@extends('layouts.admin') @section('title', 'Detail Produk') @section('content')

Detail Produk Jasa

{{ $product->product_title }}

Preview Download PDF Edit
@if ($product->product_image && file_exists(public_path('uploads/products/' . $product->product_image))) {{ $product->product_title }} @else
Tidak ada gambar
@endif
@php $totalImages = ($product->images && $product->images->count() > 0) ? $product->images->count() + 1 : (($product->product_image) ? 1 : 0); @endphp @if ($totalImages > 1)
{{ $totalImages }} gambar
@endif
@if ($totalImages > 1)

Galeri Gambar

@if ($product->product_image && file_exists(public_path('uploads/products/' . $product->product_image)))
Gambar Utama
@endif @if ($product->images && $product->images->count() > 0) @foreach ($product->images as $image) @if (file_exists(public_path('uploads/products/' . $image->image_path)))
Gambar Tambahan
@endif @endforeach @endif
@endif

{{ $product->product_title }}

@if($product->category) {{ $product->category->name }} @endif @if ($product->is_active) Aktif @else Nonaktif @endif

Harga Jual Produk

Rp {{ number_format($product->product_prices ?? 0, 0, ',', '.') }}

@if ($product->service_fee)

Upah Jasa Pengerjaan

Rp {{ number_format($product->service_fee, 0, ',', '.') }}

@endif
@if ($product->product_description)

Deskripsi Produk

{{ $product->product_description }}

@endif
@if ($product->product_work_duration)

Estimasi Pengerjaan

{{ $product->product_work_duration }}

@endif @if ($product->product_garansi)

Garansi

{{ $product->product_garansi }}

@endif
@if ($product->specifications && $product->specifications->count() > 0)

Spesifikasi Produk ({{ $product->specifications->count() }} item)

@foreach ($product->specifications as $spec)
{{ $spec->key }}: {{ $spec->value }}
@endforeach
@endif @php // Ambil data real dari database $allMaterials = $product->materials && $product->materials->count() > 0 ? $product->materials->map(function($m) { return [ 'item_type' => 'Bahan', 'name' => $m->name, 'quantity' => $m->quantity, 'unit' => $m->unit ?? 'pcs', 'type' => $m->type ?? 'material', ]; })->toArray() : []; $allSpareparts = $product->spareparts && $product->spareparts->count() > 0 ? $product->spareparts->map(function($s) { return [ 'item_type' => 'Sparepart', 'name' => $s->name, 'quantity' => $s->quantity, 'unit' => $s->unit ?? 'pcs', 'type' => $s->type ?? 'sparepart', ]; })->toArray() : []; // Gabungkan semua data $allItems = array_merge($allMaterials, $allSpareparts); @endphp @if (!empty($allItems))

Bahan & Sparepart yang Digunakan (Total: {{ count($allItems) }} item)

@foreach ($allItems as $index => $item) @endforeach
No Tipe Nama Jumlah Satuan
{{ $index + 1 }} {{ $item['item_type'] }} {{ $item['name'] }} {{ $item['quantity'] }} {{ $item['unit'] }}
@endif
@endsection