Fix Additional Service modal: department enum mapping and timing value

- Map display labels to DepartmentType enum values (CLAIMS, PERSONAL_LINES, etc.)
- Fix timing from invalid 'ONGOING' to 'PRE_RENEWAL' (only valid values)
- Remove unused TIMINGS constant
This commit is contained in:
lorentz 2026-04-13 22:55:59 +00:00
parent 5934ff7c4f
commit 27247f77f0

View file

@ -68,8 +68,13 @@ interface AdditionalServiceModalProps {
}
const PRIORITIES = ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']
const DEPARTMENTS = ['Claims', 'Personal Lines', 'Commercial Lines', 'Benefits', 'Life', 'Other']
const TIMINGS = ['BEFORE_RENEWAL', 'AT_RENEWAL', 'AFTER_RENEWAL', 'ONGOING']
const DEPARTMENTS: { label: string; value: string }[] = [
{ label: 'Claims', value: 'CLAIMS' },
{ label: 'Personal Lines', value: 'PERSONAL_LINES' },
{ label: 'Commercial Lines', value: 'COMMERCIAL_LINES' },
{ label: 'Benefits', value: 'BENEFITS' },
{ label: 'Other', value: 'OTHER' },
]
export function AdditionalServiceModal({
open,
@ -82,7 +87,7 @@ export function AdditionalServiceModal({
const [title, setTitle] = useState('')
const [description, setDescription] = useState('')
const [priority, setPriority] = useState('MEDIUM')
const [department, setDepartment] = useState(DEPARTMENTS[0])
const [department, setDepartment] = useState(DEPARTMENTS[0].value)
const [dueDate, setDueDate] = useState('')
const [assignTo, setAssignTo] = useState(currentUserId)
const [saving, setSaving] = useState(false)
@ -106,7 +111,7 @@ export function AdditionalServiceModal({
setTitle('')
setDescription('')
setPriority('MEDIUM')
setDepartment(DEPARTMENTS[0])
setDepartment(DEPARTMENTS[0].value)
setDueDate('')
setAssignTo(currentUserId)
setLevel(context?.policyId ? 'policy' : context?.policyGroupId ? 'group' : 'client')
@ -160,7 +165,7 @@ export function AdditionalServiceModal({
priority,
department,
dueDate: new Date(dueDate).toISOString(),
timing: 'ONGOING',
timing: 'PRE_RENEWAL',
daysOffset: 0,
status: 'NOT_STARTED',
isAdHoc: true,
@ -336,7 +341,7 @@ export function AdditionalServiceModal({
<Select value={department} onValueChange={setDepartment}>
<SelectTrigger><SelectValue /></SelectTrigger>
<SelectContent>
{DEPARTMENTS.map((d) => <SelectItem key={d} value={d}>{d}</SelectItem>)}
{DEPARTMENTS.map((d) => <SelectItem key={d.value} value={d.value}>{d.label}</SelectItem>)}
</SelectContent>
</Select>
</div>