From 7289a1724d8283fcaca28e5a2605589f2bbf2b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Thu, 1 Apr 2021 22:39:54 +0200 Subject: [PATCH] [pricelist][tags] add tags --- src/flaschengeist.d.ts | 1 + .../pricelist/components/CalculationTable.vue | 127 +++++++++++--- .../pricelist/components/DrinkTypes.vue | 1 - .../pricelist/components/Pricelist.vue | 29 +++ src/plugins/pricelist/components/Tags.vue | 166 ++++++++++++++++++ src/plugins/pricelist/pages/Receipts.vue | 20 ++- src/plugins/pricelist/pages/Settings.vue | 7 +- src/plugins/pricelist/store.ts | 23 +++ 8 files changed, 342 insertions(+), 32 deletions(-) create mode 100644 src/plugins/pricelist/components/Tags.vue diff --git a/src/flaschengeist.d.ts b/src/flaschengeist.d.ts index 216d696..0b0a806 100644 --- a/src/flaschengeist.d.ts +++ b/src/flaschengeist.d.ts @@ -132,5 +132,6 @@ declare namespace FG { interface Tag { id: number; name: string; + color: string; } } diff --git a/src/plugins/pricelist/components/CalculationTable.vue b/src/plugins/pricelist/components/CalculationTable.vue index b172e3a..976efed 100644 --- a/src/plugins/pricelist/components/CalculationTable.vue +++ b/src/plugins/pricelist/components/CalculationTable.vue @@ -123,26 +123,6 @@ /> - - {{ drinks_props.row.article_id || 'o.A.' }} - - - - {{ drinks_props.row.type.name }} + + + {{ tag.name }} + + + + + + + {{ drinks_props.row.article_id || 'o.A.' }} + + + + {{ drinks_props.row.volume ? `${drinks_props.row.volume} L` : 'o.A.' }} { - void store.getDrinkTypes(); + void store.getDrinkTypes(true); + void store.getTags(); void store.getExtraIngredients(); void store.get_min_prices(); store.getPriceCalcColumn(user); @@ -367,13 +421,7 @@ export default defineComponent({ sortable: true, sort, }, - { - name: 'article_id', - label: 'Artikelnummer', - field: 'article_id', - sortable: true, - sort, - }, + { name: 'drink_type', label: 'Kategorie', @@ -382,6 +430,28 @@ export default defineComponent({ sortable: true, sort: (a: FG.DrinkType, b: FG.DrinkType) => sort(a.name, b.name), }, + { + name: 'tags', + label: 'Tags', + field: 'tags', + format: (val: Array) => { + let retVal = ''; + val.forEach((tag, index) => { + if (index > 0) { + retVal += ', '; + } + retVal += tag.name; + }); + return retVal; + }, + }, + { + name: 'article_id', + label: 'Artikelnummer', + field: 'article_id', + sortable: true, + sort, + }, { name: 'volume_package', label: 'Inhalt in l des Gebinde', @@ -547,6 +617,7 @@ export default defineComponent({ console, search, filter, + tags: computed(() => store.tags), }; }, }); diff --git a/src/plugins/pricelist/components/DrinkTypes.vue b/src/plugins/pricelist/components/DrinkTypes.vue index 3071aae..9f51bec 100644 --- a/src/plugins/pricelist/components/DrinkTypes.vue +++ b/src/plugins/pricelist/components/DrinkTypes.vue @@ -60,7 +60,6 @@ export default defineComponent({ const actualDrinkType = ref(emptyDrinkType); onBeforeMount(() => { - console.log(store); void store.getDrinkTypes(); }); const rows = computed(() => store.drinkTypes); diff --git a/src/plugins/pricelist/components/Pricelist.vue b/src/plugins/pricelist/components/Pricelist.vue index 2c539cc..ac0ddde 100644 --- a/src/plugins/pricelist/components/Pricelist.vue +++ b/src/plugins/pricelist/components/Pricelist.vue @@ -31,6 +31,19 @@ /> +