'use client' import { motion } from 'framer-motion' import { Card, CardContent } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { cn, formatCurrency, formatDate } from '@/lib/utils' import { AlertCircle, ArrowUpRight, ArrowDownRight, Landmark, Link2, Loader2 } from 'lucide-react' import type { SkattekontoMatchSuggestion, StoredSkattekontoTransaction, } from '@/types/skatteverket' /** * Skattekonto-rad in the /transactions inbox. * * Mirrors the visual rhythm of TransactionInboxCard (same icon circle, same * amount placement) but with SKV-specific actions: Bokför creates a draft via * the skatteverket extension; Matcha opens the shared dialog so users can * link the row to an already-booked manual transfer. * * The Skatteverket badge is the cue that this row is fundamentally different * from a bank tx — different counter-account (1630 vs 1930), different * categorization rules, no AI-suggested invoice matches. */ export default function SkattekontoInboxCard({ row, matchSuggestion, processing, onBokfor, onMatch, onAnimationComplete, }: { row: StoredSkattekontoTransaction matchSuggestion?: SkattekontoMatchSuggestion | null processing: boolean onBokfor: (row: StoredSkattekontoTransaction) => void onMatch: (row: StoredSkattekontoTransaction) => void onAnimationComplete?: (id: string) => void }) { const amount = Number(row.belopp_skatteverket) const isIncome = amount > 0 return ( { if ( typeof definition === 'object' && 'opacity' in definition && definition.opacity === 0 ) { onAnimationComplete?.(row.id) } }} >

{row.transaktionstext}

Skatteverket

{formatDate(row.transaktionsdatum)}

{isIncome ? '+' : ''} {formatCurrency(amount)}

{matchSuggestion && (

Möjlig dublett av verifikat{' '} {matchSuggestion.voucher_series && matchSuggestion.voucher_number ? `${matchSuggestion.voucher_series}${matchSuggestion.voucher_number}` : '(utkast)'}

{matchSuggestion.entry_date} • {matchSuggestion.description}

Det här ser ut som samma kassaflöde — koppla istället för att bokföra om.

)}
{matchSuggestion ? ( <> ) : ( <> )}
) }