@extends('layouts.app') @section('content')

Customer Master Registry

Manage your master customer profiles database, unique contact entries, and demographic insights.

Add New Profile
Total Master Records in Database: {{ $customers->total() }}
{{-- 🟢 Success Alert Session Node --}} @if(session('success'))
{{ session('success') }}
@endif {{-- 🔴 Critical/Database Error Alert Session Node --}} @if(session('error'))
{{ session('error') }}
@endif
@if(request('search')) Clear @endif
{{-- 📍 ADDED: Structural Billing Columns --}} @forelse($customers as $index => $customer) @php // Fetch the latest linked bill invoice for this specific customer $latestBill = $customer->bills->last(); @endphp {{-- 📍 Live Relationship Data Injection --}} @empty @endforelse
Sr. No. Customer Name Contact Number Home CityLatest Bill Purchase Date Actions
{{ $customers->firstItem() + $index }} {{ $customer->name }} @if($customer->notes) @endif {{ $customer->contact }} {{ $customer->city }} ₹{{ $latestBill ? number_format($latestBill->bill_amount, 2) : '0.00' }} {{ $latestBill ? \Carbon\Carbon::parse($latestBill->purchase_date)->format('d M, Y') : 'N/A' }}
@csrf @method('DELETE')
No customer master profiles found.
{{ $customers->appends(request()->query())->links('pagination::bootstrap-5') }}
@endsection