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.
 
 

126 line
3.3 KiB

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