4 [% USE TablesSettings %]
8 [% PROCESS 'patronfields.inc' %]
9 [% SET libraries = Branches.all %]
10 [% SET categories = Categories.all.unblessed %]
11 [% SET columns = ['cardnumber', 'name-address', 'dateofbirth', 'branch', 'category', 'dateexpiry', 'checkouts', 'account_balance', 'borrowernotes', 'action'] %]
12 [% PROCESS 'patron-search.inc' %]
13 [% INCLUDE 'doc-head-open.inc' %]
14 <title>Patrons[% IF ( searching ) %] › Search results[% END %] › Koha</title>
15 [% INCLUDE 'doc-head-close.inc' %]
18 <body id="pat_member" class="pat">
19 [% INCLUDE 'header.inc' %]
20 [% INCLUDE 'patron-search-header.inc' %]
22 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
25 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
27 [% IF ( searching ) %]
29 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
32 <a href="#" aria-current="page">
38 <a href="#" aria-current="page">
46 <div class="main container-fluid">
48 <div class="col-sm-10 col-sm-push-2">
51 [% IF CAN_user_tools_manage_patron_lists %]
52 <div id="patron_list_dialog" class="dialog message">
53 Added <span class="patrons-length"></span> patrons to <a></a>.
57 [% INCLUDE 'patron-toolbar.inc' %]
58 [% INCLUDE 'noadd-warnings.inc' %]
60 [% IF CAN_user_borrowers_edit_borrowers && pending_borrower_modifications %]
61 <div class="pending-info" id="patron_updates_pending">
62 <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>:
63 <span class="number_box"><a href="/cgi-bin/koha/members/members-update.pl">[% pending_borrower_modifications | html %]</a></span>
67 <div id="searchresults">
68 [% IF CAN_user_tools_manage_patron_lists || CAN_user_borrowers_edit_borrowers %]
69 <div class="searchheader fh-fixedHeader" id="searchheader" style="display:none;">
71 <a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a>
73 <a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
74 [% IF CAN_user_tools_manage_patron_lists %]
78 [% IF CAN_user_tools_manage_patron_lists %]
79 <div id="patronlist-dropdown" class="btn-group">
80 <button id="patronlist-menu" type="button" class="btn btn-sm btn-default dropdown-toggle patron-edits disabled" disabled="disabled" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
81 Add to patron list <span class="caret"></span>
83 <ul class="dropdown-menu">
85 [% FOREACH pl IN patron_lists %]
86 <li><a href="#" class="patron-list-add" data-listid="[% pl.patron_list_id | html %]">[% pl.name | html %]</a></li>
89 <li role="separator" class="divider"></li>
90 <li><a href="#" class="patron-list-add" data-listid="new">New list</a></li>
95 [% IF CAN_user_borrowers_edit_borrowers %]
96 <button id="merge-patrons" class="btn btn-sm btn-default disabled" disabled="disabled" type="submit"><i class="fa fa-compress" aria-hidden="true"></i> Merge selected patrons</button>
102 [% IF CAN_user_borrowers_edit_borrowers || CAN_user_tools_manage_patron_lists %]
103 [% columns.unshift('checkbox') | html %]
105 [% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %]
109 </div> <!-- /.col-sm-10.col-sm-push-2 -->
111 <div class="col-sm-2 col-sm-pull-10">
113 [% PROCESS patron_search_filters categories => categories, libraries => libraries, filters => ['search_field', 'search_type', 'category', 'branch'], search_filter => searchmember %]
115 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
116 </div> <!-- /.row -->
118 <!-- New Patron List Modal -->
119 <div class="modal" id="new-patron-list" tabindex="-1" role="dialog" aria-labelledby="new-patron-listLabel">
120 <div class="modal-dialog" role="document">
121 <div class="modal-content">
122 <div class="modal-header">
123 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
124 <h4 class="modal-title" id="new-patron-listLabel">Add patrons to a new patron list</h4>
126 <form id="new-patron-list_form">
127 <div class="modal-body">
128 <div class="form-group">
129 <label for="new_patron_list" class="required">Patron list name: </label>
130 <input class="form-control required" type="text" name="new_patron_list" id="new_patron_list" required="required" />
131 <input type="hidden" name="add_to_patron_list" id="add_to_patron_list" />
132 <span class="required">Required</span>
134 </div> <!-- /.modal-body -->
135 <div class="modal-footer">
136 <button type="submit" id="add_to_patron_list_submit" class="btn btn-default approve">Submit</button>
137 <button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button>
138 </div> <!-- /.modal-footer -->
139 </form> <!-- /#new-patron-list_form -->
140 </div> <!-- /.modal-content -->
141 </div> <!-- /.modal-dialog -->
142 </div> <!-- /#new-patron-list -->
144 [% MACRO jsinclude BLOCK %]
145 [% INCLUDE 'datatables.inc' %]
146 [% INCLUDE 'columns_settings.inc' %]
147 [% INCLUDE 'str/members-menu.inc' %]
148 [% Asset.js("js/members-menu.js") | $raw %]
151 $(document).ready(function() {
152 $('#merge-patrons').prop('disabled', true);
153 $('#memberresultst').on('change', 'input.selection', function() {
154 if ( $('.selection:checked').length > 1 ) {
155 /* More than one checkbox has been checked */
156 $('#merge-patrons').prop('disabled', false).removeClass("disabled");
157 $("#patronlist-menu").removeClass("disabled").prop("disabled", false);
158 } else if ( $('.selection:checked').length == 1 ) {
159 /* At least one checkbox has been checked */
160 $('#merge-patrons').prop('disabled', true).addClass("disabled");
161 $("#patronlist-menu").removeClass("disabled").prop("disabled", false);
163 /* No checkbox has been checked */
164 $('#merge-patrons').prop('disabled', true).addClass("disabled");
165 $("#patronlist-menu").addClass("disabled").prop("disabled", true);
169 $('#merge-patrons').on('click', function() {
170 var merge_patrons_url = 'merge-patrons.pl?' + $('.selection:checked')
172 return "id=" + $(this).val()
174 window.location.href = merge_patrons_url;
177 $("#patronlist-dropdown").on("click", ".patron-list-add", function(e){
180 if ( $("#memberresultst input:checkbox:checked").length == 0 ) {
181 alert( _("You have not selected any patrons to add to a list!") );
182 $(".btn-group").removeClass("open"); /* Close button menu */
186 var listid = $(this).data("listid");
187 $("#add_to_patron_list").val( listid );
188 if( listid == "new" ){
189 /* #add_to_patron_list value "new" in the modal form will tell API to create a new list */
190 $("#new-patron-list").modal("show");
192 /* Ajax submit the patrons to list */
198 /* Submit selected patrons to a list via AJAX */
199 $("#new-patron-list_form").on('submit', function(e){
201 /* Upon submitting modal patron list add form... */
202 if ( $('#new_patron_list').val() ) {
203 $(".patron-list-add").each(function() {
204 /* Check each list name in the menu of patron lists */
205 /* If submitted list name matches... */
206 if ( $(this).text() == $('#new_patron_list').val() ) {
207 alert( _("You already have a list with that name!") );
212 alert( _("You must give your new patron list a name!") );
215 $("#new-patron-list").modal("hide");
219 $("#select_all").on("click",function(e){
221 $(".selection").prop("checked", true).change();
223 $("#clear_all").on("click",function(e){
225 $(".selection").prop("checked", false).change();
228 [% IF searchmember %]
229 $("#searchmember_filter").val("[% searchmember | html %]");
231 [% IF searchfieldstype %]
232 $("searchfieldstype_filter").val("[% searchfieldstype | html %]");
235 $("#searchtype_filter").val("[% searchtype | html %]");
237 [% IF categorycode %]
238 $("#categorycode_filter").val("[% categorycode_filter | html %]");
241 $("#branchcode_filter").val("[% branchcode_filter | html %]");
244 $("#searchheader").hide();
245 $("#patron_search_form").on('submit', function(){$("#searchheader").show();});
246 $("#clear_search").on("click",function(e){$("#searchheader").hide();});
249 function patronListAdd(){
250 var borrowernumbers = [];
251 $("#memberresultst").find("input:checkbox:checked").each(function(){
252 borrowernumbers.push($(this).val());
255 add_to_patron_list: $("#add_to_patron_list").val(),
256 new_patron_list: $("#new_patron_list").val(),
257 borrowernumbers: borrowernumbers
262 url: '/cgi-bin/koha/svc/members/add_to_list',
263 success: function(data) {
264 $("#patron_list_dialog").show();
265 $("#patron_list_dialog > span.patrons-length").html(data.patrons_added_to_list);
266 $("#patron_list_dialog > a").attr("href", "/cgi-bin/koha/patron_lists/list.pl?patron_list_id=" + data.patron_list.patron_list_id);
267 $("#patron_list_dialog > a").html(data.patron_list.name);
269 if ( $('#add_to_patron_list').val() == 'new' ) {
270 /* Add a new entry to the menu */
271 $("#patronlist-dropdown .divider").before('<li><a class="patron-list-add" href="#" data-listid="' + data.patron_list.patron_list_id + '">' + data.patron_list.name + '</li>');
275 alert( _("An error occurred. Patron list could not be updated.") );
281 $('#memberresultst tbody').on('click','td',function(e){
282 var $checkbox = $(this).find("input[type=checkbox]");
283 if (e.target.type != "checkbox") {
284 $checkbox.prop('checked', !$checkbox.prop("checked"));
292 // Apply DataTables on the results table
293 var table_settings = [% TablesSettings.GetTableSettings( 'members', 'member', 'memberresultst', 'json' ) | $raw %];
294 [% UNLESS CAN_user_borrowers_edit_borrowers OR CAN_user_tools_manage_patron_lists %]
295 [%# Remove the first column if we do not display the checkbox %]
296 table_settings['columns'].splice(0, 1);
300 [% IF circsearch == 1 %]
301 [% SET redirect_url = '/cgi-bin/koha/circ/circulation.pl' %]
303 [% SET redirect_url = '/cgi-bin/koha/members/moremember.pl' %]
305 [% PROCESS patron_search_js table_id => 'memberresultst', categories => categories, libraries => libraries, extended_attribute_types => attribute_type_codes, columns => columns,actions => ['edit', 'checkout'], redirect_if_one_result => 1, redirect_url => redirect_url, sticky_header => "searchheader", sticky_to => "searchresults", default_sort_column => 'name-address', display_search_description => 1 %]
309 [% INCLUDE 'intranet-bottom.inc' %]