Files
crm.e5.pl/modules/EcmSales/javascript/ProductSummary.js

78 lines
2.8 KiB
JavaScript

function getSelected() {
var sel = $('input[type=checkbox]:checked').map(function(make_pdf, el) {
return $(el).val()
}).get();
document.getElementById("idss").value=sel;
return sel;
}
function getList() {
window.open('index.php?module=EcmSales&action=productsSummaryList&to_pdf=1&ids='+$('#idss').val());
}
$(document).ready(function()
{
$("#createInsideOrder").click(createInsideOrder);
$('#selectall').click(function(event) { //on click
if(this.checked) { // check select status
$('.allCheck').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.allCheck').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
$('#selectall2').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf2').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf2').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
$('#selectall3').click(function(event) { //on click
if(this.checked) { // check select status
$('.make_pdf3').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.make_pdf3').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
// hightlight table row
$('#myTable tr').mouseover(function(e) {
$('#myTable tr').removeClass('highlighted');
$(this).addClass('highlighted');
});
});
function createInsideOrder() {
console.log('createInsideOrder');
var ids = [];
$('input.allCheck:checkbox:checked').each(function () {
ids.push($(this).val());
});
if (ids.length === 0) {
alert('Wybierz pozycje.');
return;
}
var products = [];
ids.forEach(el => {
const qty = parseFloat($("#qtyInput-" + el).val().trim());
console.log(qty);
products.push(el + "|" + qty);
});
$("#insideOrderProducts").val(products.join('*'));
$("#createInsideOrderForm").submit();
}