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

All Customer

@if(isset($isSuperOrSubAdmin) && $isSuperOrSubAdmin && isset($tenants))
@endif
Export @if($permission['create']) Add @endif @if($permission['destroy']) Delete @endif
{{-- --}} @if(isset($data) && count($data) > 0) @foreach($data as $customer) {{-- Address column hidden --}} @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 Tenant Phone EmailAddressStatus 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'] ?? '' }} @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']) View @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 @if(isset($canBlockCustomers) && $canBlockCustomers && $customer['id'] != auth()->id()) @if(isset($customer['status']) && $customer['status'] == 1) @else @endif @endif
No Customers Found.
@include('admin.components.pagination') @endsection @push('page_script') @endpush