@extends('layouts.main') @section('content')

Order Detail

@if (session()->has('success')) @endif @if (session()->has('error')) @endif @if($order->isResponseOverdue())
Order Overdue!

Teknisi belum merespon dalam batas waktu yang ditentukan. Silakan batalkan assignment dan assign ke teknisi lain.

@endif

{{ $order->order_number }}

{!! $order->type_badge !!} {!! $order->sub_category_badge !!}
{!! $order->status_badge !!}
{!! $order->priority_badge !!}
Status Tracking
@php $progress = [ 'draft' => 20, 'assigned' => 40, 'accepted' => 60, 'in_progress' => 80, 'completed' => 100, 'cancelled' => 0 ][$order->status] ?? 0; @endphp
Draft @if($order->created_at) {{ $order->created_at->format('d M Y H:i') }} @endif
Assigned @if($order->assigned_at) {{ $order->assigned_at->format('d M Y H:i') }} @endif
Accepted @if($order->accepted_at) {{ $order->accepted_at->format('d M Y H:i') }} @endif
In Progress @if($order->started_at) {{ $order->started_at->format('d M Y H:i') }} @endif
Completed @if($order->completed_at) {{ $order->completed_at->format('d M Y H:i') }} @endif

@if($order->status === 'accepted' || $order->status === 'in_progress') @if($order->status === 'in_progress') Order akan kembali ke Draft untuk di-assign ulang @endif @endif
@if($order->assignedTeknisi || $order->assignedRombongan || $order->canBeReassigned())
Assignment
@if($order->assignedTeknisi)
Tipe: Teknisi Individu
Teknisi:
{{ $order->assignedTeknisi->name }} @if($order->assignedTeknisi->categoryJasa)
{{ $order->assignedTeknisi->categoryJasa->name }} @endif
Email:
{{ $order->assignedTeknisi->email }}
@if($order->assignedTeknisi->phone)
Phone:
{{ $order->assignedTeknisi->phone }}
@endif @if($order->assignedKendaraan)
Kendaraan:
{{ $order->assignedKendaraan->merk }} {{ $order->assignedKendaraan->type }}
{{ $order->assignedKendaraan->plat_no }}
@endif
Inventaris Tools:
@php $tools = $order->assignedTeknisi->inventarisTools->where('status', 'in_use'); @endphp @if($tools->count() > 0)
    @foreach($tools as $tool)
  • {{ $tool->name }} ({{ $tool->code }}) @if($tool->category)
    Kategori: {{ $tool->category }} @endif
  • @endforeach
@else Tidak ada inventaris yang dibawa @endif
@if($order->response_deadline)
Deadline:
{{ $order->response_deadline->format('d M Y H:i') }} @if($order->isResponseOverdue())
Overdue! @endif
@endif @if($order->canBeReassigned()) @endif @elseif($order->assignedRombongan)
Tipe: Rombongan (Tim)
Rombongan:
{{ $order->assignedRombongan->name }} ({{ $order->assignedRombongan->code }})
Ketua:
{{ $order->assignedRombongan->ketua->name }} @php $ketuaTools = $order->assignedRombongan->ketua->inventarisTools->where('status', 'in_use'); @endphp @if($ketuaTools->count() > 0)
Tools: {{ $ketuaTools->count() }} item
    @foreach($ketuaTools as $tool)
  • • {{ $tool->name }} ({{ $tool->code }})
  • @endforeach
@else
Tidak ada tools @endif
@php // Filter anggota, exclude ketua $anggotaOnly = $order->assignedRombongan->activeMembers->filter(function($member) use ($order) { return $member->user_id != $order->assignedRombongan->ketua_id; }); @endphp @if($anggotaOnly->count() > 0)
Anggota:
{{ $anggotaOnly->count() }} orang
@foreach($anggotaOnly as $member)
{{ $member->user->name }} @php $memberTools = $member->user->inventarisTools->where('status', 'in_use'); @endphp @if($memberTools->count() > 0)
Tools: {{ $memberTools->count() }} item
    @foreach($memberTools as $tool)
  • • {{ $tool->name }} ({{ $tool->code }})
  • @endforeach
@else
Tidak ada tools @endif
@endforeach
@endif @if($order->response_deadline)
Deadline:
{{ $order->response_deadline->format('d M Y H:i') }} @if($order->isResponseOverdue())
Overdue! @endif
@endif @if($order->canBeReassigned()) @endif @if($order->status === 'accepted' || $order->status === 'in_progress') @endif @else

Order belum di-assign

@if($order->canBeReassigned()) @endif @endif
@endif
{{ $order->title }}
Jenis:
@if($order->type == 'psb') PSB (Pemasangan Sambungan Baru) @else Tiket Umum (Service/Perbaikan) @endif
Prioritas:
{!! $order->priority_badge !!}
@if($order->scheduled_date)
Jadwal:
{{ $order->scheduled_date->format('d M Y H:i') }}
@endif
Dibuat oleh:
{{ $order->createdBy->name }}
Tanggal dibuat:
{{ $order->created_at->format('d M Y H:i') }}
@if($order->odp)
ODP:
{{ $order->odp }}
@endif @if($order->catatan_order)
Catatan Order:
{{ $order->catatan_order }}
@endif
@if($order->mitra_id && $order->mitra)
Info Mitra:
Nama Mitra:
{{ $order->mitra->nama }}
@if($order->mitra->no_telp) @endif @if($order->mitra->alamat)
Alamat:
{{ $order->mitra->alamat }}
@endif @if($order->mitra->foto)
Foto:
Foto {{ $order->mitra->nama }}
@endif

