historical added commessaweb., edit added tested components
This commit is contained in:
parent
7397d86bc2
commit
f8320315f7
File diff suppressed because one or more lines are too long
@ -662,6 +662,11 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
} else {
|
} else {
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
||||||
}
|
}
|
||||||
|
// Status (subito dopo main_field)
|
||||||
|
$fixedColumnsReduced = ['status'];
|
||||||
|
foreach ($fixedColumnsReduced as $col) {
|
||||||
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
||||||
|
}
|
||||||
// Campi automatici (escluso main_field)
|
// Campi automatici (escluso main_field)
|
||||||
$autoIndex = ($mainFieldMapping && !$mainFieldMapping['is_manual']) ? 1 : 0;
|
$autoIndex = ($mainFieldMapping && !$mainFieldMapping['is_manual']) ? 1 : 0;
|
||||||
foreach ($allMappings as $mapping) {
|
foreach ($allMappings as $mapping) {
|
||||||
@ -712,11 +717,7 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
$manualIndex++;
|
$manualIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Colonne status, Import Reference Code, filename_import
|
// Colonne Import Reference Code, filename_import
|
||||||
$fixedColumnsReduced = ['status'];
|
|
||||||
foreach ($fixedColumnsReduced as $col) {
|
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
|
||||||
}
|
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>"; // Import Reference Code
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>"; // Import Reference Code
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>"; // filename_import
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>"; // filename_import
|
||||||
// AWB Number e Tracking Info
|
// AWB Number e Tracking Info
|
||||||
@ -734,6 +735,12 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>" . htmlspecialchars($mainFieldMapping['field_label']) . "<div class='resizer'></div></div>";
|
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>" . htmlspecialchars($mainFieldMapping['field_label']) . "<div class='resizer'></div></div>";
|
||||||
$headerIndex++;
|
$headerIndex++;
|
||||||
}
|
}
|
||||||
|
// Header per status (subito dopo main_field)
|
||||||
|
foreach ($fixedColumnsReduced as $col) {
|
||||||
|
$displayName = $slugMapping[$col] ?? $col;
|
||||||
|
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>$displayName<div class='resizer'></div></div>";
|
||||||
|
$headerIndex++;
|
||||||
|
}
|
||||||
// Header per campi automatici (escluso main_field)
|
// Header per campi automatici (escluso main_field)
|
||||||
foreach ($allMappings as $mapping) {
|
foreach ($allMappings as $mapping) {
|
||||||
if (!$mapping['is_manual'] && $mapping['main_field'] != 1) {
|
if (!$mapping['is_manual'] && $mapping['main_field'] != 1) {
|
||||||
@ -748,12 +755,7 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
$headerIndex++;
|
$headerIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Header per status, Import Reference Code, filename_import
|
// Header per Import Reference Code, filename_import
|
||||||
foreach ($fixedColumnsReduced as $col) {
|
|
||||||
$displayName = $slugMapping[$col] ?? $col;
|
|
||||||
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>$displayName<div class='resizer'></div></div>";
|
|
||||||
$headerIndex++;
|
|
||||||
}
|
|
||||||
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>Import Reference Code<div class='resizer'></div></div>";
|
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>Import Reference Code<div class='resizer'></div></div>";
|
||||||
$headerIndex++;
|
$headerIndex++;
|
||||||
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>File<div class='resizer'></div></div>";
|
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>File<div class='resizer'></div></div>";
|
||||||
@ -770,13 +772,11 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
<div style="display: flex; gap: 5px; justify-content: center;">
|
<div style="display: flex; gap: 5px; justify-content: center;">
|
||||||
<?php if (!$is_readonly): ?>
|
<?php if (!$is_readonly): ?>
|
||||||
<button type="button" class="save-btn action-btn" data-row="<?= $index ?>" style="background: #28a745; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; flex: 1;"><i class="fas fa-save"></i></button>
|
<button type="button" class="save-btn action-btn" data-row="<?= $index ?>" style="background: #28a745; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; flex: 1;"><i class="fas fa-save"></i></button>
|
||||||
<button type="button" class="photos-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" style="background: #007bff; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; flex: 1;"><i class="fas fa-camera"></i></button>
|
|
||||||
<button type="button" class="parts-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" style="background: #ffc107; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; flex: 1;"><i class="fas fa-puzzle-piece"></i></button>
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<button type="button" class="save-btn action-btn" data-row="<?= $index ?>" style="background: #ccc; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: not-allowed; flex: 1;" disabled><i class="fas fa-save"></i></button>
|
<button type="button" class="save-btn action-btn" data-row="<?= $index ?>" style="background: #ccc; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: not-allowed; flex: 1;" disabled><i class="fas fa-save"></i></button>
|
||||||
<button type="button" class="photos-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" style="background: #ccc; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: not-allowed; flex: 1;" disabled><i class="fas fa-camera"></i></button>
|
|
||||||
<button type="button" class="parts-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" style="background: #ccc; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: not-allowed; flex: 1;" disabled><i class="fas fa-puzzle-piece"></i></button>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<button type="button" class="photos-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" style="background: #007bff; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; flex: 1;"><i class="fas fa-camera"></i></button>
|
||||||
|
<button type="button" class="parts-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" style="background: #ffc107; color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; flex: 1;"><i class="fas fa-puzzle-piece"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
@ -806,6 +806,25 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
echo "</div>";
|
echo "</div>";
|
||||||
$cellIndex++;
|
$cellIndex++;
|
||||||
}
|
}
|
||||||
|
// Status (subito dopo main_field)
|
||||||
|
$fixedColumnsReduced = ['status'];
|
||||||
|
foreach ($fixedColumnsReduced as $col) {
|
||||||
|
$value = $row[$col] ?? '';
|
||||||
|
echo "<div class='grid-cell editable-cell' data-col='$col' data-row='$index' data-index='$cellIndex' style='flex: 0 0 150px;'>";
|
||||||
|
if ($col === 'status') {
|
||||||
|
$badgeClass = $value === 'i' ? 'status-i' : ($value === 'P' ? 'status-P' : 'status-l');
|
||||||
|
$badgeText = $value === 'i' ? 'Imported' : ($value === 'P' ? 'Progress' : 'LIMS');
|
||||||
|
// Aggiungi il numero di commessaweb se lo status è 'l'
|
||||||
|
if ($value === 'l') {
|
||||||
|
$commessaWeb = isset($row['commessaweb']) ? htmlspecialchars($row['commessaweb']) : '';
|
||||||
|
$badgeText .= " ($commessaWeb)";
|
||||||
|
}
|
||||||
|
echo "<span class='status-badge $badgeClass'>" . htmlspecialchars($badgeText) . "</span>";
|
||||||
|
echo "<input type='hidden' name='rows[$index][$col]' value='" . htmlspecialchars($value ?? 'i') . "'>";
|
||||||
|
}
|
||||||
|
echo "</div>";
|
||||||
|
$cellIndex++;
|
||||||
|
}
|
||||||
// Campi automatici (escluso main_field)
|
// Campi automatici (escluso main_field)
|
||||||
$autoIndex = ($mainFieldMapping && !$mainFieldMapping['is_manual']) ? 1 : 0;
|
$autoIndex = ($mainFieldMapping && !$mainFieldMapping['is_manual']) ? 1 : 0;
|
||||||
foreach ($allMappings as $mapping) {
|
foreach ($allMappings as $mapping) {
|
||||||
@ -863,20 +882,6 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
$manualIndex++;
|
$manualIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Colonna status
|
|
||||||
$fixedColumnsReduced = ['status'];
|
|
||||||
foreach ($fixedColumnsReduced as $col) {
|
|
||||||
$value = $row[$col] ?? '';
|
|
||||||
echo "<div class='grid-cell editable-cell' data-col='$col' data-row='$index' data-index='$cellIndex' style='flex: 0 0 150px;'>";
|
|
||||||
if ($col === 'status') {
|
|
||||||
$badgeClass = $value === 'i' ? 'status-i' : ($value === 'P' ? 'status-P' : 'status-l');
|
|
||||||
$badgeText = $value === 'i' ? 'Imported' : ($value === 'P' ? 'Progress' : 'LIMS');
|
|
||||||
echo "<span class='status-badge $badgeClass'>" . htmlspecialchars($badgeText) . "</span>";
|
|
||||||
echo "<input type='hidden' name='rows[$index][$col]' value='" . htmlspecialchars($value ?? 'i') . "'>";
|
|
||||||
}
|
|
||||||
echo "</div>";
|
|
||||||
$cellIndex++;
|
|
||||||
}
|
|
||||||
// Colonne Import Reference Code e filename_import
|
// Colonne Import Reference Code e filename_import
|
||||||
echo "<div class='grid-cell' data-col='importreferencecode' data-row='$index' data-index='$cellIndex' style='flex: 0 0 150px;'>";
|
echo "<div class='grid-cell' data-col='importreferencecode' data-row='$index' data-index='$cellIndex' style='flex: 0 0 150px;'>";
|
||||||
echo "<span>" . htmlspecialchars($row['importreferencecode']) . "</span>";
|
echo "<span>" . htmlspecialchars($row['importreferencecode']) . "</span>";
|
||||||
|
|||||||
@ -397,6 +397,13 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
#exportResponseModal .modal-backdrop {
|
#exportResponseModal .modal-backdrop {
|
||||||
z-index: 1299 !important;
|
z-index: 1299 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.add-part-btn {
|
||||||
|
padding: 2px 5px;
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 1;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
</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>
|
||||||
@ -504,6 +511,8 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
$manualIndex++;
|
$manualIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Aggiunta per Tested Component (senza propagate)
|
||||||
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 200px;'></div>";
|
echo "<div class='grid-cell' style='flex: 0 0 200px;'></div>";
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 250px;'></div>";
|
echo "<div class='grid-cell' style='flex: 0 0 250px;'></div>";
|
||||||
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
echo "<div class='grid-cell' style='flex: 0 0 150px;'></div>";
|
||||||
@ -536,6 +545,9 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
$headerIndex++;
|
$headerIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Aggiunta header per Tested Component
|
||||||
|
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 150px; position: relative;'>Tested Component<div class='resizer'></div></div>";
|
||||||
|
$headerIndex++;
|
||||||
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 200px; position: relative;'>AWB Number<div class='resizer'></div></div>";
|
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 200px; position: relative;'>AWB Number<div class='resizer'></div></div>";
|
||||||
$headerIndex++;
|
$headerIndex++;
|
||||||
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 250px; position: relative;'>Tracking Info<div class='resizer'></div></div>";
|
echo "<div class='grid-header' data-index='$headerIndex' style='flex: 0 0 250px; position: relative;'>Tracking Info<div class='resizer'></div></div>";
|
||||||
@ -650,6 +662,12 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
$manualIndex++;
|
$manualIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Aggiunta cella per Tested Component
|
||||||
|
echo "<div class='grid-cell editable-cell' data-col='tested_component' data-row='$index' data-index='$cellIndex' style='flex: 0 0 150px; display: flex; align-items: center;'>";
|
||||||
|
echo "<input type='text' name='rows[$index][tested_component]' value='' class='cell-input manual-input' style='flex: 1; margin-right: 5px;'>";
|
||||||
|
echo "<button type='button' class='add-part-btn btn btn-sm btn-primary' data-row='$index'><i class='fas fa-plus'></i></button>";
|
||||||
|
echo "</div>";
|
||||||
|
$cellIndex++;
|
||||||
?>
|
?>
|
||||||
<div class="grid-cell" style="flex: 0 0 200px;">
|
<div class="grid-cell" style="flex: 0 0 200px;">
|
||||||
<select name="rows[<?= $index ?>][carrier]" class="carrier-select">
|
<select name="rows[<?= $index ?>][carrier]" class="carrier-select">
|
||||||
@ -1081,6 +1099,52 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
|||||||
populateDropdowns();
|
populateDropdowns();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
$(document).on('click', '.add-part-btn', function() {
|
||||||
|
const rowIndex = $(this).data('row');
|
||||||
|
const row = $(this).closest('.grid-row');
|
||||||
|
const iddatadb = row.data('id');
|
||||||
|
const input = row.find(`input[name="rows[${rowIndex}][tested_component]"]`);
|
||||||
|
const description = input.val().trim();
|
||||||
|
|
||||||
|
if (!description) {
|
||||||
|
alert('Inserisci un valore per Tested Component');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
iddatadb: iddatadb,
|
||||||
|
parts: [{
|
||||||
|
part_number: '1', // Imposta part_number a '1'
|
||||||
|
part_description: description,
|
||||||
|
mix: 'N'
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: 'save_parts.php',
|
||||||
|
method: 'POST',
|
||||||
|
contentType: 'application/json',
|
||||||
|
data: JSON.stringify(data),
|
||||||
|
success: function(response) {
|
||||||
|
if (response.success) {
|
||||||
|
alert('Parte aggiunta con successo!');
|
||||||
|
input.val(''); // Pulisci l'input dopo l'aggiunta
|
||||||
|
// Opzionale: aggiorna la tabella delle parti se il modal è aperto
|
||||||
|
const partsModal = $('#partsModal');
|
||||||
|
if (partsModal.hasClass('show')) {
|
||||||
|
loadParts(iddatadb);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert('Errore: ' + response.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
alert('Errore durante la richiesta AJAX');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<!-- Modale di conferma per l'esportazione -->
|
<!-- Modale di conferma per l'esportazione -->
|
||||||
<div class="modal fade" id="exportConfirmModal" tabindex="-1" aria-labelledby="exportConfirmModalLabel" aria-hidden="true">
|
<div class="modal fade" id="exportConfirmModal" tabindex="-1" aria-labelledby="exportConfirmModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user