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
|
||||
level: TaskLevel
|
||||
designationId: string | null
|
||||
policyTypeFilter: string | null
|
||||
designation: Designation | null
|
||||
_count: { tasks: number }
|
||||
}
|
||||
|
|
@ -102,6 +103,25 @@ const LEVELS: { value: TaskLevel; label: string }[] = [
|
|||
{ 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 = {
|
||||
name: '',
|
||||
description: '',
|
||||
|
|
@ -114,6 +134,7 @@ const emptyTemplate = {
|
|||
displayOrder: null as number | null,
|
||||
level: 'BOTH' as TaskLevel,
|
||||
designationId: null as string | null,
|
||||
policyTypeFilter: null as string | null,
|
||||
}
|
||||
|
||||
export function TaskTemplateManager({
|
||||
|
|
@ -166,6 +187,7 @@ export function TaskTemplateManager({
|
|||
displayOrder: template.displayOrder,
|
||||
level: template.level,
|
||||
designationId: template.designationId,
|
||||
policyTypeFilter: template.policyTypeFilter,
|
||||
})
|
||||
setIsDialogOpen(true)
|
||||
}
|
||||
|
|
@ -188,6 +210,7 @@ export function TaskTemplateManager({
|
|||
description: formData.description || null,
|
||||
displayOrder: formData.displayOrder || null,
|
||||
designationId: formData.designationId || null,
|
||||
policyTypeFilter: formData.policyTypeFilter || null,
|
||||
}),
|
||||
})
|
||||
|
||||
|
|
@ -477,6 +500,31 @@ export function TaskTemplateManager({
|
|||
</SelectContent>
|
||||
</Select>
|
||||
</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">
|
||||
<Label>Designation</Label>
|
||||
<Select
|
||||
|
|
@ -578,6 +626,7 @@ export function TaskTemplateManager({
|
|||
<TableHead>Department</TableHead>
|
||||
<TableHead>Timing</TableHead>
|
||||
<TableHead>Level</TableHead>
|
||||
<TableHead>Policy Type</TableHead>
|
||||
<TableHead>Designation</TableHead>
|
||||
<TableHead>Priority</TableHead>
|
||||
<TableHead>Status</TableHead>
|
||||
|
|
@ -620,6 +669,13 @@ export function TaskTemplateManager({
|
|||
{LEVELS.find((l) => l.value === template.level)?.label || template.level}
|
||||
</span>
|
||||
</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>
|
||||
{template.designation ? (
|
||||
<Badge variant="outline" className="flex items-center gap-1 w-fit">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue