From f763aa431fdce550347fb9f185c3ecae85782f33 Mon Sep 17 00:00:00 2001 From: Tiny_Murky Date: Wed, 25 Dec 2024 17:48:43 +0800 Subject: [PATCH] add event type voucher type --- src/components/new_journal_form/new_journal_form.tsx | 1 + src/constants/account.ts | 4 ++++ src/lib/utils/zod_schema/ledger.ts | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/components/new_journal_form/new_journal_form.tsx b/src/components/new_journal_form/new_journal_form.tsx index 862190e53..823eab378 100644 --- a/src/components/new_journal_form/new_journal_form.tsx +++ b/src/components/new_journal_form/new_journal_form.tsx @@ -25,6 +25,7 @@ const eventTypeMap: { [key in EventType]: string } = { [EventType.PAYMENT]: 'journal:JOURNAL.PAYMENT', [EventType.INCOME]: 'project:PROJECT.INCOME', [EventType.TRANSFER]: 'common:COMMON.TRANSFER', + [EventType.OPENING_ACCOUNT_BOOK]: 'common:COMMON.OPENING_ACCOUNT_BOOK', // Info: (20241225 - Murky) @Anna 目前翻譯檔暫時沒有開帳的翻譯 }; const taxRateSelection: number[] = [0, 5, 20, 25]; diff --git a/src/constants/account.ts b/src/constants/account.ts index c372b45a1..cd269a9ea 100644 --- a/src/constants/account.ts +++ b/src/constants/account.ts @@ -18,6 +18,7 @@ export enum EventType { PAYMENT = 'payment', INCOME = 'income', TRANSFER = 'transfer', + OPENING_ACCOUNT_BOOK = 'openingAccountBook', } export enum AccountType { @@ -52,6 +53,7 @@ export enum VoucherType { RECEIVE = 'receive', EXPENSE = 'expense', TRANSFER = 'transfer', + OPENING_ACCOUNT_BOOK = 'openingAccountBook', } export enum PaymentStatusType { @@ -83,6 +85,7 @@ export const EVENT_TYPE_TO_VOUCHER_TYPE_MAP: { [EventType.INCOME]: VoucherType.RECEIVE, [EventType.PAYMENT]: VoucherType.EXPENSE, [EventType.TRANSFER]: VoucherType.TRANSFER, + [EventType.OPENING_ACCOUNT_BOOK]: VoucherType.OPENING_ACCOUNT_BOOK, }; export const VOUCHER_TYPE_TO_EVENT_TYPE_MAP: { @@ -91,6 +94,7 @@ export const VOUCHER_TYPE_TO_EVENT_TYPE_MAP: { [VoucherType.RECEIVE]: EventType.INCOME, [VoucherType.EXPENSE]: EventType.PAYMENT, [VoucherType.TRANSFER]: EventType.TRANSFER, + [VoucherType.OPENING_ACCOUNT_BOOK]: EventType.OPENING_ACCOUNT_BOOK, }; export const MISSING_CODE_MARKERS = ['!', '@', '#', '$', '%']; diff --git a/src/lib/utils/zod_schema/ledger.ts b/src/lib/utils/zod_schema/ledger.ts index e03736008..86e80b995 100644 --- a/src/lib/utils/zod_schema/ledger.ts +++ b/src/lib/utils/zod_schema/ledger.ts @@ -41,10 +41,12 @@ const ledgerListResponseSchema = z.object({ VoucherType.EXPENSE, VoucherType.RECEIVE, VoucherType.TRANSFER, + VoucherType.OPENING_ACCOUNT_BOOK, EventType.INCOME, EventType.PAYMENT, EventType.TRANSFER, + EventType.OPENING_ACCOUNT_BOOK, ]), particulars: z.string(), debitAmount: z.number(),