[pricelist][calculation] start add grid view
This commit is contained in:
parent
736ea04b4a
commit
284652b002
|
@ -1,16 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
|
<!--v-model:pagination="pagination"-->
|
||||||
<q-table
|
<q-table
|
||||||
v-model:pagination="pagination"
|
|
||||||
title="Kalkulationstabelle"
|
title="Kalkulationstabelle"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="drinks"
|
:rows="drinks"
|
||||||
:visible-columns="visibleColumn"
|
:visible-columns="visibleColumn"
|
||||||
:dense="$q.screen.lt.md"
|
dense
|
||||||
row-key="id"
|
|
||||||
virtual-scroll
|
|
||||||
:rows-per-page-options="[0]"
|
|
||||||
:filter="search"
|
:filter="search"
|
||||||
:filter-method="filter"
|
:filter-method="filter"
|
||||||
|
:grid="grid"
|
||||||
>
|
>
|
||||||
<template #header="props">
|
<template #header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
@ -46,6 +44,7 @@
|
||||||
option-value="name"
|
option-value="name"
|
||||||
options-cover
|
options-cover
|
||||||
/>
|
/>
|
||||||
|
<q-btn label="grid" @click="grid = !grid" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="drinks_props">
|
<template #body="drinks_props">
|
||||||
|
@ -357,25 +356,41 @@
|
||||||
@deleteStep="deleteStep($event, drinks_props.row)"
|
@deleteStep="deleteStep($event, drinks_props.row)"
|
||||||
@addStep="addStep($event, drinks_props.row)"
|
@addStep="addStep($event, drinks_props.row)"
|
||||||
/>
|
/>
|
||||||
<!--<q-popup-edit
|
|
||||||
v-slot="scope"
|
|
||||||
v-model="drinks_props.row.receipt"
|
|
||||||
buttons
|
|
||||||
label-cancel="Abbrechen"
|
|
||||||
label-set="Speichern"
|
|
||||||
@update:modelValue="updateDrink(drinks_props.row)"
|
|
||||||
>
|
|
||||||
<q-input
|
|
||||||
v-model="scope.value"
|
|
||||||
type="textarea"
|
|
||||||
autofocus
|
|
||||||
counter
|
|
||||||
@keyup.enter.stop
|
|
||||||
/>
|
|
||||||
</q-popup-edit>-->
|
|
||||||
</q-td>
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
|
<template #item="props">
|
||||||
|
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4">
|
||||||
|
<q-card>
|
||||||
|
<q-img
|
||||||
|
style="max-height: 256px"
|
||||||
|
:src="
|
||||||
|
props.row.uuid ? `/api/pricelist/picture/${props.row.uuid}?size=256` : 'no-image.svg'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div class="absolute-bottom-right justify-end">
|
||||||
|
<div class="text-subtitle1 text-right">
|
||||||
|
{{ props.row.name }}
|
||||||
|
</div>
|
||||||
|
<div class="text-caption text-right">
|
||||||
|
{{ props.row.type.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-img>
|
||||||
|
<q-card-section>
|
||||||
|
<q-badge
|
||||||
|
v-for="tag in props.row.tags"
|
||||||
|
:key="`${props.row.id}-${tag.id}`"
|
||||||
|
class="text-caption"
|
||||||
|
rounded
|
||||||
|
:style="`background-color: ${tag.color}`"
|
||||||
|
>
|
||||||
|
{{ tag.name }}
|
||||||
|
</q-badge>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</q-table>
|
</q-table>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -383,7 +398,7 @@
|
||||||
import { defineComponent, onBeforeMount, ComputedRef, computed, ref } from 'vue';
|
import { defineComponent, onBeforeMount, ComputedRef, computed, ref } from 'vue';
|
||||||
import DrinkPriceVolumesTable from 'src/plugins/pricelist/components/CalculationTable/DrinkPriceVolumesTable.vue';
|
import DrinkPriceVolumesTable from 'src/plugins/pricelist/components/CalculationTable/DrinkPriceVolumesTable.vue';
|
||||||
import { useMainStore } from 'src/stores';
|
import { useMainStore } from 'src/stores';
|
||||||
import { Drink, usePricelistStore } from 'src/plugins/pricelist/store';
|
import { Drink, usePricelistStore, DrinkPriceVolume } from 'src/plugins/pricelist/store';
|
||||||
import MinPriceSetting from 'src/plugins/pricelist/components/MinPriceSetting.vue';
|
import MinPriceSetting from 'src/plugins/pricelist/components/MinPriceSetting.vue';
|
||||||
import NewDrink from 'src/plugins/pricelist/components/CalculationTable/NewDrink.vue';
|
import NewDrink from 'src/plugins/pricelist/components/CalculationTable/NewDrink.vue';
|
||||||
import BuildManual from 'src/plugins/pricelist/components/CalculationTable/BuildManual.vue';
|
import BuildManual from 'src/plugins/pricelist/components/CalculationTable/BuildManual.vue';
|
||||||
|
@ -394,17 +409,17 @@ import { sort } from '../utils/sort';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CalculationTable',
|
name: 'CalculationTable',
|
||||||
components: { SearchInput, BuildManual, MinPriceSetting, DrinkPriceVolumesTable, NewDrink },
|
components: { SearchInput, MinPriceSetting, NewDrink, BuildManual, DrinkPriceVolumesTable },
|
||||||
setup() {
|
setup() {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
const store = usePricelistStore();
|
const store = usePricelistStore();
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
void store.getDrinkTypes(true);
|
// void store.getDrinkTypes(true);
|
||||||
void store.getTags();
|
// void store.getTags();
|
||||||
void store.getExtraIngredients();
|
//void store.getDrinks();
|
||||||
void store.get_min_prices();
|
//void store.get_min_prices();
|
||||||
store.getPriceCalcColumn(user);
|
void store.getPriceCalcColumn(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
const user = mainStore.currentUser.userid;
|
const user = mainStore.currentUser.userid;
|
||||||
|
@ -490,12 +505,34 @@ export default defineComponent({
|
||||||
name: 'volumes',
|
name: 'volumes',
|
||||||
label: 'Preiskalkulation',
|
label: 'Preiskalkulation',
|
||||||
field: 'volumes',
|
field: 'volumes',
|
||||||
|
format: (val: Array<DrinkPriceVolume>) => {
|
||||||
|
let retVal = '';
|
||||||
|
val.forEach((val, index) => {
|
||||||
|
if (index > 0) {
|
||||||
|
retVal += ', ';
|
||||||
|
}
|
||||||
|
retVal += val.id;
|
||||||
|
});
|
||||||
|
return retVal;
|
||||||
|
},
|
||||||
|
sortable: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'receipt',
|
name: 'receipt',
|
||||||
label: 'Bauanleitung',
|
label: 'Bauanleitung',
|
||||||
field: 'receipt',
|
field: 'receipt',
|
||||||
|
format: (val: Array<string>) => {
|
||||||
|
let retVal = '';
|
||||||
|
val.forEach((value, index) => {
|
||||||
|
if (index > 0) {
|
||||||
|
retVal += ', ';
|
||||||
|
}
|
||||||
|
retVal += value;
|
||||||
|
});
|
||||||
|
return retVal;
|
||||||
|
},
|
||||||
filterable: true,
|
filterable: true,
|
||||||
|
sortable: false,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const column_calc = [
|
const column_calc = [
|
||||||
|
@ -542,9 +579,10 @@ export default defineComponent({
|
||||||
|
|
||||||
const search_keys = computed(() => columns.filter((column) => column.filterable));
|
const search_keys = computed(() => columns.filter((column) => column.filterable));
|
||||||
|
|
||||||
// eslint-disable-next-line vue/return-in-computed-property
|
const pagination = ref({
|
||||||
const pagination = computed(() => {
|
sortBy: 'name',
|
||||||
rowsPerPage: store.drinks.length;
|
descending: false,
|
||||||
|
rowsPerPage: store.drinks.length,
|
||||||
});
|
});
|
||||||
|
|
||||||
const drinkTypes = computed(() => store.drinkTypes);
|
const drinkTypes = computed(() => store.drinkTypes);
|
||||||
|
@ -605,6 +643,7 @@ export default defineComponent({
|
||||||
key: '',
|
key: '',
|
||||||
label: '',
|
label: '',
|
||||||
});
|
});
|
||||||
|
const grid = ref(false);
|
||||||
return {
|
return {
|
||||||
drinks: computed(() => store.drinks),
|
drinks: computed(() => store.drinks),
|
||||||
pagination,
|
pagination,
|
||||||
|
@ -625,6 +664,7 @@ export default defineComponent({
|
||||||
search,
|
search,
|
||||||
filter,
|
filter,
|
||||||
search_keys,
|
search_keys,
|
||||||
|
grid,
|
||||||
tags: computed(() => store.tags),
|
tags: computed(() => store.tags),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -59,7 +59,7 @@ import { usePricelistStore } from 'src/plugins/pricelist/store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'Settings',
|
name: 'Settings',
|
||||||
components: { ExtraIngredients, DrinkTypes, CalculationTable, Tags },
|
components: { ExtraIngredients, DrinkTypes, Tags, CalculationTable },
|
||||||
setup() {
|
setup() {
|
||||||
interface Tab {
|
interface Tab {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -73,6 +73,7 @@ export default defineComponent({
|
||||||
console.log(store.extraIngredients);
|
console.log(store.extraIngredients);
|
||||||
})
|
})
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => console.log(err));
|
||||||
|
void store.getTags();
|
||||||
void store.getDrinkTypes();
|
void store.getDrinkTypes();
|
||||||
void store.getDrinks();
|
void store.getDrinks();
|
||||||
void store.get_min_prices();
|
void store.get_min_prices();
|
||||||
|
|
Loading…
Reference in New Issue