@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 | Tenant | Phone | Address | --}}Status | Actions | ||
|---|---|---|---|---|---|---|---|
|
@php
// Get first initial and full last name
$firstName = $customer['first_name'] ?? '';
$lastName = $customer['last_name'] ?? '';
$firstInitial = !empty($firstName) ? strtoupper(mb_substr($firstName, 0, 1)) : '';
$lastInitial = !empty($lastName) ? strtoupper(mb_substr($lastName, 0, 1)) : '';
// Format display: first initial + full last name (e.g., "J. Doe")
$displayName = '';
if (!empty($firstInitial) && !empty($lastName)) {
$displayName = $firstInitial . '. ' . $lastName;
} elseif (!empty($firstInitial)) {
$displayName = $firstInitial . '.';
} elseif (!empty($lastName)) {
$displayName = $lastName;
} else {
$displayName = '-';
}
// For the circle avatar, use combined initials without dots
$initialsForAvatar = strtoupper($firstInitial . $lastInitial);
if (empty($initialsForAvatar)) {
$fullName = $customer['full_name'] ?? ($firstName . ' ' . $lastName);
$initialsForAvatar = strtoupper(mb_substr(trim($fullName), 0, 1));
}
@endphp
{{ $initialsForAvatar }}
{{ $displayName }}
|
{{ $customer->tenant_name ?? 'N/A' }} | {{ \App\Helpers\Helper::formatPhone($customer['phone'] ?? '') }} | {{ $customer['email'] ?? '' }} | {{-- Address column hidden@php // Handle both object and array access for address $address = null; if (isset($customer->address)) { $address = $customer->address; } elseif (isset($customer['address'])) { $address = $customer['address']; } $addressParts = []; if ($address) { // Handle both object and array access for address attributes $line1 = is_object($address) ? ($address->address_line1 ?? '') : ($address['address_line1'] ?? ''); $line2 = is_object($address) ? ($address->address_line2 ?? '') : ($address['address_line2'] ?? ''); $city = is_object($address) ? ($address->city ?? '') : ($address['city'] ?? ''); $state = is_object($address) ? ($address->state ?? '') : ($address['state'] ?? ''); $zip = is_object($address) ? ($address->zip ?? '') : ($address['zip'] ?? ''); if (!empty($line1)) { $addressParts[] = $line1; } if (!empty($line2)) { $addressParts[] = $line2; } if (!empty($city)) { $addressParts[] = $city; } if (!empty($state)) { $addressParts[] = $state; } if (!empty($zip)) { $addressParts[] = $zip; } } $fullAddress = !empty($addressParts) ? implode(', ', $addressParts) : '-'; @endphp {{ $fullAddress }} | --}}@if(isset($customer['status']) && $customer['status'] == 1) Active @elseif(isset($customer['status']) && $customer['status'] == 2) Blocked @else Inactive @endif |
@if($permission['show'])
|
|
|
No Customers Found.
|
|||||||