4 [% USE TablesSettings %]
5 [% PROCESS 'i18n.inc' %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 [% INCLUDE 'columns_settings.inc' %]
9 <title>[% FILTER collapse %]
10 [% list.name | html %] ›
11 [% t("Patron lists") | html %] ›
12 [% t("Tools") | html %] ›
13 [% t("Koha") | html %]
15 [% INCLUDE 'doc-head-close.inc' %]
18 #add_patrons_by_search {
33 <body id="patlist_list" class="pat patlist">
34 [% WRAPPER 'header.inc' %]
35 [% INCLUDE 'cat-search.inc' %]
38 [% WRAPPER 'sub-header.inc' %]
39 [% WRAPPER breadcrumbs %]
40 [% WRAPPER breadcrumb_item %]
41 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
43 [% WRAPPER breadcrumb_item %]
44 <a href="lists.pl">Patron lists</a>
46 [% WRAPPER breadcrumb_item bc_active= 1 %]
47 [% list.name | html %]
49 [% END #/ WRAPPER breadcrumbs %]
50 [% END #/ WRAPPER sub-header.inc %]
52 <div class="main container-fluid">
54 <div class="col-sm-10 col-sm-push-2">
57 <h1>[% list.name | html %]</h1>
59 [% IF ( not_found.size > 0 ) %]
60 [% IF id_column == 'borrowernumbers' %]
61 <div class="dialog alert"><p>Warning, the following borrowernumbers were not found:</p></div>
63 <div class="dialog alert"><p>Warning, the following cardnumbers were not found:</p></div>
65 <table style="margin:auto;">
67 [% IF id_column == 'borrowernumbers' %]
68 <tr><th>Borrowernumbers not found</th></tr>
70 <tr><th>Cardnumbers not found</th></tr>
74 [% FOREACH nf IN not_found %]
75 <tr><td>[% nf | html %]</td></td>
81 [% IF ( existed.size > 0 ) %]
82 [% IF id_column == 'borrowernumbers' %]
83 <div class="dialog alert"><p>Warning, the following borrowernumbers were already in this list:</p></div>
85 <div class="dialog alert"><p>Warning, the following cardnumbers were already in this list:</p></div>
87 <table style="margin:auto;">
89 [% IF id_column == 'borrowernumbers' %]
90 <tr><th>Borrowernumbers already in list</th></tr>
92 <tr><th>Cardnumbers already in list</th></tr>
96 [% FOREACH ed IN existed %]
97 <tr><td>[% ed | html %]</td></td>
103 <form action="list.pl" id="add_patrons" method="post" class="clearfix">
104 <fieldset class="rows">
105 <legend>Add patrons</legend>
107 <li id="patron_search_line">
108 <label for="find_patron">Patron search: </label>
109 <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
111 <li id="add_patrons_by_search"><a href="#">
112 <span class="label"> </span>
113 <i class="fa fa-plus"></i> Search for patrons</a></li>
114 <li id="add_patrons_by_id"><a href="#">
115 <span class="label"> </span>
116 <i class="fa fa-plus"></i> Add multiple patrons</a></li>
117 <span id="patron_ids_line">
118 <li><strong>Choose type of IDs to enter:</strong></li>
120 <label class="id_choice" for="add_by_cardnumbers">
121 <input id="add_by_cardnumbers" type="radio" name="id_column" value="cardnumbers" checked="checked">
122 <span class="add_by_cardnumbers">Cardnumbers</span>
124 <label class="id_choice" for="add_by_borrowernumbers">
125 <input id="add_by_borrwernumbers" type="radio" name="id_column" value="borrowernumbers">
126 <span class="add_by_borrowernumbers">Borrowernumbers</span>
130 <label for="patrons_by_id">List (one ID per line):</label>
131 <textarea id="patrons_by_id" name="patrons_by_id" id="" cols="30" rows="10"></textarea>
136 <fieldset id="patron_ids_submit" class="action">
137 <input type="submit" class="btn btn-primary" value="Submit" />
140 <div class="clearfix"></div>
142 <fieldset id="patrons_to_add_fieldset">
143 <legend>Patrons to be added</legend>
144 <div id="patrons_to_add"></div>
146 <fieldset class="action">
147 <input type="hidden" name="patron_list_id" value="[% list.patron_list_id | html %]" />
148 <input type="submit" class="btn btn-primary" value="Add patrons" />
149 <a href="lists.pl" class="cancel">Cancel</a>
154 <form action="list.pl" id="remove_patrons" method="post">
156 <div class="searchheader" id="searchheader">
157 <span class="checkall"><a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a></span> |
158 <span class="clearall"><a id="CheckNone" href="#"><i class="fa fa-times"></i> Clear all</a></span> |
159 <div class="btn-group">
160 <button class="btn btn-default btn-xs list-remove" type="submit"><i class="fa fa-trash-can"></i> Remove selected</button>
163 <div class="btn-group">
164 <button class="btn btn-default btn-xs merge-patrons"><i class="fa fa-compress"></i> Merge selected patrons</button>
168 <div class="page-section">
169 <table id="patron-list-table">
172 <th class="NoSort"> </th>
185 [% FOREACH p IN list.patron_list_patrons %]
188 <input type="checkbox" name="patrons_to_remove" class="selection" value="[% p.patron_list_patron_id | html %]" />
189 <input type="hidden" id="borrowernumber_[% p.patron_list_patron_id | html %]" value="[% p.borrowernumber.id | html %]" />
192 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber | uri %]">
193 [% p.borrowernumber.cardnumber | html %]
196 <td>[% p.borrowernumber.firstname | html %]</td>
197 <td>[% p.borrowernumber.surname | html %]</td>
199 [% p.borrowernumber.address | html %]
200 [% p.borrowernumber.address2 | html %]
201 [% p.borrowernumber.city | html %]
202 [% p.borrowernumber.state | html %]
203 [% p.borrowernumber.country | html %]
205 <td>[% p.borrowernumber.categorycode.description | html %] ([% p.borrowernumber.categorycode.categorycode | html %])</td>
206 <td>[% p.borrowernumber.branchcode.branchname | html %]</td>
207 <td data-order="[% p.borrowernumber.dateexpiry | html %]">[% p.borrowernumber.dateexpiry | $KohaDates %]</td>
208 <td>[% p.borrowernumber.borrowernotes | $raw | html_line_break %]</td>
213 </div> <!-- /.page-section -->
215 <fieldset class="action">
216 <input type="hidden" name="patron_list_id" value="[% list.patron_list_id | html %]" />
217 <button type="submit" class="btn btn-default btn-sm list-remove"><i class="fa fa-trash-can" aria-hidden="true"></i> Remove selected patrons</button>
218 <button class="btn btn-default btn-sm merge-patrons" type="submit"><i class="fa fa-compress"></i> Merge selected patrons</button>
223 </div> <!-- /.col-sm-10.col-sm-push-2 -->
225 <div class="col-sm-2 col-sm-pull-10">
227 [% INCLUDE 'tools-menu.inc' %]
229 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
230 </div> <!-- /.row -->
232 [% MACRO jsinclude BLOCK %]
233 [% Asset.js("js/tools-menu.js") | $raw %]
234 [% INCLUDE 'datatables.inc' %]
237 var MSG_REMOVE_PATRON = _("Remove");
238 $(document).ready(function() {
239 $('#patrons_to_add_fieldset').hide();
241 var table_settings = [% TablesSettings.GetTableSettings('members', 'patron-lists', 'patron-list-table', 'json') | $raw %]
242 KohaTable('patron-list-table', {
243 "sPaginationType": "full"
246 function AddPatron( patron_name, value, container, input_name ) {
247 div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash-can' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>";
248 $(container).append( div );
250 $(container).parent().show( 800 );
252 function RemovePatron( cardnumber, container ) {
253 $( '#borrower_' + cardnumber ).remove();
255 if ( ! $(container).html() ) {
256 $(container).parent("fieldset").hide( 800 );
259 patron_autocomplete($("#find_patron"), {
260 'on-select-callback': function( event, ui ) {
261 var field = ui.item.cardnumber;
262 AddPatron( ( ui.item.firstname || "" ) + " " + ( ui.item.middle_name || "" ) + " " + ( ui.item.surname || "" ), field, $("#patrons_to_add"), 'patrons_to_add' );
263 $("#find_patron").val('').focus();
267 $("body").on("click",".removePatron",function(e){
269 var divid = $(this).parent().attr("id");
270 var cardnumber = divid.replace("borrower_","");
271 RemovePatron(cardnumber, $("#patrons_to_add"));
274 $("body").on("click", "#CheckAll", function(e){
276 $("input[type='checkbox']","#patron-list-table").each(function(){
277 $(this).prop("checked",1);
280 $("body").on("click", "#CheckNone", function(e){
282 $("input[type='checkbox']","#patron-list-table").each(function(){
283 $(this).prop("checked",0);
287 $("#remove_patrons").submit(function(){
288 var checkedItems = $("input:checked");
289 if ($(checkedItems).size() == 0) {
290 alert(_("You must select one or more patrons to remove"));
293 $(checkedItems).parents('tr').addClass("warn");
294 if( confirm(_("Are you sure you want to remove the selected patrons?")) ) {
297 $(checkedItems).parents('tr').removeClass("warn");
302 $("#add_patrons_by_id a").on("click", function(){
303 $("#add_patrons_by_id, #patron_search_line").hide();
304 $("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").show();
307 $("#add_patrons_by_search a").on("click", function(){
308 $("#add_patrons_by_id, #patron_search_line").show();
309 $("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").hide();
312 $('.merge-patrons').on('click', function() {
313 var checkedItems = $("input:checked");
314 if ($(checkedItems).length < 2) {
315 alert(_("You must select two or more patrons to merge"));
318 $(checkedItems).parents('tr').addClass("warn");
319 if (confirm(_("Are you sure you want to merge the selected patrons?"))) {
320 var merge_patrons_url = '/cgi-bin/koha/members/merge-patrons.pl?' +
321 $('.selection:checked')
323 return "id=" + $( '#borrowernumber_' + $(this).val() ).val()
326 window.location.href = merge_patrons_url;
329 $(checkedItems).parents('tr').removeClass("warn");
337 [% INCLUDE 'intranet-bottom.inc' %]