@extends('admin.layouts.layout') @push('page_style') @endpush @section('content')

All Customer

Export @if($permission['create']) Add @endif @if($permission['destroy']) Delete @endif
@if(isset($data) && count($data) > 0) @foreach($data as $customer) @endforeach @else @endif
@php $currentSort = $currentSort ?? 'id'; $currentDirection = $currentDirection ?? 'desc'; $newDirection = ($currentSort === 'first_name' && $currentDirection === 'asc') ? 'desc' : 'asc'; @endphp Customer @if($currentSort === 'first_name') @if($currentDirection === 'asc') @else @endif @else @endif Phone Email Status Actions
@php // Determine display name and initials source $displayName = $customer['full_name'] ?? ($customer['first_name'] . ' ' . $customer['last_name']); $companyName = $customer['agency']['company_name'] ?? null; $agencyName = $customer['agency']['name'] ?? null; // Use company_name if available, otherwise use agency name $initials = ''; if (!empty($companyName)) { // Get first letters of each word in company name $words = explode(' ', trim($companyName)); $initials = strtoupper(mb_substr($words[0] ?? '', 0, 1) . mb_substr($words[1] ?? '', 0, 1)); } elseif (!empty($agencyName)) { // Get first letters of each word in agency name $words = explode(' ', trim($agencyName)); $initials = strtoupper(mb_substr($words[0] ?? '', 0, 1) . mb_substr($words[1] ?? '', 0, 1)); } else { // Fallback to customer name initials $initials = strtoupper(mb_substr($customer['first_name'] ?? '', 0, 1) . mb_substr($customer['last_name'] ?? '', 0, 1)); } // Ensure we have at least one character $initials = !empty(trim($initials)) ? $initials : strtoupper(mb_substr($displayName, 0, 1)); @endphp
{{ $initials }}
{{ $displayName }}
{{ \App\Helpers\Helper::formatPhone($customer['phone'] ?? '') }} {{ $customer['email'] ?? '' }}
@if($permission['show']) View @endif @if(!isset($customer['email_verified_at'])) @endif @if($permission['edit']) @endif @if($permission['destroy']) {!! html()->form('DELETE', route( $routePrefix . '.destroy', $customer->id ))->attributes([ 'style' => 'display:inline', 'id' => 'delete-form-' . $customer->id ])->open() !!} {!! html()->form()->close() !!} @endif
No Customers Found.
@include('admin.components.pagination') @endsection @push('page_script') @endpush