mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 17:54:30 +08:00
code refactor
This commit is contained in:
@@ -602,6 +602,31 @@ function getAllStatisticsSortingTypes(translateFn) {
|
|||||||
return allSortingTypes;
|
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) {
|
function getDisplayCurrency(value, currencyCode, options, translateFn) {
|
||||||
if (!isNumber(value) && !isString(value)) {
|
if (!isNumber(value) && !isString(value)) {
|
||||||
return value;
|
return value;
|
||||||
@@ -870,6 +895,7 @@ export function i18nFunctions(i18nGlobal) {
|
|||||||
getAllDateRanges: (includeCustom) => getAllDateRanges(includeCustom, i18nGlobal.t),
|
getAllDateRanges: (includeCustom) => getAllDateRanges(includeCustom, i18nGlobal.t),
|
||||||
getAllStatisticsChartDataTypes: () => getAllStatisticsChartDataTypes(i18nGlobal.t),
|
getAllStatisticsChartDataTypes: () => getAllStatisticsChartDataTypes(i18nGlobal.t),
|
||||||
getAllStatisticsSortingTypes: () => getAllStatisticsSortingTypes(i18nGlobal.t),
|
getAllStatisticsSortingTypes: () => getAllStatisticsSortingTypes(i18nGlobal.t),
|
||||||
|
getAllTransactionEditScopeTypes: () => getAllTransactionEditScopeTypes(i18nGlobal.t),
|
||||||
getDisplayCurrency: (value, currencyCode, options) => getDisplayCurrency(value, currencyCode, options, i18nGlobal.t),
|
getDisplayCurrency: (value, currencyCode, options) => getDisplayCurrency(value, currencyCode, options, i18nGlobal.t),
|
||||||
setLanguage: (locale, force) => setLanguage(i18nGlobal, locale, force),
|
setLanguage: (locale, force) => setLanguage(i18nGlobal, locale, force),
|
||||||
initLocale: (lastUserLanguage, timezone) => initLocale(i18nGlobal, lastUserLanguage, timezone)
|
initLocale: (lastUserLanguage, timezone) => initLocale(i18nGlobal, lastUserLanguage, timezone)
|
||||||
|
|||||||
@@ -81,8 +81,8 @@
|
|||||||
|
|
||||||
<v-col cols="12" md="6">
|
<v-col cols="12" md="6">
|
||||||
<v-select
|
<v-select
|
||||||
item-title="name"
|
item-title="displayName"
|
||||||
item-value="value"
|
item-value="type"
|
||||||
persistent-placeholder
|
persistent-placeholder
|
||||||
:disabled="loading || saving"
|
:disabled="loading || saving"
|
||||||
:label="$t('Editable Transaction Scope')"
|
:label="$t('Editable Transaction Scope')"
|
||||||
@@ -297,30 +297,7 @@ export default {
|
|||||||
return this.$locale.getAllShortTimeFormats();
|
return this.$locale.getAllShortTimeFormats();
|
||||||
},
|
},
|
||||||
allTransactionEditScopeTypes() {
|
allTransactionEditScopeTypes() {
|
||||||
const self = this;
|
return this.$locale.getAllTransactionEditScopeTypes();
|
||||||
|
|
||||||
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')
|
|
||||||
}];
|
|
||||||
},
|
},
|
||||||
currentUserAvatarProvider() {
|
currentUserAvatarProvider() {
|
||||||
if (this.oldProfile.avatarProvider === 'gravatar') {
|
if (this.oldProfile.avatarProvider === 'gravatar') {
|
||||||
|
|||||||
@@ -96,13 +96,13 @@
|
|||||||
<f7-list-item
|
<f7-list-item
|
||||||
class="list-item-with-header-and-title list-item-no-item-after"
|
class="list-item-with-header-and-title list-item-no-item-after"
|
||||||
:header="$t('Editable Transaction Scope')"
|
: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') }"
|
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">
|
<select v-model="newProfile.transactionEditScope">
|
||||||
<option :value="option.value"
|
<option :value="option.type"
|
||||||
:key="option.value"
|
:key="option.type"
|
||||||
v-for="option in allTransactionEditScopeTypes">{{ $t(option.name) }}</option>
|
v-for="option in allTransactionEditScopeTypes">{{ option.displayName }}</option>
|
||||||
</select>
|
</select>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
|
|
||||||
@@ -304,28 +304,7 @@ export default {
|
|||||||
return this.$locale.getAllShortTimeFormats();
|
return this.$locale.getAllShortTimeFormats();
|
||||||
},
|
},
|
||||||
allTransactionEditScopeTypes() {
|
allTransactionEditScopeTypes() {
|
||||||
return [{
|
return this.$locale.getAllTransactionEditScopeTypes();
|
||||||
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'
|
|
||||||
}];
|
|
||||||
},
|
},
|
||||||
currentLanguageName() {
|
currentLanguageName() {
|
||||||
for (let i = 0; i < this.allLanguages.length; i++) {
|
for (let i = 0; i < this.allLanguages.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user