@extends('admin.layouts.app') @section('page-title', 'User Requests') @section('content')
@php $perPage = 5; // ✅ FORCED to show pagination even with few records $currentPage = request()->get('page', 1); $currentPage = max(1, (int)$currentPage); $total = $requests->count(); $totalPages = ceil($total / $perPage); $currentItems = $requests->slice(($currentPage - 1) * $perPage, $perPage); @endphp

User Requests (Total: {{ $total }})

@can('request.update_profile') Profile Update Requests @if($pendingProfileUpdates > 0) {{ $pendingProfileUpdates }} @endif @endcan
{{ $requests->where('status', 'pending')->count() }} Pending {{ $requests->where('status', 'approved')->count() }} Approved {{ $requests->where('status', 'rejected')->count() }} Rejected
@forelse($currentItems as $index => $req) @empty @endforelse
# Request ID Name Company Email Mobile Address Priority Date Status Actions
{{ ($currentPage - 1) * $perPage + $index + 1 }} {{ $req->request_id }} {{ $req->customer_name }} {{ $req->company_name }} {{ $req->email }} {{ $req->mobile_no }} {{ Str::limit($req->address, 30) }} @if(strtolower($req->priority) == 'high') High @elseif(strtolower($req->priority) == 'medium') Medium @elseif(strtolower($req->priority) == 'low') Low @else {{ $req->priority ?? 'N/A' }} @endif {{ $req->date }} @if($req->status == 'approved') Approved @elseif($req->status == 'rejected') Rejected @else Pending @endif @if($req->status == 'pending') Approve Reject @else No Action @endif
No records found.
{{-- ✅ PAGINATION - WITH ARROW BUTTONS --}}
Showing {{ ($currentPage - 1) * $perPage + 1 }} to {{ min($currentPage * $perPage, $total) }} of {{ $total }} entries
{{-- Previous Page --}} @if($currentPage > 1) @else @endif {{-- Page Numbers --}}
@php $start = max(1, $currentPage - 1); $end = min($totalPages, $currentPage + 1); @endphp @if($start > 1) 1 @if($start > 2) ... @endif @endif @for($i = $start; $i <= $end; $i++) @if($i == $currentPage) {{ $i }} @else {{ $i }} @endif @endfor @if($end < $totalPages) @if($end < $totalPages - 1) ... @endif {{ $totalPages }} @endif
{{-- Next Page --}} @if($currentPage < $totalPages) @else @endif
@endsection