Bug 32890: Add DataTables to curbside pickups

This patch modifies the curbside pickups page in the staff interface so
that each table is a DataTable with configurable columns.

The patch also replaces the patron name output with patron-title.inc for
consistency and to display names 'surname, firstname' for correct
column sorting.

To test, apply the patch and restart services.

- Enable the CurbsidePickup system preference if necessary.
- Properly testing requires testing data. You can run this command to
  REPLACE your curbside pickup data with sample data:

  bash <(curl -s https://gitlab.com/-/snippets/2572579/raw/main/test_curbside_pickups.sh)

- Go to Circulation -> Curbside pickups.
  - Test DataTable functionality under each tab: sorting, paging,
    filtering, column visibility, and export.
- Go to Administration -> Table settings -> Circulation -> Curbside
  pickup
  - Confirm that changes made to the configuration of each of the
    4 curbside pickup tables is correctly applied on the curbside
    pickups page.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2023-07-20 14:58:07 +00:00 committed by Katrin Fischer
parent c42d73ee26
commit 94ef3bfb47
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 80 additions and 12 deletions

View file

@ -1752,6 +1752,56 @@ modules:
-
columnname: status
curbside_pickups:
to_be_stagedt:
columns:
-
columnname: pickup_datetime
-
columnname: patron
-
columnname: items_for_pickup
-
columnname: action
cannot_be_toggled: 1
cannot_be_modified: 1
staged_and_readyt:
columns:
-
columnname: pickup_datetime
-
columnname: patron
-
columnname: items_for_pickup
-
columnname: staged_by
-
columnname: action
cannot_be_toggled: 1
cannot_be_modified: 1
patron_is_outsidet:
columns:
-
columnname: pickup_datetime
-
columnname: patron
-
columnname: items_for_pickup
-
columnname: staged_by
-
columnname: action
cannot_be_toggled: 1
cannot_be_modified: 1
delivered_todayt:
columns:
-
columnname: delivery_datetime
-
columnname: patron
-
columnname: items_checked_out
returns:
checkedintable:
columns:

View file

@ -7,6 +7,7 @@
[% USE raw %]
[% USE To %]
[% PROCESS 'i18n.inc' %]
[% USE TablesSettings %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% FILTER collapse %]
@ -66,7 +67,7 @@
[% END %]
[% BLOCK patron_info %]
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% cp.borrowernumber | uri %]">[% cp.patron.firstname | html %] [% cp.patron.surname | html %] ([% cp.patron.cardnumber | html %])</a>
[% INCLUDE 'patron-title.inc' patron=cp.patron invert_name = 1 hide_patron_infos_if_needed=1 %]
[% IF cp.notes %]
<br/>
<span>Notes: </span>[% cp.notes | html %]
@ -192,20 +193,20 @@
[% WRAPPER tab_panels %]
[% WRAPPER tab_panel tabname="to-be-staged" bt_active= to_be_staged_active %]
[% IF to_be_staged.count %]
<table class="table table-striped">
<table id="to_be_stagedt" class="table table-striped">
<thead>
<tr>
<th>Pickup date/time</th>
<th>Patron</th>
<th>Items for pickup</th>
<th>Action</th>
<th class="NoSort noExport">Action</th>
</tr>
</thead>
<tbody>
[% FOREACH cp IN to_be_staged %]
[% UNLESS cp.staged_datetime %]
<tr class="[% class | html %]">
<td>[% cp.scheduled_pickup_datetime | $KohaDates with_hours = 1 %]</td>
<td data-order="[% cp.scheduled_pickup_datetime | html %]">[% cp.scheduled_pickup_datetime | $KohaDates with_hours = 1 %]</td>
<td>
[% PROCESS patron_info %]
</td>
@ -244,21 +245,21 @@
[% END # /tab_panel %]
[% WRAPPER tab_panel tabname="staged-and-ready" bt_active = staged_and_ready_active %]
[% IF staged_and_ready.count %]
<table class="table table-striped">
<table id="staged_and_readyt" class="table table-striped">
<thead>
<tr>
<th>Pickup date/time</th>
<th>Patron</th>
<th>Items for pickup</th>
<th>Staged by</th>
<th>Action</th>
<th class="NoSort noExport">Action</th>
</tr>
</thead>
<tbody>
[% FOREACH cp IN staged_and_ready %]
[% IF cp.staged_datetime && !cp.arrival_datetime %]
<tr class="[% class | html %]">
<td>[% cp.scheduled_pickup_datetime | $KohaDates with_hours = 1 %]</td>
<td data-order="[% cp.scheduled_pickup_datetime | html %]">[% cp.scheduled_pickup_datetime | $KohaDates with_hours = 1 %]</td>
<td>
[% PROCESS patron_info %]
</td>
@ -310,21 +311,21 @@
[% END # /tab_panel %]
[% WRAPPER tab_panel tabname="patron-is-outside" bt_active = patron_is_outside_active %]
[% IF patron_outside.count %]
<table class="table table-striped">
<table id="patron_is_outsidet" class="table table-striped">
<thead>
<tr>
<th>Pickup date/time</th>
<th>Patron</th>
<th>Items for pickup</th>
<th>Staged by</th>
<th>Action</th>
<th class="NoSort noExport">Action</th>
</tr>
</thead>
<tbody>
[% FOREACH cp IN patron_outside %]
[% IF cp.arrival_datetime && !cp.delivered_datetime %]
<tr class="[% class | html %]">
<td>[% cp.scheduled_pickup_datetime | $KohaDates with_hours = 1 %]</td>
<td data-order="[% cp.scheduled_pickup_datetime | html %]">[% cp.scheduled_pickup_datetime | $KohaDates with_hours = 1 %]</td>
<td>
[% PROCESS patron_info %]
</td>
@ -376,7 +377,7 @@
[% END # /tab_panel %]
[% WRAPPER tab_panel tabname="delivered-today" bt_active = delivered_today_active %]
[% IF delivered_today.count %]
<table class="table table-striped">
<table id="delivered_todayt" class="table table-striped">
<thead>
<tr>
<th>Deliver date/time</th>
@ -388,7 +389,7 @@
[% FOREACH cp IN delivered_today %]
[% IF cp.delivered_datetime %]
<tr class="[% class | html %]">
<td>[% cp.delivered_datetime | $KohaDates with_hours = 1 %]</td>
<td data-order="[% cp.delivered_datetime | html %]">[% cp.delivered_datetime | $KohaDates with_hours = 1 %]</td>
<td>
[% PROCESS patron_info %]
</td>
@ -501,6 +502,8 @@
<script>dayjs.extend(window.dayjs_plugin_customParseFormat)</script>
[% INCLUDE 'calendar.inc' %]
[% INCLUDE 'js-patron-format.inc' %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
<script>
let pickups = [% To.json(curbside_pickups.unblessed) | $raw %];
let policy = [% To.json(policy.unblessed) | $raw %];
@ -661,6 +664,21 @@
set_interval_if_needed();
let dt_settings = [];
dt_settings.push( [% TablesSettings.GetTableSettings('circ', 'curbside_pickups', 'to_be_stagedt', 'json') | $raw %] );
dt_settings.push( [% TablesSettings.GetTableSettings('circ', 'curbside_pickups', 'staged_and_readyt', 'json') | $raw %] );
dt_settings.push( [% TablesSettings.GetTableSettings('circ', 'curbside_pickups', 'patron_is_outsidet', 'json') | $raw %] );
dt_settings.push( [% TablesSettings.GetTableSettings('circ', 'curbside_pickups', 'delivered_todayt', 'json') | $raw %] );
let dt_tables = new Array("to_be_stagedt", "staged_and_readyt", "patron_is_outsidet", "delivered_todayt");
dt_tables.forEach(function( id, index ){
KohaTable( id , {
"autoWidth": false
}, dt_settings[ index ] );
});
});
let refresh_interval_id = 0;