Add supplier claims management components and API integration
This commit is contained in:
@@ -4,6 +4,7 @@ import type {
|
||||
PurchaseOrderResponse,
|
||||
GrnResponse,
|
||||
PurchaseOrderStatus,
|
||||
PurchaseReturnResponse,
|
||||
} from '@/types/api'
|
||||
|
||||
import type { PageParams } from './master'
|
||||
@@ -19,6 +20,19 @@ export interface PurchaseOrderItemBody {
|
||||
export interface PurchaseOrderBody {
|
||||
supplierId: string
|
||||
items: PurchaseOrderItemBody[]
|
||||
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
|
||||
createdByUserId: string
|
||||
}
|
||||
|
||||
export interface UpdatePurchaseOrderLineBody {
|
||||
purchaseOrderItemId?: string
|
||||
itemId: string
|
||||
quantity: number
|
||||
unitCost: number
|
||||
}
|
||||
|
||||
export interface UpdatePurchaseOrderBody {
|
||||
items: UpdatePurchaseOrderLineBody[]
|
||||
}
|
||||
|
||||
export interface PurchaseOrderListParams extends PageParams {
|
||||
@@ -36,8 +50,11 @@ export const purchaseOrders = {
|
||||
create: (body: PurchaseOrderBody) =>
|
||||
api.post<PurchaseOrderResponse>('/purchase-orders', body).then(r => r.data),
|
||||
|
||||
cancel: (id: string, cancelReason: string) =>
|
||||
api.patch<PurchaseOrderResponse>(`/purchase-orders/${id}/cancel`, { cancelReason }).then(r => r.data),
|
||||
update: (id: string, body: UpdatePurchaseOrderBody) =>
|
||||
api.put<PurchaseOrderResponse>(`/purchase-orders/${id}`, body).then(r => r.data),
|
||||
|
||||
cancel: (id: string, reason: string) =>
|
||||
api.post<PurchaseOrderResponse>(`/purchase-orders/${id}/cancel`, { reason }).then(r => r.data),
|
||||
}
|
||||
|
||||
// ─── Goods Receipts (GRN) ─────────────────────────────────────────────────────
|
||||
@@ -53,6 +70,8 @@ export interface GrnBody {
|
||||
warehouseId: string
|
||||
receivedAt: string
|
||||
items: GrnItemBody[]
|
||||
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
|
||||
receivedByUserId: string
|
||||
}
|
||||
|
||||
export const grn = {
|
||||
@@ -65,3 +84,28 @@ export const grn = {
|
||||
create: (body: GrnBody) =>
|
||||
api.post<GrnResponse>('/goods-receipts', body).then(r => r.data),
|
||||
}
|
||||
|
||||
// ─── Purchase Returns ─────────────────────────────────────────────────────────
|
||||
|
||||
export interface PurchaseReturnItemBody {
|
||||
itemId: string
|
||||
quantity: number
|
||||
}
|
||||
|
||||
export interface PurchaseReturnBody {
|
||||
reason: string
|
||||
items: PurchaseReturnItemBody[]
|
||||
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
|
||||
createdByUserId: string
|
||||
}
|
||||
|
||||
export const purchaseReturns = {
|
||||
get: (id: string) =>
|
||||
api.get<PurchaseReturnResponse>(`/purchase-returns/${id}`).then(r => r.data),
|
||||
|
||||
listByPurchaseOrder: (purchaseOrderId: string) =>
|
||||
api.get<PurchaseReturnResponse[]>(`/purchase-orders/${purchaseOrderId}/returns`).then(r => r.data),
|
||||
|
||||
create: (purchaseOrderId: string, body: PurchaseReturnBody) =>
|
||||
api.post<PurchaseReturnResponse>(`/purchase-orders/${purchaseOrderId}/returns`, body).then(r => r.data),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user