@extends('layouts.layout-horizontal') @section('title', 'Purchase Bills') @section('css') @include('partials._index-table-styles') @endsection @section('content') @php $showTaxColumns = ($companyMode ?? 'bill') !== 'cash'; @endphp
{{-- Compact header --}}
Purchase Bills
{{ $purchases->count() }} bills New Purchase @if(($companyMode ?? 'bill') === 'cash') Overseas Purchase @endif
@if($showTaxColumns) @endif @php $avatarColors = ['#6366f1','#ec4899','#f59e0b','#10b981','#3b82f6','#8b5cf6','#ef4444','#14b8a6','#f97316','#06b6d4']; $grouped = $purchases->groupBy(fn($s) => $s->invoice_date->format('Y-m-d')); @endphp @forelse ($grouped as $date => $datePurchases) {{-- Date group header --}} @php $dateObj = \Carbon\Carbon::parse($date); $dateLabel = $dateObj->isToday() ? 'Today' : ($dateObj->isYesterday() ? 'Yesterday' : $dateObj->format('d M Y')); $dayTotal = $datePurchases->sum('grand_total'); @endphp @foreach ($datePurchases as $purchase) @php $initial = strtoupper(substr($purchase->party?->name ?? '?', 0, 1)); $colorIdx = ($purchase->party_id ?? 0) % count($avatarColors); @endphp @if($showTaxColumns) @endif @endforeach @empty @endforelse @if ($purchases->count()) @if($showTaxColumns) @endif @endif
Party Bill No Mode AmountTaxGrand Total Actions
{{ $dateLabel }} ({{ $datePurchases->count() }}) ₹{{ indian_number($dayTotal, 2) }}
{{ $initial }} {{ $purchase->party?->name ?? '—' }}
{{ $purchase->bill_no ?: '—' }} {{ ucfirst($purchase->mode) }} {{ indian_number($purchase->amount_total, 2) }}{{ indian_number($purchase->tax_total, 2) }}₹{{ indian_number($purchase->grand_total, 2) }}
@if($purchase->mode === 'cash' && ($purchase->items_count ?? 0) > 0) @endif @if(auth()->user()->role === 'admin') @endif
@include('partials._empty-state', [ 'icon' => 'ph-note', 'title' => 'No purchase bills yet', 'subtitle' => 'Create your first purchase bill.', 'action' => route('purchase.create'), 'actionLabel' => 'Create Purchase', ])
{{ $purchases->count() }} bills {{ indian_number($purchases->sum('amount_total'), 2) }}{{ indian_number($purchases->sum('tax_total'), 2) }}₹{{ indian_number($purchases->sum('grand_total'), 2) }}
{{-- Quick Add Payment Modal --}} @endsection @push('scripts') @endpush