Lines 96-103
Link Here
|
96 |
[% END %] |
96 |
[% END %] |
97 |
|
97 |
|
98 |
[% IF CAN_user_borrowers_edit_borrowers %] |
98 |
[% IF CAN_user_borrowers_edit_borrowers %] |
99 |
<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> |
99 |
<div class="btn-group"> |
|
|
100 |
<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> |
101 |
</div> |
102 |
[% END %] |
103 |
|
104 |
[% IF CAN_user_tools_edit_patrons %] |
105 |
<div class="btn-group"> |
106 |
<button id="batch-mod-patrons" class="btn btn-default btn-sm" type="button"><i class="fa fa-pencil" aria-hidden="true"></i> Batch patron modification</button> |
107 |
</div> |
100 |
[% END %] |
108 |
[% END %] |
|
|
109 |
|
101 |
<div id="patron_search_selected" class="btn-group" style="display:none;"> |
110 |
<div id="patron_search_selected" class="btn-group" style="display:none;"> |
102 |
<span></span> |
111 |
<span></span> |
103 |
<a href="#" id="clear-patron-selection"><i class="fa fa-remove"></i> Clear</a> |
112 |
<a href="#" id="clear-patron-selection"><i class="fa fa-remove"></i> Clear</a> |
Lines 111-116
Link Here
|
111 |
[% END %] |
120 |
[% END %] |
112 |
[% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %] |
121 |
[% PROCESS patron_search_table table_id => 'memberresultst' columns => columns %] |
113 |
</div> |
122 |
</div> |
|
|
123 |
[% IF CAN_user_tools_edit_patrons %] |
124 |
<form id="patron_batchmod_form" method="post" action="/cgi-bin/koha/tools/modborrowers.pl"> |
125 |
<input type="hidden" name="op" value="show" /> |
126 |
<textarea style="display:none" id="borrowernumberlist" name="borrowernumberlist"></textarea> |
127 |
</form> |
128 |
[% END %] |
114 |
|
129 |
|
115 |
</main> |
130 |
</main> |
116 |
</div> <!-- /.col-sm-10.col-sm-push-2 --> |
131 |
</div> <!-- /.col-sm-10.col-sm-push-2 --> |
Lines 159-165
Link Here
|
159 |
} |
174 |
} |
160 |
|
175 |
|
161 |
$(document).ready(function() { |
176 |
$(document).ready(function() { |
162 |
$('#merge-patrons').prop('disabled', true); |
177 |
$('#merge-patrons, #batch-mod-patrons').prop('disabled', true); |
163 |
$('#memberresultst').on('change', 'input.selection', function() { |
178 |
$('#memberresultst').on('change', 'input.selection', function() { |
164 |
var patron_search_selections = JSON.parse( localStorage.getItem("patron_search_selections") ) || []; |
179 |
var patron_search_selections = JSON.parse( localStorage.getItem("patron_search_selections") ) || []; |
165 |
var borrowernumber = $(this).val(); |
180 |
var borrowernumber = $(this).val(); |
Lines 182-198
Link Here
|
182 |
} |
197 |
} |
183 |
} |
198 |
} |
184 |
if ( patron_search_selections.length > 1 ) { |
199 |
if ( patron_search_selections.length > 1 ) { |
185 |
/* More than one checkbox has been checked */ |
200 |
/* More than one checkbox has been checked. All batch options enabled */ |
186 |
$('#merge-patrons').prop('disabled', false).removeClass("disabled"); |
201 |
$("#batch-mod-patrons, #merge-patrons, #patronlist-menu").removeClass("disabled").prop("disabled", false); |
187 |
$("#patronlist-menu").removeClass("disabled").prop("disabled", false); |
|
|
188 |
} else if ( patron_search_selections.length == 1 ) { |
202 |
} else if ( patron_search_selections.length == 1 ) { |
189 |
/* At least one checkbox has been checked */ |
203 |
/* Only one checkbox has been checked */ |
|
|
204 |
$("#batch-mod-patrons, #patronlist-menu").removeClass("disabled").prop("disabled", false); |
205 |
/* Merge requires more than one selection */ |
190 |
$('#merge-patrons').prop('disabled', true).addClass("disabled"); |
206 |
$('#merge-patrons').prop('disabled', true).addClass("disabled"); |
191 |
$("#patronlist-menu").removeClass("disabled").prop("disabled", false); |
|
|
192 |
} else { |
207 |
} else { |
193 |
/* No checkbox has been checked */ |
208 |
/* No checkbox has been checked. No batch options enabled */ |
194 |
$('#merge-patrons').prop('disabled', true).addClass("disabled"); |
209 |
$("#batch-mod-patrons, #merge-patrons, #patronlist-menu").addClass("disabled").prop("disabled", true); |
195 |
$("#patronlist-menu").addClass("disabled").prop("disabled", true); |
|
|
196 |
} |
210 |
} |
197 |
}); |
211 |
}); |
198 |
|
212 |
|
Lines 204-214
Link Here
|
204 |
|
218 |
|
205 |
$("#clear-patron-selection").on("click", function(e){ |
219 |
$("#clear-patron-selection").on("click", function(e){ |
206 |
e.preventDefault(); |
220 |
e.preventDefault(); |
207 |
$(".selection").prop("checked", false).change(); |
221 |
$("input.selection").prop("checked", false).change(); |
208 |
localStorage.removeItem("patron_search_selections"); |
222 |
localStorage.removeItem("patron_search_selections"); |
209 |
$("#patron_search_selected").hide(); |
223 |
$("#patron_search_selected").hide(); |
210 |
$('#merge-patrons').prop('disabled', true).addClass("disabled"); |
224 |
$('#merge-patrons, #patronlist-menu, #batch-mod-patrons').prop('disabled', true).addClass("disabled"); |
211 |
$("#patronlist-menu").addClass("disabled").prop("disabled", true); |
225 |
$("#borrowernumberlist").val(""); |
212 |
}); |
226 |
}); |
213 |
|
227 |
|
214 |
$("#patronlist-dropdown").on("click", ".patron-list-add", function(e){ |
228 |
$("#patronlist-dropdown").on("click", ".patron-list-add", function(e){ |
Lines 230-236
Link Here
|
230 |
|
244 |
|
231 |
patronListAdd(); |
245 |
patronListAdd(); |
232 |
} |
246 |
} |
233 |
}) |
247 |
}); |
|
|
248 |
|
249 |
$("#batch-mod-patrons").on("click", function(e) { |
250 |
e.preventDefault(); |
251 |
var patron_search_selections = JSON.parse( localStorage.getItem("patron_search_selections") ) || []; |
252 |
if( patron_search_selections.length > 0 ){ |
253 |
$("#borrowernumberlist").html( patron_search_selections.join('\n') ); |
254 |
$("#patron_batchmod_form").submit(); |
255 |
} |
256 |
}); |
234 |
|
257 |
|
235 |
/* Submit selected patrons to a list via AJAX */ |
258 |
/* Submit selected patrons to a list via AJAX */ |
236 |
$("#new-patron-list_form").on('submit', function(e){ |
259 |
$("#new-patron-list_form").on('submit', function(e){ |
Lines 255-261
Link Here
|
255 |
|
278 |
|
256 |
$("#select_all").on("click",function(e){ |
279 |
$("#select_all").on("click",function(e){ |
257 |
e.preventDefault(); |
280 |
e.preventDefault(); |
258 |
$(".selection").each(function(){ |
281 |
$("input.selection").each(function(){ |
259 |
if( $(this).prop("checked") == false ){ |
282 |
if( $(this).prop("checked") == false ){ |
260 |
$(this).prop( "checked", true ).change(); |
283 |
$(this).prop( "checked", true ).change(); |
261 |
} |
284 |
} |
Lines 263-269
Link Here
|
263 |
}); |
286 |
}); |
264 |
$("#clear_all").on("click",function(e){ |
287 |
$("#clear_all").on("click",function(e){ |
265 |
e.preventDefault(); |
288 |
e.preventDefault(); |
266 |
$(".selection").each(function(){ |
289 |
$("input.selection").each(function(){ |
267 |
if( $(this).prop("checked") ){ |
290 |
if( $(this).prop("checked") ){ |
268 |
$(this).prop("checked", false ).change(); |
291 |
$(this).prop("checked", false ).change(); |
269 |
} |
292 |
} |
Lines 339-346
Link Here
|
339 |
}); |
362 |
}); |
340 |
|
363 |
|
341 |
if( selected_patrons.length > 1 ){ |
364 |
if( selected_patrons.length > 1 ){ |
342 |
$('#merge-patrons').removeClass("disabled").prop('disabled', false); |
365 |
$('#batch-mod-patrons, #merge-patrons, #patronlist-menu').removeClass("disabled").prop('disabled', false); |
343 |
$('#patronlist-menu').removeClass("disabled").prop('disabled', false); |
|
|
344 |
} |
366 |
} |
345 |
} |
367 |
} |
346 |
} |
368 |
} |
347 |
- |
|
|