4 [% USE TablesSettings %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 [% INCLUDE 'columns_settings.inc' %]
8 <title>Add patrons › [% list.name | html %] › Patron lists › Tools › Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
12 #add_patrons_by_search {
27 <body id="patlist_list" class="pat patlist">
28 [% WRAPPER 'header.inc' %]
29 [% INCLUDE 'cat-search.inc' %]
32 [% WRAPPER 'sub-header.inc' %]
33 [% WRAPPER breadcrumbs %]
34 [% WRAPPER breadcrumb_item %]
35 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
37 [% WRAPPER breadcrumb_item %]
38 <a href="lists.pl">Patron lists</a>
40 [% WRAPPER breadcrumb_item %]
41 <a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% list.id | uri %]">[% list.name | html %]</a>
43 [% WRAPPER breadcrumb_item bc_active= 1 %]
44 <span>Add patrons</span>
46 [% END #/ WRAPPER breadcrumbs %]
47 [% END #/ WRAPPER sub-header.inc %]
49 <div class="main container-fluid">
51 <div class="col-sm-10 col-sm-push-2">
54 <h1>[% list.name | html %]</h1>
56 [% IF ( not_found.size > 0 ) %]
57 [% IF id_column == 'borrowernumbers' %]
58 <div class="dialog alert"><p>Warning, the following borrowernumbers were not found:</p></div>
60 <div class="dialog alert"><p>Warning, the following cardnumbers were not found:</p></div>
62 <table style="margin:auto;">
64 [% IF id_column == 'borrowernumbers' %]
65 <tr><th>Borrowernumbers not found</th></tr>
67 <tr><th>Cardnumbers not found</th></tr>
71 [% FOREACH nf IN not_found %]
72 <tr><td>[% nf | html %]</td></td>
78 [% IF ( existed.size > 0 ) %]
79 [% IF id_column == 'borrowernumbers' %]
80 <div class="dialog alert"><p>Warning, the following borrowernumbers were already in this list:</p></div>
82 <div class="dialog alert"><p>Warning, the following cardnumbers were already in this list:</p></div>
84 <table style="margin:auto;">
86 [% IF id_column == 'borrowernumbers' %]
87 <tr><th>Borrowernumbers already in list</th></tr>
89 <tr><th>Cardnumbers already in list</th></tr>
93 [% FOREACH ed IN existed %]
94 <tr><td>[% ed | html %]</td></td>
100 <form action="list.pl" id="add_patrons" method="post" class="clearfix">
101 <fieldset class="rows">
102 <legend>Add patrons</legend>
104 <li id="patron_search_line">
105 <label for="find_patron">Patron search: </label>
106 <input autocomplete="off" id="find_patron" type="text" style="width:150px" class="noEnterSubmit" />
108 <li id="add_patrons_by_search"><a href="#">
109 <span class="label"> </span>
110 <i class="fa fa-plus"></i> Search for patrons</a></li>
111 <li id="add_patrons_by_id"><a href="#">
112 <span class="label"> </span>
113 <i class="fa fa-plus"></i> Add multiple patrons</a></li>
114 <span id="patron_ids_line">
115 <li><strong>Choose type of IDs to enter:</strong></li>
117 <label class="id_choice" for="add_by_cardnumbers">
118 <input id="add_by_cardnumbers" type="radio" name="id_column" value="cardnumbers" checked="checked">
119 <span class="add_by_cardnumbers">Cardnumbers</span>
121 <label class="id_choice" for="add_by_borrowernumbers">
122 <input id="add_by_borrwernumbers" type="radio" name="id_column" value="borrowernumbers">
123 <span class="add_by_borrowernumbers">Borrowernumbers</span>
127 <label for="patrons_by_id">List (one ID per line):</label>
128 <textarea id="patrons_by_id" name="patrons_by_id" id="" cols="30" rows="10"></textarea>
133 <fieldset id="patron_ids_submit" class="action">
134 <input type="submit" class="btn btn-primary" value="Submit" />
137 <div class="clearfix"></div>
139 <fieldset id="patrons_to_add_fieldset">
140 <legend>Patrons to be added</legend>
141 <div id="patrons_to_add"></div>
143 <fieldset class="action">
144 <input type="hidden" name="patron_list_id" value="[% list.patron_list_id | html %]" />
145 <input type="submit" class="btn btn-primary" value="Add patrons" />
146 <a href="lists.pl" class="cancel">Cancel</a>
151 <form action="list.pl" id="remove_patrons" method="post">
153 <div class="searchheader" id="searchheader">
154 <span class="checkall"><a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a></span> |
155 <span class="clearall"><a id="CheckNone" href="#"><i class="fa fa-times"></i> Clear all</a></span> |
156 <div class="btn-group">
157 <button class="btn btn-default btn-xs list-remove" type="submit"><i class="fa fa-trash-can"></i> Remove selected</button>
160 <div class="btn-group">
161 <button class="btn btn-default btn-xs merge-patrons"><i class="fa fa-compress"></i> Merge selected patrons</button>
165 <div class="page-section">
166 <table id="patron-list-table">
169 <th class="NoSort"> </th>
182 [% FOREACH p IN list.patron_list_patrons %]
185 <input type="checkbox" name="patrons_to_remove" class="selection" value="[% p.patron_list_patron_id | html %]" />
186 <input type="hidden" id="borrowernumber_[% p.patron_list_patron_id | html %]" value="[% p.borrowernumber.id | html %]" />
189 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber | uri %]">
190 [% p.borrowernumber.cardnumber | html %]
193 <td>[% p.borrowernumber.firstname | html %]</td>
194 <td>[% p.borrowernumber.surname | html %]</td>
196 [% p.borrowernumber.address | html %]
197 [% p.borrowernumber.address2 | html %]
198 [% p.borrowernumber.city | html %]
199 [% p.borrowernumber.state | html %]
200 [% p.borrowernumber.country | html %]
202 <td>[% p.borrowernumber.categorycode.description | html %] ([% p.borrowernumber.categorycode.categorycode | html %])</td>
203 <td>[% p.borrowernumber.branchcode.branchname | html %]</td>
204 <td data-order="[% p.borrowernumber.dateexpiry | html %]">[% p.borrowernumber.dateexpiry | $KohaDates %]</td>
205 <td>[% p.borrowernumber.borrowernotes | $raw | html_line_break %]</td>
210 </div> <!-- /.page-section -->
212 <fieldset class="action">
213 <input type="hidden" name="patron_list_id" value="[% list.patron_list_id | html %]" />
214 <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>
215 <button class="btn btn-default btn-sm merge-patrons" type="submit"><i class="fa fa-compress"></i> Merge selected patrons</button>
220 </div> <!-- /.col-sm-10.col-sm-push-2 -->
222 <div class="col-sm-2 col-sm-pull-10">
224 [% INCLUDE 'tools-menu.inc' %]
226 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
227 </div> <!-- /.row -->
229 [% MACRO jsinclude BLOCK %]
230 [% Asset.js("js/tools-menu.js") | $raw %]
231 [% INCLUDE 'datatables.inc' %]
234 var MSG_REMOVE_PATRON = _("Remove");
235 $(document).ready(function() {
236 $('#patrons_to_add_fieldset').hide();
238 var table_settings = [% TablesSettings.GetTableSettings('members', 'patron-lists', 'patron-list-table', 'json') | $raw %]
239 KohaTable('patron-list-table', {
240 "sPaginationType": "full"
243 function AddPatron( patron_name, value, container, input_name ) {
244 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>";
245 $(container).append( div );
247 $(container).parent().show( 800 );
249 function RemovePatron( cardnumber, container ) {
250 $( '#borrower_' + cardnumber ).remove();
252 if ( ! $(container).html() ) {
253 $(container).parent("fieldset").hide( 800 );
256 patron_autocomplete($("#find_patron"), {
257 'on-select-callback': function( event, ui ) {
258 var field = ui.item.cardnumber;
259 AddPatron( ( ui.item.firstname || "" ) + " " + ( ui.item.middle_name || "" ) + " " + ( ui.item.surname || "" ), field, $("#patrons_to_add"), 'patrons_to_add' );
260 $("#find_patron").val('').focus();
264 $("body").on("click",".removePatron",function(e){
266 var divid = $(this).parent().attr("id");
267 var cardnumber = divid.replace("borrower_","");
268 RemovePatron(cardnumber, $("#patrons_to_add"));
271 $("body").on("click", "#CheckAll", function(e){
273 $("input[type='checkbox']","#patron-list-table").each(function(){
274 $(this).prop("checked",1);
277 $("body").on("click", "#CheckNone", function(e){
279 $("input[type='checkbox']","#patron-list-table").each(function(){
280 $(this).prop("checked",0);
284 $("#remove_patrons").submit(function(){
285 var checkedItems = $("input:checked");
286 if ($(checkedItems).size() == 0) {
287 alert(_("You must select one or more patrons to remove"));
290 $(checkedItems).parents('tr').addClass("warn");
291 if( confirm(_("Are you sure you want to remove the selected patrons?")) ) {
294 $(checkedItems).parents('tr').removeClass("warn");
299 $("#add_patrons_by_id a").on("click", function(){
300 $("#add_patrons_by_id, #patron_search_line").hide();
301 $("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").show();
304 $("#add_patrons_by_search a").on("click", function(){
305 $("#add_patrons_by_id, #patron_search_line").show();
306 $("#add_patrons_by_search, #patron_ids_line, #patron_ids_submit").hide();
309 $('.merge-patrons').on('click', function() {
310 var checkedItems = $("input:checked");
311 if ($(checkedItems).length < 2) {
312 alert(_("You must select two or more patrons to merge"));
315 $(checkedItems).parents('tr').addClass("warn");
316 if (confirm(_("Are you sure you want to merge the selected patrons?"))) {
317 var merge_patrons_url = '/cgi-bin/koha/members/merge-patrons.pl?' +
318 $('.selection:checked')
320 return "id=" + $( '#borrowernumber_' + $(this).val() ).val()
323 window.location.href = merge_patrons_url;
326 $(checkedItems).parents('tr').removeClass("warn");
334 [% INCLUDE 'intranet-bottom.inc' %]