Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix nav
James Cole8fd447af0ce0
diff --git a/app/View/Components/Elements/Alpine/PageNavigation.php b/app/View/Components/Elements/Alpine/PageNavigation.phpnew file mode 100644index 0000000000..9d06086016--- /dev/null+++ b/app/View/Components/Elements/Alpine/PageNavigation.php@@ -0,0 +1,26 @@+<?php++namespace FireflyIII\View\Components\Elements\Alpine;++use Closure;+use Illuminate\Contracts\View\View;+use Illuminate\View\Component;++class PageNavigation extends Component+{+ /**+ * Create a new component instance.+ */+ public function __construct()+ {+ //+ }++ /**+ * Get the view / contents that represent the component.+ */+ public function render(): View|Closure|string+ {+ return view('components.elements.alpine.page-navigation');+ }+}diff --git a/resources/assets/v3/js/pages/accounts/index.js b/resources/assets/v3/js/pages/accounts/index.jsindex f91caac3a0..1681d02eb1 100644--- a/resources/assets/v3/js/pages/accounts/index.js+++ b/resources/assets/v3/js/pages/accounts/index.js@@ -41,9 +41,11 @@ let index = function () {sortDirection: 'asc',page: 1,totalPages: 1,+ pageNavUrl: './accounts/',init() {const page = window.location.href.split('?')[0].split("/");this.objectType = page[page.length - 1].substring(0, 15);+ this.pageNavUrl = './accounts/' + this.objectType;const params = new Proxy(new URLSearchParams(window.location.search), {get: (searchParams, prop) => searchParams.get(prop),});diff --git a/resources/views/accounts/index.blade.php b/resources/views/accounts/index.blade.phpindex b5d11cfa98..4f350455db 100644--- a/resources/views/accounts/index.blade.php+++ b/resources/views/accounts/index.blade.php@@ -6,42 +6,7 @@<div class="card" id="account-index-{{ $objectType }}"><x-elements.card-header-with-menu :cardTitle="trans('firefly.'.$objectType.'_accounts')" :route="route('accounts.create', $objectType) . '?_from=' . urlencode($FF3_FROM)" :linkTitle="__('firefly.make_new_'. $objectType . '_account')"/><div class="card-body p-0">- <template x-if="totalPages > 1">- <div class="m-2">- <nav>- <ul class="pagination">- <li :class="{'page-item': true, 'disabled': 1 === page}" aria-disabled="true" aria-label="{{ __('pagination.previous') }}">- <template x-if="1 === page">- <span class="page-link" aria-hidden="true">‹</span>- </template>- <template x-if="page > 1">- <a class="page-link" :href="'./accounts/'+objectType+'?page=' + (page - 1)" rel="prev" aria-label="{{ __('pagination.previous') }}">‹</a>- </template>- </li>- <template x-for="current in totalPages" :key="current">- <li class="page-item" :class="{'page-item': true, 'active': current === page}">- <template x-if="current !== page">- <a class="page-link" :href="'./accounts/'+objectType+'?page=' + current" x-text="current" :aria-label="current"></a>- </template>- <template x-if="current === page">- <span class="page-link" x-text="current"></span>- </template>- </li>- </template>-- <li class="page-item">- <template x-if="totalPages === page">- <span class="page-link" aria-hidden="true">›</span>- </template>- <template x-if="totalPages > page">- <a class="page-link" :href="'./accounts/'+objectType+'?page=' + (page +1)" rel="next" aria-label="{{ __('pagination.next') }}">›</a>- </template>-- </li>- </ul>- </nav>- </div>- </template>+ <x-elements.alpine.page-navigation /><table class="table table-valign-middle table-sm table-hover sortable"><thead><tr>@@ -200,9 +165,7 @@</tbody></table><template x-if="totalPages > 1">- <div class="m-2">- TODO Pagination be here.- </div>+ <x-elements.alpine.page-navigation /></template></div><x-elements.card-footer-with-menu :route="route('accounts.create', $objectType) . '?_from=' . urlencode($FF3_FROM)" :linkTitle="__('firefly.make_new_'. $objectType . '_account')" />diff --git a/resources/views/components/elements/alpine/page-navigation.blade.php b/resources/views/components/elements/alpine/page-navigation.blade.phpnew file mode 100644index 0000000000..964362802a--- /dev/null+++ b/resources/views/components/elements/alpine/page-navigation.blade.php@@ -0,0 +1,34 @@+<template x-if="totalPages > 1">+ <div class="m-2">+ <nav>+ <ul class="pagination">+ <li :class="{'page-item': true, 'disabled': 1 === page}" :aria-disabled="1 === page ? 'true' : 'false'" aria-label="{!! __('pagination.previous') !!}">+ <template x-if="1 === page">+ <span class="page-link" aria-hidden="true">‹</span>+ </template>+ <template x-if="page > 1">+ <a class="page-link" :href="pageNavUrl + '?page=' + (page - 1)" rel="prev" aria-label="{!! __('pagination.previous') !!}" title="{!! __('pagination.previous') !!}">‹</a>+ </template>+ </li>+ <template x-for="current in totalPages" :key="current">+ <li class="page-item" :class="{'page-item': true, 'active': current === page}">+ <template x-if="current !== page">+ <a class="page-link" :href="pageNavUrl+'?page=' + current" x-text="current" :aria-label="current"></a>+ </template>+ <template x-if="current === page">+ <span class="page-link" x-text="current"></span>+ </template>+ </li>+ </template>+ <li class="{'page-item': true, 'disabled': totalPages === page" :aria-disabled="totalPages === page ? 'true' : 'false'" aria-label="{!! __('pagination.next') !!}">+ <template x-if="totalPages > page">+ <a class="page-link" :href="pageNavUrl+'?page=' + (page +1)" rel="next" aria-label="{!! __('pagination.next') !!}" title="{!! __('pagination.next') !!}">›</a>+ </template>+ <template x-if="totalPages === page">+ <span class="page-link" aria-hidden="true">›</span>+ </template>+ </li>+ </ul>+ </nav>+ </div>+</template>