From 6b0d2aa9b9fbbd306e0dee1f5c3c350894104db9 Mon Sep 17 00:00:00 2001 From: solocla Date: Mon, 27 Apr 2026 14:34:45 +0200 Subject: [PATCH] fixed color and import dahboard --- public/userarea/gridRenderer.js | 43 +++ public/userarea/import_dashboard.php | 313 +++++++++++++++++----- public/userarea/imported.php | 152 +++++++++-- public/userarea/load_active_templates.php | 5 +- public/userarea/schemi_base_response.json | 2 +- 5 files changed, 426 insertions(+), 89 deletions(-) diff --git a/public/userarea/gridRenderer.js b/public/userarea/gridRenderer.js index 59743a4..bf762e0 100644 --- a/public/userarea/gridRenderer.js +++ b/public/userarea/gridRenderer.js @@ -331,6 +331,28 @@ function createCell(col, rowIndex, cellIndex) { const div = document.createElement("div"); div.className = "grid-cell editable-cell"; + + // Field color classification + // Schema/customfield fields are green. + // Fixed and standard fields stay white. + if (col.type === "detail" || col.type === "main_field") { + div.classList.add("schema-field"); + } else if (col.type === "fixed") { + div.classList.add("fixed-field"); + } else { + div.classList.add("standard-field"); + } + + // Required field classification. + // This comes from template_mapping.is_required or template_fixed_mapping.is_required. + if ( + col.isRequired === true || + col.isRequired === 1 || + col.isRequired === "1" + ) { + div.classList.add("required-field"); + } + div.dataset.col = col.key; div.dataset.colType = col.type; div.dataset.row = rowIndex; @@ -744,6 +766,27 @@ columns.forEach((col, colIdx) => { const cell = document.createElement("div"); cell.className = "grid-cell grid-top-cell"; + + // Field color classification for top propagation row + // Schema/customfield fields are green. + // Fixed and standard fields stay white. + if (col.type === "detail" || col.type === "main_field") { + cell.classList.add("schema-field"); + } else if (col.type === "fixed") { + cell.classList.add("fixed-field"); + } else { + cell.classList.add("standard-field"); + } + + // Required field classification also for the top propagation row. + if ( + col.isRequired === true || + col.isRequired === 1 || + col.isRequired === "1" + ) { + cell.classList.add("required-field"); + } + cell.style.flex = `0 0 ${col.width}px`; if ( diff --git a/public/userarea/import_dashboard.php b/public/userarea/import_dashboard.php index a35f1cb..cae5980 100644 --- a/public/userarea/import_dashboard.php +++ b/public/userarea/import_dashboard.php @@ -10,65 +10,125 @@ Template Buttons - <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?> @@ -87,14 +147,54 @@
Active Templates
- -
+ + + +
+
+
+
Loading XLS templates...
+
+
+ +
+
+
Loading API templates...
+
+
+ +
+
+
Loading PDF templates...
+
+
+
+
@@ -104,46 +204,137 @@ diff --git a/public/userarea/imported.php b/public/userarea/imported.php index dac2e22..e3021b7 100644 --- a/public/userarea/imported.php +++ b/public/userarea/imported.php @@ -374,20 +374,10 @@ $gridMeta = [ transition: background-color 0.3s ease; } - input.auto-input, - select.auto-input { - background-color: #d4edda; - } - input.manual-input, - select.manual-input { - background-color: #fff3cd; - } - input.required-input, - select.required-input { - background-color: #f8d7da; - } + + input.required-input, select.required-input { @@ -426,17 +416,9 @@ $gridMeta = [ outline: none !important; } - textarea.auto-input { - background-color: #d4edda; - } - textarea.manual-input { - background-color: #fff3cd; - } - textarea.required-input { - background-color: #f8d7da; - } + .status-badge { display: inline-block; @@ -1044,11 +1026,7 @@ $gridMeta = [ font-style: italic; } - .api-fixed-select.required-input:invalid, - .api-fixed-select[required]:not([value]):not([data-select2-id]) { - background-color: #f8d7da !important; - border-color: #dc3545 !important; - } + /* ── Pagination bar ── */ .pager-bar { @@ -1161,6 +1139,128 @@ $gridMeta = [ color: #adb5bd; user-select: none; } + + /* ========================================================= + FINAL GRID COLORS + Schema/customfield fields = green + Fixed/standard fields = white + Required fields = red border only + ========================================================= */ + + /* Default: all fields white */ + .grid-container input, + .grid-container select, + .grid-container textarea, + .grid-top input, + .grid-top select, + .grid-top textarea { + background-color: #ffffff !important; + color: #333 !important; + } + + /* Schema/customfield fields: green background */ + .grid-container .schema-field input, + .grid-container .schema-field select, + .grid-container .schema-field textarea, + .grid-top .schema-field input, + .grid-top .schema-field select, + .grid-top .schema-field textarea { + background-color: #dff3e3 !important; + } + + /* Fixed and standard fields: white background */ + .grid-container .fixed-field input, + .grid-container .fixed-field select, + .grid-container .fixed-field textarea, + .grid-container .standard-field input, + .grid-container .standard-field select, + .grid-container .standard-field textarea, + .grid-top .fixed-field input, + .grid-top .fixed-field select, + .grid-top .fixed-field textarea, + .grid-top .standard-field input, + .grid-top .standard-field select, + .grid-top .standard-field textarea { + background-color: #ffffff !important; + } + + /* Required fields: red border only */ + .grid-container .required-field input, + .grid-container .required-field select, + .grid-container .required-field textarea, + .grid-top .required-field input, + .grid-top .required-field select, + .grid-top .required-field textarea { + border: 2px solid #dc3545 !important; + box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.15) !important; + } + + /* Required schema/customfield fields: green + red border */ + .grid-container .schema-field.required-field input, + .grid-container .schema-field.required-field select, + .grid-container .schema-field.required-field textarea, + .grid-top .schema-field.required-field input, + .grid-top .schema-field.required-field select, + .grid-top .schema-field.required-field textarea { + background-color: #dff3e3 !important; + border: 2px solid #dc3545 !important; + } + + /* Required fixed/standard fields: white + red border */ + .grid-container .fixed-field.required-field input, + .grid-container .fixed-field.required-field select, + .grid-container .fixed-field.required-field textarea, + .grid-container .standard-field.required-field input, + .grid-container .standard-field.required-field select, + .grid-container .standard-field.required-field textarea, + .grid-top .fixed-field.required-field input, + .grid-top .fixed-field.required-field select, + .grid-top .fixed-field.required-field textarea, + .grid-top .standard-field.required-field input, + .grid-top .standard-field.required-field select, + .grid-top .standard-field.required-field textarea { + background-color: #ffffff !important; + border: 2px solid #dc3545 !important; + } + + /* Select2 - schema/customfield fields: green */ + .grid-container .schema-field .select2-container--default .select2-selection--single, + .grid-top .schema-field .select2-container--default .select2-selection--single { + background-color: #dff3e3 !important; + } + + /* Select2 - fixed/standard fields: white */ + .grid-container .fixed-field .select2-container--default .select2-selection--single, + .grid-container .standard-field .select2-container--default .select2-selection--single, + .grid-top .fixed-field .select2-container--default .select2-selection--single, + .grid-top .standard-field .select2-container--default .select2-selection--single { + background-color: #ffffff !important; + } + + /* Select2 - required fields: red border only */ + .grid-container .required-field .select2-container--default .select2-selection--single, + .grid-top .required-field .select2-container--default .select2-selection--single { + border: 2px solid #dc3545 !important; + box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.15) !important; + } + + /* Remove old red background from required classes */ + .grid-container input.required-input, + .grid-container select.required-input, + .grid-container textarea.required-input, + .grid-top input.required-input, + .grid-top select.required-input, + .grid-top textarea.required-input { + background-color: inherit !important; + } + + /* Missing required cell: red outline only */ + .grid-cell.missing-required { + background-color: inherit !important; + border-right: 1px solid #dee2e6 !important; + outline: 2px solid #dc3545 !important; + outline-offset: -2px; + } Edit Imported Data - <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?> diff --git a/public/userarea/load_active_templates.php b/public/userarea/load_active_templates.php index b0d9fb7..29680c9 100644 --- a/public/userarea/load_active_templates.php +++ b/public/userarea/load_active_templates.php @@ -13,7 +13,10 @@ try { } // Recupera solo i template attivi - $stmt = $pdo->query("SELECT id, button_label, button_bg_color, button_text_color, button_size FROM excel_templates WHERE status = 'active'"); + $stmt = $pdo->query("SELECT id, button_label, button_size, button_bg_color, button_text_color, source_type +FROM excel_templates +WHERE status = 'active' +ORDER BY button_label ASC"); $templates = $stmt->fetchAll(PDO::FETCH_ASSOC); $response["success"] = true; diff --git a/public/userarea/schemi_base_response.json b/public/userarea/schemi_base_response.json index 4219d5a..2be9d68 100644 --- a/public/userarea/schemi_base_response.json +++ b/public/userarea/schemi_base_response.json @@ -653,7 +653,7 @@ "IdSchemaCustomFields": 163, "ConteggioClienti": 0, "Nome": "Devred", - "Descrizione": "Schema creato per cliente DEVRED\r\nGR 18\/03\/2024\r\n\r\n" + "Descrizione": "Schema creato per cliente DEVRED\r\nGR 18\/03\/2024 aggiornato il 23\/04\/2026\r\n\r\n" }, { "IdSchemaCustomFields": 164,