fix: assigned to filter was not working

This commit is contained in:
Shariq Ansari 2024-01-21 21:33:50 +05:30
parent 5b682cc2d7
commit a976c0b7f2

View File

@ -39,7 +39,7 @@
type="select"
:value="f.operator"
@change="(e) => updateOperator(e, f)"
:options="getOperators(f.field.fieldtype)"
:options="getOperators(f.field.fieldtype, f.field.fieldname)"
placeholder="Operator"
/>
</div>
@ -193,7 +193,7 @@ function convertFilters(data, allFilters) {
return new Set(f)
}
function getOperators(fieldtype) {
function getOperators(fieldtype, fieldname) {
let options = []
if (typeString.includes(fieldtype)) {
options.push(
@ -205,6 +205,12 @@ function getOperators(fieldtype) {
]
)
}
if (fieldname === '_assign') {
options = [
{ label: 'Like', value: 'like' },
{ label: 'Not Like', value: 'not like' },
]
}
if (typeNumber.includes(fieldtype)) {
options.push(
...[
@ -351,9 +357,6 @@ function parseFilters(filters) {
}
function transformIn(f) {
if (f.fieldname === '_assign') {
f.operator = f.operator === 'is' ? 'like' : 'not like'
}
if (f.operator.includes('like') && !f.value.includes('%')) {
f.value = `%${f.value}%`
}