From fa973a87224d6cb798a4faad2a003a5b6bae8b24 Mon Sep 17 00:00:00 2001 From: Ichsan Kurniawan Date: Sun, 26 Apr 2026 23:26:48 +0700 Subject: [PATCH] Replace FormUpdateStatus with timeline editor Refactor status update UI: remove the old FormUpdateStatus component and introduce UpdateTimelineStatus (inline timeline editor with row-level editing, date pickers, and notes). Update imports/usages across client, assignment, project and work-order components to use the new component and adjust props (assignmentId/onClose). Also rename AddTeam usage to ManageTeam in the assignment detail. Add client description support: FormClient now includes a description field and textarea, and IClient type gains an optional description. Minor cleanup: remove stray comment in HomeTask/page. --- .../(main)/ClientDetailComponent.tsx | 2 +- .../AssignmentDetailComponent.tsx | 8 +- .../[project_id]/ProjectDetailComponent.tsx | 2 +- .../[project_id]/WorkOrderCard.tsx | 2 +- app/(dashboard)/task/component/FormClient.tsx | 14 ++ .../task/component/FormUpdateStatus.tsx | 141 ------------ app/(dashboard)/task/component/HomeTask.tsx | 1 - .../task/component/UpdateTimelineStatus.tsx | 208 ++++++++++++++++++ app/(dashboard)/task/page.tsx | 1 - app/(dashboard)/task/types.ts | 1 + 10 files changed, 230 insertions(+), 150 deletions(-) delete mode 100644 app/(dashboard)/task/component/FormUpdateStatus.tsx create mode 100644 app/(dashboard)/task/component/UpdateTimelineStatus.tsx 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 563281a..1031522 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientDetailComponent.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/(main)/ClientDetailComponent.tsx @@ -15,7 +15,7 @@ import { LazyImage } from '@/components/ui/lazy-image'; import { IProjectAssignment } from '../../../type.assignment'; import ManageEmployee from '../../../component/AddTeam'; import { useRouter } from 'next/navigation'; -import FormUpdateStatus from '../../../component/FormUpdateStatus'; +import FormUpdateStatus from '../../../component/UpdateTimelineStatus'; import BadgeStatus from '@/components/ui/badge-status'; import FilterComponent from '../../../component/FilterComponent'; import { ConfirmDeleteWithInput } from '@/components/modal/ConfirmDeleteWithInput'; 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 c82924d..ab3b85b 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 @@ -13,11 +13,11 @@ import { useRouter } from 'next/navigation'; import { IClient } from '../../../types'; import { IProjectAssignment } from '../../../type.assignment'; import { useState } from 'react'; -import FormUpdateStatus from '../../../component/FormUpdateStatus'; +import FormUpdateStatus from '../../../component/UpdateTimelineStatus'; import BadgeStatus from '@/components/ui/badge-status'; import Link from 'next/link'; -import ManageEmployee from '../../../component/AddTeam'; import AssignedPeople from '../project-detail/[project_id]/AssignedPeople'; +import { ManageTeam } from '../../../component/ManageTeam'; interface Props { client: IClient | undefined; @@ -235,12 +235,12 @@ export default function AssignmentDetail({ client, initialAssignment: assignment {action === 'UPDATE_STATUS' ? - + : null } {action === 'MANAGE_EMPLOYEE' ? - + : null } diff --git a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/ProjectDetailComponent.tsx b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/ProjectDetailComponent.tsx index b71ba54..c8dd5e4 100644 --- a/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/ProjectDetailComponent.tsx +++ b/app/(dashboard)/task/client-detail/[client_id]/project-detail/[project_id]/ProjectDetailComponent.tsx @@ -10,7 +10,7 @@ import { Label } from '@/components/ui/label'; import { cn } from '@/lib/utils'; import { useRouter } from 'next/navigation'; import { useState } from 'react'; -import FormUpdateStatus from '@/app/(dashboard)/task/component/FormUpdateStatus'; +import FormUpdateStatus from '@/app/(dashboard)/task/component/UpdateTimelineStatus'; import { IClient } from '@/app/(dashboard)/task/types'; import { IProjectAssignment } from '@/app/(dashboard)/task/type.assignment'; import { IProject } from '@/app/(dashboard)/task/type.project'; 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 164151c..044c2c8 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 @@ -9,7 +9,7 @@ import AssignedPeople from './AssignedPeople'; import BadgeStatus from '@/components/ui/badge-status'; import { IProjectAssignment } from '@/app/(dashboard)/task/type.assignment'; import { useRouter } from 'next/navigation'; -import FormUpdateStatus from '@/app/(dashboard)/task/component/FormUpdateStatus'; +import FormUpdateStatus from '@/app/(dashboard)/task/component/UpdateTimelineStatus'; import ManageEmployee from '@/app/(dashboard)/task/component/AddTeam'; interface WorkOrderCardProps { diff --git a/app/(dashboard)/task/component/FormClient.tsx b/app/(dashboard)/task/component/FormClient.tsx index 7201705..0a9e242 100644 --- a/app/(dashboard)/task/component/FormClient.tsx +++ b/app/(dashboard)/task/component/FormClient.tsx @@ -19,10 +19,12 @@ import { LazyImage } from '@/components/ui/lazy-image'; import { Label } from '@/components/ui/label'; import { serverApiCall } from '@/lib/server-api'; import FormEndUser from './FormEndUser'; +import { Textarea } from '@/components/ui/textarea'; const validationSchema = Yup.object().shape({ name: Yup.string().required(), end_user_id: Yup.number().required(), + description: Yup.string().optional().default(''), }); type FormDataType = Yup.InferType; @@ -74,6 +76,7 @@ const FormClient: FC = ({ data, onSuccess, onCancel }) => { defaultValues: { "name": data?.name || '', "end_user_id": data?.end_user_id || undefined, + "description": data?.description || '', }, }); @@ -194,6 +197,17 @@ const FormClient: FC = ({ data, onSuccess, onCancel }) => { )} /> + ( + + Description + +