feat: enhance invoice item updates
This commit is contained in:
@@ -4,6 +4,7 @@ import type {
|
||||
ShopPOResponse,
|
||||
InvoiceResponse,
|
||||
InvoiceStatus,
|
||||
InvoiceVersionResponse,
|
||||
PaymentStatus,
|
||||
PaymentResponse,
|
||||
PaymentMethod,
|
||||
@@ -93,8 +94,14 @@ export const invoices = {
|
||||
print: (id: string, printedByUserId?: string | null) =>
|
||||
api.post<InvoiceResponse>(`/invoices/${id}/print`, { printedByUserId }).then(r => r.data),
|
||||
|
||||
finalize: (id: string, finalizedByUserId?: string | null) =>
|
||||
api.post<InvoiceResponse>(`/invoices/${id}/finalize`, { finalizedByUserId }).then(r => r.data),
|
||||
finalize: (id: string, finalizedByUserId?: string | null, adjustments?: { invoiceItemId: string; adjustedQuantity: number; isRemoved?: boolean }[]) =>
|
||||
api.post<InvoiceResponse>(`/invoices/${id}/finalize`, { finalizedByUserId, adjustments }).then(r => r.data),
|
||||
|
||||
updateItems: (id: string, items: { invoiceItemId?: string; itemId?: string; quantity: number; unitPrice?: number | null; isRemoved?: boolean }[], editedByUserId?: string | null) =>
|
||||
api.put<InvoiceResponse>(`/invoices/${id}/items`, { items, editedByUserId }).then(r => r.data),
|
||||
|
||||
versions: (id: string) =>
|
||||
api.get<InvoiceVersionResponse[]>(`/invoices/${id}/versions`).then(r => r.data),
|
||||
}
|
||||
|
||||
// ─── Payments ─────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -12,6 +12,7 @@ export type PurchaseOrderStatus =
|
||||
| 'Issued' | 'PartiallyReceived' | 'Received' | 'Closed' | 'Cancelled'
|
||||
export type ShopPOStatus = 'Pending' | 'PartiallyFulfilled' | 'Fulfilled' | 'Cancelled'
|
||||
export type InvoiceStatus = 'Draft' | 'Printed' | 'Finalized'
|
||||
export type InvoiceVersionStage = 'Created' | 'DraftEdited' | 'Printed' | 'Finalized'
|
||||
export type InvoiceCreationMode = 'ModeA' | 'ModeB'
|
||||
export type PaymentStatus = 'Pending' | 'PartiallyPaid' | 'Paid'
|
||||
export type PaymentMethod = 'Cash' | 'Cheque' | 'Credit'
|
||||
@@ -1001,6 +1002,36 @@ export interface ShopPOResponse {
|
||||
cancelledByRole: string | null
|
||||
}
|
||||
|
||||
export interface InvoiceItemResponse {
|
||||
id: string
|
||||
shopPOItemId: string | null
|
||||
itemId: string
|
||||
itemName: string
|
||||
orderedQuantity: number | null
|
||||
quantity: number
|
||||
unitPrice: number
|
||||
isRemoved: boolean
|
||||
}
|
||||
|
||||
export interface InvoiceVersionItemResponse {
|
||||
shopPOItemId: string | null
|
||||
itemId: string
|
||||
itemName: string
|
||||
quantity: number
|
||||
unitPrice: number
|
||||
isRemoved: boolean
|
||||
}
|
||||
|
||||
export interface InvoiceVersionResponse {
|
||||
id: string
|
||||
versionNumber: number
|
||||
stage: InvoiceVersionStage
|
||||
totalAmount: number
|
||||
createdBy: string
|
||||
createdAt: string
|
||||
items: InvoiceVersionItemResponse[]
|
||||
}
|
||||
|
||||
export interface InvoiceResponse {
|
||||
id: string
|
||||
shopPOId: string
|
||||
@@ -1017,6 +1048,7 @@ export interface InvoiceResponse {
|
||||
paidAmount: number
|
||||
isActive: boolean
|
||||
createdAt: string
|
||||
items: InvoiceItemResponse[]
|
||||
}
|
||||
|
||||
export interface OutstandingPaymentsResponse {
|
||||
|
||||
Reference in New Issue
Block a user