@extends('layouts.teknisi') @section('title', 'Detail History Produksi - Teknisi') @section('content') @php $orderQty = $production->quantity ?? $production->order->quantity ?? 1; $materialTotal = $production->total_material_cost ?? 0; $sparepartTotal = $production->total_sparepart_cost ?? 0; $directTotal = ($production->total_direct_cost ?? ($materialTotal + $sparepartTotal)); $laborTotal = $production->labor_cost ?? 0; $actualTotal = $directTotal + $laborTotal; @endphp

Detail History Produksi #{{ $production->id }}

{{ $production->product->product_title ?? 'N/A' }} · Order #{{ $production->order->id ?? 'N/A' }}

Selesai

Info Produksi

Qty: {{ $orderQty }} unit
Mulai: {{ $production->start_date ? $production->start_date->format('d/m/Y') : 'N/A' }}
Selesai: {{ $production->end_date ? $production->end_date->format('d/m/Y') : 'N/A' }}

Info Pesanan

Order ID: #{{ $production->order->id ?? 'N/A' }}
Customer: {{ Str::limit($production->order->customer_name ?? 'N/A', 15) }}
Harga: Rp {{ number_format($production->order->total_price ?? 0, 0, ',', '.') }}

Ringkasan

Bahan: {{ $production->productionMaterials->count() }} item
Sparepart: {{ $production->productionSpareparts->count() }} item
Total: Rp {{ number_format($actualTotal, 0, ',', '.') }}

Pembayaran

Metode: {{ strtoupper($production->order->payment_method ?? 'N/A') }}
Status: @php $paymentStatus = $production->order->status ?? 'menunggu'; $paymentStatusConfig = [ 'selesai' => ['bg' => 'bg-green-100 dark:bg-green-900/40', 'text' => 'text-green-700 dark:text-green-300', 'label' => 'Lunas'], 'diproses' => ['bg' => 'bg-blue-100 dark:bg-blue-900/40', 'text' => 'text-blue-700 dark:text-blue-300', 'label' => 'Diproses'], 'menunggu_verifikasi' => ['bg' => 'bg-yellow-100 dark:bg-yellow-900/40', 'text' => 'text-yellow-700 dark:text-yellow-300', 'label' => 'Verifikasi'], ]; $paymentStatusStyle = $paymentStatusConfig[$paymentStatus] ?? ['bg' => 'bg-gray-100 dark:bg-gray-700/50', 'text' => 'text-gray-700 dark:text-gray-300', 'label' => ucfirst($paymentStatus)]; @endphp {{ $paymentStatusStyle['label'] }}
@if($production->notes)

Catatan Produksi

{{ $production->notes }}

@endif

Daftar Bahan & Sparepart

{{ $production->productionMaterials->count() + $production->productionSpareparts->count() }} item · {{ $orderQty }} unit produk

@if($production->productionMaterials->count() > 0 || $production->productionSpareparts->count() > 0)
@foreach($production->productionMaterials as $pm) @endforeach @foreach($production->productionSpareparts as $ps) @endforeach
Nama Item Tipe Jumlah Satuan Harga/Unit Total
{{ $pm->material->name ?? 'N/A' }} Bahan {{ $pm->quantity }} {{ $pm->unit }} Rp {{ number_format($pm->unit_cost, 0, ',', '.') }} Rp {{ number_format($pm->total_cost, 0, ',', '.') }}
{{ $ps->sparepart->name ?? 'N/A' }} Sparepart {{ $ps->quantity }} {{ $ps->unit }} Rp {{ number_format($ps->unit_cost, 0, ',', '.') }} Rp {{ number_format($ps->total_cost, 0, ',', '.') }}
Bahan: Rp {{ number_format($materialTotal, 0, ',', '.') }} Sparepart: Rp {{ number_format($sparepartTotal, 0, ',', '.') }}
Total: Rp {{ number_format($directTotal, 0, ',', '.') }}
@else

Belum ada bahan atau sparepart ditambahkan

@endif
@if($laborTotal > 0)

Biaya Tenaga Kerja

Upah untuk {{ $orderQty }} unit

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

Per unit: Rp {{ number_format($laborTotal / max($orderQty, 1), 0, ',', '.') }}

@endif

Total Biaya Produksi

Langsung: Rp {{ number_format($directTotal, 0, ',', '.') }} @if($laborTotal > 0) · Labor: Rp {{ number_format($laborTotal, 0, ',', '.') }} @endif

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

Per unit: Rp {{ number_format($actualTotal / max($orderQty, 1), 0, ',', '.') }}

Breakdown Biaya Detail

Bahan
Rp {{ number_format($materialTotal, 0, ',', '.') }}
/unit: Rp {{ number_format($materialTotal / max($orderQty, 1), 0, ',', '.') }}
Sparepart
Rp {{ number_format($sparepartTotal, 0, ',', '.') }}
/unit: Rp {{ number_format($sparepartTotal / max($orderQty, 1), 0, ',', '.') }}
Langsung
Rp {{ number_format($directTotal, 0, ',', '.') }}
/unit: Rp {{ number_format($directTotal / max($orderQty, 1), 0, ',', '.') }}
@if($laborTotal > 0)
Labor
Rp {{ number_format($laborTotal, 0, ',', '.') }}
/unit: Rp {{ number_format($laborTotal / max($orderQty, 1), 0, ',', '.') }}
@endif
Total Aktual (Langsung + Labor)
Per unit: Rp {{ number_format($actualTotal / max($orderQty, 1), 0, ',', '.') }}
Rp {{ number_format($actualTotal, 0, ',', '.') }}
Kembali ke History
@endsection