1 $(document).ready(function() {
4 // Don't load holds table unless it is clicked on
5 $("#holds-tab").on( "click", function(){ load_holds_table() } );
7 // If the holds tab is preselected on load, we need to load the table
8 if ( $("#holds-tab").parent().hasClass('ui-state-active') ) { load_holds_table() }
10 function load_holds_table() {
12 holdsTable = $("#holds-table").dataTable({
17 "mDataProp": "reservedate_formatted"
20 "mDataProp": function ( oObj ) {
21 title = "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber="
26 $.each(oObj.subtitle, function( index, value ) {
27 title += " " + value.subfield;
33 title += " " + BY.replace( "_AUTHOR_", oObj.author );
36 if ( oObj.itemnotes ) {
38 if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
39 span_class = "circ-hlt";
41 title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>"
48 "mDataProp": function( oObj ) {
49 return oObj.itemcallnumber || "";
53 "mDataProp": function( oObj ) {
56 if ( oObj.suspend == 1 ) {
57 data += "<p>" + HOLD_IS_SUSPENDED;
58 if ( oObj.suspend_until ) {
59 data += " " + UNTIL.format( oObj.suspend_until_formatted );
66 if ( oObj.found == "W" ) {
68 if ( oObj.waiting_here ) {
69 data += ITEM_IS_WAITING_HERE;
71 data += ITEM_IS_WAITING;
72 data += " " + AT.format( oObj.waiting_at );
75 } else if ( oObj.transferred ) {
76 data += ITEM_IS_IN_TRANSIT.format( oObj.from_branch, oObj.date_sent );
77 } else if ( oObj.not_transferred ) {
78 data += NOT_TRANSFERRED_YET.format( oObj.not_transferred_by );
82 data += " <a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
97 "mDataProp": function( oObj ) {
98 return oObj.branchcode || "";
101 { "mDataProp": "expirationdate_formatted" },
103 "mDataProp": function( oObj ) {
104 if ( oObj.priority && parseInt( oObj.priority ) && parseInt( oObj.priority ) > 0 ) {
105 return oObj.priority;
113 "mDataProp": function( oObj ) {
114 return "<select name='rank-request'>"
115 + "<option value='n'>" + NO + "</option>"
116 + "<option value='del'>" + YES + "</option>"
118 + "<input type='hidden' name='biblionumber' value='" + oObj.biblionumber + "'>"
119 + "<input type='hidden' name='borrowernumber' value='" + borrowernumber + "'>"
120 + "<input type='hidden' name='reserve_id' value='" + oObj.reserve_id + "'>";
126 "bServerSide": false,
127 "sAjaxSource": '/cgi-bin/koha/svc/holds',
128 "fnServerData": function ( sSource, aoData, fnCallback ) {
129 aoData.push( { "name": "borrowernumber", "value": borrowernumber } );
131 $.getJSON( sSource, aoData, function (json) {
137 if ( $("#holds-table").length ) {
138 $("#holds-table_processing").position({
139 of: $( "#holds-table" ),