Bugzilla – Attachment 123252 Details for
Bug 28261
Add visual feedback on overridden pickup locations on patron's page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28261: Add visual feedback on overridden pickup locations on patron's page
Bug-28261-Add-visual-feedback-on-overridden-pickup.patch (text/plain), 6.80 KB, created by
Nick Clemens (kidclamp)
on 2021-07-28 13:52:19 UTC
(
hide
)
Description:
Bug 28261: Add visual feedback on overridden pickup locations on patron's page
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-07-28 13:52:19 UTC
Size:
6.80 KB
patch
obsolete
>From 1954e99c01911422288f520eb2b38d111bc779e8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 29 Apr 2021 08:53:43 -0300 >Subject: [PATCH] Bug 28261: Add visual feedback on overridden pickup locations > on patron's page > >This patch makes the patron pages in the staff interface use the API and >Select2 to render the pickup locations list. This has the effect of >adding visual feedback on those pickup locations that need an override, >based on the current configuration options. > >All the checks are done in the GET /holds/:hold_id/pickup_locations >route, so this is a fairly trivial change. > >To test: >1. Have a couple holds for a patron, some overrriden, some not >2. Visit the patrons' detail page, holds tab. >=> SUCCESS: You see the holds, pickup location has a dropdown >3. Repeat in the circulation tab for the patron >=> SUCCESS: You see the holds, pickup location has a dropdown >4. Apply this patch >5. Repeat 2 and 3 >=> SUCCESS: Same behavior as before, but the dropdown is rendered with >Select2 and has a search feature. Overridden pickup locations have an >icon telling so >6. Sign off :-D > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../prog/en/modules/circ/circulation.tt | 1 + > .../prog/en/modules/members/moremember.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/holds.js | 57 ++++++++++++++++++- > 3 files changed, 57 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 1771a941f0..6e7aa020de 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -967,6 +967,7 @@ > [% INCLUDE 'columns_settings.inc' %] > [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %] > [% INCLUDE 'timepicker.inc' %] >+ [% INCLUDE 'select2.inc' %] > [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] > <script> > /* Set some variable needed in circulation.js */ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 42cbbe0ee9..39024d6ffa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -858,6 +858,7 @@ > [% INCLUDE 'calendar.inc' %] > [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %] > [% INCLUDE 'timepicker.inc' %] >+ [% INCLUDE 'select2.inc' %] > <script> > /* Set some variable needed in circulation.js */ > var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]"; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js >index e076fa5536..820e0e5b68 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/holds.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js >@@ -78,7 +78,7 @@ $(document).ready(function() { > { > "mDataProp": function( oObj ) { > if( oObj.branches.length > 1 && oObj.found !== 'W' && oObj.found !== 'T' ){ >- var branchSelect='<select priority='+oObj.priority+' class="hold_location_select" reserve_id="'+oObj.reserve_id+'" name="pick-location">'; >+ var branchSelect='<select priority='+oObj.priority+' class="hold_location_select" data-hold-id="'+oObj.reserve_id+'" reserve_id="'+oObj.reserve_id+'" name="pick-location">'; > for ( var i=0; i < oObj.branches.length; i++ ){ > var selectedbranch; > var setbranch; >@@ -219,7 +219,60 @@ $(document).ready(function() { > }); > }); > >- $(".hold_location_select").change(function(){ >+ function display_pickup_location (state) { >+ var $text; >+ if ( state.needs_override === true ) { >+ $text = $( >+ '<span>' + state.text + '</span> <span style="float:right;" title="' + >+ _("This pickup location is not allowed according to circulation rules") + >+ '"><i class="fa fa-exclamation-circle" aria-hidden="true"></i></span>' >+ ); >+ } >+ else { >+ $text = $('<span>'+state.text+'</span>'); >+ } >+ >+ return $text; >+ }; >+ >+ $(".hold_location_select").each( function () { >+ var this_dropdown = $(this); >+ var hold_id = $(this).data('hold-id'); >+ >+ this_dropdown.select2({ >+ allowClear: false, >+ ajax: { >+ url: '/api/v1/holds/' + encodeURIComponent(hold_id) + '/pickup_locations', >+ delay: 300, // wait 300 milliseconds before triggering the request >+ dataType: 'json', >+ cache: true, >+ data: function (params) { >+ var search_term = (params.term === undefined) ? '' : params.term; >+ var query = { >+ "q": JSON.stringify({"name":{"-like":search_term+'%'}}), >+ "_order_by": "name" >+ }; >+ return query; >+ }, >+ processResults: function (data) { >+ var results = []; >+ data.forEach( function ( pickup_location ) { >+ results.push( >+ { >+ "id": pickup_location.library_id.escapeHtml(), >+ "text": pickup_location.name.escapeHtml(), >+ "needs_override": pickup_location.needs_override >+ } >+ ); >+ }); >+ return { "results": results }; >+ } >+ }, >+ templateResult: display_pickup_location >+ }); >+ }); >+ >+ $(".hold_location_select").on("change", function(){ > $(this).prop("disabled",true); > var cur_select = $(this); > var res_id = $(this).attr('reserve_id'); >-- >2.20.1
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 28261
:
120313
|
120493
|
123111
| 123252 |
123253