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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2023-08-30 16:16:43 +00:00 committed by Tomas Cohen Arazi
parent d4be7b10ac
commit 3cf3ab9a8d
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 36 additions and 22 deletions

View File

@ -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 %]