release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
4 changed files with 72 additions and 8 deletions
Showing only changes of commit 8eecb70df0 - Show all commits

View File

@ -30,6 +30,7 @@
hide-header
:hide-bottom="props.row.volumes.length < 5"
flat
:visible-columns="visibleColumn"
>
<template #body-cell-prices="props_volumes">
<q-td :props="props_volumes">
@ -39,6 +40,7 @@
hide-header
:hide-bottom="props_volumes.row.prices.length < 5"
flat
:visible-columns="visibleColumn"
>
<template #body-cell-public="props_prices">
<q-td :props="props_prices">
@ -74,7 +76,7 @@
</div>
</template>
<script lang="ts">
import { defineComponent, onBeforeMount, computed } from 'vue';
import { defineComponent, onBeforeMount, computed, ref } from 'vue';
import { usePricelistStore } from '../store';
import { useMainStore } from 'src/store';
@ -91,14 +93,27 @@ export default defineComponent({
return `${price.toFixed(2)}`;
},
},
setup() {
props: {
public: {
type: Boolean,
default: false,
},
},
setup(props) {
let user: string | null;
onBeforeMount(() => {
store.getPriceCalcColumn(user);
if (user) {
store.getPriceCalcColumn(user);
}
});
const store = usePricelistStore();
onBeforeMount(() => {
void store.getDrinks();
try {
user = mainStore.currentUser.userid;
} catch {
user = null;
}
});
const drinks = computed(() => store.drinks);
const columns_drinks = [
@ -151,14 +166,36 @@ export default defineComponent({
field: 'public',
},
];
const canBeVisible = createVisibleColumns();
const _visibleColumns = ref(canBeVisible);
const visibleColumn = computed({
get: () => store.pricecalc_columns,
get: () => {
if (user) {
return store.pricecalc_columns;
} else {
return _visibleColumns.value;
}
},
set: (val) => {
store.updatePriceCalcColumn(user, val);
if (user) {
store.updatePriceCalcColumn(user, val);
} else {
_visibleColumns.value = val;
}
},
});
const mainStore = useMainStore();
const user = mainStore.currentUser.userid;
function createVisibleColumns() {
const retVal: Array<string> = [];
columns_drinks.forEach((drink) => retVal.push(drink.name));
columns_volumes.forEach((volume) => retVal.push(volume.name));
columns_prices.forEach((price) => {
if (user || price.name !== 'public') retVal.push(price.name);
});
return retVal;
}
return { columns_drinks, columns_volumes, columns_prices, drinks, visibleColumn };
},
});

View File

@ -0,0 +1,13 @@
<template>
<pricelist public />
</template>
<script>
import Pricelist from '../components/Pricelist.vue';
export default {
name: 'OuterPricelist',
components: { Pricelist },
};
</script>
<style scoped></style>

View File

@ -1,9 +1,10 @@
import { innerRoutes } from './routes';
import { innerRoutes, outerRoutes } from './routes';
import { FG_Plugin } from 'src/plugins';
const plugin: FG_Plugin.Plugin = {
name: 'Pricelist',
innerRoutes,
outerRoutes,
requiredModules: [],
requiredBackendModules: ['pricelist'],
version: '0.0.1',

View File

@ -36,3 +36,16 @@ export const innerRoutes: FG_Plugin.MenuRoute[] = [
],
},
];
export const outerRoutes: FG_Plugin.MenuRoute[] = [
{
title: 'Preisliste',
icon: 'mdi-glass-mug-variant',
shortcut: true,
route: {
path: 'pricelist',
name: 'outter-pricelist',
component: () => import('../pages/OuterPricelist.vue')
}
}
]