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

@ -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 = {