Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix menu saveing issues #259

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading