@php $originalName = $product->name; $foundImage = null; $dirPath = public_path('images'); if (is_dir($dirPath)) { $filesInFolder = scandir($dirPath); $searchClean = strtolower(str_replace(' ', '', $originalName)); $words = explode(' ', strtolower(trim($originalName))); foreach ($filesInFolder as $file) { if ($file === '.' || $file === '..') continue; $fileClean = strtolower(str_replace(' ', '', $file)); if (str_contains($fileClean, $searchClean)) { $foundImage = asset('images/' . $file); break; } if (isset($words[0], $words[1])) { $twoWords = $words[0] . $words[1]; if (str_contains($fileClean, $twoWords)) { $foundImage = asset('images/' . $file); break; } } if (count($words) >= 2) { if (str_contains($fileClean, $words[0]) && str_contains($fileClean, $words[1])) { $foundImage = asset('images/' . $file); break; } } } } $src = $foundImage ?? 'https://placehold.co/600x600/e8e8e8/111111?text=' . urlencode($originalName); @endphp {{ $product->name }}
{{ $product->category->name ?? 'Tanpa Kategori' }}

{{ $product->name }}

🎨
Warna
{{ $product->color ?? '-' }}
📦
Total Stok
{{ $product->total_stock }} unit
📏
Ukuran Tersedia
@if ($product->sizes->isNotEmpty())
@foreach ($product->sizes as $variant)
{{ $variant->size }} ({{ $variant->stock }})
@endforeach
@else
-
@endif
@if ($product->min_stock || $product->max_stock)
⚙️
Batas Stok
Min: {{ $product->min_stock ?? 0 }}  |  Maks: {{ $product->max_stock ?? 0 }}
@endif
@php $statusClass = match($product->stock_status) { 'low' => 'stock-low', 'over' => 'stock-over', default => 'stock-ok', }; @endphp
{{ $product->stock_status_label }}
@if ($product->stockMovements->isNotEmpty())

📊 Riwayat Pergerakan Stok

@foreach ($product->stockMovements->sortByDesc('created_at')->take(10) as $movement) @endforeach
Tanggal Tipe Jumlah Stok Sebelum Stok Sesudah Catatan
{{ $movement->created_at->format('d M Y, H:i') }} {{ $movement->type === 'in' ? '↑ Masuk' : '↓ Keluar' }} {{ $movement->quantity }} {{ $movement->stock_before }} {{ $movement->stock_after }} {{ $movement->notes ?? '-' }}
@endif @if ($relatedProducts->isNotEmpty())

🛍️ Produk Terkait

@endif