From 23f28132b9bf3e4000f7fdda2aeec6a477a338af Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 28 Aug 2024 16:40:07 +0000 Subject: [PATCH] Bug 37761: Use tab WRAPPER for circulation curbside pickups tabs The tabs on Circulation -> Curbside pickups look broken because they were not updated to use the tab WRAPPER markup. This patch revises the template so that the tabs look correct and makes additional changes to ensure that the correct tab is preselected. To test: - Apply the patch and 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. - Confirm that the tabs look correct. The first tab should be active by default. - Confirm that the right content is displayed when you click each tab. - Under the "Schedule pickup" tab, search for a patron. - After you submit the search the page should reload and the "Schedule pickup" tab should be open. Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind Signed-off-by: Katrin Fischer (cherry picked from commit 1311b8c01c1bfbf6588574d691318b45cc063bf9) Signed-off-by: Paul Derscheid --- .../prog/en/modules/circ/curbside_pickups.tt | 290 ++++++++---------- 1 file changed, 135 insertions(+), 155 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt index 89a8091d95..15bba67e71 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt @@ -148,51 +148,49 @@ [% SET staged_and_ready = curbside_pickups.filter_by_staged_and_ready %] [% SET patron_outside = curbside_pickups.filter_by_patron_outside %] [% SET delivered_today = curbside_pickups.filter_by_delivered %] -
- -
- [% IF !tab OR tab == 'to-be-staged' %] -
- [% ELSE %] -
+ [% SET to_be_staged_active = 0 %] + [% SET staged_and_ready_active = 0 %] + [% SET patron_is_outside_active = 0 %] + [% SET delivered_today_active = 0 %] + [% SET schedule_pickup_active = 0 %] + + [% SWITCH tab -%] + [% CASE "to-be-staged_panel" -%] + [% to_be_staged_active = 1 %] + [% CASE "staged-and-ready_panel" -%] + [% staged_and_ready_active = 1 %] + [% CASE "patron-is-outside_panel" -%] + [% patron_is_outside_active = 1 %] + [% CASE "delivered-today_panel" -%] + [% delivered_today_active = 1 %] + [% CASE "schedule-pickup_panel" -%] + [% schedule_pickup_active = 1 %] + [% CASE # default case -%] + [% to_be_staged_active = 1 %] + [% END -%] + + [% WRAPPER tabs id= "pickup-tabs" %] + [% WRAPPER tabs_nav %] + [% WRAPPER tab_item tabname= "to-be-staged" bt_active= to_be_staged_active %] + To be staged ([% to_be_staged.count | html %]) [% END %] + [% WRAPPER tab_item tabname= "staged-and-ready" bt_active = staged_and_ready_active %] + Staged & ready ([% staged_and_ready.count | html %]) + [% END %] + [% WRAPPER tab_item tabname= "patron-is-outside" bt_active = patron_is_outside_active %] + Patron is outside ([% patron_outside.count | html %]) + [% END %] + [% WRAPPER tab_item tabname= "delivered-today" bt_active = delivered_today_active %] + Delivered today ([% delivered_today.count | html %]) + [% END %] + [% WRAPPER tab_item tabname= "schedule-pickup" bt_active = schedule_pickup_active %] + Schedule pickup + [% END %] + [% END # /WRAPPER tabs_nav %] + + [% WRAPPER tab_panels %] + [% WRAPPER tab_panel tabname="to-be-staged" bt_active= to_be_staged_active %] [% IF to_be_staged.count %] @@ -241,15 +239,10 @@
[% ELSE %] - There are no pickups to be staged. +
There are no pickups to be staged.
[% END %] -
- - [% IF tab == "staged-and-ready" %] -
- [% ELSE %] -
- [% END %] + [% END # /tab_panel %] + [% WRAPPER tab_panel tabname="staged-and-ready" bt_active = staged_and_ready_active %] [% IF staged_and_ready.count %] @@ -312,15 +305,10 @@
[% ELSE %] - There are no pickups staged and ready. +
There are no pickups staged and ready.
[% END %] -
- - [% IF tab == "patron-is-outside" %] -
- [% ELSE %] -
- [% END %] + [% END # /tab_panel %] + [% WRAPPER tab_panel tabname="patron-is-outside" bt_active = patron_is_outside_active %] [% IF patron_outside.count %] @@ -383,15 +371,10 @@
[% ELSE %] - There are no patrons waiting outside. +
There are no patrons waiting outside.
[% END %] -
- - [% IF tab == "delivered-today" %] -
- [% ELSE %] -
- [% END %] + [% END # /tab_panel %] + [% WRAPPER tab_panel tabname="delivered-today" bt_active = delivered_today_active %] [% IF delivered_today.count %] @@ -410,98 +393,95 @@ [% PROCESS patron_info %] - - [% END %] - [% END %] - -
- [% FOREACH c IN cp.checkouts %] - [% IF date.format(c.issuedate, format = '%Y-%m-%d') == today_iso %] - [% c.item.biblio.title | html %] ([% c.item.biblio.author | html %], [% c.item.barcode | html %])
- [% END %] - [% END %] -
- [% ELSE %] - No pickups have been delivered today. - [% END %] -
- - [% IF tab == "schedule-pickup" %] -
- [% ELSE %] -
- [% END %] - [% IF !patron || ( patron && existing_curbside_pickups.count >= 1 ) %] - [% IF existing_curbside_pickups.count >= 1 %] -
- [% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %]) already has a scheduled pickup for this library. -
- [% END %] -
- -
-
Search a patron
- -
-
- [% ELSE %] - [% SET waiting_holds = patron.holds.search( found => 'W', branchcode => Branches.GetLoggedInBranchcode ) %] - [% IF !policy.enable_waiting_holds_only || waiting_holds.count > 0 %] -
- [% INCLUDE 'csrf-token.inc' %] -
- - - -
    -
  1. - - [% INCLUDE 'patron-title.inc' patron=patron %] - -
  2. - -
  3. - -
    - -
    -
  4. - -
  5. - - -
  6. - -
  7. - -
  8. - - -
  9. -
-
- -
- -
-
+ + + [% END %] + [% END %] + + [% ELSE %] -
The patron does not have waitings holds.
+
There have not been any deliveries today.
+ [% END # /IF delivered_today.count %] + [% END # /tab_panel %] + [% WRAPPER tab_panel tabname="schedule-pickup" bt_active = schedule_pickup_active %] + [% IF !patron || ( patron && existing_curbside_pickups.count >= 1 ) %] + [% IF existing_curbside_pickups.count >= 1 %] +
+ [% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %]) already has a scheduled pickup for this library. +
+ [% END %] +
+
+ +
+
+ +
+
+ [% ELSE %] + [% SET waiting_holds = patron.holds.search( found => 'W', branchcode => Branches.GetLoggedInBranchcode ) %] + [% IF !policy.enable_waiting_holds_only || waiting_holds.count > 0 %] +
+ [% INCLUDE 'csrf-token.inc' %] +
+ + + +
    +
  1. + + [% INCLUDE 'patron-title.inc' patron=patron %] + +
  2. + +
  3. + +
    + +
    +
  4. + +
  5. + + +
  6. + +
  7. + +
  8. + + +
  9. +
+
+ +
+ +
+
+ [% ELSE %] +
The patron does not have waitings holds.
+ [% END %] [% END %] - [% END %] -
-
-
+ [% END # /tab_panel %] + [% END # /WRAPPER tab_panels %] + [% END # /WRAPPER tabs %] + [% IF Koha.Preference('CircSidebar') %]