HOTFIX: customerFilter sales person input #939

Merged
jsegarra merged 2 commits from hotfix_customer_salesPerson_Filter into master 2024-11-14 15:26:45 +00:00
1 changed files with 32 additions and 3 deletions

View File

@ -11,6 +11,20 @@ defineProps({
required: true, required: true,
}, },
}); });
const handleSalesModelValue = (val) => ({
or: [
{ id: val },
{ name: val },
{ nickname: { like: '%' + val + '%' } },
{ code: { like: `${val}%` } },
],
});
const exprBuilder = (param, value) => {
return {
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
};
};
</script> </script>
<template> <template>
@ -52,14 +66,18 @@ defineProps({
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
url="Workers/activeWithInheritedRole" url="Workers/search"
:filter="{ where: { role: 'salesPerson' } }" :params="{
departmentCodes: ['VT'],
}"
auto-load auto-load
:label="t('Salesperson')" :label="t('Salesperson')"
:expr-builder="exprBuilder"
v-model="params.salesPersonFk" v-model="params.salesPersonFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
option-value="id" option-value="id"
option-label="name" option-label="name"
sort-by="nickname ASC"
emit-value emit-value
map-options map-options
use-input use-input
@ -68,7 +86,18 @@ defineProps({
outlined outlined
rounded rounded
:input-debounce="0" :input-debounce="0"
/> >
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>{{ opt.name }}</QItemLabel>
<QItemLabel caption>
{{ opt.nickname }},{{ opt.code }}
</QItemLabel>
</QItemSection>
</QItem>
</template></VnSelect
>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">