mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
code refactor
This commit is contained in:
@@ -602,6 +602,31 @@ function getAllStatisticsSortingTypes(translateFn) {
|
||||
return allSortingTypes;
|
||||
}
|
||||
|
||||
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')
|
||||
}];
|
||||
}
|
||||
|
||||
function getDisplayCurrency(value, currencyCode, options, translateFn) {
|
||||
if (!isNumber(value) && !isString(value)) {
|
||||
return value;
|
||||
@@ -870,6 +895,7 @@ export function i18nFunctions(i18nGlobal) {
|
||||
getAllDateRanges: (includeCustom) => getAllDateRanges(includeCustom, i18nGlobal.t),
|
||||
getAllStatisticsChartDataTypes: () => getAllStatisticsChartDataTypes(i18nGlobal.t),
|
||||
getAllStatisticsSortingTypes: () => getAllStatisticsSortingTypes(i18nGlobal.t),
|
||||
getAllTransactionEditScopeTypes: () => getAllTransactionEditScopeTypes(i18nGlobal.t),
|
||||
getDisplayCurrency: (value, currencyCode, options) => getDisplayCurrency(value, currencyCode, options, i18nGlobal.t),
|
||||
setLanguage: (locale, force) => setLanguage(i18nGlobal, locale, force),
|
||||
initLocale: (lastUserLanguage, timezone) => initLocale(i18nGlobal, lastUserLanguage, timezone)
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
|
||||
<v-col cols="12" md="6">
|
||||
<v-select
|
||||
item-title="name"
|
||||
item-value="value"
|
||||
item-title="displayName"
|
||||
item-value="type"
|
||||
persistent-placeholder
|
||||
:disabled="loading || saving"
|
||||
:label="$t('Editable Transaction Scope')"
|
||||
@@ -297,30 +297,7 @@ export default {
|
||||
return this.$locale.getAllShortTimeFormats();
|
||||
},
|
||||
allTransactionEditScopeTypes() {
|
||||
const self = this;
|
||||
|
||||
return [{
|
||||
value: 0,
|
||||
name: self.$t('None')
|
||||
}, {
|
||||
value: 1,
|
||||
name: self.$t('All')
|
||||
}, {
|
||||
value: 2,
|
||||
name: self.$t('Today or later')
|
||||
}, {
|
||||
value: 3,
|
||||
name: self.$t('Recent 24 hours or later')
|
||||
}, {
|
||||
value: 4,
|
||||
name: self.$t('This week or later')
|
||||
}, {
|
||||
value: 5,
|
||||
name: self.$t('This month or later')
|
||||
}, {
|
||||
value: 6,
|
||||
name: self.$t('This year or later')
|
||||
}];
|
||||
return this.$locale.getAllTransactionEditScopeTypes();
|
||||
},
|
||||
currentUserAvatarProvider() {
|
||||
if (this.oldProfile.avatarProvider === 'gravatar') {
|
||||
|
||||
@@ -96,13 +96,13 @@
|
||||
<f7-list-item
|
||||
class="list-item-with-header-and-title list-item-no-item-after"
|
||||
:header="$t('Editable Transaction Scope')"
|
||||
:title="$t(getNameByKeyValue(allTransactionEditScopeTypes, newProfile.transactionEditScope, 'value', 'name'))"
|
||||
:title="getNameByKeyValue(allTransactionEditScopeTypes, newProfile.transactionEditScope, 'type', 'displayName')"
|
||||
smart-select :smart-select-params="{ openIn: 'popup', popupPush: true, closeOnSelect: true, scrollToSelectedItem: true, searchbar: true, searchbarPlaceholder: $t('Date Range'), searchbarDisableText: $t('Cancel'), appendSearchbarNotFound: $t('No results'), pageTitle: $t('Editable Transaction Scope'), popupCloseLinkText: $t('Done') }"
|
||||
>
|
||||
<select v-model="newProfile.transactionEditScope">
|
||||
<option :value="option.value"
|
||||
:key="option.value"
|
||||
v-for="option in allTransactionEditScopeTypes">{{ $t(option.name) }}</option>
|
||||
<option :value="option.type"
|
||||
:key="option.type"
|
||||
v-for="option in allTransactionEditScopeTypes">{{ option.displayName }}</option>
|
||||
</select>
|
||||
</f7-list-item>
|
||||
|
||||
@@ -304,28 +304,7 @@ export default {
|
||||
return this.$locale.getAllShortTimeFormats();
|
||||
},
|
||||
allTransactionEditScopeTypes() {
|
||||
return [{
|
||||
value: 0,
|
||||
name: 'None'
|
||||
}, {
|
||||
value: 1,
|
||||
name: 'All'
|
||||
}, {
|
||||
value: 2,
|
||||
name: 'Today or later'
|
||||
}, {
|
||||
value: 3,
|
||||
name: 'Recent 24 hours or later'
|
||||
}, {
|
||||
value: 4,
|
||||
name: 'This week or later'
|
||||
}, {
|
||||
value: 5,
|
||||
name: 'This month or later'
|
||||
}, {
|
||||
value: 6,
|
||||
name: 'This year or later'
|
||||
}];
|
||||
return this.$locale.getAllTransactionEditScopeTypes();
|
||||
},
|
||||
currentLanguageName() {
|
||||
for (let i = 0; i < this.allLanguages.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user