Add more services
This commit is contained in:
@@ -433,22 +433,6 @@ export class InventoryService {
|
||||
|
||||
// ========== DASHBOARD & ANALYTICS ==========
|
||||
|
||||
/**
|
||||
* Get inventory dashboard data
|
||||
*/
|
||||
async getDashboardData(tenantId: string): Promise<InventoryDashboardData> {
|
||||
// TODO: Map to correct endpoint when available
|
||||
return {
|
||||
total_items: 0,
|
||||
low_stock_items: 0,
|
||||
out_of_stock_items: 0,
|
||||
total_value: 0,
|
||||
recent_movements: [],
|
||||
top_products: [],
|
||||
stock_alerts: []
|
||||
};
|
||||
// return apiClient.get(`/tenants/${tenantId}/inventory/dashboard`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get inventory value report
|
||||
@@ -696,6 +680,129 @@ export class InventoryService {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ========== ENHANCED DASHBOARD FEATURES ==========
|
||||
|
||||
/**
|
||||
* Get inventory dashboard data with analytics
|
||||
*/
|
||||
async getDashboardData(tenantId: string, params?: {
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
location?: string;
|
||||
}): Promise<{
|
||||
summary: {
|
||||
total_items: number;
|
||||
low_stock_count: number;
|
||||
out_of_stock_items: number;
|
||||
expiring_soon: number;
|
||||
total_value: number;
|
||||
};
|
||||
recent_movements: any[];
|
||||
active_alerts: any[];
|
||||
stock_trends: {
|
||||
dates: string[];
|
||||
stock_levels: number[];
|
||||
movements_in: number[];
|
||||
movements_out: number[];
|
||||
};
|
||||
}> {
|
||||
try {
|
||||
return await apiClient.get(`/tenants/${tenantId}/inventory/dashboard`, { params });
|
||||
} catch (error) {
|
||||
console.error('❌ Error fetching inventory dashboard:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get food safety compliance data
|
||||
*/
|
||||
async getFoodSafetyCompliance(tenantId: string): Promise<{
|
||||
compliant_items: number;
|
||||
non_compliant_items: number;
|
||||
expiring_items: any[];
|
||||
temperature_violations: any[];
|
||||
compliance_score: number;
|
||||
}> {
|
||||
try {
|
||||
return await apiClient.get(`/tenants/${tenantId}/inventory/food-safety/compliance`);
|
||||
} catch (error) {
|
||||
console.error('❌ Error fetching food safety compliance:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get temperature monitoring data
|
||||
*/
|
||||
async getTemperatureMonitoring(tenantId: string, params?: {
|
||||
item_id?: string;
|
||||
location?: string;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
}): Promise<{
|
||||
readings: any[];
|
||||
violations: any[];
|
||||
}> {
|
||||
try {
|
||||
return await apiClient.get(`/tenants/${tenantId}/inventory/food-safety/temperature-monitoring`, { params });
|
||||
} catch (error) {
|
||||
console.error('❌ Error fetching temperature monitoring:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Record temperature reading
|
||||
*/
|
||||
async recordTemperatureReading(tenantId: string, params: {
|
||||
item_id: string;
|
||||
temperature: number;
|
||||
humidity?: number;
|
||||
location: string;
|
||||
notes?: string;
|
||||
}): Promise<void> {
|
||||
try {
|
||||
return await apiClient.post(`/tenants/${tenantId}/inventory/food-safety/temperature-reading`, params);
|
||||
} catch (error) {
|
||||
console.error('❌ Error recording temperature reading:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get inventory alerts
|
||||
*/
|
||||
async getInventoryAlerts(tenantId: string, params?: {
|
||||
alert_type?: string;
|
||||
severity?: string;
|
||||
status?: string;
|
||||
item_id?: string;
|
||||
limit?: number;
|
||||
}): Promise<any[]> {
|
||||
try {
|
||||
return await apiClient.get(`/tenants/${tenantId}/inventory/alerts`, { params });
|
||||
} catch (error) {
|
||||
console.error('❌ Error fetching inventory alerts:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get restock recommendations
|
||||
*/
|
||||
async getRestockRecommendations(tenantId: string): Promise<{
|
||||
urgent_restocks: any[];
|
||||
optimal_orders: any[];
|
||||
}> {
|
||||
try {
|
||||
return await apiClient.get(`/tenants/${tenantId}/inventory/forecasting/restock-recommendations`);
|
||||
} catch (error) {
|
||||
console.error('❌ Error fetching restock recommendations:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const inventoryService = new InventoryService();
|
||||
Reference in New Issue
Block a user