Add supplier and imporve inventory frontend

This commit is contained in:
Urtzi Alfaro
2025-09-18 23:32:53 +02:00
parent ae77a0e1c5
commit d61056df33
40 changed files with 2022 additions and 629 deletions

View File

@@ -2,6 +2,44 @@
* Food Safety API Types - Mirror backend schemas
*/
// Food Safety Enums
export enum FoodSafetyStandard {
HACCP = 'haccp',
FDA = 'fda',
USDA = 'usda',
FSMA = 'fsma',
SQF = 'sqf',
BRC = 'brc',
IFS = 'ifs',
ISO22000 = 'iso22000',
ORGANIC = 'organic',
NON_GMO = 'non_gmo',
ALLERGEN_FREE = 'allergen_free',
KOSHER = 'kosher',
HALAL = 'halal'
}
export enum ComplianceStatus {
COMPLIANT = 'compliant',
NON_COMPLIANT = 'non_compliant',
PENDING_REVIEW = 'pending_review',
EXPIRED = 'expired',
WARNING = 'warning'
}
export enum FoodSafetyAlertType {
TEMPERATURE_VIOLATION = 'temperature_violation',
EXPIRATION_WARNING = 'expiration_warning',
EXPIRED_PRODUCT = 'expired_product',
CONTAMINATION_RISK = 'contamination_risk',
ALLERGEN_CROSS_CONTAMINATION = 'allergen_cross_contamination',
STORAGE_VIOLATION = 'storage_violation',
QUALITY_DEGRADATION = 'quality_degradation',
RECALL_NOTICE = 'recall_notice',
CERTIFICATION_EXPIRY = 'certification_expiry',
SUPPLIER_COMPLIANCE_ISSUE = 'supplier_compliance_issue'
}
export interface FoodSafetyComplianceCreate {
ingredient_id: string;
compliance_type: 'temperature_check' | 'quality_inspection' | 'hygiene_audit' | 'batch_verification';
@@ -223,4 +261,12 @@ export interface FoodSafetyDashboard {
days_until_expiry: number;
quantity: number;
}>;
}
// Select option interface for enum helpers
export interface EnumOption {
value: string | number;
label: string;
disabled?: boolean;
description?: string;
}

View File

@@ -56,6 +56,18 @@ export enum ProductCategory {
OTHER_PRODUCTS = 'other_products'
}
export enum StockMovementType {
PURCHASE = 'PURCHASE',
PRODUCTION_USE = 'PRODUCTION_USE',
ADJUSTMENT = 'ADJUSTMENT',
WASTE = 'WASTE',
TRANSFER = 'TRANSFER',
RETURN = 'RETURN',
INITIAL_STOCK = 'INITIAL_STOCK',
TRANSFORMATION = 'TRANSFORMATION'
}
// Base Inventory Types
export interface IngredientCreate {
name: string;
@@ -67,7 +79,6 @@ export interface IngredientCreate {
reorder_point: number;
shelf_life_days?: number; // Default shelf life only
is_seasonal?: boolean;
supplier_id?: string;
average_cost?: number;
notes?: string;
}
@@ -135,6 +146,7 @@ export interface IngredientResponse {
// Stock Management Types
export interface StockCreate {
ingredient_id: string;
supplier_id?: string;
batch_number?: string;
lot_number?: string;
supplier_batch_ref?: string;
@@ -174,6 +186,7 @@ export interface StockCreate {
}
export interface StockUpdate {
supplier_id?: string;
batch_number?: string;
lot_number?: string;
supplier_batch_ref?: string;
@@ -409,4 +422,12 @@ export interface DeletionSummary {
deleted_stock_movements: number;
deleted_stock_alerts: number;
success: boolean;
}
// Select option interface for enum helpers
export interface EnumOption {
value: string | number;
label: string;
disabled?: boolean;
description?: string;
}

View File

@@ -22,12 +22,13 @@ export enum SupplierStatus {
}
export enum PaymentTerms {
CASH_ON_DELIVERY = 'cod',
COD = 'cod',
NET_15 = 'net_15',
NET_30 = 'net_30',
NET_45 = 'net_45',
NET_60 = 'net_60',
PREPAID = 'prepaid',
CREDIT_TERMS = 'credit_terms',
}
export enum PurchaseOrderStatus {
@@ -39,6 +40,7 @@ export enum PurchaseOrderStatus {
PARTIALLY_RECEIVED = 'partially_received',
COMPLETED = 'completed',
CANCELLED = 'cancelled',
DISPUTED = 'disputed',
}
export enum DeliveryStatus {
@@ -48,6 +50,32 @@ export enum DeliveryStatus {
DELIVERED = 'delivered',
PARTIALLY_DELIVERED = 'partially_delivered',
FAILED_DELIVERY = 'failed_delivery',
RETURNED = 'returned',
}
export enum QualityRating {
EXCELLENT = 5,
GOOD = 4,
AVERAGE = 3,
POOR = 2,
VERY_POOR = 1,
}
export enum DeliveryRating {
EXCELLENT = 5,
GOOD = 4,
AVERAGE = 3,
POOR = 2,
VERY_POOR = 1,
}
export enum InvoiceStatus {
PENDING = 'pending',
APPROVED = 'approved',
PAID = 'paid',
OVERDUE = 'overdue',
DISPUTED = 'disputed',
CANCELLED = 'cancelled',
}
export enum OrderPriority {
@@ -425,7 +453,10 @@ export interface ApiResponse<T> {
errors?: string[];
}
// Export all types
export type {
// Add any additional export aliases if needed
};
// Select option interface for enum helpers
export interface EnumOption {
value: string | number;
label: string;
disabled?: boolean;
description?: string;
}