{{-- Stock material calculator, scoped to deliverable $di / section $si. Adds a material line with real m²/offcut via WithMaterialCalculator. The ad-hoc (off-catalogue) block is guarded on the trait exposing calcSource, so it stays dormant until Session 3 lands, then lights up automatically. --}} @php $mc = $this->materialCalc; $adHocReady = property_exists($this, 'calcSource'); @endphp

{{ __('Add material, real m², offcut & cost') }}

@if ($adHocReady)
@endif @if (! $adHocReady || $this->calcSource === 'stock')
@if ($mc)

{{ __('Consumed') }}

{{ $this->trimNum($mc['consumed_qty']) }} {{ $mc['consumed_unit'] }}

{{ __('Offcut') }}

{{ $this->trimNum($mc['offcut_area']) }} m² ({{ number_format($mc['offcut_pct'], 0) }}%)

{{ __('Material cost') }}

{{ $baseCode }} {{ number_format($mc['material_cost'], 2) }}

{{ __('Weight') }}

{{ $mc['weight_kg'] !== null ? $mc['weight_kg'].' kg' : '—' }}

@if (! $mc['fits'])

{{ $mc['note'] }}

@endif @if ((float) $mc['offcut_cost'] > 0)

{{ __('Offcut costs :cur :amt, what do you want to do?', ['cur' => $baseCode, 'amt' => number_format($mc['offcut_cost'], 2)]) }}

@if ($mc['remnant_reusable'])

{{ __('Reusable remnant, consider absorbing it.') }}

@endif
@if ($calcOffcut === 'partial')
%
@endif
@endif
@if ($mc['charged'] !== null) {{ __('Adds :cur :amt', ['cur' => $baseCode, 'amt' => number_format($mc['charged'], 2)]) }} @if (($mc['absorbed'] ?? 0) > 0)· {{ __('absorbing :cur :amt', ['cur' => $baseCode, 'amt' => number_format($mc['absorbed'], 2)]) }}@endif @else {{ __('Choose what to do with the offcut ↑') }} @endif
{{ __('Add material line') }}
@elseif ($calcVariantId)

{{ __('Enter a size and quantity to calculate…') }}

@endif @elseif ($adHocReady && $this->calcSource === 'adhoc') {{-- Off-catalogue material, typed name + buy price (Session 3 fields). --}}
@if ($this->calcMeasure === 'area') @elseif ($this->calcMeasure === 'linear') @endif
{{ __('Add material line') }}
@endif