various fixing
This commit is contained in:
@@ -968,26 +968,24 @@ $(document).ready(function () {
|
||||
// ===================
|
||||
$(document).on("click", ".add-row-global", function (e) {
|
||||
e.preventDefault();
|
||||
const maxPartNumber = Math.max(
|
||||
...$("#partsTableBody tr")
|
||||
.map(function () {
|
||||
return parseInt($(this).find(".part-number").val()) || 0;
|
||||
})
|
||||
.get(),
|
||||
);
|
||||
const partNumbers = $("#partsTableBody tr")
|
||||
.map(function () {
|
||||
return parseInt($(this).find(".part-number").val()) || 0;
|
||||
})
|
||||
.get();
|
||||
const maxPartNumber = partNumbers.length ? Math.max(...partNumbers) : 0;
|
||||
addNewRow(maxPartNumber + 1, false); // Riga normale
|
||||
});
|
||||
|
||||
$(document).on("click", ".add-mix-global", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const maxPartNumber = Math.max(
|
||||
...$("#partsTableBody tr")
|
||||
.map(function () {
|
||||
return parseInt($(this).find(".part-number").val()) || 0;
|
||||
})
|
||||
.get(),
|
||||
);
|
||||
const partNumbers = $("#partsTableBody tr")
|
||||
.map(function () {
|
||||
return parseInt($(this).find(".part-number").val()) || 0;
|
||||
})
|
||||
.get();
|
||||
const maxPartNumber = partNumbers.length ? Math.max(...partNumbers) : 0;
|
||||
|
||||
// Crea la riga Mix
|
||||
addNewRow(maxPartNumber + 1, true);
|
||||
@@ -1479,13 +1477,10 @@ $(document).ready(function () {
|
||||
// OTHER TABLE HANDLERS
|
||||
// ===================
|
||||
function updateRowButtons() {
|
||||
const rowCount = $("#partsTableBody tr").length;
|
||||
// Il cestino è sempre visibile: è permesso eliminare anche l'ultima parte rimasta.
|
||||
$("#partsTableBody tr").each(function () {
|
||||
const $row = $(this);
|
||||
$row.find(".remove-row").css(
|
||||
"display",
|
||||
rowCount > 1 ? "inline-block" : "none",
|
||||
);
|
||||
$row.find(".remove-row").css("display", "inline-block");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user