various fixing
This commit is contained in:
@@ -1103,8 +1103,13 @@
|
|||||||
const isApiField = !!fixedFieldApiConfig[col.key];
|
const isApiField = !!fixedFieldApiConfig[col.key];
|
||||||
if (isApiField) {
|
if (isApiField) {
|
||||||
const tipo = clientFieldTipoMap[col.key] || "";
|
const tipo = clientFieldTipoMap[col.key] || "";
|
||||||
|
const isClientSourced =
|
||||||
|
fixedFieldApiConfig[col.key]?.source === "clients";
|
||||||
|
const clientCls = isClientSourced
|
||||||
|
? " client-select searchable-client"
|
||||||
|
: "";
|
||||||
cell.innerHTML =
|
cell.innerHTML =
|
||||||
`<select class="custom-field dropdown-select api-fixed-select fixed-top" data-column="fixed_${col.key}" data-fixed-key="${col.key}" data-client-tipo="${tipo}"><option value="">Seleziona...</option></select>` +
|
`<select class="custom-field dropdown-select api-fixed-select fixed-top${clientCls}" data-column="fixed_${col.key}" data-fixed-key="${col.key}" data-client-tipo="${tipo}"><option value="">Seleziona...</option></select>` +
|
||||||
`<button type="button" class="propagate-btn" data-column="fixed_${col.key}" data-col-index="${colIdx}"><i class="fas fa-arrow-down"></i></button>`;
|
`<button type="button" class="propagate-btn" data-column="fixed_${col.key}" data-col-index="${colIdx}"><i class="fas fa-arrow-down"></i></button>`;
|
||||||
} else {
|
} else {
|
||||||
cell.innerHTML =
|
cell.innerHTML =
|
||||||
|
|||||||
@@ -1396,17 +1396,8 @@ $gridMeta = [
|
|||||||
<div class="card radius-10">
|
<div class="card radius-10">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="d-flex align-items-center" style="min-height: 42px; gap: 12px;">
|
<div class="d-flex align-items-center" style="min-height: 42px; gap: 12px;">
|
||||||
<div class="dropdown actions-dropdown" style="flex-shrink: 0;">
|
<a href="#" class="btn btn-outline-danger btn-sm export-all-lims-btn" style="flex-shrink:0;"><i class="fas fa-upload"></i> Export All</a>
|
||||||
<button class="dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<a href="#" class="btn btn-outline-success btn-sm save-all-btn" style="flex-shrink:0;"><i class="fas fa-save"></i> Save All</a>
|
||||||
<i class="fas fa-cogs"></i> Actions
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
|
||||||
|
|
||||||
<li><a class="dropdown-item export-all-lims-btn" href="#"><i class="fas fa-upload" style="color: #eb0b0b;"></i>Export All</a></li>
|
|
||||||
|
|
||||||
<li><a class="dropdown-item save-all-btn" href="#"><i class="fas fa-save" style="color: #28a745;"></i>Save All</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-outline-success btn-sm" id="addRowBtn" style="flex-shrink:0;"><i class="fas fa-plus"></i> Add Row</button>
|
<button type="button" class="btn btn-outline-success btn-sm" id="addRowBtn" style="flex-shrink:0;"><i class="fas fa-plus"></i> Add Row</button>
|
||||||
<div id="unsavedChanges" style="display:none; color: red; font-weight: bold; font-size: 13px;">
|
<div id="unsavedChanges" style="display:none; color: red; font-weight: bold; font-size: 13px;">
|
||||||
⚠️ Unsaved changes detected!
|
⚠️ Unsaved changes detected!
|
||||||
|
|||||||
@@ -968,26 +968,24 @@ $(document).ready(function () {
|
|||||||
// ===================
|
// ===================
|
||||||
$(document).on("click", ".add-row-global", function (e) {
|
$(document).on("click", ".add-row-global", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const maxPartNumber = Math.max(
|
const partNumbers = $("#partsTableBody tr")
|
||||||
...$("#partsTableBody tr")
|
.map(function () {
|
||||||
.map(function () {
|
return parseInt($(this).find(".part-number").val()) || 0;
|
||||||
return parseInt($(this).find(".part-number").val()) || 0;
|
})
|
||||||
})
|
.get();
|
||||||
.get(),
|
const maxPartNumber = partNumbers.length ? Math.max(...partNumbers) : 0;
|
||||||
);
|
|
||||||
addNewRow(maxPartNumber + 1, false); // Riga normale
|
addNewRow(maxPartNumber + 1, false); // Riga normale
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".add-mix-global", function (e) {
|
$(document).on("click", ".add-mix-global", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const maxPartNumber = Math.max(
|
const partNumbers = $("#partsTableBody tr")
|
||||||
...$("#partsTableBody tr")
|
.map(function () {
|
||||||
.map(function () {
|
return parseInt($(this).find(".part-number").val()) || 0;
|
||||||
return parseInt($(this).find(".part-number").val()) || 0;
|
})
|
||||||
})
|
.get();
|
||||||
.get(),
|
const maxPartNumber = partNumbers.length ? Math.max(...partNumbers) : 0;
|
||||||
);
|
|
||||||
|
|
||||||
// Crea la riga Mix
|
// Crea la riga Mix
|
||||||
addNewRow(maxPartNumber + 1, true);
|
addNewRow(maxPartNumber + 1, true);
|
||||||
@@ -1479,13 +1477,10 @@ $(document).ready(function () {
|
|||||||
// OTHER TABLE HANDLERS
|
// OTHER TABLE HANDLERS
|
||||||
// ===================
|
// ===================
|
||||||
function updateRowButtons() {
|
function updateRowButtons() {
|
||||||
const rowCount = $("#partsTableBody tr").length;
|
// Il cestino è sempre visibile: è permesso eliminare anche l'ultima parte rimasta.
|
||||||
$("#partsTableBody tr").each(function () {
|
$("#partsTableBody tr").each(function () {
|
||||||
const $row = $(this);
|
const $row = $(this);
|
||||||
$row.find(".remove-row").css(
|
$row.find(".remove-row").css("display", "inline-block");
|
||||||
"display",
|
|
||||||
rowCount > 1 ? "inline-block" : "none",
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user