|
Lines 335-341
Link Here
|
| 335 |
|
335 |
|
| 336 |
$(document).ready(function() { |
336 |
$(document).ready(function() { |
| 337 |
const sale_table = document.getElementById('sale'); |
337 |
const sale_table = document.getElementById('sale'); |
| 338 |
const saleDataTable = $("#sale").DataTable({ |
338 |
const sale_kohaTable = $("#sale").kohaTable({ |
| 339 |
"paginate": false, |
339 |
"paginate": false, |
| 340 |
"searching": false, |
340 |
"searching": false, |
| 341 |
"info": false, |
341 |
"info": false, |
|
Lines 364-370
Link Here
|
| 364 |
"rowCallback": function( row, data ) { |
364 |
"rowCallback": function( row, data ) { |
| 365 |
const total = data[1] * data[2]; |
365 |
const total = data[1] * data[2]; |
| 366 |
data[3] = total; |
366 |
data[3] = total; |
| 367 |
saleDataTable.cell(row, 3).invalidate(); |
367 |
sale_kohaTable.api().cell(row, 3).invalidate(); |
| 368 |
}, |
368 |
}, |
| 369 |
"footerCallback": function(tfoot, data, start, end, display) { |
369 |
"footerCallback": function(tfoot, data, start, end, display) { |
| 370 |
let total_price = 0; |
370 |
let total_price = 0; |
|
Lines 387-393
Link Here
|
| 387 |
}); |
387 |
}); |
| 388 |
|
388 |
|
| 389 |
$("#sale").on("click", "button.drop", function(){ |
389 |
$("#sale").on("click", "button.drop", function(){ |
| 390 |
saleDataTable.row($(this).parents('tr')).remove().draw(false); |
390 |
sale_kohaTable.api().row($(this).parents('tr')).remove().draw(false); |
| 391 |
}); |
391 |
}); |
| 392 |
|
392 |
|
| 393 |
// Set up editable columns based on header classes |
393 |
// Set up editable columns based on header classes |
|
Lines 430-436
Link Here
|
| 430 |
function updateCell() { |
430 |
function updateCell() { |
| 431 |
const newValue = input.value.trim() || originalContent; // Fallback to original content |
431 |
const newValue = input.value.trim() || originalContent; // Fallback to original content |
| 432 |
cell.textContent = newValue; // Set the final value in the cell |
432 |
cell.textContent = newValue; // Set the final value in the cell |
| 433 |
saleDataTable.cell(cell).data(newValue).invalidate().draw(false); // Update DataTable data |
433 |
sale_kohaTable.api().cell(cell).data(newValue).invalidate().draw(false); // Update dataTable data |
| 434 |
} |
434 |
} |
| 435 |
} |
435 |
} |
| 436 |
}); |
436 |
}); |
|
Lines 448-454
Link Here
|
| 448 |
|
448 |
|
| 449 |
$("#invoices").on("click", ".add_button", function(e) { |
449 |
$("#invoices").on("click", ".add_button", function(e) { |
| 450 |
e.preventDefault(); |
450 |
e.preventDefault(); |
| 451 |
fnClickAddRow(saleDataTable, $( this ).data('invoiceCode'), $( this ).data('invoiceTitle'), $( this ).data('invoicePrice') ); |
451 |
fnClickAddRow(sale_kohaTable.api(), $( this ).data('invoiceCode'), $( this ).data('invoiceTitle'), $( this ).data('invoicePrice') ); |
| 452 |
if($('#invoices_filter').find('input[type=search]').val() !== ''){ |
452 |
if($('#invoices_filter').find('input[type=search]').val() !== ''){ |
| 453 |
items_table.DataTable().search('').draw(); |
453 |
items_table.DataTable().search('').draw(); |
| 454 |
} |
454 |
} |
|
Lines 494-505
Link Here
|
| 494 |
}); |
494 |
}); |
| 495 |
} |
495 |
} |
| 496 |
|
496 |
|
| 497 |
// now, process the current & fresh contents of the saleDataTable |
497 |
// now, process the current & fresh contents of the sale_kohaTable |
| 498 |
if (change != undefined && change.innerHTML > 0.00 && !checked) { |
498 |
if (change != undefined && change.innerHTML > 0.00 && !checked) { |
| 499 |
e.preventDefault(); |
499 |
e.preventDefault(); |
| 500 |
$("#confirm_change_form").modal("show"); |
500 |
$("#confirm_change_form").modal("show"); |
| 501 |
} else { |
501 |
} else { |
| 502 |
var rows = saleDataTable.data().toArray(); |
502 |
var rows = sale_kohaTable.api().data().toArray(); |
| 503 |
rows.forEach(function (row, index) { |
503 |
rows.forEach(function (row, index) { |
| 504 |
var sale = { |
504 |
var sale = { |
| 505 |
code: row[5], |
505 |
code: row[5], |
| 506 |
- |
|
|