fix: ellipsis product card and cleanup

This commit is contained in:
puriphatt 2024-08-16 15:35:07 +07:00
parent c841ee4ed2
commit 266ee54e3b
2 changed files with 47 additions and 54 deletions

View file

@ -50,12 +50,12 @@ withDefaults(
@click="$emit('select', data)" @click="$emit('select', data)"
> >
<div class="row flex justify-between text-bold"> <div class="row flex justify-between text-bold">
<div class="col-9" :class="{ inactive: isDisabled }"> <div class="col ellipsis-2-lines" :class="{ inactive: isDisabled }">
{{ title ?? 'title' }} {{ title ?? 'title' }}
</div> </div>
<div <div
v-if="isSelected === false" v-if="isSelected === false"
class="col-3 relative-position" class="col-1 relative-position"
style="left: 10px; bottom: 10px" style="left: 10px; bottom: 10px"
> >
<q-btn <q-btn

View file

@ -145,8 +145,6 @@ const stat = ref<
const { t } = useI18n(); const { t } = useI18n();
const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL); const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL);
const isWorkProductGroup = ref(false);
const workProductGroupName = ref('');
const holdDialog = ref(false); const holdDialog = ref(false);
const imageDialog = ref(false); const imageDialog = ref(false);
const currentNode = ref<ProductGroup>(); const currentNode = ref<ProductGroup>();
@ -3640,11 +3638,13 @@ watch(
</template> </template>
</DialogForm> </DialogForm>
<!-- work product -->
<DialogForm <DialogForm
v-model:modal="dialogTotalProduct" v-model:modal="dialogTotalProduct"
noAddress noAddress
noAppBox noAppBox
title="สินค้าทั้งหมด" title="สินค้าทั้งหมด"
:saveAmount="selectProduct.length"
:submit=" :submit="
() => { () => {
selectProduct.forEach((i) => { selectProduct.forEach((i) => {
@ -3676,18 +3676,40 @@ watch(
} }
" "
> >
<div class="q-pa-lg full-height scroll column"> <div class="q-pa-lg full-height scroll column no-wrap">
<div class="row items-center justify-between"> <div class="row items-center justify-between">
<div class="row"> <q-checkbox
<q-checkbox :label="$t('selectAll')"
:label="$t('selectAll')" :model-value="
:model-value="selectProduct.length === productIsAdd?.length" selectProduct.length ===
@click=" productIsAdd?.filter((i) => {
() => { if (i.status === 'INACTIVE') {
if (selectProduct.length === productIsAdd?.length) { return false;
selectProduct = []; }
} else { return true;
productIsAdd?.forEach((i) => { }).length
"
@click="
() => {
if (
selectProduct.length ===
productIsAdd?.filter((i) => {
if (i.status === 'INACTIVE') {
return false;
}
return true;
}).length
) {
selectProduct = [];
} else {
productIsAdd
?.filter((i) => {
if (i.status === 'INACTIVE') {
return false;
}
return true;
})
.forEach((i) => {
const productExists = selectProduct.some( const productExists = selectProduct.some(
(product) => product.id === i.id, (product) => product.id === i.id,
); );
@ -3695,38 +3717,10 @@ watch(
selectProduct.push({ ...i }); selectProduct.push({ ...i });
} }
}); });
}
} }
" }
/> "
<q-btn />
flat
:icon="isWorkProductGroup ? 'mdi-ungroup' : 'mdi-group'"
class="rounded q-ml-lg q-mr-sm"
padding="4px 8px"
style="color: hsl(var(--text-mute-2))"
@click="
() => {
isWorkProductGroup = !isWorkProductGroup;
if (!isWorkProductGroup) workProductGroupName = '';
}
"
>
<q-tooltip>สรางกล</q-tooltip>
</q-btn>
<q-input
v-if="isWorkProductGroup"
dense
outlined
clearable
v-model="workProductGroupName"
style="width: 400px"
>
<template #prepend>
<div class="text-caption text-black">อกล:</div>
</template>
</q-input>
</div>
<q-input <q-input
lazy-rules="ondemand" lazy-rules="ondemand"
id="input-search-add-product" id="input-search-add-product"
@ -3745,14 +3739,13 @@ watch(
</q-input> </q-input>
</div> </div>
<div class="row q-mt-md q-col-gutter-md col"> <div
<div class="flex col justify-center items-center"
class="flex col justify-center items-center" v-if="resultSearchProduct?.length === 0"
v-if="resultSearchProduct?.length === 0" >
> <NoData />
<NoData /> </div>
</div> <div v-else class="row q-mt-md q-col-gutter-md">
<div <div
class="col-md-3 col-sm-6 col-12" class="col-md-3 col-sm-6 col-12"
v-for="i in (!!inputSearchProductAndService v-for="i in (!!inputSearchProductAndService