fixed column mappings

This commit is contained in:
Claudio 2026-03-05 14:19:49 +01:00
parent 2ee9f2ecb1
commit 540c44d89a
3 changed files with 74 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -1611,7 +1611,11 @@ function fixedDefaultValue(array $f): string
clientData.forEach(client => {
const nome = client.Nominativo || "Nome non disponibile";
const id = client.IdCliente || "ID non disponibile";
const option = new Option(`${nome.trim()} - ${client.CodiceNazioneFatturazione} (ID: ${id})`, id);
const codiceCliente = (client.CodiceCliente || '').toString().trim();
const suffix = (codiceCliente.split('_')[1] || '').trim();
const shortCode = suffix || (codiceCliente ? codiceCliente.charAt(0) : '--');
const option = new Option(`${nome.trim()} - ${shortCode} (ID: ${id})`, id);
if (parseInt(id) === parseInt(<?php echo json_encode($default_idclient ?? 0); ?>)) {
option.selected = true;
}
@ -1647,7 +1651,11 @@ function fixedDefaultValue(array $f): string
clientData.forEach(client => {
const nome = client.Nominativo || "Nome non disponibile";
const id = client.IdCliente || "ID non disponibile";
const option = new Option(`${nome.trim()} - ${client.CodiceNazioneFatturazione} (ID: ${id})`, id);
const codiceCliente = (client.CodiceCliente || '').toString().trim();
const suffix = (codiceCliente.split('_')[1] || '').trim();
const shortCode = suffix || (codiceCliente ? codiceCliente.charAt(0) : '--');
const option = new Option(`${nome.trim()} - ${shortCode} (ID: ${id})`, id);
if (String(id) === String(currentValue)) {
option.selected = true;
}
@ -2031,7 +2039,7 @@ function fixedDefaultValue(array $f): string
const id = client.IdCliente || "ID non disponibile";
// CodiceCliente es: "Bl01858_E" -> vogliamo "E"
const codiceCliente = (client.CodiceCliente || '').toString().trim();
const codiceCliente = (client.CodiceCliente ?? client.codiceCliente ?? '').toString().trim();
const suffix = (codiceCliente.split('_')[1] || '').trim(); // parte dopo "_"
const shortCode = suffix || '--';

View File

@ -96,12 +96,66 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
#schemaFieldsTable th:first-child,
#schemaFieldsTable td:first-child,
/* Force predictable column sizing */
/* Stable sizing */
#schemaFieldsTable {
width: 100%;
table-layout: fixed;
}
/* Checkbox columns = minimal */
#schemaFieldsTable th:nth-child(1),
#schemaFieldsTable td:nth-child(1),
#schemaFieldsTable th:nth-child(2),
#schemaFieldsTable td:nth-child(2) {
width: 100px;
#schemaFieldsTable td:nth-child(2),
#schemaFieldsTable th:nth-child(3),
#schemaFieldsTable td:nth-child(3) {
width: 48px;
/* 🔥 più stretto */
text-align: center;
padding: 2px 4px;
/* 🔥 meno padding */
white-space: nowrap;
}
/* Make checkbox itself not oversized */
#schemaFieldsTable td:nth-child(1) input[type="checkbox"],
#schemaFieldsTable td:nth-child(2) input[type="checkbox"],
#schemaFieldsTable td:nth-child(3) input[type="checkbox"] {
transform: scale(0.95);
margin: 0;
}
/* Title */
#schemaFieldsTable th:nth-child(4),
#schemaFieldsTable td:nth-child(4) {
width: 300px;
}
/* Type */
#schemaFieldsTable th:nth-child(5),
#schemaFieldsTable td:nth-child(5) {
width: 120px;
white-space: nowrap;
}
/* Mapping = wide but NOT insane */
#schemaFieldsTable th:nth-child(6),
#schemaFieldsTable td:nth-child(6) {
width: 380px;
}
/* Default Value = wider */
#schemaFieldsTable th:nth-child(7),
#schemaFieldsTable td:nth-child(7) {
width: 320px;
}
/* selects fill the cell */
#schemaFieldsTable td:nth-child(6) .form-select,
#schemaFieldsTable td:nth-child(7) .form-control,
#schemaFieldsTable td:nth-child(7) .form-select {
width: 100% !important;
}
/* fix bootstrap/select2 width */
@ -165,11 +219,11 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
<table id="schemaFieldsTable" class="table table-striped">
<thead>
<tr>
<th style="width:90px; text-align:center;">Main</th>
<th style="width:110px; text-align:center;">Import</th>
<th style="width:110px; text-align:center;">Parts</th>
<th style="width:45px; text-align:center;">Main</th>
<th style="width:45px; text-align:center;">Import</th>
<th style="width:45px; text-align:center;">Parts</th>
<th style="width:320px;">Title</th>
<th style="width:140px;">Type</th>
<th style="width:120px;">Type</th>
<th>Mapping</th>
<th>Default Value</th>
</tr>