@extends('layouts.app') @section('title', $quote->quote_number) @section('breadcrumb')Quotes {{ $quote->quote_number }}@endsection @section('content') @php $editable = $quote->status !== 'converted'; @endphp
{{-- Header --}}

{{ $quote->quote_number }}

{{ $quote->statusLabel() }}

{{ $quote->contact?->full_name }} — {{ $quote->job?->job_number }}

Edit Download PDF @if($quote->contact?->email && $editable)
@csrf
@endif
{{-- Progress Steps --}}

Quote Progress

@foreach([['Draft','draft'],['Sent','sent'],['Viewed','viewed'],['Accepted','accepted'],['Converted','converted']] as $i => [$label, $key]) @php $step = $quote->stepNumber(); @endphp
@if($i+1 < $step)@else{{ $i+1 }}@endif
{{ $label }}
@if($i < 4)
@endif @endforeach
{{-- Quote Line Items --}}

Quote Line Items

@if($editable) @endif
@if($quote->sections->isEmpty() && $editable)
No sections yet. Start by adding a material type section.
@elseif($quote->sections->isEmpty())
No line items
@endif {{-- Each Section --}} @foreach($quote->sections as $section)
{{-- Section Header --}}
{{ $section->name }} @if($editable) @endif
W/Sale: ${{ number_format($section->items->sum(fn($i)=>(float)($i->total_wsale??0)),2) }}
Retail: ${{ number_format($section->items->sum(fn($i)=>(float)($i->total_retail??0)),2) }}
@if($editable)
@csrf @method('DELETE')
@endif
{{-- Rename Section --}} @if($editable) @endif {{-- Items Table --}} @if($section->items->isNotEmpty())
@if($editable)@endif @foreach($section->items as $item) @if($editable) @endif {{-- Edit Row --}} @if($editable) @endif @endforeach
Description Item Code Unit Qty W/Sale Retail Total W/Sale Total Retail Comments
{{ $item->description }} @if($item->materialType)[{{ $item->materialType->name }}]@endif {{ $item->item_code }} {{ $item->unit }} {{ number_format($item->qty,2) }} ${{ number_format($item->wsale_price??0,2) }} ${{ number_format($item->retail_price??$item->unit_price,2) }} ${{ number_format($item->total_wsale??0,2) }} ${{ number_format($item->total_retail??$item->total,2) }} {{ $item->comments }}
@csrf @method('DELETE')
@else
No items yet. Add materials below.
@endif {{-- Add Material to Section --}} @if($editable)
@endif
@endforeach {{-- Add Section Form --}} @if($editable) @if($quote->sections->isNotEmpty())
@endif @endif {{-- Totals --}}
@php $allItems = $quote->sections->flatMap->items; $grandWsale = $allItems->sum(fn($i) => (float)($i->total_wsale ?? 0)); $grandRetail = $allItems->sum(fn($i) => (float)($i->total_retail ?? $i->total ?? 0)); $gstAmt = $grandRetail * 0.10; @endphp
Total W/Sale (Internal)${{ number_format($grandWsale,2) }}
Total Retail (Client)${{ number_format($grandRetail,2) }}
GST (10%)${{ number_format($gstAmt,2) }}
Total incl. GST ${{ number_format($grandRetail + $gstAmt,2) }}
Gross Profit ${{ number_format($grandRetail - $grandWsale,2) }}
{{-- Sidebar --}}

Quote Summary

@php $totalRetail = $quote->sections->flatMap->items->sum(fn($i)=>(float)($i->total_retail??$i->total??0)); @endphp
${{ number_format($totalRetail * 1.10,0) }}
Total inc. GST
Valid Until{{ $quote->valid_until?->format('d M Y') ?? '—' }}
Markup{{ $quote->markup_pct ?? 0 }}%
Deposit Paid {{ ($quote->deposit_paid??0)>0 ? '$'.number_format($quote->deposit_paid,2) : 'None recorded' }}
@if($quote->contact)

Client

{{ $quote->contact->initials }}
{{ $quote->contact->full_name }}
@if($quote->contact->email) {{ $quote->contact->email }} @endif
@endif
{{-- Download PDF --}} Download PDF {{-- Print View --}} Print / Preview @if($quote->contact?->email)
@csrf
@endif @if($quote->status === 'draft')
@csrf
@endif @if(in_array($quote->status, ['sent','viewed']))
@csrf
@endif @if($quote->status === 'accepted')
@csrf
@endif @if($quote->status === 'draft')
@csrf @method('DELETE')
@endif
{{-- Reports quick links --}} @if($quote->notes)

Notes

{{ $quote->notes }}

@endif
@if($editable) @endif @endsection