|
Lines 11-34
Link Here
|
| 11 |
[% IF (dateformat == 'metric') %] |
11 |
[% IF (dateformat == 'metric') %] |
| 12 |
dt_add_type_uk_date(); |
12 |
dt_add_type_uk_date(); |
| 13 |
[% END %] |
13 |
[% END %] |
|
|
14 |
|
| 15 |
var late_orderst; |
| 16 |
function check_uncheck() { |
| 17 |
var all_nodes = $(late_orderst.fnGetNodes()); |
| 18 |
if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) { |
| 19 |
var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid"); |
| 20 |
$(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").attr('disabled', 'disabled'); |
| 21 |
} else { |
| 22 |
$("input:checkbox[name=ordernumber]").removeAttr('disabled'); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 14 |
$(document).ready(function() { |
26 |
$(document).ready(function() { |
| 15 |
var late_orderst = $("#late_orders").dataTable($.extend(true, {}, dataTablesDefaults, { |
27 |
|
|
|
28 |
late_orderst = $("#late_orders").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 16 |
"aoColumnDefs": [ |
29 |
"aoColumnDefs": [ |
| 17 |
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, |
30 |
{ "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, |
| 18 |
], |
31 |
], |
| 19 |
"sPaginationType": "four_button" |
32 |
"sPaginationType": "four_button", |
|
|
33 |
"bAutoWidth": false, |
| 34 |
"fnDrawCallback": function() { |
| 35 |
if ( typeof late_orderst != 'undefined' ) { |
| 36 |
check_uncheck(); |
| 37 |
$('input:checkbox[name=ordernumber]').bind('click', check_uncheck); |
| 38 |
}; |
| 39 |
} |
| 20 |
} ) ); |
40 |
} ) ); |
|
|
41 |
$('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();}); |
| 42 |
$('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();}); |
| 43 |
|
| 44 |
// Generates a dynamic link for exporting the selection's data as CSV |
| 45 |
$("#ExportSelected").click(function() { |
| 46 |
var all_nodes = $(late_orderst.fnGetNodes()); |
| 47 |
var selected = $(all_nodes).find("input[name='ordernumber']:checked"); |
| 48 |
|
| 49 |
if (selected.length == 0) { |
| 50 |
alert(_("Please select at least one item to export.")); |
| 51 |
return false; |
| 52 |
} |
| 21 |
|
53 |
|
| 22 |
$("input:checkbox[name=claim_for]").click(function(){ |
54 |
// Building the url from currently checked boxes |
| 23 |
var booksellerid = $(this).attr('booksellerid'); |
55 |
var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export'; |
| 24 |
if ( $("input:checkbox[name=claim_for]:checked").length > 0) { |
56 |
for (var i = 0; i < selected.length; i++) { |
| 25 |
$("input:checkbox[name=claim_for][booksellerid!="+booksellerid+"]").attr('disabled', true); |
57 |
url += '&ordernumber=' + selected[i].value; |
| 26 |
} else { |
|
|
| 27 |
$("input:checkbox[name=claim_for]").attr('disabled', false); |
| 28 |
} |
58 |
} |
|
|
59 |
// And redirecting to the CSV page |
| 60 |
location.href = url; |
| 61 |
return false; |
| 29 |
}); |
62 |
}); |
| 30 |
$('#CheckAll').click(function(){ $("#late_orders td").checkCheckboxes();}); |
|
|
| 31 |
$('#CheckNone').click(function(){ $("#late_orders td").unCheckCheckboxes();}); |
| 32 |
}); |
63 |
}); |
| 33 |
//]]> |
64 |
//]]> |
| 34 |
</script> |
65 |
</script> |
|
Lines 72-79
$(document).ready(function() {
Link Here
|
| 72 |
</p> |
103 |
</p> |
| 73 |
[% END %] |
104 |
[% END %] |
| 74 |
<table id="late_orders"> |
105 |
<table id="late_orders"> |
| 75 |
<thead> |
106 |
<thead> |
| 76 |
<tr> |
107 |
<tr> |
|
|
108 |
[% IF Supplier %] |
| 109 |
<th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th> |
| 110 |
[% ELSE %] |
| 111 |
<th></th> |
| 112 |
[% END %] |
| 77 |
<th>Order date</th> |
113 |
<th>Order date</th> |
| 78 |
<th>Estimated delivery date</th> |
114 |
<th>Estimated delivery date</th> |
| 79 |
<th>Vendor</th> |
115 |
<th>Vendor</th> |
|
Lines 82-99
$(document).ready(function() {
Link Here
|
| 82 |
<th>Basket</th> |
118 |
<th>Basket</th> |
| 83 |
<th>Claims count</th> |
119 |
<th>Claims count</th> |
| 84 |
<th>Claimed date</th> |
120 |
<th>Claimed date</th> |
| 85 |
[% IF Supplier %] |
|
|
| 86 |
<th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th> |
| 87 |
[% ELSE %] |
| 88 |
<th></th> |
| 89 |
[% END %] |
| 90 |
</tr> |
121 |
</tr> |
| 91 |
</thead> |
122 |
</thead> |
| 92 |
<tbody> |
123 |
<tbody> |
| 93 |
[% FOREACH lateorder IN lateorders %] |
124 |
[% FOREACH lateorder IN lateorders %] |
| 94 |
[% UNLESS ( loop.odd ) %]<tr class="highlight"> |
125 |
[% UNLESS ( loop.odd ) %]<tr class="highlight"> |
| 95 |
[% ELSE %]<tr>[% END %] |
126 |
[% ELSE %]<tr>[% END %] |
| 96 |
<td> |
127 |
<td> |
|
|
128 |
<input type="checkbox" value="[% lateorder.ordernumber %]" data-booksellerid="[% lateorder.supplierid %]" name="ordernumber"> |
| 129 |
</td> |
| 130 |
<td> |
| 97 |
([% lateorder.supplierid %]) |
131 |
([% lateorder.supplierid %]) |
| 98 |
[% lateorder.orderdate %] |
132 |
[% lateorder.orderdate %] |
| 99 |
([% lateorder.latesince %] days) |
133 |
([% lateorder.latesince %] days) |
|
Lines 130-160
$(document).ready(function() {
Link Here
|
| 130 |
</td> |
164 |
</td> |
| 131 |
<td>[% lateorder.claims_count %]</td> |
165 |
<td>[% lateorder.claims_count %]</td> |
| 132 |
<td>[% lateorder.claimed_date %]</td> |
166 |
<td>[% lateorder.claimed_date %]</td> |
| 133 |
<td> |
|
|
| 134 |
[% UNLESS lateorder.budget_lock %] |
| 135 |
<input type="checkbox" class="checkbox" name="claim_for" value="[% lateorder.ordernumber %]" booksellerid="[% lateorder.supplierid %]"/> |
| 136 |
[% END %] |
| 137 |
</td> |
| 138 |
</td> |
| 139 |
</tr> |
167 |
</tr> |
| 140 |
[% END %] |
168 |
[% END %] |
| 141 |
</tbody> |
169 |
</tbody> |
| 142 |
<tfoot> |
170 |
<tfoot> |
| 143 |
<tr> |
171 |
<tr> |
| 144 |
<th>Total</th> |
172 |
<th colspan="5">Total</th> |
| 145 |
<th> </th> |
|
|
| 146 |
<th> </th> |
| 147 |
<th> </th> |
| 148 |
<th>[% total %]</th> |
173 |
<th>[% total %]</th> |
| 149 |
<th> </th> |
174 |
<th colspan="3"> </th> |
| 150 |
<th> </th> |
|
|
| 151 |
<th> </th> |
| 152 |
<td> |
| 153 |
<input type="submit" value="Claim Order" /> |
| 154 |
</td> |
| 155 |
</tr> |
175 |
</tr> |
| 156 |
</tfoot> |
176 |
</tfoot> |
| 157 |
</table> |
177 |
</table> |
|
|
178 |
<div class="spacer"></div> |
| 179 |
|
| 180 |
<p style="display:block;"> |
| 181 |
<input type="button" value="Export as CSV" id="ExportSelected" /> |
| 182 |
[% UNLESS lateorder.budget_lock %] |
| 183 |
<input type="submit" value="Claim Order" /> |
| 184 |
[% END %] |
| 185 |
</p> |
| 158 |
</form> |
186 |
</form> |
| 159 |
[% ELSE %]<p>There are no late orders.</p> |
187 |
[% ELSE %]<p>There are no late orders.</p> |
| 160 |
[% END %] |
188 |
[% END %] |