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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user