@extends('layouts.app') @section('title', __('lang_v1.demand_forecast')) @section('content')

@lang('lang_v1.demand_forecast') @lang('lang_v1.across_assigned_stores')

@if(! $is_warehouse)

@lang('lang_v1.warehouse_not_provisioned')

@else

@lang('lang_v1.demand_forecast') — {{ $business->name }}

@lang('lang_v1.demand_forecast_help')

@foreach($horizons as $h) @endforeach @forelse($rows as $r) @php $m = ! empty($r->purchase_multiplier) ? (float) $r->purchase_multiplier : null; $baseUnit = $r->base_unit ?? ''; // Demand is expressed in the SELLING/base unit (that's what stores // consume and what carries the trend). Show that as the primary // number, with the whole-pack procurement figure as a hint. $cell = function ($base) use ($m, $baseUnit, $r) { $out = ''.number_format((float) $base, (session('business.quantity_precision', 2)), '.', ',').''.$baseUnit.''; if ($m && $base > 0) { $out .= '
≈ '.number_format(ceil($base / $m), 0).' '.$r->purchase_unit.''; } return $out; }; @endphp @foreach($horizons as $h) @endforeach @empty @endforelse
@lang('sale.product') @lang('lang_v1.live_demand') @lang('lang_v1.daily_rate')@lang('lang_v1.next_n_days', ['n' => $h])
{{ $r->product_name }} {!! $cell($r->live_demand) !!} @if($r->has_history) {{ @format_quantity($r->daily_rate) }} {{ $baseUnit }}/day @else @lang('lang_v1.no_history') @endif @if($r->forecast[$h] !== null) {!! $cell($r->forecast[$h]) !!} @else @endif
@lang('lang_v1.no_records_found')
{{ $rows->links() }}
@endif
@endsection