From 672c32cfb6b662d09670e3b8de71cb548efcd095 Mon Sep 17 00:00:00 2001 From: Konrad du Plessis Date: Thu, 23 Apr 2026 19:57:00 +0200 Subject: [PATCH] =?UTF-8?q?ux(adjustments):=20drop=20the=20per-row=20Delet?= =?UTF-8?q?e=20button=20=E2=80=94=20Edit=20modal=20handles=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Konrad's feedback: the red × Delete button on each unpaid row was redundant — the Edit Adjustment modal already has a Delete action inside it, so users never need a second entry point. Removed: the .adj-delete-btn button from _adjustment_row.html and its now-dead DOMContentLoaded handler in payroll_dashboard.html (~15 lines of JS). Unpaid rows now show Preview + Edit only. Bulk-delete is unaffected: the floating action bar + per-row checkboxes remain as the fast path for deleting many rows at once. Single-row delete flows through the Edit modal's existing delete button. 65/65 tests still pass. --- core/templates/core/_adjustment_row.html | 13 +++---------- core/templates/core/payroll_dashboard.html | 19 ------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/core/templates/core/_adjustment_row.html b/core/templates/core/_adjustment_row.html index e23e13a..0703a91 100644 --- a/core/templates/core/_adjustment_row.html +++ b/core/templates/core/_adjustment_row.html @@ -103,8 +103,9 @@ Row actions differ by paid status: {% else %} - {# UNPAID row: Preview (reuses .preview-payslip-btn handler), #} - {# Edit (reuses .adjustment-badge handler), Delete (opens #deleteConfirmModal). #} + {# UNPAID row: Preview + Edit only. Single-row delete happens #} + {# inside the Edit Adjustment modal; bulk delete uses the row #} + {# checkboxes + floating action bar (shared entry point). #} - {% endif %} diff --git a/core/templates/core/payroll_dashboard.html b/core/templates/core/payroll_dashboard.html index e02efb8..552c7bf 100644 --- a/core/templates/core/payroll_dashboard.html +++ b/core/templates/core/payroll_dashboard.html @@ -3832,25 +3832,6 @@ document.addEventListener('DOMContentLoaded', function() { }); } - // --- Direct delete buttons on each unpaid row --- - // Short-circuits the edit modal's usual 2-step delete flow by opening - // #deleteConfirmModal directly with the correct form action + labels. - document.querySelectorAll('.adj-delete-btn').forEach(function(btn) { - btn.addEventListener('click', function() { - var adjId = this.dataset.adjId; - var adjType = this.dataset.adjType; - var adjWorker = this.dataset.adjWorker; - var deleteForm = document.getElementById('deleteAdjForm'); - if (!deleteForm) return; // Safety: modal not loaded - deleteForm.action = '/payroll/adjustment/' + adjId + '/delete/'; - document.getElementById('deleteAdjType').textContent = adjType; - document.getElementById('deleteAdjWorker').textContent = adjWorker; - bootstrap.Modal.getOrCreateInstance( - document.getElementById('deleteConfirmModal') - ).show(); - }); - }); - // === ADJUSTMENTS TAB — bulk select + delete === // The per-row checkboxes come from _adjustment_row.html (class // .adj-bulk-checkbox on unpaid rows only; disabled dummy checkbox on