Tasks: level badge (Client/Policy/Group) on task cards, fetch policyGroup data
This commit is contained in:
parent
0d8edc97da
commit
0ac872a4da
3 changed files with 24 additions and 0 deletions
|
|
@ -42,6 +42,7 @@ interface Task {
|
||||||
notes: string | null
|
notes: string | null
|
||||||
client: { id: string; name: string } | null
|
client: { id: string; name: string } | null
|
||||||
policy: { id: string; policyNumber: string | null; policyType: string | null; expirationDate: string | Date } | null
|
policy: { id: string; policyNumber: string | null; policyType: string | null; expirationDate: string | Date } | null
|
||||||
|
policyGroup: { id: string; name: string | null; renewalDate: string | Date | null } | null
|
||||||
assignments: TaskAssignment[]
|
assignments: TaskAssignment[]
|
||||||
taskNotes: TaskNote[]
|
taskNotes: TaskNote[]
|
||||||
}
|
}
|
||||||
|
|
@ -158,6 +159,13 @@ function TaskCard({ task: initial }: { task: Task }) {
|
||||||
</h3>
|
</h3>
|
||||||
<StatusBadge status={task.status} />
|
<StatusBadge status={task.status} />
|
||||||
<PriorityDot priority={task.priority} />
|
<PriorityDot priority={task.priority} />
|
||||||
|
{task.policyGroup ? (
|
||||||
|
<span className="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-purple-500/10 text-purple-700 dark:text-purple-400">Group</span>
|
||||||
|
) : task.policy ? (
|
||||||
|
<span className="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-blue-500/10 text-blue-700 dark:text-blue-400">Policy</span>
|
||||||
|
) : (
|
||||||
|
<span className="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-muted text-muted-foreground">Client</span>
|
||||||
|
)}
|
||||||
{notes.length > 0 && (
|
{notes.length > 0 && (
|
||||||
<span className="inline-flex items-center gap-1 text-xs text-muted-foreground">
|
<span className="inline-flex items-center gap-1 text-xs text-muted-foreground">
|
||||||
<MessageSquare className="h-3 w-3" />{notes.length}
|
<MessageSquare className="h-3 w-3" />{notes.length}
|
||||||
|
|
@ -177,6 +185,14 @@ function TaskCard({ task: initial }: { task: Task }) {
|
||||||
<span className="font-medium">{task.client.name}</span>
|
<span className="font-medium">{task.client.name}</span>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
{task.policyGroup && (
|
||||||
|
<span>
|
||||||
|
<span className="text-muted-foreground">Group:</span>{' '}
|
||||||
|
<span className="font-medium">
|
||||||
|
{task.policyGroup.name ?? (task.policyGroup.renewalDate ? formatDate(task.policyGroup.renewalDate) : task.policyGroup.id)}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
{task.policy && (
|
{task.policy && (
|
||||||
<span>
|
<span>
|
||||||
<span className="text-muted-foreground">Policy:</span>{' '}
|
<span className="text-muted-foreground">Policy:</span>{' '}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ export default async function TasksPage() {
|
||||||
include: {
|
include: {
|
||||||
client: { select: { id: true, name: true } },
|
client: { select: { id: true, name: true } },
|
||||||
policy: { select: { id: true, policyNumber: true, policyType: true, expirationDate: true } },
|
policy: { select: { id: true, policyNumber: true, policyType: true, expirationDate: true } },
|
||||||
|
policyGroup: { select: { id: true, name: true, renewalDate: true } },
|
||||||
assignments: {
|
assignments: {
|
||||||
include: { user: { select: { displayName: true, email: true } } },
|
include: { user: { select: { displayName: true, email: true } } },
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,13 @@ export async function GET(request: NextRequest) {
|
||||||
expirationDate: true,
|
expirationDate: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
policyGroup: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
renewalDate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
assignments: {
|
assignments: {
|
||||||
include: {
|
include: {
|
||||||
user: {
|
user: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue