|
1 | | -import React from 'react'; |
2 | | -import CheckRole from '../utils/CheckRoles'; |
| 1 | +import React, { useState } from 'react'; |
| 2 | +import AttendanceCard from '../components/AttendanceCard'; |
| 3 | +import Modal from '../components/ModalAttendance'; |
3 | 4 |
|
4 | | -const TraineeAttendanceTracker = React.lazy( |
5 | | - () => import('../pages/TraineeAttendance'), |
6 | | -); |
7 | | -const TraineeAttendance = React.lazy( |
8 | | - () => import('../components/TraineeAttendance'), |
9 | | -); |
| 5 | +const dummyData = [ |
| 6 | + { name: 'Ngoma Chris', email: '[email protected]', score: 'present' }, |
| 7 | + { name: 'Ngoma Chris', email: '[email protected]', score: 'late' }, |
| 8 | + { name: 'Ngoma Chris', email: '[email protected]', score: 'absent' }, |
| 9 | + { name: 'Ngoma Chris', email: '[email protected]', score: 'present' }, |
| 10 | + { name: 'Ngoma Chris', email: '[email protected]', score: 'late' }, |
| 11 | +]; |
| 12 | +const AttendancePage: React.FC = () => { |
| 13 | + const [isModalOpen, setIsModalOpen] = useState(false); |
| 14 | + |
| 15 | + const openModal = () => { |
| 16 | + setIsModalOpen(true); |
| 17 | + }; |
| 18 | + |
| 19 | + const closeModal = () => { |
| 20 | + setIsModalOpen(false); |
| 21 | + }; |
10 | 22 |
|
11 | | -function Attendance() { |
12 | 23 | return ( |
13 | | - <> |
14 | | - <CheckRole roles={['coordinator']}> |
15 | | - <TraineeAttendanceTracker /> |
16 | | - </CheckRole> |
17 | | - <CheckRole roles={['trainee']}> |
18 | | - <TraineeAttendance /> |
19 | | - </CheckRole> |
20 | | - </> |
| 24 | + <div className="min-h-screen bg-gray-900 text-white"> |
| 25 | + <div className="max-w-4xl mx-auto p-6"> |
| 26 | + <h1 className="text-2xl font-bold mb-4">Attendance</h1> |
| 27 | + |
| 28 | + <div className="flex justify-between items-center mb-6"> |
| 29 | + <div> |
| 30 | + <label className="block text-sm font-medium">Team</label> |
| 31 | + <select className="mt-1 block w-full bg-gray-700 border border-gray-600 text-white py-2 px-3 rounded-md"> |
| 32 | + <option>Steppers</option> |
| 33 | + <option>Nova</option> |
| 34 | + <option>Fighters</option> |
| 35 | + </select> |
| 36 | + </div> |
| 37 | + <button |
| 38 | + onClick={openModal} |
| 39 | + className="bg-purple-500 text-white py-2 px-4 rounded-md hover:bg-purple-600" |
| 40 | + type="submit" |
| 41 | + > |
| 42 | + Submit Attendance |
| 43 | + </button> |
| 44 | + </div> |
| 45 | + |
| 46 | + <div className="flex justify-between items-center mb-4"> |
| 47 | + <div className="flex space-x-4"> |
| 48 | + <button className="text-sm font-medium px-3 py-1 border-b-2 border-gray-400"> |
| 49 | + Phase 1 |
| 50 | + </button> |
| 51 | + <button type="button" className="text-sm font-medium px-3 py-1">Phase 2</button> |
| 52 | + <button type="button" className="text-sm font-medium px-3 py-1">Phase 3</button> |
| 53 | + </div> |
| 54 | + |
| 55 | + <div className="flex items-center space-x-2"> |
| 56 | + <label className="text-sm">Week:</label> |
| 57 | + <select className="bg-gray-700 border border-gray-600 text-white py-2 px-3 rounded-md"> |
| 58 | + <option>01</option> |
| 59 | + <option>02</option> |
| 60 | + <option>03</option> |
| 61 | + </select> |
| 62 | + </div> |
| 63 | + </div> |
| 64 | + |
| 65 | + <div className="overflow-x-auto"> |
| 66 | + <table className="min-w-full table-auto divide-y divide-gray-200"> |
| 67 | + <thead className="bg-gray-100 dark:bg-gray-700"> |
| 68 | + <tr> |
| 69 | + <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"> |
| 70 | + Names |
| 71 | + </th> |
| 72 | + <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"> |
| 73 | + Email |
| 74 | + </th> |
| 75 | + <th className="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"> |
| 76 | + Score |
| 77 | + </th> |
| 78 | + </tr> |
| 79 | + </thead> |
| 80 | + <tbody className="bg-white dark:bg-gray-800 divide-y divide-gray-200"> |
| 81 | + {dummyData.map((entry, index) => ( |
| 82 | + <AttendanceCard |
| 83 | + key={index} |
| 84 | + name={entry.name} |
| 85 | + email={entry.email} |
| 86 | + score={entry.score as 'present' | 'late' | 'absent'} |
| 87 | + /> |
| 88 | + ))} |
| 89 | + </tbody> |
| 90 | + </table> |
| 91 | + </div> |
| 92 | + |
| 93 | + <Modal isVisible={isModalOpen} onClose={closeModal} /> |
| 94 | + </div> |
| 95 | + </div> |
21 | 96 | ); |
22 | | -} |
| 97 | +}; |
23 | 98 |
|
24 | | -export default Attendance; |
| 99 | +export default AttendancePage; |
0 commit comments