0 ? home_url( '/?p=' . $id ) : ''; } } return array( 'id' => 'insights_stock_check', 'label' => 'Stock check', 'description' => 'Products that cannot be sold right now: out of stock, or with no stock figure set at all.', 'group' => 'eshop_insights', 'section' => 'stock_management', 'icon' => 'clipboard-check', 'tier' => 'pro', 'scope' => 'both', 'source' => 'table', 'table' => '{prefix}aieo_core_product_vitals', 'registry_id' => 'insights_t14.stock_lookup', 'version' => '1', 'per_page' => 50, 'base_where' => 'stock < 1 OR stock IS NULL', 'row_key' => 'id', 'default_sort' => array( 'stock', 'asc' ), 'empty_state' => 'Nothing is out of stock and every product has a stock figure. This report fills when either stops being true.', 'filter_bar' => array( 'first' => array( 'stock_state', 'menu_category', 'head_category', 'sub_category', 'brand' ) ), 'columns' => array( array( 'key' => 'id', 'label' => 'Row', 'type' => 'id', 'hidden' => true, ), array( 'key' => 'image_url', 'label' => 'Image', 'type' => 'image', 'format' => array( 'size' => 44, 'rehost' => true ), 'width' => '58px', 'sortable' => false, 'empty' => '', ), array( 'key' => 'name', 'label' => 'Product', 'type' => 'link', 'format' => array( 'href' => 'aieo_stock_check_permalink' ), 'subline' => 'sku', 'sortable' => true, 'searchable' => true, 'filter' => 'text', 'truncate' => 52, 'tooltip' => true, ), array( 'key' => 'product_id', 'label' => 'ID', 'type' => 'id', 'sortable' => true, 'searchable' => true, 'filter' => 'number', ), array( 'key' => 'sku', 'label' => 'SKU', 'type' => 'code', 'searchable' => true, 'filter' => 'text', 'hidden' => true, ), array( 'key' => 'gtin', 'label' => 'GTIN', 'type' => 'code', 'sortable' => true, 'searchable' => true, 'empty' => '', ), array( 'key' => 'stock', 'label' => 'Stock', 'type' => 'integer', 'sortable' => true, 'filter' => 'number_range', 'bands' => array( array( 'max' => -1, 'tone' => 'danger' ), array( 'min' => 0, 'max' => 0, 'tone' => 'muted' ), ), ), array( 'key' => 'stock_state', 'label' => 'State', 'type' => 'badge', 'select' => "CASE WHEN stock IS NULL THEN 'not_set' ELSE 'out_of_stock' END", 'sortable' => true, 'filter' => 'select', 'format' => array( 'map' => array( 'out_of_stock' => 'danger', 'not_set' => 'warning' ), 'labels' => array( 'out_of_stock' => 'Out of stock', 'not_set' => 'Stock not set', ), ), ), array( 'key' => 'price', 'label' => 'Price', 'type' => 'money', 'sortable' => true, ), array( 'key' => 'brand', 'label' => 'Brand', 'type' => 'text', 'sortable' => true, 'filter' => 'multiselect', ), array( 'key' => 'menu_category', 'label' => 'Menu category', 'type' => 'text', 'sortable' => true, 'filter' => 'multiselect', ), array( 'key' => 'head_category', 'label' => 'Head category', 'type' => 'text', 'sortable' => true, 'filter' => 'multiselect', ), array( 'key' => 'sub_category', 'label' => 'Sub category', 'type' => 'text', 'sortable' => true, 'filter' => 'multiselect', ), ), );