mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 15:07:33 +08:00
support scheduled transaction (#2)
This commit is contained in:
@@ -67,6 +67,12 @@
|
||||
<span class="nav-item-title">{{ $t('Transaction Templates') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li class="nav-link" v-if="isUserScheduledTransactionEnabled">
|
||||
<router-link to="/schedule/list">
|
||||
<v-icon class="nav-item-icon" :icon="icons.scheduledTransactions"/>
|
||||
<span class="nav-item-title">{{ $t('Scheduled Transactions') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li class="nav-section-title">
|
||||
<div class="title-wrapper">
|
||||
<span class="title-text">{{ $t('Miscellaneous') }}</span>
|
||||
@@ -168,7 +174,7 @@
|
||||
</div>
|
||||
<div class="layout-page-content">
|
||||
<div class="page-content-container">
|
||||
<router-view/>
|
||||
<router-view :key="currentRoutePath" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -188,6 +194,7 @@
|
||||
<script>
|
||||
import { useDisplay } from 'vuetify';
|
||||
import { useTheme } from 'vuetify';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { mapStores } from 'pinia';
|
||||
import { useRootStore } from '@/stores/index.js';
|
||||
@@ -195,6 +202,7 @@ import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import { isUserScheduledTransactionEnabled } from '@/lib/server_settings.js';
|
||||
import { getSystemTheme, setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
|
||||
import {
|
||||
@@ -205,6 +213,7 @@ import {
|
||||
mdiViewDashboardOutline,
|
||||
mdiTagOutline,
|
||||
mdiClipboardTextOutline,
|
||||
mdiClipboardTextClockOutline,
|
||||
mdiChartPieOutline,
|
||||
mdiSwapHorizontal,
|
||||
mdiCogOutline,
|
||||
@@ -235,6 +244,7 @@ export default {
|
||||
categories: mdiViewDashboardOutline,
|
||||
tags: mdiTagOutline,
|
||||
templates: mdiClipboardTextOutline,
|
||||
scheduledTransactions: mdiClipboardTextClockOutline,
|
||||
statistics: mdiChartPieOutline,
|
||||
exchangeRates: mdiSwapHorizontal,
|
||||
settings: mdiCogOutline,
|
||||
@@ -258,6 +268,10 @@ export default {
|
||||
mdAndDown() {
|
||||
return this.display.mdAndDown.value;
|
||||
},
|
||||
currentRoutePath() {
|
||||
const route = useRoute();
|
||||
return route.path;
|
||||
},
|
||||
currentNickName() {
|
||||
return this.userStore.currentUserNickname || this.$t('User');
|
||||
},
|
||||
@@ -280,6 +294,9 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
isUserScheduledTransactionEnabled() {
|
||||
return isUserScheduledTransactionEnabled();
|
||||
},
|
||||
isEnableApplicationLock() {
|
||||
return this.settingsStore.appSettings.applicationLock;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<v-card>
|
||||
<template #title>
|
||||
<div class="title-and-toolbar d-flex align-center">
|
||||
<span>{{ $t('Transaction Templates') }}</span>
|
||||
<span>{{ templateType === allTemplateTypes.Schedule ? $t('Scheduled Transactions') : $t('Transaction Templates') }}</span>
|
||||
<v-btn class="ml-3" color="default" variant="outlined"
|
||||
:disabled="loading || updating" @click="add">{{ $t('Add') }}</v-btn>
|
||||
<v-btn class="ml-3" color="primary" variant="tonal"
|
||||
@@ -60,7 +60,9 @@
|
||||
|
||||
<tbody v-if="!loading && noAvailableTemplate">
|
||||
<tr>
|
||||
<td>{{ $t('No available template. Once you add templates, you can quickly add a new transaction using the dropdown menu of the Add button on the transaction list page') }}</td>
|
||||
<td v-if="templateType === allTemplateTypes.Normal">{{ $t('No available template. Once you add templates, you can quickly add a new transaction using the dropdown menu of the Add button on the transaction list page') }}</td>
|
||||
<td v-if="templateType === allTemplateTypes.Schedule">{{ $t('No available scheduled transactions') }}</td>
|
||||
<td v-else>{{ $t('No available template') }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -79,9 +81,9 @@
|
||||
<v-badge class="right-bottom-icon" color="secondary"
|
||||
location="bottom right" offset-x="8" :icon="icons.hide"
|
||||
v-if="element.hidden">
|
||||
<v-icon size="20" start :icon="icons.text"/>
|
||||
<v-icon size="20" start :icon="templateType === allTemplateTypes.Schedule ? icons.clock : icons.text"/>
|
||||
</v-badge>
|
||||
<v-icon size="20" start :icon="icons.text" v-else-if="!element.hidden"/>
|
||||
<v-icon size="20" start :icon="templateType === allTemplateTypes.Schedule ? icons.clock : icons.text" v-else-if="!element.hidden"/>
|
||||
<span class="transaction-template-name">{{ element.name }}</span>
|
||||
</div>
|
||||
|
||||
@@ -162,13 +164,17 @@ import {
|
||||
mdiDeleteOutline,
|
||||
mdiDrag,
|
||||
mdiDotsVertical,
|
||||
mdiTextBoxOutline
|
||||
mdiTextBoxOutline,
|
||||
mdiClockTimeNineOutline
|
||||
} from '@mdi/js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
EditDialog
|
||||
},
|
||||
props: [
|
||||
'initType',
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
templateType: templateConstants.allTemplateTypes.Normal,
|
||||
@@ -189,7 +195,8 @@ export default {
|
||||
remove: mdiDeleteOutline,
|
||||
drag: mdiDrag,
|
||||
more: mdiDotsVertical,
|
||||
text: mdiTextBoxOutline
|
||||
text: mdiTextBoxOutline,
|
||||
clock: mdiClockTimeNineOutline
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -217,11 +224,15 @@ export default {
|
||||
}
|
||||
|
||||
return count;
|
||||
},
|
||||
allTemplateTypes() {
|
||||
return templateConstants.allTemplateTypes;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const self = this;
|
||||
|
||||
self.templateType = self.initType;
|
||||
self.loading = true;
|
||||
|
||||
self.transactionTemplatesStore.loadAllTemplates({
|
||||
@@ -325,6 +336,7 @@ export default {
|
||||
self.$refs.editDialog.open({
|
||||
id: template.id,
|
||||
currentTemplate: {
|
||||
templateType: template.templateType,
|
||||
name: template.name,
|
||||
type: template.type,
|
||||
categoryId: template.categoryId,
|
||||
@@ -334,7 +346,10 @@ export default {
|
||||
destinationAmount: template.destinationAmount,
|
||||
hideAmount: template.hideAmount,
|
||||
tagIds: template.tagIds,
|
||||
comment: template.comment
|
||||
comment: template.comment,
|
||||
scheduledFrequencyType: template.scheduledFrequencyType,
|
||||
scheduledFrequency: template.scheduledFrequency,
|
||||
utcOffset: template.utcOffset
|
||||
}
|
||||
}).then(result => {
|
||||
if (result && result.message) {
|
||||
|
||||
@@ -195,7 +195,15 @@
|
||||
v-model="transaction.time"
|
||||
@error="showDateTimeError" />
|
||||
</v-col>
|
||||
<v-col cols="12" md="6" v-if="type === 'transaction'">
|
||||
<v-col cols="12" md="6" v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule">
|
||||
<schedule-frequency-select
|
||||
:readonly="mode === 'view'"
|
||||
:disabled="loading || submitting"
|
||||
:label="$t('Scheduled Transaction Frequency')"
|
||||
v-model:type="transaction.scheduledFrequencyType"
|
||||
v-model="transaction.scheduledFrequency" />
|
||||
</v-col>
|
||||
<v-col cols="12" md="6" v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule)">
|
||||
<v-autocomplete
|
||||
class="transaction-edit-timezone"
|
||||
item-title="displayNameWithUtcOffset"
|
||||
@@ -349,6 +357,7 @@ import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import templateConstants from '@/consts/template.js';
|
||||
import logger from '@/lib/logger.js';
|
||||
import {
|
||||
getNameByKeyValue
|
||||
@@ -423,12 +432,18 @@ export default {
|
||||
} else {
|
||||
return 'Transaction Detail';
|
||||
}
|
||||
} else if (this.type === 'template') {
|
||||
} else if (this.type === 'template' && this.transaction.templateType === templateConstants.allTemplateTypes.Normal) {
|
||||
if (this.mode === 'add') {
|
||||
return 'Add Transaction Template';
|
||||
} else if (this.mode === 'edit') {
|
||||
return 'Edit Transaction Template';
|
||||
}
|
||||
} else if (this.type === 'template' && this.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
if (this.mode === 'add') {
|
||||
return 'Add Scheduled Transaction';
|
||||
} else if (this.mode === 'edit') {
|
||||
return 'Edit Scheduled Transaction';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -497,6 +512,9 @@ export default {
|
||||
allCategoryTypes() {
|
||||
return categoryConstants.allCategoryTypes;
|
||||
},
|
||||
allTemplateTypes() {
|
||||
return templateConstants.allTemplateTypes;
|
||||
},
|
||||
allTimezones() {
|
||||
return this.$locale.getAllTimezones(true);
|
||||
},
|
||||
@@ -721,11 +739,22 @@ export default {
|
||||
self.transaction.templateType = options.templateType;
|
||||
}
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
self.transaction.scheduledFrequencyType = templateConstants.allTemplateScheduledFrequencyTypes.Disabled.type;
|
||||
self.transaction.scheduledFrequency = '';
|
||||
}
|
||||
|
||||
if (options && options.id) {
|
||||
if (options.currentTemplate) {
|
||||
self.setTransaction(options.currentTemplate, options, false, false);
|
||||
self.transaction.templateType = options.currentTemplate.templateType;
|
||||
self.transaction.name = options.currentTemplate.name;
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
self.transaction.scheduledFrequencyType = options.currentTemplate.scheduledFrequencyType;
|
||||
self.transaction.scheduledFrequency = options.currentTemplate.scheduledFrequency;
|
||||
self.transaction.utcOffset = options.currentTemplate.utcOffset;
|
||||
}
|
||||
}
|
||||
|
||||
self.mode = 'edit';
|
||||
@@ -772,6 +801,12 @@ export default {
|
||||
self.setTransaction(template, options, false, false);
|
||||
self.transaction.templateType = template.templateType;
|
||||
self.transaction.name = template.name;
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
self.transaction.scheduledFrequencyType = template.scheduledFrequencyType;
|
||||
self.transaction.scheduledFrequency = template.scheduledFrequency;
|
||||
self.transaction.utcOffset = template.utcOffset;
|
||||
}
|
||||
} else {
|
||||
self.setTransaction(null, options, true, true);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@
|
||||
count: displayDataStatistics ? displayDataStatistics.totalTransactionTemplateCount : '-',
|
||||
icon: icons.templates,
|
||||
color: 'secondary-darken-1'
|
||||
},
|
||||
{
|
||||
title: 'Scheduled Transactions',
|
||||
count: displayDataStatistics ? displayDataStatistics.totalScheduledTransactionCount : '-',
|
||||
icon: icons.scheduledTransactions,
|
||||
color: 'success-darken-1'
|
||||
}
|
||||
]">
|
||||
<div class="d-flex align-center">
|
||||
@@ -161,6 +167,7 @@ import {
|
||||
mdiViewDashboardOutline,
|
||||
mdiTagOutline,
|
||||
mdiClipboardTextOutline,
|
||||
mdiClipboardTextClockOutline,
|
||||
mdiAlert
|
||||
} from '@mdi/js';
|
||||
|
||||
@@ -179,6 +186,7 @@ export default {
|
||||
categories: mdiViewDashboardOutline,
|
||||
tags: mdiTagOutline,
|
||||
templates: mdiClipboardTextOutline,
|
||||
scheduledTransactions: mdiClipboardTextClockOutline,
|
||||
alert: mdiAlert
|
||||
}
|
||||
}
|
||||
@@ -197,7 +205,8 @@ export default {
|
||||
totalAccountCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalAccountCount),
|
||||
totalTransactionCategoryCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionCategoryCount),
|
||||
totalTransactionTagCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTagCount),
|
||||
totalTransactionTemplateCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTemplateCount)
|
||||
totalTransactionTemplateCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTemplateCount),
|
||||
totalScheduledTransactionCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalScheduledTransactionCount)
|
||||
};
|
||||
},
|
||||
isDataExportingEnabled() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<f7-list-item :title="$t('Transaction Categories')" link="/category/all"></f7-list-item>
|
||||
<f7-list-item :title="$t('Transaction Tags')" link="/tag/list"></f7-list-item>
|
||||
<f7-list-item :title="$t('Transaction Templates')" link="/template/list"></f7-list-item>
|
||||
<f7-list-item :title="$t('Scheduled Transactions')" link="/schedule/list"></f7-list-item>
|
||||
<f7-list-item :title="$t('Data Management')" link="/user/data/management"></f7-list-item>
|
||||
<f7-list-item :title="$t('Two-Factor Authentication')" link="/user/2fa"></f7-list-item>
|
||||
<f7-list-item :title="$t('Device & Sessions')" link="/user/sessions"></f7-list-item>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<f7-page :ptr="!sortable" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
||||
<f7-navbar>
|
||||
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
|
||||
<f7-nav-title :title="$t('Transaction Templates')"></f7-nav-title>
|
||||
<f7-nav-title :title="templateType === allTemplateTypes.Schedule ? $t('Scheduled Transactions') : $t('Transaction Templates')"></f7-nav-title>
|
||||
<f7-nav-right class="navbar-compact-icons">
|
||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': !templates.length }" v-if="!sortable" @click="showMoreActionSheet = true"></f7-link>
|
||||
<f7-link :href="'/template/add?templateType=' + templateType" icon-f7="plus" v-if="!sortable"></f7-link>
|
||||
@@ -21,7 +21,10 @@
|
||||
|
||||
<f7-list strong inset dividers class="margin-top" v-if="!loading && noAvailableTemplate">
|
||||
<f7-list-item :title="$t('No available template')"
|
||||
:footer="$t('Once you add templates, you can long press the Add button on the home page to quickly add a new transaction')"></f7-list-item>
|
||||
:footer="$t('Once you add templates, you can long press the Add button on the home page to quickly add a new transaction')"
|
||||
v-if="templateType === allTemplateTypes.Normal"></f7-list-item>
|
||||
<f7-list-item :title="$t('No available scheduled transactions')" v-if="templateType === allTemplateTypes.Schedule"></f7-list-item>
|
||||
<f7-list-item :title="$t('No available template')" v-else></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list strong inset dividers sortable class="margin-top template-list"
|
||||
@@ -37,7 +40,7 @@
|
||||
v-show="showHidden || !template.hidden"
|
||||
@taphold="setSortable()">
|
||||
<template #media>
|
||||
<f7-icon f7="doc_plaintext">
|
||||
<f7-icon :f7="templateType === allTemplateTypes.Schedule ? 'clock' : 'doc_plaintext'">
|
||||
<f7-badge color="gray" class="right-bottom-icon" v-if="template.hidden">
|
||||
<f7-icon f7="eye_slash_fill"></f7-icon>
|
||||
</f7-badge>
|
||||
@@ -91,6 +94,7 @@ import { onSwipeoutDeleted } from '@/lib/ui.mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
'f7route',
|
||||
'f7router'
|
||||
],
|
||||
data() {
|
||||
@@ -138,11 +142,20 @@ export default {
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
allTemplateTypes() {
|
||||
return templateConstants.allTemplateTypes;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const self = this;
|
||||
|
||||
if (self.f7route.path === '/template/list') {
|
||||
self.templateType = templateConstants.allTemplateTypes.Normal;
|
||||
} else if (self.f7route.path === '/schedule/list') {
|
||||
self.templateType = templateConstants.allTemplateTypes.Schedule;
|
||||
}
|
||||
|
||||
self.loading = true;
|
||||
|
||||
self.transactionTemplatesStore.loadAllTemplates({
|
||||
@@ -263,7 +276,7 @@ export default {
|
||||
});
|
||||
},
|
||||
edit(template) {
|
||||
this.f7router.navigate('/template/edit?id=' + template.id);
|
||||
this.f7router.navigate(`/template/edit?id=${template.id}&templateType=${template.templateType}`);
|
||||
},
|
||||
hide(template, hidden) {
|
||||
const self = this;
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-title-hide-overflow" header="Category" title="Category Names"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title" header="Account" title="Account Name"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title" header="Transaction Time" title="YYYY/MM/DD HH:mm:ss" v-if="type === 'transaction'"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-title-hide-overflow list-item-no-item-after" header="Transaction Timezone" title="(UTC XX:XX) System Default" link="#" :no-chevron="mode === 'view'" v-if="type === 'transaction'"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title" header="Scheduled Transaction Frequency" title="Every XXXXX" v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-title-hide-overflow list-item-no-item-after" header="Transaction Timezone" title="(UTC XX:XX) System Default" link="#" :no-chevron="mode === 'view'" v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule)"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-title-hide-overflow" header="Geographic Location" title="No Location" v-if="type === 'transaction'"></f7-list-item>
|
||||
<f7-list-item header="Tags">
|
||||
<template #footer>
|
||||
@@ -242,13 +243,28 @@
|
||||
</date-time-selection-sheet>
|
||||
</f7-list-item>
|
||||
|
||||
<f7-list-item
|
||||
class="list-item-with-header-and-title"
|
||||
link="#" no-chevron
|
||||
:class="{ 'readonly': mode === 'view' }"
|
||||
:header="$t('Scheduled Transaction Frequency')"
|
||||
:title="transactionDisplayScheduledFrequency"
|
||||
@click="showTransactionScheduledFrequencySheet = true"
|
||||
v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule"
|
||||
>
|
||||
<schedule-frequency-sheet v-model:show="showTransactionScheduledFrequencySheet"
|
||||
v-model:type="transaction.scheduledFrequencyType"
|
||||
v-model="transaction.scheduledFrequency">
|
||||
</schedule-frequency-sheet>
|
||||
</f7-list-item>
|
||||
|
||||
<f7-list-item
|
||||
:no-chevron="mode === 'view'"
|
||||
class="list-item-with-header-and-title list-item-title-hide-overflow list-item-no-item-after"
|
||||
:class="{ 'readonly': mode === 'view' }"
|
||||
:header="$t('Transaction Timezone')"
|
||||
smart-select :smart-select-params="{ openIn: 'popup', popupPush: true, closeOnSelect: true, scrollToSelectedItem: true, searchbar: true, searchbarPlaceholder: $t('Timezone'), searchbarDisableText: $t('Cancel'), appendSearchbarNotFound: $t('No results'), pageTitle: $t('Transaction Timezone'), popupCloseLinkText: $t('Done') }"
|
||||
v-if="type === 'transaction'"
|
||||
v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule)"
|
||||
>
|
||||
<select v-model="transaction.timeZone">
|
||||
<option :value="timezone.name" :key="timezone.name"
|
||||
@@ -424,6 +440,7 @@ export default {
|
||||
showSourceAccountSheet: false,
|
||||
showDestinationAccountSheet: false,
|
||||
showTransactionDateTimeSheet: false,
|
||||
showTransactionScheduledFrequencySheet: false,
|
||||
showGeoLocationMapSheet: false,
|
||||
showTransactionTagSheet: false
|
||||
};
|
||||
@@ -439,12 +456,18 @@ export default {
|
||||
} else {
|
||||
return 'Transaction Detail';
|
||||
}
|
||||
} else if (this.type === 'template') {
|
||||
} else if (this.type === 'template' && this.transaction.templateType === templateConstants.allTemplateTypes.Normal) {
|
||||
if (this.mode === 'add') {
|
||||
return 'Add Transaction Template';
|
||||
} else if (this.mode === 'edit') {
|
||||
return 'Edit Transaction Template';
|
||||
}
|
||||
} else if (this.type === 'template' && this.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
if (this.mode === 'add') {
|
||||
return 'Add Scheduled Transaction';
|
||||
} else if (this.mode === 'edit') {
|
||||
return 'Edit Scheduled Transaction';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -509,6 +532,9 @@ export default {
|
||||
allCategoryTypes() {
|
||||
return categoryConstants.allCategoryTypes;
|
||||
},
|
||||
allTemplateTypes() {
|
||||
return templateConstants.allTemplateTypes;
|
||||
},
|
||||
allTimezones() {
|
||||
return this.$locale.getAllTimezones(true);
|
||||
},
|
||||
@@ -581,6 +607,44 @@ export default {
|
||||
|
||||
return `${this.$locale.formatUnixTimeToLongDateTime(this.userStore, getActualUnixTimeForStore(this.transaction.time, this.transaction.utcOffset, getBrowserTimezoneOffsetMinutes()))} (UTC${getTimezoneOffset(this.settingsStore.appSettings.timeZone)})`;
|
||||
},
|
||||
transactionDisplayScheduledFrequency() {
|
||||
if (this.type !== 'template') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (this.transaction.scheduledFrequencyType === templateConstants.allTemplateScheduledFrequencyTypes.Disabled.type) {
|
||||
return this.$t('Disabled');
|
||||
}
|
||||
|
||||
const items = this.transaction.scheduledFrequency.split(',');
|
||||
const scheduledFrequencyValues = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i]) {
|
||||
scheduledFrequencyValues.push(parseInt(items[i]));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.transaction.scheduledFrequencyType === templateConstants.allTemplateScheduledFrequencyTypes.Weekly.type) {
|
||||
if (scheduledFrequencyValues.length) {
|
||||
return this.$t('format.misc.everyMultiDaysOfWeek', {
|
||||
days: this.$locale.getMultiWeekdayLongNames(scheduledFrequencyValues)
|
||||
});
|
||||
} else {
|
||||
return this.$t('Weekly');
|
||||
}
|
||||
} else if (this.transaction.scheduledFrequencyType === templateConstants.allTemplateScheduledFrequencyTypes.Monthly.type) {
|
||||
if (scheduledFrequencyValues.length) {
|
||||
return this.$t('format.misc.everyMultiDaysOfMonth', {
|
||||
days: this.$locale.getMultiMonthdayShortNames(scheduledFrequencyValues)
|
||||
});
|
||||
} else {
|
||||
return this.$t('Monthly');
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
transactionDisplayTimezone() {
|
||||
return `UTC${getUtcOffsetByUtcOffsetMinutes(this.transaction.utcOffset)}`;
|
||||
},
|
||||
@@ -750,6 +814,11 @@ export default {
|
||||
self.transaction.templateType = parseInt(query.templateType);
|
||||
}
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
self.transaction.scheduledFrequencyType = templateConstants.allTemplateScheduledFrequencyTypes.Disabled.type;
|
||||
self.transaction.scheduledFrequency = '';
|
||||
}
|
||||
|
||||
if (query.id) {
|
||||
if (self.mode === 'edit') {
|
||||
self.editId = query.id;
|
||||
@@ -820,6 +889,12 @@ export default {
|
||||
self.transaction.id = template.id;
|
||||
self.transaction.templateType = template.templateType;
|
||||
self.transaction.name = template.name;
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
self.transaction.scheduledFrequencyType = template.scheduledFrequencyType;
|
||||
self.transaction.scheduledFrequency = template.scheduledFrequency;
|
||||
self.transaction.utcOffset = template.utcOffset;
|
||||
}
|
||||
}
|
||||
|
||||
self.loading = false;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<f7-list-item title="Transaction Categories" after="Count"></f7-list-item>
|
||||
<f7-list-item title="Transaction Tags" after="Count"></f7-list-item>
|
||||
<f7-list-item title="Transaction Templates" after="Count"></f7-list-item>
|
||||
<f7-list-item title="Scheduled Transactions" after="Count"></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical" v-else-if="!loading">
|
||||
@@ -16,6 +17,7 @@
|
||||
<f7-list-item :title="$t('Transaction Categories')" :after="displayDataStatistics.totalTransactionCategoryCount"></f7-list-item>
|
||||
<f7-list-item :title="$t('Transaction Tags')" :after="displayDataStatistics.totalTransactionTagCount"></f7-list-item>
|
||||
<f7-list-item :title="$t('Transaction Templates')" :after="displayDataStatistics.totalTransactionTemplateCount"></f7-list-item>
|
||||
<f7-list-item :title="$t('Scheduled Transactions')" :after="displayDataStatistics.totalScheduledTransactionCount"></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical" :class="{ 'disabled': loading }">
|
||||
@@ -109,7 +111,8 @@ export default {
|
||||
totalAccountCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalAccountCount),
|
||||
totalTransactionCategoryCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionCategoryCount),
|
||||
totalTransactionTagCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTagCount),
|
||||
totalTransactionTemplateCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTemplateCount)
|
||||
totalTransactionTemplateCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTemplateCount),
|
||||
totalScheduledTransactionCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalScheduledTransactionCount)
|
||||
};
|
||||
},
|
||||
isDataExportingEnabled() {
|
||||
|
||||
Reference in New Issue
Block a user