Skip to content

Commit

Permalink
Add more cloud features
Browse files Browse the repository at this point in the history
  • Loading branch information
karlomikus committed Jan 2, 2025
1 parent c792497 commit 6707689
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/components/Calculator/CocktailPriceCalculator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div>
<div class="dialog-title">{{ props.cocktail.name }}</div>
<OverlayLoader v-if="isLoadingPrices"></OverlayLoader>
<SubscriptionCheck>Subscribe to "Mixologist" plan to unlock automatic price calculation!</SubscriptionCheck>
<div class="cocktail-price-calculator__prices">
<div v-for="cocktailPrice in cocktailPrices">
<CocktailPrice :cocktail-price=cocktailPrice></CocktailPrice>
Expand All @@ -13,11 +14,11 @@
<input id="name" v-model="targetPourCost" class="form-input" type="text" required>
<span class="form-input-hint">{{ $t('target-pour-cost-help') }}</span>
</div>
<h2 class="cocktail-price-calculator__price" v-if="finalPrice">
<h2 class="cocktail-price-calculator__price" v-if="finalPrice && appState.isSubscribed()">
<small>{{ $t('price.price') }}</small>
{{ UnitHandler.formatPrice(parseFloat(finalPrice.price), finalPrice.currency) }}
</h2>
<div class="dialog-actions">
<div class="dialog-actions" v-if="appState.isSubscribed()">
<button class="button button--outline" @click="emit('closed')">{{ $t('cancel') }}</button>
<button type="button" class="button button--dark" :disabled="!finalPrice" @click="selectFinalPrice">{{ $t('price.select') }}</button>
</div>
Expand All @@ -31,6 +32,8 @@ import UnitHandler from '@/UnitHandler'
import BarAssistantClient from '@/api/BarAssistantClient';
import CocktailPrice from './../Cocktail/CocktailPrice.vue'
import OverlayLoader from '../OverlayLoader.vue';
import SubscriptionCheck from '../SubscriptionCheck.vue';
import AppState from '@/AppState';
type Cocktail = components["schemas"]["Cocktail"]
type CocktailPrice = components["schemas"]["CocktailPrice"]
Expand All @@ -41,6 +44,7 @@ const props = defineProps<{
const emit = defineEmits(['closed', 'selectedPrice'])
const appState = new AppState()
const targetPourCost = ref(22)
const isLoadingPrices = ref(false)
const cocktailPrices = ref([] as CocktailPrice[])
Expand Down
10 changes: 8 additions & 2 deletions src/components/Ingredient/IngredientImport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ async function importIngredients() {
if (file.value) {
try {
(await BarAssistantClient.importIngredientsAsCSVFile(file.value))
} catch (e) {
} catch (e: any) {
toast.default(e.message)
isLoading.value = false
return
}
} else {
try {
(await BarAssistantClient.importIngredientsAsCSVBody(source.value))
} catch (e) {
} catch (e: any) {
toast.default(e.message)
isLoading.value = false
return
}
}
isLoading.value = false
Expand Down
3 changes: 3 additions & 0 deletions src/components/Settings/BillingInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
<li>Add unlimited cocktail collections</li>
<li>No rate limits for import actions</li>
<li>Create personal access API tokens</li>
<li>Automatic cocktail price menu suggestions</li>
<li>Bulk ingredient import</li>
<li>Unlimited price categories</li>
<li>Save <span>15%</span> when paying annually</li>
</ul>
<div class="form-group">
Expand Down
12 changes: 11 additions & 1 deletion src/components/Settings/PriceCategoriesList.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PageHeader>
{{ $t('prices.price-categories') }}
<template #actions>
<template v-if="showCreateAction" #actions>
<SaltRimDialog v-model="showDialog">
<template #trigger>
<button type="button" class="button button--dark" @click.prevent="openDialog($t('prices.add-price-category'), {})">{{ $t('prices.add-price-category') }}</button>
Expand All @@ -18,6 +18,7 @@
</div>
<div class="settings-page__content">
<OverlayLoader v-if="isLoading" />
<SubscriptionCheck>Subscribe to "Mixologist" plan to unlock unlimited price categories!</SubscriptionCheck>
<div v-if="categories.length > 0" class="block-container block-container--padded">
<table class="table">
<thead>
Expand Down Expand Up @@ -63,6 +64,8 @@ import SaltRimDialog from '@/components/Dialog/SaltRimDialog.vue'
import PriceCategoryForm from '@/components/Settings/PriceCategoryForm.vue'
import EmptyState from '../EmptyState.vue'
import { useTitle } from '@/composables/title'
import SubscriptionCheck from '../SubscriptionCheck.vue'
import AppState from '@/AppState'
export default {
components: {
Expand All @@ -72,16 +75,23 @@ export default {
PriceCategoryForm,
SaltRimDialog,
EmptyState,
SubscriptionCheck,
},
data() {
return {
appState: new AppState(),
isLoading: false,
showDialog: false,
dialogTitle: 'Price category data',
editPriceCategory: {},
categories: [],
}
},
computed: {
showCreateAction() {
return this.categories.length < 1 && !this.appState.isSubscribed()
}
},
created() {
useTitle(this.$t('prices.price-categories'))
Expand Down

0 comments on commit 6707689

Please sign in to comment.