From 06f3b2b1bb2ce6601ebc6989066f170230b4569b Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:41:22 +0700 Subject: [PATCH] feat: branch stats --- src/components/StatCardComponent.vue | 2 +- src/i18n/th-th/branch.ts | 2 +- src/pages/01_branch-management/MainPage.vue | 43 +++++++-------------- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/components/StatCardComponent.vue b/src/components/StatCardComponent.vue index 81a2430a..e542a05d 100644 --- a/src/components/StatCardComponent.vue +++ b/src/components/StatCardComponent.vue @@ -38,7 +38,7 @@ const color = ['pink', 'purple'];
{{ v.amount }}
-
{{ v.label }}
+
{{ $t(v.label) }}
diff --git a/src/i18n/th-th/branch.ts b/src/i18n/th-th/branch.ts index 77c30bc6..44e3720c 100644 --- a/src/i18n/th-th/branch.ts +++ b/src/i18n/th-th/branch.ts @@ -1,4 +1,4 @@ export default { branchLabel: 'สาขา', - branchHQLabel: 'สาขาใหญ่', + branchHQLabel: 'สำนักงานใหญ่', }; diff --git a/src/pages/01_branch-management/MainPage.vue b/src/pages/01_branch-management/MainPage.vue index e150ca20..7a8518f5 100644 --- a/src/pages/01_branch-management/MainPage.vue +++ b/src/pages/01_branch-management/MainPage.vue @@ -34,7 +34,7 @@ const currentBranchContactIdEdit = ref(''); const showCurrentBranch = ref(); const shape = ref(false); -const openBranchDrawer = ref(true); +const openBranchDrawer = ref(false); const openCardDetails = ref(false); const openTableCard = ref(true); @@ -82,34 +82,7 @@ const selected = ref(''); const expanded = ref([]); -const branchStat = ref< - { - amount: number; - label: string; - }[] ->([ - { - amount: 1, - label: 'สำนักงานใหญ่ 1', - }, - - { - amount: 2, - label: 'สำนักงานใหญ่ 2', - }, - { - amount: 3, - label: 'สำนักงานใหญ่ 3', - }, - { - amount: 4, - label: 'สำนักงานใหญ่ 4', - }, - { - amount: 5, - label: 'สำนักงานใหญ่ 5', - }, -]); +const branchStat = ref<{ amount: number; label: string }[]>([]); const treeData = ref([]); @@ -381,6 +354,18 @@ async function fetchSubBranch(id: string) { onMounted(async () => { getTree(); + const result = await branchStore.stats(); + + if (result) { + branchStat.value.push({ + amount: result.hq, + label: 'branchHQLabel', + }); + branchStat.value.push({ + amount: result.br, + label: 'branchLabel', + }); + } });