'use client' import { useState } from 'react' import { useTranslations } from 'next-intl' import { Button } from '@/components/ui/button' import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog' import { Progress } from '@/components/ui/progress' import { Paperclip } from 'lucide-react' import VatTreatmentSelect from './VatTreatmentSelect' import { EXPENSE_CATEGORIES, INCOME_CATEGORIES } from './transaction-types' import type { TransactionCategory, VatTreatment } from '@/types' const expenseCategories = EXPENSE_CATEGORIES const incomeCategories = INCOME_CATEGORIES interface BatchCategorySelectorProps { open: boolean onOpenChange: (open: boolean) => void selectedCount: number onSelectCategory: (category: TransactionCategory, vatTreatment?: VatTreatment) => void progress: { done: number; total: number } | null } export default function BatchCategorySelector({ open, onOpenChange, selectedCount, onSelectCategory, progress, }: BatchCategorySelectorProps) { const t = useTranslations('tx_batch_selector') const tCat = useTranslations('tx_categories') const [vatTreatment, setVatTreatment] = useState('standard_25') const isProcessing = progress !== null const handleSelectCategory = (category: TransactionCategory) => { const resolvedVat = vatTreatment === 'none' ? undefined : vatTreatment onSelectCategory(category, resolvedVat) } return ( {isProcessing ? t('title_processing', { done: progress.done, total: progress.total }) : t('title_default', { count: selectedCount })} {isProcessing ? t('description_processing') : t('description_default')} {isProcessing ? (

{t('progress_label', { done: progress.done, total: progress.total })}

) : (
{/* Underlag reminder */}

{t('underlag_reminder')}

{t('vat_label')}

{t('expenses_label')}

{expenseCategories.map((cat) => ( ))}

{t('income_label')}

{incomeCategories.map((cat) => ( ))}
)}
) }