@extends('layouts.admin')
@section('title', $configuration['title'])
@section('content')
<nav><ol class="breadcrumb small"><li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">Dashboard</a></li><li class="breadcrumb-item active">{{ $configuration['title'] }}</li></ol></nav>
<div class="d-flex flex-wrap justify-content-between align-items-center gap-3 mb-4"><div><h1 class="h3 fw-bold mb-1"><i class="bi {{ $configuration['icon'] }} text-primary me-2"></i>{{ $configuration['title'] }}</h1><p class="text-secondary mb-0">Search, filter and review platform records.</p></div><button class="btn btn-outline-secondary" onclick="window.print()"><i class="bi bi-printer me-1"></i>Print</button></div>
<div class="card panel mb-4"><div class="card-body"><form class="row g-3 align-items-end" method="GET"><div class="col-md-7"><label class="form-label small fw-semibold" for="moduleSearch">Search</label><div class="input-group"><span class="input-group-text bg-transparent"><i class="bi bi-search"></i></span><input id="moduleSearch" class="form-control" name="search" value="{{ request('search') }}" placeholder="Search {{ strtolower($configuration['title']) }}..."></div></div>@if($statuses->isNotEmpty())<div class="col-md-3"><label class="form-label small fw-semibold" for="statusFilter">Status</label><select id="statusFilter" class="form-select" name="status"><option value="">All statuses</option>@foreach($statuses as $status)<option value="{{ $status }}" @selected(request('status')===$status)>{{ ucfirst(str_replace('_',' ',$status)) }}</option>@endforeach</select></div>@endif<div class="col-md-2 d-grid"><button class="btn btn-dark"><i class="bi bi-funnel me-1"></i>Apply</button></div></form></div></div>
<div class="card panel"><div class="card-body p-0"><div class="d-flex justify-content-between px-4 py-3 border-bottom"><strong>{{ number_format($records->total()) }} records</strong><span class="small text-secondary">Page {{ $records->currentPage() }} of {{ max(1,$records->lastPage()) }}</span></div><div class="table-responsive"><table class="table table-hover align-middle mb-0"><thead class="table-light"><tr>@foreach($columns as $column)<th class="text-nowrap px-4 py-3">{{ ucwords(str_replace('_',' ',$column)) }}</th>@endforeach</tr></thead><tbody>
@forelse($records as $record)<tr>@foreach($columns as $column)@php($value=$record->{$column})<td class="px-4 text-nowrap">@if(in_array($column,['status','risk_level','priority','payment_status'],true))<span class="badge rounded-pill text-bg-secondary">{{ ucfirst(str_replace('_',' ',(string)$value)) }}</span>@elseif(in_array($column,['is_premium','is_public','is_system'],true))<i class="bi {{ $value?'bi-check-circle-fill text-success':'bi-dash-circle text-secondary' }}"></i>@elseif(str_contains($column,'amount'))₹{{ number_format((float)$value,2) }}@else<span title="{{ $value }}">{{ \Illuminate\Support\Str::limit((string)($value ?? '—'),36) }}</span>@endif</td>@endforeach</tr>@empty<tr><td colspan="{{ count($columns) }}"><div class="text-center py-5"><i class="bi {{ $configuration['icon'] }} fs-1 text-secondary opacity-50"></i><h2 class="h6 mt-3">No records found</h2><p class="text-secondary small mb-0">Records will appear here when data is added.</p></div></td></tr>@endforelse
</tbody></table></div>@if($records->hasPages())<div class="px-4 py-3 border-top">{{ $records->links() }}</div>@endif</div></div>
@endsection
