Correction in Comment popup from Daily Progress Report.

This commit is contained in:
kartik.sharma 2025-05-27 16:36:22 +05:30 committed by ashutosh.nehete
parent a68bd7dc38
commit cd3983dd19
2 changed files with 26 additions and 12 deletions

View File

@ -112,7 +112,7 @@ const AttendanceLog = ({ handleModalData, projectId, showOnlyCheckout }) => {
const { currentPage, totalPages, currentItems: paginatedAttendances, paginate, resetPage } = usePagination(
processedData,
10
20
);
// 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"),
});
/**
* 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 [loading, setloading] = useState(false);
const [comments, setComment] = useState([]);
@ -27,7 +36,7 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
});
const containerRef = useRef(null);
const firstRender = useRef(true);
const firstRender = useRef(true);
useEffect(() => {
@ -79,7 +88,7 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
showToast(error.response.data?.message || "Something went wrong", "error");
}
};
console.log("Kartik", commentsData)
return (
<div
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}
aria-label="Close"
></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">
{comments && comments[0]?.comment}
{commentsData?.workItem?.workArea?.floor?.building?.description}
</p>
<p className="fw-bold my-2 text-start">
Assigned By :
<span className=" ms-2">
@ -126,7 +140,7 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
Completed Work : {commentsData?.completedTask}
</p>
<div className="d-flex align-items-center flex-wrap">
<p className="fw-bold text-start m-0 me-1">Team:</p>
<p className="fw-bold text-start m-0 me-1">Team :</p>
<div className="d-flex flex-wrap align-items-center gap-2">
{commentsData?.teamMembers?.map((member, idx) => (
<span key={idx} className="d-flex align-items-center">
@ -147,7 +161,7 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
{...register("comment")}
className="form-control"
id="exampleFormControlTextarea1"
rows="1"
// rows="2"
placeholder="Enter comment"
/>
{errors.comment && (
@ -170,8 +184,8 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
<ul
className="list-group px-0 mx-0 overflow-auto border-0"
// ref={containerRef} // auto scroll according data
style={{ maxHeight: "200px" }}
// ref={containerRef} // auto scroll according data
// style={{ maxHeight: "200px" }}
>
{comments &&
comments
@ -196,9 +210,9 @@ const ReportTaskComments = ({ commentsData, closeModal }) => {
</span>
</div>
<div className={`text-start py-0`}>
<p className={`mb-0 text-${bgClass}`}>{fullName}</p>
<p className="text-muted m-0" style={{ fontSize: "10px" }}>
<div className={`text-start py-0 d-flex align-items-center justify-content-start`}>
<p className={`mb-0 text-muted me-2`}>{fullName}</p>
<p className={`text-${bgClass} m-0`} style={{ fontSize: "10px" }}>
{moment.utc(data?.commentDate).local().fromNow()}
</p>
</div>