feat: adjust payment page (#31)

* feat: add installment no label

* feat: update types

* refactor: add i18n

* refactor: view receipt

* refactor: add type

* refactor: add dateFormatTh

* fixup! refactor: add i18n

* fixup! refactor: add dateFormatTh

* refactor: use dateFormatJS in monthDisplay

* refactor: handle year th-TH

* ลบ log

* refactor: handle color view mod
This commit is contained in:
Net 2024-10-31 10:00:35 +07:00 committed by GitHub
parent e273ad1015
commit 0986200910
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 201 additions and 92 deletions

View file

@ -6,7 +6,7 @@ export type Invoice = {
amount: number;
productServiceList: QuotationFull['productServiceList'];
installements: QuotationFull['paySplit'];
quotation: Quotation;
@ -18,8 +18,6 @@ export type Invoice = {
export type InvoicePayload = {
quotationId: string;
amount: number;
// NOTE: For individual list that will be include in the quotation
productServiceListId?: string[];
// NOTE: Will be pulled from quotation
installmentNo?: number[];
};

View file

@ -72,6 +72,9 @@ export const useQuotationStore = defineStore('quotation-store', () => {
const res = await api.post('/quotation', {
...payload,
paySplit: data.paySplit.map((v) => ({
amount: v.amount,
})),
productServiceList: data.productServiceList.map((v) => ({
vat: v.vat,
amount: v.amount,
@ -104,6 +107,9 @@ export const useQuotationStore = defineStore('quotation-store', () => {
const { _count, ...payload } = data;
const res = await api.put(`/quotation/${data.id}`, {
...payload,
paySplit: data.paySplit.map((v) => ({
amount: v.amount,
})),
productServiceList: payload.productServiceList.map((v) => ({
vat: v.vat,
amount: v.amount,

View file

@ -1,6 +1,7 @@
import { CustomerType } from '../customer/types';
import { District, Province, SubDistrict } from '../address';
import { CreatedBy, Status, UpdatedBy } from '../types';
import { Invoice } from '../payment/types';
export type QuotationStatus =
| 'Issued'
@ -204,7 +205,7 @@ export type Quotation = {
paySplitCount: number;
paySplit: {
no: number;
invoice: boolean;
invoiceId: string;
amount: number;
}[];
payCondition:
@ -286,7 +287,12 @@ export type QuotationFull = {
urgent: boolean;
payBillDate: string | Date | null;
paySplitCount: number | null;
paySplit: { no: number; amount: number; invoice: boolean }[];
paySplit: {
no: number;
amount: number;
invoice: Invoice;
invoiceId: string;
}[];
payCondition:
| 'Full'
| 'Split'
@ -397,6 +403,8 @@ export type ProductGroup = {
};
export type QuotationPaymentData = {
invoiceId: string;
createdAt: Date;
paymentStatus: string;
amount: number;
remark: string;