feat: search employee
This commit is contained in:
parent
c5a44034f0
commit
48a4c6492c
1 changed files with 37 additions and 22 deletions
|
|
@ -637,6 +637,7 @@ async function onSubmitCustomerBranch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultSearch = ref<(Customer & { branch: CustomerBranch[] })[]>();
|
const resultSearch = ref<(Customer & { branch: CustomerBranch[] })[]>();
|
||||||
|
const resultSearchEmployee = ref();
|
||||||
|
|
||||||
async function searchCustomer() {
|
async function searchCustomer() {
|
||||||
const resultList = await fetchList({
|
const resultList = await fetchList({
|
||||||
|
|
@ -649,6 +650,16 @@ async function searchCustomer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function searchEmployee() {
|
||||||
|
const resultList = await employeeStore.fetchList({
|
||||||
|
query: inputSearch.value,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (resultList) {
|
||||||
|
resultSearchEmployee.value = resultList.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function fetchListCustomer() {
|
async function fetchListCustomer() {
|
||||||
const resultList = await fetchList({
|
const resultList = await fetchList({
|
||||||
includeBranch: true,
|
includeBranch: true,
|
||||||
|
|
@ -1129,7 +1140,9 @@ watch(fieldSelectedCustomer, async () => {
|
||||||
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
||||||
v-model="inputSearch"
|
v-model="inputSearch"
|
||||||
debounce="500"
|
debounce="500"
|
||||||
@update:model-value="searchCustomer()"
|
@update:model-value="
|
||||||
|
selectorLabel === 'EMPLOYEE' ? searchEmployee() : searchCustomer()
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
@ -1266,7 +1279,8 @@ watch(fieldSelectedCustomer, async () => {
|
||||||
<div>
|
<div>
|
||||||
<PersonCard
|
<PersonCard
|
||||||
:list="
|
:list="
|
||||||
listEmployee.map((v: Employee) => ({
|
(!!inputSearch ? resultSearchEmployee : listEmployee).map(
|
||||||
|
(v: Employee) => ({
|
||||||
img: v.profileImageUrl,
|
img: v.profileImageUrl,
|
||||||
id: v.id,
|
id: v.id,
|
||||||
name:
|
name:
|
||||||
|
|
@ -1286,7 +1300,8 @@ watch(fieldSelectedCustomer, async () => {
|
||||||
value: calculateAge(v.dateOfBirth),
|
value: calculateAge(v.dateOfBirth),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})) || []
|
}),
|
||||||
|
) || []
|
||||||
"
|
"
|
||||||
@update-card="openDialogInputForm"
|
@update-card="openDialogInputForm"
|
||||||
@enter-card="openDialogInputForm"
|
@enter-card="openDialogInputForm"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue