diff --git a/src/components/03_customer-management/BranchCardCustomer.vue b/src/components/03_customer-management/BranchCardCustomer.vue index 85cd55d0..de7dce26 100644 --- a/src/components/03_customer-management/BranchCardCustomer.vue +++ b/src/components/03_customer-management/BranchCardCustomer.vue @@ -10,6 +10,7 @@ defineProps<{ telephone: string; businessTypePure: string; totalEmployee: number; + code: string; }; metadata?: unknown; badgeField?: string[]; @@ -48,7 +49,7 @@ defineProps<{
{{ data.branchName }} - {{ data.branchName }} + {{ data.code }}
@@ -75,18 +76,25 @@ defineProps<{ " />
-
{{ $t(key) }}
-
{{ data[key as keyof typeof data] }}
+
+ {{ + fieldSelected + ? $t(key) + : key !== 'address' && key !== 'telephone' + ? $t(`customer.table.${key}`) + : $t(`general.${key}`) + }} +
+
{{ data[key as keyof typeof data] || '-' }}
@@ -174,7 +182,7 @@ defineProps<{ } &.branch-card__pers { - --_branch-card-bg: var(--pink-6-hsl); + --_branch-card-bg: var(--teal-10-hsl); } &.branch-card__corp { diff --git a/src/pages/03_customer-management/BranchPage.vue b/src/pages/03_customer-management/BranchPage.vue index 5451fdbc..156dd372 100644 --- a/src/pages/03_customer-management/BranchPage.vue +++ b/src/pages/03_customer-management/BranchPage.vue @@ -167,6 +167,28 @@ const branchFieldSelected = ref< )[] >(fieldDisplay.value); +function getCustomerName( + record: CustomerBranch, + opts?: { + locale?: string; + }, +) { + const customer = record; + + return ( + { + ['CORP']: { + ['eng']: customer.registerNameEN, + ['tha']: customer.registerName, + }[opts?.locale || 'eng'], + ['PERS']: { + ['eng']: `${useOptionStore().mapOption(customer?.namePrefix)} ${customer?.firstNameEN} ${customer?.lastNameEN}`, + ['tha']: `${useOptionStore().mapOption(customer?.namePrefix)} ${customer?.firstName} ${customer?.lastName}`, + }[opts?.locale || 'eng'], + }[customer.customer.customerType] || '-' + ); +} + async function deleteBranchById(id: string) { return await new Promise((resolve) => { dialog({ @@ -229,8 +251,6 @@ async function fetchEmployee(opts: { branchId: string; pageSize?: number }) { visa: true, }); - console.log(res); - if (res) { listEmployee.value = res.data.result; } @@ -407,7 +427,6 @@ watch(
- {{ console.log(branch) }}