From 9fd1d76fd8637ede93d8f7b12c7e2519e221bc42 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 14 Oct 2024 16:52:01 +0200 Subject: [PATCH] supermarket editor done --- vue3/src/components/model_editors/ModelEditorBase.vue | 2 +- vue3/src/components/model_editors/SupermarketEditor.vue | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/vue3/src/components/model_editors/ModelEditorBase.vue b/vue3/src/components/model_editors/ModelEditorBase.vue index fc28ad292..5b7e61713 100644 --- a/vue3/src/components/model_editors/ModelEditorBase.vue +++ b/vue3/src/components/model_editors/ModelEditorBase.vue @@ -15,7 +15,7 @@ {{ $t('Create') }} - {{ $t('Update') }} + {{ $t('Save') }} diff --git a/vue3/src/components/model_editors/SupermarketEditor.vue b/vue3/src/components/model_editors/SupermarketEditor.vue index d63e8a03c..cca537b13 100644 --- a/vue3/src/components/model_editors/SupermarketEditor.vue +++ b/vue3/src/components/model_editors/SupermarketEditor.vue @@ -118,7 +118,7 @@ const emit = defineEmits(['create', 'save', 'delete', 'close']) const {setupState, deleteObject, saveObject, isUpdate, editingObjName, loading, editingObj, modelClass} = useModelEditorFunctions('Supermarket', emit) // object specific data (for selects/display) -const tab = ref("categories") +const tab = ref("supermarket") // all available supermarket categories const supermarketCategories = ref([] as SupermarketCategory[]) @@ -172,7 +172,6 @@ function sortCategoryRelations(startIndex: number = 0) { if (!preventSort.value) { editingObjectSupermarketCategoriesRelations.value.forEach((sc, index) => { - console.log('sorting ', index, startIndex) if (index >= startIndex) { if (index == 0) { sc.order = 0 @@ -204,7 +203,7 @@ function addCategoryRelation(sCR: SupermarketCategoryRelation) { } else { sCR.order = 0 } - } else { + } else if (editingObjectSupermarketCategoriesRelations.value.length > 0) { // item will be added last to list so give it the highest order sCR.order = editingObjectSupermarketCategoriesRelations.value[editingObjectSupermarketCategoriesRelations.value.length - 1].order! + 1 } @@ -221,8 +220,7 @@ function addCategoryRelation(sCR: SupermarketCategoryRelation) { } preventSort.value = false - // TODO reorder existing items after index - + sortCategoryRelations(relationIndex) }).catch((err: any) => { useMessageStore().addError(ErrorMessageType.CREATE_ERROR, err) preventSort.value = false