'use client'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { CheckCircle2, XCircle, ArrowRight, AlertTriangle } from 'lucide-react'
import Link from 'next/link'
export type RegisterResult = {
success: boolean
created: number
updated: number
skipped: number
failed: number
errors: { row_index: number; name: string; reason: string }[]
}
interface RegisterResultStepProps {
entity: 'customers' | 'suppliers'
result: RegisterResult
onNewImport: () => void
}
const ENTITY_COPY = {
customers: {
successTitle: 'Kunder importerade',
failTitle: 'Importen misslyckades',
listLabel: 'Visa alla kunder',
listHref: '/customers',
},
suppliers: {
successTitle: 'Leverantörer importerade',
failTitle: 'Importen misslyckades',
listLabel: 'Visa alla leverantörer',
listHref: '/suppliers',
},
} as const
export default function RegisterResultStep({
entity,
result,
onNewImport,
}: RegisterResultStepProps) {
const copy = ENTITY_COPY[entity]
const totalProcessed = result.created + result.updated + result.skipped + result.failed
const isPartial = result.failed > 0 && result.created + result.updated > 0
return (
Inga rader bearbetades.Rader som inte kunde importeras
{result.errors.map((e, i) => (
{value}
{label}