From 1b17d8bc718ca88cd674164981da7623549c3dca Mon Sep 17 00:00:00 2001 From: Lucas Gass <lucas@bywatersolutions.com> Date: Wed, 30 Aug 2023 16:16:43 +0000 Subject: [PATCH] Bug 34660: Make deliveries table on housebound.tt a DataTable To test: 1. Turn on the housebound module ( HouseboundModule ) 2. From a staff account add at leats one staff member as a Deliverer and a Chooser. 3. From a patron account click on the 'Housebound' tab. Add some deliveries. 4. Notice they sort with the oldest deilivery first. 5. Apply patch and reload the page. 6. Now the table is a DataTable and can be dymacially sorted. Signed-off-by: Rhonda Kuiper <rkuiper@roundrocktexas.gov> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> --- .../prog/en/modules/members/housebound.tt | 58 ++++++++++++------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt index 67daa861500..23775159b6c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt @@ -387,30 +387,38 @@ <h3>Deliveries</h3> [% housebound_visits = housebound_profile.housebound_visits %] [% IF housebound_visits.count > 0 %] - <table border="0" width="100%" cellpadding="3" cellspacing="0"> - <tr> - <th>ID</th><th>Date</th><th>Chooser</th><th>Deliverer</th><th class="noExport">Actions</th> - </tr> - [% FOREACH entry IN housebound_visits %] + <table id="deliveries"> + <thead> <tr> - <td>[% entry.id | html %]</td> - <td>[% entry.appointment_date | $KohaDates %] ([% entry.day_segment | html %])</td> - <td> - <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% entry.chooser.borrowernumber | uri %]"> - [% INCLUDE 'patron-title.inc' patron = entry.chooser invert_name = 0 %] - </a> - </td> - <td> - <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% entry.deliverer.borrowernumber | uri %]"> - [% INCLUDE 'patron-title.inc' patron = entry.deliverer invert_name = 0 %] - </a> - </td> - <td class="actions"> - <a class="btn btn-default btn-xs" href="/cgi-bin/koha/members/housebound.pl?method=visit_update_or_create&visit_id=[% entry.id | html %]&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> - <a class="delete btn btn-default btn-xs" href="/cgi-bin/koha/members/housebound.pl?method=visit_delete&visit_id=[% entry.id | html %]&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa fa-trash-can"></i> Delete</a> - </td> + <th>ID</th> + <th>Date</th> + <th>Chooser</th> + <th>Deliverer</th> + <th class="noExport">Actions</th> </tr> - [% END %] + </thead> + <tbody> + [% FOREACH entry IN housebound_visits %] + <tr> + <td>[% entry.id | html %]</td> + <td>[% entry.appointment_date | $KohaDates %] ([% entry.day_segment | html %])</td> + <td> + <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% entry.chooser.borrowernumber | uri %]"> + [% INCLUDE 'patron-title.inc' patron = entry.chooser invert_name = 0 %] + </a> + </td> + <td> + <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% entry.deliverer.borrowernumber | uri %]"> + [% INCLUDE 'patron-title.inc' patron = entry.deliverer invert_name = 0 %] + </a> + </td> + <td class="actions"> + <a class="btn btn-default btn-xs" href="/cgi-bin/koha/members/housebound.pl?method=visit_update_or_create&visit_id=[% entry.id | html %]&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="delete btn btn-default btn-xs" href="/cgi-bin/koha/members/housebound.pl?method=visit_delete&visit_id=[% entry.id | html %]&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa fa-trash-can"></i> Delete</a> + </td> + </tr> + [% END %] + </tbody> </table> [% END %] <div class="action"> @@ -435,12 +443,18 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] <script> $(document).ready(function() { $("a.delete").click(function(){ return confirm(_("Are you sure you want to delete this delivery?")); }); }); + KohaTable("deliveries", { + "sPaginationType": "full", + "autoWidth": false, + }); </script> [% INCLUDE 'str/members-menu.inc' %] [% Asset.js("js/members-menu.js") | $raw %] -- 2.41.0