Task templates: add policyTypeFilter field to form, table, and API
This commit is contained in:
parent
47fb5317a9
commit
9331618ba6
1 changed files with 56 additions and 0 deletions
|
|
@ -66,6 +66,7 @@ interface TaskTemplate {
|
||||||
displayOrder: number | null
|
displayOrder: number | null
|
||||||
level: TaskLevel
|
level: TaskLevel
|
||||||
designationId: string | null
|
designationId: string | null
|
||||||
|
policyTypeFilter: string | null
|
||||||
designation: Designation | null
|
designation: Designation | null
|
||||||
_count: { tasks: number }
|
_count: { tasks: number }
|
||||||
}
|
}
|
||||||
|
|
@ -102,6 +103,25 @@ const LEVELS: { value: TaskLevel; label: string }[] = [
|
||||||
{ value: 'POLICY', label: 'Policy only' },
|
{ value: 'POLICY', label: 'Policy only' },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const POLICY_TYPES = [
|
||||||
|
'Workers Compensation',
|
||||||
|
'Package',
|
||||||
|
'General Liability',
|
||||||
|
'Business Auto',
|
||||||
|
'Umbrella(C)',
|
||||||
|
'Commercial Property',
|
||||||
|
'Inland Marine (C)',
|
||||||
|
'Cyber Liability',
|
||||||
|
'BOP',
|
||||||
|
'Crime',
|
||||||
|
'Pollution Liability',
|
||||||
|
'Errors & Ommissions Professional Liability',
|
||||||
|
'Employment Practices Liability',
|
||||||
|
'Directors & Officers',
|
||||||
|
'Motor Truck Cargo',
|
||||||
|
'ERISA',
|
||||||
|
]
|
||||||
|
|
||||||
const emptyTemplate = {
|
const emptyTemplate = {
|
||||||
name: '',
|
name: '',
|
||||||
description: '',
|
description: '',
|
||||||
|
|
@ -114,6 +134,7 @@ const emptyTemplate = {
|
||||||
displayOrder: null as number | null,
|
displayOrder: null as number | null,
|
||||||
level: 'BOTH' as TaskLevel,
|
level: 'BOTH' as TaskLevel,
|
||||||
designationId: null as string | null,
|
designationId: null as string | null,
|
||||||
|
policyTypeFilter: null as string | null,
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TaskTemplateManager({
|
export function TaskTemplateManager({
|
||||||
|
|
@ -166,6 +187,7 @@ export function TaskTemplateManager({
|
||||||
displayOrder: template.displayOrder,
|
displayOrder: template.displayOrder,
|
||||||
level: template.level,
|
level: template.level,
|
||||||
designationId: template.designationId,
|
designationId: template.designationId,
|
||||||
|
policyTypeFilter: template.policyTypeFilter,
|
||||||
})
|
})
|
||||||
setIsDialogOpen(true)
|
setIsDialogOpen(true)
|
||||||
}
|
}
|
||||||
|
|
@ -188,6 +210,7 @@ export function TaskTemplateManager({
|
||||||
description: formData.description || null,
|
description: formData.description || null,
|
||||||
displayOrder: formData.displayOrder || null,
|
displayOrder: formData.displayOrder || null,
|
||||||
designationId: formData.designationId || null,
|
designationId: formData.designationId || null,
|
||||||
|
policyTypeFilter: formData.policyTypeFilter || null,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -477,6 +500,31 @@ export function TaskTemplateManager({
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="grid gap-2">
|
||||||
|
<Label>Policy Type Filter</Label>
|
||||||
|
<Select
|
||||||
|
value={formData.policyTypeFilter || 'none'}
|
||||||
|
onValueChange={(value) =>
|
||||||
|
setFormData((prev) => ({
|
||||||
|
...prev,
|
||||||
|
policyTypeFilter: value === 'none' ? null : value,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<SelectTrigger>
|
||||||
|
<SelectValue placeholder="Any policy type" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="none">Any policy type</SelectItem>
|
||||||
|
{POLICY_TYPES.map((pt) => (
|
||||||
|
<SelectItem key={pt} value={pt}>
|
||||||
|
{pt}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
<p className="text-xs text-muted-foreground">Only generate this task for policies of this type. Leave blank for all types.</p>
|
||||||
|
</div>
|
||||||
<div className="grid gap-2">
|
<div className="grid gap-2">
|
||||||
<Label>Designation</Label>
|
<Label>Designation</Label>
|
||||||
<Select
|
<Select
|
||||||
|
|
@ -578,6 +626,7 @@ export function TaskTemplateManager({
|
||||||
<TableHead>Department</TableHead>
|
<TableHead>Department</TableHead>
|
||||||
<TableHead>Timing</TableHead>
|
<TableHead>Timing</TableHead>
|
||||||
<TableHead>Level</TableHead>
|
<TableHead>Level</TableHead>
|
||||||
|
<TableHead>Policy Type</TableHead>
|
||||||
<TableHead>Designation</TableHead>
|
<TableHead>Designation</TableHead>
|
||||||
<TableHead>Priority</TableHead>
|
<TableHead>Priority</TableHead>
|
||||||
<TableHead>Status</TableHead>
|
<TableHead>Status</TableHead>
|
||||||
|
|
@ -620,6 +669,13 @@ export function TaskTemplateManager({
|
||||||
{LEVELS.find((l) => l.value === template.level)?.label || template.level}
|
{LEVELS.find((l) => l.value === template.level)?.label || template.level}
|
||||||
</span>
|
</span>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
{template.policyTypeFilter ? (
|
||||||
|
<Badge variant="outline" className="text-xs font-normal">{template.policyTypeFilter}</Badge>
|
||||||
|
) : (
|
||||||
|
<span className="text-xs text-muted-foreground">Any</span>
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{template.designation ? (
|
{template.designation ? (
|
||||||
<Badge variant="outline" className="flex items-center gap-1 w-fit">
|
<Badge variant="outline" className="flex items-center gap-1 w-fit">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue