@php $isEdit = isset($productBoms) && $productBoms->isNotEmpty(); $isShow = isset($isShow) && $isShow; $action = $isEdit ? route('bill-of-materials.update', $productBoms->first()) : route('bill-of-materials.store'); $method = $isEdit ? 'PUT' : 'POST'; $title = $isShow ? 'Bill of Materials - ' . ($productBoms->first()->product->name ?? 'Unknown Product') : ($isEdit ? 'Edit Bill of Materials' : 'Create Bill of Materials'); @endphp

{{ $title }}

@if($isEdit && !$isShow)

Edit all raw materials for this product. Changes will replace all existing BOMs for this product.

@elseif(!$isEdit && !$isShow)

Add raw materials for a product. Click "Add Raw Material" to add multiple raw materials.

@endif
Back to List @if($isShow) Edit BOM @endif
@if ($errors->any())

Please fix the following errors:

    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @if($isShow) @if($productBoms->count() > 0)
Product Information

Name: {{ $productBoms->first()->product->name }}

Description: {{ $productBoms->first()->product->description ?? 'N/A' }}

Category: {{ $productBoms->first()->product->category->name ?? 'N/A' }}

BOM Summary

Total Raw Materials: {{ $productBoms->count() }}

@foreach($productBoms as $bom) @endforeach
Raw Material Quantity Required Status
@if($bom->rawMaterial) {{ $bom->rawMaterial->name }} ({{ $bom->unit_of_measure }}) @if($bom->isRawMaterialDeleted()) Deleted @endif @if($bom->rawMaterial->description)
{{ $bom->rawMaterial->description }} @endif @else Raw material not found @endif
{{ number_format($bom->quantity_required, 4) }} @if($bom->is_active) Active @else Inactive @endif
@else
No Bill of Materials found for this product.

This product doesn't have any raw materials defined yet.

Create BOM
@endif @else
@csrf @if($isEdit) @method('PUT') @endif
@error('product_id') {{ $message }} @enderror
Batch Size @error('batch_size') {{ $message }} @enderror
Raw Materials
@error('raw_materials')
Error: {{ $message }}
@enderror
Cancel
@endif
@if(!$isShow) @include('manufacturing.bill-of-materials._partials.raw-material', ['rawMaterials' => $rawMaterials]) @push('js') @endpush @endif