[text] tododashboard

Viewer

copydownloadembedprintName: tododashboard
  1. import React, { useEffect, useState } from "react";
  2. import { Button, Col, Container, Dropdown, Modal, Row } from "react-bootstrap";
  3. import "./TodoDashboard.css";
  4. import UpdateHeader from "../Components/UpdateHeader/UpdateHeader";
  5. import checkAll from "../Assets/Check.svg";
  6. import flagRed from "../Assets/emoji_flags.svg";
  7. import UpdateProgress from "../Components/ProgressBar/UpdateProgress";
  8. import UpdateWork from "../Components/UpdateWork/UpdateWork";
  9. import CheckList from "../Components/CheckList/CheckList";
  10. import FacingIssue from "../Components/Facing Issue/FacingIssue";
  11. import UpdateDetails from "../Components/UpdateDetails/UpdateDetails";
  12. import { ThreeDots } from "react-loader-spinner";
  13. import LogScreen from "../Components/LogScreen/LogScreen";
  14. import axios from "axios";
  15. import { constants } from "../../../baseURL";
  16. import { commonFunction } from "../Components/Function/function";
  17. import AddIssueModalUser from "../Components/Addition Modal/Add Issue/AddIssueModalUser";
  18. import HoldTask from "../Components/Hold Task/HoldTask";
  19. import DeleteTask from "../Components/Addition Modal/Delete Task/DeleteTask";
  20. import ResumeTask from "../Components/Addition Modal/Resume Task/ResumeTask";
  21. import UpdateDetailSingle from "../Components/UpdateDetails/UpdateDetailSingle";
  22. import DetailDependency from "../Components/UpdateDetails/DetailDependency";
  23. import DotsThreeRight from "../../../assets/images/DotsThreeRight.svg";
  24. import NewTaskModal from "../../../components/commonModal/NewTaskModal";
  25. import { useDispatch, useSelector } from "react-redux";
  26. import toast from "react-hot-toast";
  27. import { getReq } from "../../../api";
  28. import { useSearchParams } from "react-router-dom";
  29. import { setAllUserList } from "../../../Redux/Slices/taskManagerSlice";
  30. import useApiFetchCustomHookForEmailService from "../../../piservices/ApiFetchCustomHookForEmailService";
  31.  
  32. const TodoDashboard = ({
  33.   isClose,
  34.   isOpen,
  35.   projectId,
  36.   taskId,
  37.   setCheckTaskId,
  38. }) => {
  39.   const updatedCheckList = useSelector(
  40.     (state) => state.taskManager.updatedCheckList
  41.   );
  42.   const profileDataData = useSelector(
  43.     (state) => state.timeline.profileDataData
  44.   );
  45.   //console.log('projectIddddd', projectId)
  46.   const [loading, setLoading] = useState(true);
  47.   const [teamMemberId, setTeamMemberId] = useState("");
  48.   const [teamMemberName, setTeamMemberName] = useState("");
  49.   const [specificTaskData, setSpecificTaskData] = useState({});
  50.   const [logs, setLogs] = useState("");
  51.   const [DetailCategory, setdetailCategory] = useState("Details");
  52.   const [updateBtn, setUpdateBtn] = useState(false);
  53.   const [isHold, setIsHold] = useState(false);
  54.   //UpdateWork Component
  55.   const [workStatusType, setWorkStatusType] = useState("percentage");
  56.   const [workDoneToday, setWorkDoneToday] = useState();
  57.   const [refresh, setRefresh] = useState(false);
  58.   const [searchInput, setSearchInput] = useState("");
  59.   useEffect(() => {
  60.     setWorkDoneToday(0);
  61.   }, []);
  62.   const [searchParams] = useSearchParams();
  63.   const [isUpdateFirst, setisUpdateFirst] = useState(false);
  64.   const isLead = searchParams.get("isLead");
  65.   const [totalWorkQuantity, setTotalWorkQuantity] = useState(100);
  66.   const [showDetails, setShowDetails] = useState(true);
  67.   
  68.   //CheckList Component
  69.   const [storeChecklist, setStoreCheckList] = useState([]);
  70.   const [logFilter, setLogFilter] = useState(3);
  71.   const [isChecklistUpdate, setIsChecklistUpdate] = useState(false);
  72.   const [deleteTask, setDeleteTask] = useState(false);
  73.   const [holdTask, setHoldTask] = useState(false);
  74.   const dispatch = useDispatch();
  75.   const [show, setShow] = useState(false);
  76.   const [showModal, setShowModal] = useState(false);
  77.   const { sendEmailPushBellNotifications } = useApiFetchCustomHookForEmailService()
  78.   const allUserList = useSelector(
  79.     (state) => state.taskManager.allUserList
  80.   );
  81.   //console.log(specificTaskData);
  82.   //Api to get the data of specific task
  83.   const getSpecificTassk = async () => {
  84.     const res = await axios
  85.       .get(
  86.         `${constants.PMT_BASE}/api/timelines2/get-all-type-tasks-by-id?id=${taskId}`
  87.       )
  88.       .then((res) => {
  89.         setSpecificTaskData(res?.data);
  90.         getLogs()
  91.         setLoading(false);
  92.         setStoreCheckList(res?.data?.checkList);
  93.       });
  94.   };
  95.  
  96.   useEffect(() => {
  97.     const fetchUserData = async () => {
  98.       const res =  await getReq(`${constants.B2B_BASE}/api/enterprise/get-team-member?userId=${localStorage.getItem(
  99.               "userId"
  100.             )}&projectId=${specificTaskData?.projectId?._id}&type=2`
  101.           )
  102.         
  103.       //console.log({ userResponse });
  104.       if (res) {
  105.  
  106.         const changedTeamMemberList = res.data.data.map((item)=>{return {email:item.email, _id:item.memberId,fullName:item.memberName }})
  107.         dispatch(setAllUserList(changedTeamMemberList))
  108.       } else {
  109.         //console.log("Something went wrong");
  110.       }
  111.     };
  112.     // fetchPredData();
  113.     fetchUserData();
  114.   }, []);
  115.   useEffect(() => {
  116.     getSpecificTassk();
  117.   }, []);
  118.  
  119.   //Api to get the logs
  120.   const getLogs = async (data) => {
  121.     const res = await axios
  122.       .get(
  123.         `${constants.PMT_BASE}/api/timelines2/get-task-logs?userId=${localStorage.getItem("userId")}&taskId=${taskId}&flag=${data}`
  124.       )
  125.       .then((res) => {
  126.         setLogs(res?.data?.reverse());
  127.         //console.log("@@@@@###", res?.data);
  128.       });
  129.   };
  130.  
  131.   useEffect(() => {
  132.     getLogs(0);
  133.   }, [specificTaskData]);
  134.  
  135.   //Api to edit cehcklist
  136.   const updateChecklist = async (_id) => {
  137.     let array = [];
  138.     if (isChecklistUpdate) {
  139.       await axios
  140.         .post(
  141.           `${
  142.             constants.PMT_BASE
  143.           }/api/timelines2/edit-checklist?userId=${localStorage.getItem(
  144.             "userId"
  145.           )}&taskId=${specificTaskData?._id}`,
  146.           updatedCheckList
  147.         )
  148.         .then(function (response) {
  149.           //console.log(response?.data);
  150.           setUpdateBtn(false);
  151.         })
  152.         .catch(function (error) {
  153.           //console.log(error);
  154.         });
  155.     }
  156.   };
  157.  
  158.   // Api to edit task
  159.  
  160.   const uomTpyeSubmit = async () => {
  161.     if( specificTaskData?.isUpdatedFirstTime === false){
  162.     let obj =
  163.       specificTaskData?.isUpdatedFirstTime === false
  164.         ? totalWorkQuantity
  165.         : specificTaskData?.uomTotalWork;
  166.     let totalWorkDone =
  167.       specificTaskData?.uomType === "percentage"
  168.         ? workDoneToday
  169.         : Number(specificTaskData?.totalWorkDone) + Number(workDoneToday);
  170.     let progress =
  171.       specificTaskData?.uomType === "percentage"
  172.         ? workDoneToday
  173.         : (
  174.             ((specificTaskData?.totalWorkDone + Number(workDoneToday)) /
  175.               Number(obj)) *
  176.             100
  177.           ).toString();
  178.    
  179.     const res = await axios
  180.       .post(
  181.         `${constants.PMT_BASE}/api/timelines2/edit-task?taskId=${
  182.           specificTaskData?._id
  183.         }&projectId=${
  184.           specificTaskData?.projectId?._id
  185.         }&userId=${localStorage.getItem("userId")}`,
  186.         {
  187.           uomType: workStatusType,
  188.           uomTotalWork: totalWorkQuantity.toString(),
  189.           isUpdatedFirstTime: true,
  190.          
  191.         }
  192.       )
  193.       .then((res) => {
  194.         //console.log(res);
  195.         getSpecificTassk();
  196.         setUpdateBtn(false);
  197.       })
  198.       .catch((err) => {
  199.         //console.log(err);
  200.       });
  201.     }
  202.   };
  203.   console.log({updatedCheckList})
  204.   const editTask = async () => {
  205.     //console.log({ workDoneToday });
  206.     // let checkChecklist = "notFinist"
  207.     const filteringOtherReceivers = [];
  208.     const filteringReceivers = [];
  209.     filteringOtherReceivers.push(allUserList.find(item => item._id == localStorage.getItem('userId')));
  210.     filteringReceivers.push(allUserList.find(item => item._id == specificTaskData.assignedTo));
  211.     let hasEmptyTypeKey = updatedCheckList.some(obj => obj.type === '');
  212.     
  213.     let uomType =
  214.       specificTaskData?.isUpdatedFirstTime === false
  215.         ? workStatusType
  216.         : specificTaskData?.uomType;
  217.     let uomTotalWork =
  218.       specificTaskData?.isUpdatedFirstTime === false
  219.         ? totalWorkQuantity.toString()
  220.         : specificTaskData?.uomTotalWork;
  221.     let obj =
  222.       specificTaskData?.isUpdatedFirstTime === false
  223.         ? totalWorkQuantity
  224.         : specificTaskData?.uomTotalWork;
  225.     let totalWorkDone =
  226.       uomType === "percentage"
  227.         ? workDoneToday
  228.         : Number(specificTaskData?.totalWorkDone) + Number(workDoneToday);
  229.     let progress =
  230.       uomType === "percentage"
  231.         ? workDoneToday
  232.         : (
  233.             ((specificTaskData?.totalWorkDone + Number(workDoneToday)) /
  234.               Number(obj)) *
  235.             100
  236.           ).toString();
  237.           if(Math.ceil(progress)>100){
  238.             toast.error("Task progress can't be more than 100%")
  239.           }
  240.           else{
  241.           if(hasEmptyTypeKey && Math.ceil(progress) === 100){
  242.             toast.error("Please complete all the checklist before completing the task")
  243.           }
  244.           else{
  245.     let status = 0;
  246.     if (
  247.       (Math.ceil(progress) > 0 && Math.ceil(progress) < 100) ||
  248.       isChecklistUpdate
  249.     ) {
  250.       status = 1;
  251.     } else if ((Math.ceil(progress) > 99 && hasEmptyTypeKey === false)) {
  252.       status = 2;
  253.     }
  254.   console.log("ncalncsn",parseInt(Math.ceil(progress)), typeof(progress))
  255.   console.log("ncalncsn1",parseInt(specificTaskData?.progress),typeof(parseInt(specificTaskData?.progress)))
  256.     if ((specificTaskData?.totalWorkDone <= specificTaskData?.uomTotalWork) && (parseInt(Math.ceil(progress)) !== parseInt(specificTaskData?.progress))) {
  257.       const res = await axios
  258.         .post(
  259.           `${constants.PMT_BASE}/api/timelines2/edit-task?taskId=${
  260.             specificTaskData?._id
  261.           }&projectId=${
  262.             specificTaskData?.projectId?._id
  263.           }&userId=${localStorage.getItem("userId")}`,
  264.           {
  265.             workDoneToday: workDoneToday,
  266.             totalWorkDone: totalWorkDone,
  267.             progress: Math.ceil(progress),
  268.             status: status,
  269.             uomTotalWork: uomTotalWork,
  270.             uomType: uomType,
  271.             typeTask:"to-do"
  272.           }
  273.         )
  274.         .then((res) => {
  275.           if(progress==100){
  276.             sendEmailPushBellNotifications('Task(Update)', {
  277.               '@taskName': specificTaskData.taskName,
  278.               '@username': profileDataData.fullName,
  279.               '@sender': profileDataData.fullName,
  280.               '@Sender': profileDataData.fullName,
  281.           "@senderFirstName": profileDataData.fullName.split(" ")[0],
  282.               '@projectName': specificTaskData.projectId.projectName,
  283.               '@project name': specificTaskData.projectId.projectName
  284.             }
  285.               , filteringReceivers,filteringOtherReceivers,[],[],
  286.               'Task Manager')
  287.           }else{
  288.             sendEmailPushBellNotifications('Update', {
  289.               '@taskName': specificTaskData.taskName,
  290.               '@username': profileDataData.fullName,
  291.               '@sender': profileDataData.fullName,
  292.               '@Sender': profileDataData.fullName,
  293.           "@senderFirstName": profileDataData.fullName.split(" ")[0],
  294.               '@projectName': specificTaskData.projectId.projectName,
  295.               '@project name': specificTaskData.projectId.projectName
  296.             }
  297.               , filteringReceivers,filteringOtherReceivers,[],[],
  298.               'Task Manager')
  299.           }
  300.        
  301.           toast.success("Task updated successfully");
  302.         
  303.         })
  304.         .catch((err) => {
  305.           //console.log(err);
  306.         });
  307.     }
  308.   }}
  309.   isClose(false);
  310.   setWorkDoneToday(0);
  311.   setTimeout(() => {
  312.     window.location.reload()
  313.   }, 1500);
  314.    
  315.   getSpecificTassk();
  316.   
  317.   setUpdateBtn(false);
  318.   };
  319.   const reAssignMember = async (item) => {
  320.     const reassignOtherReceivers = [];
  321.     const reassignReceivers = [];
  322.     reassignOtherReceivers.push(allUserList.find(item => item._id == specificTaskData.assignedTo));
  323.     reassignReceivers.push(allUserList.find(item => item._id == teamMemberId));
  324.     console.log({reassignReceivers})
  325.     const res = await axios
  326.       .post(
  327.         `${constants.PMT_BASE}/api/timelines2/edit-task?taskId=${
  328.           specificTaskData?._id
  329.         }&projectId=${
  330.           specificTaskData?.projectId?._id
  331.         }&userId=${localStorage.getItem("userId")}`,
  332.         {
  333.           assignedTo: teamMemberId,
  334.         }
  335.       )
  336.       .then((res) => {
  337.         //console.log(res);
  338.         getSpecificTassk();
  339.         setRefresh(true);
  340.         setUpdateBtn(false);
  341.         sendEmailPushBellNotifications('Re-Assign  Task/RFI/MR/Issue', {
  342.           '@taskName': specificTaskData.taskName,
  343.           '@projectName': specificTaskData.projectId.projectName,
  344.           '@project name': specificTaskData.projectId.projectName,
  345.           '@newReceiver': reassignReceivers[0]?.fullName,
  346.           '@previousReceiver':reassignOtherReceivers[0].fullName
  347.         }
  348.           , reassignReceivers,reassignOtherReceivers,[],[],
  349.           'Task Manager')
  350.         
  351.       })
  352.       .catch((err) => {
  353.         //console.log(err);
  354.       });
  355.   };
  356.   const reAssignMemberDependency = async (item) => {
  357.     const reassignOtherReceivers2 = [];
  358.     const reassignReceivers2 = [];
  359.     reassignOtherReceivers2.push(allUserList.find(item => item._id == specificTaskData.assignedTo));
  360.     reassignReceivers2.push(allUserList.find(item => item._id == teamMemberId));
  361.     const res = await axios
  362.       .post(
  363.         `${constants.PMT_BASE}/api/timelines2/edit-task-dependency?taskId=${
  364.           specificTaskData?._id
  365.         }&projectId=${
  366.           specificTaskData?.projectId?._id
  367.         }&userId=${localStorage.getItem("userId")}`,
  368.         {
  369.           assignedTo: teamMemberId,
  370.         }
  371.       )
  372.       .then((res) => {
  373.         //console.log(res);
  374.         getSpecificTassk();
  375.         setUpdateBtn(false);
  376.         sendEmailPushBellNotifications('Re-Assign  Task/RFI/MR/Issue', {
  377.           '@taskName': specificTaskData.taskName,
  378.           '@projectName': specificTaskData.projectId.projectName,
  379.           '@project name': specificTaskData.projectId.projectName,
  380.           '@newReceiver': reassignReceivers2[0]?.fullName,
  381.           '@previousReceiver':reassignOtherReceivers2[0].fullName
  382.         }
  383.           , reassignReceivers2,reassignOtherReceivers2,profileDataData.admins,profileDataData.superAdmins,
  384.           'Task Manager')
  385.       })
  386.       .catch((err) => {
  387.         //console.log(err);
  388.       });
  389.   };
  390.   return (
  391.     <>
  392.       <Modal
  393.         show={isOpen}
  394.         centered
  395.         size="xl"
  396.         style={{
  397.           overflow: "hidden",
  398.           maxHeight: "95vh",
  399.           borderBottomLeftRadius: "0.5rem",
  400.         }}
  401.       >
  402.         <Modal.Header className="modalHeaderCont">
  403.           <Modal.Title style={{ width: "100%" }}>
  404.             <div className="to-do-ModalHeader">
  405.               <div className="to-do-ModalHeaderLeft">
  406.                 {loading ? (
  407.                   <></>
  408.                 ) : (
  409.                   <>
  410.                     <span className="to-do-taskName">
  411.                       {specificTaskData?.taskName
  412.                         ? specificTaskData?.taskName.charAt(0).toUpperCase() +
  413.                           specificTaskData?.taskName.slice(1)
  414.                         : ""}
  415.                     </span>
  416.                     <span className="to-do-dueDate">
  417.                       of{" "}
  418.                       <span className="to-do-headerProjectName">
  419.                         {specificTaskData?.projectId?.name}
  420.                       </span>{" "}
  421.                       due on{" "}
  422.                       {commonFunction.getTime(specificTaskData?.plannedEndDate)}
  423.                     </span>
  424.                     {((specificTaskData?.projectAdmin !== undefined &&
  425.                       specificTaskData.projectAdmin ==
  426.                         localStorage.getItem("userId")) ||
  427.                         profileDataData.isAdmin || profileDataData.isSuperAdmin ||
  428.                       specificTaskData.assignedBy ==
  429.                         localStorage.getItem("userId")) && (
  430.                       <span className="to-do-headerProjectDropDown">
  431.                         <Dropdown>
  432.                           <Dropdown.Toggle className="to-do-headerProjectDropDownToggle">
  433.                             <img src={DotsThreeRight} alt="" />
  434.                           </Dropdown.Toggle>
  435.                           {Math.floor(specificTaskData?.progress) == 100 ? (
  436.                             <Dropdown.Menu className="to-do-headerProjectDropDownMenu">
  437.                               <Dropdown.Item disabled> Edit Task</Dropdown.Item>
  438.                               <Dropdown.Item disabled> Hold Task</Dropdown.Item>
  439.                               <Dropdown.Item disabled>
  440.                                 {" "}
  441.                                 Delete Task
  442.                               </Dropdown.Item>
  443.                             </Dropdown.Menu>
  444.                           ) : (
  445.                             <Dropdown.Menu className="to-do-headerProjectDropDownMenu">
  446.                               <Dropdown.Item onClick={() => setShowModal(true)}>
  447.                                 {" "}
  448.                                 Edit Task
  449.                               </Dropdown.Item>
  450.                               {specificTaskData?.holdTask === true ? (
  451.                                 <Dropdown.Item disabled>
  452.                                   {" "}
  453.                                   Hold Task
  454.                                 </Dropdown.Item>
  455.                               ) : (
  456.                                 <Dropdown.Item
  457.                                   onClick={() => setHoldTask(true)}
  458.                                 >
  459.                                   {" "}
  460.                                   Hold Task
  461.                                 </Dropdown.Item>
  462.                               )}
  463.  
  464.                               <Dropdown.Item
  465.                                 onClick={() => setDeleteTask(true)}
  466.                               >
  467.                                 {" "}
  468.                                 Delete Task
  469.                               </Dropdown.Item>
  470.                             </Dropdown.Menu>
  471.                           )}
  472.                         </Dropdown>
  473.                       </span>
  474.                     )}
  475.                   </>
  476.                 )}
  477.               </div>
  478.               <div className="to-do-ModalHeaderRight">
  479.                 <Button
  480.                   className="to-do-cancelBtn"
  481.                   onClick={() => (
  482.                     localStorage.setItem("taskId", taskId),
  483.                     isClose(false),
  484.                     (refresh || isHold) && window.location.reload()
  485.                   )}
  486.                 >
  487.                   Cancel
  488.                 </Button>
  489.                 {loading ? (
  490.                   <Button variant="primary">
  491.                     <ThreeDots
  492.                       height="25"
  493.                       width="50"
  494.                       radius="9"
  495.                       color="#0084EF"
  496.                       ariaLabel="three-dots-loading"
  497.                       wrapperStyle={{}}
  498.                       wrapperClassName=""
  499.                       visible={true}
  500.                     />
  501.                   </Button>
  502.                 ) : (
  503.                   <Button
  504.                     variant="primary"
  505.                     onClick={() => (
  506.                      
  507.                       localStorage.setItem("taskId", taskId),
  508.                       
  509.                       specificTaskData.assignedTo !== teamMemberId &&
  510.                       specificTaskData?.taskType === "dependency"
  511.                         ? reAssignMemberDependency()
  512.                         : specificTaskData.assignedTo !== teamMemberId &&
  513.                           reAssignMember(),
  514.                       updateChecklist(),
  515.                       specificTaskData.isUpdatedFirstTime === false && uomTpyeSubmit(),
  516.                       editTask()
  517.                      
  518.                      
  519.                       // setCheckTaskId(false)
  520.                     )}
  521.                     disabled={
  522.                       updateBtn === false &&
  523.                       specificTaskData.holdTask === false &&
  524.                       (specificTaskData.projectAdmin ===
  525.                         localStorage.getItem("userId") ||
  526.                         profileDataData.isAdmin || profileDataData.isSuperAdmin ||
  527.                         specificTaskData?.assignedTo ===
  528.                           localStorage.getItem("userId") ||
  529.                         specificTaskData?.assignedBy ===
  530.                           localStorage.getItem("userId")) &&
  531.                       Math.ceil(specificTaskData?.progress) < 100
  532.                         ? false
  533.                         : true
  534.                     }
  535.                   >
  536.                     Update
  537.                   </Button>
  538.                 )}
  539.               </div>
  540.             </div>
  541.           </Modal.Title>
  542.         </Modal.Header>
  543.         <Container className="todoContainer">
  544.           {loading ? (
  545.             <div
  546.               style={{
  547.                 width: "100%",
  548.                 display: "flex",
  549.                 justifyContent: "center",
  550.                 marginTop: "18%",
  551.               }}
  552.             >
  553.               <ThreeDots
  554.                 height="80"
  555.                 width="80"
  556.                 radius="9"
  557.                 color="#0084EF"
  558.                 ariaLabel="three-dots-loading"
  559.                 wrapperStyle={{}}
  560.                 wrapperClassName=""
  561.                 visible={true}
  562.               />
  563.             </div>
  564.           ) : (
  565.             <Row>
  566.               <Col xs={12} md={8}>
  567.                 <UpdateProgress
  568.                   projectId={projectId}
  569.                   reAssignMemberDependency={reAssignMemberDependency}
  570.                   reAssignMember={reAssignMember}
  571.                   setTeamMemberId={setTeamMemberId}
  572.                   teamMemberName={teamMemberName}
  573.                   setTeamMemberName={setTeamMemberName}
  574.                   teamMemberId={teamMemberId}
  575.                   setRefresh={setRefresh}
  576.                   workStatusType={workStatusType}
  577.                   setWorkStatusType={setWorkStatusType}
  578.                   taskData={specificTaskData}
  579.                   getSpecificTassk={getSpecificTassk}
  580.                   totalWorkQuantity={totalWorkQuantity}
  581.                   setWorkDoneToday={setWorkDoneToday}
  582.                   setShow={setShow}
  583.                   show={show}
  584.                   updateChecklist={updateChecklist}
  585.                   isUpdateFirst={isUpdateFirst}
  586.                   setisUpdateFirst={setisUpdateFirst}       
  587.                 />
  588.                 <button onClick={()=>setShowDetails(!showDetails)}>df</button>
  589.                {showDetails === false && 
  590.                <div style={{paddingLeft:"3%", marginBottom:"3%"}}>
  591.                 <UpdateWork
  592.                 isUpdateFirst={isUpdateFirst}
  593.                 setisUpdateFirst={setisUpdateFirst}                   
  594.                  taskData={specificTaskData}
  595.                  workStatusType={workStatusType}
  596.                  setWorkStatusType={setWorkStatusType}
  597.                  workDoneToday={workDoneToday}
  598.                  setWorkDoneToday={setWorkDoneToday}
  599.                  totalWorkQuantity={totalWorkQuantity}
  600.                  setTotalWorkQuantity={setTotalWorkQuantity}
  601.                />
  602.                </div>
  603.                }
  604.                 {showDetails &&
  605.                 <div className="to-do-updateCont">
  606.                   <UpdateWork
  607.                    isUpdateFirst={isUpdateFirst}
  608.                    setisUpdateFirst={setisUpdateFirst}                   
  609.                     taskData={specificTaskData}
  610.                     workStatusType={workStatusType}
  611.                     setWorkStatusType={setWorkStatusType}
  612.                     workDoneToday={workDoneToday}
  613.                     setWorkDoneToday={setWorkDoneToday}
  614.                     totalWorkQuantity={totalWorkQuantity}
  615.                     setTotalWorkQuantity={setTotalWorkQuantity}
  616.                   />
  617.  
  618.                   {specificTaskData?.checkList?.length > 0 && (
  619.                     <CheckList
  620.                       setIsChecklistUpdate={setIsChecklistUpdate}
  621.                       isChecklistUpdate={isChecklistUpdate}
  622.                       taskData={specificTaskData}
  623.                       setStoreCheckList={setStoreCheckList}
  624.                     />
  625.                   )}
  626.                 </div>}
  627.                 <FacingIssue
  628.                   taskData={specificTaskData}
  629.                   setdetailCategory={setdetailCategory}
  630.                   getSpecificTassk={getSpecificTassk}
  631.                 />
  632.                 <div className="updateDetailsCont">
  633.                   {DetailCategory === "Details" ? (
  634.                     <UpdateDetailSingle
  635.                       taskData={specificTaskData}
  636.                       DetailCategory={DetailCategory}
  637.                     />
  638.                   ) : DetailCategory === "Subtask" ? (
  639.                     specificTaskData?.subTasks?.map((curElem, i) => {
  640.                       return (
  641.                         <UpdateDetails
  642.                           taskData={curElem}
  643.                           DetailCategory={DetailCategory}
  644.                         />
  645.                       );
  646.                     })
  647.                   ) : DetailCategory === "Dependency" ? (
  648.                     specificTaskData?.dependencies?.length > 0 &&
  649.                     specificTaskData?.dependencies?.map((cur, i) => {
  650.                       return (
  651.                         <DetailDependency
  652.                           taskData={cur}
  653.                           DetailCategory={DetailCategory}
  654.                         />
  655.                       );
  656.                     })
  657.                   ) : DetailCategory === "Observation" ? (
  658.                     <UpdateDetails
  659.                       taskData={specificTaskData}
  660.                       DetailCategory={DetailCategory}
  661.                     />
  662.                   ) : DetailCategory === "Snag List" ? (
  663.                     <UpdateDetails
  664.                       taskData={specificTaskData}
  665.                       DetailCategory={DetailCategory}
  666.                     />
  667.                   ) : DetailCategory === "RFI" ? (
  668.                     <UpdateDetails
  669.                       taskData={specificTaskData}
  670.                       DetailCategory={DetailCategory}
  671.                     />
  672.                   ) : (
  673.                     DetailCategory === "Predecessor" && (
  674.                       <UpdateDetails
  675.                         taskData={specificTaskData}
  676.                         DetailCategory={DetailCategory}
  677.                       />
  678.                     )
  679.                   )}
  680.                   {/* <UpdateDetails taskData={specificTaskData} /> */}
  681.                 </div>
  682.               </Col>
  683.               <Col xs={6} md={4} style={{ borderLeft: "1px solid #DEDEDE" }}>
  684.                 <LogScreen
  685.                   logsData={logs}
  686.                   taskData={specificTaskData}
  687.                   getLogs={getLogs}
  688.                   logFilter={logFilter}
  689.                   setLogFilter={setLogFilter}
  690.                   projectId={projectId}
  691.                 />
  692.               </Col>
  693.             </Row>
  694.           )}
  695.         </Container>
  696.       </Modal>
  697.       {holdTask && (
  698.         <HoldTask
  699.           setIsHold={setIsHold}
  700.           taskData={specificTaskData}
  701.           holdTask={holdTask}
  702.           setHoldTask={setHoldTask}
  703.           getSpecificTassk={getSpecificTassk}
  704.         />
  705.       )}
  706.       {deleteTask && (
  707.         <DeleteTask
  708.           taskData={specificTaskData}
  709.           setDeleteTask={setDeleteTask}
  710.           deleteTask={deleteTask}
  711.           isClose={isClose}
  712.           isOpen={isOpen}
  713.         />
  714.       )}
  715.       {showModal && (
  716.         <NewTaskModal
  717.           showModal={showModal}
  718.           setShowModal={setShowModal}
  719.           isClose={isClose}
  720.           isOpen={isOpen}
  721.           isEdit={true}
  722.           taskId={taskId}
  723.           projectId={projectId}
  724.           getSpecificTassk={getSpecificTassk}
  725.           setSearchInput={setSearchInput}
  726.         />
  727.       )}
  728.     </>
  729.   );
  730. };
  731.  
  732. export default TodoDashboard;
  733.  

Editor

You can edit this paste and save as new:


File Description
  • tododashboard
  • Paste Code
  • 16 May-2024
  • 28.01 Kb
You can Share it: