|
@@ -39,13 +39,11 @@ SELECT
|
|
|
'filter' AS id,
|
|
|
'get' AS method,
|
|
|
'' AS title,
|
|
|
- 'apply.sql' AS action,
|
|
|
'Apply' AS validate
|
|
|
;
|
|
|
|
|
|
SELECT
|
|
|
'path' AS name,
|
|
|
- '' AS label,
|
|
|
sqlpage.path() AS value,
|
|
|
'hidden' AS type
|
|
|
;
|
|
@@ -54,70 +52,43 @@ SELECT
|
|
|
'products[]' AS name,
|
|
|
'Product' AS label,
|
|
|
4 AS width,
|
|
|
- 'select' AS "type",
|
|
|
+ 'select' AS type,
|
|
|
TRUE AS dropdown,
|
|
|
TRUE AS multiple,
|
|
|
- json_agg(json_build_object(
|
|
|
- 'label', o.name,
|
|
|
- 'value', o.name,
|
|
|
- 'selected', COALESCE(o.selected, FALSE)
|
|
|
- ) ORDER BY o.name) AS options
|
|
|
-FROM sqlpage_options o
|
|
|
-WHERE
|
|
|
- o.type = 'product'
|
|
|
-AND
|
|
|
- o.session = sqlpage.cookie('session')
|
|
|
+ $product_options AS options
|
|
|
;
|
|
|
SELECT
|
|
|
'categories[]' AS name,
|
|
|
'Categories' AS label,
|
|
|
4 AS width,
|
|
|
- 'select' AS "type",
|
|
|
+ 'select' AS type,
|
|
|
TRUE AS dropdown,
|
|
|
TRUE AS multiple,
|
|
|
- json_agg(json_build_object(
|
|
|
- 'label', o.name,
|
|
|
- 'value', o.name,
|
|
|
- 'selected', COALESCE(o.selected, FALSE)
|
|
|
- ) ORDER BY o.name) AS options
|
|
|
-FROM sqlpage_options o
|
|
|
-WHERE
|
|
|
- o.type = 'category'
|
|
|
-AND
|
|
|
- o.session = sqlpage.cookie('session')
|
|
|
+ $category_options AS options
|
|
|
;
|
|
|
SELECT
|
|
|
'groups[]' AS name,
|
|
|
'Groups' AS label,
|
|
|
4 AS width,
|
|
|
- 'select' AS "type",
|
|
|
+ 'select' AS type,
|
|
|
TRUE AS dropdown,
|
|
|
TRUE AS multiple,
|
|
|
- json_agg(json_build_object(
|
|
|
- 'label', o.name,
|
|
|
- 'value', o.name,
|
|
|
- 'selected', COALESCE(o.selected, FALSE)
|
|
|
- ) ORDER BY o.name) AS options
|
|
|
-FROM sqlpage_options o
|
|
|
-WHERE
|
|
|
- o.type = 'group'
|
|
|
-AND
|
|
|
- o.session = sqlpage.cookie('session')
|
|
|
-;
|
|
|
-SELECT
|
|
|
- 'start' AS name,
|
|
|
- 'From' AS label,
|
|
|
- 2 AS width,
|
|
|
- (SELECT COALESCE((SELECT name FROM sqlpage_options WHERE type = 'start'), to_char(now()-'30 days'::interval, 'YYYY-MM-DD'))) AS value,
|
|
|
- 'date' AS type
|
|
|
-;
|
|
|
-SELECT
|
|
|
- 'end' AS name,
|
|
|
- 'To' AS label,
|
|
|
- 2 AS width,
|
|
|
- (SELECT COALESCE((SELECT name FROM sqlpage_options WHERE type = 'end'), to_char(now(), 'YYYY-MM-DD'))) AS value,
|
|
|
- 'date' AS type
|
|
|
-;
|
|
|
+ $group_options AS options
|
|
|
+;
|
|
|
+--SELECT
|
|
|
+-- 'start' AS name,
|
|
|
+-- 'From' AS label,
|
|
|
+-- 2 AS width,
|
|
|
+-- (SELECT COALESCE((SELECT name FROM sqlpage_options WHERE type = 'start'), to_char(now()-'30 days'::interval, 'YYYY-MM-DD'))) AS value,
|
|
|
+-- 'date' AS type
|
|
|
+--;
|
|
|
+--SELECT
|
|
|
+-- 'end' AS name,
|
|
|
+-- 'To' AS label,
|
|
|
+-- 2 AS width,
|
|
|
+-- (SELECT COALESCE((SELECT name FROM sqlpage_options WHERE type = 'end'), to_char(now(), 'YYYY-MM-DD'))) AS value,
|
|
|
+-- 'date' AS type
|
|
|
+--;
|
|
|
SELECT
|
|
|
'tags[]' AS name,
|
|
|
'Tags' AS label,
|
|
@@ -125,69 +96,60 @@ SELECT
|
|
|
'select' AS "type",
|
|
|
TRUE AS dropdown,
|
|
|
TRUE AS multiple,
|
|
|
- json_agg(json_build_object(
|
|
|
- 'label', o.name,
|
|
|
- 'value', o.name,
|
|
|
- 'selected', COALESCE(o.selected, FALSE)
|
|
|
- ) ORDER BY o.name) AS options
|
|
|
-FROM sqlpage_options o
|
|
|
-WHERE
|
|
|
- o.type = 'tag'
|
|
|
-AND
|
|
|
- o.session = sqlpage.cookie('session')
|
|
|
-;
|
|
|
-SELECT
|
|
|
- 'unit_volume' AS name,
|
|
|
- 'Unit (vol.)' AS label,
|
|
|
- 1 AS width,
|
|
|
- 'select' AS type,
|
|
|
- json_agg(json_build_object(
|
|
|
- 'label', o.name,
|
|
|
- 'value', o.name,
|
|
|
- 'selected', COALESCE(o.selected, FALSE)
|
|
|
- ) ORDER BY o.name) AS options
|
|
|
-FROM sqlpage_options o
|
|
|
-WHERE
|
|
|
- o.type = 'unit_volume'
|
|
|
-AND
|
|
|
- o.session = sqlpage.cookie('session')
|
|
|
-;
|
|
|
-SELECT
|
|
|
- 'unit_mass' AS name,
|
|
|
- 'Unit (mass)' AS label,
|
|
|
- 1 AS width,
|
|
|
- 'select' AS type,
|
|
|
- $unit_mass AS value,
|
|
|
- json_agg(json_build_object(
|
|
|
- 'label', o.name,
|
|
|
- 'value', o.name,
|
|
|
- 'selected', COALESCE(o.selected, FALSE)
|
|
|
- ) ORDER BY o.name) AS options
|
|
|
-FROM sqlpage_options o
|
|
|
-WHERE
|
|
|
- o.type = 'unit_mass'
|
|
|
-AND
|
|
|
- o.session = sqlpage.cookie('session')
|
|
|
-;
|
|
|
-SELECT
|
|
|
- 'unit_count[]' AS name,
|
|
|
- 'Unit (count)' AS label,
|
|
|
- 2 AS width,
|
|
|
- 'select' AS type,
|
|
|
- TRUE AS multiple,
|
|
|
- TRUE AS dropdown,
|
|
|
- '' AS value,
|
|
|
- json_agg(json_build_object(
|
|
|
- 'label', o.name,
|
|
|
- 'value', o.name,
|
|
|
- 'selected', COALESCE(o.selected, FALSE)
|
|
|
- ) ORDER BY o.name) AS options
|
|
|
-FROM sqlpage_options o
|
|
|
-WHERE
|
|
|
- o.type = 'unit_count'
|
|
|
-AND
|
|
|
- o.session = sqlpage.cookie('session')
|
|
|
-;
|
|
|
+ $tag_options AS options
|
|
|
+;
|
|
|
+--SELECT
|
|
|
+-- 'unit_volume' AS name,
|
|
|
+-- 'Unit (vol.)' AS label,
|
|
|
+-- 1 AS width,
|
|
|
+-- 'select' AS type,
|
|
|
+-- json_agg(json_build_object(
|
|
|
+-- 'label', o.name,
|
|
|
+-- 'value', o.name,
|
|
|
+-- 'selected', COALESCE(o.selected, FALSE)
|
|
|
+-- ) ORDER BY o.name) AS options
|
|
|
+--FROM sqlpage_options o
|
|
|
+--WHERE
|
|
|
+-- o.type = 'unit_volume'
|
|
|
+--AND
|
|
|
+-- o.session = sqlpage.cookie('session')
|
|
|
+--;
|
|
|
+--SELECT
|
|
|
+-- 'unit_mass' AS name,
|
|
|
+-- 'Unit (mass)' AS label,
|
|
|
+-- 1 AS width,
|
|
|
+-- 'select' AS type,
|
|
|
+-- $unit_mass AS value,
|
|
|
+-- json_agg(json_build_object(
|
|
|
+-- 'label', o.name,
|
|
|
+-- 'value', o.name,
|
|
|
+-- 'selected', COALESCE(o.selected, FALSE)
|
|
|
+-- ) ORDER BY o.name) AS options
|
|
|
+--FROM sqlpage_options o
|
|
|
+--WHERE
|
|
|
+-- o.type = 'unit_mass'
|
|
|
+--AND
|
|
|
+-- o.session = sqlpage.cookie('session')
|
|
|
+--;
|
|
|
+--SELECT
|
|
|
+-- 'unit_count[]' AS name,
|
|
|
+-- 'Unit (count)' AS label,
|
|
|
+-- 2 AS width,
|
|
|
+-- 'select' AS type,
|
|
|
+-- TRUE AS multiple,
|
|
|
+-- TRUE AS dropdown,
|
|
|
+-- '' AS value,
|
|
|
+-- json_agg(json_build_object(
|
|
|
+-- 'label', o.name,
|
|
|
+-- 'value', o.name,
|
|
|
+-- 'selected', COALESCE(o.selected, FALSE)
|
|
|
+-- ) ORDER BY o.name) AS options
|
|
|
+--FROM sqlpage_options o
|
|
|
+--WHERE
|
|
|
+-- o.type = 'unit_count'
|
|
|
+--AND
|
|
|
+-- o.session = sqlpage.cookie('session')
|
|
|
+--;
|
|
|
SELECT
|
|
|
'clear' AS name,
|
|
|
'Clear' AS value,
|