From 7a25557bfeaa889a8da9ab89dec352f95f12e374 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 5 Jan 2024 12:01:55 +0100 Subject: [PATCH] Bug 35329: Move patron search to modal - edit-batch Test plan: Create new patron card batch Keep the textarea empty and click "Add patron(s)" to open the modal There is a special feature here, the "checkbox" column is displayed and you can select several patrons and click "Add selected patrons". Signed-off-by: Owen Leonard Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- .../prog/en/includes/patron-search.inc | 45 ++++++++++++++++--- .../prog/en/modules/patroncards/edit-batch.tt | 21 +++++---- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index 36614be110..cabe6dc210 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -426,7 +426,7 @@ "searchable": false, "orderable": false, "render": function( data, type, row, meta ) { - return ""; + return ""; } } [% CASE 'cardnumber' %] @@ -657,6 +657,10 @@ patron_search_form.on('submit', filter); patron_search_form.on('submit', update_search_type); + patron_search_form.on('submit', function(){ + parent_block.find(".searchheader").show(); + }); + $(".filterByLetter").on("click",function(e){ e.preventDefault(); @@ -913,14 +917,12 @@
[% IF columns.grep('checkbox').size %] -
+ + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt index 11270294ec..de6bb89c76 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt @@ -2,6 +2,7 @@ [% USE Asset %] [% PROCESS 'i18n.inc' %] [% SET footerjs = 1 %] +[% PROCESS 'patron-search.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] [% IF ( batch_id ) %] @@ -85,7 +86,7 @@ </div> </form> <div id="batch-manage" class="action"> - <a class="btn btn-default" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a> + <a class="btn btn-default" id="additems" href="#patron_search_modal" data-toggle="modal"><i class="fa fa-plus"></i> Add patron(s)</a> [% IF ( table_loop ) %] <a class="btn btn-default" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a> <a class="btn btn-default" id="removeitems" href="#"><i class="fa fa-trash-can"></i> Remove selected patrons</a> @@ -222,13 +223,11 @@ function Add() { var bor_nums = document.getElementById("bor_num_list"); if (bor_nums.value == '') { - window.open("/cgi-bin/koha/members/search.pl?columns=checkbox,cardnumber,name,category,branch,dateexpiry,borrowernotes,action&selection_type=add", - 'PatronPopup', - 'width=1024,height=768,location=yes,toolbar=no,' - + 'scrollbars=yes,resize=yes'); - } else { - document.forms["add_by_bor_num"].submit(); + return true; } + + document.forms["add_by_bor_num"].submit(); + return false }; function add_user(borrowernumber) { @@ -316,8 +315,7 @@ "autoWidth": false })); $("#additems").click(function(){ - Add(); - return false; + return Add(); }); $("#removeitems").click(function(){ Remove(); @@ -385,6 +383,11 @@ }); }); </script> + + [% INCLUDE 'select2.inc' %] + [% SET columns = ['checkbox','cardnumber','name','category','branch','dateexpiry','borrowernotes','action'] %] + [% PROCESS patron_search_modal columns => columns, modal_title => t("Add patrons") %] + [% PROCESS patron_search_js columns => columns, actions => ["add"], preview_on_name_click => 1 %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5