Works Order Report

@if($from || $to)

Period: {{ $from ? \Carbon\Carbon::parse($from)->format('d M Y') : 'All' }} {{ ($from && $to) ? ' — ' : '' }} {{ $to ? \Carbon\Carbon::parse($to)->format('d M Y') : '' }}  ·  Total: {{ $worksOrders->count() }} works order{{ $worksOrders->count() !== 1 ? 's' : '' }}

@endif @forelse($worksOrders as $wo)
{{ $wo->order_number }} {{ $wo->statusLabel() }}
Job: {{ $wo->job?->job_number ?? '—' }}  ·  {{ $wo->job?->contact?->full_name ?? '—' }}  ·  {{ $wo->job?->site_suburb ?? '' }}  ·  Type: {{ $wo->works_order_type ?? '—' }}
Issued Date
{{ $wo->issued_date?->format('d M Y') ?? '—' }}
Manufacture Date
{{ $wo->manufacture_date?->format('d M Y') ?? '—' }}
Delivery Date
{{ $wo->delivery_date?->format('d M Y') ?? '—' }}
Target Completion
{{ $wo->target_completion?->format('d M Y') ?? '—' }}
@if($wo->scope_of_works)
Scope: {{ $wo->scope_of_works }}
@endif @if($wo->special_instructions)
Special Instructions: {{ $wo->special_instructions }}
@endif @if($wo->items->isNotEmpty()) @foreach($wo->items as $item) @endforeach
# Description Trade Assignee Est. Hrs Status
{{ $loop->iteration }} {{ $item->description }} {{ \App\Models\WorksOrderItem::tradeLabel($item->trade) }} {{ $item->assignee?->name ?? '—' }} {{ $item->estimated_hours ?? '—' }} {{ ucfirst(str_replace('_',' ',$item->status)) }}
@else
No line items recorded.
@endif @if($wo->faults->isNotEmpty())
FAULT ITEMS ({{ $wo->faults->count() }}) — Total cost: ${{ number_format($wo->totalFaultCost()) }}
@foreach($wo->faults as $fault)
{{ $fault->fault_number }} · {{ $fault->fault_type ?? 'Fault' }} ${{ number_format($fault->cost ?? 0) }}
@endforeach
@endif @if($wo->notes)
Notes: {{ $wo->notes }}
@endif
@empty

No works orders found for the selected criteria.

@endforelse