From 0532c6842f22abf7ae7cb35d9ba1c942dc1f9a15 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 10 Apr 2024 23:11:51 +0700 Subject: [PATCH 1/6] feat: user type => roleData --- src/stores/user/types.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/stores/user/types.ts b/src/stores/user/types.ts index c17d8d1a..d383f194 100644 --- a/src/stores/user/types.ts +++ b/src/stores/user/types.ts @@ -71,7 +71,7 @@ export type UserCreate = { firstName: string; userRole: string; userType: string; - keycloakId: string; + keycloakId?: string; profileImage?: File | null; // required but not strict birthDate?: Date | null; responsibleArea: string; @@ -100,9 +100,15 @@ export type UserTypeStats = { export type UserOption = { hqOpts: Option[]; brOpts: Option[]; + roleOpts: Option[]; }; export type Option = { label: string; value: string; }; + +export type RoleData = { + id: string; + name: string; +} From cecf2732afd17ebdf15cfd57404f5b56a0acf31b Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 10 Apr 2024 23:12:24 +0700 Subject: [PATCH 2/6] fix: VueDatePicker font --- src/css/quasar.variables.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index c470780d..4b1fb9d9 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -51,3 +51,7 @@ $separator-dark-color: var(--border-color); .q-field--dense .q-field__label { font-family: 'Noto Sans Thai', sans-serif; } + +.q-field__inner { + font-family: 'Noto Sans Thai', sans-serif; +} From 0712ccba1edd46acdd9b8973336e5241cc804176 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 10 Apr 2024 23:13:38 +0700 Subject: [PATCH 3/6] fix: PersonCard => profile img --- src/components/home/PersonCard.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/home/PersonCard.vue b/src/components/home/PersonCard.vue index 8bb8258e..c2891c7b 100644 --- a/src/components/home/PersonCard.vue +++ b/src/components/home/PersonCard.vue @@ -119,7 +119,10 @@ const status = ref(false); class="avatar" style="border: 2px solid var(--border-color)" > - +
Date: Wed, 10 Apr 2024 23:14:42 +0700 Subject: [PATCH 4/6] fix: remove i18n warning --- src/components/GlobalLoading.vue | 2 +- src/components/StatCardComponent.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/GlobalLoading.vue b/src/components/GlobalLoading.vue index 7da9b628..f9cfeb5d 100644 --- a/src/components/GlobalLoading.vue +++ b/src/components/GlobalLoading.vue @@ -8,7 +8,7 @@ defineProps<{ - {{ $t('loading') }} + {{ 'loading' }} diff --git a/src/components/StatCardComponent.vue b/src/components/StatCardComponent.vue index 67ec0c7c..1be919bd 100644 --- a/src/components/StatCardComponent.vue +++ b/src/components/StatCardComponent.vue @@ -38,7 +38,7 @@ const color = ['pink', 'purple'];
{{ v.amount }}
-
{{ $t(v.label) }}
+
{{ v.label }}
From f422d00d23bcbc36a17f3b837f51bce51324db2d Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 10 Apr 2024 23:15:43 +0700 Subject: [PATCH 5/6] feat: select district & sub when edit --- src/components/FormDialog.vue | 64 ++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/src/components/FormDialog.vue b/src/components/FormDialog.vue index 928934c6..ca4996e0 100644 --- a/src/components/FormDialog.vue +++ b/src/components/FormDialog.vue @@ -13,6 +13,11 @@ defineProps<{ close?: (...args: unknown[]) => void; }>(); +defineExpose({ + fetchDistrict, + fetchSubDistrict, +}); + const adrressStore = useAddressStore(); const modal = defineModel('modal', { default: false }); const address = defineModel('address', { default: '' }); @@ -48,39 +53,38 @@ async function fetchSubDistrict(id: string | undefined) { if (id) { const result = await adrressStore.fetchSubDistrictByProvinceId(id); if (result) { - console.log(addrOptions.value.subDistrictOps); addrOptions.value.subDistrictOps = result; } } } -onMounted(async () => { - await fetchProvince(); -}); - -watch(provinceId, async (v) => { - await fetchDistrict(v); -}); - -watch(districtId, async (v) => { +async function selectProvince(id: string) { + if (!id) return; + districtId.value = undefined; subDistrictId.value = undefined; - await fetchSubDistrict(v); -}); + addrOptions.value.districtOps = []; + addrOptions.value.subDistrictOps = []; + zipCode.value = ''; + await fetchDistrict(id); +} -watch(subDistrictId, async (v) => { +async function selectDistrict(id: string) { + if (!id) return; + subDistrictId.value = undefined; + zipCode.value = ''; + await fetchSubDistrict(id); +} + +async function selectSubDistrict(id: string) { + if (!id) return; zipCode.value = addrOptions.value.subDistrictOps - ?.filter((x) => x.id === v) + ?.filter((x) => x.id === id) .map((x) => x.zipCode)[0] ?? ''; -}); +} -watch(provinceId, (v) => { - if (v) { - addrOptions.value.districtOps = []; - addrOptions.value.subDistrictOps = []; - districtId.value = undefined; - subDistrictId.value = undefined; - } +onMounted(async () => { + await fetchProvince(); }); @@ -669,7 +723,7 @@ watch( - +