+
+[% MACRO jsinclude BLOCK %]
+ [% Asset.js("js/acquisitions-menu.js") %]
+ [% INCLUDE 'datatables.inc' %]
+ [% INCLUDE 'columns_settings.inc' %]
+ [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
+ [% INCLUDE 'calendar.inc' %]
+ <script>
+ var late_orderst;
+ function check_uncheck() {
+ var all_nodes = $(late_orderst.fnGetNodes());
+ if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
+ var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
+ $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
+ } else {
+ $("input:checkbox[name=ordernumber]").prop('disabled', false);
+ }
+ }
+
+ $(document).ready(function() {
+
+ var columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) %];
+ late_orderst = KohaTable("late_orders", {
+ "aoColumnDefs": [
+ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
+ { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
+ { "sType": "title-string", "aTargets" : [ "title-string" ] }
+ ],
+ "sPaginationType": "four_button",
+ "bAutoWidth": false,
+ "fnDrawCallback": function() {
+ if ( typeof late_orderst != 'undefined' ) {
+ check_uncheck();
+ $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
+ };
+ }
+ }, columns_settings );
+ $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
+ $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
+ $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
+
+ // Generates a dynamic link for exporting the selection's data as CSV
+ $("#ExportSelected").click(function() {
+ var all_nodes = $(late_orderst.fnGetNodes());
+ var selected = $(all_nodes).find("input[name='ordernumber']:checked");
+
+ if (selected.length == 0) {
+ alert(_("Please select at least one item to export."));
+ return false;
+ }
+
+ // Building the url from currently checked boxes
+ var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export';
+ for (var i = 0; i < selected.length; i++) {
+ url += '&ordernumber=' + selected[i].value;
+ }
+ // And redirecting to the CSV page
+ location.href = url;
+ return false;
+ });
+ });
+ </script>
+[% END %]
+