added save all
This commit is contained in:
parent
9ba859e15b
commit
f89dbd0c23
@ -31,6 +31,6 @@ Content-Length: 51
|
|||||||
< strict-transport-security: max-age=2592000
|
< strict-transport-security: max-age=2592000
|
||||||
< x-powered-by: ASP.NET
|
< x-powered-by: ASP.NET
|
||||||
< x-content-type-options: nosniff
|
< x-content-type-options: nosniff
|
||||||
< date: Thu, 04 Sep 2025 13:15:29 GMT
|
< date: Sat, 06 Sep 2025 10:24:00 GMT
|
||||||
<
|
<
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
* Connection #0 to host 93.43.5.102 left intact
|
||||||
|
|||||||
@ -15,11 +15,11 @@
|
|||||||
* [HTTP/2] [1] [:scheme: https]
|
* [HTTP/2] [1] [:scheme: https]
|
||||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
||||||
* [HTTP/2] [1] [:path: /limsapi/api/odata/CustomField(1083)?$expand=CustomFieldsValues]
|
* [HTTP/2] [1] [:path: /limsapi/api/odata/CustomField(1083)?$expand=CustomFieldsValues]
|
||||||
* [HTTP/2] [1] [authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc1Njk5ODkyOSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.h_WreKPdjRaE9d3zCjGfsk0HSRqdDbtYfAEjpTl_Tjw]
|
* [HTTP/2] [1] [authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc1NzE2MTQ0MCwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.UgVN5wzjtR8MRU2xLDFWRHIAYLJTmxF3x7kWeVU11YU]
|
||||||
* [HTTP/2] [1] [accept: application/json]
|
* [HTTP/2] [1] [accept: application/json]
|
||||||
> GET /limsapi/api/odata/CustomField(1083)?$expand=CustomFieldsValues HTTP/2
|
> GET /limsapi/api/odata/CustomField(1083)?$expand=CustomFieldsValues HTTP/2
|
||||||
Host: 93.43.5.102
|
Host: 93.43.5.102
|
||||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc1Njk5ODkyOSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.h_WreKPdjRaE9d3zCjGfsk0HSRqdDbtYfAEjpTl_Tjw
|
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc1NzE2MTQ0MCwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.UgVN5wzjtR8MRU2xLDFWRHIAYLJTmxF3x7kWeVU11YU
|
||||||
Accept: application/json
|
Accept: application/json
|
||||||
|
|
||||||
< HTTP/2 200
|
< HTTP/2 200
|
||||||
@ -30,6 +30,6 @@ Accept: application/json
|
|||||||
< odata-version: 4.0
|
< odata-version: 4.0
|
||||||
< x-powered-by: ASP.NET
|
< x-powered-by: ASP.NET
|
||||||
< x-content-type-options: nosniff
|
< x-content-type-options: nosniff
|
||||||
< date: Thu, 04 Sep 2025 13:15:32 GMT
|
< date: Sat, 06 Sep 2025 10:24:02 GMT
|
||||||
<
|
<
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
* Connection #0 to host 93.43.5.102 left intact
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -21,8 +21,8 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !isset($_POST['template_id']) || !i
|
|||||||
|
|
||||||
$template_id = intval($_POST['template_id']) ?? $_SESSION['template_id'];
|
$template_id = intval($_POST['template_id']) ?? $_SESSION['template_id'];
|
||||||
$selected_rows = $_POST['selected_rows'] ?? $_SESSION['selected_rows'];
|
$selected_rows = $_POST['selected_rows'] ?? $_SESSION['selected_rows'];
|
||||||
$columns = json_decode($_POST['columns'], true) ?? $_SESSION['columns']; // Header dell'XLS
|
$columns = json_decode($_POST['columns'], true) ?? $_SESSION['columns'];
|
||||||
$rows = json_decode($_POST['rows'], true) ?? $_SESSION['rows']; // Dati dell'XLS
|
$rows = json_decode($_POST['rows'], true) ?? $_SESSION['rows'];
|
||||||
$newFilename = htmlspecialchars($_POST['filename']) ?? $_SESSION['filename'];
|
$newFilename = htmlspecialchars($_POST['filename']) ?? $_SESSION['filename'];
|
||||||
|
|
||||||
// Log dei dati ricevuti
|
// Log dei dati ricevuti
|
||||||
@ -31,7 +31,7 @@ error_log("Columns: " . json_encode($columns));
|
|||||||
error_log("Rows: " . json_encode($rows));
|
error_log("Rows: " . json_encode($rows));
|
||||||
|
|
||||||
// Recupera l'ID dell'utente loggato
|
// Recupera l'ID dell'utente loggato
|
||||||
$user_id = $iduserlogin ?? 1; // Default a 1 se non definito
|
$user_id = $iduserlogin ?? 1;
|
||||||
|
|
||||||
$db = DBHandlerSelect::getInstance();
|
$db = DBHandlerSelect::getInstance();
|
||||||
$pdo = $db->getConnection();
|
$pdo = $db->getConnection();
|
||||||
@ -99,30 +99,25 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2Lw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2Lw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||||
<style>
|
<style>
|
||||||
.cell-changed {
|
.cell-changed {
|
||||||
background-color: #fff3b0 !important; /* რბილი ყვითელი */
|
background-color: #fff3b0 !important;
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Colori pastello per input/select */
|
|
||||||
input.auto-input,
|
input.auto-input,
|
||||||
select.auto-input {
|
select.auto-input {
|
||||||
background-color: #d4edda;
|
background-color: #d4edda;
|
||||||
/* Verde pastello */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input.manual-input,
|
input.manual-input,
|
||||||
select.manual-input {
|
select.manual-input {
|
||||||
background-color: #fff3cd;
|
background-color: #fff3cd;
|
||||||
/* Giallino pastello */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input.required-input,
|
input.required-input,
|
||||||
select.required-input {
|
select.required-input {
|
||||||
background-color: #f8d7da;
|
background-color: #f8d7da;
|
||||||
/* Rossino chiaro */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stili base per input/select */
|
|
||||||
input,
|
input,
|
||||||
select {
|
select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -133,14 +128,11 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mantieni leggibilità del testo */
|
|
||||||
input,
|
input,
|
||||||
select {
|
select {
|
||||||
color: #333;
|
color: #333;
|
||||||
/* Colore scuro per contrasto */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stili per i badge di stato */
|
|
||||||
.status-badge {
|
.status-badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
@ -166,7 +158,6 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stili esistenti rimangono invariati */
|
|
||||||
.grid-container {
|
.grid-container {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
@ -259,6 +250,11 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grid-top .save-all-cell {
|
||||||
|
flex: 0 0 210px;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
.propagate-btn {
|
.propagate-btn {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
@ -375,7 +371,6 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stile per l'header dei pulsanti combinati */
|
|
||||||
.grid-cell.button-cell,
|
.grid-cell.button-cell,
|
||||||
.grid-header.button-header {
|
.grid-header.button-header {
|
||||||
min-width: 210px !important;
|
min-width: 210px !important;
|
||||||
@ -396,6 +391,20 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
background-color: #d4edda !important;
|
background-color: #d4edda !important;
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.save-all-btn {
|
||||||
|
background-color: #28a745;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 8px 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.save-all-btn:hover {
|
||||||
|
background-color: #218838;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<title>Edit Imported Data - <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?></title>
|
<title>Edit Imported Data - <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?></title>
|
||||||
</head>
|
</head>
|
||||||
@ -426,9 +435,10 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form id="editForm">
|
<form id="editForm">
|
||||||
<div class="grid-container">
|
<div class="grid-container">
|
||||||
<!-- Riga superiore per gli input dei campi manuali -->
|
|
||||||
<div class="grid-top">
|
<div class="grid-top">
|
||||||
<div class="grid-cell button-cell" style="flex: 0 0 210px;"></div> <!-- Actions -->
|
<div class="grid-cell save-all-cell">
|
||||||
|
<button type="button" class="save-all-btn" title="Save All Rows"><i class="fas fa-save"></i> Save All</button>
|
||||||
|
</div>
|
||||||
<?php if ($mainFieldMapping): ?>
|
<?php if ($mainFieldMapping): ?>
|
||||||
<div class="grid-cell" style="flex: 0 0 150px;">
|
<div class="grid-cell" style="flex: 0 0 150px;">
|
||||||
<?php
|
<?php
|
||||||
@ -456,9 +466,8 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="grid-cell" style="flex: 0 0 150px;"></div> <!-- status -->
|
<div class="grid-cell" style="flex: 0 0 150px;"></div>
|
||||||
<?php
|
<?php
|
||||||
// Campi automatici (is_manual = 0) escluso main_field
|
|
||||||
$autoIndex = 0;
|
$autoIndex = 0;
|
||||||
foreach ($allMappings as $mapping) {
|
foreach ($allMappings as $mapping) {
|
||||||
if (!$mapping['is_manual'] && $mapping['main_field'] != 1) {
|
if (!$mapping['is_manual'] && $mapping['main_field'] != 1) {
|
||||||
@ -477,7 +486,6 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
$autoIndex++;
|
$autoIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Campi manuali (is_manual = 1) escluso main_field
|
|
||||||
$manualIndex = 0;
|
$manualIndex = 0;
|
||||||
foreach ($allMappings as $mapping) {
|
foreach ($allMappings as $mapping) {
|
||||||
if ($mapping['is_manual'] && $mapping['main_field'] != 1) {
|
if ($mapping['is_manual'] && $mapping['main_field'] != 1) {
|
||||||
@ -489,7 +497,7 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
if ($mapping['is_required']) $inputClass .= ' required-input';
|
if ($mapping['is_required']) $inputClass .= ' required-input';
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'>";
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'>";
|
||||||
if ($mapping['data_type'] === 'SceltaMultipla') {
|
if ($mapping['data_type'] === 'SceltaMultipla') {
|
||||||
echo "<select class='custom-field dropdown-select $inputClass' data-column='manual_$manualIndex' data-field-id='{$mapping['field_id']}' data-selected-value='" . htmlspecialchars($fieldValue) . "' " . ($mapping['is_required'] ? 'required' : '') . ">";
|
echo "<select class='custom-field dropdown-select $inputClass' data-column='manual_$manualIndex' data-field-id='{$mapping['field_id']}' data-selected-value='" . htmlspecialchars($fieldValue) . "' " . ($mainFieldMapping['is_required'] ? 'required' : '') . ">";
|
||||||
echo "<option value=''>Seleziona...</option>";
|
echo "<option value=''>Seleziona...</option>";
|
||||||
echo "</select>";
|
echo "</select>";
|
||||||
} elseif ($mapping['data_type'] === 'DATE') {
|
} elseif ($mapping['data_type'] === 'DATE') {
|
||||||
@ -504,15 +512,14 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
$manualIndex++;
|
$manualIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 200px;'></div>"; // AWB
|
echo "<div class='grid-cell' style='flex: 0 0 200px;'></div>";
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 250px;'></div>"; // Tracking Info
|
echo "<div class='grid-cell' style='flex: 0 0 250px;'></div>";
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>"; // importreferencecode
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>"; // filename_import
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>"; // importdate
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Header della tabella -->
|
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
<div class="grid-header button-header" style="flex: 0 0 210px;">Actions</div>
|
<div class="grid-header button-header" style="flex: 0 0 210px;">Actions</div>
|
||||||
<?php if ($mainFieldMapping): ?>
|
<?php if ($mainFieldMapping): ?>
|
||||||
@ -549,7 +556,6 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Righe della tabella -->
|
|
||||||
<?php foreach ($importedData as $index => $row): ?>
|
<?php foreach ($importedData as $index => $row): ?>
|
||||||
<div class="grid-row" data-id="<?= $row['iddatadb'] ?>">
|
<div class="grid-row" data-id="<?= $row['iddatadb'] ?>">
|
||||||
<div class="grid-cell button-cell" style="flex: 0 0 210px; position: relative;">
|
<div class="grid-cell button-cell" style="flex: 0 0 210px; position: relative;">
|
||||||
@ -704,16 +710,17 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
<script src="tracking.js"></script>
|
<script src="tracking.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
console.log("Page loaded, initializing event listeners");
|
||||||
|
|
||||||
const inputs = document.querySelectorAll(".cell-input, .dropdown-select, .carrier-select, .awb-input");
|
const inputs = document.querySelectorAll(".cell-input, .dropdown-select, .carrier-select, .awb-input");
|
||||||
const unsavedDiv = document.getElementById("unsavedChanges");
|
const unsavedDiv = document.getElementById("unsavedChanges");
|
||||||
const changedList = document.getElementById("changedFields");
|
const changedList = document.getElementById("changedFields");
|
||||||
|
|
||||||
let hasChanges = false;
|
let hasChanges = false;
|
||||||
let changedFields = {}; // { rowIndex: [fieldNames...] }
|
let changedFields = {};
|
||||||
|
|
||||||
function renderChangedList() {
|
function renderChangedList() {
|
||||||
|
console.log("Rendering changed fields list:", changedFields);
|
||||||
changedList.innerHTML = "";
|
changedList.innerHTML = "";
|
||||||
|
|
||||||
Object.keys(changedFields).forEach(rowIndex => {
|
Object.keys(changedFields).forEach(rowIndex => {
|
||||||
const fields = changedFields[rowIndex];
|
const fields = changedFields[rowIndex];
|
||||||
if (fields.length > 0) {
|
if (fields.length > 0) {
|
||||||
@ -722,14 +729,13 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
changedList.appendChild(li);
|
changedList.appendChild(li);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
unsavedDiv.style.display = Object.keys(changedFields).length > 0 ? "block" : "none";
|
unsavedDiv.style.display = Object.keys(changedFields).length > 0 ? "block" : "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.forEach(el => {
|
inputs.forEach(el => {
|
||||||
el.addEventListener("change", () => {
|
el.addEventListener("change", () => {
|
||||||
|
console.log("Input changed:", el.name);
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
|
|
||||||
const gridCell = el.closest(".grid-cell");
|
const gridCell = el.closest(".grid-cell");
|
||||||
const colIndex = gridCell?.dataset.index;
|
const colIndex = gridCell?.dataset.index;
|
||||||
const rowIndex = gridCell?.dataset.row;
|
const rowIndex = gridCell?.dataset.row;
|
||||||
@ -749,8 +755,6 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
if (!changedFields[rowIndex].includes(label)) {
|
if (!changedFields[rowIndex].includes(label)) {
|
||||||
changedFields[rowIndex].push(label);
|
changedFields[rowIndex].push(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlight მხოლოდ ეს კონკრეტული cell
|
|
||||||
gridCell.classList.add("cell-changed");
|
gridCell.classList.add("cell-changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,23 +765,141 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
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;
|
||||||
|
console.log(`Saving row ${rowIndex}`);
|
||||||
|
const row = btn.closest('.grid-row');
|
||||||
|
const iddatadb = row.getAttribute('data-id');
|
||||||
|
const formData = new FormData();
|
||||||
|
|
||||||
if (rowIndex !== undefined && changedFields[rowIndex]) {
|
const inputs = row.querySelectorAll(`input[name^="rows[${rowIndex}][details]"], select[name^="rows[${rowIndex}][details]"]`);
|
||||||
delete changedFields[rowIndex]; // წავშალოთ კონკრეტული row
|
inputs.forEach(input => {
|
||||||
renderChangedList();
|
const matches = input.name.match(/rows\[\d+\]\[details\]\[(\d+)\]\[field_value\]/);
|
||||||
|
if (matches) {
|
||||||
|
const mappingId = matches[1];
|
||||||
|
formData.append(`details${mappingId}field_value`, input.value);
|
||||||
|
if (input.tagName === 'SELECT' && input.classList.contains('dropdown-select')) {
|
||||||
|
input.setAttribute('data-selected-value', input.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
formData.append('iddatadb', iddatadb);
|
||||||
|
|
||||||
// ამოვშალოთ cell highlight იმ row-ში
|
fetch('save_edited_row.php', {
|
||||||
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
method: 'POST',
|
||||||
.forEach(cell => cell.classList.remove("cell-changed"));
|
body: formData
|
||||||
}
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log("Save response:", data);
|
||||||
|
if (data.success) {
|
||||||
|
const cells = row.querySelectorAll('.grid-cell');
|
||||||
|
cells.forEach(cell => {
|
||||||
|
cell.classList.remove('flash-success');
|
||||||
|
void cell.offsetWidth;
|
||||||
|
cell.classList.add('flash-success');
|
||||||
|
});
|
||||||
|
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
||||||
|
|
||||||
// თუ აღარაფერია შესანახი → false
|
if (changedFields[rowIndex]) {
|
||||||
if (Object.keys(changedFields).length === 0) {
|
delete changedFields[rowIndex];
|
||||||
hasChanges = false;
|
document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`)
|
||||||
}
|
.forEach(cell => cell.classList.remove("cell-changed"));
|
||||||
|
renderChangedList();
|
||||||
|
hasChanges = Object.keys(changedFields).length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
alert('Salvataggio riga avvenuto con successo!');
|
||||||
|
} else {
|
||||||
|
alert('Errore durante il salvataggio: ' + data.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error("Save error:", error);
|
||||||
|
alert('Errore durante il salvataggio: ' + error.message);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.querySelector('.save-all-btn').addEventListener('click', async () => {
|
||||||
|
console.log("Saving all rows");
|
||||||
|
const rows = document.querySelectorAll('.grid-row');
|
||||||
|
let successCount = 0;
|
||||||
|
let errorMessages = [];
|
||||||
|
|
||||||
|
for (const row of rows) {
|
||||||
|
const saveBtn = row.querySelector('.save-btn');
|
||||||
|
if (!saveBtn) {
|
||||||
|
console.warn(`No save button found in row with data-id: ${row.getAttribute('data-id')}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const rowIndex = saveBtn.dataset.row;
|
||||||
|
const iddatadb = row.getAttribute('data-id');
|
||||||
|
if (!rowIndex || !iddatadb) {
|
||||||
|
console.warn(`Missing rowIndex or iddatadb in row:`, row);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
console.log(`Processing row ${rowIndex} with iddatadb ${iddatadb}`);
|
||||||
|
const formData = new FormData();
|
||||||
|
|
||||||
|
const inputs = row.querySelectorAll(`input[name^="rows[${rowIndex}][details]"], select[name^="rows[${rowIndex}][details]"]`);
|
||||||
|
inputs.forEach(input => {
|
||||||
|
const matches = input.name.match(/rows\[\d+\]\[details\]\[(\d+)\]\[field_value\]/);
|
||||||
|
if (matches) {
|
||||||
|
const mappingId = matches[1];
|
||||||
|
formData.append(`details${mappingId}field_value`, input.value);
|
||||||
|
if (input.tagName === 'SELECT' && input.classList.contains('dropdown-select')) {
|
||||||
|
input.setAttribute('data-selected-value', input.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
formData.append('iddatadb', iddatadb);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch('save_edited_row.php', {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData
|
||||||
|
});
|
||||||
|
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
console.log(`Row ${rowIndex} save response:`, data);
|
||||||
|
if (data.success) {
|
||||||
|
successCount++;
|
||||||
|
const cells = row.querySelectorAll('.grid-cell');
|
||||||
|
cells.forEach(cell => {
|
||||||
|
cell.classList.remove('flash-success');
|
||||||
|
void cell.offsetWidth;
|
||||||
|
cell.classList.add('flash-success');
|
||||||
|
});
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errorMessages.push(`Riga ${parseInt(rowIndex) + 1}: ${data.message}`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Row ${rowIndex} save error:`, error);
|
||||||
|
errorMessages.push(`Riga ${parseInt(rowIndex) + 1}: ${error.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
renderChangedList();
|
||||||
|
hasChanges = Object.keys(changedFields).length > 0;
|
||||||
|
console.log(`Save all completed: ${successCount} successes, ${errorMessages.length} errors`);
|
||||||
|
|
||||||
|
if (errorMessages.length === 0) {
|
||||||
|
alert(`Tutte le ${successCount} righe salvate con successo!`);
|
||||||
|
} else {
|
||||||
|
alert(`Salvate ${successCount} righe con successo.\nErrori:\n${errorMessages.join('\n')}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
window.addEventListener("beforeunload", function(e) {
|
window.addEventListener("beforeunload", function(e) {
|
||||||
if (hasChanges) {
|
if (hasChanges) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -786,9 +908,9 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
console.log("Initializing cell expansion and propagation");
|
||||||
const inputs = document.querySelectorAll('.cell-input');
|
const inputs = document.querySelectorAll('.cell-input');
|
||||||
inputs.forEach(input => {
|
inputs.forEach(input => {
|
||||||
input.addEventListener('focus', function() {
|
input.addEventListener('focus', function() {
|
||||||
@ -799,48 +921,10 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const saveButtons = document.querySelectorAll('.save-btn');
|
|
||||||
saveButtons.forEach(button => {
|
|
||||||
button.addEventListener('click', function() {
|
|
||||||
const rowIndex = this.getAttribute('data-row');
|
|
||||||
const row = this.closest('.grid-row');
|
|
||||||
const iddatadb = row.getAttribute('data-id');
|
|
||||||
const formData = new FormData();
|
|
||||||
|
|
||||||
const inputs = row.querySelectorAll(`input[name^="rows[${rowIndex}]"], select[name^="rows[${rowIndex}]"]`);
|
|
||||||
inputs.forEach(input => {
|
|
||||||
const name = input.name.replace(`rows[${rowIndex}]`, '').replace(/\[|\]/g, '');
|
|
||||||
formData.append(name, input.value);
|
|
||||||
});
|
|
||||||
formData.append('iddatadb', iddatadb);
|
|
||||||
formData.append('mapping', JSON.stringify(<?= json_encode($allMappings) ?>));
|
|
||||||
|
|
||||||
fetch('save_edited_row.php', {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
const cells = row.querySelectorAll('.grid-cell');
|
|
||||||
cells.forEach(cell => {
|
|
||||||
cell.classList.remove('flash-success');
|
|
||||||
void cell.offsetWidth;
|
|
||||||
cell.classList.add('flash-success');
|
|
||||||
});
|
|
||||||
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
|
||||||
alert('Salvataggio avvenuto con successo!');
|
|
||||||
} else {
|
|
||||||
alert('Errore durante il salvataggio: ' + data.message);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => alert('Errore durante il salvataggio: ' + error.message));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const propagateButtons = document.querySelectorAll('.propagate-btn');
|
const propagateButtons = document.querySelectorAll('.propagate-btn');
|
||||||
propagateButtons.forEach(button => {
|
propagateButtons.forEach(button => {
|
||||||
button.addEventListener('click', function() {
|
button.addEventListener('click', function() {
|
||||||
|
console.log("Propagating value for column:", this.getAttribute('data-column'));
|
||||||
const column = this.getAttribute('data-column');
|
const column = this.getAttribute('data-column');
|
||||||
const input = this.previousElementSibling;
|
const input = this.previousElementSibling;
|
||||||
const value = input.value;
|
const value = input.value;
|
||||||
@ -859,6 +943,7 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
if (targetInput) {
|
if (targetInput) {
|
||||||
targetInput.value = value;
|
targetInput.value = value;
|
||||||
if (targetInput.tagName === 'SELECT') {
|
if (targetInput.tagName === 'SELECT') {
|
||||||
|
targetInput.setAttribute('data-selected-value', value);
|
||||||
const event = new Event('change');
|
const event = new Event('change');
|
||||||
targetInput.dispatchEvent(event);
|
targetInput.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
@ -876,6 +961,7 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
let columnIndex = 0;
|
let columnIndex = 0;
|
||||||
resizers.forEach(resizer => {
|
resizers.forEach(resizer => {
|
||||||
resizer.addEventListener('mousedown', function(e) {
|
resizer.addEventListener('mousedown', function(e) {
|
||||||
|
console.log("Starting column resize");
|
||||||
currentResizer = resizer;
|
currentResizer = resizer;
|
||||||
const header = resizer.parentElement;
|
const header = resizer.parentElement;
|
||||||
columnIndex = header.getAttribute('data-index');
|
columnIndex = header.getAttribute('data-index');
|
||||||
@ -898,6 +984,7 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
|
|
||||||
function stopResize() {
|
function stopResize() {
|
||||||
if (currentResizer) {
|
if (currentResizer) {
|
||||||
|
console.log("Stopping column resize");
|
||||||
document.removeEventListener('mousemove', resize);
|
document.removeEventListener('mousemove', resize);
|
||||||
document.removeEventListener('mouseup', stopResize);
|
document.removeEventListener('mouseup', stopResize);
|
||||||
currentResizer = null;
|
currentResizer = null;
|
||||||
@ -908,11 +995,15 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
console.log("Initializing dropdown population");
|
||||||
const dropdownData = {};
|
const dropdownData = {};
|
||||||
|
|
||||||
async function populateDropdowns() {
|
async function populateDropdowns() {
|
||||||
const dropdowns = document.querySelectorAll('.dropdown-select');
|
const dropdowns = document.querySelectorAll('.dropdown-select');
|
||||||
if (dropdowns.length === 0) return;
|
if (dropdowns.length === 0) {
|
||||||
|
console.log("No dropdowns found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const uniqueFieldIds = [
|
const uniqueFieldIds = [
|
||||||
...new Set(Array.from(dropdowns).map(d => d.getAttribute('data-field-id')))
|
...new Set(Array.from(dropdowns).map(d => d.getAttribute('data-field-id')))
|
||||||
@ -921,31 +1012,34 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
const missingFieldIds = uniqueFieldIds.filter(fieldId => !dropdownData[fieldId]);
|
const missingFieldIds = uniqueFieldIds.filter(fieldId => !dropdownData[fieldId]);
|
||||||
|
|
||||||
if (missingFieldIds.length > 0) {
|
if (missingFieldIds.length > 0) {
|
||||||
|
console.log("Fetching dropdown data for field IDs:", missingFieldIds);
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`get_customfield_values.php?field_ids=${missingFieldIds.join(",")}`
|
`get_customfield_values.php?field_ids=${missingFieldIds.join(",")}`
|
||||||
);
|
);
|
||||||
|
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
console.error("Errore fetch multiplo:", data.error);
|
console.error("Fetch error:", data.error);
|
||||||
} else {
|
} else {
|
||||||
for (const fieldId of Object.keys(data)) {
|
for (const fieldId of Object.keys(data)) {
|
||||||
dropdownData[fieldId] = data[fieldId] || [];
|
dropdownData[fieldId] = data[fieldId] || [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Errore generale nel fetch multiplo:", error);
|
console.error("Fetch error:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dropdowns.forEach(dropdown => {
|
dropdowns.forEach(dropdown => {
|
||||||
const fieldId = dropdown.getAttribute('data-field-id');
|
const fieldId = dropdown.getAttribute('data-field-id');
|
||||||
const selectedValue = dropdown.getAttribute('data-selected-value') || '';
|
const selectedValue = dropdown.getAttribute('data-selected-value') || '';
|
||||||
const currentValue = dropdown.value; // Preserva il valore corrente
|
const currentValue = dropdown.value;
|
||||||
|
|
||||||
if (!fieldId || !dropdownData[fieldId]) {
|
if (!fieldId || !dropdownData[fieldId]) {
|
||||||
dropdown.innerHTML = '<option value="">Errore nel caricamento</option>';
|
dropdown.innerHTML = '<option value="">Errore nel caricamento</option>';
|
||||||
|
console.warn(`No data for fieldId ${fieldId}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,7 +1048,6 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = value.IdCustomFieldsValue;
|
option.value = value.IdCustomFieldsValue;
|
||||||
option.textContent = value.Valore;
|
option.textContent = value.Valore;
|
||||||
// Usa il valore corrente se disponibile, altrimenti usa data-selected-value
|
|
||||||
if (currentValue && currentValue === String(value.IdCustomFieldsValue)) {
|
if (currentValue && currentValue === String(value.IdCustomFieldsValue)) {
|
||||||
option.selected = true;
|
option.selected = true;
|
||||||
} else if (!currentValue && selectedValue === String(value.IdCustomFieldsValue)) {
|
} else if (!currentValue && selectedValue === String(value.IdCustomFieldsValue)) {
|
||||||
@ -965,89 +1058,14 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
|
|
||||||
if ((currentValue || selectedValue) && dropdown.value !== (currentValue || selectedValue)) {
|
if ((currentValue || selectedValue) && dropdown.value !== (currentValue || selectedValue)) {
|
||||||
dropdown.value = '';
|
dropdown.value = '';
|
||||||
console.warn(`Valore ${currentValue || selectedValue} non trovato per fieldId ${fieldId}`);
|
console.warn(`Value ${currentValue || selectedValue} not found for fieldId ${fieldId}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chiama populateDropdowns solo al caricamento iniziale
|
|
||||||
populateDropdowns();
|
populateDropdowns();
|
||||||
|
|
||||||
document.querySelectorAll('.save-btn').forEach(btn => {
|
|
||||||
btn.addEventListener('click', function() {
|
|
||||||
const rowIndex = this.getAttribute('data-row');
|
|
||||||
const row = this.closest('.grid-row');
|
|
||||||
const iddatadb = row.getAttribute('data-id');
|
|
||||||
const formData = new FormData();
|
|
||||||
|
|
||||||
const inputs = row.querySelectorAll(`input[name^="rows[${rowIndex}]"], select[name^="rows[${rowIndex}]"]`);
|
|
||||||
inputs.forEach(input => {
|
|
||||||
const name = input.name.replace(`rows[${rowIndex}]`, '').replace(/\[|\]/g, '');
|
|
||||||
formData.append(name, input.value);
|
|
||||||
// Aggiorna data-selected-value per i dropdown
|
|
||||||
if (input.tagName === 'SELECT' && input.classList.contains('dropdown-select')) {
|
|
||||||
input.setAttribute('data-selected-value', input.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
formData.append('iddatadb', iddatadb);
|
|
||||||
formData.append('mapping', JSON.stringify(<?= json_encode($allMappings) ?>));
|
|
||||||
|
|
||||||
fetch('save_edited_row.php', {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
const cells = row.querySelectorAll('.grid-cell');
|
|
||||||
cells.forEach(cell => {
|
|
||||||
cell.classList.remove('flash-success');
|
|
||||||
void cell.offsetWidth;
|
|
||||||
cell.classList.add('flash-success');
|
|
||||||
});
|
|
||||||
setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500);
|
|
||||||
alert('Salvataggio avvenuto con successo!');
|
|
||||||
} else {
|
|
||||||
alert('Errore durante il salvataggio: ' + data.message);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => alert('Errore durante il salvataggio: ' + error.message));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const propagateButtons = document.querySelectorAll('.propagate-btn');
|
|
||||||
propagateButtons.forEach(button => {
|
|
||||||
button.addEventListener('click', function() {
|
|
||||||
const column = this.getAttribute('data-column');
|
|
||||||
const input = this.previousElementSibling;
|
|
||||||
const value = input.value;
|
|
||||||
|
|
||||||
const gridTopCells = document.querySelector('.grid-top').querySelectorAll('.grid-cell');
|
|
||||||
const targetTopIndex = Array.from(gridTopCells).findIndex(cell =>
|
|
||||||
cell.querySelector('.propagate-btn[data-column="' + column + '"]')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (targetTopIndex !== -1) {
|
|
||||||
const rows = document.querySelectorAll('.grid-row');
|
|
||||||
rows.forEach(row => {
|
|
||||||
const cells = row.querySelectorAll('.grid-cell');
|
|
||||||
if (cells.length > targetTopIndex) {
|
|
||||||
const targetInput = cells[targetTopIndex].querySelector('select.dropdown-select, input');
|
|
||||||
if (targetInput) {
|
|
||||||
targetInput.value = value;
|
|
||||||
if (targetInput.tagName === 'SELECT') {
|
|
||||||
targetInput.setAttribute('data-selected-value', value); // Aggiorna anche qui
|
|
||||||
const event = new Event('change');
|
|
||||||
targetInput.dispatchEvent(event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user