diff --git a/src/Admin/AdminInternTime.jsx b/src/Admin/AdminInternTime.jsx new file mode 100644 index 0000000..f16724b --- /dev/null +++ b/src/Admin/AdminInternTime.jsx @@ -0,0 +1,180 @@ +"use client"; + +import { useState } from "react"; +import { Button } from "@/Components/ui/button"; +import { Card } from "@/Components/ui/card"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/Components/ui/select"; +import { Clock, Calendar, Filter } from "lucide-react"; + +const interns = [ + { + name: "Alice Johnson", + department: "Engineering", + startDate: "2023-01-01", + endDate: "2023-06-30", + progress: "100", + }, + { + name: "Bob Smith", + department: "Marketing", + startDate: "2023-03-15", + endDate: "2023-09-15", + progress: "75", + }, + { + name: "Charlie Brown", + department: "Design", + startDate: "2023-02-01", + endDate: "2023-08-01", + progress: "50", + }, + { + name: "Diana Prince", + department: "Engineering", + startDate: "2023-01-01", + endDate: "2023-06-30", + progress: "100", + }, + { + name: "Ethan Hunt", + department: "HR", + startDate: "2023-01-01", + endDate: "2023-06-30", + progress: "90", + }, +]; + +function calculateRemainingTime(startDate, endDate) { + const today = new Date(); + const end = new Date(endDate); + const timeDiff = Math.max(end - today, 0); + const daysRemaining = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); + return daysRemaining > 0 + ? `${daysRemaining} days remaining` + : "Internship Completed"; +} + +export default function AdminInternTime() { + const [remainingTimes, setRemainingTimes] = useState({}); + const [selectedDepartment, setSelectedDepartment] = useState("all"); + + const handleToggleRemainingTime = (internName) => { + setRemainingTimes((prev) => ({ + ...prev, + [internName]: !prev[internName], + })); + }; + + const filteredInterns = + selectedDepartment === "all" + ? interns + : interns.filter( + (intern) => + intern.department.toLowerCase() === selectedDepartment.toLowerCase() + ); + + return ( +
+ {/* Header */} +
+

+ Intern Progress Tracker +

+ + Total Interns: {filteredInterns.length} + +
+ + {/* Filter Section */} +
+ +
+ + {/* Interns Grid */} +
+ {filteredInterns.map((intern) => ( + + {/* Intern Info */} +
+
+

+ {intern.name} +

+

{intern.department}

+
+ +
+ + {/* Internship Details */} +
handleToggleRemainingTime(intern.name)} + > +
+ + + Remaining Time + +
+ {remainingTimes[intern.name] && ( +

+ {calculateRemainingTime(intern.startDate, intern.endDate)} +

+ )} +
+ + {/* Progress Section */} +
+
+ + Progress: {intern.progress}% +
+
+
+
+
+ Duration: {intern.startDate} to {intern.endDate} +
+
+
+ ))} +
+
+ ); +} diff --git a/src/App.jsx b/src/App.jsx index bcda7bb..3d31c59 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -42,6 +42,7 @@ import "./App.css"; import { NotFound } from "./Components/Notfound"; import { useAuthContext } from "./context/AuthContext"; import AllAttendance from "./Admin/AllAttendance"; +import AdminInternTime from "./Admin/AdminInternTime"; const AdminRoute = ({ children }) => { const isAdmin = localStorage.getItem("isAdmin") === "true"; @@ -272,7 +273,15 @@ const App = () => { path="/help-request" element={ - + + + } + /> + + } /> @@ -284,7 +293,6 @@ const App = () => { } /> - ); }; diff --git a/src/Components/TopNavbar.jsx b/src/Components/TopNavbar.jsx index b498b0c..92c1f38 100644 --- a/src/Components/TopNavbar.jsx +++ b/src/Components/TopNavbar.jsx @@ -26,23 +26,22 @@ const TopNavbar = () => { const isAdmin = localStorage.getItem("isAdmin") === "true"; const availableRoutes = [ + // Protected User Routes + { path: "/", label: "Home", public: false }, + { path: "/your-profile", label: "Profile", public: false }, + { path: "/reports", label: "Reports", public: false }, + { path: "/projects", label: "Projects", public: false }, + + // Public Routes - { path: "/login", label: "Login", public: true }, - { path: "/signup", label: "Sign Up", public: true }, + { path: "/frequently-asked-questions", label: "FAQ", public: true }, { path: "/aboutus", label: "About Us", public: true }, { path: "/privacypolicy", label: "Privacy Policy", public: true }, - { path: "/frequently-asked-questions", label: "FAQ", public: true }, // Protected User Routes - { path: "/", label: "Home", public: false }, - { path: "/dashboard", label: "Dashboard", public: false }, - { path: "/your-profile", label: "Profile", public: false }, { path: "/notifications", label: "Notifications", public: false }, - { path: "/reports", label: "Reports", public: false }, - { path: "/projects", label: "Projects", public: false }, { path: "/help", label: "Help", public: false }, { path: "/my-attendance", label: "My Attendance", public: false }, - { path: "/stores", label: "Stores", public: false }, { path: "/leave-application", label: "Leave Application", public: false }, { path: "/setting", label: "Settings", public: false }, { path: "/help-request", label: "Harassment Form", public: false}, @@ -146,7 +145,6 @@ const TopNavbar = () => { {/* Desktop Header */}
-
@@ -155,7 +153,6 @@ const TopNavbar = () => {
-
diff --git a/src/Pages/pageIndex.js b/src/Pages/pageIndex.js index 373924e..4c91a13 100644 --- a/src/Pages/pageIndex.js +++ b/src/Pages/pageIndex.js @@ -34,7 +34,9 @@ import Internleaveapplication from "@/Admin/InternLeaveApplications"; import IntroPage from "./IntroPage"; import AdminNotify from "@/Admin/AdminNotify"; import HarassmentEmailForm from "@/Components/HarassmentEmailForm"; +import AdminInternTime from "@/Admin/AdminInternTime"; -export { Home, Notifications, HarassmentEmailForm, Settings, AdminNotify, IntroPage, ResetPassword, Reports, UserAttendance, NotAuthorized, Projects, FAQ, SettingsPage, Categories, Dashboard, Stores, Signin, SignUp, Logout, Profile, Aboutus, CustomNavbar, AdminHomePage, AdminProject, AdminTask, AdminReport, PrivacyPolicy, Help, AllUsers, AdminHelpPage, InternAttendance, AdminHelp, InternTasksSubmissions, LeaveApplication, Internleaveapplication } + +export { Home, Notifications, HarassmentEmailForm, Settings, AdminNotify, IntroPage, ResetPassword, Reports, UserAttendance, NotAuthorized, Projects, FAQ, SettingsPage, Categories, Dashboard, Stores, Signin, SignUp, Logout, Profile, Aboutus, CustomNavbar, AdminHomePage, AdminProject, AdminTask, AdminReport, PrivacyPolicy, Help, AllUsers, AdminHelpPage, InternAttendance, AdminHelp, InternTasksSubmissions, LeaveApplication, Internleaveapplication, AdminInternTime }