Rebrand from Forte (music-store-specific) to LunarFront (any small business): - Package namespace @forte/* → @lunarfront/* - Database forte/forte_test → lunarfront/lunarfront_test - Docker containers, volumes, connection strings - UI branding, localStorage keys, test emails - All documentation and planning docs Generalize music-specific terminology: - instrumentDescription → itemDescription - instrumentCount → itemCount - instrumentType → itemCategory (on service templates) - New migration 0027_generalize_terminology for column renames - Seed data updated with generic examples - RBAC descriptions updated
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
import { useForm } from 'react-hook-form'
|
|
import { zodResolver } from '@hookform/resolvers/zod'
|
|
import { ProcessorLinkCreateSchema } from '@lunarfront/shared/schemas'
|
|
import type { ProcessorLinkCreateInput } from '@lunarfront/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>
|
|
)
|
|
}
|