@extends('admin.layout') @section('title', 'Edit Produk') @section('content')

Edit Produk: {{ $product->name }}

@if($errors->any())
{{ $errors->first() }}
@endif
@csrf
atau upload gambar baru:

Pengendalian Stok (Min-Max)

@if($product->isLowStock())
⚠ Stok rendah! Stok saat ini: {{ $product->total_stock }} | Reorder Qty: {{ $product->reorder_quantity }} unit
@endif

Stok per Ukuran

@php $sizes = $product->sizes->pluck('size')->unique(); $orderedSizes = ['S','M','L','XL','XXL']; $sizes = $sizes->sortBy(function ($size) use ($orderedSizes) { $index = array_search($size, $orderedSizes, true); return $index === false ? 100 + intval(preg_replace('/[^0-9]/', '', $size)) : $index; }); if ($sizes->isEmpty()) { $sizes = collect($orderedSizes); } @endphp @foreach($sizes as $s) @php $row = $product->sizes->firstWhere('size', $s); $val = $row ? $row->stock : 0; @endphp
@endforeach
Batal
@endsection