feat(FE-212): add types for purchase creation and updates

This commit is contained in:
rstubryan
2025-10-29 17:26:06 +07:00
parent c832c4adeb
commit 215580215e
+47
View File
@@ -0,0 +1,47 @@
import { BaseMetadata } from '@/types/api/api-general';
import { Supplier } from '@/types/api/master-data/supplier';
import { Warehouse } from '@/types/api/master-data/warehouse';
export type BasePurchase = {
id: number;
pr_number: string;
po_number: string;
po_date: string;
supplier: Supplier;
warehouse: Warehouse[];
credit_term: number;
due_date: string;
grand_total: number;
notes?: string | null;
deleted_at?: string | null;
created_by: number;
};
export type Purchase = BaseMetadata & BasePurchase;
export type CreatePurchasePayload = {
pr_number: string;
po_number: string;
po_date: string;
supplier_id: number;
warehouse_ids: number[];
credit_term: number;
due_date: string;
grand_total: number;
notes?: string | null;
purchase_items: {
product_id: number;
product_warehouse_id?: number | null;
received_date?: string | null;
travel_number?: string | null;
travel_number_docs?: string | null;
vehicle_number?: string | null;
sub_qty: number;
total_qty: number;
total_used: number;
price: number;
total_price: number;
}[];
};
export type UpdatePurchasePayload = CreatePurchasePayload;