Fix UI for inventory page

This commit is contained in:
Urtzi Alfaro
2025-09-15 15:31:27 +02:00
parent 36cfc88f93
commit 65a53c6d16
10 changed files with 953 additions and 378 deletions

View File

@@ -113,6 +113,8 @@ export type {
PaginatedResponse,
} from './types/inventory';
export { ProductType } from './types/inventory';
// Types - Classification
export type {
ProductClassificationRequest,

View File

@@ -2,6 +2,52 @@
* Inventory API Types - Mirror backend schemas
*/
// Enums - Mirror backend enum definitions
export enum ProductType {
INGREDIENT = 'ingredient',
FINISHED_PRODUCT = 'finished_product'
}
export enum UnitOfMeasure {
KILOGRAMS = 'kg',
GRAMS = 'g',
LITERS = 'l',
MILLILITERS = 'ml',
UNITS = 'units',
PIECES = 'pcs',
PACKAGES = 'pkg',
BAGS = 'bags',
BOXES = 'boxes'
}
export enum IngredientCategory {
FLOUR = 'flour',
YEAST = 'yeast',
DAIRY = 'dairy',
EGGS = 'eggs',
SUGAR = 'sugar',
FATS = 'fats',
SALT = 'salt',
SPICES = 'spices',
ADDITIVES = 'additives',
PACKAGING = 'packaging',
CLEANING = 'cleaning',
OTHER = 'other'
}
export enum ProductCategory {
BREAD = 'bread',
CROISSANTS = 'croissants',
PASTRIES = 'pastries',
CAKES = 'cakes',
COOKIES = 'cookies',
MUFFINS = 'muffins',
SANDWICHES = 'sandwiches',
SEASONAL = 'seasonal',
BEVERAGES = 'beverages',
OTHER_PRODUCTS = 'other_products'
}
// Base Inventory Types
export interface IngredientCreate {
name: string;
@@ -24,16 +70,28 @@ export interface IngredientUpdate {
name?: string;
description?: string;
category?: string;
subcategory?: string;
brand?: string;
unit_of_measure?: string;
package_size?: number;
average_cost?: number;
last_purchase_price?: number;
standard_cost?: number;
low_stock_threshold?: number;
max_stock_level?: number;
reorder_point?: number;
shelf_life_days?: number;
reorder_quantity?: number;
max_stock_level?: number;
requires_refrigeration?: boolean;
requires_freezing?: boolean;
storage_temperature_min?: number;
storage_temperature_max?: number;
storage_humidity_max?: number;
shelf_life_days?: number;
storage_instructions?: string;
is_active?: boolean;
is_perishable?: boolean;
is_seasonal?: boolean;
supplier_id?: string;
average_cost?: number;
allergen_info?: any;
notes?: string;
}
@@ -42,26 +100,42 @@ export interface IngredientResponse {
tenant_id: string;
name: string;
description?: string;
product_type: ProductType;
category: string;
subcategory?: string;
brand?: string;
unit_of_measure: string;
package_size?: number;
average_cost?: number;
last_purchase_price?: number;
standard_cost?: number;
low_stock_threshold: number;
max_stock_level: number;
reorder_point: number;
shelf_life_days?: number;
reorder_quantity: number;
max_stock_level?: number;
requires_refrigeration: boolean;
requires_freezing: boolean;
is_seasonal: boolean;
supplier_id?: string;
average_cost?: number;
notes?: string;
current_stock_level: number;
available_stock: number;
reserved_stock: number;
stock_status: 'in_stock' | 'low_stock' | 'out_of_stock' | 'overstock';
last_restocked?: string;
storage_temperature_min?: number;
storage_temperature_max?: number;
storage_humidity_max?: number;
shelf_life_days?: number;
storage_instructions?: string;
is_active: boolean;
is_perishable: boolean;
is_seasonal?: boolean;
allergen_info?: any;
created_at: string;
updated_at: string;
created_by?: string;
// Computed fields
current_stock?: number;
is_low_stock?: boolean;
needs_reorder?: boolean;
stock_status?: 'in_stock' | 'low_stock' | 'out_of_stock' | 'overstock';
last_restocked?: string;
supplier_id?: string;
notes?: string;
}
// Stock Management Types