diff --git a/public/userarea/import_edit2.php b/public/userarea/import_edit2.php
index 7e5e5e4..86a1531 100644
--- a/public/userarea/import_edit2.php
+++ b/public/userarea/import_edit2.php
@@ -83,7 +83,35 @@ $fixedStmt = $pdo->prepare("
ORDER BY id
");
$fixedStmt->execute([$template_id]);
-$fixedFields = $fixedStmt->fetchAll(PDO::FETCH_ASSOC);
+$fixedFieldsRaw = $fixedStmt->fetchAll(PDO::FETCH_ASSOC);
+
+// Ordine desiderato: Cliente Responsabile prima, poi gli altri, ConsegnaRichiesta prima delle 3 speciali
+$desiredOrder = [
+ 'ClienteResponsabile',
+ 'AnagraficaCertestObject',
+ 'AnagraficaCertestService',
+ 'MoltiplicatorePrezzo',
+ 'ConsegnaRichiesta',
+ // se ci sono altri campi fixed li mettiamo dopo
+];
+
+$fixedFields = [];
+$tempMap = [];
+foreach ($fixedFieldsRaw as $f) {
+ $tempMap[$f['fixed_field_key']] = $f;
+}
+
+foreach ($desiredOrder as $key) {
+ if (isset($tempMap[$key])) {
+ $fixedFields[] = $tempMap[$key];
+ unset($tempMap[$key]);
+ }
+}
+
+// Aggiunge eventuali campi fixed non elencati sopra (alla fine)
+foreach ($tempMap as $f) {
+ $fixedFields[] = $f;
+}
// helper default (DATE can use 'today' if you already use it elsewhere)
function fixedDefaultValue(array $f): string
@@ -709,24 +737,29 @@ function fixedDefaultValue(array $f): string
$headerIndex++;
echo "
";
$headerIndex++;
- echo "";
- $headerIndex++;
- echo "";
- $headerIndex++;
- echo "";
- ?>
- "
. htmlspecialchars($label) .
"";
$headerIndex++;
+
+ // Inseriamo le 3 colonne SOLO dopo ConsegnaRichiesta
+ if ($key === 'ConsegnaRichiesta' && !$insertedAfterConsegna) {
+ echo "";
+ $headerIndex++;
+ echo "";
+ $headerIndex++;
+ echo "";
+ $headerIndex++;
+ $insertedAfterConsegna = true;
+ }
}
}
?>
@@ -862,70 +895,73 @@ function fixedDefaultValue(array $f): string
Shipment Info
-
- = htmlspecialchars($row['importreferencecode']) ?>
-
-
-
-
-
-
- = htmlspecialchars($row['importdate']) ?>
-
-
+
";
+ data-col='" . htmlspecialchars($key, ENT_QUOTES) . "'
+ data-row='$index'
+ data-index='$cellIndex'
+ style='flex: 0 0 180px;'>";
if ($f['data_type'] === 'DATE') {
echo "";
- } else { // INT → diventa select se è uno dei campi API
- $isApiField = in_array($key, ['MoltiplicatorePrezzo', 'ClienteResponsabile', 'AnagraficaCertestObject', 'AnagraficaCertestService']);
+ } else {
+ $isApiField = in_array($key, ['MoltiplicatorePrezzo', 'ClienteResponsabile', 'AnagraficaCertestObject', 'AnagraficaCertestService'], true);
$selectClass = $isApiField ? 'api-fixed-select' : '';
-
- echo "";
+ echo "";
}
-
echo "";
+
$cellIndex++;
+
+ // === INSERIMENTO dopo ConsegnaRichiesta ===
+ if ($key === 'ConsegnaRichiesta') {
+ // Import Reference Code
+ echo "";
+ echo "" . htmlspecialchars($row['importreferencecode']) . "";
+ echo "";
+ echo "
";
+ $cellIndex++;
+
+ // filename_import
+ echo "";
+ echo "
File";
+ echo "
";
+ echo "
";
+ $cellIndex++;
+
+ // importdate
+ echo "";
+ echo "" . htmlspecialchars($row['importdate']) . "";
+ echo "";
+ echo "
";
+ $cellIndex++;
+ }
}
}
?>