fixed note save and import special character
This commit is contained in:
@@ -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 [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 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-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 radius-10">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="d-flex align-items-center">
|
<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;">
|
<div id="unsavedChanges" style="display:none; color: red; font-weight: bold; margin:10px 0;">
|
||||||
⚠️ Unsaved changes detected! Please save before leaving this page.
|
⚠️ Unsaved changes detected! Please save before leaving this page.<br>
|
||||||
<ul id="changedFields" style="margin-top:5px; font-weight:normal; color:darkred;"></ul>
|
<span id="changedRows" style="font-weight:normal; color:darkred;"></span>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -1228,52 +1226,49 @@ function fixedDefaultValue(array $f): string
|
|||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
const inputs = document.querySelectorAll(".cell-input, .dropdown-select, .carrier-select, .awb-input, .date-picker");
|
const inputs = document.querySelectorAll(".cell-input, .dropdown-select, .carrier-select, .awb-input, .date-picker");
|
||||||
const unsavedDiv = document.getElementById("unsavedChanges");
|
const unsavedDiv = document.getElementById("unsavedChanges");
|
||||||
const changedList = document.getElementById("changedFields");
|
const changedRowsEl = document.getElementById("changedRows");
|
||||||
let hasChanges = false;
|
let hasChanges = false;
|
||||||
let changedFields = {};
|
|
||||||
|
|
||||||
function renderChangedList() {
|
// ✅ solo righe modificate (Set)
|
||||||
changedList.innerHTML = "";
|
let changedRows = new Set();
|
||||||
Object.keys(changedFields).forEach(rowIndex => {
|
|
||||||
const fields = changedFields[rowIndex];
|
function renderChangedRows() {
|
||||||
if (fields.length > 0) {
|
const rows = Array.from(changedRows)
|
||||||
const li = document.createElement("li");
|
.map(n => Number(n))
|
||||||
li.textContent = `Row ${parseInt(rowIndex) + 1}: ${fields.join(", ")}`;
|
.sort((a, b) => a - b);
|
||||||
changedList.appendChild(li);
|
|
||||||
|
if (rows.length === 0) {
|
||||||
|
unsavedDiv.style.display = "none";
|
||||||
|
changedRowsEl.textContent = "";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
unsavedDiv.style.display = Object.keys(changedFields).length > 0 ? "block" : "none";
|
// Visuale: "Row 1, Row 5, Row 6"
|
||||||
|
changedRowsEl.textContent = rows.map(r => `Row ${r + 1}`).join(", ");
|
||||||
|
unsavedDiv.style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inputs.forEach(el => {
|
inputs.forEach(el => {
|
||||||
el.addEventListener("change", () => {
|
el.addEventListener("change", () => {
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
|
|
||||||
const gridCell = el.closest(".grid-cell");
|
const gridCell = el.closest(".grid-cell");
|
||||||
const colIndex = gridCell?.dataset.index;
|
|
||||||
const rowIndex = gridCell?.dataset.row;
|
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 (rowIndex !== undefined) {
|
||||||
if (!changedFields[rowIndex]) {
|
changedRows.add(rowIndex);
|
||||||
changedFields[rowIndex] = [];
|
|
||||||
}
|
|
||||||
if (!changedFields[rowIndex].includes(label)) {
|
|
||||||
changedFields[rowIndex].push(label);
|
|
||||||
}
|
|
||||||
gridCell.classList.add("cell-changed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderChangedList();
|
// (se vuoi mantenere highlight cella gialla, lascia questa riga)
|
||||||
|
if (gridCell) gridCell.classList.add("cell-changed");
|
||||||
|
|
||||||
|
renderChangedRows();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
document.querySelectorAll(".save-btn").forEach(btn => {
|
document.querySelectorAll(".save-btn").forEach(btn => {
|
||||||
btn.addEventListener("click", () => {
|
btn.addEventListener("click", () => {
|
||||||
const rowIndex = btn.dataset.row;
|
const rowIndex = btn.dataset.row;
|
||||||
@@ -1331,13 +1326,16 @@ function fixedDefaultValue(array $f): string
|
|||||||
});
|
});
|
||||||
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
||||||
|
|
||||||
if (changedFields[rowIndex]) {
|
// ✅ rimuovi riga dal set (non mostrare più Row X)
|
||||||
delete changedFields[rowIndex];
|
changedRows.delete(rowIndex);
|
||||||
|
|
||||||
|
// se vuoi continuare a togliere highlight giallo di TUTTA la riga:
|
||||||
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
||||||
.forEach(cell => cell.classList.remove("cell-changed"));
|
.forEach(cell => cell.classList.remove("cell-changed"));
|
||||||
renderChangedList();
|
|
||||||
hasChanges = Object.keys(changedFields).length > 0;
|
renderChangedRows();
|
||||||
}
|
hasChanges = changedRows.size > 0;
|
||||||
|
|
||||||
|
|
||||||
alert('Salvataggio riga avvenuto con successo!');
|
alert('Salvataggio riga avvenuto con successo!');
|
||||||
} else {
|
} else {
|
||||||
@@ -1413,11 +1411,10 @@ function fixedDefaultValue(array $f): string
|
|||||||
});
|
});
|
||||||
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
||||||
|
|
||||||
if (changedFields[rowIndex]) {
|
changedRows.delete(rowIndex);
|
||||||
delete changedFields[rowIndex];
|
|
||||||
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
||||||
.forEach(cell => cell.classList.remove("cell-changed"));
|
.forEach(cell => cell.classList.remove("cell-changed"));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
errorMessages.push(`Riga ${parseInt(rowIndex) + 1}: ${data.message}`);
|
errorMessages.push(`Riga ${parseInt(rowIndex) + 1}: ${data.message}`);
|
||||||
}
|
}
|
||||||
@@ -1426,8 +1423,9 @@ function fixedDefaultValue(array $f): string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderChangedList();
|
renderChangedRows();
|
||||||
hasChanges = Object.keys(changedFields).length > 0;
|
hasChanges = changedRows.size > 0;
|
||||||
|
|
||||||
|
|
||||||
if (errorMessages.length === 0) {
|
if (errorMessages.length === 0) {
|
||||||
alert(`Tutte le ${successCount} righe salvate con successo!`);
|
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']);
|
$template_id = intval($_POST['template_id']);
|
||||||
$selected_rows = array_map('intval', $_POST['selected_rows']);
|
$selected_rows = array_map('intval', $_POST['selected_rows']);
|
||||||
$columns = json_decode($_POST['columns'], true);
|
$columns = json_decode(urldecode($_POST['columns'] ?? '[]'), true);
|
||||||
$rows = json_decode($_POST['rows'], true);
|
$rows = json_decode(urldecode($_POST['rows'] ?? '[]'), true);
|
||||||
$excelrows = json_decode($_POST['excelrows'], true);
|
$excelrows = json_decode(urldecode($_POST['excelrows'] ?? '[]'), true);
|
||||||
|
|
||||||
$newFilename = htmlspecialchars($_POST['filename']);
|
$newFilename = htmlspecialchars($_POST['filename']);
|
||||||
|
|
||||||
$_SESSION['template_id'] = $template_id;
|
$_SESSION['template_id'] = $template_id;
|
||||||
|
|||||||
@@ -305,9 +305,10 @@ error_log("Loaded template: " . print_r($template, true));
|
|||||||
let html = `
|
let html = `
|
||||||
<form id="selectRowsForm" action="import_insert.php" method="POST">
|
<form id="selectRowsForm" action="import_insert.php" method="POST">
|
||||||
<input type="hidden" name="template_id" value="${data.template_id}">
|
<input type="hidden" name="template_id" value="${data.template_id}">
|
||||||
<input type="hidden" name="columns" value='${JSON.stringify(data.columns)}'>
|
<input type="hidden" name="columns" value="${encodeURIComponent(JSON.stringify(data.columns))}">
|
||||||
<input type="hidden" name="rows" value='${JSON.stringify(data.rows)}'>
|
<input type="hidden" name="rows" value="${encodeURIComponent(JSON.stringify(data.rows))}">
|
||||||
<input type="hidden" name="excelrows" value='${JSON.stringify(data.excel_data.map(row => row.excelrow))}'>
|
<input type="hidden" name="excelrows" value="${encodeURIComponent(JSON.stringify(data.excel_data.map(r => r.excelrow)))}">
|
||||||
|
|
||||||
<input type="hidden" name="filename" value="${data.filename}">
|
<input type="hidden" name="filename" value="${data.filename}">
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<input type="text" id="searchInput" class="form-control" placeholder="Cerca nelle righe...">
|
<input type="text" id="searchInput" class="form-control" placeholder="Cerca nelle righe...">
|
||||||
|
|||||||
Reference in New Issue
Block a user