ux(adjustments): drop the per-row Delete button — Edit modal handles it

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.
This commit is contained in:
Konrad du Plessis 2026-04-23 19:57:00 +02:00
parent 3fe3e5aa01
commit 672c32cfb6
2 changed files with 3 additions and 29 deletions

View File

@ -103,8 +103,9 @@ Row actions differ by paid status:
<i class="fas fa-eye"></i>
</button>
{% 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). #}
<button type="button"
class="btn btn-sm btn-outline-info preview-payslip-btn"
data-worker-id="{{ adj.worker.id }}"
@ -124,14 +125,6 @@ Row actions differ by paid status:
title="Edit" data-bs-toggle="tooltip">
<i class="fas fa-pen"></i>
</button>
<button type="button"
class="btn btn-sm btn-outline-danger adj-delete-btn"
data-adj-id="{{ adj.id }}"
data-adj-type="{{ adj.type }}"
data-adj-worker="{{ adj.worker.name }}"
title="Delete" data-bs-toggle="tooltip">
<i class="fas fa-times"></i>
</button>
{% endif %}
</td>
</tr>

View File

@ -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