mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-05 10:56:28 +00:00
Refactor task UI, forms and team/status flows
Consolidate and improve client/task UI and related forms: - Replace/rename modal components: use ManageTeam and UpdateTimelineStatus consistently (replace previous ManageEmployee/FormUpdateStatus imports/usages). - ClientDetail: update grid layout, add End User column in table view, guard status with optional chaining, adjust avatar size, and minor label tweaks. - Project/Assignment forms: add end_user_id to assignment schema and form, fetch end-users, integrate ComboboxCustomUI and lazy image rendering for end-user selection, allow creating end-user inline, and fix autofill mappings for project selection. Improve loading handling and payload construction for create/update flows. - Project assignments page: switch to fetching project list endpoint and pass correct project type to form. - WorkOrderCard & AssignmentDetail: optional chaining for status, use correct selected IDs for modals, and ensure ManageTeam receives real assignment id. - ManageTeam: update data shape (field renames: fullname, position, start_date, end_date, status strings), change PUT endpoint for updating assignment user, improve empty-state copy and avatar/fallback handling, adjust status select values. - UpdateTimelineStatus: remove unused form, adjust payload mapping, make dialog scrollable, tweak layout and textarea sizing. - AssignmentTable & ClientDetail table: adjust column widths, truncation classes, and use assignment.end_user where appropriate. - Small UX/cleanup: hide category filter on HomeTask, comment out end_user in FormClient, minor spacing/formatting cleanups, and a temporary console.log in page.tsx. These changes improve UI consistency, add explicit end-user handling across forms, harden status access with optional chaining, and align API usages and data shapes for team/status operations.
This commit is contained in:
@@ -13,12 +13,12 @@ import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import Link from 'next/link';
|
||||
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/UpdateTimelineStatus';
|
||||
import BadgeStatus from '@/components/ui/badge-status';
|
||||
import FilterComponent from '../../../component/FilterComponent';
|
||||
import { ConfirmDeleteWithInput } from '@/components/modal/ConfirmDeleteWithInput';
|
||||
import UpdateTimelineStatus from '../../../component/UpdateTimelineStatus';
|
||||
import { ManageTeam } from '../../../component/ManageTeam';
|
||||
|
||||
interface Props {
|
||||
clientId: string;
|
||||
@@ -84,7 +84,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
|
||||
: viewMode === 'grid' ?
|
||||
/* --- GRID VIEW --- */
|
||||
<div className="grid gap-4">
|
||||
<div className="grid grid-cols-2 gap-8 auto-rows-fr h-full">
|
||||
{assignmentLists.map((assignment) => {
|
||||
const isProject = assignment.wo_name
|
||||
|
||||
@@ -93,12 +93,12 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
const assignmentStartDate = assignment.wo_start_date || assignment.im_start_date
|
||||
const assignmentEndDate = assignment.wo_end_date || assignment.im_end_date
|
||||
const assignmentDesc = assignment.wo_description || assignment.im_description
|
||||
const assignmentStatus = assignment.project?.status || assignment.project_status.name
|
||||
const assignmentStatus = assignment.project?.status || assignment.project_status?.name
|
||||
|
||||
return (
|
||||
<motion.div key={assignment.id} initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }}>
|
||||
<Link href={`${clientId}/${assignment.id}`}>
|
||||
<Card900 key={assignment.id} className="group hover:border-primary/30 transition-all duration-300 hover:scale-101">
|
||||
<motion.div key={assignment.id} initial={{ opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} className="h-full">
|
||||
<Link href={`${clientId}/${assignment.id}`} className='h-full'>
|
||||
<Card900 key={assignment.id} className="h-full group hover:border-primary/30 transition-all duration-300 hover:scale-101">
|
||||
<CardContent className="py-4">
|
||||
<div className="flex items-start justify-between gap-4">
|
||||
<div className="flex items-start gap-4">
|
||||
@@ -109,7 +109,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
<div className="flex flex-col sm:flex-row items-start sm:items-center gap-3 mb-1">
|
||||
<h3 className="font-bold text-xl">{assignmentName}</h3>
|
||||
{!isProject ? <Badge variant={'info'}>{assignmentType}</Badge> : null}
|
||||
<BadgeStatus status={assignmentStatus} />
|
||||
{assignmentStatus ? <BadgeStatus status={assignmentStatus} /> : null}
|
||||
</div>
|
||||
|
||||
{assignment.wo_name &&
|
||||
@@ -143,7 +143,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
<div key={key}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
<LazyImage src={user?.user.avatar ? `${process.env.BASE_URL_IMG}/${user?.user.avatar}` : '/assets/no-avatar.jpg'} alt={user?.user.fullname!} className="w-6 h-6 rounded-full border-2 border-background cursor-help hover:scale-110 hover:z-10 transition-transform" />
|
||||
<LazyImage src={user?.user.avatar ? `${process.env.BASE_URL_IMG}/${user?.user.avatar}` : '/assets/no-avatar.jpg'} alt={user?.user.fullname!} className="w-7 h-7 rounded-full border-2 border-background cursor-help hover:scale-110 hover:z-10 transition-transform" />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<div className="text-xs">
|
||||
@@ -185,7 +185,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
<Link href={`${clientId}/project-assignments?is_edit=true&assignment_id=${assignment.id}`}>Edit Assignment</Link>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={(e) => e.stopPropagation()} onSelect={() => { setSelectedData(assignment); setAction('MANAGE_EMPLOYEE') }}>Manage Team</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={(e) => e.stopPropagation()} onSelect={() => { setSelectedData(assignment); setAction('UPDATE_STATUS') }}>Update Assignment Status</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={(e) => e.stopPropagation()} onSelect={() => { setSelectedData(assignment); setAction('UPDATE_STATUS') }}>Update Status</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={(e) => e.stopPropagation()} onSelect={() => { setSelectedData(assignment); setAction('DELETE') }} className="text-destructive">Delete</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
@@ -205,6 +205,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
<Table>
|
||||
<TableHeader className="bg-accent/50">
|
||||
<TableRow>
|
||||
<TableHead className="min-w-25">End User</TableHead>
|
||||
<TableHead className="min-w-50">IM Name</TableHead>
|
||||
<TableHead>IM Code</TableHead>
|
||||
<TableHead className="min-w-50">Description</TableHead>
|
||||
@@ -230,6 +231,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
{assignmentLists.map((assignment) => {
|
||||
return (
|
||||
<TableRow key={assignment.id}>
|
||||
<TableCell className="font-medium">{assignment.end_user?.name}</TableCell>
|
||||
<TableCell className="font-medium">{assignment.im_name}</TableCell>
|
||||
<TableCell>{assignment.im_code || ''}</TableCell>
|
||||
<TableCell className="max-w-75 truncate" title={assignment.im_description}>
|
||||
@@ -296,7 +298,7 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<BadgeStatus status={assignment.project?.status || assignment.project_status.name} />
|
||||
<BadgeStatus status={assignment.project?.status || assignment.project_status?.name} />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<DropdownMenu>
|
||||
@@ -335,12 +337,12 @@ export default function ClientDetailComponent({ clientId, assignmentLists }: Pro
|
||||
}
|
||||
|
||||
{action === 'MANAGE_EMPLOYEE' ?
|
||||
<ManageEmployee assignmentId={1} onCancel={handleClose} onSuccess={handleSuccess} />
|
||||
<ManageTeam assignmentId={selectedData?.id!} onClose={handleClose} />
|
||||
: null
|
||||
}
|
||||
|
||||
{action === 'UPDATE_STATUS' ?
|
||||
<FormUpdateStatus data={selectedData!} title={selectedData?.wo_name || selectedData?.im_name} onCancel={handleClose} onSuccess={handleSuccess} />
|
||||
<UpdateTimelineStatus assignmentId={selectedData?.id!} onClose={handleClose} />
|
||||
: null
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ export default async function ClientDetailPage({ params, searchParams }: Props)
|
||||
|
||||
const [client, assignmentList] = await Promise.all([getClientById, getAssignmentsByClient]);
|
||||
|
||||
console.log(client)
|
||||
|
||||
if (!client) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center h-[60vh] space-y-4">
|
||||
@@ -105,7 +107,7 @@ export default async function ClientDetailPage({ params, searchParams }: Props)
|
||||
</Button>
|
||||
</Link>
|
||||
<h1 className="text-xl sm:text-4xl font-bold tracking-tight">{client.name}</h1>
|
||||
<p className="text-sm sm:text-lg text-muted-foreground">End User: {client.end_user_name}</p>
|
||||
<p className="text-sm sm:text-lg text-muted-foreground">{client?.description || 'No description available for this client!'}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
@@ -117,18 +119,19 @@ export default async function ClientDetailPage({ params, searchParams }: Props)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-8 lg:grid-cols-3">
|
||||
<ClientDetailComponent
|
||||
clientId={client_id}
|
||||
assignmentLists={filterData()}
|
||||
/>
|
||||
{/* <div className="grid gap-8 lg:grid-cols-3">
|
||||
|
||||
{/* --- INTERACTIVE CLIENT COMPONENT (Grid/Table & Modals) --- */}
|
||||
<div className="lg:col-span-2 space-y-6">
|
||||
{/* Pass the server-fetched data as props */}
|
||||
<ClientDetailComponent
|
||||
clientId={client_id}
|
||||
assignmentLists={filterData()}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* --- STATIC SERVER SIDEBAR --- */}
|
||||
<div className="space-y-6">
|
||||
<Card900>
|
||||
<CardHeader>
|
||||
@@ -171,7 +174,7 @@ export default async function ClientDetailPage({ params, searchParams }: Props)
|
||||
</CardContent>
|
||||
</Card900>
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+3
-3
@@ -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/UpdateTimelineStatus';
|
||||
import BadgeStatus from '@/components/ui/badge-status';
|
||||
import Link from 'next/link';
|
||||
import AssignedPeople from '../project-detail/[project_id]/AssignedPeople';
|
||||
import { ManageTeam } from '../../../component/ManageTeam';
|
||||
import UpdateTimelineStatus from '../../../component/UpdateTimelineStatus';
|
||||
|
||||
interface Props {
|
||||
client: IClient | undefined;
|
||||
@@ -39,7 +39,7 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
const assignmentStartDate = assignment.wo_start_date || assignment.im_start_date
|
||||
const assignmentEndDate = assignment.wo_end_date || assignment.im_end_date
|
||||
const assignmentDesc = assignment.wo_description || assignment.im_description
|
||||
const assignmentStatus = assignment.project?.status || assignment.project_status.name
|
||||
const assignmentStatus = assignment.project?.status || assignment.project_status?.name
|
||||
|
||||
const handleClose = () => {
|
||||
setSelectedData(undefined)
|
||||
@@ -235,7 +235,7 @@ export default function AssignmentDetail({ client, initialAssignment: assignment
|
||||
</motion.div>
|
||||
|
||||
{action === 'UPDATE_STATUS' ?
|
||||
<FormUpdateStatus assignmentId={1} onClose={handleClose} />
|
||||
<UpdateTimelineStatus assignmentId={1} onClose={handleClose} />
|
||||
: null
|
||||
}
|
||||
|
||||
|
||||
+67
-25
@@ -5,7 +5,7 @@ import { useRouter } from 'next/navigation';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { motion, AnimatePresence } from 'motion/react';
|
||||
import { ArrowLeft, ArrowRight, Save, Briefcase, Clock, Search, Check } from 'lucide-react';
|
||||
import { ArrowLeft, ArrowRight, Save, Briefcase, Clock, Search, Check, CheckCircle, Plus } from 'lucide-react';
|
||||
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -25,11 +25,16 @@ import { toast } from 'sonner';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import * as yup from 'yup';
|
||||
import { IClient } from '../../../types';
|
||||
import { IClient, IEndUser } from '../../../types';
|
||||
import { serverApiCall } from '@/lib/server-api';
|
||||
import dayjs from 'dayjs';
|
||||
import PageLoading from '@/components/loader/PageLoading';
|
||||
import { IProjectAssignment } from '../../../type.assignment';
|
||||
import { useFetchWithAxios } from '@/lib/axios/useFetch';
|
||||
import { ComboboxCustomUI } from '@/components/ui/combobox-custom-ui';
|
||||
import { LazyImage } from '@/components/ui/lazy-image';
|
||||
import FormEndUser from '../../../component/FormEndUser';
|
||||
import { IProject } from '../../../type.project';
|
||||
|
||||
type IStep = 'type' | 'details' | 'work-orders' | 'review';
|
||||
|
||||
@@ -37,6 +42,7 @@ export const assignmentSchema = yup.object({
|
||||
type: yup.string().oneOf(['Project', 'IM']).required('Project type is required'),
|
||||
|
||||
// Details Step
|
||||
end_user_id: yup.number().required('End user is required'),
|
||||
name: yup.string().required('Assignment name is required'),
|
||||
code: yup.string().required('Project code is required'),
|
||||
year: yup.string().required('Year is required'),
|
||||
@@ -61,18 +67,19 @@ export const assignmentSchema = yup.object({
|
||||
// Infer the TypeScript type from the Yup schema
|
||||
export type AssignmentFormValues = yup.InferType<typeof assignmentSchema>;
|
||||
|
||||
export default function CreateAssignmentForm({ client, clientId, projectList, isEdit, assignmentId }: { client: IClient, projectList: IProjectAssignment[], clientId: string, isEdit?: boolean, assignmentId?: string }) {
|
||||
export default function CreateAssignmentForm({ client, clientId, projectList, isEdit, assignmentId }: { client: IClient, projectList: IProject[], clientId: string, isEdit?: boolean, assignmentId?: string }) {
|
||||
const [existAssignment, setIsExistAssignment] = useState<IProjectAssignment | null>(null)
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const [step, setStep] = useState<IStep>('type');
|
||||
const [loading, setIsLoading] = useState(false);
|
||||
const [isFullLoading, setIsFullLoading] = useState(false)
|
||||
const [isExistProject, setIsExistProject] = useState(false)
|
||||
const [openProjectSearch, setOpenProjectSearch] = useState(false);
|
||||
const [showEndUserForm, setShowEndUserForm] = useState(false)
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const { data: endUserList, mutate } = useFetchWithAxios('/end-user')
|
||||
|
||||
// 1. Initialize React Hook Form
|
||||
const form = useForm<AssignmentFormValues>({
|
||||
resolver: yupResolver(assignmentSchema),
|
||||
defaultValues: {
|
||||
@@ -90,7 +97,6 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
mode: "onChange"
|
||||
});
|
||||
|
||||
// Watch values for dynamic UI rendering
|
||||
const assignmentType = form.watch('type');
|
||||
const formValues = form.watch();
|
||||
|
||||
@@ -111,11 +117,11 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
setIsFullLoading(true)
|
||||
const res: any = await serverApiCall('GET', `/project-assignment/${assignmentId}`)
|
||||
|
||||
setIsFullLoading(false)
|
||||
if (res.success) {
|
||||
const data: IProjectAssignment = res.data.data
|
||||
form.setValue('type', data.project?.code ? 'Project' : 'IM')
|
||||
form.setValue('name', data.project?.name || data.im_name)
|
||||
form.setValue('end_user_id', data.end_user.id)
|
||||
form.setValue('code', data.project?.code || data.im_code)
|
||||
form.setValue('year', data.project?.year || data.im_year)
|
||||
form.setValue('startDate', data.project?.start_date || data.im_start_date)
|
||||
@@ -136,6 +142,7 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
description: `(${res.code || '-'}) ${res.message}`
|
||||
})
|
||||
}
|
||||
setIsFullLoading(false)
|
||||
}
|
||||
|
||||
getAssignmentDetail()
|
||||
@@ -165,13 +172,12 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
else if (step === 'review') setStep(assignmentType === 'Project' ? 'work-orders' : 'details');
|
||||
};
|
||||
|
||||
// 4. Submission
|
||||
const onSubmit = async (payload: AssignmentFormValues) => {
|
||||
setIsLoading(true);
|
||||
|
||||
const newPayload = {
|
||||
"client_id": Number(clientId),
|
||||
"end_user_id": Number(client.end_user_id),
|
||||
"end_user_id": Number(payload.end_user_id),
|
||||
"im_code": assignmentType === 'IM' ? payload.code : isEdit ? existAssignment?.im_code : "",
|
||||
"im_name": assignmentType === 'IM' ? payload.name : isEdit ? existAssignment?.im_name : "",
|
||||
"im_year": assignmentType === 'IM' ? Number(payload.year) : isEdit ? existAssignment?.im_year : 2026,
|
||||
@@ -197,8 +203,6 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
"note": isEdit ? existAssignment?.note : "",
|
||||
}
|
||||
|
||||
console.log(newPayload)
|
||||
|
||||
let res: any
|
||||
if (isEdit) {
|
||||
res = await serverApiCall('PUT', `/project-assignment/${assignmentId}`, newPayload)
|
||||
@@ -348,20 +352,20 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
<CommandItem
|
||||
key={p.id}
|
||||
onSelect={() => {
|
||||
form.setValue('name', p.project?.name!, { shouldValidate: true });
|
||||
form.setValue('code', p.project?.code!, { shouldValidate: true });
|
||||
form.setValue('year', p.project?.year!, { shouldValidate: true });
|
||||
form.setValue('startDate', new Date(p.project?.start_date!), { shouldValidate: true });
|
||||
form.setValue('endDate', new Date(p.project?.end_date!), { shouldValidate: true });
|
||||
form.setValue('description', p.project?.description!, { shouldValidate: true });
|
||||
form.setValue('name', p.name!, { shouldValidate: true });
|
||||
form.setValue('code', p.code!, { shouldValidate: true });
|
||||
form.setValue('year', String(p.year), { shouldValidate: true });
|
||||
form.setValue('startDate', new Date(p.start_date!), { shouldValidate: true });
|
||||
form.setValue('endDate', new Date(p.end_date!), { shouldValidate: true });
|
||||
form.setValue('description', p.description!, { shouldValidate: true });
|
||||
|
||||
setOpenProjectSearch(false);
|
||||
setIsExistProject(true)
|
||||
toast.info(`Autofilled details from ${p.project?.name}`);
|
||||
toast.info(`Autofilled details from ${p.name}`);
|
||||
}}
|
||||
>
|
||||
<Check className={cn("mr-2 h-4 w-4", field.value === p.project?.name ? "opacity-100" : "opacity-0")} />
|
||||
{p?.project?.name!}
|
||||
<Check className={cn("mr-2 h-4 w-4", field.value === p.name ? "opacity-100" : "opacity-0")} />
|
||||
{p?.name!}
|
||||
</CommandItem>
|
||||
))}
|
||||
</CommandGroup>
|
||||
@@ -378,6 +382,46 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField control={form.control} name='end_user_id'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>End User</FormLabel>
|
||||
<FormControl>
|
||||
<div className="flex gap-4">
|
||||
<ComboboxCustomUI options={endUserList && endUserList.length > 0 ? endUserList.map((item: IEndUser) => ({ label: item.name, value: item.id, originalData: item })) : []}
|
||||
value={field.value} onChange={field.onChange} placeholder='Select end user' className='shrink'
|
||||
|
||||
// --- CUSTOM DROPDOWN OPTIONS ---
|
||||
renderOption={(option, isSelected) => {
|
||||
const user = option.originalData as IEndUser;
|
||||
return (
|
||||
<div className={`flex items-center justify-between w-full py-1 rounded-sm ${isSelected ? 'bg-zinc-800' : ''}`}>
|
||||
<div className="flex items-center gap-3">
|
||||
<LazyImage className='w-10 h-10 rounded-md border border-border' alt={user.name} src={user.photo ? `${process.env.BASE_URL_IMG}/${user.photo}` : '/assets/ilustration.png'} />
|
||||
<div className="flex flex-col">
|
||||
<span className={`text-sm ${isSelected ? 'font-bold text-primary' : ''}`}>
|
||||
{user.name}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground truncate">
|
||||
{user.description}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{isSelected && <CheckCircle className="h-5 w-5 -translate-x-2" />}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<Button type="button" variant="outline" size="icon" onClick={() => setShowEndUserForm(true)}>
|
||||
<Plus className="w-4 h-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="grid md:grid-cols-2 gap-4">
|
||||
<FormField control={form.control} name="code" disabled={isExistProject} render={({ field }) => (
|
||||
<FormItem>
|
||||
@@ -572,9 +616,6 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
Back
|
||||
</Button>
|
||||
|
||||
{/* <Button type="button" className="gap-2" onClick={handleNext}>
|
||||
Next Step <ArrowRight className="w-4 h-4" />
|
||||
</Button> */}
|
||||
<div className="flex gap-4">
|
||||
{step !== 'review' ?
|
||||
<Button key="next-btn" type="button" className="gap-2" onClick={handleNext}>
|
||||
@@ -590,6 +631,7 @@ export default function CreateAssignmentForm({ client, clientId, projectList, is
|
||||
</form>
|
||||
</Form>
|
||||
|
||||
{showEndUserForm ? <FormEndUser onCancel={() => setShowEndUserForm(false)} onSuccess={() => { mutate(); setShowEndUserForm(false) }} /> : null}
|
||||
{isFullLoading ? <PageLoading /> : null}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import fetchData from "@/lib/fetchData";
|
||||
import ProjectAssignmentForm from "./ProjectAssignmentForm";
|
||||
import { IProjectAssignment } from "../../../type.assignment";
|
||||
|
||||
type Props = {
|
||||
params: Promise<{ client_id: string }>
|
||||
@@ -13,14 +12,14 @@ export default async function CreateAssignmentPage({ params, searchParams }: Pro
|
||||
const assignmentId = (await searchParams)!.assignment_id
|
||||
|
||||
const getClient = fetchData(`/client/${client_id}`)
|
||||
const getProjectByClient = fetchData(`/client/project-assignment/${client_id}`)
|
||||
const getProjectByClient = fetchData(`/client/project/${client_id}`)
|
||||
|
||||
const [clientRes, projectList] = await Promise.all([getClient, getProjectByClient]);
|
||||
const client = clientRes && clientRes.length > 0 ? clientRes[0] : clientRes
|
||||
|
||||
return (
|
||||
<div className="max-w-4xl mx-auto p-6 sm:p-8 pt-6 pb-20">
|
||||
<ProjectAssignmentForm client={client} clientId={client_id} projectList={projectList && projectList.length > 0 ? projectList.filter((item: IProjectAssignment) => item.project?.name) : []}
|
||||
<ProjectAssignmentForm client={client} clientId={client_id} projectList={projectList && projectList.length > 0 ? projectList : []}
|
||||
isEdit={isEdit ? true : false} assignmentId={assignmentId as any}
|
||||
/>
|
||||
</div>
|
||||
|
||||
+4
-3
@@ -11,6 +11,7 @@ import { IProjectAssignment } from '@/app/(dashboard)/task/type.assignment';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import FormUpdateStatus from '@/app/(dashboard)/task/component/UpdateTimelineStatus';
|
||||
import ManageEmployee from '@/app/(dashboard)/task/component/AddTeam';
|
||||
import UpdateTimelineStatus from '@/app/(dashboard)/task/component/UpdateTimelineStatus';
|
||||
|
||||
interface WorkOrderCardProps {
|
||||
workOrder: IProjectAssignment;
|
||||
@@ -55,7 +56,7 @@ const WorkOrderCard = ({ workOrder, index, defaultOpen = false }: WorkOrderCardP
|
||||
<h3 className="text-base sm:text-xl font-bold text-foreground wrap-break-word flex-1 min-w-0">
|
||||
{workOrder.wo_name}
|
||||
</h3>
|
||||
<BadgeStatus status={workOrder.project_status.name} />
|
||||
<BadgeStatus status={workOrder.project_status?.name} />
|
||||
</div>
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-1.5 sm:gap-3 text-muted-foreground sm:flex-wrap">
|
||||
<span className="inline-flex items-center gap-1.5 font-mono">
|
||||
@@ -144,12 +145,12 @@ const WorkOrderCard = ({ workOrder, index, defaultOpen = false }: WorkOrderCardP
|
||||
</Card900>
|
||||
|
||||
{action === 'UPDATE_STATUS' ?
|
||||
<FormUpdateStatus data={selectedData} title={selectedData?.wo_name!} onCancel={handleClose} onSuccess={handleSuccess} />
|
||||
<UpdateTimelineStatus assignmentId={selectedData?.id!} onClose={handleClose} />
|
||||
: null
|
||||
}
|
||||
|
||||
{action === 'MANAGE_EMPLOYEE' ?
|
||||
<ManageEmployee assignmentId={1} onCancel={handleClose} onSuccess={handleSuccess} />
|
||||
<ManageEmployee assignmentId={selectedData?.id!} onCancel={handleClose} onSuccess={handleSuccess} />
|
||||
: null
|
||||
}
|
||||
</>
|
||||
|
||||
@@ -48,8 +48,8 @@ export default async function ProjectDetailPage({ params, searchParams }: Props)
|
||||
|
||||
// Aggregate stats
|
||||
const totalWorkOrders = project.project_assignment.length;
|
||||
const completedWO = project.project_assignment.filter((wo: any) => COMPLETE_STATUS_LIST.includes(wo.project_status.name.toUpperCase())).length;
|
||||
const inProgressWO = project.project_assignment.filter((wo: any) => ONPROGRESS_STATUS_LIST.includes(wo.project_status.name.toUpperCase())).length;
|
||||
const completedWO = project.project_assignment.filter((wo: any) => COMPLETE_STATUS_LIST.includes(wo.project_status?.name?.toUpperCase())).length;
|
||||
const inProgressWO = project.project_assignment.filter((wo: any) => ONPROGRESS_STATUS_LIST.includes(wo.project_status?.name?.toUpperCase())).length;
|
||||
const totalAssigned = new Set(
|
||||
project.project_assignment.flatMap((wo: any) =>
|
||||
wo.project_assignment_work_order_detail.map((p: any) => p.id),
|
||||
|
||||
@@ -16,7 +16,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { serverApiCall } from '@/lib/server-api';
|
||||
import { toast } from 'sonner';
|
||||
import { Combobox } from '@/components/ui/combobox-custom-ui';
|
||||
import { ComboboxCustomUI } from '@/components/ui/combobox-custom-ui';
|
||||
|
||||
type Props = {
|
||||
assignmentId: number;
|
||||
@@ -26,7 +26,7 @@ type Props = {
|
||||
};
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
user: Yup.number().required('Please select at least one user'),
|
||||
user_id: Yup.number().required('Please select at least one user'),
|
||||
});
|
||||
|
||||
type FormDataType = Yup.InferType<typeof validationSchema>;
|
||||
@@ -48,7 +48,7 @@ const AddTeam: FC<Props> = ({ assignmentId, existingTeam, onCancel, onSuccess })
|
||||
const submitPayload = {
|
||||
data: [{
|
||||
"project_assignment_id": assignmentId,
|
||||
"user_id": payload.user,
|
||||
"user_id": payload.user_id,
|
||||
"start_date": '',
|
||||
"end_date": ''
|
||||
}]
|
||||
@@ -96,12 +96,12 @@ const AddTeam: FC<Props> = ({ assignmentId, existingTeam, onCancel, onSuccess })
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
<div className="grid grid-cols-1 gap-4 mb-6">
|
||||
<FormField control={form.control} name='user'
|
||||
<FormField control={form.control} name='user_id'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Employee to Assign <span className='text-red-600 font-bold'>*</span></FormLabel>
|
||||
<FormControl>
|
||||
<Combobox options={mappedUsers} value={field.value} onChange={field.onChange} placeholder='Select user to assign'
|
||||
<ComboboxCustomUI options={mappedUsers} value={field.value} onChange={field.onChange} placeholder='Select user to assign'
|
||||
// --- CUSTOM DROPDOWN OPTIONS ---
|
||||
renderOption={(option, isSelected) => {
|
||||
const user = option.originalData as IUser;
|
||||
|
||||
@@ -29,28 +29,28 @@ export default function AssignmentTable({ data }: { data: IProjectAssignment[] }
|
||||
<Table>
|
||||
<TableHeader className="bg-accent/50">
|
||||
<TableRow>
|
||||
<TableHead className="min-w-[150px]">Client</TableHead>
|
||||
<TableHead className="min-w-[120px]">End User</TableHead>
|
||||
<TableHead className="min-w-[200px]">IM Name</TableHead>
|
||||
<TableHead className="min-w-37.5">Client</TableHead>
|
||||
<TableHead className="min-w-30">End User</TableHead>
|
||||
<TableHead className="min-w-50">IM Name</TableHead>
|
||||
<TableHead>IM Code</TableHead>
|
||||
<TableHead className="min-w-[200px]">Description</TableHead>
|
||||
<TableHead className="min-w-50">Description</TableHead>
|
||||
<TableHead>IM Year</TableHead>
|
||||
<TableHead>IM Start</TableHead>
|
||||
<TableHead>IM End</TableHead>
|
||||
<TableHead className="min-w-[200px]">Project Name</TableHead>
|
||||
<TableHead className="min-w-50">Project Name</TableHead>
|
||||
<TableHead>Project Code</TableHead>
|
||||
<TableHead className="min-w-[200px]">Description</TableHead>
|
||||
<TableHead className="min-w-50">Description</TableHead>
|
||||
<TableHead>Year</TableHead>
|
||||
<TableHead>Proj Start</TableHead>
|
||||
<TableHead>Proj End</TableHead>
|
||||
<TableHead className="min-w-[150px]">Work Order</TableHead>
|
||||
<TableHead className="min-w-37.5">Work Order</TableHead>
|
||||
<TableHead>WO Code</TableHead>
|
||||
<TableHead>WO Start</TableHead>
|
||||
<TableHead>WO End</TableHead>
|
||||
<TableHead>Last Status</TableHead>
|
||||
<TableHead>Status Remarks</TableHead>
|
||||
<TableHead>Team</TableHead>
|
||||
<TableHead className="w-[50px]"></TableHead>
|
||||
<TableHead className="w-12.5"></TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@@ -62,10 +62,10 @@ export default function AssignmentTable({ data }: { data: IProjectAssignment[] }
|
||||
{assignment.client?.name}
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell className="font-bold text-primary">{assignment.client?.end_user?.name}</TableCell>
|
||||
<TableCell className="font-bold text-primary">{assignment.end_user.name}</TableCell>
|
||||
<TableCell className="font-medium">{assignment.im_name}</TableCell>
|
||||
<TableCell>{assignment.im_code || ''}</TableCell>
|
||||
<TableCell className="max-w-[300px] truncate" title={assignment.im_description}>
|
||||
<TableCell className="max-w-74 truncate" title={assignment.im_description}>
|
||||
{assignment.im_description}
|
||||
</TableCell>
|
||||
<TableCell>{assignment.im_year || ''}</TableCell>
|
||||
@@ -81,7 +81,7 @@ export default function AssignmentTable({ data }: { data: IProjectAssignment[] }
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell>{assignment.project?.code || ''}</TableCell>
|
||||
<TableCell className="max-w-[300px] truncate" title={assignment.project?.description}>
|
||||
<TableCell className="max-w-75 truncate" title={assignment.project?.description}>
|
||||
{assignment.project?.description}
|
||||
</TableCell>
|
||||
<TableCell>{assignment.project?.year || ''}</TableCell>
|
||||
@@ -100,7 +100,7 @@ export default function AssignmentTable({ data }: { data: IProjectAssignment[] }
|
||||
{assignment.wo_end_date ? new Date(assignment.wo_end_date).toLocaleDateString() : ''}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<BadgeStatus status={assignment.project?.status || assignment.project_status.name} />
|
||||
<BadgeStatus status={assignment.project?.status || assignment.project_status?.name} />
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{assignment.project_assignment_status_detail[0]?.status_remarks}
|
||||
|
||||
@@ -29,7 +29,6 @@ export default function ClientGrid({ clients }: { clients: IClient[] }) {
|
||||
setShowSelectedData(undefined)
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
{clients.length === 0 ?
|
||||
|
||||
@@ -23,7 +23,7 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
name: Yup.string().required(),
|
||||
end_user_id: Yup.number().required(),
|
||||
// end_user_id: Yup.number().required(),
|
||||
description: Yup.string().optional().default(''),
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ const FormClient: FC<Props> = ({ data, onSuccess, onCancel }) => {
|
||||
resolver: yupResolver(validationSchema),
|
||||
defaultValues: {
|
||||
"name": data?.name || '',
|
||||
"end_user_id": data?.end_user_id || undefined,
|
||||
// "end_user_id": data?.end_user_id || undefined,
|
||||
"description": data?.description || '',
|
||||
},
|
||||
});
|
||||
@@ -181,7 +181,7 @@ const FormClient: FC<Props> = ({ data, onSuccess, onCancel }) => {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField control={form.control} name='end_user_id'
|
||||
{/* <FormField control={form.control} name='end_user_id'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>End User <span className='text-red-600 font-bold'>*</span></FormLabel>
|
||||
@@ -196,7 +196,7 @@ const FormClient: FC<Props> = ({ data, onSuccess, onCancel }) => {
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
/> */}
|
||||
<FormField control={form.control} name='description'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
|
||||
@@ -64,7 +64,7 @@ export default function HomeTask({ currentView }: ShellProps) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<FilterComponent />
|
||||
<FilterComponent hideCategory />
|
||||
|
||||
{showForm && <FormClient onCancel={() => setShowForm(false)} onSuccess={() => { setShowForm(false); router.refresh() }} />}
|
||||
</>
|
||||
|
||||
@@ -27,17 +27,15 @@ import { toast } from "sonner";
|
||||
import { serverApiCall } from "@/lib/server-api";
|
||||
|
||||
|
||||
export type AssignmentStatus = "pending" | "in_progress" | "completed";
|
||||
|
||||
export interface ITableData {
|
||||
id: string;
|
||||
name: string;
|
||||
fullname: string;
|
||||
email: string;
|
||||
avatar: string;
|
||||
position: string;
|
||||
start_date_assign: string;
|
||||
end_date_assign: string;
|
||||
status: AssignmentStatus;
|
||||
position: any;
|
||||
start_date: string;
|
||||
end_date: string;
|
||||
status: string
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +54,8 @@ export function ManageTeam({ assignmentId, onClose }: { assignmentId: number, on
|
||||
setEditingId(row.id);
|
||||
|
||||
setDraftData({
|
||||
start_date_assign: row.start_date_assign,
|
||||
end_date_assign: row.end_date_assign,
|
||||
start_date: row.start_date,
|
||||
end_date: row.end_date,
|
||||
status: row.status,
|
||||
});
|
||||
};
|
||||
@@ -68,12 +66,12 @@ export function ManageTeam({ assignmentId, onClose }: { assignmentId: number, on
|
||||
const submitPayload = {
|
||||
"project_assignment_id": assignmentId,
|
||||
"status": draftData.status,
|
||||
"start_date": draftData.start_date_assign ? new Date(draftData.start_date_assign).toISOString() : '',
|
||||
"end_date": draftData.end_date_assign ? new Date(draftData.end_date_assign).toISOString() : '',
|
||||
"start_date": draftData.start_date ? new Date(draftData.start_date).toISOString() : '',
|
||||
"end_date": draftData.end_date ? new Date(draftData.end_date).toISOString() : '',
|
||||
}
|
||||
|
||||
console.log(submitPayload)
|
||||
const res = await serverApiCall('PUT', `/project-assignment/assign-user/${draftData.id}`, submitPayload)
|
||||
const res = await serverApiCall('PUT', `/project-assignment/assign-user/update/${draftData.id}`, submitPayload)
|
||||
|
||||
setIsSaving(false);
|
||||
if (res.success) {
|
||||
@@ -138,9 +136,9 @@ export function ManageTeam({ assignmentId, onClose }: { assignmentId: number, on
|
||||
:
|
||||
existUserAssign.length === 0 ?
|
||||
<TableRow>
|
||||
<TableCell colSpan={5} className="w-full h-32">
|
||||
<div className="text-center text-muted-foreground flex flex-col items-center justify-center gap-2">
|
||||
No team members have been added yet. Create a team to get started with project assignments
|
||||
<TableCell colSpan={5} className="w-full py-6">
|
||||
<div className="text-center text-muted-foreground flex flex-col items-center justify-center gap-4">
|
||||
No team members have been added yet.<br />Create a team to get started with project assignments
|
||||
<Button variant='outline' className="w-max" onClick={() => setShowAddTeamDialog(true)}><UserPlus /> Add Team</Button>
|
||||
</div>
|
||||
</TableCell>
|
||||
@@ -155,13 +153,13 @@ export function ManageTeam({ assignmentId, onClose }: { assignmentId: number, on
|
||||
<TableCell>
|
||||
<div className="flex items-center gap-3">
|
||||
<Avatar className="h-9 w-9">
|
||||
<AvatarImage src={row.avatar} alt={row.name} />
|
||||
<AvatarFallback>{row.name.charAt(0)}</AvatarFallback>
|
||||
<AvatarImage src={row.avatar} alt={row.fullname} />
|
||||
<AvatarFallback>{row.fullname?.charAt(0)}</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="flex flex-col">
|
||||
<div className="flex items-center gap-1">
|
||||
<span className="font-medium text-sm leading-none">{row.name}</span>
|
||||
<Badge variant="secondary" className="ml-auto">{row.position}</Badge>
|
||||
<span className="font-medium text-sm leading-none">{row.fullname}</span>
|
||||
<Badge variant="secondary" className="ml-auto">{row.position?.name}</Badge>
|
||||
</div>
|
||||
<span className="text-xs text-muted-foreground mt-1">{row.email}</span>
|
||||
</div>
|
||||
@@ -170,17 +168,17 @@ export function ManageTeam({ assignmentId, onClose }: { assignmentId: number, on
|
||||
|
||||
<TableCell>
|
||||
{isEditing ?
|
||||
<DatePicker date={draftData.start_date_assign as Date | undefined} setDate={(date) => handleDraftChange("start_date_assign", date as any)} />
|
||||
<DatePicker date={draftData.start_date as Date | undefined} setDate={(date) => handleDraftChange("start_date", date as any)} />
|
||||
:
|
||||
<span className="text-sm">{row.start_date_assign}</span>
|
||||
<span className="text-sm">{row.start_date}</span>
|
||||
}
|
||||
</TableCell>
|
||||
|
||||
<TableCell>
|
||||
{isEditing ?
|
||||
<DatePicker date={draftData.end_date_assign as Date | undefined} setDate={(date) => handleDraftChange("end_date_assign", date as any)} />
|
||||
<DatePicker date={draftData.end_date as Date | undefined} setDate={(date) => handleDraftChange("end_date", date as any)} />
|
||||
:
|
||||
<span className="text-sm">{row.end_date_assign}</span>
|
||||
<span className="text-sm">{row.end_date}</span>
|
||||
}
|
||||
</TableCell>
|
||||
|
||||
@@ -191,9 +189,8 @@ export function ManageTeam({ assignmentId, onClose }: { assignmentId: number, on
|
||||
<SelectValue placeholder="Select status" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="pending">Active</SelectItem>
|
||||
<SelectItem value="in_progress">In Active</SelectItem>
|
||||
<SelectItem value="completed">Completed</SelectItem>
|
||||
<SelectItem value="ACTIVE">Active</SelectItem>
|
||||
<SelectItem value="INACTIVE">In Active</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
:
|
||||
|
||||
@@ -19,13 +19,6 @@ import {
|
||||
} from "@/components/ui/table";
|
||||
import BadgeStatus from '@/components/ui/badge-status';
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
project_status_id: Yup.string().required(),
|
||||
date: Yup.date().required('Date is required'),
|
||||
note: Yup.string().optional().default(''),
|
||||
});
|
||||
|
||||
type FormDataType = Yup.InferType<typeof validationSchema>;
|
||||
|
||||
type Props = {
|
||||
assignmentId: string | number
|
||||
@@ -39,10 +32,6 @@ const UpdateTimelineStatus: FC<Props> = ({ assignmentId, onClose }) => {
|
||||
|
||||
const { data: existTimeline, isLoading: isLoadingTimeline, mutate } = useFetchWithAxios(`project-assignment/status-detail/${assignmentId}`)
|
||||
|
||||
const form = useForm<FormDataType>({
|
||||
resolver: yupResolver(validationSchema),
|
||||
});
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const handleEdit = (row: any) => {
|
||||
@@ -60,7 +49,7 @@ const UpdateTimelineStatus: FC<Props> = ({ assignmentId, onClose }) => {
|
||||
setIsSaving(true);
|
||||
|
||||
const submitPayload = {
|
||||
"project_status_id": Number(draftData.project_status_id),
|
||||
"project_status_id": Number(draftData.id),
|
||||
"start_date": draftData.start_date_assign ? new Date(draftData.start_date_assign).toISOString() : '',
|
||||
"end_date": draftData.end_date_assign ? new Date(draftData.end_date_assign).toISOString() : '',
|
||||
"note": draftData.note,
|
||||
@@ -98,11 +87,11 @@ const UpdateTimelineStatus: FC<Props> = ({ assignmentId, onClose }) => {
|
||||
return (
|
||||
<>
|
||||
<AlertDialog open={true} >
|
||||
<AlertDialogContent className="min-w-full md:min-w-max">
|
||||
<AlertDialogContent className="min-w-full md:min-w-max max-h-[90vh] overflow-y-auto">
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Update Status</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
Update the timeline status for this assignment. You can also add a note or remark regarding this status change. This will help you keep track of the progress and any important information related to this assignment.
|
||||
<AlertDialogDescription className='w-full sm:max-w-140'>
|
||||
Update the timeline status for this assignment. You can also add a note or remark regarding this status change. This will help to keep track of the progress.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<div className="rounded-md border bg-card overflow-x-auto my-3">
|
||||
@@ -130,7 +119,7 @@ const UpdateTimelineStatus: FC<Props> = ({ assignmentId, onClose }) => {
|
||||
<TableRow>
|
||||
<TableCell colSpan={5} className="w-full h-32">
|
||||
<div className="text-center text-muted-foreground flex flex-col items-center justify-center gap-2">
|
||||
No team members have been added yet. Create a team to get started with project assignments
|
||||
No team members have been added yet.<br />Create a team to get started with project assignments
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
@@ -163,7 +152,7 @@ const UpdateTimelineStatus: FC<Props> = ({ assignmentId, onClose }) => {
|
||||
|
||||
<TableCell>
|
||||
{isEditing ?
|
||||
<Textarea placeholder="Add a note about this status change..." className="min-h-10" value={draftData.note} onChange={(e) => handleDraftChange("note", e.target.value)} />
|
||||
<Textarea placeholder="Add a note about this status change..." className="min-h-20 w-60" value={draftData.note} onChange={(e) => handleDraftChange("note", e.target.value)} />
|
||||
:
|
||||
<span className="text-sm">{row.note}</span>
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface IProjectAssignment {
|
||||
im_year?: any
|
||||
note: string
|
||||
client: Client
|
||||
end_user: EndUser
|
||||
project?: Project
|
||||
project_status: ProjectStatus
|
||||
wo_code: string
|
||||
@@ -28,7 +29,6 @@ export interface Client {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
end_user: EndUser
|
||||
}
|
||||
|
||||
export interface EndUser {
|
||||
|
||||
@@ -40,7 +40,7 @@ interface ComboboxProps {
|
||||
renderOption?: (option: ComboboxOption, isSelected: boolean) => React.ReactNode;
|
||||
}
|
||||
|
||||
export function Combobox({
|
||||
export function ComboboxCustomUI({
|
||||
options,
|
||||
value,
|
||||
onChange,
|
||||
|
||||
Reference in New Issue
Block a user