Skip to content

Commit

Permalink
Fix menu saveing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
karlomikus committed Nov 17, 2024
1 parent 7f7d47e commit 1694bad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.4.1
## Fixes
- Fix issues with updating menu prices

# v3.4.0
## New
- Added support for bar shelf
Expand Down
13 changes: 8 additions & 5 deletions src/components/Menu/MenuIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div>
<h4>{{ cocktail.name }}</h4>
<small>{{ cocktail.short_ingredients.join(', ') }}</small><br>
<a href="#" @click.prevent="copyCurrency(cocktail.currency)">{{ $t('menu.copy-currency') }}</a> &middot; <a href="#" @click.prevent="removeCocktail(category, cocktail)">{{ $t('remove') }}</a>
<a href="#" @click.prevent="copyCurrency(cocktail.price.currency)">{{ $t('menu.copy-currency') }}</a> &middot; <a href="#" @click.prevent="removeCocktail(category, cocktail)">{{ $t('remove') }}</a>
</div>
<div class="menu-category__cocktail__content__price">
<div class="form-group">
Expand Down Expand Up @@ -107,6 +107,7 @@ export default {
categories: [],
bar: {},
menu: {
is_enabled: false,
url: null
},
sortableInstances: [],
Expand All @@ -118,7 +119,7 @@ export default {
},
guessCurrency() {
// Use map() to create a new array with just the currencies
let currencyArray = this.cocktails.map(item => item.currency)
let currencyArray = this.cocktails.map(item => item.price.currency)
// Convert it into a Set, which will automatically remove any duplicates
let uniqueCurrencySet = new Set(currencyArray)
Expand Down Expand Up @@ -156,8 +157,10 @@ export default {
name: cocktail.name,
sort: 0,
short_ingredients: cocktail.short_ingredients,
price: '0.00',
currency: this.guessCurrency
price: {
price: '0.00',
currency: this.guessCurrency,
},
})
},
addCategory() {
Expand Down Expand Up @@ -260,7 +263,7 @@ export default {
copyCurrency(currency) {
this.categories.forEach(cat => {
cat.cocktails.forEach(cocktail => {
cocktail.currency = currency
cocktail.price.currency = currency
})
})
},
Expand Down

0 comments on commit 1694bad

Please sign in to comment.