fix(ui): use styled confirm dialog for salary and recurring-invoice destructive actions (#1036)

* fix(ui): use styled confirm dialog for salary and recurring-invoice destructive actions

Replace native window.confirm() with the existing DestructiveConfirmDialog
/ useDestructiveConfirm() primitive at the six sites from #839: recurring
invoice schedule delete, employee deactivation, salary run draft delete,
remove employee from run, salary calendar bulk delete (all variant
'destructive'), and the nollkorning-to-review guard (variant 'warning').
Confirmation copy is preserved as the dialog description; new title keys
added to both messages/sv.json and messages/en.json.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(ui): lock delete and deactivate actions while the request is in flight

The styled confirm dialog resolves before the DELETE settles, so the
trigger button could be clicked again and fire a duplicate request.
Add an in-flight guard (deletingId / deactivating) and disable the
button until the request completes, mirroring the runNow pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-07-16 18:14:34 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent a95872928e
commit f8611f2e89
6 changed files with 112 additions and 21 deletions
+5
View File
@@ -2931,6 +2931,7 @@
"schedule_deleted_title": "Schedule removed",
"schedule_delete_failed_title": "Could not remove schedule",
"delete_confirm": "Remove schedule \"{name}\"? Already created invoices are not affected.",
"delete_confirm_title": "Remove the schedule?",
"run_now": "Create invoice now",
"run_now_confirm": "Create an invoice for \"{name}\" now? If the schedule has automatic sending, it is emailed to the customer immediately. The next scheduled run is not affected.",
"run_now_success_title": "Invoice created",
@@ -4977,7 +4978,9 @@
"journal_th_debit": "Debit",
"journal_th_credit": "Credit",
"confirm_delete": "Delete the draft for {period}? All employees and calculations in the run are removed. This cannot be undone.",
"confirm_delete_title": "Delete draft?",
"confirm_remove_employee": "Remove {name} from the payroll run?",
"confirm_remove_employee_title": "Remove employee?",
"toast_status_updated": "Status updated",
"toast_status_failed": "Could not update status",
"toast_draft_deleted": "Draft deleted",
@@ -5116,6 +5119,7 @@
"error_load_worked": "Could not load worked hours",
"unknown_error": "Unknown error",
"confirm_bulk_delete": "Remove everything (worked time and absence) on {count, plural, one {# day} other {# days}}?",
"confirm_bulk_delete_title": "Remove selected days?",
"error_delete_worked_date": "Could not remove worked time on {date}",
"error_delete_absence_date": "Could not remove absence on {date}",
"prev_month": "Previous month",
@@ -5228,6 +5232,7 @@
"detail_updated": "Employee updated",
"detail_update_failed": "Could not update employee",
"detail_deactivate_confirm": "Do you want to deactivate this employee?",
"detail_deactivate_confirm_title": "Deactivate employee?",
"detail_deactivated": "Employee deactivated",
"detail_not_found": "Employee not found",
"detail_deactivate": "Deactivate",
+5
View File
@@ -2931,6 +2931,7 @@
"schedule_deleted_title": "Schema borttaget",
"schedule_delete_failed_title": "Kunde inte ta bort schema",
"delete_confirm": "Ta bort schemat \"{name}\"? Redan skapade fakturor påverkas inte.",
"delete_confirm_title": "Ta bort schemat?",
"run_now": "Skapa faktura nu",
"run_now_confirm": "Skapa en faktura för \"{name}\" nu? Om schemat har automatiskt utskick skickas den direkt till kunden. Nästa schemalagda körning påverkas inte.",
"run_now_success_title": "Faktura skapad",
@@ -4977,7 +4978,9 @@
"journal_th_debit": "Debet",
"journal_th_credit": "Kredit",
"confirm_delete": "Radera utkastet för {period}? Alla anställda och beräkningar i körningen tas bort. Detta kan inte ångras.",
"confirm_delete_title": "Radera utkast?",
"confirm_remove_employee": "Ta bort {name} från lönekörningen?",
"confirm_remove_employee_title": "Ta bort anställd?",
"toast_status_updated": "Status uppdaterad",
"toast_status_failed": "Kunde inte uppdatera status",
"toast_draft_deleted": "Utkast raderat",
@@ -5116,6 +5119,7 @@
"error_load_worked": "Kunde inte ladda arbetade timmar",
"unknown_error": "Okänt fel",
"confirm_bulk_delete": "Ta bort allt (arbetad tid och frånvaro) på {count, plural, one {# dag} other {# dagar}}?",
"confirm_bulk_delete_title": "Ta bort markerade dagar?",
"error_delete_worked_date": "Kunde inte ta bort arbetad tid på {date}",
"error_delete_absence_date": "Kunde inte ta bort frånvaro på {date}",
"prev_month": "Föregående månad",
@@ -5228,6 +5232,7 @@
"detail_updated": "Anställd uppdaterad",
"detail_update_failed": "Kunde inte uppdatera anställd",
"detail_deactivate_confirm": "Vill du inaktivera denna anställd?",
"detail_deactivate_confirm_title": "Inaktivera anställd?",
"detail_deactivated": "Anställd inaktiverad",
"detail_not_found": "Anställd hittades inte",
"detail_deactivate": "Inaktivera",