@extends('layouts.layout-horizontal') @section('title', 'Sales Enquiries') @section('css') @include('partials._index-table-styles') @endsection @section('content')
{{-- Compact header --}}
Sales Enquiries
{{ $enquiries->total() }} enquiries @if(auth()->user()?->role !== 'cash') New Enquiry @endif
@php $avatarColors = ['#6366f1','#ec4899','#f59e0b','#10b981','#3b82f6','#8b5cf6','#ef4444','#14b8a6','#f97316','#06b6d4']; $grouped = $enquiries->getCollection()->groupBy(fn($s) => $s->enquiry_date->format('Y-m-d')); @endphp @forelse ($grouped as $date => $dateEnquiries) {{-- Date group header --}} @php $dateObj = \Carbon\Carbon::parse($date); $dateLabel = $dateObj->isToday() ? 'Today' : ($dateObj->isYesterday() ? 'Yesterday' : $dateObj->format('d M Y')); $dayTotal = $dateEnquiries->sum('grand_total'); @endphp @foreach ($dateEnquiries as $enquiry) @php $initial = strtoupper(substr($enquiry->party?->name ?? '?', 0, 1)); $colorIdx = ($enquiry->party_id ?? 0) % count($avatarColors); @endphp @endforeach @empty @endforelse
Party Name Enquiry No Items Progress Status Total Amount Actions
{{ $dateLabel }} ({{ $dateEnquiries->count() }}) ₹{{ indian_number($dayTotal, 2) }}
{{ $initial }} {{ $enquiry->party?->name ?? '—' }}
@if(auth()->user()?->role !== 'cash') {{ $enquiry->enquiry_no }} @else {{ $enquiry->enquiry_no }} @endif {{ $enquiry->items_count }} @php $tQty = $enquiry->items->sum('qty'); $tOut = $enquiry->items->sum('outward_qty'); $pct = $tQty > 0 ? round(($tOut / $tQty) * 100) : 0; @endphp
{{ $pct }}%
@if($enquiry->status == 'open') Open @else Closed @endif ₹{{ indian_number($enquiry->grand_total, 2) }}
@if($enquiry->party && $enquiry->party->mobile) @endif
@include('partials._empty-state', [ 'icon' => 'ph-newspaper-clipping', 'title' => 'No enquiries yet', 'subtitle' => 'Create your first sale enquiry.', 'action' => route('sale-enquiries.create'), 'actionLabel' => 'Create Enquiry', ])
{{ $enquiries->links() }}
@endsection @push('scripts') @php $companyName = currentCompany()->name ?? config('app.name'); @endphp @endpush