@php $initialComponents = collect(old('components', isset($product) ? $product->components->map(fn ($component) => [ 'product_id' => $component->component_product_id, 'quantity' => (float) $component->quantity, ])->all() : [])); $initialComboMode = old('combo_mode', $product->combo_mode ?? 'direct'); $initialComboYield = old('combo_yield_quantity', $product->combo_yield_quantity ?? 1); $componentProductOptions = $componentProducts->map(function ($item) { return [ 'id' => $item->id, 'label' => $item->name.' | '.$item->barcode, 'name' => $item->name, 'barcode' => $item->barcode, 'cost' => (float) $item->buying_price, 'stock' => (float) $item->stock_quantity, ]; })->values()->all(); $initialComponentOptions = $initialComponents->values()->all(); @endphp Stock Composition Select the stock items consumed when one unit is sold. Add Component Stock Behaviour Direct deduction / recipe Break pack into portions Portions From One Base Pack Example: enter 25 when one 750ml bottle gives 25 tots. Component ProductQuantity UsedUnit CostUnit Product CostAction Calculated Buying Cost0.00 @foreach($componentProducts as $componentProduct) @endforeach
Select the stock items consumed when one unit is sold.