getStatsForRoute function
Maps menu option routes to their corresponding statistics from the Stats model.
Returns null if no matching stats are found for the route.
Implementation
String? getStatsForRoute(String? route, Stats? stats) {
if (stats == null || route == null) return null;
switch (route) {
case '/orders':
return 'Sales: ${stats.openSlsOrders}\nPurchase: ${stats.openPurOrders}';
case '/accounting':
return 'Sales Invoices: ${stats.salesInvoicesNotPaidCount}\nPurchase: ${stats.purchInvoicesNotPaidCount}';
case '/shipments':
return 'Incoming: ${stats.incomingShipments}\nOutgoing: ${stats.outgoingShipments}';
case '/inventory':
return 'WH Locations: ${stats.whLocations}';
case '/requests':
return 'Requests: ${stats.requests}';
case '/catalog':
return 'Categories: ${stats.categories}\nProducts: ${stats.products}';
case '/crm':
return 'Customers: ${stats.customers}\nLeads: ${stats.leads}\nSuppliers: ${stats.suppliers}';
case '/users':
return 'Admins: ${stats.admins}\nEmployees: ${stats.employees}';
case '/opportunities':
return 'Opportunities: ${stats.opportunities}';
case '/tasks':
return 'Tasks: ${stats.allTasks}\nHours: ${stats.notInvoicedHours}';
case '/activities':
return 'To Do: ${stats.todoActivities}\nEvents: ${stats.eventActivities}';
case '/assets':
return 'Assets: ${stats.assets}';
// Accounting sub-routes
case '/accounting/sales':
return 'Open: ${stats.salesInvoicesNotPaidCount}';
case '/accounting/purchase':
return 'Open: ${stats.purchInvoicesNotPaidCount}';
default:
return null;
}
}