diff --git a/inventory-server/src/routes/analytics.js b/inventory-server/src/routes/analytics.js index 5da6b1d..351cc63 100644 --- a/inventory-server/src/routes/analytics.js +++ b/inventory-server/src/routes/analytics.js @@ -353,22 +353,10 @@ router.get('/stock', async (req, res) => { COALESCE( (SELECT reorder_days FROM stock_thresholds st - JOIN product_categories pc ON st.cat_id = pc.cat_id - WHERE pc.pid = p.pid - AND st.vendor = p.vendor LIMIT 1), + WHERE st.vendor = p.vendor LIMIT 1), (SELECT reorder_days FROM stock_thresholds st - JOIN product_categories pc ON st.cat_id = pc.cat_id - WHERE pc.pid = p.pid - AND st.vendor IS NULL LIMIT 1), - (SELECT reorder_days - FROM stock_thresholds st - WHERE st.cat_id IS NULL - AND st.vendor = p.vendor LIMIT 1), - (SELECT reorder_days - FROM stock_thresholds st - WHERE st.cat_id IS NULL - AND st.vendor IS NULL LIMIT 1), + WHERE st.vendor IS NULL LIMIT 1), 14 ) as reorder_days FROM products p diff --git a/inventory/src/components/analytics/CategoryPerformance.tsx b/inventory/src/components/analytics/CategoryPerformance.tsx index 1d8cda3..1f627a0 100644 --- a/inventory/src/components/analytics/CategoryPerformance.tsx +++ b/inventory/src/components/analytics/CategoryPerformance.tsx @@ -93,7 +93,7 @@ export function CategoryPerformance() { > {data.distribution.map((entry, index) => ( ))} @@ -170,7 +170,7 @@ export function CategoryPerformance() {
{data.performance.map((category) => ( -
+

{getShortCategoryName(category.categoryPath)}

diff --git a/inventory/src/components/analytics/PriceAnalysis.tsx b/inventory/src/components/analytics/PriceAnalysis.tsx index f2ec107..1626272 100644 --- a/inventory/src/components/analytics/PriceAnalysis.tsx +++ b/inventory/src/components/analytics/PriceAnalysis.tsx @@ -154,7 +154,7 @@ export function PriceAnalysis() {
{data.recommendations.map((item) => ( -
+

{item.product}

diff --git a/inventory/src/components/analytics/ProfitAnalysis.tsx b/inventory/src/components/analytics/ProfitAnalysis.tsx index bf4b8bf..17deac4 100644 --- a/inventory/src/components/analytics/ProfitAnalysis.tsx +++ b/inventory/src/components/analytics/ProfitAnalysis.tsx @@ -150,7 +150,7 @@ export function ProfitAnalysis() {

{data.topProducts.map((product) => ( -
+

{product.product}

diff --git a/inventory/src/components/analytics/StockAnalysis.tsx b/inventory/src/components/analytics/StockAnalysis.tsx index a786390..fb12669 100644 --- a/inventory/src/components/analytics/StockAnalysis.tsx +++ b/inventory/src/components/analytics/StockAnalysis.tsx @@ -145,7 +145,7 @@ export function StockAnalysis() {
{data.criticalItems.map((item) => ( -
+

{item.product}

diff --git a/inventory/src/components/analytics/VendorPerformance.tsx b/inventory/src/components/analytics/VendorPerformance.tsx index 11e812d..12a1641 100644 --- a/inventory/src/components/analytics/VendorPerformance.tsx +++ b/inventory/src/components/analytics/VendorPerformance.tsx @@ -131,7 +131,7 @@ export function VendorPerformance() {
{data.performance.map((vendor) => ( -
+

{vendor.vendor}

diff --git a/inventory/src/pages/Categories.tsx b/inventory/src/pages/Categories.tsx index 42dc1e8..d07b159 100644 --- a/inventory/src/pages/Categories.tsx +++ b/inventory/src/pages/Categories.tsx @@ -28,6 +28,11 @@ interface Category { }; } +interface TypeCount { + type: number; + count: number; +} + interface CategoryFilters { search: string; type: string; @@ -286,7 +291,7 @@ export function Categories() { All Types - {data?.typeCounts?.map(tc => ( + {data?.typeCounts?.map((tc: TypeCount) => ( {TYPE_LABELS[tc.type]} ({tc.count}) @@ -345,9 +350,7 @@ export function Categories() {

{category.name} - - {TYPE_LABELS[category.type]} - +
{category.description && (
{category.description}