import { useState, useEffect } from 'react';
import {
Users,
Calendar,
BarChart3,
FileText,
Settings,
Bell,
Search,
UserCircle,
Clock,
CalendarDays,
Award,
Briefcase,
ArrowUpRight,
ArrowDownRight,
MoreHorizontal,
Plus,
X,
Check,
Download,
Upload,
ChevronDown,
ChevronRight,
Edit,
Trash2,
Eye,
LogOut,
User,
Mail,
Phone,
MapPin,
Calendar as CalendarIcon,
AlertCircle,
CheckCircle2,
XCircle,
Filter,
ArrowUpDown,
ChevronLeft,
ChevronUp
} from 'lucide-react';
// Mock data
const employeesData = [
{ id: 1, name: "John Doe", email: "john.doe@company.com", phone: "+1 (555) 123-4567", position: "Software Engineer", department: "Engineering", status: "Active", joinDate: "2021-05-15", salary: 85000, manager: "Lisa Johnson", avatar: "https://randomuser.me/api/portraits/men/1.jpg" },
{ id: 2, name: "Jane Smith", email: "jane.smith@company.com", phone: "+1 (555) 234-5678", position: "HR Manager", department: "Human Resources", status: "Active", joinDate: "2020-03-10", salary: 92000, manager: "Michael Brown", avatar: "https://randomuser.me/api/portraits/women/2.jpg" },
{ id: 3, name: "Robert Johnson", email: "robert.j@company.com", phone: "+1 (555) 345-6789", position: "Product Manager", department: "Product", status: "On Leave", joinDate: "2019-11-05", salary: 105000, manager: "Sarah Williams", avatar: "https://randomuser.me/api/portraits/men/3.jpg" },
{ id: 4, name: "Emily Davis", email: "emily.d@company.com", phone: "+1 (555) 456-7890", position: "UX Designer", department: "Design", status: "Active", joinDate: "2022-01-20", salary: 78000, manager: "David Miller", avatar: "https://randomuser.me/api/portraits/women/4.jpg" },
{ id: 5, name: "Michael Wilson", email: "michael.w@company.com", phone: "+1 (555) 567-8901", position: "Marketing Specialist", department: "Marketing", status: "Active", joinDate: "2021-08-12", salary: 72000, manager: "Jennifer Taylor", avatar: "https://randomuser.me/api/portraits/men/5.jpg" },
{ id: 6, name: "Sarah Thompson", email: "sarah.t@company.com", phone: "+1 (555) 678-9012", position: "Financial Analyst", department: "Finance", status: "Active", joinDate: "2020-06-30", salary: 88000, manager: "Robert Clark", avatar: "https://randomuser.me/api/portraits/women/6.jpg" },
{ id: 7, name: "David Miller", email: "david.m@company.com", phone: "+1 (555) 789-0123", position: "Design Director", department: "Design", status: "Active", joinDate: "2018-04-15", salary: 115000, manager: "Michael Brown", avatar: "https://randomuser.me/api/portraits/men/7.jpg" },
{ id: 8, name: "Jennifer Taylor", email: "jennifer.t@company.com", phone: "+1 (555) 890-1234", position: "Marketing Director", department: "Marketing", status: "Active", joinDate: "2019-02-28", salary: 110000, manager: "Michael Brown", avatar: "https://randomuser.me/api/portraits/women/8.jpg" },
];
const departmentsData = [
{ id: 1, name: "Engineering", manager: "Lisa Johnson", employeeCount: 12, budget: 1200000 },
{ id: 2, name: "Human Resources", manager: "Jane Smith", employeeCount: 5, budget: 450000 },
{ id: 3, name: "Product", manager: "Sarah Williams", employeeCount: 8, budget: 900000 },
{ id: 4, name: "Design", manager: "David Miller", employeeCount: 7, budget: 650000 },
{ id: 5, name: "Marketing", manager: "Jennifer Taylor", employeeCount: 6, budget: 580000 },
{ id: 6, name: "Finance", manager: "Robert Clark", employeeCount: 4, budget: 520000 },
];
const attendanceData = [
{ day: "Mon", present: 45, absent: 3, leave: 2 },
{ day: "Tue", present: 47, absent: 2, leave: 1 },
{ day: "Wed", present: 44, absent: 4, leave: 2 },
{ day: "Thu", present: 46, absent: 2, leave: 2 },
{ day: "Fri", present: 43, absent: 5, leave: 2 },
];
const attendanceRecords = [
{ id: 1, employeeId: 1, employeeName: "John Doe", date: "2023-06-15", clockIn: "09:02:34", clockOut: "17:30:12", status: "Present", workHours: "8:28" },
{ id: 2, employeeId: 2, employeeName: "Jane Smith", date: "2023-06-15", clockIn: "08:55:21", clockOut: "17:45:05", status: "Present", workHours: "8:50" },
{ id: 3, employeeId: 3, employeeName: "Robert Johnson", date: "2023-06-15", clockIn: null, clockOut: null, status: "On Leave", workHours: "0:00" },
{ id: 4, employeeId: 4, employeeName: "Emily Davis", date: "2023-06-15", clockIn: "09:10:45", clockOut: "17:15:33", status: "Present", workHours: "8:05" },
{ id: 5, employeeId: 5, employeeName: "Michael Wilson", date: "2023-06-15", clockIn: "08:45:12", clockOut: "18:10:22", status: "Present", workHours: "9:25" },
{ id: 6, employeeId: 1, employeeName: "John Doe", date: "2023-06-14", clockIn: "08:58:34", clockOut: "17:32:12", status: "Present", workHours: "8:34" },
{ id: 7, employeeId: 2, employeeName: "Jane Smith", date: "2023-06-14", clockIn: "09:05:21", clockOut: "17:40:05", status: "Present", workHours: "8:35" },
{ id: 8, employeeId: 3, employeeName: "Robert Johnson", date: "2023-06-14", clockIn: "09:15:45", clockOut: "17:20:33", status: "Present", workHours: "8:05" },
];
const leaveTypes = [
{ id: 1, name: "Annual Leave", daysAllowed: 20, carryForward: true, description: "Regular vacation time" },
{ id: 2, name: "Sick Leave", daysAllowed: 10, carryForward: false, description: "For medical reasons" },
{ id: 3, name: "Personal Leave", daysAllowed: 5, carryForward: false, description: "For personal matters" },
{ id: 4, name: "Maternity Leave", daysAllowed: 90, carryForward: false, description: "For new mothers" },
{ id: 5, name: "Paternity Leave", daysAllowed: 14, carryForward: false, description: "For new fathers" },
{ id: 6, name: "Bereavement Leave", daysAllowed: 5, carryForward: false, description: "For family loss" },
];
const leaveBalances = [
{ employeeId: 1, annualLeave: 15, sickLeave: 8, personalLeave: 3 },
{ employeeId: 2, annualLeave: 12, sickLeave: 10, personalLeave: 5 },
{ employeeId: 3, annualLeave: 5, sickLeave: 6, personalLeave: 2 },
{ employeeId: 4, annualLeave: 18, sickLeave: 9, personalLeave: 4 },
{ employeeId: 5, annualLeave: 10, sickLeave: 7, personalLeave: 3 },
];
const leaveRequests = [
{ id: 1, employeeId: 2, employeeName: "Jane Smith", type: "Sick Leave", from: "2023-06-15", to: "2023-06-16", days: 2, reason: "Not feeling well", status: "Approved", approvedBy: "Michael Brown", appliedOn: "2023-06-14" },
{ id: 2, employeeId: 3, employeeName: "Robert Johnson", type: "Annual Leave", from: "2023-06-20", to: "2023-06-25", days: 6, reason: "Family vacation", status: "Pending", approvedBy: null, appliedOn: "2023-06-10" },
{ id: 3, employeeId: 4, employeeName: "Emily Davis", type: "Personal Leave", from: "2023-06-18", to: "2023-06-18", days: 1, reason: "Personal matter", status: "Approved", approvedBy: "David Miller", appliedOn: "2023-06-15" },
{ id: 4, employeeId: 1, employeeName: "John Doe", type: "Annual Leave", from: "2023-07-10", to: "2023-07-15", days: 6, reason: "Summer vacation", status: "Pending", approvedBy: null, appliedOn: "2023-06-12" },
{ id: 5, employeeId: 5, employeeName: "Michael Wilson", type: "Sick Leave", from: "2023-06-05", to: "2023-06-06", days: 2, reason: "Fever", status: "Approved", approvedBy: "Jennifer Taylor", appliedOn: "2023-06-04" },
];
const performanceReviews = [
{ id: 1, employeeId: 1, employeeName: "John Doe", reviewPeriod: "2023 Q1", reviewDate: "2023-04-15", reviewer: "Lisa Johnson", status: "Completed", rating: 4.5, strengths: "Technical skills, problem-solving", areasToImprove: "Documentation, knowledge sharing" },
{ id: 2, employeeId: 2, employeeName: "Jane Smith", reviewPeriod: "2023 Q1", reviewDate: "2023-04-12", reviewer: "Michael Brown", status: "Completed", rating: 4.8, strengths: "Leadership, communication, organization", areasToImprove: "Work-life balance" },
{ id: 3, employeeId: 3, employeeName: "Robert Johnson", reviewPeriod: "2023 Q1", reviewDate: "2023-04-14", reviewer: "Sarah Williams", status: "Completed", rating: 4.2, strengths: "Product vision, stakeholder management", areasToImprove: "Technical depth, delegation" },
{ id: 4, employeeId: 4, employeeName: "Emily Davis", reviewPeriod: "2023 Q1", reviewDate: "2023-04-10", reviewer: "David Miller", status: "Completed", rating: 4.6, strengths: "Creativity, user empathy, attention to detail", areasToImprove: "Meeting deadlines" },
{ id: 5, employeeId: 1, employeeName: "John Doe", reviewPeriod: "2022 Q4", reviewDate: "2023-01-15", reviewer: "Lisa Johnson", status: "Completed", rating: 4.3, strengths: "Technical skills, problem-solving", areasToImprove: "Communication, documentation" },
];
const employeeGoals = [
{ id: 1, employeeId: 1, title: "Complete Advanced React Course", description: "Finish online course to improve React skills", startDate: "2023-05-01", targetDate: "2023-07-31", status: "In Progress", progress: 60 },
{ id: 2, employeeId: 1, title: "Mentor Junior Developer", description: "Provide mentorship to new team member", startDate: "2023-06-01", targetDate: "2023-12-31", status: "In Progress", progress: 25 },
{ id: 3, employeeId: 2, title: "Implement New Onboarding Process", description: "Design and roll out improved employee onboarding", startDate: "2023-04-15", targetDate: "2023-06-30", status: "In Progress", progress: 80 },
{ id: 4, employeeId: 3, title: "Product Roadmap 2023", description: "Finalize product strategy and roadmap for 2023", startDate: "2023-01-15", targetDate: "2023-03-31", status: "Completed", progress: 100 },
{ id: 5, employeeId: 4, title: "Design System Overhaul", description: "Update and standardize company design system", startDate: "2023-05-01", targetDate: "2023-08-31", status: "In Progress", progress: 40 },
];
const upcomingEvents = [
{ id: 1, title: "Team Building", date: "2023-06-30", time: "13:00", location: "Central Park", description: "Outdoor team building activities", participants: 25 },
{ id: 2, title: "Performance Review Cycle", date: "2023-07-15", time: "09:00", location: "Company-wide", description: "Q2 performance reviews begin", participants: 50 },
{ id: 3, title: "Leadership Training Workshop", date: "2023-07-05", time: "10:00", location: "Conference Room A", description: "Workshop for team leads and managers", participants: 15 },
{ id: 4, title: "New Hire Orientation", date: "2023-06-25", time: "09:30", location: "Training Room", description: "Orientation for new employees", participants: 8 },
];
const reportTemplates = [
{ id: 1, name: "Employee Headcount", description: "Current employee count by department", category: "Workforce" },
{ id: 2, name: "Attendance Summary", description: "Monthly attendance statistics", category: "Attendance" },
{ id: 3, name: "Leave Usage", description: "Leave utilization by department and type", category: "Leave" },
{ id: 4, name: "Turnover Rate", description: "Employee turnover statistics", category: "Workforce" },
{ id: 5, name: "Performance Distribution", description: "Distribution of performance ratings", category: "Performance" },
{ id: 6, name: "Salary Analysis", description: "Salary distribution by role and department", category: "Compensation" },
];
export default function HRMSDashboard() {
const [activeTab, setActiveTab] = useState('dashboard');
const [searchTerm, setSearchTerm] = useState('');
const [filteredEmployees, setFilteredEmployees] = useState(employeesData);
const [showModal, setShowModal] = useState(false);
const [modalContent, setModalContent] = useState(null);
const [currentDate] = useState(new Date().toISOString().split('T')[0]);
// Tab-specific states
const [employeeView, setEmployeeView] = useState('list');
const [selectedEmployee, setSelectedEmployee] = useState(null);
const [attendanceView, setAttendanceView] = useState('today');
const [leaveView, setLeaveView] = useState('requests');
const [performanceView, setPerformanceView] = useState('reviews');
const [reportsView, setReportsView] = useState('templates');
const [settingsView, setSettingsView] = useState('company');
useEffect(() => {
setFilteredEmployees(
employeesData.filter(employee =>
employee.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
employee.position.toLowerCase().includes(searchTerm.toLowerCase()) ||
employee.department.toLowerCase().includes(searchTerm.toLowerCase())
)
);
}, [searchTerm]);
const openModal = (content) => {
setModalContent(content);
setShowModal(true);
};
const closeModal = () => {
setShowModal(false);
setModalContent(null);
};
const handleEmployeeSelect = (employee) => {
setSelectedEmployee(employee);
setEmployeeView('detail');
};
const handleAddEmployee = () => {
openModal(
);
};
const handleAddLeaveRequest = () => {
openModal(
);
};
const handleAddPerformanceReview = () => {
openModal(
Create Performance Review
);
};
return (
{/* Sidebar */}
HRMS Dashboard
{/* Main Content */}
{/* Header */}
{/* Dashboard Content */}
{/* Dashboard Tab */}
{activeTab === 'dashboard' && (
HR Dashboard Overview
{/* Stats Cards */}
}
/>
}
/>
}
/>
}
/>
{/* Charts and Tables */}
{/* Attendance Chart */}
Weekly Attendance
{/* Leave Requests */}
Recent Leave Requests
| Employee |
Type |
Duration |
Status |
{leaveRequests.slice(0, 3).map(request => (
| {request.employeeName} |
{request.type} |
{new Date(request.from).toLocaleDateString()} - {new Date(request.to).toLocaleDateString()} |
{request.status}
|
))}
{/* Bottom Row */}
{/* Recent Employees */}
Recent Employees
{employeesData.slice(0, 3).map(employee => (
{employee.name}
{employee.position}
{employee.status}
))}
{/* Upcoming Events */}
Upcoming Events
{upcomingEvents.slice(0, 3).map(event => (
{event.title}
{new Date(event.date).toLocaleDateString()} • {event.time} • {event.participants} participants
))}
)}
{/* Employees Tab */}
{activeTab === 'employees' && (
{employeeView === 'list' && (
<>
|
|
|
|
Status |
Actions |
{filteredEmployees.map(employee => (
{employee.name}
|
{employee.position} |
{employee.department} |
{employee.status}
|
|
))}
Showing 1 to {filteredEmployees.length} of {employeesData.length} employees
>
)}
{employeeView === 'detail' && selectedEmployee && (
<>
Employee Profile
{/* Employee Info Card */}
{selectedEmployee.name}
{selectedEmployee.position}
{selectedEmployee.department}
Email
{selectedEmployee.email}
Phone
{selectedEmployee.phone}
Manager
{selectedEmployee.manager}
Join Date
{new Date(selectedEmployee.joinDate).toLocaleDateString()}
{/* Employee Details */}
{/* Attendance Summary */}
Attendance Summary
{/* Leave Balance */}
Leave Balance
Annual Leave
{leaveBalances.find(lb => lb.employeeId === selectedEmployee.id)?.annualLeave || 0}
days remaining
Sick Leave
{leaveBalances.find(lb => lb.employeeId === selectedEmployee.id)?.sickLeave || 0}
days remaining
Personal Leave
{leaveBalances.find(lb => lb.employeeId === selectedEmployee.id)?.personalLeave || 0}
days remaining
{/* Performance */}
Recent Performance
{performanceReviews.filter(review => review.employeeId === selectedEmployee.id).length > 0 ? (
{performanceReviews
.filter(review => review.employeeId === selectedEmployee.id)
.slice(0, 1)
.map(review => (
{review.reviewPeriod}
★
{review.rating}/5
Strengths
{review.strengths}
Areas to Improve
{review.areasToImprove}
))}
) : (
No performance reviews available.
)}
>
)}
)}
{/* Attendance Tab */}
{activeTab === 'attendance' && (
Attendance Management
{attendanceView === 'today' && (
<>
Today's Summary
{new Date().toLocaleDateString()}
Present
46
Absent
1
On Leave
3
Late
5
Quick Actions
Today's Attendance
Date:
{new Date().toLocaleDateString()}
| Employee |
Department |
Clock In |
Clock Out |
Status |
Actions |
{attendanceRecords
.filter(record => record.date === "2023-06-15")
.map(record => (
 emp.id === record.employeeId)?.avatar || "https://randomuser.me/api/portraits/men/1.jpg"}
alt={record.employeeName}
className="w-8 h-8 rounded-full"
/>
{record.employeeName}
|
{employeesData.find(emp => emp.id === record.employeeId)?.department || "N/A"}
|
{record.clockIn || "N/A"}
|
{record.clockOut || "N/A"}
|
{record.status}
|
|
))}
>
)}
{attendanceView === 'history' && (
| Date |
Employee |
Clock In |
Clock Out |
Work Hours |
Status |
{attendanceRecords.map(record => (
| {new Date(record.date).toLocaleDateString()} |
 emp.id === record.employeeId)?.avatar || "https://randomuser.me/api/portraits/men/1.jpg"}
alt={record.employeeName}
className="w-8 h-8 rounded-full"
/>
{record.employeeName}
|
{record.clockIn || "N/A"} |
{record.clockOut || "N/A"} |
{record.workHours} |
{record.status}
|
))}
Showing 1 to {attendanceRecords.length} of {attendanceRecords.length} records
)}
{attendanceView === 'report' && (
Generate Attendance Report
Recent Reports
| Report Name |
Generated On |
Type |
Format |
Actions |
| Monthly Attendance - June 2023 |
2023-06-15 |
Monthly Summary |
PDF |
|
| Engineering Department - May 2023 |
2023-06-02 |
Department Summary |
Excel |
|
| John Doe - Q2 2023 |
2023-05-28 |
Employee Attendance |
PDF |
|
)}
)}
{/* Leave Management Tab */}
{activeTab === 'leave' && (
Leave Management
{leaveView === 'requests' && (
<>
Leave Requests
| Employee |
Leave Type |
From |
To |
Days |
Applied On |
Status |
Actions |
{leaveRequests.map(request => (
 emp.id === request.employeeId)?.avatar || "https://randomuser.me/api/portraits/men/1.jpg"}
alt={request.employeeName}
className="w-8 h-8 rounded-full"
/>
{request.employeeName}
|
{request.type} |
{new Date(request.from).toLocaleDateString()} |
{new Date(request.to).toLocaleDateString()} |
{request.days} |
{new Date(request.appliedOn).toLocaleDateString()} |
{request.status}
|
{request.status === 'Pending' && (
<>
>
)}
|
))}
Showing 1 to {leaveRequests.length} of {leaveRequests.length} requests
>
)}
{leaveView === 'calendar' && (
{['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].map(day => (
{day}
))}
{/* Calendar days - first row (empty days + days 1-3) */}
{/* Calendar days - second row (days 5-11) */}
{/* Calendar days - third row (days 12-18) */}
{/* Calendar days - fourth row (days 19-25) */}
{/* Calendar days - fifth row (days 26-30) */}
)}
{leaveView === 'types' && (
Leave Types
| Name |
Days Allowed |
Carry Forward |
Description |
Actions |
{leaveTypes.map(type => (
| {type.name} |
{type.daysAllowed} |
{type.carryForward ? (
Yes
) : (
No
)}
|
{type.description} |
|
))}
)}
)}
{/* Performance Tab */}
{activeTab === 'performance' && (
Performance Management
{performanceView === 'reviews' && (
<>
Rating Distribution
Q1 2023
Department Performance
Q1 2023
| Department |
Avg. Rating |
Top Performer |
Trend |
| Engineering |
★
4.3
|
John Doe |
+0.2
|
| Human Resources |
★
4.7
|
Jane Smith |
+0.3
|
| Product |
★
4.1
|
Robert Johnson |
-0.1
|
| Design |
★
4.5
|
Emily Davis |
+0.2
|
Performance Reviews
| Employee |
Period |
Review Date |
Reviewer |
Rating |
Status |
Actions |
{performanceReviews.map(review => (
 emp.id === review.employeeId)?.avatar || "https://randomuser.me/api/portraits/men/1.jpg"}
alt={review.employeeName}
className="w-8 h-8 rounded-full"
/>
{review.employeeName}
|
{review.reviewPeriod} |
{new Date(review.reviewDate).toLocaleDateString()} |
{review.reviewer} |
★
{review.rating}/5
|
{review.status}
|
|
))}
Showing 1 to {performanceReviews.length} of {performanceReviews.length} reviews
>
)}
{performanceView === 'goals' && (
<>
| Employee |
Goal |
Start Date |
Target Date |
Progress |
Status |
Actions |
{employeeGoals.map(goal => (
 emp.id === goal.employeeId)?.avatar || "https://randomuser.me/api/portraits/men/1.jpg"}
alt={employeesData.find(emp => emp.id === goal.employeeId)?.name}
className="w-8 h-8 rounded-full"
/>
{employeesData.find(emp => emp.id === goal.employeeId)?.name}
|
{goal.title}
{goal.description}
|
{new Date(goal.startDate).toLocaleDateString()} |
{new Date(goal.targetDate).toLocaleDateString()} |
|
{goal.status}
|
|
))}
>
)}
)}
{/* Reports Tab */}
{activeTab === 'reports' && (
Reports
{reportsView === 'templates' && (
<>
Report Categories
import { useState, useEffect } from 'react';
import {
Users,
Calendar,
BarChart3,
FileText,
Settings,
Bell,
Search,
UserCircle,
Clock,
CalendarDays,
Award,
Briefcase,
ArrowUpRight,
ArrowDownRight,
MoreHorizontal
} from 'lucide-react';
// Mock data
const employeesData = [
{ id: 1, name: "John Doe", position: "Software Engineer", department: "Engineering", status: "Active", avatar: "https://randomuser.me/api/portraits/men/1.jpg" },
{ id: 2, name: "Jane Smith", position: "HR Manager", department: "Human Resources", status: "Active", avatar: "https://randomuser.me/api/portraits/women/2.jpg" },
{ id: 3, name: "Robert Johnson", position: "Product Manager", department: "Product", status: "On Leave", avatar: "https://randomuser.me/api/portraits/men/3.jpg" },
{ id: 4, name: "Emily Davis", position: "UX Designer", department: "Design", status: "Active", avatar: "https://randomuser.me/api/portraits/women/4.jpg" },
{ id: 5, name: "Michael Wilson", position: "Marketing Specialist", department: "Marketing", status: "Active", avatar: "https://randomuser.me/api/portraits/men/5.jpg" },
];
const attendanceData = [
{ day: "Mon", present: 45, absent: 3, leave: 2 },
{ day: "Tue", present: 47, absent: 2, leave: 1 },
{ day: "Wed", present: 44, absent: 4, leave: 2 },
{ day: "Thu", present: 46, absent: 2, leave: 2 },
{ day: "Fri", present: 43, absent: 5, leave: 2 },
];
const leaveRequests = [
{ id: 1, employee: "Jane Smith", type: "Sick Leave", from: "2023-06-15", to: "2023-06-16", status: "Approved" },
{ id: 2, employee: "Robert Johnson", type: "Vacation", from: "2023-06-20", to: "2023-06-25", status: "Pending" },
{ id: 3, employee: "Emily Davis", type: "Personal", from: "2023-06-18", to: "2023-06-18", status: "Approved" },
];
const upcomingEvents = [
{ id: 1, title: "Team Building", date: "2023-06-30", participants: 25 },
{ id: 2, title: "Performance Review", date: "2023-07-15", participants: 50 },
{ id: 3, title: "Training Workshop", date: "2023-07-05", participants: 15 },
];
export default function HRMSDashboard() {
const [activeTab, setActiveTab] = useState('dashboard');
const [searchTerm, setSearchTerm] = useState('');
const [filteredEmployees, setFilteredEmployees] = useState(employeesData);
useEffect(() => {
setFilteredEmployees(
employeesData.filter(employee =>
employee.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
employee.position.toLowerCase().includes(searchTerm.toLowerCase()) ||
employee.department.toLowerCase().includes(searchTerm.toLowerCase())
)
);
}, [searchTerm]);
return (
{/* Sidebar */}
HRMS Dashboard
{/* Main Content */}
{/* Header */}
{/* Dashboard Content */}
{activeTab === 'dashboard' && (
HR Dashboard Overview
{/* Stats Cards */}
}
/>
}
/>
}
/>
}
/>
{/* Charts and Tables */}
{/* Attendance Chart */}
Weekly Attendance
{/* Leave Requests */}
Recent Leave Requests
| Employee |
Type |
Duration |
Status |
{leaveRequests.map(request => (
| {request.employee} |
{request.type} |
{new Date(request.from).toLocaleDateString()} - {new Date(request.to).toLocaleDateString()} |
{request.status}
|
))}
{/* Bottom Row */}
{/* Recent Employees */}
Recent Employees
{employeesData.slice(0, 3).map(employee => (
{employee.name}
{employee.position}
{employee.status}
))}
{/* Upcoming Events */}
Upcoming Events
{upcomingEvents.map(event => (
{event.title}
{new Date(event.date).toLocaleDateString()} • {event.participants} participants
))}
)}
{activeTab === 'employees' && (
Employee Directory
| Employee |
Position |
Department |
Status |
Actions |
{filteredEmployees.map(employee => (
{employee.name}
|
{employee.position} |
{employee.department} |
{employee.status}
|
|
))}
)}
{/* Placeholder for other tabs */}
{activeTab !== 'dashboard' && activeTab !== 'employees' && (
{activeTab.charAt(0).toUpperCase() + activeTab.slice(1)} Module
This section is under development
)}
);
}
// Component for sidebar items
function SidebarItem({ icon, label, active, onClick }) {
return (
);
}
// Component for stat cards
function StatCard({ title, value, change, isPositive, icon }) {
return (
{title}
{value}
{isPositive ? (
) : (
)}
{change} from last month
{icon}
);
}
// Attendance Chart Component
function AttendanceChart({ data }) {
return (
{data.map((item, index) => (
))}
);
}