duplicate transaction with time / geographic location (#36)
This commit is contained in:
@@ -1521,6 +1521,9 @@
|
||||
"Swap Account": "Konto tauschen",
|
||||
"Swap Amount": "Betrag tauschen",
|
||||
"Swap Account and Amount": "Konto und Betrag tauschen",
|
||||
"Duplicate (With Time)": "Duplicate (With Time)",
|
||||
"Duplicate (With Geographic Location)": "Duplicate (With Geographic Location)",
|
||||
"Duplicate (With Time and Geographic Location)": "Duplicate (With Time and Geographic Location)",
|
||||
"Category": "Kategorie",
|
||||
"Multiple Categories": "Mehrere Kategorien",
|
||||
"Account": "Konto",
|
||||
|
||||
@@ -1521,6 +1521,9 @@
|
||||
"Swap Account": "Swap Account",
|
||||
"Swap Amount": "Swap Amount",
|
||||
"Swap Account and Amount": "Swap Account and Amount",
|
||||
"Duplicate (With Time)": "Duplicate (With Time)",
|
||||
"Duplicate (With Geographic Location)": "Duplicate (With Geographic Location)",
|
||||
"Duplicate (With Time and Geographic Location)": "Duplicate (With Time and Geographic Location)",
|
||||
"Category": "Category",
|
||||
"Multiple Categories": "Multiple Categories",
|
||||
"Account": "Account",
|
||||
|
||||
@@ -1521,6 +1521,9 @@
|
||||
"Swap Account": "Intercambiar cuenta",
|
||||
"Swap Amount": "Intercambiar importe",
|
||||
"Swap Account and Amount": "Intercambiar Cuenta e Importe",
|
||||
"Duplicate (With Time)": "Duplicate (With Time)",
|
||||
"Duplicate (With Geographic Location)": "Duplicate (With Geographic Location)",
|
||||
"Duplicate (With Time and Geographic Location)": "Duplicate (With Time and Geographic Location)",
|
||||
"Category": "Categoría",
|
||||
"Multiple Categories": "Múltiples categorías",
|
||||
"Account": "Cuenta",
|
||||
|
||||
@@ -1521,6 +1521,9 @@
|
||||
"Swap Account": "Поменять счет",
|
||||
"Swap Amount": "Поменять сумму",
|
||||
"Swap Account and Amount": "Поменять счет и сумму",
|
||||
"Duplicate (With Time)": "Duplicate (With Time)",
|
||||
"Duplicate (With Geographic Location)": "Duplicate (With Geographic Location)",
|
||||
"Duplicate (With Time and Geographic Location)": "Duplicate (With Time and Geographic Location)",
|
||||
"Category": "Категория",
|
||||
"Multiple Categories": "Несколько категорий",
|
||||
"Account": "Счет",
|
||||
|
||||
@@ -1521,6 +1521,9 @@
|
||||
"Swap Account": "Hoán đổi tài khoản",
|
||||
"Swap Amount": "Hoán đổi số tiền",
|
||||
"Swap Account and Amount": "Hoán đổi tài khoản và số tiền",
|
||||
"Duplicate (With Time)": "Duplicate (With Time)",
|
||||
"Duplicate (With Geographic Location)": "Duplicate (With Geographic Location)",
|
||||
"Duplicate (With Time and Geographic Location)": "Duplicate (With Time and Geographic Location)",
|
||||
"Category": "Danh mục",
|
||||
"Multiple Categories": "Nhiều danh mục",
|
||||
"Account": "Tài khoản",
|
||||
|
||||
@@ -1521,6 +1521,9 @@
|
||||
"Swap Account": "交换账户",
|
||||
"Swap Amount": "交换金额",
|
||||
"Swap Account and Amount": "交换账户和金额",
|
||||
"Duplicate (With Time)": "复制 (含时间)",
|
||||
"Duplicate (With Geographic Location)": "复制 (含地理位置)",
|
||||
"Duplicate (With Time and Geographic Location)": "复制 (含时间和地理位置)",
|
||||
"Category": "分类",
|
||||
"Multiple Categories": "多个分类",
|
||||
"Account": "账户",
|
||||
|
||||
@@ -382,9 +382,26 @@
|
||||
{{ tt(saveButtonTitle) }}
|
||||
<v-progress-circular indeterminate size="22" class="ml-2" v-if="submitting"></v-progress-circular>
|
||||
</v-btn>
|
||||
<v-btn variant="tonal" :disabled="loading || submitting"
|
||||
v-if="mode === TransactionEditPageMode.View && transaction.type !== TransactionType.ModifyBalance"
|
||||
@click="duplicate">{{ tt('Duplicate') }}</v-btn>
|
||||
<v-btn-group variant="tonal" density="comfortable"
|
||||
v-if="mode === TransactionEditPageMode.View && transaction.type !== TransactionType.ModifyBalance">
|
||||
<v-btn :disabled="loading || submitting"
|
||||
@click="duplicate(false, false)">{{ tt('Duplicate') }}</v-btn>
|
||||
<v-btn density="compact" :disabled="loading || submitting" :icon="true">
|
||||
<v-icon :icon="mdiMenuDown" size="24" />
|
||||
<v-menu activator="parent">
|
||||
<v-list>
|
||||
<v-list-item :title="tt('Duplicate (With Time)')"
|
||||
@click="duplicate(true, false)"></v-list-item>
|
||||
<v-list-item :title="tt('Duplicate (With Geographic Location)')"
|
||||
@click="duplicate(false, true)"
|
||||
v-if="transaction.geoLocation"></v-list-item>
|
||||
<v-list-item :title="tt('Duplicate (With Time and Geographic Location)')"
|
||||
@click="duplicate(true, true)"
|
||||
v-if="transaction.geoLocation"></v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</v-btn>
|
||||
</v-btn-group>
|
||||
<v-btn color="warning" variant="tonal" :disabled="loading || submitting"
|
||||
v-if="mode === TransactionEditPageMode.View && originalTransactionEditable && transaction.type !== TransactionType.ModifyBalance"
|
||||
@click="edit">{{ tt('Edit') }}</v-btn>
|
||||
@@ -461,6 +478,7 @@ import {
|
||||
mdiEyeOutline,
|
||||
mdiSwapHorizontal,
|
||||
mdiPound,
|
||||
mdiMenuDown,
|
||||
mdiImagePlusOutline,
|
||||
mdiTrashCanOutline,
|
||||
mdiFullscreen
|
||||
@@ -863,7 +881,7 @@ function save(): void {
|
||||
}
|
||||
}
|
||||
|
||||
function duplicate(): void {
|
||||
function duplicate(withTime?: boolean, withGeoLocation?: boolean): void {
|
||||
if (props.type !== TransactionEditPageType.Transaction || mode.value !== TransactionEditPageMode.View) {
|
||||
return;
|
||||
}
|
||||
@@ -872,10 +890,17 @@ function duplicate(): void {
|
||||
duplicateFromId.value = transaction.value.id;
|
||||
activeTab.value = 'basicInfo';
|
||||
transaction.value.id = '';
|
||||
transaction.value.time = getCurrentUnixTime();
|
||||
transaction.value.timeZone = settingsStore.appSettings.timeZone;
|
||||
transaction.value.utcOffset = getTimezoneOffsetMinutes(transaction.value.timeZone);
|
||||
transaction.value.removeGeoLocation();
|
||||
|
||||
if (!withTime) {
|
||||
transaction.value.time = getCurrentUnixTime();
|
||||
transaction.value.timeZone = settingsStore.appSettings.timeZone;
|
||||
transaction.value.utcOffset = getTimezoneOffsetMinutes(transaction.value.timeZone);
|
||||
}
|
||||
|
||||
if (!withGeoLocation) {
|
||||
transaction.value.removeGeoLocation();
|
||||
}
|
||||
|
||||
transaction.value.clearPictures();
|
||||
mode.value = TransactionEditPageMode.Add;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<f7-nav-left :back-link="tt('Back')"></f7-nav-left>
|
||||
<f7-nav-title :title="tt(title)"></f7-nav-title>
|
||||
<f7-nav-right>
|
||||
<f7-link icon-f7="ellipsis" @click="showMoreActionSheet = true" v-if="mode !== TransactionEditPageMode.View"></f7-link>
|
||||
<f7-link icon-f7="ellipsis" @click="showMoreActionSheet = true"></f7-link>
|
||||
<f7-link :class="{ 'disabled': inputIsEmpty || submitting }" :text="tt(saveButtonTitle)" @click="save" v-if="mode !== TransactionEditPageMode.View"></f7-link>
|
||||
</f7-nav-right>
|
||||
|
||||
@@ -403,18 +403,24 @@
|
||||
</f7-actions>
|
||||
|
||||
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
|
||||
<f7-actions-group v-if="transaction.type === TransactionType.Transfer">
|
||||
<f7-actions-group v-if="mode !== TransactionEditPageMode.View && transaction.type === TransactionType.Transfer">
|
||||
<f7-actions-button @click="swapTransactionData(true, false)">{{ tt('Swap Account') }}</f7-actions-button>
|
||||
<f7-actions-button @click="swapTransactionData(false, true)">{{ tt('Swap Amount') }}</f7-actions-button>
|
||||
<f7-actions-button @click="swapTransactionData(true, true)">{{ tt('Swap Account and Amount') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group>
|
||||
<f7-actions-group v-if="mode !== TransactionEditPageMode.View">
|
||||
<f7-actions-button v-if="transaction.hideAmount" @click="transaction.hideAmount = false">{{ tt('Show Amount') }}</f7-actions-button>
|
||||
<f7-actions-button v-if="!transaction.hideAmount" @click="transaction.hideAmount = true">{{ tt('Hide Amount') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group v-if="pageTypeAndMode?.type === TransactionEditPageType.Transaction && (mode === TransactionEditPageMode.Add || mode === TransactionEditPageMode.Edit) && isTransactionPicturesEnabled() && !showTransactionPictures">
|
||||
<f7-actions-button @click="showTransactionPictures = true">{{ tt('Add Picture') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group v-if="pageTypeAndMode?.type === TransactionEditPageType.Transaction && mode === TransactionEditPageMode.View">
|
||||
<f7-actions-button @click="duplicate(false, false)">{{ tt('Duplicate') }}</f7-actions-button>
|
||||
<f7-actions-button @click="duplicate(true, false)">{{ tt('Duplicate (With Time)') }}</f7-actions-button>
|
||||
<f7-actions-button @click="duplicate(false, true)" v-if="transaction.geoLocation">{{ tt('Duplicate (With Geographic Location)') }}</f7-actions-button>
|
||||
<f7-actions-button @click="duplicate(true, true)" v-if="transaction.geoLocation">{{ tt('Duplicate (With Time and Geographic Location)') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group>
|
||||
<f7-actions-button bold close>{{ tt('Cancel') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
@@ -863,7 +869,17 @@ function init(): void {
|
||||
pageTypeAndMode.type === TransactionEditPageType.Transaction && (mode.value === TransactionEditPageMode.Edit || mode.value === TransactionEditPageMode.View)
|
||||
);
|
||||
|
||||
if (pageTypeAndMode.type === TransactionEditPageType.Template && query['id'] && responses[4] instanceof TransactionTemplate) {
|
||||
if (pageTypeAndMode.type === TransactionEditPageType.Transaction && query['id'] && responses[4] instanceof Transaction) {
|
||||
if (fromTransaction && query['withTime'] && query['withTime'] === 'true') {
|
||||
transaction.value.time = fromTransaction.time;
|
||||
transaction.value.timeZone = fromTransaction.timeZone;
|
||||
transaction.value.utcOffset = fromTransaction.utcOffset;
|
||||
}
|
||||
|
||||
if (fromTransaction && query['withGeoLocation'] && query['withGeoLocation'] === 'true') {
|
||||
transaction.value.setGeoLocation(fromTransaction.geoLocation);
|
||||
}
|
||||
} else if (pageTypeAndMode.type === TransactionEditPageType.Template && query['id'] && responses[4] instanceof TransactionTemplate) {
|
||||
const template = responses[4];
|
||||
transaction.value.id = template.id;
|
||||
|
||||
@@ -1117,6 +1133,10 @@ function viewOrRemovePicture(pictureInfo: TransactionPictureInfoBasicResponse):
|
||||
});
|
||||
}
|
||||
|
||||
function duplicate(withTime?: boolean, withGeoLocation?: boolean): void {
|
||||
props.f7router.navigate(`/transaction/add?id=${transaction.value.id}&type=${transaction.value.type}&withTime=${withTime ?? false}&withGeoLocation=${withGeoLocation ?? false}`);
|
||||
}
|
||||
|
||||
function onPageAfterIn(): void {
|
||||
routeBackOnError(props.f7router, loadingError);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user