Files
le-matelot/local/modules/FreeShipping/AdminIncludes/module-config-js.html
2020-01-27 08:56:08 +01:00

41 lines
1.4 KiB
HTML

<script>
$(document).ready(function() {
var checkboxes = [];
{loop name="js.get.orders.freeshipping.export" type="order.notsent.freeshipping"}
checkboxes.push("export_{$ID}");
{/loop}
//Buttons
$("#check-all-but").click( function() {
checkboxes.forEach(function(entry) {
$("#"+entry).prop('checked', true);
});
});
$("#uncheck-all-but").click( function() {
checkboxes.forEach(function(entry) {
$("#"+entry).prop('checked', false);
});
});
$("#reverse-all-but").click( function() {
checkboxes.forEach(function(entry) {
var box=$("#"+entry);
box.prop('checked', !box.is(":checked"));
});
});
// Export form button
$("button[name=export_freeshiping_form]").click(function() {
var value = $("input[name='exportfreeshippingorder[new_status_id]']:checked").val();
if(value == "sent") {
checkboxes.forEach(function(entry) {
var box=$("#"+entry);
if(box.is(":checked")) {
var row= box.parents("tr"); // get first tr parent
row.hide('slow', function() {
row.remove();
});
}
});
}
});
});
</script>