- Added RawMaterialController and RawMaterialVariantController for managing raw materials and their variants. - Introduced RawMaterialRequest and RawMaterialVariantRequest for validation. - Implemented RawMaterialService and RawMaterialVariantService for business logic. - Created hooks for saving drafts of raw materials. - Developed UI components for creating, editing, and listing raw materials and variants.
39 lines
763 B
TypeScript
39 lines
763 B
TypeScript
export type RawMaterialVariant = {
|
|
id: number;
|
|
variant: string;
|
|
price: number;
|
|
stock: number;
|
|
photo_url: string | null;
|
|
};
|
|
|
|
export type RawMaterial = {
|
|
id: number;
|
|
name: string;
|
|
unit: string;
|
|
is_active: boolean;
|
|
raw_material_prices: RawMaterialVariant[];
|
|
};
|
|
|
|
export type RawMaterialVariantForEdit = {
|
|
id: number;
|
|
variant: string;
|
|
price: number;
|
|
stock: number;
|
|
photo_key: string | null;
|
|
photo_url: string | null;
|
|
};
|
|
|
|
export type RawMaterialForEdit = {
|
|
id: number;
|
|
name: string;
|
|
unit: string;
|
|
is_active: boolean;
|
|
raw_material_prices: RawMaterialVariantForEdit[];
|
|
};
|
|
|
|
export const UNIT_LABELS: Record<string, string> = {
|
|
kg: 'Kilogram',
|
|
meter: 'Meter',
|
|
yard: 'Yard',
|
|
};
|