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