fix(ui): guard delete on paid invoices / ordered-or-locked offers; add guarded delete to issued orders

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-09 16:36:32 +02:00
parent 39565767ef
commit 20177e8f87
3 changed files with 86 additions and 19 deletions

View File

@@ -1211,15 +1211,19 @@ export default function InvoiceDetail() {
Zobrazit fakturu
</Button>
)}
{hasPermission("invoices.delete") && (
<Button
onClick={() => setDeleteConfirm(true)}
variant="outlined"
color="error"
>
Smazat
</Button>
)}
{/* A paid invoice is a settled financial record — never deletable
from the UI. (Backend rejection of deleting a paid invoice is a
separate hardening, out of scope here.) */}
{hasPermission("invoices.delete") &&
invoice.status !== "paid" && (
<Button
onClick={() => setDeleteConfirm(true)}
variant="outlined"
color="error"
>
Smazat
</Button>
)}
</Box>
</Box>
</Box>
@@ -1778,15 +1782,20 @@ export default function InvoiceDetail() {
)}
</Button>
))}
{hasPermission("invoices.delete") && (
<Button
onClick={() => setDeleteConfirm(true)}
variant="outlined"
color="error"
>
Smazat
</Button>
)}
{/* A paid invoice is a settled financial record — never
deletable from the UI. A paid invoice never actually reaches
this branch (it renders the read-only view above), but the
guard documents the invariant explicitly. */}
{hasPermission("invoices.delete") &&
invoice.status !== "paid" && (
<Button
onClick={() => setDeleteConfirm(true)}
variant="outlined"
color="error"
>
Smazat
</Button>
)}
</>
)}
</Box>