@extends('garage.layouts.app') @section('title', 'View Estimate') @section('content')
Estimate Details
@if($estimate->status === 'draft') Edit @endif @if(!empty($hasDocumentServices)) Service reminder @endif Back to List
Estimate Number: {{ $estimate->estimate_number }}
Estimate Date: {{ \Carbon\Carbon::parse($estimate->estimate_date)->format('M d, Y') }}
Expiry Date: {{ $estimate->expiry_date ? \Carbon\Carbon::parse($estimate->expiry_date)->format('M d, Y') : '-' }}
Reference Number: {{ $estimate->reference_number ?? '-' }}
Status: @php $statusColors = [ 'draft' => 'secondary', 'sent' => 'info', 'accepted' => 'success', 'rejected' => 'danger', 'expired' => 'warning', 'converted' => 'primary' ]; $statusColor = $statusColors[$estimate->status] ?? 'secondary'; @endphp {{ ucfirst($estimate->status) }}
@if(!empty($hasDocumentServices)) @endif
Customer:
{{ $estimate->customer_name ?? '-' }} @if(!empty($estimate->customer_ledger_id)) Ledger statement @endif
Vehicle: @if($estimate->vehicle_registration) {{ $estimate->vehicle_registration }} @if(!empty($estimate->vehicle_id)) @php $subLedgerId = null; try { $sl = \Illuminate\Support\Facades\DB::table('garage_sub_ledgers') ->where('garage_id', auth('garage_admin')->user()->garage_id) ->whereNull('deleted_at') ->where('vehicle_id', (int) $estimate->vehicle_id) ->first(['id']); $subLedgerId = $sl?->id; } catch (\Throwable $e) { $subLedgerId = null; } @endphp @if($subLedgerId) @endif @endif @if($estimate->vehicle_make && $estimate->vehicle_model) ({{ $estimate->vehicle_make }} {{ $estimate->vehicle_model }}) @endif @else - @endif
Current reading: @if(!empty($estimate->meter_reading)) {{ \App\Support\GarageMeterReading::format($estimate->meter_reading) }} km @else @endif
Next reading: @if(!empty($estimate->next_meter_reading)) {{ \App\Support\GarageMeterReading::format($estimate->next_meter_reading) }} km @else @endif
Next service date: @if(!empty($estimate->next_service_date)) {{ \Carbon\Carbon::parse($estimate->next_service_date)->format('d M Y') }} @else @endif
Subtotal: PKR {{ number_format($estimate->subtotal, 2) }}
Tax Amount: PKR {{ number_format($estimate->tax_amount, 2) }}
Discount: PKR {{ number_format($estimate->discount_amount, 2) }}
Total Amount: PKR {{ number_format($estimate->total_amount, 2) }}
@if($estimate->customer_notes || $estimate->internal_notes)
@if($estimate->customer_notes)
Customer Notes

{{ nl2br(e($estimate->customer_notes)) }}

@endif @if($estimate->internal_notes)
Internal Notes

{{ nl2br(e($estimate->internal_notes)) }}

@endif
@endif
Estimate Items
@foreach($items as $index => $item) @endforeach @if(isset($estimate->freight_amount) && (float) $estimate->freight_amount > 0) @endif
# Item Type Qty Unit Price Discount Tax % Tax Amount Total
{{ $index + 1 }}
{{ $item->part_name ?? $item->labor_name ?? $item->service_group_name ?? $item->garage_service_name ?? $item->description ?? '-' }}
@if($item->notes) {{ $item->notes }} @endif
{{ ucfirst(str_replace('_', ' ', $item->item_type)) }} @if($item->item_type === 'garage_service' && isset($item->service_hours) && $item->service_hours !== null) {{ rtrim(rtrim(number_format((float) $item->service_hours, 2, '.', ''), '0'), '.') }} hrs @else {{ $item->quantity }} @endif PKR {{ number_format($item->unit_price, 2) }} PKR {{ number_format($item->discount_amount, 2) }} {{ number_format($item->tax_rate, 2) }}% PKR {{ number_format($item->tax_amount, 2) }} PKR {{ number_format($item->total_price, 2) }}
Subtotal: PKR {{ number_format($estimate->subtotal, 2) }}
Tax: PKR {{ number_format($estimate->tax_amount, 2) }}
Discount: @if(($estimate->discount_type ?? 'fixed') === 'percentage') {{ rtrim(rtrim(number_format((float) $estimate->discount_amount, 2, '.', ''), '0'), '.') }}% @else PKR {{ number_format((float) $estimate->discount_amount, 2) }} @endif
Freight: PKR {{ number_format($estimate->freight_amount, 2) }}
Total: PKR {{ number_format($estimate->total_amount, 2) }}
@include('garage.partials.vehicle-mileage-history', [ 'mileageTimeline' => $mileageTimeline ?? collect(), 'vehicleOdometer' => $vehicleOdometer ?? null, ])
Back to List @if($estimate->status === 'draft') Edit Estimate @endif
@endsection