Add accounts UI with list, create, edit, detail tabs for all sub-entities

Accounts list with paginated table, search, sort. Account detail page with
tabs for members, payment methods, tax exemptions, and processor links.
All sub-entities have create/edit dialogs and delete actions. Forms use
shared Zod schemas via react-hook-form.
This commit is contained in:
Ryan Moon
2026-03-28 07:45:52 -05:00
parent e734ef4606
commit 9abdf6c050
23 changed files with 1688 additions and 6 deletions

View File

@@ -0,0 +1,63 @@
import { useForm } from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod'
import { ProcessorLinkCreateSchema } from '@forte/shared/schemas'
import type { ProcessorLinkCreateInput } from '@forte/shared/schemas'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
interface ProcessorLinkFormProps {
accountId: string
onSubmit: (data: Record<string, unknown>) => void
loading?: boolean
}
export function ProcessorLinkForm({ accountId, onSubmit, loading }: ProcessorLinkFormProps) {
const {
register,
handleSubmit,
setValue,
watch,
formState: { errors },
} = useForm<ProcessorLinkCreateInput>({
resolver: zodResolver(ProcessorLinkCreateSchema),
defaultValues: {
accountId,
processor: 'stripe',
processorCustomerId: '',
},
})
const processor = watch('processor')
return (
<form onSubmit={handleSubmit(onSubmit)} className="space-y-4">
<div className="space-y-2">
<Label>Processor</Label>
<Select
value={processor}
onValueChange={(v) => setValue('processor', v as 'stripe' | 'global_payments')}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="stripe">Stripe</SelectItem>
<SelectItem value="global_payments">Global Payments</SelectItem>
</SelectContent>
</Select>
</div>
<div className="space-y-2">
<Label htmlFor="customerId">Customer ID *</Label>
<Input id="customerId" {...register('processorCustomerId')} placeholder="cus_..." />
{errors.processorCustomerId && (
<p className="text-sm text-destructive">{errors.processorCustomerId.message}</p>
)}
</div>
<Button type="submit" disabled={loading}>
{loading ? 'Saving...' : 'Add Processor Link'}
</Button>
</form>
)
}