@extends('layouts.app') @section('title', __('Low Stock Reorder')) @section('content')

{{ __('Draft purchase orders generated from low-stock products, pending approval.') }}

@csrf
{{-- AI reorder predictions (#28) --}} @if (! empty($predictions))

{{ __('AI reorder predictions') }}

{{ __(':days-day forecast', ['days' => 45]) }}

{{ __('Based on average daily sales velocity and days of cover.') }}

@foreach ($predictions as $row) @endforeach
{{ __('Product') }} {{ __('On hand') }} {{ __('Avg/day') }} {{ __('Days cover') }} {{ __('Suggested qty') }} {{ __('Confidence') }}
{{ $row['name'] }}{{ $row['supplier'] ?? __('Unassigned') }} {{ $row['on_hand'] }} {{ $row['avg_daily_sales'] }} @if ($row['days_cover'] !== null) {{ $row['days_cover'] }}d @else — @endif {{ $row['suggested_quantity'] }}
{{ $row['confidence'] }}%
@endif

{{ __('Draft orders') }}

@forelse ($orders as $order) @empty @endforelse
{{ __('Reference') }}{{ __('Supplier') }}{{ __('Items') }} {{ __('Estimated total') }}{{ __('Status') }}
{{ $order->reference }} {{ $order->supplier?->name ?? __('Unassigned') }} {{ $order->items->count() }} {{ money($order->estimated_total) }} {{ __(ucfirst(str_replace('_',' ', $order->status))) }}
@if (in_array($order->status, ['draft','pending_approval']))
@csrf
@csrf
@endif
{{ __('No reorder drafts.') }}
{{ $orders->links() }}
@endsection