release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
3 changed files with 54 additions and 16 deletions
Showing only changes of commit fb8fc09e8d - Show all commits

View File

@ -601,6 +601,9 @@ import { defineComponent, onBeforeMount, ref, computed, ComputedRef } from '@vue
import store, { DrinkPriceVolume, Drink } from '../store/altStore';
import PriceTable from 'src/plugins/pricelist/components/CalculationTable/PriceTable.vue';
import Ingredients from 'src/plugins/pricelist/components/CalculationTable/Ingredients.vue';
import { StateInterface } from 'src/store';
import { Store } from 'vuex';
import { UserStateInterface } from 'src/plugins/user/store/user';
function sort(a: string | number, b: string | number) {
if (a > b) return 1;
if (b > a) return -1;
@ -609,7 +612,12 @@ function sort(a: string | number, b: string | number) {
export default defineComponent({
name: 'CalculationTable',
components: { PriceTable, Ingredients },
setup() {
setup(_, { root }) {
onBeforeMount(() => {
store.actions.getPriceCalcColumn(user);
});
const userstore = <Store<StateInterface>>root.$store;
const user = <string>userstore.state.user.currentUser?.userid;
const columns = [
{
name: 'name',
@ -705,21 +713,12 @@ export default defineComponent({
field: 'public',
},
];
const visibleColumn = ref([
'name',
'drink_type',
'volume_package',
'cost_price_package_netto',
'package_size',
'cost_price_pro_volume',
'volumes',
'volume',
'min_prices',
'prices',
'price',
'description',
'public',
]);
const visibleColumn = computed({
get: () => store.state.pricecalc_columns,
set: (val) => {
store.actions.updatePriceCalcColumn(user, val);
},
});
const emptyVolume: DrinkPriceVolume = {
id: -1,
_volume: 0,

View File

@ -7,11 +7,27 @@ const state = reactive<{
tags: FG.Tag[];
drinkTypes: FG.DrinkType[];
extraIngredients: FG.ExtraIngredient[];
pricecalc_columns: Array<string>;
}>({
drinks: [],
tags: [],
drinkTypes: [],
extraIngredients: [],
pricecalc_columns: [
'name',
'drink_type',
'volume_package',
'cost_price_package_netto',
'package_size',
'cost_price_pro_volume',
'volumes',
'volume',
'min_prices',
'prices',
'price',
'description',
'public',
],
});
interface MinPrice extends Omit<FG.MinPrices, 'price'> {
@ -307,6 +323,24 @@ const actions = {
})
.catch((err) => console.warn(err));
},
getPriceCalcColumn(userid: string) {
axios
.get(`pricelist/users/${userid}/pricecalc_columns`)
.then(({ data }: AxiosResponse<Array<string>>) => {
if (data.length > 0) {
state.pricecalc_columns = data;
}
})
.catch((err) => console.log(err));
},
updatePriceCalcColumn(userid: string, data: Array<string>) {
axios
.put(`pricelist/users/${userid}/pricecalc_columns`, data)
.then(() => {
state.pricecalc_columns = data;
})
.catch((err) => console.log(err));
},
};
const getters = {};

View File

@ -7989,6 +7989,11 @@ prettier@^1.18.2:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
pretty-error@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.2.tgz#be89f82d81b1c86ec8fdfbc385045882727f93b6"