@extends('layouts.app')
@section('title', 'Paketler')
@section('content')
<div class="flex justify-between items-center mb-4">
    <form method="GET" class="flex gap-2">
        <select name="company_id" class="border rounded px-3 py-1.5 text-sm">
            <option value="">Tüm Firmalar</option>
            @foreach ($companies as $c)
                <option value="{{ $c->id }}" @selected(request('company_id')==$c->id)>{{ $c->name }}</option>
            @endforeach
        </select>
        <button class="bg-slate-800 text-white rounded px-4 py-1.5 text-sm">Filtrele</button>
    </form>
    @can('create', App\Models\Package::class)
        <a href="{{ route('panel.packages.create') }}" class="bg-blue-600 text-white rounded px-4 py-2 text-sm font-medium">+ Yeni Paket</a>
    @endcan
</div>
<div class="bg-white rounded shadow overflow-x-auto">
    <table class="w-full text-sm">
        <thead class="bg-slate-100 text-left"><tr><th class="p-3">Firma</th><th class="p-3">Paket</th><th class="p-3">Hız</th><th class="p-3">Aylık Ücret</th><th class="p-3">Durum</th><th class="p-3">İşlem</th></tr></thead>
        <tbody>
        @foreach ($packages as $package)
            <tr class="border-t">
                <td class="p-3">{{ $package->company->name }}</td>
                <td class="p-3">{{ $package->name }}</td>
                <td class="p-3">{{ $package->speed }}</td>
                <td class="p-3">{{ number_format($package->monthly_fee,2,',','.') }} TL</td>
                <td class="p-3">{{ $package->status==='active' ? 'Aktif':'Pasif' }}</td>
                <td class="p-3 flex gap-2">
                    <a href="{{ route('panel.packages.show', $package) }}" class="text-blue-600 hover:underline">Görüntüle</a>
                    <a href="{{ route('panel.packages.edit', $package) }}" class="text-slate-600 hover:underline">Düzenle</a>
                </td>
            </tr>
        @endforeach
        </tbody>
    </table>
</div>
<div class="mt-4">{{ $packages->links() }}</div>
@endsection
