diff --git a/modules/EcmSales/javascript/ProductSummary.js b/modules/EcmSales/javascript/ProductSummary.js index 0f1175a7..b8d326f4 100644 --- a/modules/EcmSales/javascript/ProductSummary.js +++ b/modules/EcmSales/javascript/ProductSummary.js @@ -15,100 +15,15 @@ function getList() { $(document).ready(function() { - - // by document no - $.tablesorter.addParser({ - // set a unique id - id: 'rangesort', - is: function (s) { - // return false so this parser is not auto detected - return false; - }, - format: function (s, table, cell, cellIndex) { - // get data attributes from $(cell).attr('data-something'); - // check specific column using cellIndex - - return $(cell).attr('data-price'); - }, - // set type, either numeric or text - type: 'numeric' - }); - // by total netto - $.tablesorter.addParser({ - // set a unique id - id: 'rangesorttota', - is: function (s) { - // return false so this parser is not auto detected - return false; - }, - format: function (s, table, cell, cellIndex) { - // get data attributes from $(cell).attr('data-something'); - // check specific column using cellIndex - - return $(cell).attr('data-total'); - }, - // set type, either numeric or text - type: 'numeric' - }); - // by vat + $("#createInsideOrder").click(createInsideOrder); - $.tablesorter.addParser({ - // set a unique id - id: 'rangesorttotav', - is: function (s) { - // return false so this parser is not auto detected - return false; - }, - format: function (s, table, cell, cellIndex) { - // get data attributes from $(cell).attr('data-something'); - // check specific column using cellIndex - - return $(cell).attr('data-total'); - }, - // set type, either numeric or text - type: 'numeric' - }); - // by total brutto - $.tablesorter.addParser({ - // set a unique id - id: 'rangesorttotan', - is: function (s) { - // return false so this parser is not auto detected - return false; - }, - format: function (s, table, cell, cellIndex) { - // get data attributes from $(cell).attr('data-something'); - // check specific column using cellIndex - - return $(cell).attr('data-total'); - }, - // set type, either numeric or text - type: 'numeric' - }); - // by total invoice - $.tablesorter.addParser({ - // set a unique id - id: 'rangesorttotai', - is: function (s) { - // return false so this parser is not auto detected - return false; - }, - format: function (s, table, cell, cellIndex) { - // get data attributes from $(cell).attr('data-something'); - // check specific column using cellIndex - - return $(cell).attr('data-total'); - }, - // set type, either numeric or text - type: 'numeric' - }); $('#selectall').click(function(event) { //on click if(this.checked) { // check select status - $('.make_pdf').each(function() { //loop through each checkbox + $('.allCheck').each(function() { //loop through each checkbox this.checked = true; //select all checkboxes with class "checkbox1" }); }else{ - $('.make_pdf').each(function() { //loop through each checkbox + $('.allCheck').each(function() { //loop through each checkbox this.checked = false; //deselect all checkboxes with class "checkbox1" }); } @@ -140,32 +55,24 @@ $(document).ready(function() $('#myTable tr').removeClass('highlighted'); $(this).addClass('highlighted'); }); - $("#myTable").tablesorter({ - headers: { - 0: { - // disable it by setting the property sorter to false - sorter: false - }, +}); - } +function createInsideOrder() { + console.log('createInsideOrder'); + var ids = []; + $('input.allCheck:checkbox:checked').each(function () { + ids.push($(this).val()); }); - - $("#myTable2").tablesorter({ - headers: { - 0: { - // disable it by setting the property sorter to false - sorter: false - }, - - } + 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); }); - $("#myTable3").tablesorter({ - headers: { - 0: { - // disable it by setting the property sorter to false - sorter: false - }, - - } - }); -}); \ No newline at end of file + $("#insideOrderProducts").val(products.join('*')); + $("#createInsideOrderForm").submit(); +} \ No newline at end of file diff --git a/modules/EcmSales/tpls/ProductSummary.tpl b/modules/EcmSales/tpls/ProductSummary.tpl index 1e287393..9785f09b 100644 --- a/modules/EcmSales/tpls/ProductSummary.tpl +++ b/modules/EcmSales/tpls/ProductSummary.tpl @@ -8,6 +8,7 @@
+