diff --git a/src/views/desktop/transactions/list/dialogs/ImportDialog.vue b/src/views/desktop/transactions/list/dialogs/ImportDialog.vue index e4181e35..8ab5e4ba 100644 --- a/src/views/desktop/transactions/list/dialogs/ImportDialog.vue +++ b/src/views/desktop/transactions/list/dialogs/ImportDialog.vue @@ -13,44 +13,44 @@ @@ -210,8 +210,7 @@ :custom-selection-secondary-text="getSecondaryCategoryName(item.categoryId, allCategories[allCategoryTypes.Expense])" :placeholder="$t('Category')" :items="allCategories[allCategoryTypes.Expense]" - v-model="item.categoryId" - @update:model-value="updateTransactionData(item)"> + v-model="item.categoryId">
@@ -228,8 +227,7 @@ :custom-selection-secondary-text="getSecondaryCategoryName(item.categoryId, allCategories[allCategoryTypes.Income])" :placeholder="$t('Category')" :items="allCategories[allCategoryTypes.Income]" - v-model="item.categoryId" - @update:model-value="updateTransactionData(item)"> + v-model="item.categoryId">
@@ -246,8 +244,7 @@ :custom-selection-secondary-text="getSecondaryCategoryName(item.categoryId, allCategories[allCategoryTypes.Transfer])" :placeholder="$t('Category')" :items="allCategories[allCategoryTypes.Transfer]" - v-model="item.categoryId" - @update:model-value="updateTransactionData(item)"> + v-model="item.categoryId">
@@ -284,8 +281,7 @@ :custom-selection-primary-text="getSourceAccountDisplayName(item)" :placeholder="getSourceAccountTitle(item)" :items="allVisibleCategorizedAccounts" - v-model="item.sourceAccountId" - @update:model-value="updateTransactionData(item)"> + v-model="item.sourceAccountId"> + v-if="item.type === allTransactionTypes.Transfer"> @@ -338,14 +333,13 @@ :placeholder="$t('None')" :items="allTags" :no-data-text="$t('No available tag')" - v-model="item.tagIds" - @update:model-value="updateTransactionData(item)" + v-model="editingTags" > @@ -439,7 +433,7 @@ {{ $t('Next') }} - {{ $t('Import') }} @@ -523,6 +517,7 @@ export default { importFile: null, importTransactions: null, editingTransaction: null, + editingTags: [], currentPage: 1, countPerPage: 10, importedCount: null, @@ -804,6 +799,7 @@ export default { this.importFile = null; this.importTransactions = null; this.editingTransaction = null; + this.editingTags = []; this.currentPage = 1; this.countPerPage = 10; } @@ -816,6 +812,7 @@ export default { self.importFile = null; self.importTransactions = null; self.editingTransaction = null; + self.editingTags = []; self.currentPage = 1; self.countPerPage = 10; self.showState = true; @@ -885,6 +882,7 @@ export default { self.importTransactions = parsedTransactions; self.editingTransaction = null; + self.editingTags = []; self.currentPage = 1; if (self.importTransactions && self.importTransactions.length >= 0 && self.importTransactions.length < 10) { @@ -905,6 +903,11 @@ export default { }, submit() { const self = this; + + if (self.editingTransaction) { + return; + } + const transactions = []; for (let i = 0; i < self.importTransactions.length; i++) { @@ -927,6 +930,7 @@ export default { count: transactions.length }).then(() => { self.editingTransaction = null; + self.editingTags = []; self.submitting = true; self.transactionsStore.importTransactions({ @@ -1009,10 +1013,17 @@ export default { } }, editTransaction(transaction) { + if (this.editingTransaction) { + this.editingTransaction.tagIds = this.editingTags; + this.updateTransactionData(this.editingTransaction); + } + if (this.editingTransaction === transaction) { + this.editingTags = []; this.editingTransaction = null; } else { this.editingTransaction = transaction; + this.editingTags = this.editingTransaction.tagIds; } }, updateTransactionData(transaction) { @@ -1029,6 +1040,10 @@ export default { showBatchReplaceDialog(type) { const self = this; + if (self.editingTransaction) { + return; + } + self.$refs.batchReplaceDialog.open({ mode: 'batchReplace', type: type @@ -1089,6 +1104,10 @@ export default { showReplaceInvalidItemDialog(type, invalidItems) { const self = this; + if (self.editingTransaction) { + return; + } + self.$refs.batchReplaceDialog.open({ mode: 'replaceInvalidItems', type: type, @@ -1283,16 +1302,16 @@ export default { return true; }, - isTagValid(transaction, tagIndex) { - if (!transaction || !transaction.tagIds || !transaction.tagIds[tagIndex]) { + isTagValid(tagIds, tagIndex) { + if (!tagIds || !tagIds[tagIndex]) { return false; } - if (transaction.tagIds[tagIndex] === '0') { + if (tagIds[tagIndex] === '0') { return false; } - const tagId = transaction.tagIds[tagIndex]; + const tagId = tagIds[tagIndex]; return !!this.allTagsMap[tagId]; }, getDisplayDateTime(transaction) {