add report submission

This commit is contained in:
2025-12-11 20:46:34 -03:00
parent 3fb8488074
commit 1e1a0ae24c
10 changed files with 281 additions and 54 deletions

View File

@@ -123,6 +123,7 @@ function ActionMenu({ row }: { row: any }) {
<CancelItem
id={row.id}
cancelPolicy={data?.cancel_policy}
lock={data?.lock}
onSuccess={onSuccess}
/>
</>
@@ -180,7 +181,7 @@ function RemoveDedupItem({
const [loading, { set }] = useToggle(false)
const [open, { set: setOpen }] = useToggle(false)
const cancel = async (e: MouseEvent<HTMLButtonElement>) => {
const remove = async (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault()
set(true)
@@ -231,7 +232,7 @@ function RemoveDedupItem({
</AlertDialogHeader>
<AlertDialogFooter className="*:cursor-pointer">
<AlertDialogAction asChild>
<Button onClick={cancel} disabled={loading} variant="destructive">
<Button onClick={remove} disabled={loading} variant="destructive">
{loading ? <Spinner /> : null} Continuar
</Button>
</AlertDialogAction>
@@ -272,8 +273,9 @@ function CancelItem({
set(true)
const r = await fetch(`/~/api/enrollments/${id}/cancel`, {
method: 'POST',
headers: new Headers({ 'Content-Type': 'application/json' })
method: 'PATCH',
headers: new Headers({ 'Content-Type': 'application/json' }),
body: JSON.stringify({ lock_hash: lock?.hash })
})
if (r.ok) {