From 9bde1f820d83c463b8f0ddc16ab3aeb3eaca65e4 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Fri, 8 Mar 2024 12:36:29 -0500 Subject: [PATCH] - Add new special filters Signed-off-by: Dave Richer --- _reference/reportFiltersAndSorters.md | 11 ++++++++--- .../report-center-modal-utils.js | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/_reference/reportFiltersAndSorters.md b/_reference/reportFiltersAndSorters.md index 2aea3f11a..0b5b16aaf 100644 --- a/_reference/reportFiltersAndSorters.md +++ b/_reference/reportFiltersAndSorters.md @@ -59,7 +59,7 @@ Filters can make use of reflection to pre-fill select boxes, the following is an "type": "internal", "name": "special.job_statuses" } - }, + } ``` in this example, a reflector with the type 'internal' (all types at the moment require this, and it is used for future functionality), with a name of `special.job_statuses` @@ -74,9 +74,13 @@ The following cases are available - `special.employees` - This will reflect the employees `bodyshop.employees` - `special.first_names` - This will reflect the first names `bodyshop.employees` - `special.last_names` - This will reflect the last names `bodyshop.employees` -- `special.referral_sources` - This will reflect the referral sources `bodyshop.md_referral_sources +- `special.referral_sources` - This will reflect the referral sources `bodyshop.md_referral_sources` - `special.class`- This will reflect the class `bodyshop.md_classes` -- +- `special.lost_sale_reasons` - This will reflect the lost sale reasons `bodyshop.md_lost_sale_reasons` +- `special.alt_transports` - This will reflect the alternative transports `bodyshop.appt_alt_transport` +- `special.payment_types` - This will reflect the payment types `bodyshop.md_payment_types` +- `special.payment_payers` - This is a special case with a key value set of [Customer, Insurance] + ### Path without brackets, multi level `"name": "jobs.joblines.mod_lb_hrs",` @@ -156,6 +160,7 @@ query gendoc_hours_sold_detail_open($starttz: timestamptz!, $endtz: timestamptz! - Do not add the ability to filter things that are already filtered as part of the original query, this would be redundant and could cause issues. - Do not add the ability to filter on things like FK constraints, must like the above example. +- *INHERITANCE CAVEAT* If you have a filters file on a parent report that has a child that you do not want the filters inherited from, you must place a blank filters file (valid json so {}) on the child report level. This will than fetch the child filters, which are empty and move along, versus inheriting the parent filters. ## Sorters diff --git a/client/src/components/report-center-modal/report-center-modal-utils.js b/client/src/components/report-center-modal/report-center-modal-utils.js index 97b693a61..b8a9e8adf 100644 --- a/client/src/components/report-center-modal/report-center-modal-utils.js +++ b/client/src/components/report-center-modal/report-center-modal-utils.js @@ -22,7 +22,6 @@ const generateOptionsFromArray = (bodyshop, path) => { })), 'value'); } - /** * Valid internal reflections * Note: This is intended for future functionality @@ -61,6 +60,23 @@ const generateOptionsFromObject = (bodyshop, path, labelPath, valuePath) => { */ const generateSpecialReflections = (bodyshop, finalPath) => { switch (finalPath) { + case 'payment_payers': + return [ + { + label: 'Customer', + value: 'Customer' + }, + { + label: 'Insurance', + value: 'Insurance' + } + ]; + case 'payment_types': + return generateOptionsFromArray(bodyshop, 'md_payment_types'); + case 'alt_transports': + return generateOptionsFromArray(bodyshop, 'appt_alt_transport'); + case 'lost_sale_reasons': + return generateOptionsFromArray(bodyshop, 'md_lost_sale_reasons'); // Special case because Referral Sources is an Array, not an Object. case 'referral_source': return generateOptionsFromArray(bodyshop, 'md_referral_sources');