@@ -457,12 +464,8 @@ export default defineComponent({
});
drinkPic.value = undefined;
}
- interface Row extends Drink {
- expand: boolean;
- }
function savePicture(drink: Drink) {
console.log('hier bin ich!!!', drinkPic.value);
- drink.loading = true;
if (drinkPic.value && drinkPic.value instanceof File) {
store
.upload_drink_picture(drink, drinkPic.value)
@@ -471,17 +474,11 @@ export default defineComponent({
onPictureRejected();
}
})
- .finally(() => {
- drink.loading = false;
- });
}
}
- function deletePicture(drink: Row) {
- drink.loading = true;
- void store.delete_drink_picture(drink).finally(() => {
- drink.loading = false;
- });
+ function deletePicture(drink: Drink) {
+ void store.delete_drink_picture(drink)
}
return {
diff --git a/src/plugins/pricelist/components/CalculationTable/NewDrink.vue b/src/plugins/pricelist/components/CalculationTable/NewDrink.vue
index 75ad58d..baa37f4 100644
--- a/src/plugins/pricelist/components/CalculationTable/NewDrink.vue
+++ b/src/plugins/pricelist/components/CalculationTable/NewDrink.vue
@@ -83,6 +83,7 @@ export default defineComponent({
tags: [],
type: undefined,
volumes: [],
+ uuid: ''
};
const calc_price_pro_volume = computed(
diff --git a/src/plugins/pricelist/store.ts b/src/plugins/pricelist/store.ts
index 1018e98..4a21adf 100644
--- a/src/plugins/pricelist/store.ts
+++ b/src/plugins/pricelist/store.ts
@@ -15,7 +15,6 @@ interface Drink extends Omit, 'volumes'>
volumes: DrinkPriceVolume[];
cost_price_pro_volume: WritableComputedRef;
_cost_price_pro_volume?: number;
- loading: boolean;
}
class DrinkPriceVolume implements DrinkPriceVolume {
@@ -56,6 +55,7 @@ class Drink {
cost_price_package_netto,
tags,
type,
+ uuid
}: FG.Drink) {
this.id = id;
this.article_id = article_id;
@@ -81,7 +81,7 @@ class Drink {
this.tags = tags;
this.type = type;
this.volumes = [];
- this.loading = false;
+ this.uuid = uuid;
}
}
@@ -162,6 +162,7 @@ export const usePricelistStore = defineStore({
this.drinks.push(_drink);
});
this.create_min_prices();
+ console.log(this.drinks)
},
sortPrices(volume: DrinkPriceVolume) {
volume.prices.sort((a, b) => {
@@ -305,14 +306,16 @@ export const usePricelistStore = defineStore({
async upload_drink_picture(drink: Drink, file: File) {
const formData = new FormData();
formData.append('file', file);
- await api.post(`pricelist/drinks/${drink.id}/picture`, formData, {
+ const {data} = await api.post(`pricelist/drinks/${drink.id}/picture`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
+ drink.uuid = data.uuid
},
async delete_drink_picture(drink: Drink) {
await api.delete(`pricelist/drinks/${drink.id}/picture`);
+ drink.uuid = ''
},
},
});