From ed6a0cee3d2aea633e2c6046a4cd58ecfb66b90d Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Wed, 18 Dec 2024 11:49:26 +0700 Subject: [PATCH] refactor: handle status --- .../03_customer-management/TableEmpoloyee.vue | 11 +++++++++++ src/pages/01_branch-management/MainPage.vue | 2 +- src/pages/02_personnel-management/MainPage.vue | 13 ++----------- src/pages/04_product-service/MainPage.vue | 7 ++++++- src/stores/product-service/index.ts | 4 ++-- src/stores/product-service/types.ts | 1 + 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/components/03_customer-management/TableEmpoloyee.vue b/src/components/03_customer-management/TableEmpoloyee.vue index 61346e5a..cb156e44 100644 --- a/src/components/03_customer-management/TableEmpoloyee.vue +++ b/src/components/03_customer-management/TableEmpoloyee.vue @@ -364,4 +364,15 @@ defineEmits<{ --_fg: var(--gender-female); } } + +.status-active { + --_branch-status-color: var(--green-6-hsl); +} + +.status-inactive { + --_branch-status-color: var(--stone-5-hsl); + --_branch-badge-bg: var(--stone-5-hsl); + filter: grayscale(0.5); + opacity: 0.5; +} diff --git a/src/pages/01_branch-management/MainPage.vue b/src/pages/01_branch-management/MainPage.vue index 878b67d9..72ac7d41 100644 --- a/src/pages/01_branch-management/MainPage.vue +++ b/src/pages/01_branch-management/MainPage.vue @@ -1811,7 +1811,7 @@ watch(currentHq, () => { style="position: absolute; z-index: 99999; top: 0; right: 0" >
-
+
diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index b9c12a97..d452c046 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -1118,6 +1118,7 @@ async function submitService(notClose = false) { const res = await createService( { ...formDataProductService.value, + workflowId: currWorkflow.value?.id || '', }, onCreateImageList.value, @@ -1197,7 +1198,11 @@ async function submitGroup() { await editProductGroup(currentIdGroupTree.value, formDataGroup.value); else await editProductGroup(currentIdGroup.value, formDataGroup.value); } else { - const res = await createProductGroup(formDataGroup.value); + const res = await createProductGroup({ + ...formDataGroup.value, + status: + currentStatusGroupType.value === 'CREATED' ? undefined : 'INACTIVE', + }); if (res) { allStat.value[0].count = allStat.value[0].count + 1; diff --git a/src/stores/product-service/index.ts b/src/stores/product-service/index.ts index 210177b8..ef12a196 100644 --- a/src/stores/product-service/index.ts +++ b/src/stores/product-service/index.ts @@ -164,7 +164,7 @@ const useProductServiceStore = defineStore('api-product-service', () => { list: { url: string; imgFile: File | null; name: string }[]; }, ) { - const { image, status, ...payload } = data; + const { image, ...payload } = data; const res = await api.post('/product', { ...payload, @@ -271,7 +271,7 @@ const useProductServiceStore = defineStore('api-product-service', () => { list: { url: string; imgFile: File | null; name: string }[]; }, ) { - const { image, status, ...payload } = data; + const { image, ...payload } = data; const res = await api.post( '/service', diff --git a/src/stores/product-service/types.ts b/src/stores/product-service/types.ts index 0beb9d98..a7d794be 100644 --- a/src/stores/product-service/types.ts +++ b/src/stores/product-service/types.ts @@ -232,6 +232,7 @@ export interface ProductGroupCreate { code: string; shared?: boolean; registeredBranchId: string; + status?: Status; } export interface ProductGroupUpdate {