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 a4400e6..484b515 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 @@ -125,7 +125,7 @@ export default function AssignmentDetail({ client, initialAssignment: assignment {assignmentStatus ? : null} {assignmentCode ? ( - {assignmentCode} + # {assignmentCode} ) : null} diff --git a/app/(dashboard)/task/component/FilterComponent.tsx b/app/(dashboard)/task/component/FilterComponent.tsx index 606ab89..11ef94e 100644 --- a/app/(dashboard)/task/component/FilterComponent.tsx +++ b/app/(dashboard)/task/component/FilterComponent.tsx @@ -45,7 +45,7 @@ const FilterComponent: FC = ({ const currentQuery = searchParams?.get('q') || ''; const currentSort = searchParams?.get('sort') || ''; - const currentLayout = searchParams?.get('layout') === 'list' ? 'list' : 'grid'; + const currentLayout = searchParams?.get('layout') === 'grid' ? 'grid' : 'list'; const [searchText, setSearchText] = useState(currentQuery); @@ -78,8 +78,8 @@ const FilterComponent: FC = ({ const handleLayoutChange = (val: 'grid' | 'list') => { const params = new URLSearchParams(searchParams?.toString() || ''); - if (val === 'list') { - params.set('layout', 'list'); + if (val === 'grid') { + params.set('layout', 'grid'); } else { params.delete('layout'); } diff --git a/app/(dashboard)/task/component/HomeTask.tsx b/app/(dashboard)/task/component/HomeTask.tsx index e827a9b..d02230b 100644 --- a/app/(dashboard)/task/component/HomeTask.tsx +++ b/app/(dashboard)/task/component/HomeTask.tsx @@ -1,34 +1,28 @@ "use client" import { useState } from 'react'; -import { useRouter, usePathname, useSearchParams } from 'next/navigation'; +import { useRouter } from 'next/navigation'; import { Plus } from 'lucide-react'; import { Button } from '@/components/ui/button'; import FormClient from './client/FormClient'; import FilterComponent from './FilterComponent'; -import { - Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, -} from '@/components/ui/select'; -import Link from 'next/link'; -interface ShellProps { - currentView: 'clients' | 'assignments'; -} +// interface ShellProps { +// currentView: 'clients' | 'assignments'; +// } -export default function HomeTask({ currentView }: ShellProps) { +export default function HomeTask() { const router = useRouter(); - const pathname = usePathname(); - const searchParams = useSearchParams(); const [showForm, setShowForm] = useState(false); // Update URL when Tabs change - const handleTabChange = (view: string) => { - const params = new URLSearchParams(searchParams!); - params.set('view', view); - params.delete('status'); - router.push(`${pathname}?${params.toString()}`); - }; + // const handleTabChange = (view: string) => { + // const params = new URLSearchParams(searchParams!); + // params.set('view', view); + // params.delete('status'); + // router.push(`${pathname}?${params.toString()}`); + // }; return ( <> @@ -40,7 +34,7 @@ export default function HomeTask({ currentView }: ShellProps) {

- @@ -51,8 +45,11 @@ export default function HomeTask({ currentView }: ShellProps) { Project Assignment - - {currentView === 'clients' ? + */} + + {/* {currentView === 'clients' ? @@ -62,12 +59,12 @@ export default function HomeTask({ currentView }: ShellProps) { Create Project Assignment - } + } */}
diff --git a/app/(dashboard)/task/component/ManageTeam.tsx b/app/(dashboard)/task/component/ManageTeam.tsx index ff7db2f..5974b1a 100644 --- a/app/(dashboard)/task/component/ManageTeam.tsx +++ b/app/(dashboard)/task/component/ManageTeam.tsx @@ -15,8 +15,8 @@ import { } from "@/components/ui/select"; import { DatePicker } from "@/components/ui/datepicker"; import { - AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle -} from "@/components/ui/alert-dialog" + Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle +} from "@/components/ui/dialog" import AddTeam from "./AddTeam"; import { useFetchWithAxios } from "@/lib/axios/useFetch"; import { Skeleton } from "@/components/ui/skeleton"; @@ -113,16 +113,16 @@ export function ManageTeam({ assignmentId, onClose, startDate, endDate }: { assi return ( <> - - -
- - Manage Team - + { if (!open) onClose(); }}> + +
+ + Manage Team + Add team members and manage who is working on each project assignment. - - - + + +
@@ -287,11 +287,11 @@ export function ManageTeam({ assignmentId, onClose, startDate, endDate }: { assi
- - Close - - - + + + +
+
{showAddTeamDialog ? setShowAddTeamDialog(false)} onSuccess={handleSuccess} /> diff --git a/app/(dashboard)/task/component/UpdateTimelineStatus.tsx b/app/(dashboard)/task/component/UpdateTimelineStatus.tsx index ca85ce5..52c1df1 100644 --- a/app/(dashboard)/task/component/UpdateTimelineStatus.tsx +++ b/app/(dashboard)/task/component/UpdateTimelineStatus.tsx @@ -1,7 +1,7 @@ import { useState, type FC } from 'react'; import { - AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle -} from "@/components/ui/alert-dialog" + Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle +} from "@/components/ui/dialog" import { Button } from '@/components/ui/button'; import { DatePicker } from '@/components/ui/datepicker'; import { Edit2, Loader2, Save, X } from 'lucide-react'; @@ -97,14 +97,14 @@ const UpdateTimelineStatus: FC = ({ assignmentId, onClose }) => { return ( <> - - - - Update Status - + { if (!open && onClose) onClose(); }}> + + + Update Status + 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. - - + +
@@ -187,11 +187,11 @@ const UpdateTimelineStatus: FC = ({ assignmentId, onClose }) => {
- - Close - -
-
+ + + + + ); } diff --git a/app/(dashboard)/task/component/project-assignment/ProjectAssignment.tsx b/app/(dashboard)/task/component/project-assignment/ProjectAssignment.tsx index b2dc46a..642d4bb 100644 --- a/app/(dashboard)/task/component/project-assignment/ProjectAssignment.tsx +++ b/app/(dashboard)/task/component/project-assignment/ProjectAssignment.tsx @@ -1,23 +1,21 @@ -"use client"; - import { Card } from '@/components/ui/card'; import { BookOpenCheck } from 'lucide-react'; -import { useSearchParams } from 'next/navigation'; import { IProjectAssignment } from '../../type.assignment'; import AssignmentGrid from './AssignmentGrid'; import AssignmentList from './AssignmentList'; interface AssignmentTableProps { data: IProjectAssignment[]; + layout?: 'grid' | 'list'; initialLayout?: 'grid' | 'list'; } export default function AssignmentTable({ data, + layout, initialLayout = 'grid', }: AssignmentTableProps) { - const searchParams = useSearchParams(); - const layout = searchParams?.get('layout') === 'list' ? 'list' : initialLayout; + const currentLayout = layout || initialLayout; if (data.length === 0) { return ( @@ -33,7 +31,7 @@ export default function AssignmentTable({ ); } - if (layout === 'list') { + if (currentLayout === 'list') { return ; } diff --git a/app/(dashboard)/task/page.tsx b/app/(dashboard)/task/page.tsx index 8b7172d..e018c1e 100644 --- a/app/(dashboard)/task/page.tsx +++ b/app/(dashboard)/task/page.tsx @@ -1,10 +1,9 @@ import { lazy, Suspense } from 'react'; -import fetchData, { getQueryStringFilteredAssignments } from '@/lib/fetchData'; -import { getFilteredAssignments, getFilteredClients } from './data'; +import fetchData from '@/lib/fetchData'; +import { getFilteredClients } from './data'; import { Loader2 } from 'lucide-react'; const HomeTask = lazy(() => import('./component/HomeTask')); -const ProjectAssignment = lazy(() => import('./component/project-assignment/ProjectAssignment')); const Client = lazy(() => import('./component/client/Client')); type Props = { @@ -14,37 +13,37 @@ type Props = { export default async function ClientsPage({ searchParams }: Props) { const searchParams_ = await searchParams; - const view = searchParams_.view === 'assignments' ? 'assignments' : 'clients'; + // const view = searchParams_.view === 'assignments' ? 'assignments' : 'clients'; const query = (searchParams_.q || '').toLowerCase(); const sort = (searchParams_.sort || '').toLowerCase(); const sortBy = sort || 'default'; - const layout = searchParams_.layout === 'list' ? 'list' : 'grid'; + const layout = searchParams_.layout === 'grid' ? 'grid' : 'list'; - const queryString = getQueryStringFilteredAssignments(searchParams_) + // const queryString = getQueryStringFilteredAssignments(searchParams_) - const getClient = fetchData('/client') - const getAssignment = fetchData(queryString ? `/project-assignment?${queryString}` : '/project-assignment') + const allClients = await fetchData('/client') + // const getAssignment = fetchData(queryString ? `/project-assignment?${queryString}` : '/project-assignment') - const [allClients, allAssignments] = await Promise.all([getClient, getAssignment]); + // const [allClients, allAssignments] = await Promise.all([getClient, getAssignment]); const filteredClients = getFilteredClients(allClients, query, sortBy) - const filterAssignments = getFilteredAssignments(allAssignments, query, sortBy) + // const filterAssignments = getFilteredAssignments(allAssignments, query, sortBy) return (
Loading...
}> - + - {/* Render the correct view based on the URL */} - }> + + {/* }> {view === 'clients' ? : - + } - + */}
); } \ No newline at end of file