diff --git a/src/components/MyActiveJobs/ActiveJobs.jsx b/src/components/MyActiveJobs/ActiveJobs.jsx index db690aa..53f000b 100644 --- a/src/components/MyActiveJobs/ActiveJobs.jsx +++ b/src/components/MyActiveJobs/ActiveJobs.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState, useRef, forwardRef } from "react"; import { useSelector } from "react-redux"; import Layout from "../Partials/Layout"; import { useNavigate } from "react-router-dom"; @@ -6,6 +6,8 @@ import ActiveJobMessage from "./ActiveJobMessage"; import LoadingSpinner from "../Spinners/LoadingSpinner"; import CountDown from "../Helpers/CountDown"; import IndexJobActions from "./JobActions/IndexJobActions"; +import ModalCom from "../Helpers/ModalCom"; +import { useReactToPrint } from "react-to-print"; import usersService from "../../services/UsersService"; @@ -25,6 +27,18 @@ function ActiveJobs(props) { let [requestStatus, setRequestStatus] = useState({loading: false, status: false, message: ''}) + let [popUp, setPopUp] = useState(false) // STATE FOR POPOUT MODAL + + const printRef = useRef(); + // to handle printing + const handlePrint = useReactToPrint({ + content: () => printRef.current, + }); + + const popUpHandler = () => { // FUNCTION TO HANDLE POPOUT + setPopUp(prev => !prev) + } + // FUNCTION TO HANDLE MESSAGE CHANGE const handleMessageChange = ({target:{value}}) => { setMessageToSend(value) @@ -395,7 +409,12 @@ function ActiveJobs(props) { {/* MESSAGE SECTION */}
-

Message

+
+

Message

+ +
{props.activeJobMesList.loading ? : @@ -405,6 +424,12 @@ function ActiveJobs(props) { {/* END OF MESSAGE */}
+ {/* POPOUT SECTION */} + {popUp && + + } + {/* END OF POPOUT SECTION */} + ); } @@ -429,3 +454,104 @@ function convertFileToBase64(file) { }); } +//POPOUT COMPONENT FUNCTION +const PopModal = ({popUpHandler, popUp, details, activeJobMesList, handlePrint, myRef}) => { + return ( + +
+
+

+ {details?.contract} +

+ +
+
+
+ {activeJobMesList.loading ? + + : +
+ + + + + + + {activeJobMesList?.data?.length ? + ( + + {activeJobMesList?.data?.map((item, index) => ( + + + + ))} + + ) + : + activeJobMesList.error ? + ( + + + + + + ) + : + + + + + + } +
+
+
{item.msg_date} {item.msg_firstname}
+ +
+ +
Opps! an error occurred. Please try again!
No Message Found!
+
+ } +
+ + {/* btn */} +
+
+ + +
+
+
+
+
+ ) +} + diff --git a/src/index.css b/src/index.css index e4c7fcb..93c3d14 100644 --- a/src/index.css +++ b/src/index.css @@ -621,6 +621,20 @@ input[type="text"][dir="rtl"] { .modal-com { transition: all 0.1s ease-in-out; } + +@media print { + body .modal-com{ + height: 100%; + overflow: hidden; + } + .job-action-modal-body button, .message-modal-header button { + display: none; + } + .message-modal-wrapper .message-table{ + height: 100%; + overflow-y: hidden; + } +} /* TODO: =================================modal end================================= */ /* TODO: =================================login ================================= */ .btn-login {