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.
 
 
 

112 lines
2.6 KiB

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