<x-app-layout><x-slot name="header"><div class="d-flex flex-wrap justify-content-between align-items-center gap-2"><div><h2 class="h4 mb-0">BTRC Subscriber Report</h2><p class="text-muted mb-0">Regulatory subscriber, identity, connection and bandwidth information</p></div><div class="d-flex gap-2"><a href="{{ route('admin.reports.btrc.export',request()->query()) }}" class="btn btn-success">Export CSV</a><button onclick="window.print()" class="btn btn-outline-secondary">Print</button></div></div></x-slot>
<form class="card border-0 shadow-sm mb-4 d-print-none"><div class="card-body row g-3 align-items-end"><div class="col-md-2"><label class="form-label">Connected from</label><input type="date" name="from" value="{{ $filters['from']??'' }}" class="form-control"></div><div class="col-md-2"><label class="form-label">Connected to</label><input type="date" name="to" value="{{ $filters['to']??'' }}" class="form-control"></div><div class="col-md-2"><label class="form-label">Status</label><select name="status" class="form-select"><option value="">All</option><option value="active" @selected(($filters['status']??'')==='active')>Active</option><option value="inactive" @selected(($filters['status']??'')==='inactive')>Inactive</option></select></div><div class="col-md-2"><label class="form-label">Zone</label><select name="zone" class="form-select"><option value="">All</option>@foreach($zones as $zone)<option @selected(($filters['zone']??'')===$zone)>{{ $zone }}</option>@endforeach</select></div><div class="col-md-2"><label class="form-label">Package</label><select name="package_id" class="form-select"><option value="">All</option>@foreach($packages as $package)<option value="{{ $package->id }}" @selected(($filters['package_id']??'')==$package->id)>{{ $package->name }}</option>@endforeach</select></div><div class="col-md-2"><label class="form-label">Search</label><input name="search" value="{{ $filters['search']??'' }}" class="form-control" placeholder="ID/name/mobile/IP"></div><div class="col-12"><button class="btn btn-primary">Generate report</button><a href="{{ route('admin.reports.btrc') }}" class="btn btn-outline-secondary">Reset</a></div></div></form>
<div class="row g-3 mb-4"><div class="col-6 col-lg-3"><div class="card border-0 shadow-sm"><div class="card-body"><small>Total Subscribers</small><h3>{{ number_format($summary['total']) }}</h3></div></div></div><div class="col-6 col-lg-3"><div class="card border-0 shadow-sm"><div class="card-body"><small>Active</small><h3 class="text-success">{{ number_format($summary['active']) }}</h3></div></div></div><div class="col-6 col-lg-3"><div class="card border-0 shadow-sm"><div class="card-body"><small>Inactive</small><h3 class="text-danger">{{ number_format($summary['inactive']) }}</h3></div></div></div><div class="col-6 col-lg-3"><div class="card border-0 shadow-sm"><div class="card-body"><small>Monthly Billing</small><h3>@money($summary['monthly_revenue'])</h3></div></div></div></div>
<div class="card border-0 shadow-sm"><div class="table-responsive"><table class="table table-sm table-bordered align-middle mb-0" style="min-width:1500px"><thead><tr><th>SL</th><th>Customer ID</th><th>Subscriber</th><th>Mobile</th><th>NID</th><th>Address</th><th>Zone</th><th>Package</th><th>Bandwidth</th><th>IP</th><th>Type</th><th>Connected</th><th>Status</th><th>MikroTik</th><th>ONU MAC</th></tr></thead><tbody>@forelse($customers as $customer)<tr><td>{{ $customers->firstItem()+$loop->index }}</td><td>{{ $customer->customer_code }}</td><td>{{ $customer->name }}</td><td>{{ $customer->contact_phone }}</td><td>{{ $customer->national_id ?: '-' }}</td><td>{{ $customer->office_address ?: '-' }}</td><td>{{ $customer->zone ?: '-' }}</td><td>{{ $customer->package?->name ?? '-' }}</td><td>{{ $customer->package?->net_speed ?? '-' }}</td><td>{{ $customer->ip_address ?: '-' }}</td><td>{{ $customer->connection_type ?: '-' }}</td><td>{{ $customer->connection_date?->format('Y-m-d') ?? '-' }}</td><td><span class="badge {{ $customer->status==1?'bg-success':'bg-danger' }}">{{ $customer->status==1?'Active':'Inactive' }}</span></td><td>{{ $customer->mikrotik?->name ?? '-' }}</td><td>{{ $customer->onumac ?: '-' }}</td></tr>@empty<tr><td colspan="15" class="text-center py-4">No subscribers found.</td></tr>@endforelse</tbody></table></div><div class="card-footer bg-white d-print-none">{{ $customers->links() }}</div></div>
</x-app-layout>
