dstpabuaran.com/resources/js/pages/admin/manage/purchase/columns.tsx

105 lines
2.3 KiB
TypeScript

export type PurchaseItem = {
id: number;
raw_material_price_id: number;
quantity: number;
unit_price: number;
subtotal: number;
variant_name: string;
};
export type Purchase = {
id: number;
supplier_id: number;
created_by_id: number;
subtotal: number;
discount: number;
shipping_cost: number;
total: number;
notes: string | null;
photo_urls: string[];
photo_conversion_urls: string[];
created_at: string;
variants_count: number;
total_qty: number;
material_name: string | null;
unit: string | null;
supplier: {
id: number;
name: string;
};
created_by: {
id: number;
user_profile: {
full_name: string;
};
};
purchase_items?: PurchaseItemDetail[];
};
export type PurchaseItemDetail = {
id: number;
raw_material_price_id: number;
quantity: number;
unit_price: number;
subtotal: number;
raw_material_price: {
id: number;
variant: string;
price: number;
stock: number;
photo_url: string | null;
photo_conversion_url: string | null;
raw_material: {
id: number;
name: string;
unit: string;
};
};
};
export type PurchaseForEdit = {
id: number;
name: string;
unit: string;
supplier_id: number;
discount: number;
shipping_cost: number;
notes: string | null;
photo_keys: string[];
photo_urls: string[];
variants: {
id: number;
variant: string;
price: number;
stock: number;
photo_key: string | null;
photo_url: string | null;
}[];
default_mode: 'new' | 'existing';
existing_material_name: string | null;
existing_quantities: Record<string, number>;
};
export type Supplier = {
id: number;
name: string;
};
export type PurchaseCreateData = {
suppliers: Supplier[];
rawMaterials: {
id: number;
name: string;
unit: string;
is_active: boolean;
raw_material_prices: {
id: number;
variant: string;
price: number;
stock: number;
photo_url: string | null;
photo_conversion_url: string | null;
}[];
}[];
};