|
| 1 | +import React from "react"; |
| 2 | + |
| 3 | +interface ModalProps { |
| 4 | + isVisible: boolean; |
| 5 | + onClose: () => void; |
| 6 | +} |
| 7 | + |
| 8 | +const ModalAttendance: React.FC<ModalProps> = ({ isVisible, onClose }) => { |
| 9 | + const dummyTrainees = [ |
| 10 | + { name: "Ngoma Chris", attendance: 1 }, |
| 11 | + { name: "Ngoma Chris", attendance: 0 }, |
| 12 | + { name: "Ngoma Chris", attendance: 2 }, |
| 13 | + ]; |
| 14 | + |
| 15 | + if (!isVisible) return null; |
| 16 | + |
| 17 | + return ( |
| 18 | + <div className="fixed inset-0 bg-gray-900 bg-opacity-75 flex justify-center items-center z-50"> |
| 19 | + <div className="bg-gray-800 text-white rounded-lg w-96 p-6 shadow-lg"> |
| 20 | + <h2 className="text-xl font-bold text-center text-purple-400 mb-4"> |
| 21 | + Take Attendance |
| 22 | + </h2> |
| 23 | + <div className="text-center"> |
| 24 | + <h3 className="font-semibold text-lg">Week 4</h3> |
| 25 | + <p className="text-sm">Monday, 27th November 2023</p> |
| 26 | + </div> |
| 27 | + |
| 28 | + {/* Trainees List */} |
| 29 | + <div className="mt-4 grid grid-cols-2 gap-2"> |
| 30 | + {dummyTrainees.map((trainee, index) => ( |
| 31 | + <div |
| 32 | + key={index} |
| 33 | + className="flex justify-between items-center bg-gray-700 rounded-lg p-2" |
| 34 | + > |
| 35 | + <span>{trainee.name}</span> |
| 36 | + <div className="flex items-center space-x-2"> |
| 37 | + <span>[{trainee.attendance}]</span> |
| 38 | + <button className="text-red-500">❌</button> |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + ))} |
| 42 | + </div> |
| 43 | + |
| 44 | + {/* Trainee Search Input */} |
| 45 | + <div className="mt-4"> |
| 46 | + <label htmlFor="trainee" className="block text-sm font-medium"> |
| 47 | + Trainee Name |
| 48 | + </label> |
| 49 | + <div className="flex mt-1"> |
| 50 | + <input |
| 51 | + id="trainee" |
| 52 | + type="text" |
| 53 | + className="bg-gray-700 text-white w-full py-2 px-3 rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500" |
| 54 | + placeholder="Ngoma Chris" |
| 55 | + /> |
| 56 | + <button className="ml-2 bg-purple-500 text-white px-4 py-2 rounded-md hover:bg-purple-600"> |
| 57 | + Search |
| 58 | + </button> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + |
| 62 | + {/* Attendance Status Icons */} |
| 63 | + <div className="mt-4 flex items-center justify-center space-x-4"> |
| 64 | + <button className="text-green-500">✔️</button> |
| 65 | + <button className="text-yellow-500">~</button> |
| 66 | + <button className="text-red-500">❌</button> |
| 67 | + </div> |
| 68 | + |
| 69 | + {/* Buttons */} |
| 70 | + <div className="mt-6 flex justify-between"> |
| 71 | + <button |
| 72 | + onClick={onClose} |
| 73 | + className="bg-gray-500 text-white py-2 px-4 rounded-md hover:bg-gray-600" |
| 74 | + > |
| 75 | + Cancel |
| 76 | + </button> |
| 77 | + <button className="bg-purple-500 text-white py-2 px-4 rounded-md hover:bg-purple-600"> |
| 78 | + Submit |
| 79 | + </button> |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + </div> |
| 83 | + ); |
| 84 | +}; |
| 85 | + |
| 86 | +export default ModalAttendance; |
0 commit comments