From b9350943f5b2424c6fb1d50a3373f00da1cd563a Mon Sep 17 00:00:00 2001 From: Shawn Date: Tue, 28 Jul 2026 21:25:02 -0400 Subject: [PATCH] Fix work order detail modal: hide redundant Cancel button on info-only modals (showCancel param) --- static/index.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/static/index.html b/static/index.html index b2394c7..61c6c93 100644 --- a/static/index.html +++ b/static/index.html @@ -2487,7 +2487,7 @@ // MODAL // ========================================================================= let modalResolve = null; - function showModal(title, body, confirmText = 'Confirm', confirmClass = 'btn-danger') { + function showModal(title, body, confirmText = 'Confirm', confirmClass = 'btn-danger', showCancel = true) { document.getElementById('modalTitle').textContent = title; const bodyEl = document.getElementById('modalBody'); bodyEl.innerHTML = ''; @@ -2499,6 +2499,8 @@ const btn = document.getElementById('modalConfirmBtn'); btn.textContent = confirmText; btn.className = 'btn btn-sm ' + confirmClass; + const cancelBtn = document.querySelector('#modalOverlay .btn-outline'); + if (cancelBtn) cancelBtn.style.display = showCancel ? '' : 'none'; document.getElementById('modalOverlay').classList.add('open'); return new Promise(resolve => { modalResolve = resolve; @@ -2506,6 +2508,9 @@ } function closeModal(confirmed = false) { document.getElementById('modalOverlay').classList.remove('open'); + // Show cancel button again for next use + const cancelBtn = document.querySelector('#modalOverlay .btn-outline'); + if (cancelBtn) cancelBtn.style.display = ''; if (modalResolve) { modalResolve(confirmed); modalResolve = null; @@ -4880,7 +4885,8 @@ 'Work Order Details', '
Loading...
', 'Close', - null + 'btn-outline', + false ); // Fetch single WO detail using the lookup endpoint api('/api/workorders/lookup', { @@ -5559,7 +5565,7 @@ ${wo.notes ? `
${esc(wo.notes)}
` : ''} `; }).join(''); - showModal(`Work Orders — ${msfs.work_order_count} total`, items, 'Close', 'btn-outline'); + showModal(`Work Orders — ${msfs.work_order_count} total`, items, 'Close', 'btn-outline', false); } // ── GPS Map Editor ──────────────────────────────────────────────────