diff --git a/src/components/CalculationTable.vue b/src/components/CalculationTable.vue index f04348d..8e6c0f8 100644 --- a/src/components/CalculationTable.vue +++ b/src/components/CalculationTable.vue @@ -37,8 +37,9 @@ + +
+ +
+
+
+ {{ props.row.name }} +
+
+ {{ props.row.type.name }} +
+
+
@@ -191,8 +214,8 @@ import { filter, Search } from '../utils/filter'; import SearchInput from './SearchInput.vue'; import DrinkModify from './DrinkModify.vue'; import { DeleteObjects } from '../utils/utils'; +import { setNewImage, getNewImage} from '../utils/image'; import { PERMISSIONS } from '../permissions'; -import { sort } from '../utils/sort'; import { Notify } from 'quasar'; export default defineComponent({ @@ -222,7 +245,7 @@ export default defineComponent({ onBeforeMount(() => { //void store.getDrinks(); - onRequest({ + void onRequest({ pagination: pagination.value, filter: undefined, }); @@ -237,8 +260,6 @@ export default defineComponent({ name: 'name', label: 'Name', field: 'name', - sortable: true, - sort, filterable: true, public: true, }, @@ -248,8 +269,6 @@ export default defineComponent({ label: 'Kategorie', field: 'type', format: (val: FG.DrinkType) => `${val.name}`, - sortable: true, - sort: (a: FG.DrinkType, b: FG.DrinkType) => sort(a.name, b.name), filterable: true, public: true, }, @@ -275,7 +294,6 @@ export default defineComponent({ label: 'Artikelnummer', field: 'article_id', sortable: true, - sort, filterable: true, public: false, }, @@ -284,7 +302,6 @@ export default defineComponent({ label: 'Inhalt in l des Gebinde', field: 'volume', sortable: true, - sort, public: false, }, { @@ -292,7 +309,6 @@ export default defineComponent({ label: 'Gebindegröße', field: 'package_size', sortable: true, - sort, public: false, }, { @@ -301,7 +317,6 @@ export default defineComponent({ field: 'cost_per_package', format: (val: number | null) => (val ? `${val.toFixed(3)}€` : ''), sortable: true, - sort, public: false, }, { @@ -310,7 +325,6 @@ export default defineComponent({ field: 'cost_per_volume', format: (val: number | null) => (val ? `${val.toFixed(3)}€` : ''), sortable: true, - sort: (a: ComputedRef, b: ComputedRef) => sort(a.value, b.value), }, { name: 'volumes', @@ -439,12 +453,12 @@ export default defineComponent({ void store.updateDrink(drink); } - async function deleteDrink() { + function deleteDrink() { if (editDrink.value) { - await store.deleteDrink(editDrink.value); + store.deleteDrink(editDrink.value); } editDrink.value = undefined; - onRequest({ pagination: pagination.value, filter: search.value }); + void onRequest({ pagination: pagination.value, filter: search.value }); } const showNewDrink = ref(false); @@ -534,10 +548,13 @@ export default defineComponent({ } if (drinkPic instanceof File) { await savePicture(drinkPic); + if (drink.id > 0) { + setNewImage(drink.id) + } } editDrink.value = undefined; notLoading.value = true; - onRequest({ pagination: pagination.value, filter: search.value }); + void onRequest({ pagination: pagination.value, filter: search.value }); } function get_volumes(drink_id: number) { @@ -546,20 +563,17 @@ export default defineComponent({ const notLoading = ref(true); - const imageloading = ref>([]); - function getImageLoading(id: number) { - const loading = imageloading.value.find((a) => a.id === id); - if (loading) { - return loading.loading; - } - return false; - } - function image(id: number | undefined) { if (id) { + const _newImage = getNewImage(id) + if (_newImage) { + return `${ + api.defaults.baseURL || '' + }/pricelist/drinks/${id}/picture?thumbnail?t=${_newImage.lastModified.toString()}` + } return `${ api.defaults.baseURL || '' - }/pricelist/drinks/${id}/picture?thumbnail?t=${new Date()}`; + }/pricelist/drinks/${id}/picture?thumbnail`; } return 'no-image.svg'; } @@ -587,7 +601,6 @@ export default defineComponent({ editing_drink, get_volumes, notLoading, - getImageLoading, newDrink, hasPermission, PERMISSIONS, diff --git a/src/components/DrinkModify.vue b/src/components/DrinkModify.vue index 467ed6e..568f132 100644 --- a/src/components/DrinkModify.vue +++ b/src/components/DrinkModify.vue @@ -146,6 +146,7 @@