{{-- Sweet Works ERP | app/Modules/Manufacturing/Resources/Views/boms/show.blade.php | v1.5 | 31/08/2026 --}} {{-- v1.5 — Explosion table: indent by level (20px/level), L-badge in component cell, arrow icon for sub-levels. --}} {{-- v1.4 — Explosion tab header shows dynamic base_quantity + base_uom instead of hardcoded '(1 unit)'. --}} {{-- v1.3 — Add Level column in components tab (badge L1/L2 from _line_row partial). --}} {{-- v1.2 — Fix: product->product_name; explosion tab usa acceso de array $item['key'] con variable $explosion. --}} {{-- v1.1 — i18n: "Pendiente" → __('manufacturing.boms.pending'). --}} {{-- v1.0 — Detalle BOM: árbol multinivel + tabla de explosión. --}} @extends('layouts.vertical') @section('content')

{{ $bom->code }} — {{ $bom->name }}

@can('manufacturing.bom.approve') @if(!$bom->approved_at)
@csrf
@endif @endcan @can('manufacturing.bom.edit') {{ __('manufacturing.common.edit') }}
@csrf
@endcan {{ __('manufacturing.common.back') }}
@if(session('success'))
{{ session('success') }}
@endif {{-- Tabs --}}
{{-- Tab 1: Datos cabecera --}}
{{ __('manufacturing.boms.code') }}
{{ $bom->code }}
{{ __('manufacturing.boms.product') }}
{{ $bom->product->product_code ?? '—' }} — {{ $bom->product->product_name ?? '' }}
{{ __('manufacturing.boms.type') }}
{{ \App\Modules\Manufacturing\Models\MfgBom::types()[$bom->type] ?? $bom->type }}
{{ __('manufacturing.boms.base_qty') }}
{{ number_format($bom->base_quantity, 4) }} {{ $bom->base_uom }}
{{ __('manufacturing.common.version') }}
{{ $bom->version }}
{{ __('manufacturing.boms.approved_by') }}
@if($bom->approvedBy) {{ $bom->approvedBy->name }} {{ $bom->approved_at?->format('d/m/Y H:i') }} @else {{ __('manufacturing.common.na') }} — {{ __('manufacturing.boms.pending') }} @endif
{{ __('manufacturing.common.status') }}
@if($bom->is_active) {{ __('manufacturing.common.active') }} @else {{ __('manufacturing.common.inactive') }} @endif
@if($bom->notes)
{{ __('manufacturing.common.notes') }}
{{ $bom->notes }}
@endif
{{-- Tab 2: Árbol de componentes --}}
@foreach($bom->rootLines as $line) @include('manufacturing::boms._line_row', ['line' => $line, 'depth' => 0]) @endforeach @if($bom->rootLines->isEmpty()) @endif
{{ __('manufacturing.boms.line_level') }} {{ __('manufacturing.boms.line_component') }} {{ __('manufacturing.boms.line_qty') }} {{ __('manufacturing.boms.line_uom') }} {{ __('manufacturing.boms.line_scrap') }} {{ __('manufacturing.boms.line_yield') }} {{ __('manufacturing.boms.line_critical') }}
{{ __('manufacturing.common.no_records') }}
{{-- Tab 3: Explosión BOM --}}
{{ __('manufacturing.boms.explosion') }} ({{ $bom->base_quantity % 1 == 0 ? (int)$bom->base_quantity : $bom->base_quantity }} {{ $bom->base_uom }})
@foreach($explosion as $item) @php $lvl = (int) $item['level']; $indent = ($lvl - 1) * 20; // px per level if ($lvl === 1) { $badge = 'L1'; $rowClass = ''; } else { $badge = 'L' . $lvl . ''; $rowClass = 'table-active'; } @endphp @endforeach @if($explosion->isEmpty()) @endif
{{ __('manufacturing.boms.line_component') }} {{ __('manufacturing.boms.line_qty') }} {{ __('manufacturing.boms.line_uom') }} {{ __('manufacturing.boms.line_critical') }}
@if($lvl > 1) @endif {!! $badge !!} {{ $item['product_code'] ?? '?' }} — {{ $item['product_name'] ?? '?' }} {{ number_format($item['quantity'], 4) }} {{ $item['uom'] }} @if($item['is_critical']) @else — @endif
{{ __('manufacturing.common.no_records') }}
@endsection