@extends('admin.layouts.app') @section('page-title', 'Profile Update Requests') @section('content')
@php $perPage = 5; $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

Profile Update Requests ({{ $total }})

@foreach($currentItems as $index => $req) @php $user = $req->user; // FIX: Convert string to array $newData = is_array($req->data) ? $req->data : json_decode($req->data, true); @endphp @endforeach
# User Requested Changes Status Requested At Actions
{{ ($currentPage - 1) * $perPage + $index + 1 }} {{ $user->customer_name }}
{{ $user->email }}
ID: {{ $user->customer_id }}
@foreach($newData as $key => $newValue) @php $oldValue = $user->$key ?? '—'; $changed = $oldValue != $newValue; @endphp
{{ ucfirst(str_replace('_',' ', $key)) }}:
Old: {{ $oldValue }}
New: {{ $newValue ?? '—' }}
@endforeach
@if($req->status == 'pending') Pending @elseif($req->status == 'approved') Approved @else Rejected @endif {{ $req->created_at->format('d M Y, h:i A') }} @if($req->status == 'pending') Approve Reject @else Completed @endif
@endsection