e8fb84b4fd
- SIE parser: Windows-1252 and CP437 encoding detection and decoding - Bank file parser: add Nordea Business (Företag) CSV format - Bank file parser: improve format detection for SEB, Länsförsäkringar, generic CSV - INK2 engine: calculate årets resultat (7222) from income statement for open fiscal years - Dashboard: parallel Supabase queries, simplified dashboard page - Fix Swedish characters (å, ä, ö) in BAS data descriptions, validation messages, AI consent disclosures - Import wizard UI improvements across all steps - Migration: add 'bas_range' match type to sie_account_mappings constraint - Extensive new tests for SIE parser encoding and bank file parser Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
'use client'
|
|
|
|
import {
|
|
Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter,
|
|
} from '@/components/ui/dialog'
|
|
import { Button } from '@/components/ui/button'
|
|
import { Loader2, AlertTriangle } from 'lucide-react'
|
|
|
|
interface ConfirmDeleteDialogProps {
|
|
open: boolean
|
|
onOpenChange: (open: boolean) => void
|
|
title?: string
|
|
description?: string
|
|
onConfirm: () => void | Promise<void>
|
|
isDeleting?: boolean
|
|
}
|
|
|
|
export default function ConfirmDeleteDialog({
|
|
open,
|
|
onOpenChange,
|
|
title = 'Bekräfta borttagning',
|
|
description = 'Är du säker på att du vill ta bort detta? Åtgärden kan inte ångras.',
|
|
onConfirm,
|
|
isDeleting = false,
|
|
}: ConfirmDeleteDialogProps) {
|
|
const handleConfirm = async () => {
|
|
await onConfirm()
|
|
onOpenChange(false)
|
|
}
|
|
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<DialogContent className="max-w-sm">
|
|
<DialogHeader>
|
|
<div className="flex items-center gap-3">
|
|
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-destructive/10">
|
|
<AlertTriangle className="h-5 w-5 text-destructive" />
|
|
</div>
|
|
<div>
|
|
<DialogTitle>{title}</DialogTitle>
|
|
<DialogDescription>{description}</DialogDescription>
|
|
</div>
|
|
</div>
|
|
</DialogHeader>
|
|
<DialogFooter>
|
|
<Button variant="outline" onClick={() => onOpenChange(false)} disabled={isDeleting}>
|
|
Avbryt
|
|
</Button>
|
|
<Button variant="destructive" onClick={handleConfirm} disabled={isDeleting}>
|
|
{isDeleting ? (
|
|
<>
|
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
|
Tar bort...
|
|
</>
|
|
) : (
|
|
'Ta bort'
|
|
)}
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
)
|
|
}
|