@extends('garage.layouts.app') @section('title', 'Dashboard') @push('styles') @include('garage.dashboard.partials.dashboard-ui') @endpush @section('content') @php $fmtMoney = fn ($n) => number_format((float) ($n ?? 0), 2); $fmtInt = fn ($n) => number_format((int) ($n ?? 0)); $limit = (int) ($cardLimit ?? 4); $statusClass = function ($status) { $s = str_replace(' ', '_', strtolower((string) $status)); return match ($s) { 'in_progress' => 'is-progress', 'completed', 'posted' => 'is-done', 'on_hold' => 'is-hold', 'cancelled' => 'is-danger', 'overdue' => 'is-danger', 'due_soon' => 'is-warn', default => 'is-draft', }; }; $statusLabel = fn ($s) => ucwords(str_replace('_', ' ', (string) $s)); $voucherTypeLabel = function ($t) { return match ((string) $t) { 'journal' => 'Journal', 'receipt' => 'Receipt', 'payment' => 'Payment', 'contra' => 'Contra', default => strtoupper((string) $t), }; }; $servicePreview = ($serviceDueAlerts ?? collect())->take($limit); $ordersPreview = ($repairOrders ?? collect())->take($limit); $jobsPreview = ($pendingJobCards ?? collect())->take($limit); $vouchersPreview = ($vouchers ?? collect())->take($limit); $ordersListUrl = route('garage.repair-orders.index'); $jobsListUrl = route('garage.work-orders.index', [ 'from_date' => $fromDate, 'to_date' => $toDate, ]); $vouchersListUrl = route('garage.vouchers.index', [ 'from_date' => $fromDate, 'to_date' => $toDate, ]); $vouchersDraftUrl = route('garage.vouchers.index', [ 'from_date' => $fromDate, 'to_date' => $toDate, 'status' => 'draft', ]); $salesListUrl = route('garage.sales.index'); @endphp

Operations overview

@if($garage){{ $garage->name }} · @endif {{ date('d M Y', strtotime($fromDate)) }}@if($fromDate !== $toDate) – {{ date('d M Y', strtotime($toDate)) }}@endif

@if(!empty($lowStockCount)) {{ $fmtInt($lowStockCount) }} low stock @endif
Today

Service reminders

{{ $fmtInt($serviceDueTotal ?? 0) }}
@forelse($servicePreview as $alert) @empty
No service reminders for vehicles.
@endforelse

Vouchers

{{ $fmtInt(($vouchers ?? collect())->count()) }}
@if($vouchersEnabled ?? false) @forelse($vouchersPreview as $v) {{ $v->voucher_no }} {{ $voucherTypeLabel($v->voucher_type) }} · {{ $v->voucher_date }} · PKR {{ $fmtMoney($v->total_amount ?? 0) }} {{ $statusLabel($v->status) }} @empty
No vouchers in this period.
@endforelse @else
Vouchers module not enabled.
@endif
@if($vouchersEnabled && ($vouchers ?? collect())->count() > $limit) @endif
{{-- Service detail modal only (not list) --}} @endsection @push('scripts') @endpush