feat: count product type, service, product

This commit is contained in:
puriphatt 2024-07-01 04:49:11 +00:00
parent 51e8d2897e
commit 962b69baf6
3 changed files with 14 additions and 4 deletions

View file

@ -12,6 +12,9 @@ withDefaults(
isType?: boolean; isType?: boolean;
id?: string; id?: string;
isDisabled?: boolean; isDisabled?: boolean;
countType?: number;
countProduct?: number;
countService?: number;
}>(), }>(),
{ {
color: 'var(--brand-1)', color: 'var(--brand-1)',
@ -159,21 +162,21 @@ withDefaults(
style="border-radius: 5px" style="border-radius: 5px"
> >
<div><q-icon name="mdi-folder-table" /></div> <div><q-icon name="mdi-folder-table" /></div>
<div>10</div> <div>{{ countType }}</div>
</div> </div>
<div <div
class="col-3 bordered row justify-between q-px-sm rounded no-wrap" class="col-3 bordered row justify-between q-px-sm rounded no-wrap"
style="border-radius: 5px" style="border-radius: 5px"
> >
<div><q-icon name="mdi-server-network" /></div> <div><q-icon name="mdi-server-network" /></div>
<div>10</div> <div>{{ countService }}</div>
</div> </div>
<div <div
class="col-3 bordered row justify-between q-px-sm rounded no-wrap" class="col-3 bordered row justify-between q-px-sm rounded no-wrap"
style="border-radius: 5px" style="border-radius: 5px"
> >
<div><q-icon name="mdi-shopping" /></div> <div><q-icon name="mdi-shopping" /></div>
<div>10</div> <div>{{ countProduct }}</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1250,8 +1250,11 @@ watch(inputSearchProductAndService, async () => {
> >
<ProductCardComponent <ProductCardComponent
v-if="productMode === 'type'" v-if="productMode === 'type'"
:title="v.name"
isType isType
:count-product="v._count.product"
:count-type="v._count.type"
:count-service="999"
:title="v.name"
:subtitle="v.code" :subtitle="v.code"
:date="new Date(v.updatedAt)" :date="new Date(v.updatedAt)"
:status="v.status" :status="v.status"
@ -1304,6 +1307,9 @@ watch(inputSearchProductAndService, async () => {
v-else-if="productMode === 'group'" v-else-if="productMode === 'group'"
:title="v.name" :title="v.name"
:subtitle="v.code" :subtitle="v.code"
:count-product="v._count.product"
:count-type="v._count.type"
:count-service="999"
:date="new Date(v.updatedAt)" :date="new Date(v.updatedAt)"
:status="v.status" :status="v.status"
color="var(--pink-6-hsl)" color="var(--pink-6-hsl)"

View file

@ -158,6 +158,7 @@ export type ProductGroup = {
createdAt: string; createdAt: string;
updatedBy: string; updatedBy: string;
updatedAt: string; updatedAt: string;
_count: { product: number; type: number };
}; };
export interface ProductGroupCreate { export interface ProductGroupCreate {