Add price information
This commit is contained in:
@@ -123,7 +123,10 @@ function DrinkPage(arg:Arguments) {
|
||||
<th>Volume</th>
|
||||
<th>Amount</th>
|
||||
{arg.isAdmin ? (
|
||||
<th>Edit</th>
|
||||
<>
|
||||
<th>Price</th>
|
||||
<th>Edit</th>
|
||||
</>
|
||||
) : ""}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -135,7 +138,10 @@ function DrinkPage(arg:Arguments) {
|
||||
<td>{volume(container.volume)}</td>
|
||||
<td>{container.inventory}</td>
|
||||
{arg.isAdmin ? (
|
||||
<>
|
||||
<td>€{container.price}</td>
|
||||
<td><LinkContainer to={"/admin/edit/container/" + container.id}><Button variant='primary'>Edit</Button></LinkContainer></td>
|
||||
</>
|
||||
) : ""}
|
||||
</tr>
|
||||
))}
|
||||
|
||||
@@ -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} <br />
|
||||
Total cocktails in inventory: {loadData.total.cocktailInventory} <br /><br />
|
||||
|
||||
Total alcohol in inventory: {loadData.total.totalLiterAlcohol} Liter <br />
|
||||
Total pure alcohol in inventory: {loadData.total.totalLiterAlcohol} Liter <br />
|
||||
Total price inventory: €{loadData.total.totalPrice} <br />
|
||||
Average alcohol percentage: {loadData.total.averageAlcoholPercentage}% <br />
|
||||
</Col>
|
||||
<Col key="stats-24h" className="mb-3">
|
||||
@@ -105,7 +109,8 @@ export default function StatsRoute() {
|
||||
Sodas checked out: {loadData.statsLast24H.sodaInventory} <br />
|
||||
Cocktails checked out: {loadData.statsLast24H.cocktailInventory} <br /><br />
|
||||
|
||||
Alcohol checked out: {loadData.statsLast24H.totalLiterAlcohol} Liter <br />
|
||||
Pure alcohol checked out: {loadData.statsLast24H.totalLiterAlcohol} Liter <br />
|
||||
Price checked out: €{loadData.statsLast24H.totalPrice} <br />
|
||||
Average alcohol percentage: {loadData.statsLast24H.averageAlcoholPercentage}% <br />
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
Reference in New Issue
Block a user