Skip to content

Commit

Permalink
Kiosk alphabet ordering, display total sum
Browse files Browse the repository at this point in the history
  • Loading branch information
megastary committed Oct 19, 2023
1 parent ef4bcb4 commit 0b85471
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions routes/kiosk_shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,16 @@ function renderPage(req, res, alert, customer) {
$gt: ['$$stock.amount_left', 0]
}
}
},
stockSum: {
$sum: '$stock.amount_left'
}
}
},
{
$sort: {
displayName: 1
}
}
])
.then((docs) => {
Expand Down
3 changes: 1 addition & 2 deletions views/shop/kiosk_shop.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@
<div class="card-footer">
<div class="row">
<div class="col-6 text-left">
{{!-- TODO: add tooltip to icons https://getbootstrap.com/docs/4.0/components/tooltips/ --}}
{{#if this.stock.0.amount_left}}
<i class="fas fa-boxes"></i> {{ this.stock.0.amount_left }}
<i class="fas fa-boxes"></i> {{ this.stockSum }}
{{else}}
<i class="fas fa-boxes"></i> <span class="text-danger">0</span>
{{/if }}
Expand Down

0 comments on commit 0b85471

Please sign in to comment.