@extends('layouts.dashboard') @section('content') @include('customers._theme')
@if(session('success'))
✅ {{ session('success') }}
@endif @if($errors->has('review'))
{{ $errors->first('review') }}
@endif
Customer onboarding
{{ str_replace('_', ' ', strtoupper($customer->approval_status ?? 'APPROVED')) }} @php $displayAccountType = $customer->approval_status === 'approved' ? ($customer->account_type ?? 'on_account') : ($customer->requested_account_type ?? 'on_account'); @endphp {{ $customer->approval_status === 'approved' ? 'FINAL' : 'REQUESTED' }} {{ $displayAccountType === 'on_account' ? 'ON ACCOUNT' : 'CASH' }} {{ $customer->customer_code ?: $customer->application_number }} {{ count($customer->profileMissingInformation()) ? 'PROFILE INCOMPLETE' : 'PROFILE COMPLETE' }}
@if($customer->changes_requested_reason)

Changes requested: {{ $customer->changes_requested_reason }}

@endif @if($customer->rejection_reason)

Rejected: {{ $customer->rejection_reason }}

@endif
@if(auth()->user()->canManageOperations() && in_array($customer->approval_status, ['submitted', 'under_review']))
@if($customer->approval_status === 'submitted')
@csrf
@endif
@csrf
Final account type: {{ $customer->requested_account_type === 'cash' ? 'CASH (no credit approval)' : 'ON ACCOUNT (credit approval)' }}
@if($customer->requested_account_type !== 'cash')
@endif
@csrf
@csrf
@endif
@if(true)
Application data

Onboarding Review

@if(auth()->user()->canManageOperations())Customer Applications@endif
Application
{{ $customer->application_number ?: 'Legacy / Not Provided' }}
Shop
{{ $customer->shop_name }}
Owner
{{ $customer->owner_name ?: '—' }}
Owner Phone
{{ $customer->owner_phone ?: '—' }}
Salesman
{{ $customer->salesman?->name ?: '—' }}
Territory
{{ $customer->area?->name ?: '—' }}
Requested Account
{{ $customer->requested_account_type === 'on_account' ? 'On Account' : 'Cash' }}
Final Account
{{ $customer->approval_status === 'approved' ? ($customer->account_type === 'on_account' ? 'On Account' : 'Cash') : 'Pending decision' }}
Trade License
{{ $customer->trade_license_number ?: '—' }}
License Expiry
{{ $customer->trade_license_expiry?->format('d M Y') ?: '—' }}
VAT / TRN
{{ $customer->vat_registered ? ($customer->trn ?: 'Registered') : 'Not registered' }}
Profile
{{ count($customer->profileMissingInformation()) ? 'Missing: '.implode(', ', $customer->profileMissingInformation()) : 'Complete' }}
ID Holder Type
{{ $customer->id_holder_type ?: '—' }}
ID Expiry
{{ $customer->id_expiry?->format('d M Y') ?: '—' }}
Location
{{ $customer->google_maps_url ?: (($customer->latitude && $customer->longitude) ? $customer->latitude.', '.$customer->longitude : 'Not Provided') }}
Submitted
{{ $customer->submitted_at?->format('d M Y H:i') ?: 'Not submitted' }}
Address
{{ $customer->address ?: '—' }}
Salesman Notes
{{ $customer->salesman_notes ?: '—' }}
Protected files

Documents

@forelse($customer->documents->sortByDesc('id') as $document) @empty @endforelse
TypeFilenameUploadedExpiryVersion
{{ match($document->document_type) { 'trade_license' => 'Trade License', 'owner_id' => 'Owner / Contact ID', 'vat_certificate' => 'VAT Certificate', 'security_cheque' => 'Security Cheque', default => ucwords(str_replace('_', ' ', $document->document_type)) } }} {{ $document->original_name }} {{ $document->created_at?->format('d M Y H:i') ?: '—' }} {{ $document->expires_at?->format('d M Y') ?: ($document->document_type === 'trade_license' ? ($customer->trade_license_expiry?->format('d M Y') ?: '—') : ($document->document_type === 'owner_id' ? ($customer->id_expiry?->format('d M Y') ?: '—') : '—')) }} v{{ $document->version }} @if($document->is_current)Current@endif View / Download
No documents uploaded.
@endif @if(($customer->requested_account_type ?? $customer->account_type) === 'on_account') @php $securityCheque = $customer->documents ->where('document_type', 'security_cheque') ->firstWhere('is_current', true); @endphp
Credit security

Security Cheque

{{ $securityCheque ? ($customer->security_cheque_undated ? 'UNDATED' : 'DATED') : 'NOT PROVIDED' }}
Bank
{{ $customer->security_cheque_bank_name ?: '—' }}
Cheque Number
{{ $customer->security_cheque_number ?: '—' }}
Account Holder
{{ $customer->security_cheque_account_holder ?: '—' }}
Amount
{{ $customer->security_cheque_amount !== null ? 'AED '.number_format((float) $customer->security_cheque_amount, 2) : '—' }}
Cheque Date
{{ $customer->security_cheque_date?->format('d M Y') ?: ($customer->security_cheque_undated ? 'Not required (undated)' : 'Missing date') }}
Notes
{{ $customer->security_cheque_notes ?: '—' }}
@if($securityCheque) View secure cheque document @else
Security cheque: Not Provided. This does not block an existing active customer.
@endif
@endif
← Back to Customers

{{ $customer->shop_name }}

{{ ucfirst($customer->status) }}

{{ $customer->customer_code }}

Orders Returns @if($customer->phone) 📞 Call @endif @if($customer->whatsapp) @php $whatsapp = preg_replace('/\D+/', '', $customer->whatsapp); @endphp 💬 WhatsApp @endif ✏️ Edit
Orders
{{ number_format($orderStats['all']) }}
Draft Orders
{{ number_format($orderStats['draft']) }}
Confirmed Orders
{{ number_format($orderStats['confirmed']) }}
Confirmed Sales
AED {{ number_format($orderStats['sales_total'], 2) }}

🧾 Recent Orders

@forelse($customer->orders as $order) @empty @endforelse
Order Status Items Total Date
{{ $order->order_number }} {{ ucfirst($order->status) }} {{ $order->items_count }} AED {{ number_format((float) $order->grand_total, 2) }} {{ $order->created_at?->format('d M Y') }} Open
No linked orders yet.
@if($customer->notes)

📝 Notes

{{ $customer->notes }}
@endif

👤 Contact

Contact Person
{{ $customer->contact_person ?: '—' }}
Phone
{{ $customer->phone ?: '—' }}
Email
{{ $customer->email ?: '—' }}

📍 Assignment & Location

Salesman
{{ $customer->salesman?->name ?: 'Unassigned' }}
Area
{{ $customer->area?->name ?: '—' }}
City
{{ $customer->city ?: '—' }}
Address
{{ $customer->address ?: '—' }}
@if($customer->google_maps_url) 🗺 Open Google Maps @elseif($customer->latitude && $customer->longitude) 🗺 Open Coordinates @endif

💳 Credit

Opening Balance
AED {{ number_format((float) $customer->opening_balance, 2) }}
Credit Limit
{{ $customer->credit_limit !== null ? 'AED '.number_format((float) $customer->credit_limit, 2) : '—' }}
Credit Days
{{ $customer->credit_days !== null ? $customer->credit_days.' days' : '—' }}
@if(auth()->user()->canManageOperations() && in_array($customer->approval_status, ['submitted', 'under_review'])) @endif @endsection