FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

107 line
2.5 KiB

  1. "use client";
  2. import { useState } from "react";
  3. import Button from "@mui/material/Button";
  4. import { Card, Modal, Typography } from "@mui/material";
  5. import TimesheetInputGrid from "./LeaveInputGrid";
  6. interface EnterTimesheetModalProps {
  7. isOpen: boolean;
  8. onClose: () => void;
  9. modalStyle?: any;
  10. }
  11. const EnterTimesheetModal: React.FC<EnterTimesheetModalProps> = ({
  12. ...props
  13. }) => {
  14. const [lockConfirm, setLockConfirm] = useState(false);
  15. const columns = [
  16. {
  17. id: "projectCode",
  18. field: "projectCode",
  19. headerName: "Project Code and Name",
  20. flex: 1,
  21. },
  22. {
  23. id: "task",
  24. field: "task",
  25. headerName: "Task",
  26. flex: 1,
  27. },
  28. ];
  29. const rows = [
  30. {
  31. id: 1,
  32. projectCode: "M1001",
  33. task: "1.2",
  34. },
  35. {
  36. id: 2,
  37. projectCode: "M1301",
  38. task: "1.1",
  39. },
  40. ];
  41. const fetchTimesheet = async () => {
  42. // fetchLeaves();
  43. // const res = await fetch(`http://localhost:8090/api/timesheets`, {
  44. // // const res = await fetch(`${BASE_API_URL}/timesheets`, {
  45. // method: "GET",
  46. // mode: 'no-cors',
  47. // });
  48. // console.log(res.json);
  49. };
  50. return (
  51. <Modal open={props.isOpen} onClose={props.onClose}>
  52. <div>
  53. {/* <Typography variant="h5" id="modal-title" sx={{flex:1}}>
  54. <div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>
  55. Record Leave
  56. </div>
  57. </Typography> */}
  58. <Card style={{
  59. flex: 10,
  60. marginBottom: "20px",
  61. width: "90%",
  62. // height: "80%",
  63. position: "fixed",
  64. top: "50%",
  65. left: "50%",
  66. transform: "translate(-50%, -50%)",
  67. }}>
  68. <TimesheetInputGrid setLockConfirm={setLockConfirm}/>
  69. <div
  70. style={{
  71. display: "flex",
  72. justifyContent: "space-between",
  73. width: "100%",
  74. flex: 1,
  75. padding: "20px",
  76. }}
  77. >
  78. <Button
  79. disabled={lockConfirm}
  80. variant="contained"
  81. onClick={props.onClose}
  82. >
  83. Confirm
  84. </Button>
  85. <Button
  86. variant="contained"
  87. onClick={props.onClose}
  88. sx={{ "background-color": "#F890A5" }}
  89. >
  90. Cancel
  91. </Button>
  92. </div>
  93. </Card>
  94. </div>
  95. </Modal>
  96. );
  97. };
  98. export default EnterTimesheetModal;