Files
salam e687b4437b
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s
first commit
2026-10-06 18:53:03 +02:00

93 lines
3.6 KiB
Svelte

<script lang="ts">
import { Form } from '@inertiajs/svelte';
import ProfileController from '@/actions/App/Http/Controllers/Settings/ProfileController';
import Heading from '@/components/Heading.svelte';
import InputError from '@/components/InputError.svelte';
import PasswordInput from '@/components/PasswordInput.svelte';
import { Button } from '@/components/ui/button';
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog';
import { Label } from '@/components/ui/label';
</script>
<div class="space-y-6">
<Heading
variant="small"
title="Delete account"
description="Delete your account and all of its resources"
/>
<div
class="space-y-4 rounded-lg border border-red-100 bg-red-50 p-4 dark:border-red-200/10 dark:bg-red-700/10"
>
<div class="relative space-y-0.5 text-red-600 dark:text-red-100">
<p class="font-medium">Warning</p>
<p class="text-sm">
Please proceed with caution, this cannot be undone.
</p>
</div>
<Dialog>
<DialogTrigger>
<Button variant="destructive" data-test="delete-user-button"
>Delete account</Button
>
</DialogTrigger>
<DialogContent>
<Form
{...ProfileController.destroy.form()}
class="space-y-6"
options={{ preserveScroll: true }}
>
{#snippet children({ errors, processing })}
<div class="space-y-3">
<DialogTitle
>Are you sure you want to delete your account?</DialogTitle
>
<DialogDescription>
Once your account is deleted, all of its
resources and data will also be permanently
deleted. Please enter your password to confirm
you would like to permanently delete your
account.
</DialogDescription>
</div>
<div class="grid gap-2">
<Label for="password" class="sr-only"
>Password</Label
>
<PasswordInput
id="password"
name="password"
placeholder="Password"
/>
<InputError message={errors.password} />
</div>
<DialogFooter class="gap-2">
<DialogClose>
<Button variant="secondary">Cancel</Button>
</DialogClose>
<Button
type="submit"
variant="destructive"
disabled={processing}
data-test="confirm-delete-user-button"
>
Delete account
</Button>
</DialogFooter>
{/snippet}
</Form>
</DialogContent>
</Dialog>
</div>
</div>