code refactor
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
<span :class="{ 'tabbar-item-changed': query.maxTime > 0 || query.minTime > 0 }">{{ query.dateType | dateRangeName(allDateRanges, 'Date') | localized }}</span>
|
<span :class="{ 'tabbar-item-changed': query.maxTime > 0 || query.minTime > 0 }">{{ query.dateType | dateRangeName(allDateRanges, 'Date') | localized }}</span>
|
||||||
</f7-link>
|
</f7-link>
|
||||||
<f7-link class="tabbar-text-with-ellipsis" popover-open=".type-popover-menu">
|
<f7-link class="tabbar-text-with-ellipsis" popover-open=".type-popover-menu">
|
||||||
<span :class="{ 'tabbar-item-changed': query.type > 0 }">{{ query.type | typeName('Type') | localized }}</span>
|
<span :class="{ 'tabbar-item-changed': query.type > 0 }">{{ query.type | transactionTypeName($constants.transaction.allTransactionTypes, 'Type') | localized }}</span>
|
||||||
</f7-link>
|
</f7-link>
|
||||||
<f7-link class="tabbar-text-with-ellipsis" popover-open=".category-popover-menu" :class="{ 'disabled': query.type === 1 }">
|
<f7-link class="tabbar-text-with-ellipsis" popover-open=".category-popover-menu" :class="{ 'disabled': query.type === 1 }">
|
||||||
<span :class="{ 'tabbar-item-changed': query.categoryId > 0 }">{{ query.categoryId | optionName(allCategories, null, 'name', $t('Category')) }}</span>
|
<span :class="{ 'tabbar-item-changed': query.categoryId > 0 }">{{ query.categoryId | optionName(allCategories, null, 'name', $t('Category')) }}</span>
|
||||||
@@ -313,7 +313,7 @@
|
|||||||
{{ transaction.category.name }}
|
{{ transaction.category.name }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="transaction.type !== $constants.transaction.allTransactionTypes.ModifyBalance && !transaction.category">
|
<span v-else-if="transaction.type !== $constants.transaction.allTransactionTypes.ModifyBalance && !transaction.category">
|
||||||
{{ transaction.type | transactionTypeName($constants.transaction.allTransactionTypes) | localized }}
|
{{ transaction.type | transactionTypeName($constants.transaction.allTransactionTypes, 'Transaction') | localized }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div slot="text" class="transaction-comment" v-if="transaction.comment">
|
<div slot="text" class="transaction-comment" v-if="transaction.comment">
|
||||||
@@ -421,10 +421,10 @@
|
|||||||
<f7-list accordion-list
|
<f7-list accordion-list
|
||||||
class="no-margin-vertical"
|
class="no-margin-vertical"
|
||||||
v-for="(categories, categoryType) in allPrimaryCategories"
|
v-for="(categories, categoryType) in allPrimaryCategories"
|
||||||
v-show="!query.type || parseInt(categoryType) === query.type - 1"
|
v-show="!query.type || $utilities.categroyTypeToTransactionType(parseInt(categoryType)) === query.type"
|
||||||
:key="categoryType"
|
:key="categoryType"
|
||||||
>
|
>
|
||||||
<f7-list-item divider :title="(parseInt(categoryType) + 1) | typeName('Type') | localized"></f7-list-item>
|
<f7-list-item divider :title="$utilities.categroyTypeToTransactionType(parseInt(categoryType)) | transactionTypeName($constants.transaction.allTransactionTypes, 'Type') | localized"></f7-list-item>
|
||||||
<f7-list-item accordion-item
|
<f7-list-item accordion-item
|
||||||
v-for="category in categories"
|
v-for="category in categories"
|
||||||
:key="category.id"
|
:key="category.id"
|
||||||
@@ -737,7 +737,7 @@ export default {
|
|||||||
if (type && this.query.categoryId) {
|
if (type && this.query.categoryId) {
|
||||||
const category = this.allCategories[this.query.categoryId];
|
const category = this.allCategories[this.query.categoryId];
|
||||||
|
|
||||||
if (category && category.type !== type - 1) {
|
if (category && category.type !== this.$utilities.transactionTypeToCategroyType(type)) {
|
||||||
removeCategoryFilter = true;
|
removeCategoryFilter = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -859,15 +859,18 @@ export default {
|
|||||||
|
|
||||||
return amount;
|
return amount;
|
||||||
},
|
},
|
||||||
transactionTypeName(type, allTransactionTypes) {
|
transactionTypeName(type, allTransactionTypes, defaultName) {
|
||||||
if (type === allTransactionTypes.Income) {
|
switch (type){
|
||||||
return 'Income';
|
case allTransactionTypes.ModifyBalance:
|
||||||
} else if (type === allTransactionTypes.Expense) {
|
return 'Modify Balance';
|
||||||
return 'Expense';
|
case allTransactionTypes.Income:
|
||||||
} else if (type === allTransactionTypes.Transfer) {
|
return 'Income';
|
||||||
return 'Transfer';
|
case allTransactionTypes.Expense:
|
||||||
} else {
|
return 'Expense';
|
||||||
return 'Transaction';
|
case allTransactionTypes.Transfer:
|
||||||
|
return 'Transfer';
|
||||||
|
default:
|
||||||
|
return defaultName;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
transactionDomId(transaction) {
|
transactionDomId(transaction) {
|
||||||
@@ -901,20 +904,6 @@ export default {
|
|||||||
|
|
||||||
return defaultName;
|
return defaultName;
|
||||||
},
|
},
|
||||||
typeName(type, defaultName) {
|
|
||||||
switch (type){
|
|
||||||
case 1:
|
|
||||||
return 'Modify Balance';
|
|
||||||
case 2:
|
|
||||||
return 'Income';
|
|
||||||
case 3:
|
|
||||||
return 'Expense';
|
|
||||||
case 4:
|
|
||||||
return 'Transfer';
|
|
||||||
default:
|
|
||||||
return defaultName;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
categoryListItemCheckedClass(category, queryCategoryId) {
|
categoryListItemCheckedClass(category, queryCategoryId) {
|
||||||
if (category.id === queryCategoryId) {
|
if (category.id === queryCategoryId) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user