-
@@ -45,7 +48,10 @@
{{ $t('Unit') }} |
{{ $t('Food') }} |
{{ $t('Note') }} |
- {{ $t('Save') }} |
+
+
+
+ |
@@ -56,10 +62,11 @@
|
-
+
|
-
|
-
|
-
+
|
-
+
+
|
@@ -106,13 +114,14 @@ import {ApiApiFactory} from "@/utils/openapi/api";
import GenericMultiselect from "@/components/GenericMultiselect";
import GenericModalForm from "@/components/Modals/GenericModalForm";
import LoadingSpinner from "@/components/LoadingSpinner";
+import BetaWarning from "@/components/BetaWarning";
Vue.use(BootstrapVue)
export default {
name: "IngredientEditorView",
mixins: [ApiMixin],
- components: {LoadingSpinner, GenericMultiselect, GenericModalForm},
+ components: {BetaWarning, LoadingSpinner, GenericMultiselect, GenericModalForm},
data() {
return {
ingredients: [],
@@ -154,11 +163,24 @@ export default {
}
},
updateIngredient: function (i) {
- let apiClient = new ApiApiFactory()
- apiClient.updateIngredient(i.id, i).then(r => {
- StandardToasts.makeStandardToast(StandardToasts.SUCCESS_UPDATE)
- }).catch((r, e) => {
- StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE)
+ let update_list = []
+ if (i === undefined) {
+ this.ingredients.forEach(x => {
+ if (x.changed) {
+ update_list.push(x)
+ }
+ })
+ } else {
+ update_list = [i]
+ }
+
+ update_list.forEach(i => {
+ let apiClient = new ApiApiFactory()
+ apiClient.updateIngredient(i.id, i).then(r => {
+ this.$set(i, 'changed', false)
+ }).catch((r, e) => {
+ StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE)
+ })
})
},
},