code refactor
This commit is contained in:
@@ -5,11 +5,43 @@ const allTransactionTypes = {
|
||||
Transfer: 4
|
||||
};
|
||||
|
||||
const allTransactionEditScopeTypes = {
|
||||
None: {
|
||||
type: 0,
|
||||
name: 'None'
|
||||
},
|
||||
All: {
|
||||
type: 1,
|
||||
name: 'All'
|
||||
},
|
||||
TodayOrLater: {
|
||||
type: 2,
|
||||
name: 'Today or later'
|
||||
},
|
||||
Recent24HoursOrLater: {
|
||||
type: 3,
|
||||
name: 'Recent 24 hours or later'
|
||||
},
|
||||
ThisWeekOrLater: {
|
||||
type: 4,
|
||||
name: 'This week or later'
|
||||
},
|
||||
ThisMonthOrLater: {
|
||||
type: 5,
|
||||
name: 'This month or later'
|
||||
},
|
||||
ThisYearOrLater: {
|
||||
type: 6,
|
||||
name: 'This year or later'
|
||||
}
|
||||
};
|
||||
|
||||
const minAmountNumber = -99999999999; // -999999999.99
|
||||
const maxAmountNumber = 99999999999; // 999999999.99
|
||||
|
||||
export default {
|
||||
allTransactionTypes: allTransactionTypes,
|
||||
allTransactionEditScopeTypes: allTransactionEditScopeTypes,
|
||||
minAmountNumber: minAmountNumber,
|
||||
maxAmountNumber: maxAmountNumber,
|
||||
};
|
||||
|
||||
+17
-22
@@ -7,6 +7,7 @@ import timezoneConstants from '@/consts/timezone.js';
|
||||
import currencyConstants from '@/consts/currency.js';
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import statisticsConstants from '@/consts/statistics.js';
|
||||
import apiConstants from '@/consts/api.js';
|
||||
|
||||
@@ -1029,28 +1030,22 @@ function getAllStatisticsSortingTypes(translateFn) {
|
||||
}
|
||||
|
||||
function getAllTransactionEditScopeTypes(translateFn) {
|
||||
return [{
|
||||
type: 0,
|
||||
displayName: translateFn('None')
|
||||
}, {
|
||||
type: 1,
|
||||
displayName: translateFn('All')
|
||||
}, {
|
||||
type: 2,
|
||||
displayName: translateFn('Today or later')
|
||||
}, {
|
||||
type: 3,
|
||||
displayName: translateFn('Recent 24 hours or later')
|
||||
}, {
|
||||
type: 4,
|
||||
displayName: translateFn('This week or later')
|
||||
}, {
|
||||
type: 5,
|
||||
displayName: translateFn('This month or later')
|
||||
}, {
|
||||
type: 6,
|
||||
displayName: translateFn('This year or later')
|
||||
}];
|
||||
const allEditScopeTypes = [];
|
||||
|
||||
for (const typeName in transactionConstants.allTransactionEditScopeTypes) {
|
||||
if (!Object.prototype.hasOwnProperty.call(transactionConstants.allTransactionEditScopeTypes, typeName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const editScopeType = transactionConstants.allTransactionEditScopeTypes[typeName];
|
||||
|
||||
allEditScopeTypes.push({
|
||||
type: editScopeType.type,
|
||||
displayName: translateFn(editScopeType.name)
|
||||
});
|
||||
}
|
||||
|
||||
return allEditScopeTypes;
|
||||
}
|
||||
|
||||
function getAllTransactionDefaultCategories(categoryType, locale, translateFn) {
|
||||
|
||||
Reference in New Issue
Block a user