feat: invoice (#174)

* feat: add 10 invoice

* feat: invoicelayout

* feat: invoicetable

* refactor: uew new table

* fix: columns missing

* feat: invoicebadgestatus

* feat: formatdate

#156

* refactor: watch pagesize and page

#159

* refector: filter status

#160

* feat: invoice stats

* fix: typo

* chore: cleanup

* refactor: add columns action

* refactor: add btn view invoice

* refactor: add query tab

* refactor: change set code invoice to function

* chore: change case

* refactor: add i18n netvalue

* refactor: add record colors of status invoice

* feat: add view card invoice

* chore: cleanpu

* refactor: handle i18n pay condition

* refactor: handle value by storage or by api

* refactor: add btnn preview

* refactor: function view doc example

* refactor: bind function view doc example

---------

Co-authored-by: Thanaphon Frappet <thanaphon@frappet.com>
Co-authored-by: nwpptrs <jay02499@gmail.com>
Co-authored-by: Methapon2001 <61303214+Methapon2001@users.noreply.github.com>
Co-authored-by: oat_dev <nattapon@frappet.com>
This commit is contained in:
Methapon Metanipat 2025-01-14 11:34:20 +07:00 committed by GitHub
parent 7d1f32a5cb
commit c5d3897d76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 801 additions and 86 deletions

View file

@ -8,6 +8,7 @@ import {
Payment,
Receipt,
PaymentFlowAccount,
PaymentDataStatus,
} from './types';
import { manageAttachment } from '../utils';
@ -122,6 +123,19 @@ export const useInvoice = defineStore('invoice-store', () => {
const page = ref<number>(1);
const pageMax = ref<number>(1);
const pageSize = ref<number>(30);
const stats = ref<Record<PaymentDataStatus, number>>({
[PaymentDataStatus.Success]: 0,
[PaymentDataStatus.Wait]: 0,
});
async function getInvoiceStats(params?: { quotationId?: string }) {
const res = await api.get<Record<PaymentDataStatus, number>>(
'/invoice/stats',
{ params },
);
if (res.status >= 400) return null;
return res.data;
}
async function getInvoice(id: string) {
const res = await api.get<Invoice>(`/invoice/${id}`);
@ -136,6 +150,7 @@ export const useInvoice = defineStore('invoice-store', () => {
pageSize?: number;
query?: string;
quotationId?: string;
pay?: boolean;
}) {
const res = await api.get<PaginationResult<Invoice>>('/invoice', {
params,
@ -171,7 +186,9 @@ export const useInvoice = defineStore('invoice-store', () => {
page,
pageSize,
pageMax,
stats,
getInvoiceStats,
getInvoice,
getInvoiceList,
createInvoice,

View file

@ -16,9 +16,14 @@ export type Invoice = {
createdBy: CreatedBy;
createdByUserId: string;
payment?: Payment;
payment: Payment;
};
export enum PaymentDataStatus {
Success = 'PaymentSuccess',
Wait = 'PaymentWait',
}
export type InvoicePayload = {
quotationId: string;
amount: number;