diff --git a/package.json b/package.json index 708e7b8..d581d06 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,11 @@ "lint": "eslint --ext .js,.ts,.vue ./src" }, "dependencies": { - "@quasar/extras": "^1.9.19", "axios": "^0.21.1", "cordova": "^10.0.0", "core-js": "^3.9.1", "pinia": "^2.0.0-alpha.7", - "quasar": "^2.0.0-beta.9" + "quasar": "^2.0.0-beta.11" }, "prettier": { "singleQuote": true, @@ -24,7 +23,8 @@ "arrowParens": "always" }, "devDependencies": { - "@quasar/app": "^3.0.0-beta.9", + "@quasar/app": "^3.0.0-beta.10", + "@quasar/extras": "^1.10.0", "@quasar/quasar-app-extension-qcalendar": "file:deps/quasar-ui-qcalendar/app-extension", "@types/node": "^12.20.6", "@types/webpack": "^4.41.26", diff --git a/src-cordova/res/android/hdpi.png b/src-cordova/res/android/hdpi.png index f8b7556..a75b8bc 100644 Binary files a/src-cordova/res/android/hdpi.png and b/src-cordova/res/android/hdpi.png differ diff --git a/src-cordova/res/android/ldpi.png b/src-cordova/res/android/ldpi.png index 918576d..481bfdc 100644 Binary files a/src-cordova/res/android/ldpi.png and b/src-cordova/res/android/ldpi.png differ diff --git a/src-cordova/res/android/mdpi.png b/src-cordova/res/android/mdpi.png index 62a7d1f..c23e016 100644 Binary files a/src-cordova/res/android/mdpi.png and b/src-cordova/res/android/mdpi.png differ diff --git a/src-cordova/res/android/xhdpi.png b/src-cordova/res/android/xhdpi.png index f101926..d6e939e 100644 Binary files a/src-cordova/res/android/xhdpi.png and b/src-cordova/res/android/xhdpi.png differ diff --git a/src-cordova/res/android/xxhdpi.png b/src-cordova/res/android/xxhdpi.png index fb6d5cb..7ec5d5c 100644 Binary files a/src-cordova/res/android/xxhdpi.png and b/src-cordova/res/android/xxhdpi.png differ diff --git a/src-cordova/res/android/xxxhdpi.png b/src-cordova/res/android/xxxhdpi.png index 5ff27e5..574239c 100644 Binary files a/src-cordova/res/android/xxxhdpi.png and b/src-cordova/res/android/xxxhdpi.png differ diff --git a/src-cordova/res/ios/icon-1024.png b/src-cordova/res/ios/icon-1024.png index 926831e..40bb775 100644 Binary files a/src-cordova/res/ios/icon-1024.png and b/src-cordova/res/ios/icon-1024.png differ diff --git a/src-cordova/res/ios/icon-20.png b/src-cordova/res/ios/icon-20.png index d8b5142..1c5dc87 100644 Binary files a/src-cordova/res/ios/icon-20.png and b/src-cordova/res/ios/icon-20.png differ diff --git a/src-cordova/res/ios/icon-20@2x.png b/src-cordova/res/ios/icon-20@2x.png index e3f7f49..cf523e4 100644 Binary files a/src-cordova/res/ios/icon-20@2x.png and b/src-cordova/res/ios/icon-20@2x.png differ diff --git a/src-cordova/res/ios/icon-20@3x.png b/src-cordova/res/ios/icon-20@3x.png index 7df03bf..af16bc4 100644 Binary files a/src-cordova/res/ios/icon-20@3x.png and b/src-cordova/res/ios/icon-20@3x.png differ diff --git a/src-cordova/res/ios/icon-24@2x.png b/src-cordova/res/ios/icon-24@2x.png index 748c7e1..b5df90d 100644 Binary files a/src-cordova/res/ios/icon-24@2x.png and b/src-cordova/res/ios/icon-24@2x.png differ diff --git a/src-cordova/res/ios/icon-27.5@2x.png b/src-cordova/res/ios/icon-27.5@2x.png index f7229dc..132290b 100644 Binary files a/src-cordova/res/ios/icon-27.5@2x.png and b/src-cordova/res/ios/icon-27.5@2x.png differ diff --git a/src-cordova/res/ios/icon-29.png b/src-cordova/res/ios/icon-29.png index af8a670..89230e5 100644 Binary files a/src-cordova/res/ios/icon-29.png and b/src-cordova/res/ios/icon-29.png differ diff --git a/src-cordova/res/ios/icon-29@2x.png b/src-cordova/res/ios/icon-29@2x.png index bda922e..5964119 100644 Binary files a/src-cordova/res/ios/icon-29@2x.png and b/src-cordova/res/ios/icon-29@2x.png differ diff --git a/src-cordova/res/ios/icon-29@3x.png b/src-cordova/res/ios/icon-29@3x.png index 0c291e1..d46cdc6 100644 Binary files a/src-cordova/res/ios/icon-29@3x.png and b/src-cordova/res/ios/icon-29@3x.png differ diff --git a/src-cordova/res/ios/icon-40.png b/src-cordova/res/ios/icon-40.png index e3f7f49..cf523e4 100644 Binary files a/src-cordova/res/ios/icon-40.png and b/src-cordova/res/ios/icon-40.png differ diff --git a/src-cordova/res/ios/icon-40@2x.png b/src-cordova/res/ios/icon-40@2x.png index f66b516..4f4e96e 100644 Binary files a/src-cordova/res/ios/icon-40@2x.png and b/src-cordova/res/ios/icon-40@2x.png differ diff --git a/src-cordova/res/ios/icon-44@2x.png b/src-cordova/res/ios/icon-44@2x.png index 71258cf..4a28ced 100644 Binary files a/src-cordova/res/ios/icon-44@2x.png and b/src-cordova/res/ios/icon-44@2x.png differ diff --git a/src-cordova/res/ios/icon-50.png b/src-cordova/res/ios/icon-50.png index afb780c..db2b72c 100644 Binary files a/src-cordova/res/ios/icon-50.png and b/src-cordova/res/ios/icon-50.png differ diff --git a/src-cordova/res/ios/icon-50@2x.png b/src-cordova/res/ios/icon-50@2x.png index a7d508b..35b567e 100644 Binary files a/src-cordova/res/ios/icon-50@2x.png and b/src-cordova/res/ios/icon-50@2x.png differ diff --git a/src-cordova/res/ios/icon-60@2x.png b/src-cordova/res/ios/icon-60@2x.png index d861f87..65b4677 100644 Binary files a/src-cordova/res/ios/icon-60@2x.png and b/src-cordova/res/ios/icon-60@2x.png differ diff --git a/src-cordova/res/ios/icon-60@3x.png b/src-cordova/res/ios/icon-60@3x.png index 4587465..4247aa2 100644 Binary files a/src-cordova/res/ios/icon-60@3x.png and b/src-cordova/res/ios/icon-60@3x.png differ diff --git a/src-cordova/res/ios/icon-72.png b/src-cordova/res/ios/icon-72.png index b27ae3c..9ec3a4b 100644 Binary files a/src-cordova/res/ios/icon-72.png and b/src-cordova/res/ios/icon-72.png differ diff --git a/src-cordova/res/ios/icon-72@2x.png b/src-cordova/res/ios/icon-72@2x.png index 3621c8f..41f6a5d 100644 Binary files a/src-cordova/res/ios/icon-72@2x.png and b/src-cordova/res/ios/icon-72@2x.png differ diff --git a/src-cordova/res/ios/icon-76.png b/src-cordova/res/ios/icon-76.png index 496148a..41be212 100644 Binary files a/src-cordova/res/ios/icon-76.png and b/src-cordova/res/ios/icon-76.png differ diff --git a/src-cordova/res/ios/icon-76@2x.png b/src-cordova/res/ios/icon-76@2x.png index bdb2569..4a8f542 100644 Binary files a/src-cordova/res/ios/icon-76@2x.png and b/src-cordova/res/ios/icon-76@2x.png differ diff --git a/src-cordova/res/ios/icon-83.5@2x.png b/src-cordova/res/ios/icon-83.5@2x.png index 23ebbc3..daacd97 100644 Binary files a/src-cordova/res/ios/icon-83.5@2x.png and b/src-cordova/res/ios/icon-83.5@2x.png differ diff --git a/src-cordova/res/ios/icon-86@2x.png b/src-cordova/res/ios/icon-86@2x.png index fea8585..4fb526a 100644 Binary files a/src-cordova/res/ios/icon-86@2x.png and b/src-cordova/res/ios/icon-86@2x.png differ diff --git a/src-cordova/res/ios/icon-98@2x.png b/src-cordova/res/ios/icon-98@2x.png index 2bcbcbb..50e53c2 100644 Binary files a/src-cordova/res/ios/icon-98@2x.png and b/src-cordova/res/ios/icon-98@2x.png differ diff --git a/src-cordova/res/ios/icon.png b/src-cordova/res/ios/icon.png index bf9fe3a..54fa2cd 100644 Binary files a/src-cordova/res/ios/icon.png and b/src-cordova/res/ios/icon.png differ diff --git a/src-cordova/res/ios/icon@2x.png b/src-cordova/res/ios/icon@2x.png index 1724047..b2071ab 100644 Binary files a/src-cordova/res/ios/icon@2x.png and b/src-cordova/res/ios/icon@2x.png differ diff --git a/src-cordova/res/screen/android/splash-land-hdpi.png b/src-cordova/res/screen/android/splash-land-hdpi.png index 7237031..3ac007f 100644 Binary files a/src-cordova/res/screen/android/splash-land-hdpi.png and b/src-cordova/res/screen/android/splash-land-hdpi.png differ diff --git a/src-cordova/res/screen/android/splash-land-ldpi.png b/src-cordova/res/screen/android/splash-land-ldpi.png index 3f92dab..83ff5a8 100644 Binary files a/src-cordova/res/screen/android/splash-land-ldpi.png and b/src-cordova/res/screen/android/splash-land-ldpi.png differ diff --git a/src-cordova/res/screen/android/splash-land-mdpi.png b/src-cordova/res/screen/android/splash-land-mdpi.png index 44241a6..19845cd 100644 Binary files a/src-cordova/res/screen/android/splash-land-mdpi.png and b/src-cordova/res/screen/android/splash-land-mdpi.png differ diff --git a/src-cordova/res/screen/android/splash-land-xhdpi.png b/src-cordova/res/screen/android/splash-land-xhdpi.png index 405899d..fcea352 100644 Binary files a/src-cordova/res/screen/android/splash-land-xhdpi.png and b/src-cordova/res/screen/android/splash-land-xhdpi.png differ diff --git a/src-cordova/res/screen/android/splash-land-xxhdpi.png b/src-cordova/res/screen/android/splash-land-xxhdpi.png index 00c2c8c..c7d8201 100644 Binary files a/src-cordova/res/screen/android/splash-land-xxhdpi.png and b/src-cordova/res/screen/android/splash-land-xxhdpi.png differ diff --git a/src-cordova/res/screen/android/splash-land-xxxhdpi.png b/src-cordova/res/screen/android/splash-land-xxxhdpi.png index cd0d955..c776489 100644 Binary files a/src-cordova/res/screen/android/splash-land-xxxhdpi.png and b/src-cordova/res/screen/android/splash-land-xxxhdpi.png differ diff --git a/src-cordova/res/screen/android/splash-port-hdpi.png b/src-cordova/res/screen/android/splash-port-hdpi.png index 47401fa..bb71a8a 100644 Binary files a/src-cordova/res/screen/android/splash-port-hdpi.png and b/src-cordova/res/screen/android/splash-port-hdpi.png differ diff --git a/src-cordova/res/screen/android/splash-port-ldpi.png b/src-cordova/res/screen/android/splash-port-ldpi.png index ccc78d6..0c1a2f9 100644 Binary files a/src-cordova/res/screen/android/splash-port-ldpi.png and b/src-cordova/res/screen/android/splash-port-ldpi.png differ diff --git a/src-cordova/res/screen/android/splash-port-mdpi.png b/src-cordova/res/screen/android/splash-port-mdpi.png index 3a47c06..b2f0f7c 100644 Binary files a/src-cordova/res/screen/android/splash-port-mdpi.png and b/src-cordova/res/screen/android/splash-port-mdpi.png differ diff --git a/src-cordova/res/screen/android/splash-port-xhdpi.png b/src-cordova/res/screen/android/splash-port-xhdpi.png index bb80b92..5a8b03a 100644 Binary files a/src-cordova/res/screen/android/splash-port-xhdpi.png and b/src-cordova/res/screen/android/splash-port-xhdpi.png differ diff --git a/src-cordova/res/screen/android/splash-port-xxhdpi.png b/src-cordova/res/screen/android/splash-port-xxhdpi.png index e879b67..a46dc85 100644 Binary files a/src-cordova/res/screen/android/splash-port-xxhdpi.png and b/src-cordova/res/screen/android/splash-port-xxhdpi.png differ diff --git a/src-cordova/res/screen/android/splash-port-xxxhdpi.png b/src-cordova/res/screen/android/splash-port-xxxhdpi.png index a463528..ba53fbd 100644 Binary files a/src-cordova/res/screen/android/splash-port-xxxhdpi.png and b/src-cordova/res/screen/android/splash-port-xxxhdpi.png differ diff --git a/src-cordova/res/screen/ios/Default@2x~ipad~anyany.png b/src-cordova/res/screen/ios/Default@2x~ipad~anyany.png index 518284c..d049642 100644 Binary files a/src-cordova/res/screen/ios/Default@2x~ipad~anyany.png and b/src-cordova/res/screen/ios/Default@2x~ipad~anyany.png differ diff --git a/src-cordova/res/screen/ios/Default@2x~ipad~comany.png b/src-cordova/res/screen/ios/Default@2x~ipad~comany.png index 6094ab0..64f144b 100644 Binary files a/src-cordova/res/screen/ios/Default@2x~ipad~comany.png and b/src-cordova/res/screen/ios/Default@2x~ipad~comany.png differ diff --git a/src-cordova/res/screen/ios/Default@2x~iphone~anyany.png b/src-cordova/res/screen/ios/Default@2x~iphone~anyany.png index 997da93..559efaa 100644 Binary files a/src-cordova/res/screen/ios/Default@2x~iphone~anyany.png and b/src-cordova/res/screen/ios/Default@2x~iphone~anyany.png differ diff --git a/src-cordova/res/screen/ios/Default@2x~iphone~comany.png b/src-cordova/res/screen/ios/Default@2x~iphone~comany.png index 3ee4163..0f319dc 100644 Binary files a/src-cordova/res/screen/ios/Default@2x~iphone~comany.png and b/src-cordova/res/screen/ios/Default@2x~iphone~comany.png differ diff --git a/src-cordova/res/screen/ios/Default@2x~iphone~comcom.png b/src-cordova/res/screen/ios/Default@2x~iphone~comcom.png index 0641764..d5f0ae1 100644 Binary files a/src-cordova/res/screen/ios/Default@2x~iphone~comcom.png and b/src-cordova/res/screen/ios/Default@2x~iphone~comcom.png differ diff --git a/src-cordova/res/screen/ios/Default@3x~iphone~anyany.png b/src-cordova/res/screen/ios/Default@3x~iphone~anyany.png index 7f756cd..eb24af3 100644 Binary files a/src-cordova/res/screen/ios/Default@3x~iphone~anyany.png and b/src-cordova/res/screen/ios/Default@3x~iphone~anyany.png differ diff --git a/src-cordova/res/screen/ios/Default@3x~iphone~anycom.png b/src-cordova/res/screen/ios/Default@3x~iphone~anycom.png index f528d1a..82d5016 100644 Binary files a/src-cordova/res/screen/ios/Default@3x~iphone~anycom.png and b/src-cordova/res/screen/ios/Default@3x~iphone~anycom.png differ diff --git a/src-cordova/res/screen/ios/Default@3x~iphone~comany.png b/src-cordova/res/screen/ios/Default@3x~iphone~comany.png index 4274e25..fbe7e80 100644 Binary files a/src-cordova/res/screen/ios/Default@3x~iphone~comany.png and b/src-cordova/res/screen/ios/Default@3x~iphone~comany.png differ diff --git a/src/boot/plugins.ts b/src/boot/plugins.ts index c070353..a6515b9 100644 --- a/src/boot/plugins.ts +++ b/src/boot/plugins.ts @@ -313,7 +313,7 @@ async function getBackend() { */ export default boot(async ({ router, app }) => { const backend = await getBackend(); - if (!backend) { + if (backend === null) { void router.push({ name: 'error' }); return; } diff --git a/src/components/Notification.vue b/src/components/Notification.vue new file mode 100644 index 0000000..74f3bd1 --- /dev/null +++ b/src/components/Notification.vue @@ -0,0 +1,45 @@ + + + {{ dateString }} + {{ modelValue.text }} + + + + + + + diff --git a/src/flaschengeist.d.ts b/src/flaschengeist.d.ts index 67248d4..1e08ed4 100644 --- a/src/flaschengeist.d.ts +++ b/src/flaschengeist.d.ts @@ -1,11 +1,10 @@ declare namespace FG { - interface Session { - expires: Date; - token: string; - lifetime: number; - browser: string; - platform: string; - userid: string; + interface Notification { + id: number; + plugin: string; + text: string; + data?: unknown; + time: Date; } interface User { userid: string; @@ -18,6 +17,14 @@ declare namespace FG { permissions?: Array; avatar_url?: string; } + interface Session { + expires: Date; + token: string; + lifetime: number; + browser: string; + platform: string; + userid: string; + } type Permission = string; interface Role { id: number; @@ -69,6 +76,7 @@ declare namespace FG { } interface Service { userid: string; + is_backup: boolean; value: number; } interface Drink { @@ -77,8 +85,8 @@ declare namespace FG { package_size?: number; name: string; volume?: number; - cost_price_pro_volume?: number; - cost_price_package_netto?: number; + cost_per_volume?: number; + cost_per_package?: number; tags?: Array; type?: DrinkType; volumes: Array; @@ -88,7 +96,7 @@ declare namespace FG { interface DrinkIngredient { id: number; volume: number; - drink_ingredient_id: number; + ingredient_id: number; } interface DrinkPrice { id: number; diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 0cdd70a..6d0e074 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -21,6 +21,25 @@ + {{ notifications.length }} + + + + + + Keine neuen Benachrichtigungen + + import EssentialLink from 'src/components/navigation/EssentialLink.vue'; import ShortcutLink from 'src/components/navigation/ShortcutLink.vue'; +import Notification from 'src/components/Notification.vue'; import { Screen } from 'quasar'; -import { defineComponent, ref, inject, computed } from 'vue'; +import { defineComponent, ref, inject, computed, onBeforeMount } from 'vue'; import { useMainStore } from 'src/store'; import { FG_Plugin } from 'src/plugins'; import { useRouter } from 'vue-router'; @@ -100,7 +120,7 @@ const essentials: FG_Plugin.MenuLink[] = [ export default defineComponent({ name: 'MainLayout', - components: { EssentialLink, ShortcutLink }, + components: { EssentialLink, ShortcutLink, Notification }, setup() { const router = useRouter(); const mainStore = useMainStore(); @@ -108,6 +128,16 @@ export default defineComponent({ const leftDrawer = ref(false); const shortcuts = flaschengeist?.shortcuts; const mainLinks = flaschengeist?.menuLinks; + const notifications = computed(() => mainStore.notifications.slice().reverse()); + const noPermission = ref(window.Notification.permission !== 'granted'); + + function requestPermission() { + void window.Notification.requestPermission().then( + (p) => (noPermission.value = p !== 'granted') + ); + } + + onBeforeMount(() => window.setInterval(() => void mainStore.loadNotifications(), 30000)); const leftDrawerOpen = computed({ get: () => (leftDrawer.value || Screen.gt.sm ? true : false), @@ -131,6 +161,10 @@ export default defineComponent({ void mainStore.logout(); } + async function remove(id: number) { + await mainStore.removeNotification(id); + } + return { essentials, leftDrawerOpen, @@ -138,6 +172,10 @@ export default defineComponent({ leftDrawerClicker, logout, mainLinks, + notifications, + noPermission, + remove, + requestPermission, shortcuts, subLinks, }; diff --git a/src/plugins/pricelist/components/CalculationTable/Ingredients.vue b/src/plugins/pricelist/components/CalculationTable/Ingredients.vue index 99486e7..ccfc27c 100644 --- a/src/plugins/pricelist/components/CalculationTable/Ingredients.vue +++ b/src/plugins/pricelist/components/CalculationTable/Ingredients.vue @@ -181,7 +181,7 @@ export default defineComponent({ id: -1, drink_ingredient: { id: -1, - drink_ingredient_id: newIngredient.value.id, + ingredient_id: newIngredient.value.id, volume: newIngredientVolume.value, }, extra_ingredient: undefined, diff --git a/src/plugins/pricelist/components/CalculationTable/NewDrink.vue b/src/plugins/pricelist/components/CalculationTable/NewDrink.vue index ef54f9b..a58c718 100644 --- a/src/plugins/pricelist/components/CalculationTable/NewDrink.vue +++ b/src/plugins/pricelist/components/CalculationTable/NewDrink.vue @@ -41,14 +41,14 @@ type="number" /> - !!newDrink.value.cost_price_package_netto && + !!newDrink.value.cost_per_package && !!newDrink.value.volume && !!newDrink.value.package_size ); - const cost_price_pro_volume = computed({ + const cost_per_volume = computed({ get: () => { if (calc_price_pro_volume.value) { const retVal = - ((newDrink.value.cost_price_package_netto || 0) / + ((newDrink.value.cost_per_package || 0) / ((newDrink.value.volume || 0) * (newDrink.value.package_size || 0))) * 1.19; // eslint-disable-next-line vue/no-side-effects-in-computed-properties - newDrink.value.cost_price_pro_volume = Math.round(retVal * 1000) / 1000; + newDrink.value.cost_per_volume = Math.round(retVal * 1000) / 1000; } - return newDrink.value.cost_price_pro_volume; + return newDrink.value.cost_per_volume; }, set: (val) => { - newDrink.value.cost_price_pro_volume = val; + newDrink.value.cost_per_volume = val; }, }); @@ -124,7 +124,7 @@ export default defineComponent({ drinkTypes: computed(() => store.drinkTypes), newDrink, calc_price_pro_volume, - cost_price_pro_volume, + cost_per_volume, addDrink, cancelAddDrink, notEmpty, diff --git a/src/plugins/pricelist/pages/CocktailBuilder.vue b/src/plugins/pricelist/pages/CocktailBuilder.vue index 793c940..5c37226 100644 --- a/src/plugins/pricelist/pages/CocktailBuilder.vue +++ b/src/plugins/pricelist/pages/CocktailBuilder.vue @@ -45,7 +45,7 @@ export default defineComponent({ volume.value.ingredients.forEach((ingredient) => { if (ingredient.drink_ingredient) { const _drink = store.drinks.find( - (a) => a.id === ingredient.drink_ingredient?.drink_ingredient_id + (a) => a.id === ingredient.drink_ingredient?.ingredient_id ); retVal += ingredient.drink_ingredient.volume * diff --git a/src/plugins/pricelist/pages/Pricelist.vue b/src/plugins/pricelist/pages/Pricelist.vue new file mode 100644 index 0000000..1a6c827 --- /dev/null +++ b/src/plugins/pricelist/pages/Pricelist.vue @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/plugins/pricelist/pages/PricelistP.vue b/src/plugins/pricelist/pages/PricelistP.vue deleted file mode 100644 index 19248fa..0000000 --- a/src/plugins/pricelist/pages/PricelistP.vue +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - diff --git a/src/plugins/pricelist/routes/index.ts b/src/plugins/pricelist/routes/index.ts index fcfc86e..ab429fa 100644 --- a/src/plugins/pricelist/routes/index.ts +++ b/src/plugins/pricelist/routes/index.ts @@ -19,7 +19,7 @@ export const innerRoutes: FG_Plugin.MenuRoute[] = [ route: { path: 'pricelist', name: 'drinks-pricelist', - component: () => import('../pages/PricelistP.vue'), + component: () => import('../pages/Pricelist.vue'), }, }, { diff --git a/src/plugins/pricelist/store.ts b/src/plugins/pricelist/store.ts index 4200cc6..ba16fc7 100644 --- a/src/plugins/pricelist/store.ts +++ b/src/plugins/pricelist/store.ts @@ -53,8 +53,8 @@ class Drink { package_size, name, volume, - cost_price_pro_volume, - cost_price_package_netto, + cost_per_volume, + cost_per_package, tags, type, uuid, @@ -65,15 +65,13 @@ class Drink { this.package_size = package_size; this.name = name; this.volume = volume; - this.cost_price_package_netto = cost_price_package_netto; - this._cost_price_pro_volume = cost_price_pro_volume; + this.cost_per_package = cost_per_package; + this.cost_per_volume = cost_per_volume; this.cost_price_pro_volume = computed({ get: () => { - if (!!this.volume && !!this.package_size && !!this.cost_price_package_netto) { + if (!!this.volume && !!this.package_size && !!this.cost_per_package) { const retVal = - ((this.cost_price_package_netto || 0) / - ((this.volume || 0) * (this.package_size || 0))) * - 1.19; + ((this.cost_per_package || 0) / ((this.volume || 0) * (this.package_size || 0))) * 1.19; this._cost_price_pro_volume = Math.round(retVal * 1000) / 1000; } @@ -289,7 +287,7 @@ export const usePricelistStore = defineStore({ volume.ingredients.forEach((ingredient) => { if (ingredient.drink_ingredient) { const _drink = usePricelistStore().drinks.find( - (a) => a.id === ingredient.drink_ingredient?.drink_ingredient_id + (a) => a.id === ingredient.drink_ingredient?.ingredient_id ); retVal += ingredient.drink_ingredient.volume * diff --git a/src/plugins/schedule/components/management/EventTypes.vue b/src/plugins/schedule/components/management/EventTypes.vue index d258ff1..a9dbf80 100644 --- a/src/plugins/schedule/components/management/EventTypes.vue +++ b/src/plugins/schedule/components/management/EventTypes.vue @@ -15,32 +15,30 @@ - - - - - - + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -59,7 +57,7 @@ export default defineComponent({ const actualEvent = ref(emptyEvent); const newEventName = ref(''); - onBeforeMount(() => store.getEventTypes()); + onBeforeMount(async () => await store.getEventTypes()); const rows = computed(() => store.eventTypes); diff --git a/src/plugins/schedule/components/management/JobTypes.vue b/src/plugins/schedule/components/management/JobTypes.vue index 7273673..c3fc3f8 100644 --- a/src/plugins/schedule/components/management/JobTypes.vue +++ b/src/plugins/schedule/components/management/JobTypes.vue @@ -15,32 +15,30 @@ - - - - - - + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/src/plugins/schedule/components/overview/slots/JobSlot.vue b/src/plugins/schedule/components/overview/slots/JobSlot.vue index a188487..71948e7 100644 --- a/src/plugins/schedule/components/overview/slots/JobSlot.vue +++ b/src/plugins/schedule/components/overview/slots/JobSlot.vue @@ -84,6 +84,7 @@ export default defineComponent({ async function enrollForJob() { const newService: FG.Service = { userid: mainStore.currentUser.userid, + is_backup: false, value: 1, }; try { @@ -104,6 +105,7 @@ export default defineComponent({ async function signOutFromJob() { const newService: FG.Service = { userid: mainStore.currentUser.userid, + is_backup: false, value: -1, }; try { diff --git a/src/plugins/schedule/permissions.ts b/src/plugins/schedule/permissions.ts index 40a5b92..c1bc584 100644 --- a/src/plugins/schedule/permissions.ts +++ b/src/plugins/schedule/permissions.ts @@ -1,16 +1,16 @@ export const PERMISSIONS = { // Can create events - CREATE: 'schedule_create', + CREATE: 'events_create', // Can edit events - EDIT: 'schedule_edit', + EDIT: 'events_edit', // Can delete events - DELETE: 'schedule_delete', + DELETE: 'events_delete', // Can create and edit EventTypes - EVENT_TYPE: 'schedule_event_type', + EVENT_TYPE: 'events_event_type', // Can create and edit JobTypes - JOB_TYPE: 'schedule_job_type', + JOB_TYPE: 'events_job_type', // Can self assign to jobs - ASSIGN: 'schedule_assign', + ASSIGN: 'events_assign', // Can assign other users to jobs - ASSIGN_OTHER: 'schedule_assign_other', + ASSIGN_OTHER: 'events_assign_other', }; diff --git a/src/plugins/user/plugin.ts b/src/plugins/user/plugin.ts index e447d87..7836ba4 100644 --- a/src/plugins/user/plugin.ts +++ b/src/plugins/user/plugin.ts @@ -6,7 +6,7 @@ const plugin: FG_Plugin.Plugin = { name: 'User', innerRoutes: routes, requiredModules: [], - requiredBackendModules: ['auth'], + requiredBackendModules: ['auth', 'users', 'roles'], version: '0.0.1', widgets: [ { diff --git a/src/store/index.ts b/src/store/index.ts index 21d53f5..211e24e 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -41,6 +41,7 @@ export const useMainStore = defineStore({ state: () => ({ session: loadCurrentSession(), user: loadUser(), + notifications: [] as Array, }), getters: { @@ -123,5 +124,33 @@ export const useMainStore = defineStore({ response && 'status' in response ? (response).status : false ); }, + + async loadNotifications() { + const params = + this.notifications.length > 0 + ? { from: this.notifications[this.notifications.length - 1].time } + : {}; + const { data } = await api.get('/notifications', { params: params }); + data.forEach((n) => { + n.time = new Date(n.time); + if (window.Notification.permission === 'granted') + new window.Notification(n.text, { + timestamp: n.time.getTime(), + }); + }); + this.notifications.push(...data); + }, + + async removeNotification(id: number) { + const idx = this.notifications.findIndex((n) => n.id === id); + if (idx >= 0) + try { + this.notifications.splice(idx, 1); + await api.delete(`/notifications/${id}`); + } catch (error) { + if (this.notifications.length > idx) + this.notifications.splice(idx, this.notifications.length - idx - 1); + } + }, }, }); diff --git a/yarn.lock b/yarn.lock index 417ba17..ce96c44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1027,10 +1027,10 @@ resolved "https://registry.yarnpkg.com/@positron/stack-trace/-/stack-trace-1.0.0.tgz#14fcc712a530038ef9be1ce6952315a839f466a8" integrity sha1-FPzHEqUwA475vhzmlSMVqDn0Zqg= -"@quasar/app@^3.0.0-beta.9": - version "3.0.0-beta.9" - resolved "https://registry.yarnpkg.com/@quasar/app/-/app-3.0.0-beta.9.tgz#8d5fb2056aaf5a03919b63c9c655933281e8beed" - integrity sha512-Wt12LLWTyp1GMw17xVVScvjom9EILIlnuV4xrgZ7WTfwwZ18jcqtf3pTs2NMeOgIwohlP2qLsI5JQW9wLylQzw== +"@quasar/app@^3.0.0-beta.10": + version "3.0.0-beta.10" + resolved "https://registry.yarnpkg.com/@quasar/app/-/app-3.0.0-beta.10.tgz#f4401fa64f9f94b7e643560fb8968f3f7250578d" + integrity sha512-KC5dmW7hOJ0x634vgyb98cjjia2Mj0BySgq1JghMGiCqq3noF6E9DS9UoF3ru9HUVRUtxfLe73Su8V0s1UoQZg== dependencies: "@quasar/babel-preset-app" "2.0.1" "@quasar/fastclick" "1.1.4" @@ -1041,7 +1041,7 @@ "@types/terser-webpack-plugin" "3.0.0" "@types/webpack" "4.41.26" "@types/webpack-bundle-analyzer" "3.9.1" - "@types/webpack-dev-server" "3.11.1" + "@types/webpack-dev-server" "3.11.2" "@vue/compiler-sfc" "3.0.6" "@vue/server-renderer" "3.0.6" archiver "5.2.0" @@ -1135,10 +1135,10 @@ core-js "^3.6.5" core-js-compat "^3.6.5" -"@quasar/extras@^1.9.19": - version "1.9.19" - resolved "https://registry.yarnpkg.com/@quasar/extras/-/extras-1.9.19.tgz#8e511117ccd8ec5bbed7038b9dad1749052376b8" - integrity sha512-A1IO0dzfUtRkyKq3QC7ZQNvhLeJey2ET8MvRX7oV0Qe+g30jy/4pr1ZhO7GylkDAoLT3C9eY8t2/5Anrl0AHdA== +"@quasar/extras@^1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@quasar/extras/-/extras-1.10.0.tgz#1cf13d299e80e1396b2f982e1663b89dd54f3e8e" + integrity sha512-H71Y/6pxunwiEN+oo9OBGM96ncM2QreVdnb2t2iStVHduju3nnypw9euBCshhYxKE/ORHZoOBRDoiddUOyaUdA== "@quasar/fastclick@1.1.4": version "1.1.4" @@ -1148,7 +1148,7 @@ "@quasar/quasar-app-extension-qcalendar@file:deps/quasar-ui-qcalendar/app-extension": version "4.0.0-alpha.1" dependencies: - "@quasar/quasar-ui-qcalendar" "link:../../../../../.cache/yarn/v6/npm-@quasar-quasar-app-extension-qcalendar-4.0.0-alpha.1-0eac22e6-3d93-4296-9ecf-77ea02e6ad1a-1616339967660/node_modules/@quasar/ui" + "@quasar/quasar-ui-qcalendar" "link:../../../../../.cache/yarn/v6/npm-@quasar-quasar-app-extension-qcalendar-4.0.0-alpha.1-3c86cc72-2d95-4dfe-9e1e-2f553d66f91e-1616893646708/node_modules/@quasar/ui" "@quasar/quasar-ui-qcalendar@link:deps/quasar-ui-qcalendar/ui": version "0.0.0" @@ -1266,13 +1266,6 @@ resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz#3c9ee980f1a10d6021ae6632ca3e79ca2ec4fb50" integrity sha512-giAlZwstKbmvMk1OO7WXSj4OZ0keXAcl2TQq4LWHiiPH2ByaH7WeUzng+Qej8UPxxv+8lRTuouo0iaNDBuzIBA== -"@types/http-proxy-middleware@*": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/http-proxy-middleware/-/http-proxy-middleware-1.0.0.tgz#4370a52766782e9c4f0be2ef79c3dd47aef5f428" - integrity sha512-/s8lFX6rT43hSPqjjD8KNuu0SkPKY7uIdR6u9DCxVqCRhAvfKxGbVOixJsAT2mdpSnCyrGFAGoB39KFh6tmRxw== - dependencies: - http-proxy-middleware "*" - "@types/http-proxy@^1.17.4": version "1.17.5" resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.5.tgz#c203c5e6e9dc6820d27a40eb1e511c70a220423d" @@ -1365,16 +1358,16 @@ dependencies: "@types/webpack" "*" -"@types/webpack-dev-server@3.11.1": - version "3.11.1" - resolved "https://registry.yarnpkg.com/@types/webpack-dev-server/-/webpack-dev-server-3.11.1.tgz#f8f4dac1da226d530bd15a1d5dc34b23ba766ccb" - integrity sha512-rIb+LtUkKnh7+oIJm3WiMJONd71Q0lZuqGLcSqhZ5qjN9gV/CNmZe7Bai+brnBPZ/KVYOsr+4bFLiNZwjBicLw== +"@types/webpack-dev-server@3.11.2": + version "3.11.2" + resolved "https://registry.yarnpkg.com/@types/webpack-dev-server/-/webpack-dev-server-3.11.2.tgz#73915a7d9e0a9b5e010a2388a46f68ab3f770ef8" + integrity sha512-13w1VhaghN+G1rYjkBPgN/GFRoHd9uI2fwK9cSKvLutdmZ22L9iicFEvt69by40DP2I6uNcClaGTyPY6nYhIgQ== dependencies: "@types/connect-history-api-fallback" "*" "@types/express" "*" - "@types/http-proxy-middleware" "*" "@types/serve-static" "*" "@types/webpack" "*" + http-proxy-middleware "^1.0.0" "@types/webpack-env@^1.16.0": version "1.16.0" @@ -5235,17 +5228,6 @@ http-proxy-agent@^4.0.1: agent-base "6" debug "4" -http-proxy-middleware@*: - version "1.0.6" - resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-1.0.6.tgz#0618557722f450375d3796d701a8ac5407b3b94e" - integrity sha512-NyL6ZB6cVni7pl+/IT2W0ni5ME00xR0sN27AQZZrpKn1b+qRh+mLbBxIq9Cq1oGfmTc7BUq4HB77mxwCaxAYNg== - dependencies: - "@types/http-proxy" "^1.17.4" - http-proxy "^1.18.1" - is-glob "^4.0.1" - lodash "^4.17.20" - micromatch "^4.0.2" - http-proxy-middleware@0.19.1: version "0.19.1" resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz#183c7dc4aa1479150306498c210cdaf96080a43a" @@ -5256,6 +5238,17 @@ http-proxy-middleware@0.19.1: lodash "^4.17.11" micromatch "^3.1.10" +http-proxy-middleware@^1.0.0: + version "1.0.6" + resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-1.0.6.tgz#0618557722f450375d3796d701a8ac5407b3b94e" + integrity sha512-NyL6ZB6cVni7pl+/IT2W0ni5ME00xR0sN27AQZZrpKn1b+qRh+mLbBxIq9Cq1oGfmTc7BUq4HB77mxwCaxAYNg== + dependencies: + "@types/http-proxy" "^1.17.4" + http-proxy "^1.18.1" + is-glob "^4.0.1" + lodash "^4.17.20" + micromatch "^4.0.2" + http-proxy@^1.17.0, http-proxy@^1.18.1: version "1.18.1" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" @@ -8236,10 +8229,10 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -quasar@^2.0.0-beta.9: - version "2.0.0-beta.9" - resolved "https://registry.yarnpkg.com/quasar/-/quasar-2.0.0-beta.9.tgz#0247a3512f3bdffd29f8f2a3f33fc91e62a91697" - integrity sha512-xqYKBQMF5ntM9RUr/eHFsSM6onXTzpwTcoBnM0YL6/QknBlSBHXltjG7pJmKMSm62ZRq1YeOdLsC9nchHgSrCQ== +quasar@^2.0.0-beta.11: + version "2.0.0-beta.11" + resolved "https://registry.yarnpkg.com/quasar/-/quasar-2.0.0-beta.11.tgz#78f21abe94caa78fe17ad17ce945d09dfda9e5d2" + integrity sha512-YG+iVkd1LNbo0MFSrPl1npEW02FfVeD4+/98nYPz3pfZEdOy1kiOF7N9Ij7RDC8x0/+9Ans9mgBvs0xjg9YxyA== query-string@^4.1.0: version "4.3.4"