Bericht löschen: Button + Dialog in Report-Detail, api.deleteReport() [deploy]
All checks were successful
Deploy baustelle-pwa / deploy (push) Successful in 1s
All checks were successful
Deploy baustelle-pwa / deploy (push) Successful in 1s
- Lösch-Button (rot) unter Report-Detail - Eigener Bestätigungs-Dialog (kein browser-confirm()) - api.deleteReport(id) → DELETE /reports.php?id=X - CSS: .btn-danger Klasse Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3dad52367c
commit
645624eeb6
3 changed files with 44 additions and 1 deletions
6
app.css
6
app.css
|
|
@ -116,6 +116,12 @@ body {
|
||||||
color: #f0f0f0;
|
color: #f0f0f0;
|
||||||
}
|
}
|
||||||
.btn-large { padding: 22px; font-size: 18px; }
|
.btn-large { padding: 22px; font-size: 18px; }
|
||||||
|
.btn-danger {
|
||||||
|
background: #d9534f;
|
||||||
|
color: #fff;
|
||||||
|
margin-top: 24px;
|
||||||
|
}
|
||||||
|
.btn-danger:active { background: #c9302c; }
|
||||||
|
|
||||||
.hidden-input { display: none; }
|
.hidden-input { display: none; }
|
||||||
|
|
||||||
|
|
|
||||||
33
app.js
33
app.js
|
|
@ -744,6 +744,7 @@ router.on('/reports/:id', async (args) => {
|
||||||
${hasPages ? '<button class="btn btn-secondary" id="btn-view-pdf">👁 PDF-Vorschau</button>' : ''}
|
${hasPages ? '<button class="btn btn-secondary" id="btn-view-pdf">👁 PDF-Vorschau</button>' : ''}
|
||||||
<button class="btn btn-secondary" id="btn-signature">✍️ Kunden-Unterschrift hinzufügen</button>
|
<button class="btn btn-secondary" id="btn-signature">✍️ Kunden-Unterschrift hinzufügen</button>
|
||||||
<button class="btn btn-secondary" id="btn-open-editor">✏️ Im Desktop-Editor öffnen</button>
|
<button class="btn btn-secondary" id="btn-open-editor">✏️ Im Desktop-Editor öffnen</button>
|
||||||
|
<button class="btn btn-danger" id="btn-delete-report">Bericht löschen</button>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
loadThumbs();
|
loadThumbs();
|
||||||
|
|
@ -783,6 +784,38 @@ router.on('/reports/:id', async (args) => {
|
||||||
document.getElementById('btn-open-editor').onclick = () => {
|
document.getElementById('btn-open-editor').onclick = () => {
|
||||||
window.open(window.location.origin + '/custom/bericht/bericht_card.php?berichtid=' + args.id, '_blank');
|
window.open(window.location.origin + '/custom/bericht/bericht_card.php?berichtid=' + args.id, '_blank');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
document.getElementById('btn-delete-report').onclick = () => {
|
||||||
|
const modal = document.createElement('div');
|
||||||
|
modal.className = 'fullscreen-modal';
|
||||||
|
modal.innerHTML = `
|
||||||
|
<div class="modal-header">
|
||||||
|
<h2>Bericht löschen</h2>
|
||||||
|
<button class="close-btn" id="dr-cancel">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" style="padding:20px;text-align:center;">
|
||||||
|
<p style="font-size:16px;margin:16px 0;">Bericht <strong>${escapeHtml(data.report.ref)}</strong> mit ${data.pages.length} Seite${data.pages.length === 1 ? '' : 'n'} wirklich löschen?</p>
|
||||||
|
<p style="opacity:0.6;font-size:13px;">Alle Seiten und Annotationen werden unwiderruflich entfernt.</p>
|
||||||
|
<div style="display:flex;gap:12px;justify-content:center;margin-top:24px;">
|
||||||
|
<button class="btn btn-secondary" id="dr-no">Abbrechen</button>
|
||||||
|
<button class="btn btn-danger" id="dr-yes">Endgültig löschen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(modal);
|
||||||
|
modal.querySelector('#dr-cancel').onclick = () => modal.remove();
|
||||||
|
modal.querySelector('#dr-no').onclick = () => modal.remove();
|
||||||
|
modal.querySelector('#dr-yes').onclick = async () => {
|
||||||
|
try {
|
||||||
|
await api.deleteReport(args.id);
|
||||||
|
modal.remove();
|
||||||
|
showToast('Bericht gelöscht');
|
||||||
|
router.go('#/reports');
|
||||||
|
} catch (e) {
|
||||||
|
showToast('Fehler: ' + e.message, 'error');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
main().innerHTML = '<div class="empty-state"><div class="icon">⚠️</div>' + e.message + '</div>';
|
main().innerHTML = '<div class="empty-state"><div class="icon">⚠️</div>' + e.message + '</div>';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,10 @@
|
||||||
return request('/reports.php?id=' + id + '&action=finalize', { method: 'POST' });
|
return request('/reports.php?id=' + id + '&action=finalize', { method: 'POST' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function deleteReport(id) {
|
||||||
|
return request('/reports.php?id=' + id, { method: 'DELETE' });
|
||||||
|
}
|
||||||
|
|
||||||
async function deletePhoto(relpath) {
|
async function deletePhoto(relpath) {
|
||||||
return request('/delete_photo.php', {
|
return request('/delete_photo.php', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
@ -243,7 +247,7 @@
|
||||||
login, logout,
|
login, logout,
|
||||||
listOrders, getOrder, listOrderPhotos, uploadOrderPhoto,
|
listOrders, getOrder, listOrderPhotos, uploadOrderPhoto,
|
||||||
listCustomers, getCustomer,
|
listCustomers, getCustomer,
|
||||||
getReport, listReports, createReport, listTemplates, listOdtTemplates, finalizeReport,
|
getReport, listReports, createReport, listTemplates, listOdtTemplates, finalizeReport, deleteReport,
|
||||||
deletePhoto, uploadVoiceNote, transcribeAudio, uploadAnnotatedPhoto,
|
deletePhoto, uploadVoiceNote, transcribeAudio, uploadAnnotatedPhoto,
|
||||||
listMaterials, addMaterial, deleteMaterial,
|
listMaterials, addMaterial, deleteMaterial,
|
||||||
getPhotoBlobUrl, clearPhotoCache,
|
getPhotoBlobUrl, clearPhotoCache,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue