Correction in Comment popup from Daily Progress Report. #152

Merged
ashutosh.nehete merged 2 commits from Kartik_Bug#350 into Issue_May_5W 2025-05-27 11:56:53 +00:00
2 changed files with 26 additions and 12 deletions
Showing only changes of commit 69abd207c6 - Show all commits

View File

@ -112,7 +112,7 @@ const AttendanceLog = ({ handleModalData, projectId, showOnlyCheckout }) => {
const { currentPage, totalPages, currentItems: paginatedAttendances, paginate, resetPage } = usePagination( const { currentPage, totalPages, currentItems: paginatedAttendances, paginate, resetPage } = usePagination(
processedData, processedData,
10 20
); );
// Reset to the first page whenever processedData changes (due to switch on/off) // Reset to the first page whenever processedData changes (due to switch on/off)

View File

@ -13,6 +13,15 @@ const schema = z.object({
comment: z.string().min(1, "Comment cannot be empty"), comment: z.string().min(1, "Comment cannot be empty"),
}); });
/**
* ReportTaskComments component for displaying and adding comments to a task.
* It also shows a summary of the activity and task details.
*
* @param {object} props - The component props.
* @param {object} props.commentsData - Data related to the task and its comments, including the description.
* @param {function} props.closeModal - Callback function to close the modal.
*/
const ReportTaskComments = ({ commentsData, closeModal }) => { const ReportTaskComments = ({ commentsData, closeModal }) => {
const [loading, setloading] = useState(false); const [loading, setloading] = useState(false);
const [comments, setComment] = useState([]); const [comments, setComment] = useState([]);
@ -79,7 +88,7 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
showToast(error.response.data?.message || "Something went wrong", "error"); showToast(error.response.data?.message || "Something went wrong", "error");
} }
}; };
console.log("Kartik", commentsData)
return ( return (
<div <div
className="modal-dialog modal-lg modal-simple report-task-comments-modal mx-sm-auto mx-1" className="modal-dialog modal-lg modal-simple report-task-comments-modal mx-sm-auto mx-1"
@ -93,10 +102,15 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
onClick={closeModal} onClick={closeModal}
aria-label="Close" aria-label="Close"
></button> ></button>
<p className="fs-6 text-dark text-start m-0">Activity Summary</p> <h5 className=" text-center mb-2">
Activity Summary
</h5>
<p className="small-text text-start my-2"> <p className="small-text text-start my-2">
{comments && comments[0]?.comment} {commentsData?.workItem?.workArea?.floor?.building?.description}
</p> </p>
<p className="fw-bold my-2 text-start"> <p className="fw-bold my-2 text-start">
Assigned By : Assigned By :
<span className=" ms-2"> <span className=" ms-2">
@ -147,7 +161,7 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
{...register("comment")} {...register("comment")}
className="form-control" className="form-control"
id="exampleFormControlTextarea1" id="exampleFormControlTextarea1"
rows="1" // rows="2"
placeholder="Enter comment" placeholder="Enter comment"
/> />
{errors.comment && ( {errors.comment && (
@ -171,7 +185,7 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
<ul <ul
className="list-group px-0 mx-0 overflow-auto border-0" className="list-group px-0 mx-0 overflow-auto border-0"
// ref={containerRef} // auto scroll according data // ref={containerRef} // auto scroll according data
style={{ maxHeight: "200px" }} // style={{ maxHeight: "200px" }}
> >
{comments && {comments &&
comments comments
@ -196,9 +210,9 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
</span> </span>
</div> </div>
<div className={`text-start py-0`}> <div className={`text-start py-0 d-flex align-items-center justify-content-start`}>
<p className={`mb-0 text-${bgClass}`}>{fullName}</p> <p className={`mb-0 text-muted me-2`}>{fullName}</p>
<p className="text-muted m-0" style={{ fontSize: "10px" }}> <p className={`text-${bgClass} m-0`} style={{ fontSize: "10px" }}>
{moment.utc(data?.commentDate).local().fromNow()} {moment.utc(data?.commentDate).local().fromNow()}
</p> </p>
</div> </div>