@extends('admin.layouts.layout') @push('page_style') @endpush @section('content')
| @php $currentSort = $currentSort ?? 'id'; $currentDirection = $currentDirection ?? 'desc'; $newDirection = ($currentSort === 'first_name' && $currentDirection === 'asc') ? 'desc' : 'asc'; @endphp Customer | Phone | 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'])
|
||
|
No Customers Found.
|
||||||