2021-03-14 19:37:41 +00:00
|
|
|
<template>
|
2021-03-17 20:36:26 +00:00
|
|
|
<q-table
|
2021-03-19 15:33:27 +00:00
|
|
|
v-model:pagination="pagination"
|
2021-03-17 20:36:26 +00:00
|
|
|
title="Kalkulationstabelle"
|
|
|
|
:columns="columns"
|
2021-03-19 19:41:21 +00:00
|
|
|
:rows="drinks"
|
2021-03-17 20:36:26 +00:00
|
|
|
:visible-columns="visibleColumn"
|
|
|
|
:dense="$q.screen.lt.md"
|
|
|
|
row-key="id"
|
|
|
|
virtual-scroll
|
|
|
|
:rows-per-page-options="[0]"
|
|
|
|
>
|
2021-03-19 15:33:27 +00:00
|
|
|
<template #header="props">
|
2021-03-17 20:36:26 +00:00
|
|
|
<q-tr :props="props">
|
|
|
|
<q-th auto-width />
|
|
|
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
|
|
|
{{ col.label }}
|
|
|
|
</q-th>
|
|
|
|
</q-tr>
|
|
|
|
</template>
|
2021-03-19 15:33:27 +00:00
|
|
|
<template #top-right>
|
2021-03-17 20:36:26 +00:00
|
|
|
<div class="row justify-end q-gutter-sm">
|
2021-03-21 21:07:12 +00:00
|
|
|
<q-btn label="Aufpreise">
|
|
|
|
<q-menu anchor="center middle" self="center middle">
|
|
|
|
<min-price-setting />
|
|
|
|
</q-menu>
|
|
|
|
</q-btn>
|
2021-03-17 20:36:26 +00:00
|
|
|
<q-btn label="neues Getränk" color="positive" icon-right="add">
|
2021-03-21 22:02:25 +00:00
|
|
|
<q-menu v-model="showNewDrink" anchor="center middle" self="center middle">
|
|
|
|
<new-drink @close="showNewDrink = false" />
|
2021-03-17 20:36:26 +00:00
|
|
|
</q-menu>
|
|
|
|
</q-btn>
|
2021-03-14 19:37:41 +00:00
|
|
|
<q-select
|
|
|
|
v-model="visibleColumn"
|
|
|
|
multiple
|
|
|
|
filled
|
|
|
|
dense
|
|
|
|
options-dense
|
|
|
|
display-value="Sichtbarkeit"
|
|
|
|
emit-value
|
|
|
|
map-options
|
|
|
|
:options="[...columns, ...column_calc, ...column_prices]"
|
|
|
|
option-value="name"
|
|
|
|
options-cover
|
|
|
|
/>
|
2021-03-17 20:36:26 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2021-03-19 15:33:27 +00:00
|
|
|
<template #body="drinks_props">
|
2021-03-17 20:36:26 +00:00
|
|
|
<q-tr :props="drinks_props">
|
|
|
|
<q-td auto-width>
|
|
|
|
<q-btn
|
2021-03-19 15:33:27 +00:00
|
|
|
v-if="drinks_props.row.volumes.length === 0"
|
2021-03-17 20:36:26 +00:00
|
|
|
size="xs"
|
|
|
|
color="negative"
|
|
|
|
round
|
|
|
|
dense
|
|
|
|
icon="mdi-delete"
|
|
|
|
class="q-mx-sm"
|
|
|
|
@click="deleteDrink(drinks_props.row)"
|
|
|
|
/>
|
|
|
|
</q-td>
|
2021-03-22 22:18:22 +00:00
|
|
|
<q-td key="picture" :props="drinks_props" style="width: 128px">
|
|
|
|
<q-img
|
|
|
|
:src="`http://localhost/api/pricelist/drinks/${drinks_props.row.id}/picture?size=128`"
|
|
|
|
/>
|
|
|
|
<q-popup-edit
|
|
|
|
v-slot="scope"
|
|
|
|
v-model="drinkPic"
|
|
|
|
buttons
|
|
|
|
label-set="Speichern"
|
|
|
|
label-cancel="Abbrechen"
|
|
|
|
@update:modelValue="savePicture(drinks_props.row)"
|
|
|
|
>
|
2021-03-24 16:28:41 +00:00
|
|
|
<q-file v-model="scope.value" filled>
|
|
|
|
<template #prepend>
|
2021-03-22 22:18:22 +00:00
|
|
|
<q-icon name="attach_file" />
|
|
|
|
</template>
|
|
|
|
</q-file>
|
|
|
|
</q-popup-edit>
|
|
|
|
</q-td>
|
2021-03-17 20:36:26 +00:00
|
|
|
<q-td key="name" :props="drinks_props">
|
|
|
|
{{ drinks_props.row.name }}
|
|
|
|
<q-popup-edit
|
2021-03-21 21:07:12 +00:00
|
|
|
v-slot="scope"
|
2021-03-17 20:36:26 +00:00
|
|
|
v-model="drinks_props.row.name"
|
|
|
|
buttons
|
|
|
|
label-cancel="Abbrechen"
|
|
|
|
label-set="Speichern"
|
2021-03-21 21:07:12 +00:00
|
|
|
@update:modelValue="updateDrink(drinks_props.row)"
|
2021-03-17 20:36:26 +00:00
|
|
|
>
|
2021-03-21 21:07:12 +00:00
|
|
|
<q-input
|
|
|
|
v-model="scope.value"
|
|
|
|
filled
|
|
|
|
dense
|
|
|
|
autofocus
|
|
|
|
clearable
|
|
|
|
@keyup.enter="scope.set"
|
|
|
|
/>
|
2021-03-17 20:36:26 +00:00
|
|
|
</q-popup-edit>
|
|
|
|
</q-td>
|
|
|
|
<q-td key="drink_type" :props="drinks_props">
|
|
|
|
{{ drinks_props.row.type.name }}
|
|
|
|
<q-popup-edit
|
2021-03-21 21:07:12 +00:00
|
|
|
v-slot="scope"
|
2021-03-17 20:36:26 +00:00
|
|
|
v-model="drinks_props.row.type"
|
|
|
|
buttons
|
|
|
|
label-cancel="Abbrechen"
|
|
|
|
label-set="Speichern"
|
2021-03-21 21:07:12 +00:00
|
|
|
@update:modelValue="updateDrink(drinks_props.row)"
|
2021-03-17 20:36:26 +00:00
|
|
|
>
|
|
|
|
<q-select
|
2021-03-21 21:07:12 +00:00
|
|
|
v-model="scope.value"
|
2021-03-17 20:36:26 +00:00
|
|
|
:options="drinkTypes"
|
|
|
|
option-label="name"
|
|
|
|
filled
|
|
|
|
dense
|
|
|
|
autofocus
|
2021-03-21 21:07:12 +00:00
|
|
|
@keyup.enter="scope.set"
|
2021-03-17 20:36:26 +00:00
|
|
|
/>
|
|
|
|
</q-popup-edit>
|
|
|
|
</q-td>
|
|
|
|
<q-td key="article_id" :props="drinks_props">
|
|
|
|
{{ drinks_props.row.article_id || 'o.A.' }}
|
|
|
|
<q-popup-edit
|
2021-03-21 21:07:12 +00:00
|
|
|
v-slot="scope"
|
2021-03-17 20:36:26 +00:00
|
|
|
v-model="drinks_props.row.article_id"
|
|
|
|
buttons
|
|
|
|
label-cancel="Abbrechen"
|
|
|
|
label-set="Speichern"
|
2021-03-21 21:07:12 +00:00
|
|
|
@update:modelValue="updateDrink(drinks_props.row)"
|
2021-03-17 20:36:26 +00:00
|
|
|
>
|
2021-03-21 21:07:12 +00:00
|
|
|
<q-input
|
|
|
|
v-model="scope.value"
|
|
|
|
filled
|
|
|
|
dense
|
|
|
|
autofocus
|
|
|
|
clearable
|
|
|
|
@keyup.enter="scope.set"
|
|
|
|
/>
|
2021-03-17 20:36:26 +00:00
|
|
|
</q-popup-edit>
|
|
|
|
</q-td>
|
|
|
|
<q-td key="volume_package" :props="drinks_props">
|
|
|
|
{{ drinks_props.row.volume ? `${drinks_props.row.volume} L` : 'o.A.' }}
|
|
|
|
<q-popup-edit
|
|
|
|
v-if="
|
2021-03-18 16:23:57 +00:00
|
|
|
!drinks_props.row.volumes.some((volume) =>
|
|
|
|
volume.ingredients.some((ingredient) => ingredient.drink_ingredient)
|
2021-03-17 20:36:26 +00:00
|
|
|
)
|
|
|
|
"
|
2021-03-21 21:07:12 +00:00
|
|
|
v-slot="scope"
|
2021-03-17 20:36:26 +00:00
|
|
|
v-model.number="drinks_props.row.volume"
|
|
|
|
buttons
|
|
|
|
label-cancel="Abbrechen"
|
|
|
|
label-set="Speichern"
|
2021-03-21 21:07:12 +00:00
|
|
|
@update:modelValue="updateDrink(drinks_props.row)"
|
2021-03-17 20:36:26 +00:00
|
|
|
>
|
|
|
|
<q-input
|
2021-03-21 21:07:12 +00:00
|
|
|
v-model.number="scope.value"
|
2021-03-17 20:36:26 +00:00
|
|
|
filled
|
|
|
|
dense
|
|
|
|
autofocus
|
|
|
|
type="number"
|
|
|
|
clearable
|
|
|
|
step="0.01"
|
|
|
|
min="0"
|
|
|
|
suffix="L"
|
2021-03-21 21:07:12 +00:00
|
|
|
@keyup.enter="scope.set"
|
2021-03-17 20:36:26 +00:00
|
|
|
/>
|
|
|
|
</q-popup-edit>
|
|
|
|
</q-td>
|
|
|
|
<q-td key="package_size" :props="drinks_props">
|
|
|
|
{{ drinks_props.row.package_size || 'o.A.' }}
|
|
|
|
<q-popup-edit
|
|
|
|
v-if="
|
2021-03-18 16:23:57 +00:00
|
|
|
!drinks_props.row.volumes.some((volume) =>
|
|
|
|
volume.ingredients.some((ingredient) => ingredient.drink_ingredient)
|
2021-03-17 20:36:26 +00:00
|
|
|
)
|
|
|
|
"
|
2021-03-21 21:07:12 +00:00
|
|
|
v-slot="scope"
|
2021-03-17 20:36:26 +00:00
|
|
|
v-model="drinks_props.row.package_size"
|
|
|
|
buttons
|
|
|
|
label-cancel="Abbrechen"
|
|
|
|
label-set="Speichern"
|
2021-03-21 21:07:12 +00:00
|
|
|
@update:modelValue="updateDrink(drinks_props.row)"
|
2021-03-17 20:36:26 +00:00
|
|
|
>
|
|
|
|
<q-input
|
2021-03-21 21:07:12 +00:00
|
|
|
v-model.number="scope.value"
|
2021-03-17 20:36:26 +00:00
|
|
|
filled
|
|
|
|
dense
|
|
|
|
autofocus
|
|
|
|
type="number"
|
|
|
|
min="0"
|
2021-03-21 21:07:12 +00:00
|
|
|
@keyup.enter="scope.set"
|
2021-03-17 20:36:26 +00:00
|
|
|
/>
|
|
|
|
</q-popup-edit>
|
|
|
|
</q-td>
|
|
|
|
<q-td key="cost_price_package_netto" :props="drinks_props">
|
|
|
|
{{
|
|
|
|
drinks_props.row.cost_price_package_netto
|
2021-03-21 21:07:12 +00:00
|
|
|
? `${drinks_props.row.cost_price_package_netto.toFixed(2)}€`
|
2021-03-17 20:36:26 +00:00
|
|
|
: 'o.A.'
|
|
|
|
}}
|
|
|
|
<q-popup-edit
|
|
|
|
v-if="
|
2021-03-18 16:23:57 +00:00
|
|
|
!drinks_props.row.volumes.some((volume) =>
|
|
|
|
volume.ingredients.some((ingredient) => ingredient.drink_ingredient)
|
2021-03-17 20:36:26 +00:00
|
|
|
)
|
|
|
|
"
|
2021-03-21 21:07:12 +00:00
|
|
|
v-slot="scope"
|
2021-03-17 20:36:26 +00:00
|
|
|
v-model="drinks_props.row.cost_price_package_netto"
|
|
|
|
buttons
|
|
|
|
label-cancel="Abbrechen"
|
|
|
|
label-set="Speichern"
|
2021-03-21 21:07:12 +00:00
|
|
|
@update:modelValue="updateDrink(drinks_props.row)"
|
2021-03-17 20:36:26 +00:00
|
|
|
>
|
|
|
|
<q-input
|
2021-03-21 21:07:12 +00:00
|
|
|
v-model.number="scope.value"
|
2021-03-17 20:36:26 +00:00
|
|
|
filled
|
|
|
|
dense
|
|
|
|
autofocus
|
|
|
|
type="number"
|
|
|
|
step="0.01"
|
|
|
|
min="0"
|
|
|
|
suffix="€"
|
2021-03-21 21:07:12 +00:00
|
|
|
@keyup.enter="scope.set"
|
2021-03-17 20:36:26 +00:00
|
|
|
/>
|
|
|
|
</q-popup-edit>
|
|
|
|
</q-td>
|
|
|
|
<q-td key="cost_price_pro_volume" :props="drinks_props">
|
|
|
|
{{
|
2021-03-19 19:41:21 +00:00
|
|
|
drinks_props.row.cost_price_pro_volume
|
|
|
|
? `${drinks_props.row.cost_price_pro_volume.toFixed(3)}€`
|
2021-03-17 20:36:26 +00:00
|
|
|
: 'o.A.'
|
|
|
|
}}
|
|
|
|
<q-popup-edit
|
|
|
|
v-if="
|
|
|
|
!(
|
|
|
|
!!drinks_props.row.cost_price_package_netto &&
|
|
|
|
!!drinks_props.row.volume &&
|
|
|
|
!!drinks_props.row.package_size
|
|
|
|
) &&
|
2021-03-18 16:23:57 +00:00
|
|
|
!drinks_props.row.volumes.some((volume) =>
|
|
|
|
volume.ingredients.some((ingredient) => ingredient.drink_ingredient)
|
|
|
|
)
|
2021-03-17 20:36:26 +00:00
|
|
|
"
|
2021-03-21 21:07:12 +00:00
|
|
|
v-slot="scope"
|
2021-03-19 19:41:21 +00:00
|
|
|
v-model="drinks_props.row.cost_price_pro_volume"
|
2021-03-17 20:36:26 +00:00
|
|
|
buttons
|
|
|
|
label-cancel="Abbrechen"
|
|
|
|
label-set="Speichern"
|
2021-03-21 21:07:12 +00:00
|
|
|
@update:modelValue="updateDrink(drinks_props.row)"
|
2021-03-17 20:36:26 +00:00
|
|
|
>
|
|
|
|
<q-input
|
2021-03-21 21:07:12 +00:00
|
|
|
v-model.number="scope.value"
|
2021-03-17 20:36:26 +00:00
|
|
|
filled
|
|
|
|
dense
|
|
|
|
autofocus
|
|
|
|
type="number"
|
|
|
|
min="0"
|
|
|
|
step="0.1"
|
|
|
|
suffix="€"
|
2021-03-21 21:07:12 +00:00
|
|
|
@keyup.enter="scope.set"
|
2021-03-17 20:36:26 +00:00
|
|
|
/>
|
|
|
|
</q-popup-edit>
|
|
|
|
</q-td>
|
|
|
|
<q-td key="volumes" :props="drinks_props">
|
2021-03-21 21:07:12 +00:00
|
|
|
<drink-price-volumes-table
|
|
|
|
:rows="drinks_props.row.volumes"
|
|
|
|
:visible-columns="visibleColumn"
|
|
|
|
:columns="column_calc"
|
|
|
|
:drink="drinks_props.row"
|
|
|
|
@updateDrink="updateDrink(drinks_props.row)"
|
|
|
|
/>
|
2021-03-17 20:36:26 +00:00
|
|
|
</q-td>
|
|
|
|
</q-tr>
|
|
|
|
</template>
|
|
|
|
</q-table>
|
2021-03-14 19:37:41 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-03-22 22:18:22 +00:00
|
|
|
import {
|
|
|
|
defineComponent,
|
|
|
|
onBeforeMount,
|
|
|
|
ComputedRef,
|
|
|
|
computed,
|
|
|
|
ref,
|
|
|
|
getCurrentInstance,
|
|
|
|
} from 'vue';
|
2021-03-20 13:59:55 +00:00
|
|
|
import DrinkPriceVolumesTable from 'src/plugins/pricelist/components/CalculationTable/DrinkPriceVolumesTable.vue';
|
2021-03-21 21:07:12 +00:00
|
|
|
import { useMainStore } from 'src/store';
|
2021-03-20 13:59:55 +00:00
|
|
|
import { Drink, usePricelistStore } from 'src/plugins/pricelist/store';
|
2021-03-21 21:07:12 +00:00
|
|
|
import MinPriceSetting from 'src/plugins/pricelist/components/MinPriceSetting.vue';
|
2021-03-21 22:02:25 +00:00
|
|
|
import NewDrink from 'src/plugins/pricelist/components/CalculationTable/NewDrink.vue';
|
2021-03-22 22:18:22 +00:00
|
|
|
import { Notify } from 'quasar';
|
2021-03-19 15:33:27 +00:00
|
|
|
|
2021-03-18 20:10:54 +00:00
|
|
|
function sort(a: string | number, b: string | number) {
|
|
|
|
if (a > b) return 1;
|
|
|
|
if (b > a) return -1;
|
|
|
|
return 0;
|
|
|
|
}
|
2021-03-14 19:37:41 +00:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'CalculationTable',
|
2021-03-21 22:02:25 +00:00
|
|
|
components: { MinPriceSetting, DrinkPriceVolumesTable, NewDrink },
|
2021-03-19 15:33:27 +00:00
|
|
|
setup() {
|
|
|
|
const mainStore = useMainStore();
|
2021-03-19 19:41:21 +00:00
|
|
|
const store = usePricelistStore();
|
2021-03-22 22:18:22 +00:00
|
|
|
const root = getCurrentInstance()?.proxy;
|
2021-03-19 15:33:27 +00:00
|
|
|
|
2021-03-18 21:33:25 +00:00
|
|
|
onBeforeMount(() => {
|
2021-03-19 19:41:21 +00:00
|
|
|
store.getPriceCalcColumn(user);
|
2021-03-18 21:33:25 +00:00
|
|
|
});
|
2021-03-19 15:33:27 +00:00
|
|
|
|
|
|
|
const user = mainStore.currentUser.userid;
|
|
|
|
|
2021-03-14 19:37:41 +00:00
|
|
|
const columns = [
|
2021-03-22 22:18:22 +00:00
|
|
|
{
|
|
|
|
name: 'picture',
|
|
|
|
label: 'Bild',
|
|
|
|
},
|
2021-03-14 19:37:41 +00:00
|
|
|
{
|
|
|
|
name: 'name',
|
|
|
|
label: 'Getränkename',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'name',
|
2021-03-18 20:10:54 +00:00
|
|
|
sortable: true,
|
|
|
|
sort,
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'article_id',
|
|
|
|
label: 'Artikelnummer',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'article_id',
|
2021-03-18 20:10:54 +00:00
|
|
|
sortable: true,
|
|
|
|
sort,
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
2021-03-15 18:57:42 +00:00
|
|
|
name: 'drink_type',
|
2021-03-14 19:37:41 +00:00
|
|
|
label: 'Kategorie',
|
2021-03-15 18:57:42 +00:00
|
|
|
field: 'type',
|
2021-03-18 16:23:57 +00:00
|
|
|
format: (val: FG.DrinkType) => `${val.name}`,
|
2021-03-18 20:10:54 +00:00
|
|
|
sortable: true,
|
|
|
|
sort: (a: FG.DrinkType, b: FG.DrinkType) => sort(a.name, b.name),
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'volume_package',
|
|
|
|
label: 'Inhalt in l des Gebinde',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'volume',
|
2021-03-18 20:10:54 +00:00
|
|
|
sortable: true,
|
|
|
|
sort,
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'package_size',
|
|
|
|
label: 'Gebindegröße',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'package_size',
|
2021-03-18 20:10:54 +00:00
|
|
|
sortable: true,
|
|
|
|
sort,
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'cost_price_package_netto',
|
|
|
|
label: 'Preis Netto/Gebinde',
|
|
|
|
field: 'cost_price_package_netto',
|
2021-03-18 16:23:57 +00:00
|
|
|
format: (val: number | null) => (val ? `${val.toFixed(3)}€` : ''),
|
2021-03-18 20:10:54 +00:00
|
|
|
sortable: true,
|
|
|
|
sort,
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'cost_price_pro_volume',
|
|
|
|
label: 'Preis mit 19%/Liter',
|
|
|
|
field: 'cost_price_pro_volume',
|
2021-03-18 16:23:57 +00:00
|
|
|
format: (val: number | null) => (val ? `${val.toFixed(3)}€` : ''),
|
2021-03-18 20:10:54 +00:00
|
|
|
sortable: true,
|
|
|
|
sort: (a: ComputedRef, b: ComputedRef) => sort(a.value, b.value),
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
2021-03-15 18:57:42 +00:00
|
|
|
name: 'volumes',
|
2021-03-14 19:37:41 +00:00
|
|
|
label: 'Preiskalkulation',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'volumes',
|
|
|
|
},
|
2021-03-14 19:37:41 +00:00
|
|
|
];
|
|
|
|
const column_calc = [
|
|
|
|
{
|
|
|
|
name: 'volume',
|
|
|
|
label: 'Abgabe in l',
|
|
|
|
field: 'volume',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'min_prices',
|
|
|
|
label: 'Minimal Preise',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'min_prices',
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'prices',
|
|
|
|
label: 'Preise',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'prices',
|
|
|
|
},
|
2021-03-14 19:37:41 +00:00
|
|
|
];
|
|
|
|
const column_prices = [
|
|
|
|
{
|
|
|
|
name: 'price',
|
|
|
|
label: 'Preis',
|
|
|
|
field: 'price',
|
2021-03-18 16:23:57 +00:00
|
|
|
format: (val: number) => `${val.toFixed(2)}€`,
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'description',
|
|
|
|
label: 'Beschreibung',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'description',
|
2021-03-14 19:37:41 +00:00
|
|
|
},
|
|
|
|
{
|
2021-03-15 18:57:42 +00:00
|
|
|
name: 'public',
|
|
|
|
label: 'Öffentlich',
|
2021-03-18 16:23:57 +00:00
|
|
|
field: 'public',
|
|
|
|
},
|
2021-03-15 18:57:42 +00:00
|
|
|
];
|
2021-03-18 21:33:25 +00:00
|
|
|
const visibleColumn = computed({
|
2021-03-19 19:41:21 +00:00
|
|
|
get: () => store.pricecalc_columns,
|
2021-03-18 21:33:25 +00:00
|
|
|
set: (val) => {
|
2021-03-19 19:41:21 +00:00
|
|
|
store.updatePriceCalcColumn(user, val);
|
2021-03-18 21:33:25 +00:00
|
|
|
},
|
|
|
|
});
|
2021-03-14 19:37:41 +00:00
|
|
|
|
2021-03-19 19:41:21 +00:00
|
|
|
// eslint-disable-next-line vue/return-in-computed-property
|
2021-03-17 20:36:26 +00:00
|
|
|
const pagination = computed(() => {
|
2021-03-19 19:41:21 +00:00
|
|
|
rowsPerPage: store.drinks.length;
|
2021-03-17 20:36:26 +00:00
|
|
|
});
|
|
|
|
|
2021-03-19 19:41:21 +00:00
|
|
|
const drinkTypes = computed(() => store.drinkTypes);
|
2021-03-17 20:36:26 +00:00
|
|
|
|
|
|
|
function updateDrink(drink: Drink) {
|
2021-03-21 21:07:12 +00:00
|
|
|
void store.updateDrink(drink);
|
2021-03-17 20:36:26 +00:00
|
|
|
}
|
|
|
|
function deleteDrink(drink: Drink) {
|
2021-03-19 19:41:21 +00:00
|
|
|
store.deleteDrink(drink);
|
2021-03-14 19:37:41 +00:00
|
|
|
}
|
|
|
|
|
2021-03-21 22:02:25 +00:00
|
|
|
const showNewDrink = ref(false);
|
|
|
|
|
2021-03-22 22:18:22 +00:00
|
|
|
const drinkPic = ref<File>();
|
|
|
|
|
|
|
|
function onPictureRejected() {
|
|
|
|
Notify.create({
|
|
|
|
group: false,
|
|
|
|
type: 'negative',
|
|
|
|
message: 'Datei zu groß oder keine gültige Bilddatei.',
|
|
|
|
timeout: 10000,
|
|
|
|
progress: true,
|
|
|
|
actions: [{ icon: 'mdi-close', color: 'white' }],
|
|
|
|
});
|
|
|
|
drinkPic.value = undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
function savePicture(drink: Drink) {
|
|
|
|
console.log('hier bin ich!!!', drinkPic.value);
|
|
|
|
if (drinkPic.value && drinkPic.value instanceof File)
|
|
|
|
store
|
|
|
|
.upload_drink_picture(drink, drinkPic.value)
|
|
|
|
.then(() => {
|
|
|
|
root?.$forceUpdate();
|
|
|
|
})
|
|
|
|
.catch((response: Response) => {
|
|
|
|
if (response && response.status == 400) {
|
|
|
|
onPictureRejected();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-14 19:37:41 +00:00
|
|
|
return {
|
2021-03-19 19:41:21 +00:00
|
|
|
drinks: computed(() => store.drinks),
|
2021-03-17 20:36:26 +00:00
|
|
|
pagination,
|
2021-03-14 19:37:41 +00:00
|
|
|
columns,
|
|
|
|
column_calc,
|
|
|
|
column_prices,
|
|
|
|
visibleColumn,
|
2021-03-17 20:36:26 +00:00
|
|
|
drinkTypes,
|
|
|
|
updateDrink,
|
|
|
|
deleteDrink,
|
2021-03-21 22:02:25 +00:00
|
|
|
showNewDrink,
|
2021-03-22 22:18:22 +00:00
|
|
|
drinkPic,
|
|
|
|
savePicture,
|
2021-03-18 16:23:57 +00:00
|
|
|
console,
|
2021-03-19 19:41:21 +00:00
|
|
|
};
|
2021-03-18 16:23:57 +00:00
|
|
|
},
|
2021-03-14 19:37:41 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|