BIG-58: add starts/ends with comparator option to advanced filter dropdown.

This commit is contained in:
a.bouhuolia
2021-09-13 20:01:58 +02:00
parent aabcf71621
commit 40ff1464c8
5 changed files with 23 additions and 0 deletions

View File

@@ -29,6 +29,8 @@ export const getTextCompatators = () => [
{ value: 'not_contain', label: intl.get('not_contain') }, { value: 'not_contain', label: intl.get('not_contain') },
{ value: 'equal', label: intl.get('equals') }, { value: 'equal', label: intl.get('equals') },
{ value: 'not_equal', label: intl.get('not_equals') }, { value: 'not_equal', label: intl.get('not_equals') },
{ value: 'starts_with', label: intl.get('starts_with') },
{ value: 'ends_with', label: intl.get('ends_with') },
]; ];
export const getDateCompatators = () => [ export const getDateCompatators = () => [

View File

@@ -209,6 +209,8 @@
"not_equal": "ليس متساوي", "not_equal": "ليس متساوي",
"contain": "يحتوي", "contain": "يحتوي",
"not_contain": "لا يحتوي", "not_contain": "لا يحتوي",
"starts_with": "يبدأ بـ",
"ends_with": "ينتهي بـ",
"cash": "النقدية", "cash": "النقدية",
"accrual": "الاستحقاق", "accrual": "الاستحقاق",
"from": "من", "from": "من",

View File

@@ -202,6 +202,8 @@
"not_equal": "Not Equal", "not_equal": "Not Equal",
"contain": "Contain", "contain": "Contain",
"not_contain": "Not Contain", "not_contain": "Not Contain",
"starts_with": "Starts with",
"ends_with": "Ends with",
"cash": "Cash", "cash": "Cash",
"accrual": "Accrual", "accrual": "Accrual",
"from": "From", "from": "From",

View File

@@ -255,6 +255,17 @@ export default abstract class DynamicFilterAbstructor
return (builder) => { return (builder) => {
builder.whereNot(comparatorColumn, 'LIKE', `%${role.value}%`); builder.whereNot(comparatorColumn, 'LIKE', `%${role.value}%`);
}; };
case COMPARATOR_TYPE.STARTS_WITH:
case COMPARATOR_TYPE.START_WITH:
return (builder) => {
builder.where(comparatorColumn, 'LIKE', `${role.value}%`);
};
case COMPARATOR_TYPE.ENDS_WITH:
case COMPARATOR_TYPE.END_WITH:
return (builder) => {
builder.where(comparatorColumn, 'LIKE', `%${role.value}`);
};
} }
}; };

View File

@@ -24,6 +24,12 @@ export const COMPARATOR_TYPE = {
AFTER: 'after', AFTER: 'after',
BEFORE: 'before', BEFORE: 'before',
IN: 'in', IN: 'in',
STARTS_WITH: 'starts_with',
START_WITH: 'start_with',
ENDS_WITH: 'ends_with',
END_WITH: 'end_with'
}; };
export const FIELD_TYPE = { export const FIELD_TYPE = {