@php use Illuminate\Support\Str; function formatIndianCurrency($amount) { $amount = (float) $amount; $decimal = number_format($amount, 2, '.', ''); $exploded = explode('.', $decimal); $last3 = substr($exploded[0], -3); $restUnits = substr($exploded[0], 0, -3); if ($restUnits != '') { $restUnits = preg_replace("/\B(?=(\d{2})+(?!\d))/", ",", $restUnits); } return '₹' . $restUnits . $last3 . '.' . $exploded[1]; } @endphp @extends('layouts.sales.sales') @section('title', 'Quotes') @section('content') @php $activeTab = request('tab', 'active'); @endphp
All Quotes
{{-- ── Tabs ── --}}
{{-- Search / filter form — keeps current tab --}}
{{-- ── Tab panes ── --}}
{{-- ════ ACTIVE QUOTES ════ --}}
@foreach($active as $a) @endforeach
Quote No Client Name Factory Name Factory Location Status Estimated Quote Action
{{ strtoupper(substr($a->state_code, 0, 2)) }}-{{ date('y') }}-{{ str_pad($a->id, 3, '0', STR_PAD_LEFT) }} {{ $a->name }} {{ $a->title ?? 'N/A' }} {{ Str::limit($a->location, 20) }} {{ $a->status == 'converted' ? 'Active' : ucfirst($a->status) }} @if(!empty($a->estimate_cost)) {{ formatIndianCurrency($a->estimate_cost) }} @else N/A @endif {{-- Pass return_tab so the detail page knows where to go back --}} View
{{-- ════ PENDING QUOTES ════ --}}
@foreach($pending as $pd) @endforeach
Quote No Client Name Factory Name Factory Location Status Final Quote Value Action
{{ strtoupper(substr($pd->state_code, 0, 2)) }}-{{ date('y') }}-{{ str_pad($pd->id, 3, '0', STR_PAD_LEFT) }} {{ $pd->name }} {{ $pd->title }} {{ $pd->location }} Pending @if(!empty($pd->project->project_cost)) {{ formatIndianCurrency($pd->project->project_cost) }} @else N/A @endif View
{{-- ════ ACTIVE JOBS (In Progress) ════ --}}
@foreach($inProgress as $project) @endforeach
Quote No Client Name Factory Location Status Action
@if($project->quotation) {{ strtoupper(substr($project->quotation->state_code, 0, 2)) }}-{{ date('y') }}-{{ str_pad($project->quotation->id, 3, '0', STR_PAD_LEFT) }} @else No Quote Linked @endif {{ $project->client_name }} {{ $project->location }} {{ $project->staff->pluck('name')->implode(', ') }} In Progress @if($project->quotation_id) View Chat @else @endif
{{-- ════ COMPLETED ════ --}}
@foreach($delivered as $d) @endforeach
Quote No Client Name Project Name Location Start Date End Date Status Team Assigned Payment Status
{{ strtoupper(substr($d->state_code, 0, 2)) }}-{{ date('y') }}-{{ str_pad($d->id, 3, '0', STR_PAD_LEFT) }} {{ $d->client_name }} {{ $d->project_name }} {{ $d->location }} {{ \Carbon\Carbon::parse($d->start_date)->format('d/m/Y') }} {{ \Carbon\Carbon::parse($d->end_date)->format('d/m/Y') }} Completed {{ $d->team_assigned }} {{ $d->payment_status }}
{{-- ════ LOST DEALS ════ --}}
@foreach($lostDeals as $lost) @endforeach
Quote Id Client Name Location Quote Date Status Reason
#{{ $lost->id }} {{ $lost->name }} {{ $lost->location }} {{ \Carbon\Carbon::parse($lost->quote_date)->format('d/m/Y') }} Lost {{ $lost->rejection_reason }}
{{-- .tab-content --}} {{-- Pagination --}}
Rows per page: {{ $active->perPage() }}    {{ $active->firstItem() }}–{{ $active->lastItem() }} of {{ $active->total() }}
{{ $active->links('pagination::bootstrap-5') }}
@endsection