Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Clean up account list.
James Cole396e216a87e4
diff --git a/config/translations.php b/config/translations.phpindex 09b2c75cd3..6508b951f8 100644--- a/config/translations.php+++ b/config/translations.php@@ -107,6 +107,8 @@ return ['interest_calc_','release_notes_title','wait_attachments',+ 'filter_placeholder_name',+ 'filter_placeholder_account_number_and_iban','interest_calc_null','interest_calc_daily','interest_calc_monthly',diff --git a/resources/assets/v3/js/pages/accounts/index.js b/resources/assets/v3/js/pages/accounts/index.jsindex cf3a7b2fa9..62168696e2 100644--- a/resources/assets/v3/js/pages/accounts/index.js+++ b/resources/assets/v3/js/pages/accounts/index.js@@ -59,12 +59,9 @@ let index = function () {defaultSortDirection: "asc",// variables necessary for sorting tables.- handleFunc: null,pageNavUrl: "./accounts/",sortColumn: "order", // used in GET request.sortDirection: "asc", // used in GET request.- loadingNewSort: true,- isFiltering: false,filter: {},// sort functions, imported@@ -110,8 +107,8 @@ let index = function () {});this.sortableTable.sortColumn = this.defaultSortColumn;- this.sortableTable.storageKey = this.storageKey;this.sortableTable.sortDirection = this.defaultSortDirection;+ this.sortableTable.storageKey = this.storageKey;this.sortableTable.page = this.page;this.sortableTable.init(this);@@ -121,6 +118,8 @@ let index = function () {console.log("sortable-table-sort-change", event.detail);this.sortColumn = event.detail.sortColumn;this.sortDirection = event.detail.sortDirection;+ this.sortableTable.sortColumn = this.sortColumn;+ this.sortableTable.sortDirection = this.sortDirection;this.updateHistory(this.page, this.sortColumn, this.sortDirection, this.filter);this.storeFilterAndSort(this.storageKey, this.sortColumn, this.sortDirection, this.filter);this.downloadAccounts();@@ -183,14 +182,9 @@ let index = function () {return account;},downloadAccounts() {- this.loadingNewSort = true;- let sort = "asc" === this.sortDirection ? this.sortColumn : "-" + this.sortColumn;- console.log("downloadAccounts:", {- page: this.page,- column: this.defaultSortColumn,- direction: this.defaultSortDirection,- });- console.log("Sort:", sort);+ this.sortableTable.loadingNewSort = true;+ let sort = "asc" === this.sortableTable.sortDirection ? this.sortableTable.sortColumn : "-" + this.sortableTable.sortColumn;+ console.log("downloadAccounts:", {page: this.page, sort: sort});let start = window.store.get("start");let end = window.store.get("end");this.convertToPrimary = window.store.get("convert_to_primary");@@ -295,7 +289,7 @@ let index = function () {// this.accounts.length,// );this.loadingPage = false;- this.loadingNewSort = false;+ this.sortableTable.loadingNewSort = false;this.sortableTable.disableRefresh = false;if (0 === this.accounts.length && false === this.isFiltering) {document.querySelectorAll(".data-holder").forEach((el) => {@@ -320,29 +314,6 @@ let index = function () {window.store.get("locale"),);},- handlePageClick(e) {- let link = e.currentTarget;-- let page = parseInt(link.dataset.page);- if (isNaN(page)) {- e.preventDefault();- return false;- }- this.page = page;- this.updateHistory();- this.downloadAccounts();- e.preventDefault();- queueMicrotask(() => {- this.capturePageNavigation();- });- return false;- },- // capturePageNavigation() {- // document.querySelectorAll("a.page-link").forEach((el) => {- // el.removeEventListener("click", this.handleFunc);- // el.addEventListener("click", this.handleFunc);- // });- // },};};diff --git a/resources/assets/v3/js/pages/shared/sortable-tables.js b/resources/assets/v3/js/pages/shared/sortable-tables.jsindex 38ab95a061..5110e1a5f0 100644--- a/resources/assets/v3/js/pages/shared/sortable-tables.js+++ b/resources/assets/v3/js/pages/shared/sortable-tables.js@@ -18,6 +18,8 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.*/+import i18next from "i18next";+export class sortableTable {tableId = "";sortColumn = "order";@@ -26,6 +28,7 @@ export class sortableTable {disableRefresh = false;parent = null;isFiltering = true;+ loadingNewSort = true;constructor(tableId) {this.tableId = tableId;@@ -33,6 +36,7 @@ export class sortableTable {}init(parent) {+ this.handleFunc = this.handlePageClick.bind(this);this.parent = parent;queueMicrotask(() => {this.updateHeaderClasses();@@ -99,7 +103,6 @@ export class sortableTable {capturePageNavigation() {console.log('capturePageNavigation()');document.querySelectorAll("a.page-link").forEach((el) => {- console.log('Catch clicks.');el.removeEventListener("click", this.handleFunc);el.addEventListener("click", this.handleFunc);});@@ -120,6 +123,27 @@ export class sortableTable {//this.downloadAccounts();}+ handlePageClick(e) {+ let link = e.currentTarget;++ let page = parseInt(link.dataset.page);+ if (isNaN(page)) {+ e.preventDefault();+ return false;+ }+ this.page = page;+ this.parent.page = page;+ // some sort of trigger to parent?+ // console.warn('Here be push to parent!');+ this.parent.updateHistory(page, this.sortColumn, this.sortDirection, this.parent.filter);+ this.parent.downloadAccounts();+ e.preventDefault();+ queueMicrotask(() => {+ this.capturePageNavigation();+ });+ return false;+ }+fireSortChangeEvent() {this.updateHeaderClasses();let obj = {@@ -207,7 +231,7 @@ export class sortableTable {let input = document.createElement("input");input.classList.add("form-control", "form-control-sm");input.setAttribute("type", "search");- input.setAttribute("placeholder", "TODO placeholder");+ input.setAttribute("placeholder", i18next.t("firefly.filter_placeholder_" + column));input.setAttribute("x-model", "filter." + column);div.appendChild(input);diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex c7bf853645..e15452baea 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -1732,6 +1732,9 @@ return ['select_source_account' => 'Please select or type a valid source account name','select_dest_account' => 'Please select or type a valid destination account name',+ 'filter_placeholder_name' => 'Filter on name...',+ 'filter_placeholder_account_number_and_iban' => 'Filter on account number...',+// convert stuff:'convert_is_already_type_Withdrawal' => 'This transaction is already a withdrawal','convert_is_already_type_Deposit' => 'This transaction is already a deposit',diff --git a/resources/views/accounts/index.blade.php b/resources/views/accounts/index.blade.phpindex 58c76da742..ec722b0fd2 100644--- a/resources/views/accounts/index.blade.php+++ b/resources/views/accounts/index.blade.php@@ -60,7 +60,7 @@<th data-sort-column="balance_difference" class="w-15 text-end d-lg-table-cell d-none"><span class="title">{{ trans('list.balanceDiff') }}</span></th><th> </th></tr>- <tr x-show="true === loadingNewSort">+ <tr x-show="true === sortableTable.loadingNewSort"><th colspan="12"><div class="p-3 text-center"><div class="spinner-border spinner-border-sm" role="status">