diff --git a/app/components/cards/drink.page.tsx b/app/components/cards/drink.page.tsx index 5a1ec12..e08addd 100644 --- a/app/components/cards/drink.page.tsx +++ b/app/components/cards/drink.page.tsx @@ -123,7 +123,10 @@ function DrinkPage(arg:Arguments) { Volume Amount {arg.isAdmin ? ( - Edit + <> + Price + Edit + ) : ""} @@ -135,7 +138,10 @@ function DrinkPage(arg:Arguments) { {volume(container.volume)} {container.inventory} {arg.isAdmin ? ( + <> + €{container.price} + ) : ""} ))} diff --git a/app/routes/inventory/stats/route.tsx b/app/routes/inventory/stats/route.tsx index 37074e9..871c3e6 100644 --- a/app/routes/inventory/stats/route.tsx +++ b/app/routes/inventory/stats/route.tsx @@ -16,6 +16,7 @@ function statsForContainers(containers : ContainerWithDrink[]){ var cocktailInventory = 0; var totalMilliliterAlcohol = 0.0; var averageAlcoholPercentage = 0.0; + var totalPrice = 0.00; var divider = 0; containers.forEach((container) => { @@ -37,6 +38,7 @@ function statsForContainers(containers : ContainerWithDrink[]){ } totalMilliliterAlcohol += (container.inventory * (container.volume * (container.drink.abv / 100))); + totalPrice += (container.inventory * container.price); if(container.drink.abv > 0){ averageAlcoholPercentage += container.drink.abv; @@ -48,10 +50,11 @@ function statsForContainers(containers : ContainerWithDrink[]){ averageAlcoholPercentage /= divider; totalLiterAlcohol = Math.round(totalLiterAlcohol * 100) / 100; + totalPrice = Math.round(totalPrice * 100) / 100; averageAlcoholPercentage = Math.round(averageAlcoholPercentage * 100) / 100; - return {drinksInventory, beersInventory, wineInventory, sodaInventory, cocktailInventory, totalLiterAlcohol, averageAlcoholPercentage}; + return {drinksInventory, beersInventory, wineInventory, sodaInventory, cocktailInventory, totalLiterAlcohol, averageAlcoholPercentage, totalPrice}; } export const loader = async ({request} : LoaderFunctionArgs) => { @@ -94,7 +97,8 @@ export default function StatsRoute() { Total sodas in inventory: {loadData.total.sodaInventory}
Total cocktails in inventory: {loadData.total.cocktailInventory}

- Total alcohol in inventory: {loadData.total.totalLiterAlcohol} Liter
+ Total pure alcohol in inventory: {loadData.total.totalLiterAlcohol} Liter
+ Total price inventory: €{loadData.total.totalPrice}
Average alcohol percentage: {loadData.total.averageAlcoholPercentage}%
@@ -105,7 +109,8 @@ export default function StatsRoute() { Sodas checked out: {loadData.statsLast24H.sodaInventory}
Cocktails checked out: {loadData.statsLast24H.cocktailInventory}

- Alcohol checked out: {loadData.statsLast24H.totalLiterAlcohol} Liter
+ Pure alcohol checked out: {loadData.statsLast24H.totalLiterAlcohol} Liter
+ Price checked out: €{loadData.statsLast24H.totalPrice}
Average alcohol percentage: {loadData.statsLast24H.averageAlcoholPercentage}%