From 912fb7c4c373d40cfb6d05bfde3551e19b5a78a7 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 2 Aug 2024 11:13:21 +0000 Subject: [PATCH] feat: bankbook & i18n --- public/option/option.json | 104 ++++++++ .../01_branch-management/FormBank.vue | 240 ++++++++++++++++++ src/i18n/en-US/bank.ts | 8 + src/i18n/en-US/index.ts | 4 + src/i18n/th-th/bank.ts | 8 + src/i18n/th-th/index.ts | 4 + src/pages/01_branch-management/MainPage.vue | 78 ++++-- src/stores/branch/index.ts | 36 ++- src/stores/branch/types.ts | 10 + 9 files changed, 458 insertions(+), 34 deletions(-) create mode 100644 src/components/01_branch-management/FormBank.vue create mode 100644 src/i18n/en-US/bank.ts create mode 100644 src/i18n/th-th/bank.ts diff --git a/public/option/option.json b/public/option/option.json index ff82d041..77579dc6 100644 --- a/public/option/option.json +++ b/public/option/option.json @@ -1,5 +1,57 @@ { "eng": { + "bankBook": [ + { + "label": "Bangkok Bank", + "value": "bbl" + }, + { + "label": "Kasikorn Bank", + "value": "kbank" + }, + { + "label": "Krungthai Bank", + "value": "ktb" + }, + { + "label": "TMBThanachart Bank", + "value": "ttb" + }, + { + "label": "Siam Commercial Bank", + "value": "scb" + }, + { + "label": "UOB Bank", + "value": "uobt" + }, + { + "label": "Krungsri Bank", + "value": "bay" + }, + { + "label": "Government Savings Bank", + "value": "gsb" + }, + { + "label": "Kiatnakin Phatra Bank", + "value": "kkp" + } + ], + "accountType": [ + { + "label": "Savings Account", + "value": "savingAccount" + }, + { + "label": "Fixed Deposit Account", + "value": "fixedDeposit" + }, + { + "label": "Current Account", + "value": "currentAccount" + } + ], "typeProduct": [ { "label": "DOE", @@ -732,6 +784,58 @@ }, "tha": { + "bankBook": [ + { + "label": "ธนาคารกรุงเทพ", + "value": "bbl" + }, + { + "label": "ธนาคารกสิกรไทย", + "value": "kbank" + }, + { + "label": "ธนาคารกรุงไทย", + "value": "ktb" + }, + { + "label": "ธนาคารทหารไทยธนชาต", + "value": "ttb" + }, + { + "label": "ธนาคารไทยพาณิชย์", + "value": "scb" + }, + { + "label": "ธนาคารยูโอบี", + "value": "uobt" + }, + { + "label": "ธนาคารกรุงศรีอยุธยา", + "value": "bay" + }, + { + "label": "ธนาคารออมสิน", + "value": "gsb" + }, + { + "label": "ธนาคารเกียรตินาคินภัทร", + "value": "kkp" + } + ], + "accountType": [ + { + "label": "บัญชีเงินฝากออมทรัพย์", + "value": "savingAccount" + }, + { + "label": "บัญชีเงินฝากประจำ", + "value": "fixedDeposit" + }, + { + "label": "บัญชีเงินฝากกระแสรายวัน", + "value": "currentAccount" + } + ], "typeProduct": [ { "label": "DOE", diff --git a/src/components/01_branch-management/FormBank.vue b/src/components/01_branch-management/FormBank.vue new file mode 100644 index 00000000..a5c61c16 --- /dev/null +++ b/src/components/01_branch-management/FormBank.vue @@ -0,0 +1,240 @@ + + diff --git a/src/i18n/en-US/bank.ts b/src/i18n/en-US/bank.ts new file mode 100644 index 00000000..b2d2d1ac --- /dev/null +++ b/src/i18n/en-US/bank.ts @@ -0,0 +1,8 @@ +export default { + accountNumber: 'Account Number', + bankBranch: 'Bank Branch', + accountName: 'Account Name', + bankType: 'Bank Type', + accountStatus: 'Account Status ', + bankBookNo: 'Bank Book', +}; diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index 9c21d8d9..7edb7f05 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -11,6 +11,7 @@ import employerDialog from './employer-dialog'; import otherDocument from './other-document'; import productService from './product-service'; import alertDialog from './alert-dialog'; +import bank from './bank'; export default { ok: 'Confirm', agree: 'Ok', @@ -69,6 +70,8 @@ export default { notRecorded: 'You have not yet saved.', editImage: 'Edit Image', bankBook: 'Bank Book', + use: 'In Use', + notUse: 'Not Use', ...status, ...main, ...address, @@ -82,4 +85,5 @@ export default { ...otherDocument, ...productService, ...alertDialog, + ...bank, }; diff --git a/src/i18n/th-th/bank.ts b/src/i18n/th-th/bank.ts new file mode 100644 index 00000000..b568fd8a --- /dev/null +++ b/src/i18n/th-th/bank.ts @@ -0,0 +1,8 @@ +export default { + accountNumber: 'เลขที่บัญชี', + bankBranch: 'สาขาธนาคาร', + accountName: 'ชื่อบัญชี', + bankType: 'ประเภทของธนาคาร', + accountStatus: 'สถานะการใช้งาน ', + bankBookNo: 'ช่องทางที่', +}; diff --git a/src/i18n/th-th/index.ts b/src/i18n/th-th/index.ts index a1c2fba0..56ce2489 100644 --- a/src/i18n/th-th/index.ts +++ b/src/i18n/th-th/index.ts @@ -11,6 +11,7 @@ import employerDialog from './employer-dialog'; import otherDocument from './other-document'; import productService from './product-service'; import alertDialog from './alert-dialog'; +import bank from './bank'; export default { ok: 'ยืนยัน', agree: 'ตกลง', @@ -72,6 +73,8 @@ export default { notRecorded: 'คุณยังไม่ได้บันทึก', editImage: 'แก้ไขรูป', bankBook: 'บัญชีธนาคาร', + use: 'ใช้งาน', + notUse: 'ไม่ใช้งาน', ...status, ...main, ...address, @@ -85,4 +88,5 @@ export default { ...otherDocument, ...productService, ...alertDialog, + ...bank, }; diff --git a/src/pages/01_branch-management/MainPage.vue b/src/pages/01_branch-management/MainPage.vue index b38808ed..921f484c 100644 --- a/src/pages/01_branch-management/MainPage.vue +++ b/src/pages/01_branch-management/MainPage.vue @@ -9,7 +9,12 @@ import type { QTableProps } from 'quasar'; import useBranchStore from 'stores/branch'; import useFlowStore from 'src/stores/flow'; -import { BranchWithChildren, BranchCreate, Branch } from 'stores/branch/types'; +import { + BranchWithChildren, + BranchCreate, + Branch, + BankBook, +} from 'stores/branch/types'; import { Status } from 'src/stores/types'; import useUtilsStore, { dialog } from 'src/stores/utils'; @@ -29,6 +34,7 @@ import TreeCompoent from 'src/components/TreeCompoent.vue'; import ProfileBanner from 'src/components/ProfileBanner.vue'; import SideMenu from 'src/components/SideMenu.vue'; import ImageUploadDialog from 'src/components/ImageUploadDialog.vue'; +import FormBank from 'src/components/01_branch-management/FormBank.vue'; const $q = useQuasar(); const { t } = useI18n(); @@ -70,11 +76,6 @@ const hideStat = ref(false); const currentStatus = ref('All'); const expandedTree = ref([]); const formMenuIcon = ref<{ icon: string; color: string; bgColor: string }[]>([ - { - icon: 'mdi-office-building-outline', - color: 'hsl(var(--info-bg))', - bgColor: 'var(--surface-1)', - }, { icon: 'mdi-phone', color: 'hsl(var(--info-bg))', @@ -90,15 +91,16 @@ const formMenuIcon = ref<{ icon: string; color: string; bgColor: string }[]>([ color: 'hsl(var(--info-bg))', bgColor: 'var(--surface-1)', }, +]); + +const formBankBook = ref([ { - icon: 'mdi-qrcode', - color: 'hsl(var(--info-bg))', - bgColor: 'var(--surface-1)', - }, - { - icon: 'mdi-piggy-bank-outline', - color: 'hsl(var(--info-bg))', - bgColor: 'var(--surface-1)', + bankName: '', + accountNumber: '', + bankBranch: '', + accountName: '', + accountType: '', + currentlyUse: true, }, ]); @@ -294,6 +296,12 @@ async function fetchBranchById(id: string) { imageUrl.value = res.imageUrl; prevImageUrl.value = res.imageUrl; + const updatedBank = res.bank.map((item) => { + const { id: _id, branchId: _branchId, ...rest } = item; + return rest; + }); + formBankBook.value = updatedBank; + formData.value = { headOfficeId: res.headOfficeId, taxNo: res.taxNo, @@ -326,6 +334,17 @@ function clearData() { code: '', }; profileFile.value = undefined; + + formBankBook.value = [ + { + bankName: '', + accountNumber: '', + bankBranch: '', + accountName: '', + accountType: '', + currentlyUse: true, + } + ]; } async function undo() { @@ -473,6 +492,7 @@ async function onSubmit() { }, profileFile.value, profileFileImg.value, + formBankBook.value, ); await branchStore.fetchList({ pageSize: 99999 }); @@ -490,11 +510,14 @@ async function onSubmit() { delete formData.value['codeHeadOffice']; } - await branchStore.create({ - ...formData.value, - qrCodeImage: profileFile.value, - imageUrl: profileFileImg.value, - }); + await branchStore.create( + { + ...formData.value, + qrCodeImage: profileFile.value, + imageUrl: profileFileImg.value, + }, + formBankBook.value, + ); await branchStore.fetchList({ pageSize: 99999 }); modal.value = false; @@ -1484,7 +1507,7 @@ watch(currentHq, () => { }, { name: $t('bankBook'), - anchor: 'form-bankBook', + anchor: 'form-bank', }, ]" background="transparent" @@ -1559,6 +1582,12 @@ watch(currentHq, () => { } " /> +