0 GROUP BY bp.ref_id ) br ON br.ref_id = g.id WHERE 1=1{$aieo_mhp_filter} "; return array( 'id' => 'missing_hot_sellers_priority', 'label' => 'Missing hot sellers: priority', 'description' => 'Physically-selling SKUs not live in the eshop, ranked by in-store demand. The # is a PRIORITY — a row keeps its number whatever you sort by.', 'footnote' => 'Totals cover the whole filtered set, not the page. The recoverable estimate applies the eshop\'s channel share to observed in-store turnover.', 'group' => 'attribution', 'section' => 'recovery', 'icon' => 'list-checks', 'menu_priority' => 73, 'tier' => 'pro', 'scope' => 'local', 'source' => 'sql', 'sql' => $aieo_mhp_sql, 'registry_id' => 'missing_hot_sellers.priority', 'version' => '1', 'per_page' => 50, 'row_key' => 'sku_norm', 'default_sort' => array( 'rank_priority', 'asc' ), 'empty_state' => 'No missing hot sellers detected yet. Run detection on the Stock Recovery tab (needs physical-store sales data).', 'filter_bar' => array( 'first' => array( 'status', 'phys_units', 'phys_turnover' ) ), 'actions' => array( array( 'id' => 'edit', 'label' => 'Edit in Woo', 'variant' => 'primary', 'intent' => array( 'name' => 'edit_product', 'key' => 'product_id' ), 'capability' => 'edit_products', 'when' => array( 'key' => 'product_id', 'not' => '' ), ), array( 'id' => 'dismiss', 'label' => 'Dismiss', 'variant' => 'secondary', 'bulk' => 'selection', 'bulk_confirm' => 'Dismiss %1$s SKUs from the priority list? They move to the Dismissed list below and can be restored any time.', ), ), 'columns' => array( array( 'key' => 'id', 'label' => 'ID', 'type' => 'id', 'hidden' => true, ), array( 'key' => 'rank_priority', 'label' => '#', 'type' => 'integer', 'width' => '48px', 'sortable' => true, ), array( 'key' => 'select', 'label' => '', 'type' => 'selector', 'width' => '28px', 'sortable' => false, 'select' => "''", ), array( 'key' => 'name', 'label' => 'Product', 'type' => 'text', 'sortable' => true, 'searchable' => true, 'filter' => 'text', 'truncate' => 48, 'tooltip' => true, ), array( 'key' => 'sku', 'label' => 'SKU', 'type' => 'code', 'sortable' => true, 'searchable' => true, ), array( 'key' => 'sku_norm', 'label' => 'SKU (normalised)', 'type' => 'code', 'hidden' => true, ), array( 'key' => 'phys_units', 'label' => 'Phys. sold', 'type' => 'decimal', 'format' => array( 'precision' => 0 ), 'sortable' => true, 'filter' => 'number_range', 'aggregate' => 'SUM', ), array( 'key' => 'phys_sale_days', 'label' => 'Sale-days', 'type' => 'integer', 'sortable' => true, 'hidden' => true, ), array( 'key' => 'last_phys_sale_date', 'label' => 'Last sold', 'type' => 'date', 'sortable' => true, 'hidden' => true, ), array( 'key' => 'branches', 'label' => 'By branch (units)', 'type' => 'text', 'header_tip' => 'Units sold per physical store over the detection window — where this SKU is selling. Labels come from the branch registry.', 'empty' => '—', ), array( 'key' => 'phys_turnover', 'label' => 'Turnover (net)', 'type' => 'money', 'sortable' => true, 'filter' => 'number_range', 'aggregate' => 'SUM', 'header_tip' => 'Net physical-store revenue (ex-VAT) over the detection window.', ), array( 'key' => 'recoverable', 'label' => 'Est. recoverable', 'type' => 'money', 'sortable' => true, 'header_tip' => 'Estimated recoverable online sales if published = in-store turnover × the eshop\'s channel share.', ), array( 'key' => 'phys_units_30d', 'label' => 'Units · 30d', 'type' => 'decimal', 'format' => array( 'precision' => 0 ), 'sortable' => true, 'aggregate' => 'SUM', ), array( 'key' => 'phys_turnover_30d', 'label' => 'Sales · 30d', 'type' => 'money', 'sortable' => true, 'aggregate' => 'SUM', 'header_tip' => 'Net physical-store revenue (ex-VAT) in the last 30 days.', ), array( 'key' => 'first_created', 'label' => 'First created', 'type' => 'date', 'sortable' => true, 'empty' => 'not imported', 'header_tip' => 'When the product was first created in the eshop (from the ERP daily import).', ), array( 'key' => 'days_not_live', 'label' => 'Days not live', 'type' => 'integer', 'sortable' => true, 'empty' => '—', ), array( 'key' => 'status', 'label' => 'Status', 'type' => 'badge', 'filter' => 'select', 'format' => array( 'tone_key' => 'status_tone', 'labels' => array( '__create__' => 'not in eshop — create it' ), ), ), array( 'key' => 'needs_image', 'label' => 'Needs image', 'type' => 'boolean', 'filter' => 'select', 'hidden' => true, ), array( 'key' => 'needs_desc', 'label' => 'Needs description', 'type' => 'boolean', 'filter' => 'select', 'hidden' => true, ), array( 'key' => 'needs_cats', 'label' => 'Needs categories', 'type' => 'boolean', 'filter' => 'select', 'hidden' => true, ), array( 'key' => 'needs_brand', 'label' => 'Needs brand', 'type' => 'boolean', 'filter' => 'select', 'hidden' => true, ), array( 'key' => 'product_id', 'label' => 'Product ID', 'type' => 'id', 'hidden' => true, ), ), );