'' GROUP BY p.batch_ref "; return array( 'id' => 'preorder_order_batches', 'label' => 'Ordered batches', 'description' => '', 'scope' => 'local', 'source' => 'sql', 'sql' => $aieo_pb_sql, 'registry_id' => 'supplier_orders.order_batches', 'version' => '1', 'per_page' => 25, 'row_key' => 'batch_ref', 'default_sort' => array( 'ordered_at', 'desc' ), 'empty_state' => 'No ordered batches yet. Approve pre-order lines in the queue above and use Mark ordered — each supplier gets a batch reference that appears here.', 'actions' => array( array( 'id' => 'batch_export', 'label' => 'Download XLSX', ), array( 'id' => 'batch_email', 'label' => 'Email the supplier', 'confirm' => 'Email this batch to the supplier now?', ), ), 'columns' => array( array( 'key' => 'batch_ref', 'label' => 'Batch', 'type' => 'code', 'sortable' => true, 'searchable' => true, ), array( 'key' => 'supplier', 'label' => 'Supplier', 'type' => 'text', 'sortable' => true, 'filter' => 'select', 'empty' => '— unresolved —', ), array( 'key' => 'line_count', 'label' => 'Lines', 'type' => 'integer', 'sortable' => true, ), array( 'key' => 'total_qty', 'label' => 'Quantity', 'type' => 'integer', 'sortable' => true, ), array( 'key' => 'ordered_at', 'label' => 'Ordered at', 'type' => 'datetime', 'width' => '150px', 'nowrap' => true, 'sortable' => true, 'format' => array( 'tz' => 'utc' ), ), array( 'key' => 'received_lines', 'label' => 'Received', 'type' => 'integer', 'sortable' => true, 'empty_zero' => true, ), array( 'key' => 'open_lines', 'label' => 'Outstanding', 'type' => 'integer', 'sortable' => true, 'empty_zero' => true, ), array( 'key' => 'supplier_term_id', 'label' => 'Supplier ID', 'type' => 'id', 'hidden' => true ), ), );