From 9d7f956c3bce082b9b7147852fe022016b8453c5 Mon Sep 17 00:00:00 2001 From: "santasri.pachhal" Date: Fri, 10 Jul 2026 18:27:26 +0530 Subject: [PATCH] feat(ticket): show assigned contractor details on in-progress tickets --- .../components/TicketStatusActions.tsx | 6 +- .../actions/AssignedContractorAction.tsx | 61 +++++++++++++++++++ .../actions/ReviewExtensionRequestAction.tsx | 5 +- 3 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 src/app/(modules)/ticket/[ticketId]/components/actions/AssignedContractorAction.tsx diff --git a/src/app/(modules)/ticket/[ticketId]/components/TicketStatusActions.tsx b/src/app/(modules)/ticket/[ticketId]/components/TicketStatusActions.tsx index efd4cac..6ab97d2 100644 --- a/src/app/(modules)/ticket/[ticketId]/components/TicketStatusActions.tsx +++ b/src/app/(modules)/ticket/[ticketId]/components/TicketStatusActions.tsx @@ -4,6 +4,7 @@ import { PERMISSIONS } from '@/constants/permissions'; import { PermissionGuard } from '@/guards'; import type { TicketDetail } from '@/types'; +import { AssignedContractorAction } from './actions/AssignedContractorAction'; import { AssignTicketAction } from './actions/AssignTicketAction'; import { ClosedTicketAction } from './actions/ClosedTicketAction'; import { NoTicketAction } from './actions/NoTicketAction'; @@ -41,7 +42,10 @@ function getTicketAction(ticket: TicketDetail) { } > - + <> + + + ); } diff --git a/src/app/(modules)/ticket/[ticketId]/components/actions/AssignedContractorAction.tsx b/src/app/(modules)/ticket/[ticketId]/components/actions/AssignedContractorAction.tsx new file mode 100644 index 0000000..5e3a661 --- /dev/null +++ b/src/app/(modules)/ticket/[ticketId]/components/actions/AssignedContractorAction.tsx @@ -0,0 +1,61 @@ +'use client'; + +import { CalendarClock, UserCheck } from 'lucide-react'; + +import { PersonInfo } from '@/components/person-avatar'; +import { Badge } from '@/components/ui/badge'; +import type { TicketDetail } from '@/types'; +import { formatDate } from '@/utils/date'; + +import { TicketActionCard } from './TicketActionCard'; + +function AssignmentField({ label, value }: { label: string; value: string }) { + return ( +
+

{label}

+

{value}

+
+ ); +} + +export function AssignedContractorAction({ ticket }: { ticket: TicketDetail }) { + const worker = ticket.worker; + + return ( + + {worker ? ( +
+
+ + + Assigned + +
+ +
+ + + +
+

Due Date

+

+ + {formatDate(worker.due_at)} +

+
+
+
+ ) : ( +

+ Assignment details are not available. +

+ )} +
+ ); +} diff --git a/src/app/(modules)/ticket/[ticketId]/components/actions/ReviewExtensionRequestAction.tsx b/src/app/(modules)/ticket/[ticketId]/components/actions/ReviewExtensionRequestAction.tsx index 357e5a0..fa18c36 100644 --- a/src/app/(modules)/ticket/[ticketId]/components/actions/ReviewExtensionRequestAction.tsx +++ b/src/app/(modules)/ticket/[ticketId]/components/actions/ReviewExtensionRequestAction.tsx @@ -24,7 +24,6 @@ import { useReviewTicketExtensionMutation, useTicketExtensionRequestQuery, } from '../../../hooks/useTicketQueries'; -import { NoTicketAction } from './NoTicketAction'; import { TicketActionCard } from './TicketActionCard'; const MAX_NOTE_LENGTH = 300; @@ -208,7 +207,7 @@ export function ReviewExtensionRequestAction({ ); if (!assignmentId || extensionRequestQuery.isError) { - return ; + return null; } if (extensionRequestQuery.isLoading) { @@ -226,7 +225,7 @@ export function ReviewExtensionRequestAction({ ? getPendingRequest(extensionRequestQuery.data) : null; - if (!pendingRequest) return ; + if (!pendingRequest) return null; return ; }