Lines 237-243
Link Here
|
237 |
[% Asset.js("js/tools-menu.js") | $raw %] |
237 |
[% Asset.js("js/tools-menu.js") | $raw %] |
238 |
[% INCLUDE 'datatables.inc' %] |
238 |
[% INCLUDE 'datatables.inc' %] |
239 |
|
239 |
|
240 |
[% Asset.js("js/autocomplete/patrons.js") | $raw %] |
|
|
241 |
<script> |
240 |
<script> |
242 |
var MSG_REMOVE_PATRON = _("Remove"); |
241 |
var MSG_REMOVE_PATRON = _("Remove"); |
243 |
$(document).ready(function() { |
242 |
$(document).ready(function() { |
Lines 248-257
Link Here
|
248 |
"sPaginationType": "full" |
247 |
"sPaginationType": "full" |
249 |
}, table_settings); |
248 |
}, table_settings); |
250 |
|
249 |
|
251 |
patron_autocomplete({ |
250 |
function AddPatron( patron_name, value, container, input_name ) { |
252 |
patron_container: $("#patrons_to_add"), |
251 |
div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>"; |
253 |
input_autocomplete: $("#find_patron"), |
252 |
$(container).append( div ); |
254 |
patron_input_name: 'patrons_to_add' |
253 |
|
|
|
254 |
$(container).parent().show( 800 ); |
255 |
} |
256 |
function RemovePatron( cardnumber, container ) { |
257 |
$( '#borrower_' + cardnumber ).remove(); |
258 |
|
259 |
if ( ! $(container).html() ) { |
260 |
$(container).parent("fieldset").hide( 800 ); |
261 |
} |
262 |
} |
263 |
patron_autocomplete($("#find_patron"), { |
264 |
'on-select-callback': function( event, ui ) { |
265 |
var field = ui.item.cardnumber; |
266 |
AddPatron( ui.item.firstname + " " + ( ui.item.middle_name || "" ) + " " + ui.item.surname, field, $("#patrons_to_add"), 'patrons_to_add' ); |
267 |
$("#find_patron").val('').focus(); |
268 |
return false; |
269 |
} |
270 |
}); |
271 |
$("body").on("click",".removePatron",function(e){ |
272 |
e.preventDefault(); |
273 |
var divid = $(this).parent().attr("id"); |
274 |
var cardnumber = divid.replace("borrower_",""); |
275 |
RemovePatron(cardnumber, $("#patrons_to_add")); |
255 |
}); |
276 |
}); |
256 |
|
277 |
|
257 |
$("body").on("click", "#CheckAll", function(e){ |
278 |
$("body").on("click", "#CheckAll", function(e){ |
258 |
- |
|
|