@extends('layouts.app') @section('title', $wo->work_order_number) @section('content')

{{ $wo->work_order_number }}

{{ $wo->customer->display_name }} · {{ title_case_words($wo->type) }} · {{ title_case_words($wo->status) }} · {{ $wo->priority }}

@if ($wo->status === 'open') @elseif ($wo->status === 'assigned')
@csrf
@elseif ($wo->status === 'in_progress') @endif @if (! in_array($wo->status, ['completed', 'cancelled'])) @endif
@include('components.kpi', ['label' => 'Status', 'value' => title_case_words($wo->status), 'variant' => $wo->status === 'completed' ? 'good' : ($wo->status === 'cancelled' ? 'bad' : 'warn'), 'href' => '#']) @include('components.kpi', ['label' => 'Technician', 'value' => $wo->technician?->name ?? 'Unassigned', 'variant' => 'info', 'href' => '#']) @include('components.kpi', ['label' => 'Material cost', 'value' => money($wo->material_cost), 'href' => '#materials']) @include('components.kpi', ['label' => 'Scheduled', 'value' => $wo->scheduled_start?->format('d M H:i') ?? '—', 'href' => '#'])

Job detail

Job number
{{ $wo->work_order_number }}
Type
{{ title_case_words($wo->type) }}
Priority
{{ title_case_words($wo->priority) }}
Site address
{{ $wo->site_address }}
Service
@if ($wo->service) {{ $wo->service->service_number }} @else — @endif
Ticket
@if ($wo->ticket) {{ $wo->ticket->ticket_number }} @else — @endif
Technician
{{ $wo->technician?->name ?? 'Unassigned' }}
Scheduled
{{ $wo->scheduled_start?->format('d M Y H:i') ?? '—' }} – {{ $wo->scheduled_end?->format('H:i') ?? '—' }}
Started
{{ $wo->started_at?->format('d M Y H:i') ?? 'Not started' }}
Completed
{{ $wo->completed_at?->format('d M Y H:i') ?? '—' }}
Customer rating
{{ $wo->customer_rating ? str_repeat('★', $wo->customer_rating).str_repeat('☆', 5 - $wo->customer_rating) : 'Not rated' }}

Description

{{ $wo->description }}

Updates

{{ $wo->updates()->count() }} update(s)
@if ($wo->updates->isNotEmpty())
@foreach ($wo->updates as $update)
{{ $update->user?->name ?? 'System' }} {{ $update->type }}
{{ $update->created_at->format('d M Y H:i') }}
{{ $update->note }}
@endforeach
@else @include('components.empty-state', ['icon' => '📝', 'title' => 'No updates yet']) @endif @if (! in_array($wo->status, ['completed', 'cancelled']))
@csrf
@endif

Materials used

Total: {{ money($wo->material_cost) }}
@forelse ($wo->materials as $material) @empty @endforelse
ItemQtyUnit costTotalAdded
{{ $material->product?->name ?? $material->description }} @if ($material->product)
{{ $material->product->sku }}
@endif
{{ $material->quantity }} {{ money($material->unit_cost) }} {{ money($material->total_cost) }} {{ $material->created_at->format('d M H:i') }}
@csrf @method('DELETE')
@include('components.empty-state', ['icon' => '📦', 'title' => 'No materials recorded', 'message' => 'Add stock items consumed during the job.', 'action' => ''])
@endsection