add subtypes to imported file types

This commit is contained in:
MaysWind
2024-10-20 10:05:44 +08:00
parent 45faa269a4
commit a23a194660
5 changed files with 66 additions and 20 deletions
@@ -78,6 +78,18 @@
/>
</v-col>
<v-col cols="12" md="12" v-if="allFileSubTypes">
<v-select
item-title="displayName"
item-value="type"
:disabled="submitting"
:label="$t('Type')"
:placeholder="$t('Type')"
:items="allFileSubTypes"
v-model="fileSubType"
/>
</v-col>
<v-col cols="12" md="12">
<v-text-field
readonly
@@ -523,6 +535,7 @@ export default {
clientSessionId: '',
currentStep: 'uploadFile',
fileType: 'ezbookkeeping_csv',
fileSubType: '',
importFile: null,
importTransactions: null,
editingTransaction: null,
@@ -579,6 +592,9 @@ export default {
allSupportedImportFileTypes() {
return this.$locale.getAllSupportedImportFileTypes();
},
allFileSubTypes() {
return getNameByKeyValue(this.allSupportedImportFileTypes, this.fileType, 'type', 'subTypes');
},
allTransactionTypes() {
return transactionConstants.allTransactionTypes;
},
@@ -826,6 +842,10 @@ export default {
},
watch: {
fileType: function () {
if (this.allFileSubTypes && this.allFileSubTypes.length) {
this.fileSubType = this.allFileSubTypes[0].type;
}
this.importFile = null;
this.importTransactions = null;
this.editingTransaction = null;
@@ -893,8 +913,14 @@ export default {
const self = this;
self.submitting = true;
let fileType = self.fileType;
if (self.allFileSubTypes) {
fileType = self.fileSubType;
}
self.transactionsStore.parseImportTransaction({
fileType: self.fileType,
fileType: fileType,
importFile: self.importFile
}).then(response => {
const parsedTransactions = response.items;