+
{{ $t("Supermarkets") }}
-
+ {
+ return { ...x, editmode: false }
+ })
+ "
+ >
+
{{ s.name }}
+
+
+
+
@@ -154,12 +176,20 @@
+
{{ $t("Shopping_Categories") }}
-
+
@@ -200,6 +230,9 @@
:border-variant="new_supermarket.editmode ? 'success' : ''"
>
{{ categoryName(c) }}
+
+
+
@@ -218,6 +251,9 @@
{{ categoryName(c) }}
+
+
+
@@ -708,6 +744,34 @@ export default {
StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE)
})
},
+ deleteSupermarket: function (s) {
+ let api = new ApiApiFactory()
+ api.destroySupermarket(s.id)
+ .then(() => {
+ this.getSupermarkets()
+ StandardToasts.makeStandardToast(StandardToasts.SUCCESS_DELETE)
+ })
+ .catch((err) => {
+ console.log(err)
+ StandardToasts.makeStandardToast(StandardToasts.FAIL_DELETE)
+ })
+ },
+ deleteCategory: function (c) {
+ // could be category relation or a catory
+ let c_id = c?.category?.id ?? c.id
+ let api = new ApiApiFactory()
+ api.destroySupermarketCategory(c_id)
+ .then(() => {
+ this.getSupermarkets()
+ this.getShoppingCategories()
+ this.new_supermarket.value.category_to_supermarket = this.new_supermarket.value.category_to_supermarket.filter((x) => x.category.id != c_id)
+ StandardToasts.makeStandardToast(StandardToasts.SUCCESS_DELETE)
+ })
+ .catch((err) => {
+ console.log(err)
+ StandardToasts.makeStandardToast(StandardToasts.FAIL_DELETE)
+ })
+ },
resetFilters: function () {
this.selected_supermarket = undefined
this.supermarket_categories_only = this.settings.filter_to_supermarket