Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 2x 2x 28x 28x 28x 28x 28x 14x 2x | import { Form, Modal } from "antd"; import "./UserDetailsModal.css" import { User } from "@/types/User"; interface Props{ data: User; show?:boolean; handleClose?: ()=>void; } function UserDetailsModal({data, show=false, handleClose}:Props) { function formatDate(dateInput:Date) { // Extract day, month, and year from the date object const date = new Date(dateInput) const day = String(date.getDate()).padStart(2, '0'); const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero based const year = date.getFullYear(); // Return the formatted date string in DD/MM/YYYY format return `${day}/${month}/${year}`; } return ( <Modal className="" title={ <div> <p className="text-lg font-semibold primary-color"> Detailed User Information </p> <br/> <hr/> </div> } open={show} footer={null} onCancel={handleClose} > <Form layout="horizontal"> <Form.Item label="Staff Code" className="custom-form-item" labelCol={{ span: 6 }} labelAlign="left"> <div>{data.staffCode}</div> </Form.Item> <Form.Item label="Full name" className="custom-form-item" labelCol={{ span: 6 }} labelAlign="left"> <div>{data.firstName+" "+data.lastName}</div> </Form.Item> <Form.Item label="Username" className="custom-form-item" labelCol={{ span: 6 }} labelAlign="left"> <p>{data.username}</p> </Form.Item> <Form.Item label="Date of Birth" className="custom-form-item" labelCol={{ span: 6 }} labelAlign="left"> <p>{formatDate(data.dob)}</p> </Form.Item> <Form.Item label="Gender" className="custom-form-item" labelCol={{ span: 6 }} labelAlign="left"> <p>{data.gender}</p> </Form.Item> <Form.Item label="Joined Date" className="custom-form-item" labelCol={{ span: 6 }} labelAlign="left"> <p>{formatDate(data.joinDate)}</p> </Form.Item> <Form.Item label="Type" className="custom-form-item" labelCol={{ span: 6 }} labelAlign="left"> <p>{data.type}</p> </Form.Item> <Form.Item label="Location" className="custom-form-item" labelCol={{ span: 6 }} labelAlign="left"> <p>{data.location.name}</p> </Form.Item> </Form> </Modal> ); } export default UserDetailsModal; |