feat: bankbook & i18n

This commit is contained in:
puriphatt 2024-08-02 11:13:21 +00:00
parent 5f26c8bcdc
commit 912fb7c4c3
9 changed files with 458 additions and 34 deletions

View file

@ -2,7 +2,7 @@ import { ref, watch } from 'vue';
import { defineStore } from 'pinia';
import { Pagination } from '../types';
import { api } from 'src/boot/axios';
import { Branch, BranchCreate } from './types';
import { BankBook, Branch, BranchCreate } from './types';
import { BranchContact } from '../branch-contact/types';
import axios from 'axios';
import useFlowStore from '../flow';
@ -120,6 +120,7 @@ const useBranchStore = defineStore('api-branch', () => {
async function create(
branch: BranchCreate,
bank?: BankBook[],
flow?: {
sessionId?: string;
refTransactionId?: string;
@ -134,13 +135,17 @@ const useBranchStore = defineStore('api-branch', () => {
qrCodeImageUploadUrl: string;
imageUploadUrl: string;
}
>('/branch', payload, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
>(
'/branch',
{ ...payload, bank: bank },
{
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
},
});
);
qrCodeImage &&
(await axios
@ -169,6 +174,7 @@ const useBranchStore = defineStore('api-branch', () => {
data: Partial<BranchCreate & { status: 'ACTIVE' | 'INACTIVE' | 'CREATED' }>,
qrCodeImage?: File | undefined,
imageHq?: File | undefined,
bank?: BankBook[],
flow?: {
sessionId?: string;
refTransactionId?: string;
@ -178,13 +184,17 @@ const useBranchStore = defineStore('api-branch', () => {
const { ...payload } = data;
const res = await api.put<
Branch & { qrCodeImageUploadUrl: string; imageUploadUrl: string }
>(`/branch/${id}`, payload, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
>(
`/branch/${id}`,
{ ...payload, bank: bank },
{
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
},
});
);
if (qrCodeImage) {
await axios

View file

@ -2,6 +2,15 @@ import { District, Province, SubDistrict } from '../address';
import { BranchContact } from '../branch-contact/types';
import { Status } from '../types';
export type BankBook = {
bankName: string;
accountNumber: string;
bankBranch: string;
accountName: string;
accountType: string;
currentlyUse: boolean;
};
export type Branch = {
subDistrict: SubDistrict | null;
district: District | null;
@ -31,6 +40,7 @@ export type Branch = {
id: string;
code: string;
telephoneNo: string;
bank: (BankBook & { id: string; branchId: string })[];
lineId: string;
contact: BranchContact[];
_count: {