Lines 647-691
Link Here
|
647 |
}; |
647 |
}; |
648 |
|
648 |
|
649 |
var selected_rows = {}; |
649 |
var selected_rows = {}; |
650 |
$('#select_multiple').click(function() { |
650 |
$('#select_multiple').click(function () { |
651 |
var ids = Object.keys(selected_rows); |
651 |
var ids = Object.keys(selected_rows); |
652 |
if(!ids.length) return; |
652 |
if (!ids.length) return; |
653 |
location.href = 'orderreceive.pl?multiple_orders='+ids.join(',')+ '&invoiceid=[% invoiceid | uri %]'; |
653 |
location.href = 'orderreceive.pl?multiple_orders=' + ids.join(',') + '&invoiceid=[% invoiceid | uri %]'; |
654 |
}).html(PENDING_MULTI_SELECTION.format('0')) |
654 |
}).html(PENDING_MULTI_SELECTION.format('0')) |
655 |
options.select = { |
655 |
options.select = { |
656 |
style: 'api' |
656 |
style: 'api' |
657 |
}; |
657 |
}; |
658 |
options.order = [[1, 'asc']]; |
658 |
options.order = [[1, 'asc']]; |
659 |
options.columns.unshift({ |
659 |
options.columns.unshift({ |
660 |
"data": function(row, type, val, meta) { |
660 |
"data": function (row, type, val, meta) { |
661 |
return '<input type="checkbox" class="selOrder" />'; |
661 |
return '<input type="checkbox" class="selOrder" />'; |
662 |
}, |
662 |
}, |
663 |
"searchable": false, |
663 |
"searchable": false, |
664 |
"orderable": false |
664 |
"orderable": false |
665 |
}); |
665 |
}); |
666 |
|
666 |
|
667 |
var pending_orders_table = $("#pending_orders").kohaTable(options, {}, 1, {"basket.vendor_id": [% booksellerid | html %]}); |
667 |
var pending_orders_table = $("#pending_orders").kohaTable(options, {}, 1, { "basket.vendor_id": [% booksellerid | html %] }); |
668 |
|
668 |
|
669 |
var api = pending_orders_table.api(); |
669 |
var api = pending_orders_table.api(); |
670 |
api.on('draw', function() { |
670 |
api.on('draw', function () { |
671 |
api.rows().every(function() { |
671 |
api.rows().every(function () { |
672 |
var row = this; |
672 |
var row = this; |
673 |
var data = row.data(); |
673 |
var data = row.data(); |
674 |
$('.selOrder', row.node()).on('click', function(event) { |
674 |
$('.selOrder', row.node()).on('click', function (event) { |
675 |
if($(this).prop('checked')) { |
675 |
if ($(this).prop('checked')) { |
676 |
row.select(); |
676 |
row.select(); |
677 |
selected_rows[data.order_id] = data; |
677 |
selected_rows[data.order_id] = data; |
678 |
} else { |
678 |
} else { |
679 |
row.deselect(); |
679 |
row.deselect(); |
680 |
delete selected_rows[data.order_id]; |
680 |
delete selected_rows[data.order_id]; |
681 |
} |
681 |
} |
682 |
$('#select_multiple').html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length)); |
682 |
$('#select_multiple').html(PENDING_MULTI_SELECTION.format(Object.keys(selected_rows).length)); |
|
|
683 |
}); |
684 |
if (selected_rows[data.order_id]) { |
685 |
row.select(); |
686 |
$('.selOrder', row.node()).prop('checked', true); |
687 |
} |
683 |
}); |
688 |
}); |
684 |
if(selected_rows[data.order_id]) { |
|
|
685 |
row.select(); |
686 |
$('.selOrder', row.node()).prop('checked', true); |
687 |
} |
688 |
}); |
689 |
}); |
689 |
}); |
690 |
|
690 |
|
691 |
|
691 |
|
692 |
- |
|
|