historical added commessaweb., edit added tested components
This commit is contained in:
@@ -397,6 +397,13 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
#exportResponseModal .modal-backdrop {
|
||||
z-index: 1299 !important;
|
||||
}
|
||||
|
||||
.add-part-btn {
|
||||
padding: 2px 5px;
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
</style>
|
||||
<title>Edit Imported Data - <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?></title>
|
||||
</head>
|
||||
@@ -504,6 +511,8 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$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 250px;'></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++;
|
||||
}
|
||||
}
|
||||
// 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>";
|
||||
$headerIndex++;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
// 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;">
|
||||
<select name="rows[<?= $index ?>][carrier]" class="carrier-select">
|
||||
@@ -1081,6 +1099,52 @@ foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
populateDropdowns();
|
||||
});
|
||||
</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 -->
|
||||
<div class="modal fade" id="exportConfirmModal" tabindex="-1" aria-labelledby="exportConfirmModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
|
||||
Reference in New Issue
Block a user