fixed note save and import special character
This commit is contained in:
parent
1a4beadbb2
commit
407d6884a1
@ -27,3 +27,6 @@
|
||||
2026-01-30 10:50:43 [AnagraficaCertestService] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||
2026-01-30 10:50:43 [MoltiplicatorePrezzo] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||
2026-01-30 11:09:22 [MoltiplicatorePrezzo] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||
2026-02-19 10:00:13 [MoltiplicatorePrezzo] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||
2026-02-19 10:00:42 [AnagraficaCertestObject] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||
2026-02-19 10:00:44 [MoltiplicatorePrezzo] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||
|
||||
@ -666,13 +666,11 @@ function fixedDefaultValue(array $f): string
|
||||
<div class="card radius-10">
|
||||
<div class="card-header">
|
||||
<div class="d-flex align-items-center">
|
||||
<div>
|
||||
<h6 class="mb-0">Modifica Dati Importati</h6>
|
||||
<div id="unsavedChanges" style="display:none; color: red; font-weight: bold; margin:10px 0;">
|
||||
⚠️ Unsaved changes detected! Please save before leaving this page.
|
||||
<ul id="changedFields" style="margin-top:5px; font-weight:normal; color:darkred;"></ul>
|
||||
</div>
|
||||
<div id="unsavedChanges" style="display:none; color: red; font-weight: bold; margin:10px 0;">
|
||||
⚠️ Unsaved changes detected! Please save before leaving this page.<br>
|
||||
<span id="changedRows" style="font-weight:normal; color:darkred;"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@ -1228,52 +1226,49 @@ function fixedDefaultValue(array $f): string
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const inputs = document.querySelectorAll(".cell-input, .dropdown-select, .carrier-select, .awb-input, .date-picker");
|
||||
const unsavedDiv = document.getElementById("unsavedChanges");
|
||||
const changedList = document.getElementById("changedFields");
|
||||
const changedRowsEl = document.getElementById("changedRows");
|
||||
let hasChanges = false;
|
||||
let changedFields = {};
|
||||
|
||||
function renderChangedList() {
|
||||
changedList.innerHTML = "";
|
||||
Object.keys(changedFields).forEach(rowIndex => {
|
||||
const fields = changedFields[rowIndex];
|
||||
if (fields.length > 0) {
|
||||
const li = document.createElement("li");
|
||||
li.textContent = `Row ${parseInt(rowIndex) + 1}: ${fields.join(", ")}`;
|
||||
changedList.appendChild(li);
|
||||
}
|
||||
});
|
||||
unsavedDiv.style.display = Object.keys(changedFields).length > 0 ? "block" : "none";
|
||||
// ✅ solo righe modificate (Set)
|
||||
let changedRows = new Set();
|
||||
|
||||
function renderChangedRows() {
|
||||
const rows = Array.from(changedRows)
|
||||
.map(n => Number(n))
|
||||
.sort((a, b) => a - b);
|
||||
|
||||
if (rows.length === 0) {
|
||||
unsavedDiv.style.display = "none";
|
||||
changedRowsEl.textContent = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// Visuale: "Row 1, Row 5, Row 6"
|
||||
changedRowsEl.textContent = rows.map(r => `Row ${r + 1}`).join(", ");
|
||||
unsavedDiv.style.display = "block";
|
||||
}
|
||||
|
||||
|
||||
inputs.forEach(el => {
|
||||
el.addEventListener("change", () => {
|
||||
hasChanges = true;
|
||||
|
||||
const gridCell = el.closest(".grid-cell");
|
||||
const colIndex = gridCell?.dataset.index;
|
||||
const rowIndex = gridCell?.dataset.row;
|
||||
let label = "Unknown field";
|
||||
|
||||
if (colIndex) {
|
||||
const header = document.querySelector(`.grid-header[data-index="${colIndex}"]`);
|
||||
if (header) {
|
||||
label = header.textContent.replace(":", "").trim();
|
||||
}
|
||||
}
|
||||
|
||||
// ✅ segnamo solo la riga
|
||||
if (rowIndex !== undefined) {
|
||||
if (!changedFields[rowIndex]) {
|
||||
changedFields[rowIndex] = [];
|
||||
}
|
||||
if (!changedFields[rowIndex].includes(label)) {
|
||||
changedFields[rowIndex].push(label);
|
||||
}
|
||||
gridCell.classList.add("cell-changed");
|
||||
changedRows.add(rowIndex);
|
||||
}
|
||||
|
||||
renderChangedList();
|
||||
// (se vuoi mantenere highlight cella gialla, lascia questa riga)
|
||||
if (gridCell) gridCell.classList.add("cell-changed");
|
||||
|
||||
renderChangedRows();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
document.querySelectorAll(".save-btn").forEach(btn => {
|
||||
btn.addEventListener("click", () => {
|
||||
const rowIndex = btn.dataset.row;
|
||||
@ -1331,13 +1326,16 @@ function fixedDefaultValue(array $f): string
|
||||
});
|
||||
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
||||
|
||||
if (changedFields[rowIndex]) {
|
||||
delete changedFields[rowIndex];
|
||||
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
||||
.forEach(cell => cell.classList.remove("cell-changed"));
|
||||
renderChangedList();
|
||||
hasChanges = Object.keys(changedFields).length > 0;
|
||||
}
|
||||
// ✅ rimuovi riga dal set (non mostrare più Row X)
|
||||
changedRows.delete(rowIndex);
|
||||
|
||||
// se vuoi continuare a togliere highlight giallo di TUTTA la riga:
|
||||
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
||||
.forEach(cell => cell.classList.remove("cell-changed"));
|
||||
|
||||
renderChangedRows();
|
||||
hasChanges = changedRows.size > 0;
|
||||
|
||||
|
||||
alert('Salvataggio riga avvenuto con successo!');
|
||||
} else {
|
||||
@ -1413,11 +1411,10 @@ function fixedDefaultValue(array $f): string
|
||||
});
|
||||
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
||||
|
||||
if (changedFields[rowIndex]) {
|
||||
delete changedFields[rowIndex];
|
||||
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
||||
.forEach(cell => cell.classList.remove("cell-changed"));
|
||||
}
|
||||
changedRows.delete(rowIndex);
|
||||
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
||||
.forEach(cell => cell.classList.remove("cell-changed"));
|
||||
|
||||
} else {
|
||||
errorMessages.push(`Riga ${parseInt(rowIndex) + 1}: ${data.message}`);
|
||||
}
|
||||
@ -1426,8 +1423,9 @@ function fixedDefaultValue(array $f): string
|
||||
}
|
||||
}
|
||||
|
||||
renderChangedList();
|
||||
hasChanges = Object.keys(changedFields).length > 0;
|
||||
renderChangedRows();
|
||||
hasChanges = changedRows.size > 0;
|
||||
|
||||
|
||||
if (errorMessages.length === 0) {
|
||||
alert(`Tutte le ${successCount} righe salvate con successo!`);
|
||||
|
||||
@ -20,9 +20,10 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !isset($_POST['template_id']) || !i
|
||||
|
||||
$template_id = intval($_POST['template_id']);
|
||||
$selected_rows = array_map('intval', $_POST['selected_rows']);
|
||||
$columns = json_decode($_POST['columns'], true);
|
||||
$rows = json_decode($_POST['rows'], true);
|
||||
$excelrows = json_decode($_POST['excelrows'], true);
|
||||
$columns = json_decode(urldecode($_POST['columns'] ?? '[]'), true);
|
||||
$rows = json_decode(urldecode($_POST['rows'] ?? '[]'), true);
|
||||
$excelrows = json_decode(urldecode($_POST['excelrows'] ?? '[]'), true);
|
||||
|
||||
$newFilename = htmlspecialchars($_POST['filename']);
|
||||
|
||||
$_SESSION['template_id'] = $template_id;
|
||||
|
||||
@ -305,9 +305,10 @@ error_log("Loaded template: " . print_r($template, true));
|
||||
let html = `
|
||||
<form id="selectRowsForm" action="import_insert.php" method="POST">
|
||||
<input type="hidden" name="template_id" value="${data.template_id}">
|
||||
<input type="hidden" name="columns" value='${JSON.stringify(data.columns)}'>
|
||||
<input type="hidden" name="rows" value='${JSON.stringify(data.rows)}'>
|
||||
<input type="hidden" name="excelrows" value='${JSON.stringify(data.excel_data.map(row => row.excelrow))}'>
|
||||
<input type="hidden" name="columns" value="${encodeURIComponent(JSON.stringify(data.columns))}">
|
||||
<input type="hidden" name="rows" value="${encodeURIComponent(JSON.stringify(data.rows))}">
|
||||
<input type="hidden" name="excelrows" value="${encodeURIComponent(JSON.stringify(data.excel_data.map(r => r.excelrow)))}">
|
||||
|
||||
<input type="hidden" name="filename" value="${data.filename}">
|
||||
<div class="search-container">
|
||||
<input type="text" id="searchInput" class="form-control" placeholder="Cerca nelle righe...">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user