Bugzilla – Attachment 167934 Details for
Bug 37141
Add option to display completed bookings from patron page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37141: Add 'Include completed' option to bookings tab
Bug-37141-Add-Include-completed-option-to-bookings.patch (text/plain), 3.44 KB, created by
Martin Renvoize (ashimema)
on 2024-06-20 11:15:14 UTC
(
hide
)
Description:
Bug 37141: Add 'Include completed' option to bookings tab
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-20 11:15:14 UTC
Size:
3.44 KB
patch
obsolete
>From 4288cb6c1ec7b158c4b1886be2c73e02998a56b6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 20 Jun 2024 12:01:34 +0100 >Subject: [PATCH] Bug 37141: Add 'Include completed' option to bookings tab > >This patch adds the 'Include completed' filter toggle option to the >bookings display tab on both the patron details and circulation pages. >--- > .../prog/en/includes/patron-detail-tabs.inc | 3 ++ > .../intranet-tmpl/prog/js/tables/bookings.js | 37 +++++++++++++++---- > 2 files changed, 33 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >index b220d7952af..a4a06ad9dd3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-detail-tabs.inc >@@ -228,6 +228,9 @@ > > [% WRAPPER tab_panel tabname="bookings" %] > [% IF ( bookings_count ) %] >+ <fieldset class="action filters" style="cursor:pointer;"> >+ <a id="completed_filter" class="filtered"><i class="fa fa-bars"></i> Include completed</a> >+ </fieldset> > <table id="bookings_table" style="width: 100% !Important;"></table> > [% ELSE %] > <p>Patron has nothing booked.</p> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >index 585c1af94c2..d794d4cccf2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >@@ -5,8 +5,21 @@ $(document).ready(function () { > > // Load bookings table on tab selection > $("#bookings-tab").on("click", function () { >+ let filter_completed = true; >+ let additional_filters = { >+ patron_id: patron_borrowernumber, >+ end_date: function () { >+ if (filter_completed) { >+ let today = new Date(); >+ return { ">=": today.toISOString() } >+ } else { >+ return; >+ } >+ } >+ }; >+ > if (!bookings_table) { >- var today = new Date(); >+ > var bookings_table_url = "/api/v1/bookings"; > bookings_table = $("#bookings_table").kohaTable( > { >@@ -88,13 +101,23 @@ $(document).ready(function () { > }, > ], > }, >- table_settings_bookings_table, >- 0, >- { >- patron_id: patron_borrowernumber, >- end_date: { ">=": today.toISOString() }, >- } >+ table_settings_bookings_table, 0, additional_filters > ); > } >+ >+ var txtActivefilter = _("Include completed"); >+ var txtInactivefilter = _("Filter completed"); >+ $('#completed_filter').on("click", function () { >+ if ($(this).hasClass('filtered')) { >+ filter_completed = false; >+ $(this).html('<i class="fa fa-filter"></i> ' + txtActivefilter); >+ } else { >+ filter_completed = true; >+ $(this).html('<i class="fa fa-bars"></i> ' + txtInactivefilter); >+ } >+ bookings_table.DataTable().draw(); >+ $(this).toggleClass('filtered'); >+ }); >+ > }); > }); >-- >2.45.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37141
:
167934
|
168420
|
170057
|
170063
|
170064
|
170081
|
170082
|
170083
|
170088
|
170089
|
170090
|
170091