- Add new special filters

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-03-08 12:47:11 -05:00
parent 9bde1f820d
commit 1c8f377212
2 changed files with 17 additions and 8 deletions

View File

@@ -142,7 +142,8 @@ function FiltersSection({filters, form, bodyshop}) {
return generateInternalReflections({ return generateInternalReflections({
bodyshop, bodyshop,
upperPath, upperPath,
finalPath finalPath,
t
}); });
}; };

View File

@@ -56,19 +56,26 @@ const generateOptionsFromObject = (bodyshop, path, labelPath, valuePath) => {
* Generate special reflections * Generate special reflections
* @param bodyshop * @param bodyshop
* @param finalPath * @param finalPath
* @param t - i18n
* @returns {{label: *, value: *}[]|{label: *, value: *}[]|{label: string, value: *}[]|*[]} * @returns {{label: *, value: *}[]|{label: *, value: *}[]|{label: string, value: *}[]|*[]}
*/ */
const generateSpecialReflections = (bodyshop, finalPath) => { const generateSpecialReflections = (bodyshop, finalPath, t) => {
switch (finalPath) { switch (finalPath) {
case 'payment_payers': case 'payment_payers':
return [ return [
{ {
label: 'Customer', label: t("payments.labels.customer"),
value: 'Customer' value: t("payments.labels.customer"),
}, },
{ {
label: 'Insurance', label: t("payments.labels.insurance"),
value: 'Insurance' value: t("payments.labels.insurance"),
},
// This is a weird one supposedly only used by one shop and could potentially be
// placed behind a SplitSDK
{
label: t("payments.labels.external"),
value: t("payments.labels.external"),
} }
]; ];
case 'payment_types': case 'payment_types':
@@ -137,12 +144,13 @@ const generateBodyshopReflections = (bodyshop, finalPath) => {
* @param bodyshop * @param bodyshop
* @param upperPath * @param upperPath
* @param finalPath * @param finalPath
* @param t - i18n
* @returns {{label: *, value: *}[]|[]|{label: *, value: *}[]|{label: string, value: *}[]|{label: *, value: *}[]|*[]} * @returns {{label: *, value: *}[]|[]|{label: *, value: *}[]|{label: string, value: *}[]|{label: *, value: *}[]|*[]}
*/ */
const generateInternalReflections = ({bodyshop, upperPath, finalPath}) => { const generateInternalReflections = ({bodyshop, upperPath, finalPath, t}) => {
switch (upperPath) { switch (upperPath) {
case 'special': case 'special':
return generateSpecialReflections(bodyshop, finalPath); return generateSpecialReflections(bodyshop, finalPath, t);
case 'bodyshop': case 'bodyshop':
return generateBodyshopReflections(bodyshop, finalPath); return generateBodyshopReflections(bodyshop, finalPath);
default: default: