import { useState } from 'react'; import { TextArea } from '@/components/base/textarea/textarea'; import type { CallDisposition } from '@/types/entities'; import { cx } from '@/utils/cx'; interface DispositionFormProps { onSubmit: (disposition: CallDisposition, notes: string) => void; defaultDisposition?: CallDisposition | null; } const dispositionOptions: Array<{ value: CallDisposition; label: string; activeClass: string; defaultClass: string; }> = [ { value: 'APPOINTMENT_BOOKED', label: 'Appointment Booked', activeClass: 'bg-success-solid text-white ring-transparent', defaultClass: 'bg-success-primary text-success-primary border-success', }, { value: 'APPOINTMENT_RESCHEDULED', label: 'Appt Rescheduled', activeClass: 'bg-warning-solid text-white ring-transparent', defaultClass: 'bg-warning-primary text-warning-primary border-warning', }, { value: 'APPOINTMENT_CANCELLED', label: 'Appt Cancelled', activeClass: 'bg-error-solid text-white ring-transparent', defaultClass: 'bg-error-primary text-error-primary border-error', }, { value: 'FOLLOW_UP_SCHEDULED', label: 'Follow-up Needed', activeClass: 'bg-brand-solid text-white ring-transparent', defaultClass: 'bg-brand-primary text-brand-secondary border-brand', }, { value: 'INFO_PROVIDED', label: 'Info Provided', activeClass: 'bg-utility-blue-light-600 text-white ring-transparent', defaultClass: 'bg-utility-blue-light-50 text-utility-blue-light-700 border-utility-blue-light-200', }, { value: 'NO_ANSWER', label: 'No Answer', activeClass: 'bg-warning-solid text-white ring-transparent', defaultClass: 'bg-warning-primary text-warning-primary border-warning', }, { value: 'WRONG_NUMBER', label: 'Wrong Number', activeClass: 'bg-secondary-solid text-white ring-transparent', defaultClass: 'bg-secondary text-secondary border-secondary', }, { value: 'NOT_INTERESTED', label: 'Not Interested', activeClass: 'bg-error-solid text-white ring-transparent', defaultClass: 'bg-error-primary text-error-primary border-error', }, { value: 'CALLBACK_REQUESTED', label: 'Callback Requested', activeClass: 'bg-utility-blue-600 text-white ring-transparent', defaultClass: 'bg-utility-blue-50 text-utility-blue-700 border-utility-blue-200', }, ]; export const DispositionForm = ({ onSubmit, defaultDisposition }: DispositionFormProps) => { const [selected, setSelected] = useState(defaultDisposition ?? null); const [notes, setNotes] = useState(''); const handleSubmit = () => { if (selected === null) return; onSubmit(selected, notes); }; return (
What happened?
{dispositionOptions.map((option) => { const isSelected = selected === option.value; return ( ); })}