diff --git a/src/components/Activities/ReportTaskComments.jsx b/src/components/Activities/ReportTaskComments.jsx index 054390e3..60452887 100644 --- a/src/components/Activities/ReportTaskComments.jsx +++ b/src/components/Activities/ReportTaskComments.jsx @@ -8,6 +8,7 @@ import showToast from "../../services/toastService"; import Avatar from "../common/Avatar"; import { getBgClassFromHash } from "../../utils/projectStatus"; import { cacheData, getCachedData } from "../../slices/apiDataManager"; +import ImagePreview from "../common/ImagePreview"; const schema = z.object({ comment: z.string().min(1, "Comment cannot be empty"), @@ -40,7 +41,9 @@ const ReportTaskComments = ({ commentsData, closeModal }) => { useEffect(() => { const taskList = getCachedData("taskList"); if (taskList && taskList.data && commentsData?.id) { - const currentTask = taskList.data.find(task => task.id === commentsData.id); + const currentTask = taskList.data.find( + (task) => task.id === commentsData.id + ); if (currentTask && currentTask.comments) { setComment(currentTask.comments); } else { @@ -99,157 +102,170 @@ const ReportTaskComments = ({ commentsData, closeModal }) => { showToast("Successfully Sent", "success"); } catch (error) { setloading(false); - showToast(error.response.data?.message || "Something went wrong", "error"); + showToast( + error.response.data?.message || "Something went wrong", + "error" + ); } }; - return ( -
- {commentsData?.workItem?.workArea?.floor?.building?.description} -
++ {commentsData?.workItem?.workArea?.floor?.building?.description} +
-- Assigned By : - - {commentsData?.assignedBy?.firstName + - " " + - commentsData?.assignedBy?.lastName} - {" "} -
++ Assigned By : + + {commentsData?.assignedBy?.firstName + + " " + + commentsData?.assignedBy?.lastName} + {" "} +
-
- Reported By :
- -
- {/* {commentsData?.assignedBy?.firstName +
+
+ Reported By :
+
+ {" "}
+ -
+ {/* {commentsData?.assignedBy?.firstName +
" " +
commentsData?.assignedBy?.lastName} */}
- {" "}
-
- Location : - - {`${commentsData?.workItem?.workArea?.floor?.building?.name}`}{" "} - {" "} - {`${commentsData?.workItem?.workArea?.floor?.floorName} `}{" "} - - {`${commentsData?.workItem?.workArea?.areaName}`} - - {` ${commentsData?.workItem?.activityMaster?.activityName}`} - -
-- Planned Work: {commentsData?.plannedTask}{" "} - { - commentsData?.workItem?.activityMaster - ?.unitOfMeasurement - } -
-- {" "} - Completed Work : {commentsData?.completedTask}{" "} - { - commentsData?.workItem?.activityMaster - ?.unitOfMeasurement - } -
-Team :
-+ Location : + + {`${commentsData?.workItem?.workArea?.floor?.building?.name}`}{" "} + {" "} + {`${commentsData?.workItem?.workArea?.floor?.floorName} `}{" "} + + {`${commentsData?.workItem?.workArea?.areaName}`} + + {` ${commentsData?.workItem?.activityMaster?.activityName}`} + +
++ Planned Work: {commentsData?.plannedTask}{" "} + {commentsData?.workItem?.activityMaster?.unitOfMeasurement} +
++ {" "} + Completed Work : {commentsData?.completedTask}{" "} + {commentsData?.workItem?.activityMaster?.unitOfMeasurement} +
+Team :
+{fullName}
-- {moment.utc(data?.commentDate).local().fromNow()} -
-{data?.comment}
-Attachment
+{fullName}
++ {moment.utc(data?.commentDate).local().fromNow()} +
++ {data?.comment} +
+ {data?.preSignedUrls?.length > 0 && ( +