@endif
Foto dan Lokasi Check-In: (Opsional)
Foto Check-In:
@if($order->foto_check_in)
Foto Check-In @if(auth()->user()->role === 'admin') @endif
@else No Image @endif
Waktu Check-In:
{{ $order->check_in_date ? $order->check_in_date->format('d M Y') : '-' }} {{ $order->check_in_time ? $order->check_in_time->format('H:i') : '-' }}
Lokasi Check-In:
@if($order->lat_check_in && $order->lon_check_in) Latitude: {{ $order->lat_check_in }}, Longitude: {{ $order->lon_check_in }}
Lihat di Google Maps @else No Location @endif

Deskripsi Pekerjaan:

{{ $order->description }}

@if($order->info_foto1 || $order->info_foto2 || $order->info_file1 || $order->info_file2)
Info untuk Teknisi:
@if($order->info_foto1)

{{ $order->label_info_foto1 ?? 'Foto Referensi 1' }}
Info Foto 1 @if(auth()->user()->role === 'admin') @endif
@endif @if($order->info_foto2)

{{ $order->label_info_foto2 ?? 'Foto Referensi 2' }}
Info Foto 2 @if(auth()->user()->role === 'admin') @endif
@endif @if($order->info_file1)

{{ $order->label_info_file1 ?? 'Dokumen Referensi 1' }}
Lihat PDF Download
@endif @if($order->info_file2)

{{ $order->label_info_file2 ?? 'Dokumen Referensi 2' }}
Lihat PDF Download
@endif
@endif @if($order->admin_notes)
Catatan Admin:
{{ $order->admin_notes }}
@endif @if($order->notes)
Catatan Teknisi:
{{ $order->notes }}
@endif
{{-- Dynamic Result Photos --}} @php $instalasiPhotos = $order->resultPhotos->where('category', 'instalasi'); $snPerangkatPhotos = $order->resultPhotos->where('category', 'sn_perangkat'); @endphp @if($instalasiPhotos->count() > 0 || $snPerangkatPhotos->count() > 0)
Foto Hasil Pekerjaan :
{{-- Instalasi Photos --}} @if($instalasiPhotos->count() > 0)
Foto Instalasi:
@foreach($instalasiPhotos as $photo)
{{ $photo->title }} @if(auth()->user()->role === 'admin') @endif @if($photo->title)
{{ $photo->title }}
@endif
@endforeach
@endif {{-- SN Perangkat Photos --}} @if($snPerangkatPhotos->count() > 0)
Foto Serial Number Perangkat:
@foreach($snPerangkatPhotos as $photo)
{{ $photo->title }} @if(auth()->user()->role === 'admin') @endif @if($photo->title)
{{ $photo->title }}
@endif
@endforeach
@endif

@endif
Foto dan Lokasi Check-Out:
Foto Check-Out:
@if($order->foto_check_out)
Foto Check-Out @if(auth()->user()->role === 'admin') @endif
@else No Image @endif
Waktu Check-Out:
{{ $order->check_out_date ? $order->check_out_date->format('d M Y') : '-' }} {{ $order->check_out_time ? $order->check_out_time->format('H:i') : '-' }}
Lokasi Check-Out:
@if($order->lat_check_out && $order->lon_check_out) Latitude: {{ $order->lat_check_out }}, Longitude: {{ $order->lon_check_out }}
Lihat di Google Maps @else No Location @endif
Informasi Klien
@if($order->customer)
Data dari Customer: {{ $order->customer->name }}
@endif
Nama:
{{ $order->client_name }} @if($order->customer && $order->customer->name != $order->client_name)
(Customer: {{ $order->customer->name }}) @endif
Telepon:
{{ $order->client_phone }} @if($order->customer && $order->customer->phone && $order->customer->phone != $order->client_phone)
(Customer: {{ $order->customer->phone }}) @endif
@if($order->client_email)
Email:
{{ $order->client_email }} @if($order->customer && $order->customer->email && $order->customer->email != $order->client_email)
(Customer: {{ $order->customer->email }}) @endif
@endif
Alamat:
{{ $order->client_address }} @if($order->customer && $order->customer->address && $order->customer->address != $order->client_address)
(Customer: {{ $order->customer->address }}) @endif
@if($order->client_lat && $order->client_lng)
Koordinat:
{{ $order->client_lat }}, {{ $order->client_lng }}
Buka di Google Maps
@endif
Riwayat Assignment
@if($order->assignments->count() > 0)
@foreach($order->assignments as $assignment)
{{ $assignment->teknisi->name }} {!! $assignment->status_badge !!}
@if($assignment->teknisi->categoryJasa) {{ $assignment->teknisi->categoryJasa->name }} @endif

Assigned oleh {{ $assignment->assignedBy->name }} pada {{ $assignment->assigned_at->format('d M Y H:i') }}

@if($assignment->kendaraan)

{{ $assignment->kendaraan->merk }} {{ $assignment->kendaraan->type }} ({{ $assignment->kendaraan->plat_no }})

@endif @if($assignment->response_note)

Note: {{ $assignment->response_note }}

@endif @if($assignment->cancel_reason)

Cancel Reason: {{ $assignment->cancel_reason }}

@endif
{{ $assignment->created_at->diffForHumans() }}
@endforeach
@else

Belum ada riwayat assignment

@endif
Kembali ke Daftar
@if($order->status === 'draft') Edit @endif @if($order->canBeReassigned() && !$order->assignedTeknisi) @endif
@endsection @push('scripts') @endpush @push('scripts') {{-- Google Maps moved to separate page: route('orders.route-map', $order->id) --}} @endpush