From 73f16d6cbb8d6c51d31f6eee55335bc5526d01a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 18 Mar 2021 17:23:57 +0100 Subject: [PATCH] [prettier] format with prettier, fixed some pricelist issues --- src/App.vue | 2 +- src/boot/axios.ts | 10 +- src/boot/loading.ts | 2 +- src/boot/login.ts | 2 +- src/boot/notify.ts | 2 +- src/boot/plugins.ts | 40 +++---- src/components/about/Developer.vue | 16 +-- src/components/loading/CircularProgress.vue | 2 +- .../loading/DarkCircularProgress.vue | 2 +- src/components/navigation/EmptyParent.vue | 2 +- src/components/navigation/EssentialLink.vue | 14 +-- src/components/navigation/ShortCutLink.vue | 10 +- src/components/utils/IsoDateInput.vue | 20 ++-- src/css/quasar.variables.scss | 16 +-- src/flaschengeist.d.ts | 19 ++-- src/index.template.html | 16 +-- src/layouts/MainLayout.vue | 18 +-- src/layouts/OutLayout.vue | 6 +- src/pages/Dashboard.vue | 8 +- src/pages/Login.vue | 18 +-- src/pages/Offline.vue | 8 +- src/pages/PluginError.vue | 8 +- src/pages/Reset.vue | 12 +- src/pages/about/About.vue | 24 ++-- src/plugins/balance/components/BalanceAdd.vue | 16 ++- .../balance/components/BalanceHeader.vue | 2 +- .../balance/components/BalanceTransfer.vue | 14 ++- .../balance/components/Transaction.vue | 67 ++++++----- src/plugins/balance/components/Widget.vue | 4 +- src/plugins/balance/pages/Admin.vue | 12 +- src/plugins/balance/pages/MainPage.vue | 67 ++++++----- src/plugins/balance/pages/Overview.vue | 24 ++-- src/plugins/balance/permissions.ts | 2 +- src/plugins/balance/plugin.ts | 6 +- src/plugins/balance/routes/index.ts | 12 +- .../pricelist/components/CalculationTable.vue | 72 ++++++------ .../CalculationTable/Ingredients.vue | 44 +++++--- .../CalculationTable/PriceTable.vue | 18 +-- .../pricelist/components/DrinkTypes.vue | 14 +-- .../pricelist/components/ExtraIngredients.vue | 16 +-- .../pricelist/components/Pricelist.vue | 105 +++++++++--------- src/plugins/pricelist/pages/MainPage.vue | 2 +- src/plugins/pricelist/pages/Pricelist.vue | 12 +- src/plugins/pricelist/pages/Settings.vue | 8 +- src/plugins/pricelist/store/altStore.ts | 8 +- src/plugins/schedule/components/Widget.vue | 4 +- .../components/management/CreateEvent.vue | 10 +- .../components/management/Eventtypes.vue | 12 +- .../schedule/components/management/Job.vue | 16 +-- .../components/management/JobTypes.vue | 10 +- .../components/overview/AgendaView.vue | 28 ++--- .../components/overview/slots/EventSlot.vue | 38 +++---- src/plugins/schedule/pages/MainPage.vue | 2 +- src/plugins/schedule/pages/Management.vue | 10 +- src/plugins/schedule/pages/Overview.vue | 10 +- src/plugins/schedule/permissions.ts | 2 +- src/plugins/schedule/plugin.ts | 6 +- src/plugins/schedule/routes/index.ts | 12 +- src/plugins/schedule/store/schedule.ts | 44 ++++---- src/plugins/user/components/NewUser.vue | 10 +- src/plugins/user/components/UpdateUser.vue | 10 +- src/plugins/user/components/UserSelector.vue | 6 +- src/plugins/user/components/Widget.vue | 10 +- .../components/settings/MainUserSettings.vue | 24 ++-- .../user/components/settings/RoleSettings.vue | 22 ++-- .../user/components/settings/Sessions.vue | 16 +-- src/plugins/user/pages/AdminSettings.vue | 10 +- src/plugins/user/pages/MainPage.vue | 2 +- src/plugins/user/pages/Settings.vue | 8 +- src/plugins/user/permissions.ts | 2 +- src/plugins/user/plugin.ts | 8 +- src/plugins/user/routes/index.ts | 10 +- src/plugins/user/store/user.ts | 36 +++--- src/router/index.ts | 4 +- src/router/routes.ts | 26 ++--- src/store/index.ts | 4 +- src/utils/datetime.ts | 2 +- src/utils/loading.ts | 2 +- src/utils/permission.ts | 4 +- 79 files changed, 609 insertions(+), 613 deletions(-) diff --git a/src/App.vue b/src/App.vue index ae9bb31..0b7a348 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,6 @@ import { defineComponent } from '@vue/composition-api'; export default defineComponent({ - name: 'App' + name: 'App', }); diff --git a/src/boot/axios.ts b/src/boot/axios.ts index 940b45a..6ffca27 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -19,7 +19,7 @@ export const setBaseUrl = (url: string) => { message: 'Serveraddresse gespeichert', position: 'bottom', caption: `${url}`, - color: 'positive' + color: 'positive', }); setTimeout(() => { window.location.reload(); @@ -38,7 +38,7 @@ export default boot>(({ Vue, store, router }) => { /*** * Intercept requests and insert Token if available */ - axios.interceptors.request.use(config => { + axios.interceptors.request.use((config) => { const session = store.state.session.currentSession; if (session?.token) { config.headers = { Authorization: 'Bearer ' + session.token }; @@ -52,8 +52,8 @@ export default boot>(({ Vue, store, router }) => { * - filter timeout or 502-504 --> backendOffline */ axios.interceptors.response.use( - response => response, - error => { + (response) => response, + (error) => { if (error) { const e = error; if ( @@ -62,7 +62,7 @@ export default boot>(({ Vue, store, router }) => { ) { return router.push({ name: 'offline', - query: { redirect: router.currentRoute.fullPath } + query: { redirect: router.currentRoute.fullPath }, }); } else if (e.response && e.response.status == 401) { if (router.currentRoute.name !== 'login') return store.dispatch('session/clearCurrent'); diff --git a/src/boot/loading.ts b/src/boot/loading.ts index c56b27c..53f6d46 100644 --- a/src/boot/loading.ts +++ b/src/boot/loading.ts @@ -8,6 +8,6 @@ export default boot((/* { app, router, Vue ... } */) => { Loading.setDefaults({ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - spinner: DarkCircularProgress + spinner: DarkCircularProgress, }); }); diff --git a/src/boot/login.ts b/src/boot/login.ts index f9c8d61..cc33679 100644 --- a/src/boot/login.ts +++ b/src/boot/login.ts @@ -15,7 +15,7 @@ export default boot>(({ router, store }) => { // Secured area (LOGIN REQUIRED) // Check login is ok if (!session || session.expires <= new Date()) { - store.dispatch('session/logout').catch(error => { + store.dispatch('session/logout').catch((error) => { console.warn(error); }); return; diff --git a/src/boot/notify.ts b/src/boot/notify.ts index 513290d..8dfc333 100644 --- a/src/boot/notify.ts +++ b/src/boot/notify.ts @@ -9,6 +9,6 @@ export default boot((/* { app, router, Vue ... } */) => { icon: 'mdi-alert-circle', progress: true, position: 'bottom', - actions: [{ icon: 'mdi-close', color: 'white' }] + actions: [{ icon: 'mdi-close', color: 'white' }], }); }); diff --git a/src/boot/plugins.ts b/src/boot/plugins.ts index 7807578..c2c3336 100644 --- a/src/boot/plugins.ts +++ b/src/boot/plugins.ts @@ -12,7 +12,7 @@ const config = { // Do not change required Modules !! requiredModules: ['User'], // here you can import plugins. - loadModules: ['Balance', 'Schedule', 'Pricelist'] + loadModules: ['Balance', 'Schedule', 'Pricelist'], }; // do not change anything here !! @@ -40,7 +40,7 @@ function combineRoutes( source: FG_Plugin.PluginRouteConfig[], mainPath: '/' | '/main' = '/' ): RouteConfig[] { - target.forEach(target => { + target.forEach((target) => { if (target.path === mainPath) { source.forEach((sourceMainConfig: FG_Plugin.PluginRouteConfig) => { const targetMainConfig = target.children?.find((targetMainConfig: RouteConfig) => { @@ -48,7 +48,7 @@ function combineRoutes( }); if (targetMainConfig) { const sourceChildren: RouteConfig[] = []; - sourceMainConfig.children?.forEach(child => { + sourceMainConfig.children?.forEach((child) => { sourceChildren.push(child); }); if (targetMainConfig.children) { @@ -92,7 +92,7 @@ function combineMainLinks( icon: sourcePluginChildLink.icon, link: sourcePluginChildLink.name, name: sourcePluginChildLink.name, - permissions: sourcePluginChildLink.meta?.permissions + permissions: sourcePluginChildLink.meta?.permissions, }); }); } else { @@ -101,9 +101,9 @@ function combineMainLinks( icon: source.icon, link: source.name, name: source.name, - permissions: source.meta?.permissions + permissions: source.meta?.permissions, }; - source.children?.forEach(child => { + source.children?.forEach((child) => { if (mainLink.children === undefined) { mainLink.children = []; } @@ -112,7 +112,7 @@ function combineMainLinks( icon: child.icon, link: child.name, name: child.name, - permissions: child.meta?.permissions + permissions: child.meta?.permissions, }); }); target.push(mainLink); @@ -124,12 +124,12 @@ function loadShortCuts( target: FG_Plugin.ShortCutLink[], source: FG_Plugin.PluginRouteConfig[] ): FG_Plugin.ShortCutLink[] { - source.forEach(route => { + source.forEach((route) => { if (route.shortcut) { target.push({ link: route.name, icon: route.icon, - permissions: route.meta?.permissions + permissions: route.meta?.permissions, }); } if (route.children) { @@ -148,14 +148,14 @@ function loadPlugin( store: Store, router: VueRouter ): FG_Plugin.LoadedPlugins { - modules.forEach(requiredModule => { - const plugin = plugins.find(plugin => { + modules.forEach((requiredModule) => { + const plugin = plugins.find((plugin) => { return plugin.name == requiredModule; }); if (plugin) { if (plugin.mainRoutes) { loadedPlugins.routes = combineRoutes(loadedPlugins.routes, plugin.mainRoutes, '/main'); - plugin.mainRoutes.forEach(route => { + plugin.mainRoutes.forEach((route) => { loadedPlugins.mainLinks = combineMainLinks(loadedPlugins.mainLinks, route); }); loadedPlugins.shortcuts = loadShortCuts(loadedPlugins.shortcuts, plugin.mainRoutes); @@ -165,7 +165,7 @@ function loadPlugin( loadedPlugins.shortcutsOut = loadShortCuts(loadedPlugins.shortcutsOut, plugin.outRoutes); } if (plugin.widgets.length > 0) { - plugin.widgets.forEach(widget => (widget.name = plugin.name + '_' + widget.name)); + plugin.widgets.forEach((widget) => (widget.name = plugin.name + '_' + widget.name)); Array.prototype.push.apply(loadedPlugins.widgets, plugin.widgets); } if (plugin.store) { @@ -175,11 +175,11 @@ function loadPlugin( } loadedPlugins.plugins.push({ name: plugin.name, - version: plugin.version + version: plugin.version, }); } else { console.exception(`Could not find required Plugin ${requiredModule}`); - router.push({ name: 'error' }).catch(e => { + router.push({ name: 'error' }).catch((e) => { console.warn(e); }); } @@ -213,7 +213,7 @@ export default boot>(({ Vue, router, store }) => { mainLinks: [], shortcuts: [], shortcutsOut: [], - widgets: [] + widgets: [], }; // get all plugins @@ -225,7 +225,7 @@ export default boot>(({ Vue, router, store }) => { // check dependencies backendPromise - .then(backend => { + .then((backend) => { console.log(backend); if (backend) { plugins.forEach((plugin: FG_Plugin.Plugin) => { @@ -237,7 +237,7 @@ export default boot>(({ Vue, router, store }) => { ) ) { console.error(`Plugin ${plugin.name} need Plugin ${requiredModule}`); - router.push({ name: 'error' }).catch(e => { + router.push({ name: 'error' }).catch((e) => { console.warn(e); }); } @@ -247,7 +247,7 @@ export default boot>(({ Vue, router, store }) => { console.error( `Plugin ${plugin.name} need Plugin ${requiredBackendModule} in backend.` ); - router.push({ name: 'error' }).catch(err => { + router.push({ name: 'error' }).catch((err) => { console.warn(err); }); } @@ -255,7 +255,7 @@ export default boot>(({ Vue, router, store }) => { }); } }) - .catch(e => { + .catch((e) => { console.error(e); }); diff --git a/src/components/about/Developer.vue b/src/components/about/Developer.vue index 70cd302..96f67a0 100644 --- a/src/components/about/Developer.vue +++ b/src/components/about/Developer.vue @@ -27,26 +27,26 @@ export default defineComponent({ name: 'Developer', props: { pic: { - default: 'logo-dark.svg' + default: 'logo-dark.svg', }, firstname: { //required: true, - default: 'firstname' + default: 'firstname', }, lastname: { //required: true, - default: 'lastname' + default: 'lastname', }, job: { - default: 'student' + default: 'student', }, club: { - default: 'Studentenclub Wu5 e.V.' + default: 'Studentenclub Wu5 e.V.', }, description: { default: - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ' - } - } + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ', + }, + }, }); diff --git a/src/components/loading/CircularProgress.vue b/src/components/loading/CircularProgress.vue index 3f3f113..33b5815 100644 --- a/src/components/loading/CircularProgress.vue +++ b/src/components/loading/CircularProgress.vue @@ -18,6 +18,6 @@ diff --git a/src/components/loading/DarkCircularProgress.vue b/src/components/loading/DarkCircularProgress.vue index 6eec95d..8304601 100644 --- a/src/components/loading/DarkCircularProgress.vue +++ b/src/components/loading/DarkCircularProgress.vue @@ -18,6 +18,6 @@ diff --git a/src/components/navigation/EmptyParent.vue b/src/components/navigation/EmptyParent.vue index f9817a4..4dc75e8 100644 --- a/src/components/navigation/EmptyParent.vue +++ b/src/components/navigation/EmptyParent.vue @@ -9,6 +9,6 @@ export default defineComponent({ name: 'EmptyParent', setup() { return {}; - } + }, }); diff --git a/src/components/navigation/EssentialLink.vue b/src/components/navigation/EssentialLink.vue index bb03bf4..2065ea3 100644 --- a/src/components/navigation/EssentialLink.vue +++ b/src/components/navigation/EssentialLink.vue @@ -22,26 +22,26 @@ export default defineComponent({ props: { title: { type: String, - required: true + required: true, }, caption: { type: String, - default: '' + default: '', }, link: { type: String, - default: 'home' + default: 'home', }, icon: { type: String, - default: '' + default: '', }, permissions: { - default: undefined - } + default: undefined, + }, }, setup(props, { root }) { @@ -59,6 +59,6 @@ export default defineComponent({ const isGranted = computed(() => hasPermissions(props.permissions || [], root.$store)); return { realTitle: title, isGranted }; - } + }, }); diff --git a/src/components/navigation/ShortCutLink.vue b/src/components/navigation/ShortCutLink.vue index 1a09398..69d6de1 100644 --- a/src/components/navigation/ShortCutLink.vue +++ b/src/components/navigation/ShortCutLink.vue @@ -11,19 +11,19 @@ export default defineComponent({ props: { link: { required: true, - type: String + type: String, }, icon: { required: true, - type: String + type: String, }, permissions: { - default: undefined - } + default: undefined, + }, }, setup(props, { root }) { const isGranted = computed(() => hasPermissions(props.permissions || [], root.$store)); return { isGranted }; - } + }, }); diff --git a/src/components/utils/IsoDateInput.vue b/src/components/utils/IsoDateInput.vue index fcf2cd2..cb9da1e 100644 --- a/src/components/utils/IsoDateInput.vue +++ b/src/components/utils/IsoDateInput.vue @@ -50,21 +50,23 @@ export default defineComponent({ name: 'IsoDateInput', props: { value: { - required: true + required: true, }, label: {}, readonly: { - default: false + default: false, }, type: { default: 'date', - validator: function(value: string) { + validator: function (value: string) { return ['date', 'time', 'datetime'].indexOf(value) !== -1; - } + }, }, rules: { - default: () => { return [] } - } + default: () => { + return []; + }, + }, }, setup(props: Props, { emit }: { emit: any }) { function getDateTime() { @@ -185,7 +187,7 @@ export default defineComponent({ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const customRules = [ props.type == 'date' ? isDate : props.type == 'time' ? isTime : isDateTime, - ...props.rules + ...props.rules, ]; return { @@ -196,8 +198,8 @@ export default defineComponent({ customRules, timeChanged, placeholder, - dateTimeChanged + dateTimeChanged, }; - } + }, }); diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index dd1fb01..dff10be 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -12,13 +12,13 @@ // to match your app's branding. // Tip: Use the "Theme Builder" on Quasar's documentation website. -$primary : #1976D2; -$secondary : #26A69A; -$accent : #9C27B0; +$primary: #1976d2; +$secondary: #26a69a; +$accent: #9c27b0; -$dark : #1D1D1D; +$dark: #1d1d1d; -$positive : #21BA45; -$negative : #C10015; -$info : #31CCEC; -$warning : #F2C037; +$positive: #21ba45; +$negative: #c10015; +$info: #31ccec; +$warning: #f2c037; diff --git a/src/flaschengeist.d.ts b/src/flaschengeist.d.ts index b930d82..92c5fc4 100644 --- a/src/flaschengeist.d.ts +++ b/src/flaschengeist.d.ts @@ -42,27 +42,27 @@ declare namespace FG { volume?: number; cost_price_pro_volume?: number; cost_price_package_netto?: number; - tags: Array; - type: DrinkType; + tags?: Array; + type?: DrinkType; volumes: Array; } interface DrinkIngredient { id: number; volume: number; drink_ingredient_id: number; - price: number; } interface DrinkPrice { id: number; price: number; - public: bool; + public: boolean; description?: string; } interface DrinkPriceVolume { id: number; volume: number; - ingredients: Array; + min_prices: Array; prices: Array; + ingredients: Array; } interface DrinkType { id: number; @@ -75,9 +75,12 @@ declare namespace FG { } interface Ingredient { id: number; - volume_id: number; - drink_ingredient: DrinkIngredient; - extra_ingredient: ExtraIngredient; + drink_ingredient?: DrinkIngredient; + extra_ingredient?: ExtraIngredient; + } + interface MinPrices { + percentage: number; + price: number; } interface Tag { id: number; diff --git a/src/index.template.html b/src/index.template.html index aa31bff..ed23541 100644 --- a/src/index.template.html +++ b/src/index.template.html @@ -12,20 +12,10 @@ content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>" /> - + - - + + diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index b74cc1a..64cdf33 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -112,23 +112,23 @@ const links = [ name: 'about', title: 'Über Flaschengeist', link: 'about', - icon: 'mdi-information' - } + icon: 'mdi-information', + }, ]; const shortcuts = [ { link: 'about', - icon: 'mdi-information' + icon: 'mdi-information', }, { link: 'user', - icon: 'mdi-account' + icon: 'mdi-account', }, { link: 'user-plugin1', - icon: 'mdi-account-plus' - } + icon: 'mdi-account-plus', + }, ]; declare module 'vue/types/vue' { @@ -146,7 +146,7 @@ export default defineComponent({ const leftDrawerOpen = ref( computed({ get: () => (leftDrawer.value || Screen.gt.sm ? true : false), - set: (val: boolean) => (leftDrawer.value = val) + set: (val: boolean) => (leftDrawer.value = val), }) ); const leftDrawerMini = ref(false); @@ -189,8 +189,8 @@ export default defineComponent({ links, pluginChildLinks, shortcuts, - logout + logout, }; - } + }, }); diff --git a/src/layouts/OutLayout.vue b/src/layouts/OutLayout.vue index 708733c..b14bbac 100644 --- a/src/layouts/OutLayout.vue +++ b/src/layouts/OutLayout.vue @@ -6,9 +6,7 @@ - - Flaschengeist - + Flaschengeist
diff --git a/src/pages/Dashboard.vue b/src/pages/Dashboard.vue index 4040ac7..cf1c61d 100644 --- a/src/pages/Dashboard.vue +++ b/src/pages/Dashboard.vue @@ -1,7 +1,7 @@