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