Lines 6-11
Link Here
|
6 |
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> |
6 |
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> |
7 |
[% INCLUDE 'datatables.inc' %] |
7 |
[% INCLUDE 'datatables.inc' %] |
8 |
|
8 |
|
|
|
9 |
<script type="text/javascript" src="[% interface %]/js/autocomplete/patrons.js"></script> |
9 |
<script type="text/javascript"> |
10 |
<script type="text/javascript"> |
10 |
//<![CDATA[ |
11 |
//<![CDATA[ |
11 |
$(document).ready(function() { |
12 |
$(document).ready(function() { |
Lines 21-46
$(document).ready(function() {
Link Here
|
21 |
"sPaginationType": "four_button" |
22 |
"sPaginationType": "four_button" |
22 |
} )); |
23 |
} )); |
23 |
|
24 |
|
24 |
$( "#find_patron" ).autocomplete({ |
25 |
patron_autocomplete({ |
25 |
source: "/cgi-bin/koha/circ/ysearch.pl", |
26 |
patron_container: $("#patrons_to_add"), |
26 |
minLength: 3, |
27 |
input_autocomplete: $("#find_patron"), |
27 |
select: function( event, ui ) { |
28 |
patron_input_name = 'patrons_to_add' |
28 |
AddPatron( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber ); |
|
|
29 |
return false; |
30 |
} |
31 |
}) |
32 |
.data( "ui-autocomplete" )._renderItem = function( ul, item ) { |
33 |
return $( "<li></li>" ) |
34 |
.data( "ui-autocomplete-item", item ) |
35 |
.append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) |
36 |
.appendTo( ul ); |
37 |
}; |
38 |
|
39 |
$("body").on("click",".removePatron",function(e){ |
40 |
e.preventDefault(); |
41 |
var divid = $(this).parent().attr("id"); |
42 |
var cardnumber = divid.replace("borrower_",""); |
43 |
RemovePatron(cardnumber); |
44 |
}); |
29 |
}); |
45 |
|
30 |
|
46 |
var checkBoxes = $("input[type='checkbox']","#patron-list-table"); |
31 |
var checkBoxes = $("input[type='checkbox']","#patron-list-table"); |
Lines 74-95
$(document).ready(function() {
Link Here
|
74 |
}); |
59 |
}); |
75 |
}); |
60 |
}); |
76 |
|
61 |
|
77 |
function AddPatron( name, cardnumber ) { |
|
|
78 |
div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' class='removePatron'> " + _("Remove") + " </a> ) <input type='hidden' name='patrons_to_add' value='" + cardnumber + "' /></div>"; |
79 |
$('#patrons_to_add').append( div ); |
80 |
|
81 |
$('#find_patron').val('').focus(); |
82 |
|
83 |
$('#patrons_to_add_fieldset').show( 800 ); |
84 |
} |
85 |
|
86 |
function RemovePatron( cardnumber ) { |
87 |
$( '#borrower_' + cardnumber ).remove(); |
88 |
|
89 |
if ( ! $('#patrons_to_add').html() ) { |
90 |
$('#patrons_to_add_fieldset').hide( 800 ); |
91 |
} |
92 |
} |
93 |
//]]> |
62 |
//]]> |
94 |
</script> |
63 |
</script> |
95 |
|
64 |
|
96 |
- |
|
|