@extends('layouts.app') @section('title','Detail Order Servis') @section('page-title','Detail Order Servis') @push('head') @endpush @section('content') @php $phone = preg_replace('/[^0-9]/', '', $order->customer?->phone ?? ''); if ($phone && str_starts_with($phone, '0')) $phone = '62' . substr($phone, 1); $spTotal = $order->sparparts->sum('subtotal'); $chTotal = $order->charges->sum('amount'); $finalCost = $order->final_cost ?? $order->calculateFinalCost(); $waLines = []; $waLines[] = "Halo {$order->customer?->name},"; $waLines[] = ""; $waLines[] = "Berikut informasi servis Anda di GMComp:"; $waLines[] = ""; $waLines[] = "πŸ“‹ No. Nota: {$order->order_number}"; $waLines[] = "πŸ“… Tanggal Masuk: {$order->received_at->format('d/m/Y')}"; $waLines[] = "πŸ’» Perangkat: {$order->device_type} {$order->device_brand} {$order->device_model}"; $waLines[] = "πŸ”§ Keluhan: {$order->complaint}"; $waLines[] = "βœ… Status: {$order->status_label}"; $waLines[] = ""; $waLines[] = "πŸ’° Rincian Biaya:"; if ($spTotal > 0) $waLines[] = "- Sparepart: Rp " . number_format($spTotal, 0, ',', '.'); if ($chTotal > 0) $waLines[] = "- Jasa Servis: Rp " . number_format($chTotal, 0, ',', '.'); $waLines[] = "- *TOTAL: Rp " . number_format($finalCost, 0, ',', '.') . "*"; $waLines[] = ""; $waLines[] = "πŸ›‘οΈ Garansi servis: {$order->warranty_service_days} hari"; $waLines[] = ""; $waLines[] = "Terima kasih sudah mempercayakan perangkat Anda ke GMComp πŸ™"; $waMsg = implode("\n", $waLines); $waUrl = $phone ? "https://wa.me/{$phone}?text=" . rawurlencode($waMsg) : null; @endphp
{{-- Header --}}

{{ $order->order_number }}

Masuk: {{ $order->received_at->format('d F Y, H:i') }}

@if($order->estimated_finish)

Est. Selesai: {{ $order->estimated_finish->format('d F Y, H:i') }}

@endif
@php $c=$order->status_color @endphp {{ $order->status_label }}
Pelanggan

{{ $order->customer?->name }}

@if($order->customer?->phone)

{{ $order->customer->phone }}

@endif
Perangkat

{{ $order->device_type }} {{ $order->device_brand }}

Model

{{ $order->device_model ?: '-' }}

S/N

{{ $order->serial_number ?: '-' }}

Teknisi

{{ $order->technician?->name ?? 'Belum Ditentukan' }}

Kondisi Fisik

{{ $order->device_condition ?: '-' }}

Kelengkapan

{{ $order->accessories ?: '-' }}

Est. Biaya

Rp {{ number_format($order->estimated_cost,0,',','.') }}

@if($order->device_password)
Password / PIN

β€’β€’β€’β€’β€’β€’β€’β€’

@endif
Keluhan

{{ $order->complaint }}

{{-- Status Actions --}} @if($order->isEditable())

Aksi

@if(auth()->user()->hasRole(['superadmin','owner','admin']))
@csrf
@endif
@csrf
@endif {{-- Diagnosis --}}

Diagnosa Teknisi

@if($order->diagnosis)

Diagnosa: {{ $order->diagnosis->diagnosis }}

@if($order->diagnosis->action_plan)

Tindakan: {{ $order->diagnosis->action_plan }}

@endif @if($order->diagnosis->estimated_cost)

Est. Biaya: Rp {{ number_format($order->diagnosis->estimated_cost,0,',','.') }}

@endif

{{ $order->diagnosis->diagnosed_at?->format('d/m/Y H:i') }}

@else

Belum ada diagnosa.

@endif @if($order->technician_notes)

Catatan Teknisi

{{ $order->technician_notes }}

@endif @if($order->isEditable())
@csrf
@endif
{{-- Spareparts --}}

Sparepart Digunakan

Rp {{ number_format($order->sparparts->sum('subtotal'),0,',','.') }}
@forelse($order->sparparts as $sp) @if($order->isEditable()) @endif @empty @endforelse
{{ $sp->product?->name }} {{ $sp->quantity }} Γ— Rp {{ number_format($sp->unit_price,0,',','.') }} Rp {{ number_format($sp->subtotal,0,',','.') }}
@csrf @method('DELETE')
Belum ada sparepart.
@if($order->isEditable())
@csrf
@endif
{{-- Service Charges --}}

Biaya Servis

Rp {{ number_format($order->charges->sum('amount'),0,',','.') }}
@forelse($order->charges as $ch) @if($order->isEditable()) @endif @empty @endforelse
{{ $ch->description }} Rp {{ number_format($ch->amount,0,',','.') }}
@csrf @method('DELETE')
Belum ada biaya servis.
@if($order->isEditable())
@csrf
@endif
{{-- Garansi --}}

Garansi

Garansi Servis: {{ $order->warranty_service_days }} hari Garansi Sparepart: {{ $order->warranty_part_days }} hari
@if($order->isEditable())
@csrf @method('PATCH')
@endif
{{-- Total & Complete --}}

Ringkasan Biaya

Total Biaya

Rp {{ number_format($finalCost,0,',','.') }}

@if($order->status === 'siap_diambil' && !$order->payment)
@csrf
@elseif($order->payment)
No. Bayar: {{ $order->payment->payment_number }} Metode: {{ ucfirst(str_replace('_',' ',$order->payment->payment_method)) }} {{ $order->payment->created_at->format('d/m/Y H:i') }}
@if($order->change_amount > 0)

Kembalian: Rp {{ number_format($order->change_amount,0,',','.') }}

@endif
@endif
{{-- Bottom Actions --}}
← Kembali πŸ–¨ Cetak Nota Servis @if($waUrl) πŸ“² Kirim WA ke Pelanggan @if($order->wa_sent_at) ({{ $order->wa_sent_at->format('d/m H:i') }}) @endif @elseif(!$phone) πŸ“² Kirim WA @endif
@php $sparepartsData = $spareparts->map(fn($sp) => ['id' => $sp->id, 'name' => $sp->name, 'code' => $sp->code ?? '', 'stock' => (int) $sp->stock]); @endphp @push('scripts') @endpush @endsection