acb85edf4a
- Add 8 new Zod schemas (UpdateCustomer, UpdateSupplier, UpdateSupplierInvoice, UpdateAccount, BankUnlink, RunReconciliation, CorrectJournalEntry, EvaluateMappingRules) and wire validateBody() into 24 JSON-body API routes - Remove redundant manual validation checks replaced by Zod - Add comprehensive schema tests (222 tests) - Improve type definitions in types/index.ts with expanded interfaces - Refactor extension types (push-notifications, receipt-ocr) for cleaner imports - Update transaction components (BatchCategorySelector, SwipeCategorizationView, QuickReviewDialog, VatTreatmentSelect) and invoice inbox workspace - Add invoice-inbox utilities and type decoupling tests - Fix NE-bilaga, SRU export, and invoice PDF template type usage - Update CLAUDE.md with expanded architecture documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.9 KiB
TypeScript
58 lines
1.9 KiB
TypeScript
'use client'
|
|
|
|
import * as SelectPrimitive from '@radix-ui/react-select'
|
|
import { Check } from 'lucide-react'
|
|
import { Select, SelectContent, SelectTrigger, SelectValue } from '@/components/ui/select'
|
|
import { cn } from '@/lib/utils'
|
|
import { VAT_TREATMENT_OPTIONS } from './transaction-types'
|
|
import type { VatTreatment } from '@/types'
|
|
|
|
interface VatTreatmentSelectProps {
|
|
value: VatTreatment | 'none'
|
|
onValueChange: (value: VatTreatment | 'none') => void
|
|
disabled?: boolean
|
|
}
|
|
|
|
export default function VatTreatmentSelect({
|
|
value,
|
|
onValueChange,
|
|
disabled,
|
|
}: VatTreatmentSelectProps) {
|
|
return (
|
|
<Select
|
|
value={value}
|
|
onValueChange={(v) => onValueChange(v as VatTreatment | 'none')}
|
|
disabled={disabled}
|
|
>
|
|
<SelectTrigger className="h-9">
|
|
<SelectValue />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{VAT_TREATMENT_OPTIONS.map((opt) => (
|
|
<SelectPrimitive.Item
|
|
key={opt.value}
|
|
value={opt.value}
|
|
className={cn(
|
|
'relative flex w-full cursor-default select-none items-start rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-secondary focus:text-secondary-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50'
|
|
)}
|
|
>
|
|
<span className="absolute left-2 top-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
<SelectPrimitive.ItemIndicator>
|
|
<Check className="h-4 w-4 text-primary" />
|
|
</SelectPrimitive.ItemIndicator>
|
|
</span>
|
|
<div>
|
|
<SelectPrimitive.ItemText>{opt.label}</SelectPrimitive.ItemText>
|
|
{opt.description && (
|
|
<p className="text-xs text-muted-foreground mt-0.5 font-normal">
|
|
{opt.description}
|
|
</p>
|
|
)}
|
|
</div>
|
|
</SelectPrimitive.Item>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
)
|
|
}
|