fixed tested components
This commit is contained in:
parent
9c850e4ea6
commit
f4e0074a73
File diff suppressed because one or more lines are too long
@ -364,8 +364,15 @@ function fixedDefaultValue(array $f): string
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes batch-pulse {
|
@keyframes batch-pulse {
|
||||||
0%, 100% { background-position: 0% 50%; }
|
|
||||||
50% { background-position: 100% 50%; }
|
0%,
|
||||||
|
100% {
|
||||||
|
background-position: 0% 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
background-position: 100% 50%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.batch-row-spinner {
|
.batch-row-spinner {
|
||||||
@ -1191,7 +1198,7 @@ function fixedDefaultValue(array $f): string
|
|||||||
<!-- commented only for admin roles -->
|
<!-- commented only for admin roles -->
|
||||||
<?php if ((Auth::user()->hasRole('Admin'))) : ?>
|
<?php if ((Auth::user()->hasRole('Admin'))) : ?>
|
||||||
<?php $isExported = (($row['status'] ?? '') === 'l'); ?>
|
<?php $isExported = (($row['status'] ?? '') === 'l'); ?>
|
||||||
<button type="button" class="export-lims-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" title="<?= $isExported ? 'Già esportato' : 'Export to LIMS' ?>" style="background: <?= $isExported ? '#ccc' : '#eb0b0b' ?>; color: white; border: none; border-radius: 5px; cursor: <?= $isExported ? 'not-allowed' : 'pointer' ?>; <?= $isExported ? 'opacity: 0.5;' : '' ?>"<?= $isExported ? ' disabled' : '' ?>><i class="fas fa-upload"></i></button>
|
<button type="button" class="export-lims-btn action-btn" data-row="<?= $index ?>" data-iddatadb="<?= $row['iddatadb'] ?>" title="<?= $isExported ? 'Già esportato' : 'Export to LIMS' ?>" style="background: <?= $isExported ? '#ccc' : '#eb0b0b' ?>; color: white; border: none; border-radius: 5px; cursor: <?= $isExported ? 'not-allowed' : 'pointer' ?>; <?= $isExported ? 'opacity: 0.5;' : '' ?>" <?= $isExported ? ' disabled' : '' ?>><i class="fas fa-upload"></i></button>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<button type="button" class="save-btn action-btn" data-row="<?= $index ?>" title="Save" style="background: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;"><i class="fas fa-save"></i></button>
|
<button type="button" class="save-btn action-btn" data-row="<?= $index ?>" title="Save" style="background: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer;"><i class="fas fa-save"></i></button>
|
||||||
@ -1639,7 +1646,9 @@ function fixedDefaultValue(array $f): string
|
|||||||
document.querySelector('.save-all-btn').addEventListener('click', (e) => {
|
document.querySelector('.save-all-btn').addEventListener('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (saveAllRunning || window.batchRunning) return;
|
if (saveAllRunning || window.batchRunning) return;
|
||||||
const confirmModal = new bootstrap.Modal(document.getElementById('saveAllConfirmModal'), { keyboard: false });
|
const confirmModal = new bootstrap.Modal(document.getElementById('saveAllConfirmModal'), {
|
||||||
|
keyboard: false
|
||||||
|
});
|
||||||
confirmModal.show();
|
confirmModal.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1657,7 +1666,11 @@ function fixedDefaultValue(array $f): string
|
|||||||
// Disable all row buttons
|
// Disable all row buttons
|
||||||
document.querySelectorAll('.grid-row[data-id]').forEach(r => r.classList.add('batch-disabled'));
|
document.querySelectorAll('.grid-row[data-id]').forEach(r => r.classList.add('batch-disabled'));
|
||||||
const toggle = document.querySelector('.actions-dropdown .dropdown-toggle');
|
const toggle = document.querySelector('.actions-dropdown .dropdown-toggle');
|
||||||
if (toggle) { toggle.disabled = true; toggle.style.opacity = '0.5'; toggle.style.pointerEvents = 'none'; }
|
if (toggle) {
|
||||||
|
toggle.disabled = true;
|
||||||
|
toggle.style.opacity = '0.5';
|
||||||
|
toggle.style.pointerEvents = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
// Show status bar
|
// Show status bar
|
||||||
const bar = document.getElementById('batchExportBar');
|
const bar = document.getElementById('batchExportBar');
|
||||||
@ -1674,10 +1687,14 @@ function fixedDefaultValue(array $f): string
|
|||||||
|
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
const saveBtn = row.querySelector('.save-btn');
|
const saveBtn = row.querySelector('.save-btn');
|
||||||
if (!saveBtn) { continue; }
|
if (!saveBtn) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const rowIndex = saveBtn.dataset.row;
|
const rowIndex = saveBtn.dataset.row;
|
||||||
const iddatadb = row.getAttribute('data-id');
|
const iddatadb = row.getAttribute('data-id');
|
||||||
if (!rowIndex || !iddatadb) { continue; }
|
if (!rowIndex || !iddatadb) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
processed++;
|
processed++;
|
||||||
statusEl.textContent = `Salvataggio ${processed} / ${total} (id: ${iddatadb})...`;
|
statusEl.textContent = `Salvataggio ${processed} / ${total} (id: ${iddatadb})...`;
|
||||||
@ -1687,7 +1704,10 @@ function fixedDefaultValue(array $f): string
|
|||||||
row.classList.add('batch-exporting');
|
row.classList.add('batch-exporting');
|
||||||
const btnCell = row.querySelector('.button-cell');
|
const btnCell = row.querySelector('.button-cell');
|
||||||
if (btnCell) {
|
if (btnCell) {
|
||||||
btnCell.querySelectorAll('.action-btn').forEach(b => { b.dataset.prevDisplay = b.style.display; b.style.display = 'none'; });
|
btnCell.querySelectorAll('.action-btn').forEach(b => {
|
||||||
|
b.dataset.prevDisplay = b.style.display;
|
||||||
|
b.style.display = 'none';
|
||||||
|
});
|
||||||
const spinner = document.createElement('span');
|
const spinner = document.createElement('span');
|
||||||
spinner.className = 'batch-row-spinner';
|
spinner.className = 'batch-row-spinner';
|
||||||
spinner.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Saving...';
|
spinner.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Saving...';
|
||||||
@ -1785,7 +1805,10 @@ function fixedDefaultValue(array $f): string
|
|||||||
if (btnCell) {
|
if (btnCell) {
|
||||||
const sp = btnCell.querySelector('.batch-row-spinner');
|
const sp = btnCell.querySelector('.batch-row-spinner');
|
||||||
if (sp) sp.remove();
|
if (sp) sp.remove();
|
||||||
btnCell.querySelectorAll('.action-btn').forEach(b => { b.style.display = b.dataset.prevDisplay || ''; delete b.dataset.prevDisplay; });
|
btnCell.querySelectorAll('.action-btn').forEach(b => {
|
||||||
|
b.style.display = b.dataset.prevDisplay || '';
|
||||||
|
delete b.dataset.prevDisplay;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1798,7 +1821,11 @@ function fixedDefaultValue(array $f): string
|
|||||||
|
|
||||||
// Re-enable all row buttons
|
// Re-enable all row buttons
|
||||||
document.querySelectorAll('.grid-row[data-id]').forEach(r => r.classList.remove('batch-disabled'));
|
document.querySelectorAll('.grid-row[data-id]').forEach(r => r.classList.remove('batch-disabled'));
|
||||||
if (toggle) { toggle.disabled = false; toggle.style.opacity = ''; toggle.style.pointerEvents = ''; }
|
if (toggle) {
|
||||||
|
toggle.disabled = false;
|
||||||
|
toggle.style.opacity = '';
|
||||||
|
toggle.style.pointerEvents = '';
|
||||||
|
}
|
||||||
|
|
||||||
const resultEl = document.getElementById('saveAllResultMessage');
|
const resultEl = document.getElementById('saveAllResultMessage');
|
||||||
const resultLabel = document.getElementById('saveAllResultModalLabel');
|
const resultLabel = document.getElementById('saveAllResultModalLabel');
|
||||||
@ -1809,7 +1836,9 @@ function fixedDefaultValue(array $f): string
|
|||||||
resultLabel.textContent = 'Salvataggio con Errori';
|
resultLabel.textContent = 'Salvataggio con Errori';
|
||||||
resultEl.innerHTML = `<i class="fas fa-exclamation-triangle" style="color:#ffc107;"></i> Salvate <strong>${successCount}</strong> righe con successo.<br><br><strong>Errori:</strong><br>` + errorMessages.join('<br>');
|
resultEl.innerHTML = `<i class="fas fa-exclamation-triangle" style="color:#ffc107;"></i> Salvate <strong>${successCount}</strong> righe con successo.<br><br><strong>Errori:</strong><br>` + errorMessages.join('<br>');
|
||||||
}
|
}
|
||||||
new bootstrap.Modal(document.getElementById('saveAllResultModal'), { keyboard: false }).show();
|
new bootstrap.Modal(document.getElementById('saveAllResultModal'), {
|
||||||
|
keyboard: false
|
||||||
|
}).show();
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener("beforeunload", function(e) {
|
window.addEventListener("beforeunload", function(e) {
|
||||||
@ -2473,7 +2502,9 @@ function fixedDefaultValue(array $f): string
|
|||||||
$('.searchable-client').on('select2:select select2:clear', function(e) {
|
$('.searchable-client').on('select2:select select2:clear', function(e) {
|
||||||
// Trigger native change on the real <select> element so
|
// Trigger native change on the real <select> element so
|
||||||
// addEventListener('change') handlers can detect modifications.
|
// addEventListener('change') handlers can detect modifications.
|
||||||
const nativeEvent = new Event('change', { bubbles: true });
|
const nativeEvent = new Event('change', {
|
||||||
|
bubbles: true
|
||||||
|
});
|
||||||
this.dispatchEvent(nativeEvent);
|
this.dispatchEvent(nativeEvent);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2485,7 +2516,9 @@ function fixedDefaultValue(array $f): string
|
|||||||
const clientSelect = row.querySelector('select[name$="[idclient]"]');
|
const clientSelect = row.querySelector('select[name$="[idclient]"]');
|
||||||
if (clientSelect) {
|
if (clientSelect) {
|
||||||
$(clientSelect).val(value).trigger('change.select2');
|
$(clientSelect).val(value).trigger('change.select2');
|
||||||
const event = new Event('change', { bubbles: true });
|
const event = new Event('change', {
|
||||||
|
bubbles: true
|
||||||
|
});
|
||||||
clientSelect.dispatchEvent(event);
|
clientSelect.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -2499,7 +2532,9 @@ function fixedDefaultValue(array $f): string
|
|||||||
const fornitoreSelect = row.querySelector('select[name$="[cliente_fornitore_id]"]');
|
const fornitoreSelect = row.querySelector('select[name$="[cliente_fornitore_id]"]');
|
||||||
if (fornitoreSelect) {
|
if (fornitoreSelect) {
|
||||||
$(fornitoreSelect).val(value).trigger('change.select2');
|
$(fornitoreSelect).val(value).trigger('change.select2');
|
||||||
const event = new Event('change', { bubbles: true });
|
const event = new Event('change', {
|
||||||
|
bubbles: true
|
||||||
|
});
|
||||||
fornitoreSelect.dispatchEvent(event);
|
fornitoreSelect.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -2523,10 +2558,7 @@ function fixedDefaultValue(array $f): string
|
|||||||
.map(s => s.trim())
|
.map(s => s.trim())
|
||||||
.filter(s => s.length > 0);
|
.filter(s => s.length > 0);
|
||||||
|
|
||||||
// (opzionale) dedup per evitare doppioni tipo "Cap | Cap"
|
if (!parts.length) {
|
||||||
const uniqueParts = [...new Set(parts)];
|
|
||||||
|
|
||||||
if (!uniqueParts.length) {
|
|
||||||
alert('⚠️ Inserisci prima una descrizione nel campo Tested Component.');
|
alert('⚠️ Inserisci prima una descrizione nel campo Tested Component.');
|
||||||
$input.focus();
|
$input.focus();
|
||||||
return;
|
return;
|
||||||
@ -2537,7 +2569,7 @@ function fixedDefaultValue(array $f): string
|
|||||||
const errors = [];
|
const errors = [];
|
||||||
|
|
||||||
// ✅ esegue una chiamata per ogni parte (compatibile con l’attuale add_part_quick.php)
|
// ✅ esegue una chiamata per ogni parte (compatibile con l’attuale add_part_quick.php)
|
||||||
for (const p of uniqueParts) {
|
for (const p of parts) {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('iddatadb', iddatadb);
|
formData.append('iddatadb', iddatadb);
|
||||||
formData.append('part_description', p);
|
formData.append('part_description', p);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user