'supplier-orders-items',
'icon' => 'list',
'title' => __('Items to order, by supplier', 'ai-eshop-optimizer'),
'description' => __('Every product of the chosen supplier across the shop\'s orders — what open orders have already committed you to, or everything sold in a period. Export it, or email the supplier the list in one click.', 'ai-eshop-optimizer'),
));
echo $aieo_so_open;
?>
__('Pick more than one when the same trading partner invoices through several companies — the items are listed together, and each company is still emailed only its own lines.', 'ai-eshop-optimizer'),
__('What is listed?', 'ai-eshop-optimizer') => __('"Pending" reads the open order statuses (pending payment, processing, on hold). The period view adds completed orders. The email goes to the supplier\'s order-taking address from the Suppliers page and lists SKU × quantity per line.', 'ai-eshop-optimizer'),
) as $aieo_so_ask => $aieo_so_why) {
echo class_exists('\Rooster\Admin\Guidance') ? \Rooster\Admin\Guidance::text($aieo_so_why, 'guidance', array('question' => $aieo_so_ask)) : '
'supplier-orders-outstanding-pre-orders',
'icon' => 'clock',
'heading' => 'h2',
'title' => __('Outstanding pre-orders by supplier', 'ai-eshop-optimizer'),
'description' => __('Aggregated from staff-recorded `desired_qty` updates. One row per supplier with the unfulfilled quantity total. Use to drive the next purchase order.', 'ai-eshop-optimizer'),
'page_id' => 'supplier_orders',
'row_key' => 'supplier',
'rows' => array_map(
static function ($s) {
return array(
'supplier' => (string) $s['supplier_name'],
'lines' => (int) $s['line_count'],
'qty' => (int) $s['total_qty'],
'recent' => (string) $s['most_recent_at'],
);
},
(array) $preorder_summary
),
'empty' => __('No outstanding pre-orders. Staff have either not signalled desired_qty yet, or every signal has been marked fulfilled.', 'ai-eshop-optimizer'),
'columns' => array(
array('key' => 'supplier', 'label' => __('Supplier', 'ai-eshop-optimizer')),
array('key' => 'lines', 'label' => __('Lines', 'ai-eshop-optimizer'), 'type' => 'integer'),
array('key' => 'qty', 'label' => __('Total qty requested', 'ai-eshop-optimizer'), 'type' => 'integer'),
array('key' => 'recent', 'label' => __('Most recent', 'ai-eshop-optimizer'), 'nowrap' => true),
),
));
?>
'supplier-orders-recent-signals',
'heading' => 'h2',
'icon' => 'bell',
'title' => __('Recent staff pre-order signals', 'ai-eshop-optimizer'),
'description' => __('Every staff request — from the branch worksheets and the scanner — with its whole requested / approved / ordered / received life. Filter to a supplier or branch and approve or mark ordered in bulk; Mark ordered stamps a per-supplier batch reference for the XLSX and the email.', 'ai-eshop-optimizer'),
));
AIEO_Report_Render::card('preorder_order_batches', array(
'anchor' => 'supplier-orders-order-batches',
'heading' => 'h2',
'icon' => 'boxes',
'title' => __('Ordered batches', 'ai-eshop-optimizer'),
'description' => __('One row per purchase-order batch. Download the XLSX or email the supplier the SKU × quantity list — both carry the batch reference, so the supplier\'s confirmation can be matched back.', 'ai-eshop-optimizer'),
));
AIEO_Report_Render::card('preorder_receive_reconcile', array(
'anchor' => 'supplier-orders-receive-reconcile',
'heading' => 'h2',
'icon' => 'scale',
'title' => __('Received vs ERP', 'ai-eshop-optimizer'),
'description' => __('Read-only reconcile: every received line against what was requested, with the ERP catalogue\'s current stock for the SKU beside it, so short deliveries surface. The ERP stays canonical — nothing here writes.', 'ai-eshop-optimizer'),
));
AIEO_Report_Render::card('preorder_audit_log', array(
'anchor' => 'supplier-orders-preorder-audit',
'heading' => 'h2',
'icon' => 'scroll-text',
'title' => __('Pre-order audit trail', 'ai-eshop-optimizer'),
'description' => __('Every lifecycle event with who did it — written by the same PHP paths that make each change, which is what the old board\'s triggers could never attribute.', 'ai-eshop-optimizer'),
));
?>