@extends('front.layouts.main') @section('title', 'Customers') @push('pageCss') @endpush @section('content')
{{-- Header --}}

Customers

{{-- Add Customer --}}
{{-- Search and Pagination Form --}}
{{-- THIS IS THE CORRECTION: Use total() for paginated collections --}} Total {{ $customers->total() }}
{{-- Customers Table --}} @if ($customers->count() > 0)
@php $currentSort = request('sort_by'); $currentOrder = request('order') === 'asc' ? 'desc' : 'asc'; @endphp {{-- @dd($customers) --}} @foreach ($customers as $customer) {{-- @dd($customer->kuaClient->name) --}} @endforeach
Name @if ($currentSort === 'full_name' || $currentSort === 'registered_company_name') @else @endif Customer Type @if ($currentSort === 'customer_type') @else @endif Client @if ($currentSort === 'client') @else @endif Product @if ($currentSort === 'product_name') @else @endif Added on @if ($currentSort === 'created_at') @else @endif Action @if ($currentSort === 'action') @else @endif
{{ $customer->full_name ? $customer->full_name : $customer->registered_company_name ?? 'N/A' }} {{ $customer->customer_type ?? 'N/A' }} {{ $customer->kuaClient->name ?? 'N/A' }} {{ $customer->kuaProduct->product_name ?? 'N/A' }} {{ \Carbon\Carbon::parse($customer->created_at)->format('d M Y') ?? 'N/A' }} visibility edit
@else
@endif {{-- --}}
@endsection @push('pageJs') @endpush