mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 17:24:26 +08:00
support canceling the sorting operation on mobile version
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<f7-page :ptr="!sortable" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
<f7-page :ptr="!sortable" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
||||||
<f7-navbar>
|
<f7-navbar>
|
||||||
<f7-nav-left :back-link="tt('Back')"></f7-nav-left>
|
<f7-nav-left :back-link="tt('Back')" v-if="!sortable"></f7-nav-left>
|
||||||
|
<f7-nav-left v-else-if="sortable">
|
||||||
|
<f7-link icon-f7="xmark" :class="{ 'disabled': displayOrderSaving }" @click="cancelSort"></f7-link>
|
||||||
|
</f7-nav-left>
|
||||||
<f7-nav-title :title="tt('Account List')"></f7-nav-title>
|
<f7-nav-title :title="tt('Account List')"></f7-nav-title>
|
||||||
<f7-nav-right class="navbar-compact-icons">
|
<f7-nav-right class="navbar-compact-icons">
|
||||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': !allAccountCount }" v-if="!sortable" @click="showMoreActionSheet = true"></f7-link>
|
<f7-link icon-f7="ellipsis" :class="{ 'disabled': !allAccountCount || sortable }" @click="showMoreActionSheet = true"></f7-link>
|
||||||
<f7-link icon-f7="plus" href="/account/add" v-if="!sortable"></f7-link>
|
<f7-link icon-f7="plus" href="/account/add" v-if="!sortable"></f7-link>
|
||||||
<f7-link :text="tt('Done')" :class="{ 'disabled': displayOrderSaving }" @click="saveSortResult" v-else-if="sortable"></f7-link>
|
<f7-link icon-f7="checkmark_alt" :class="{ 'disabled': displayOrderSaving || !displayOrderModified }" @click="saveSortResult" v-else-if="sortable"></f7-link>
|
||||||
</f7-nav-right>
|
</f7-nav-right>
|
||||||
</f7-navbar>
|
</f7-navbar>
|
||||||
|
|
||||||
@@ -505,6 +508,35 @@ function saveSortResult(): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cancelSort(): void {
|
||||||
|
if (!displayOrderModified.value) {
|
||||||
|
showHidden.value = false;
|
||||||
|
sortable.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayOrderSaving.value = true;
|
||||||
|
showLoading();
|
||||||
|
|
||||||
|
accountsStore.loadAllAccounts({
|
||||||
|
force: false
|
||||||
|
}).then(() => {
|
||||||
|
displayOrderSaving.value = false;
|
||||||
|
hideLoading();
|
||||||
|
|
||||||
|
showHidden.value = false;
|
||||||
|
sortable.value = false;
|
||||||
|
displayOrderModified.value = false;
|
||||||
|
}).catch(error => {
|
||||||
|
displayOrderSaving.value = false;
|
||||||
|
hideLoading();
|
||||||
|
|
||||||
|
if (!error.processed) {
|
||||||
|
showToast(error.message || error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function setAccountsIncludedInTotal(): void {
|
function setAccountsIncludedInTotal(): void {
|
||||||
props.f7router.navigate('/settings/filter/account?type=accountListTotalAmount');
|
props.f7router.navigate('/settings/filter/account?type=accountListTotalAmount');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<f7-page :ptr="!sortable" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
<f7-page :ptr="!sortable" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
||||||
<f7-navbar>
|
<f7-navbar>
|
||||||
<f7-nav-left :back-link="tt('Back')"></f7-nav-left>
|
<f7-nav-left :back-link="tt('Back')" v-if="!sortable"></f7-nav-left>
|
||||||
|
<f7-nav-left v-else-if="sortable">
|
||||||
|
<f7-link icon-f7="xmark" :class="{ 'disabled': displayOrderSaving }" @click="cancelSort"></f7-link>
|
||||||
|
</f7-nav-left>
|
||||||
<f7-nav-title :title="tt(title)"></f7-nav-title>
|
<f7-nav-title :title="tt(title)"></f7-nav-title>
|
||||||
<f7-nav-right class="navbar-compact-icons">
|
<f7-nav-right class="navbar-compact-icons">
|
||||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': !categories.length }" v-if="!sortable" @click="showMoreActionSheet = true"></f7-link>
|
<f7-link icon-f7="ellipsis" :class="{ 'disabled': !categories.length || sortable }" @click="showMoreActionSheet = true"></f7-link>
|
||||||
<f7-link icon-f7="plus" :href="'/category/add?type=' + categoryType + '&parentId=' + primaryCategoryId + (currentPrimaryCategory ? `&color=${currentPrimaryCategory.color}&icon=${currentPrimaryCategory.icon}` : '')" v-if="!sortable"></f7-link>
|
<f7-link icon-f7="plus" :href="'/category/add?type=' + categoryType + '&parentId=' + primaryCategoryId + (currentPrimaryCategory ? `&color=${currentPrimaryCategory.color}&icon=${currentPrimaryCategory.icon}` : '')" v-if="!sortable"></f7-link>
|
||||||
<f7-link :text="tt('Done')" :class="{ 'disabled': displayOrderSaving }" @click="saveSortResult" v-else-if="sortable"></f7-link>
|
<f7-link icon-f7="checkmark_alt" :class="{ 'disabled': displayOrderSaving || !displayOrderModified }" @click="saveSortResult" v-else-if="sortable"></f7-link>
|
||||||
</f7-nav-right>
|
</f7-nav-right>
|
||||||
</f7-navbar>
|
</f7-navbar>
|
||||||
|
|
||||||
@@ -354,6 +357,35 @@ function saveSortResult(): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cancelSort(): void {
|
||||||
|
if (!displayOrderModified.value) {
|
||||||
|
showHidden.value = false;
|
||||||
|
sortable.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayOrderSaving.value = true;
|
||||||
|
showLoading();
|
||||||
|
|
||||||
|
transactionCategoriesStore.loadAllCategories({
|
||||||
|
force: false
|
||||||
|
}).then(() => {
|
||||||
|
displayOrderSaving.value = false;
|
||||||
|
hideLoading();
|
||||||
|
|
||||||
|
showHidden.value = false;
|
||||||
|
sortable.value = false;
|
||||||
|
displayOrderModified.value = false;
|
||||||
|
}).catch(error => {
|
||||||
|
displayOrderSaving.value = false;
|
||||||
|
hideLoading();
|
||||||
|
|
||||||
|
if (!error.processed) {
|
||||||
|
showToast(error.message || error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function onSort(event: { el: { id: string }; from: number; to: number }): void {
|
function onSort(event: { el: { id: string }; from: number; to: number }): void {
|
||||||
if (!event || !event.el || !event.el.id) {
|
if (!event || !event.el || !event.el.id) {
|
||||||
showToast('Unable to move category');
|
showToast('Unable to move category');
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<f7-page :ptr="!sortable && !hasEditingTag" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
<f7-page :ptr="!sortable && !hasEditingTag" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
||||||
<f7-navbar>
|
<f7-navbar>
|
||||||
<f7-nav-left :back-link="tt('Back')"></f7-nav-left>
|
<f7-nav-left :back-link="tt('Back')" v-if="!sortable"></f7-nav-left>
|
||||||
|
<f7-nav-left v-else-if="sortable">
|
||||||
|
<f7-link icon-f7="xmark" :class="{ 'disabled': displayOrderSaving }" @click="cancelSort"></f7-link>
|
||||||
|
</f7-nav-left>
|
||||||
<f7-nav-title :title="tt('Transaction Tags')"></f7-nav-title>
|
<f7-nav-title :title="tt('Transaction Tags')"></f7-nav-title>
|
||||||
<f7-nav-right class="navbar-compact-icons">
|
<f7-nav-right class="navbar-compact-icons">
|
||||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': hasEditingTag || !tags.length }" v-if="!sortable" @click="showMoreActionSheet = true"></f7-link>
|
<f7-link icon-f7="ellipsis" :class="{ 'disabled': hasEditingTag || !tags.length || sortable }" @click="showMoreActionSheet = true"></f7-link>
|
||||||
<f7-link icon-f7="plus" :class="{ 'disabled': hasEditingTag }" v-if="!sortable" @click="add"></f7-link>
|
<f7-link icon-f7="plus" :class="{ 'disabled': hasEditingTag }" v-if="!sortable" @click="add"></f7-link>
|
||||||
<f7-link :text="tt('Done')" :class="{ 'disabled': displayOrderSaving || hasEditingTag }" v-else-if="sortable" @click="saveSortResult"></f7-link>
|
<f7-link icon-f7="checkmark_alt" :class="{ 'disabled': displayOrderSaving || !displayOrderModified || hasEditingTag }" @click="saveSortResult" v-else-if="sortable"></f7-link>
|
||||||
</f7-nav-right>
|
</f7-nav-right>
|
||||||
</f7-navbar>
|
</f7-navbar>
|
||||||
|
|
||||||
@@ -382,6 +385,35 @@ function saveSortResult(): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cancelSort(): void {
|
||||||
|
if (!displayOrderModified.value) {
|
||||||
|
showHidden.value = false;
|
||||||
|
sortable.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayOrderSaving.value = true;
|
||||||
|
showLoading();
|
||||||
|
|
||||||
|
transactionTagsStore.loadAllTags({
|
||||||
|
force: false
|
||||||
|
}).then(() => {
|
||||||
|
displayOrderSaving.value = false;
|
||||||
|
hideLoading();
|
||||||
|
|
||||||
|
showHidden.value = false;
|
||||||
|
sortable.value = false;
|
||||||
|
displayOrderModified.value = false;
|
||||||
|
}).catch(error => {
|
||||||
|
displayOrderSaving.value = false;
|
||||||
|
hideLoading();
|
||||||
|
|
||||||
|
if (!error.processed) {
|
||||||
|
showToast(error.message || error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function onSort(event: { el: { id: string }, from: number, to: number }): void {
|
function onSort(event: { el: { id: string }, from: number, to: number }): void {
|
||||||
if (!event || !event.el || !event.el.id) {
|
if (!event || !event.el || !event.el.id) {
|
||||||
showToast('Unable to move tag');
|
showToast('Unable to move tag');
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<f7-page :ptr="!sortable" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
<f7-page :ptr="!sortable" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
||||||
<f7-navbar>
|
<f7-navbar>
|
||||||
<f7-nav-left :back-link="tt('Back')"></f7-nav-left>
|
<f7-nav-left :back-link="tt('Back')" v-if="!sortable"></f7-nav-left>
|
||||||
|
<f7-nav-left v-else-if="sortable">
|
||||||
|
<f7-link icon-f7="xmark" :class="{ 'disabled': displayOrderSaving }" @click="cancelSort"></f7-link>
|
||||||
|
</f7-nav-left>
|
||||||
<f7-nav-title :title="templateType === TemplateType.Schedule.type ? tt('Scheduled Transactions') : tt('Transaction Templates')"></f7-nav-title>
|
<f7-nav-title :title="templateType === TemplateType.Schedule.type ? tt('Scheduled Transactions') : tt('Transaction Templates')"></f7-nav-title>
|
||||||
<f7-nav-right class="navbar-compact-icons">
|
<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 icon-f7="ellipsis" :class="{ 'disabled': !templates.length || sortable }" @click="showMoreActionSheet = true"></f7-link>
|
||||||
<f7-link icon-f7="plus" :href="'/template/add?templateType=' + templateType" v-if="!sortable"></f7-link>
|
<f7-link icon-f7="plus" :href="'/template/add?templateType=' + templateType" v-if="!sortable"></f7-link>
|
||||||
<f7-link :text="tt('Done')" :class="{ 'disabled': displayOrderSaving }" @click="saveSortResult" v-else-if="sortable"></f7-link>
|
<f7-link icon-f7="checkmark_alt" :class="{ 'disabled': displayOrderSaving || !displayOrderModified }" @click="saveSortResult" v-else-if="sortable"></f7-link>
|
||||||
</f7-nav-right>
|
</f7-nav-right>
|
||||||
</f7-navbar>
|
</f7-navbar>
|
||||||
|
|
||||||
@@ -289,6 +292,36 @@ function saveSortResult(): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cancelSort(): void {
|
||||||
|
if (!displayOrderModified.value) {
|
||||||
|
showHidden.value = false;
|
||||||
|
sortable.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayOrderSaving.value = true;
|
||||||
|
showLoading();
|
||||||
|
|
||||||
|
transactionTemplatesStore.loadAllTemplates({
|
||||||
|
templateType: templateType.value,
|
||||||
|
force: false
|
||||||
|
}).then(() => {
|
||||||
|
displayOrderSaving.value = false;
|
||||||
|
hideLoading();
|
||||||
|
|
||||||
|
showHidden.value = false;
|
||||||
|
sortable.value = false;
|
||||||
|
displayOrderModified.value = false;
|
||||||
|
}).catch(error => {
|
||||||
|
displayOrderSaving.value = false;
|
||||||
|
hideLoading();
|
||||||
|
|
||||||
|
if (!error.processed) {
|
||||||
|
showToast(error.message || error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function onSort(event: { el: { id: string }; from: number; to: number }): void {
|
function onSort(event: { el: { id: string }; from: number; to: number }): void {
|
||||||
if (!event || !event.el || !event.el.id) {
|
if (!event || !event.el || !event.el.id) {
|
||||||
showToast('Unable to move template');
|
showToast('Unable to move template');
|
||||||
|
|||||||
Reference in New Issue
Block a user