From dbc70a667175a6d4e3875bb42993176f499ced89 Mon Sep 17 00:00:00 2001 From: Ichsan Kurniawan Date: Wed, 22 Apr 2026 14:28:53 +0700 Subject: [PATCH] update --- .../(main)/ClientDetailComponent.tsx | 9 ++++-- .../AssignmentDetailComponent.tsx | 20 ++++-------- .../[project_id]/AssignedPeople.tsx | 8 +++-- .../[project_id]/StatusTimeline.tsx | 2 +- .../[project_id]/WorkOrderCard.tsx | 2 +- .../task/component/AssignmentTable.tsx | 32 ++++++++++++++++++- app/(dashboard)/task/component/ClientGrid.tsx | 27 +++++++--------- app/(dashboard)/task/page.tsx | 2 +- .../administration/user/component/type.tsx | 1 + components/ui/badge-status.tsx | 5 +-- 10 files changed, 65 insertions(+), 43 deletions(-) diff --git a/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientDetailComponent.tsx b/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientDetailComponent.tsx index 8f1a453..b2e017f 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientDetailComponent.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientDetailComponent.tsx @@ -43,6 +43,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro handleClose() } + console.log(assignmentLists) return ( <>
@@ -154,7 +155,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro

{user?.user.fullname}

-

{user?.user.role?.name}

+

{user?.user.position?.name}

@@ -284,7 +285,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro

{user?.user.fullname}

-

{user?.user.role?.name}

+

{user?.user.position?.name}

@@ -296,7 +297,9 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro +{assignment.project_assignment_work_order_detail?.length - 3}
)} - {assignment.project_assignment_work_order_detail && assignment.project_assignment_work_order_detail.length === 0 && No employees assigned} + {assignment.project_assignment_work_order_detail?.length === 0 && + No team assigned + } diff --git a/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/AssignmentDetailComponent.tsx b/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/AssignmentDetailComponent.tsx index 2784f2b..c508fdd 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/AssignmentDetailComponent.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/[assignment_id]/AssignmentDetailComponent.tsx @@ -2,7 +2,7 @@ "use client" import { motion } from 'motion/react'; -import { ArrowLeft, Briefcase, Calendar, CheckCircle2, History, AlertCircle, UserPlus, ExternalLink, Mail, Phone } from 'lucide-react'; +import { ArrowLeft, Briefcase, Calendar, CheckCircle2, History, AlertCircle, UserPlus, ExternalLink } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle, CardDescription, Card900 } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; @@ -17,8 +17,6 @@ import FormUpdateStatus from '../../../component/FormUpdateStatus'; import BadgeStatus from '@/components/ui/badge-status'; import Link from 'next/link'; import ManageEmployee from '../../../component/ManageEmployee'; -import dayjs from 'dayjs'; -import { LazyImage } from '@/components/ui/lazy-image'; import AssignedPeople from '../project-detail/[project_id]/AssignedPeople'; interface Props { @@ -63,23 +61,19 @@ export default function AssignmentDetail({ client, initialAssignment: assignment {/* Header */}
-

Assignment Detail

- - {assignmentType} - + {assignmentType}
{!isProject ?

{assignmentName}

: - +

{assignmentName}

- @@ -181,7 +175,7 @@ export default function AssignmentDetail({ client, initialAssignment: assignment

Team

- @@ -202,7 +196,7 @@ export default function AssignmentDetail({ client, initialAssignment: assignment - Assignment History + Assignment Timeline Timeline of status changes diff --git a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/AssignedPeople.tsx b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/AssignedPeople.tsx index 76d46ba..193bcb2 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/AssignedPeople.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/AssignedPeople.tsx @@ -18,7 +18,7 @@ const AssignedPeople = ({ people }: Props) => { } return ( -
+
{/* Stacked avatars */}
@@ -45,12 +45,14 @@ const AssignedPeople = ({ people }: Props) => {

{user.user.fullname}

- {user.user.role?.name} + {user.user.position?.name}
- {user.user.email} + + {user.user.email} + diff --git a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/StatusTimeline.tsx b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/StatusTimeline.tsx index ba9bff0..2ee736d 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/StatusTimeline.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/StatusTimeline.tsx @@ -23,7 +23,7 @@ const StatusTimeline = ({ history }: StatusTimelineProps) => {
{history.map((item, i) => { const { date, time } = formatDate(item.date_status_changed); - const isLatest = i === history.length - 1; + const isLatest = i === 0; return (
diff --git a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/WorkOrderCard.tsx b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/WorkOrderCard.tsx index 120fd53..ef4c547 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/WorkOrderCard.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/WorkOrderCard.tsx @@ -112,7 +112,7 @@ const WorkOrderCard = ({ workOrder, index, defaultOpen = false }: WorkOrderCardP
-

Status History

+

Assignment Timeline

{workOrder.project_assignment_status_detail.length} status changes

diff --git a/app/(dashboard)/task/component/AssignmentTable.tsx b/app/(dashboard)/task/component/AssignmentTable.tsx index 1c3fe39..38de698 100644 --- a/app/(dashboard)/task/component/AssignmentTable.tsx +++ b/app/(dashboard)/task/component/AssignmentTable.tsx @@ -7,6 +7,8 @@ import BadgeStatus from '@/components/ui/badge-status'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'; import { Button } from '@/components/ui/button'; import { IProjectAssignment } from '../type.assignment'; +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; +import { LazyImage } from '@/components/ui/lazy-image'; export default function AssignmentTable({ data }: { data: IProjectAssignment[] }) { if (data.length === 0) { @@ -42,6 +44,7 @@ export default function AssignmentTable({ data }: { data: IProjectAssignment[] } WO End Last Status Status Remarks + Team @@ -95,7 +98,34 @@ export default function AssignmentTable({ data }: { data: IProjectAssignment[] } - {assignment.project_assignment_status_detail[0].status_remarks} + {assignment.project_assignment_status_detail[0]?.status_remarks} + + +
+ {assignment.project_assignment_work_order_detail?.slice(0, 5).map((user, key) => { + return ( +
+ + + + + +

{user?.user?.name}

+

{user?.user?.position?.name}

+
+
+
+ ); + })} + {assignment.project_assignment_work_order_detail?.length! > 5 && +
+ +{assignment.project_assignment_work_order_detail?.length! - 5} +
+ } + {assignment.project_assignment_work_order_detail?.length === 0 && + No team assigned + } +
diff --git a/app/(dashboard)/task/component/ClientGrid.tsx b/app/(dashboard)/task/component/ClientGrid.tsx index 39c5c36..11bc12d 100644 --- a/app/(dashboard)/task/component/ClientGrid.tsx +++ b/app/(dashboard)/task/component/ClientGrid.tsx @@ -19,7 +19,7 @@ import { useRouter } from 'next/navigation'; import FormClient from './FormClient'; import { ConfirmDeleteWithInput } from '@/components/modal/ConfirmDeleteWithInput'; -export default function ClientGrid({ clients, assignments }: { clients: IClient[], assignments: any[] }) { +export default function ClientGrid({ clients }: { clients: IClient[] }) { const router = useRouter(); const [action, setAction] = useState<'EDIT' | 'DELETE' | undefined>(undefined) const [selectedData, setShowSelectedData] = useState() @@ -42,13 +42,10 @@ export default function ClientGrid({ clients, assignments }: { clients: IClient[ <>
{clients.map((client, i) => { - const clientAssignments = assignments.filter(a => a.clientId === client.id); const imCount = 0 const projectCount = client.total_project; - // const woCount = clientAssignments.reduce((acc, a) => acc + a.workOrders.length, 0); const woCount = client.total_work_order - const assignedEmployeeIds = Array.from(new Set(clientAssignments.flatMap(a => a.assignedEmployees))); - console.log(client) + const userCount = client.total_user_assigned return ( 0 && ( <> A dedicated team of{" "} - {assignedEmployeeIds.length} experts is handling{" "} + {userCount} experts is handling{" "} {woCount} work order{woCount! > 1 ? 's' : ''}{" "}to ensure successful delivery for {client.end_user_name}. )} @@ -123,27 +120,25 @@ export default function ClientGrid({ clients, assignments }: { clients: IClient[ return (
- - + + -

{user?.fullname}

-

{user?.role?.name}

+

{user?.name}

+

{user?.position?.name}

); })} - {client.users?.length! > 5 && ( + {client.users?.length! > 5 &&
+{client.users?.length! - 5}
- )} - {client.users?.length === 0 && ( + } + {client.users?.length === 0 && No team assigned - )} + }
diff --git a/app/(dashboard)/task/page.tsx b/app/(dashboard)/task/page.tsx index 7b59803..8c5199a 100644 --- a/app/(dashboard)/task/page.tsx +++ b/app/(dashboard)/task/page.tsx @@ -37,7 +37,7 @@ export default async function ClientsPage({ searchParams }: Props) { {/* Render the correct view based on the URL */} }> {view === 'grid' ? - + : } diff --git a/app/admin/administration/user/component/type.tsx b/app/admin/administration/user/component/type.tsx index 00bc405..80883c5 100644 --- a/app/admin/administration/user/component/type.tsx +++ b/app/admin/administration/user/component/type.tsx @@ -36,4 +36,5 @@ export interface IUser { resign_date?: string resign_reason?: string post_company?: string + name?: string } \ No newline at end of file diff --git a/components/ui/badge-status.tsx b/components/ui/badge-status.tsx index 1315923..2ec45b3 100644 --- a/components/ui/badge-status.tsx +++ b/components/ui/badge-status.tsx @@ -3,10 +3,7 @@ import { Badge, STATUS_BADGE_MAP } from "@/components/ui/badge" export default function BadgeStatus({ status, className }: { status: string, className?: string }) { // e.g. status = "UAT" return ( - {status?.toLowerCase() - .split(' ') - .map(word => word.charAt(0).toUpperCase() + word.slice(1)) - .join(' ')} + {status} ) } \ No newline at end of file