fix(04): product search

This commit is contained in:
puriphatt 2024-10-17 13:31:36 +07:00
parent 93d7aa4eb7
commit 6ddf3a9030

View file

@ -195,6 +195,7 @@ const refImageUpload = ref<InstanceType<typeof ImageUploadDialog>>();
const inputSearch = ref('');
const inputSearchProductAndService = ref('');
const inputSearchWorkProduct = ref('');
const currentStatusProduct = ref(false);
const drawerInfo = ref(false);
@ -508,8 +509,9 @@ const onCreateImageList = ref<{
}>({ selectedImage: '', list: [] });
async function searchProduct(isAdd: boolean = true) {
console.log('spd');
const res = await fetchListProduct({
query: inputSearchProductAndService.value,
query: inputSearchWorkProduct.value,
});
if (res) {
@ -1287,7 +1289,6 @@ async function fetchStatus() {
async function alternativeFetch() {
if (productAndServiceTab.value === 'product') {
await fetchListOfProduct();
flowStore.rotate();
}
if (productAndServiceTab.value === 'service') {
@ -1532,9 +1533,6 @@ watch(
</script>
<template>
<!-- 1:{{ inputSearch }}
<br />
2:{{ inputSearchProductAndService }} -->
<ButtonAddComponent
hide-icon
v-if="actionDisplay && !currentNoAction"
@ -3248,7 +3246,7 @@ watch(
:close="
() => {
dialogTotalProduct = false;
inputSearchProductAndService = '';
inputSearchWorkProduct = '';
}
"
>
@ -3267,7 +3265,7 @@ watch(
<q-checkbox
:label="$t('general.selectAll')"
:model-value="
!!inputSearchProductAndService
!!inputSearchWorkProduct
? selectProduct.length ===
resultSearchProduct?.filter((i) => {
if (i.status === 'INACTIVE') {
@ -3286,7 +3284,7 @@ watch(
@click="
() => {
if (
!!inputSearchProductAndService
!!inputSearchWorkProduct
? selectProduct.length ===
resultSearchProduct?.filter((i) => {
if (i.status === 'INACTIVE') {
@ -3304,7 +3302,7 @@ watch(
) {
selectProduct = [];
} else {
!!inputSearchProductAndService
!!inputSearchWorkProduct
? resultSearchProduct && selectAllProduct(resultSearchProduct)
: productIsAdd && selectAllProduct(productIsAdd);
}
@ -3317,7 +3315,7 @@ watch(
dense
:label="$t('general.search')"
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
v-model="inputSearchProductAndService"
v-model="inputSearchWorkProduct"
debounce="500"
@update:model-value="searchProduct()"
>
@ -3343,7 +3341,7 @@ watch(
<div v-else class="row q-col-gutter-md full-width">
<div
class="col-md-3 col-sm-6 col-12"
v-for="i in (!!inputSearchProductAndService
v-for="i in (!!inputSearchWorkProduct
? resultSearchProduct
: productIsAdd
)?.filter((i) => {