various fixing
This commit is contained in:
@@ -1103,8 +1103,13 @@
|
||||
const isApiField = !!fixedFieldApiConfig[col.key];
|
||||
if (isApiField) {
|
||||
const tipo = clientFieldTipoMap[col.key] || "";
|
||||
const isClientSourced =
|
||||
fixedFieldApiConfig[col.key]?.source === "clients";
|
||||
const clientCls = isClientSourced
|
||||
? " client-select searchable-client"
|
||||
: "";
|
||||
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>`;
|
||||
} else {
|
||||
cell.innerHTML =
|
||||
|
||||
@@ -1396,17 +1396,8 @@ $gridMeta = [
|
||||
<div class="card radius-10">
|
||||
<div class="card-header">
|
||||
<div class="d-flex align-items-center" style="min-height: 42px; gap: 12px;">
|
||||
<div class="dropdown actions-dropdown" style="flex-shrink: 0;">
|
||||
<button class="dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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;">
|
||||
⚠️ Unsaved changes detected!
|
||||
|
||||
@@ -968,26 +968,24 @@ $(document).ready(function () {
|
||||
// ===================
|
||||
$(document).on("click", ".add-row-global", function (e) {
|
||||
e.preventDefault();
|
||||
const maxPartNumber = Math.max(
|
||||
...$("#partsTableBody tr")
|
||||
const partNumbers = $("#partsTableBody tr")
|
||||
.map(function () {
|
||||
return parseInt($(this).find(".part-number").val()) || 0;
|
||||
})
|
||||
.get(),
|
||||
);
|
||||
.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")
|
||||
const partNumbers = $("#partsTableBody tr")
|
||||
.map(function () {
|
||||
return parseInt($(this).find(".part-number").val()) || 0;
|
||||
})
|
||||
.get(),
|
||||
);
|
||||
.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