@extends('layouts.app')

@section('title', 'Transport')

@section('content')
    <x-page-head title="Transport" subtitle="Buses & routes">
        <x-slot:actions><a href="{{ route('extras.transport.create') }}" class="btn btn-primary">New Route</a></x-slot:actions>
    </x-page-head>
    <x-panel>
        @if ($routes->isEmpty())
            <x-empty-state title="No routes configured" message="Add transport routes for student assignments." />
        @else
            <div class="table-wrap">
                <table>
                    <thead><tr><th>Code</th><th>Name</th><th>Fare</th><th>Status</th><th></th></tr></thead>
                    <tbody>
                        @foreach ($routes as $route)
                            <tr>
                                <td>{{ $route->code }}</td>
                                <td>{{ $route->name }}</td>
                                <td>{{ number_format($route->fare_amount, 2) }}</td>
                                <td><x-badge variant="blue">{{ $route->status }}</x-badge></td>
                                <td class="text-right"><a href="{{ route('extras.transport.edit', $route) }}" class="btn btn-ghost btn-sm">Edit</a></td>
                            </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
            <div style="margin-top:16px;">{{ $routes->links() }}</div>
        @endif
    </x-panel>
@endsection
