category order

This commit is contained in:
efrilm
2025-10-07 00:01:53 +07:00
parent e551ae7feb
commit ac2fc4e920
10 changed files with 252 additions and 104 deletions
@@ -420,7 +420,13 @@ const DailyPOSReport = () => {
<div className='space-y-12'>
{Object.keys(groupedProducts)
.sort()
.sort((a, b) => {
const productsA = groupedProducts[a]
const productsB = groupedProducts[b]
const orderA = productsA[0]?.category_order ?? 999
const orderB = productsB[0]?.category_order ?? 999
return orderA - orderB
})
.map(categoryName => {
const categoryProducts = groupedProducts[categoryName]
const categoryTotalQty = categoryProducts.reduce((sum, item) => sum + (item.quantity_sold || 0), 0)