@extends('layouts.app')
@section('title', 'Weights')
@section('content')
<div class="d-flex justify-content-between align-items-center mb-3">
    <h4>Weights</h4>
    <a href="{{ route('weights.create') }}" class="btn btn-primary btn-sm"><i class="bi bi-plus"></i> Add Weight</a>
</div>
<div class="card">
    <div class="card-body p-0">
        <table class="table table-hover mb-0">
            <thead><tr><th>#</th><th>Label</th><th>Sort Order</th><th>Actions</th></tr></thead>
            <tbody>
            @forelse($weights as $w)
                <tr>
                    <td>{{ $w->id }}</td>
                    <td>{{ $w->label }}</td>
                    <td>{{ $w->sort_order }}</td>
                    <td>
                        <a href="{{ route('weights.edit', $w) }}" class="btn btn-sm btn-outline-primary">Edit</a>
                        <form action="{{ route('weights.destroy', $w) }}" method="POST" class="d-inline" onsubmit="return confirm('Delete this weight?')">
                            @csrf @method('DELETE')
                            <button class="btn btn-sm btn-outline-danger">Delete</button>
                        </form>
                    </td>
                </tr>
            @empty
                <tr><td colspan="4" class="text-center text-muted">No weights yet</td></tr>
            @endforelse
            </tbody>
        </table>
    </div>
</div>
<div class="mt-3">{{ $weights->links() }}</div>
@endsection
