feat: add support for credit note status and acceptance functionality

This commit is contained in:
puriphatt 2025-02-24 16:20:47 +07:00
parent 83a7e7ee47
commit 91c7db7c7b
6 changed files with 13 additions and 8 deletions

View file

@ -1257,6 +1257,7 @@ export default {
refundSuccess: 'Refund Success',
},
status: {
Waiting: 'Credit Note',
Pending: 'Pending Refund',
Success: 'Refund Completed',
Canceled: 'Canceled',
@ -1266,10 +1267,6 @@ export default {
Done: 'Done',
},
},
stats: {
Pending: 'Pending Refund',
Success: 'Refund Completed',
},
},
invoice: {

View file

@ -1237,6 +1237,7 @@ export default {
refundSuccess: 'คืนเงินเสร็จเรียบร้อย',
},
status: {
Waiting: 'ใบลดหนี้',
Pending: 'รอคืนเงิน',
Success: 'คืนเงินเสร็จสิ้น',
Canceled: 'ยกเลิกรายการ',
@ -1246,10 +1247,6 @@ export default {
Done: 'คืนเงินเรียบร้อย',
},
},
stats: {
Pending: 'รอคืนเงิน',
Success: 'คืนเงินเสร็จสิ้น',
},
},
invoice: {

View file

@ -14,6 +14,7 @@ export const taskStatusOpts = [
];
export const pageTabs = [
{ label: CreditNoteStatus.Waiting, value: CreditNoteStatus.Waiting },
{ label: CreditNoteStatus.Pending, value: CreditNoteStatus.Pending },
{ label: CreditNoteStatus.Success, value: CreditNoteStatus.Success },
];

View file

@ -71,12 +71,19 @@ export async function updatePaybackStatus(
return null;
}
export async function acceptCreditNote(id: string) {
const res = await api.post<Data>(`/${ENDPOINT}/${id}/accept`);
if (res.status < 400) return res.data;
return null;
}
export const useCreditNote = defineStore('credit-note-store', () => {
const data = ref<Data[]>([]);
const page = ref<number>(1);
const pageMax = ref<number>(1);
const pageSize = ref<number>(30);
const stats = ref<Record<Status, number>>({
[Status.Waiting]: 0,
[Status.Pending]: 0,
[Status.Success]: 0,
});
@ -94,6 +101,7 @@ export const useCreditNote = defineStore('credit-note-store', () => {
createCreditNote,
updateCreditNote,
deleteCreditNote,
acceptCreditNote,
...manageAttachment(api, ENDPOINT),
...manageFile<'slip'>(api, ENDPOINT),

View file

@ -42,6 +42,7 @@ export type CreditNote = {
};
export enum CreditNoteStatus {
Waiting = 'Waiting',
Pending = 'Pending',
Success = 'Success',
}

View file

@ -343,6 +343,7 @@ export type QuotationFull = {
updatedBy: UpdatedBy;
agentPrice?: boolean;
isDebitNote?: boolean;
};
export type QuotationPayload = {