|
|
|
@ -625,11 +625,54 @@ const DashboardProject = () => {
|
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((err) => err.response); |
|
|
|
|
|
|
|
|
|
if (!result) { |
|
|
|
|
NotificationManager.error(`Could not connect to internet.`, "Failed"); |
|
|
|
|
setIsSendingComment(false); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
const RenderBehindTasks = useMemo(() => { |
|
|
|
|
return ( |
|
|
|
|
<div> |
|
|
|
|
{!isReadyOverdueActivities && <ListLoader />} |
|
|
|
|
{isReadyOverdueActivities && |
|
|
|
|
overdueActivities && |
|
|
|
|
overdueActivities.length < 1 && ( |
|
|
|
|
<div |
|
|
|
|
style={{ |
|
|
|
|
flex: 1, |
|
|
|
|
textAlign: "center", |
|
|
|
|
color: "#E80053", |
|
|
|
|
marginTop: 50, |
|
|
|
|
marginBottom: 50, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
No overdue activity found. |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
{isReadyOverdueActivities && |
|
|
|
|
overdueActivities && |
|
|
|
|
overdueActivities.length > 0 && |
|
|
|
|
overdueActivities.map((item, idx) => { |
|
|
|
|
let end_date; |
|
|
|
|
let planned_end; |
|
|
|
|
let diffDays = 0; |
|
|
|
|
let message = ""; |
|
|
|
|
if (item.end_date && item.end_date !== null) { |
|
|
|
|
end_date = moment(item.end_date); |
|
|
|
|
planned_end = moment(item.planned_end); |
|
|
|
|
diffDays = end_date.diff(planned_end, "days"); |
|
|
|
|
if (isNaN(diffDays)) { |
|
|
|
|
return null; |
|
|
|
|
} else { |
|
|
|
|
if (diffDays > 0) { |
|
|
|
|
message = `Overdue by ${diffDays + 1} days`; |
|
|
|
|
} else { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return ( |
|
|
|
|
<BehindTaskItem key={idx} name={item.name} message={message} /> |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
}, [overdueActivities, isReadyOverdueActivities]); |
|
|
|
|
|
|
|
|
|
if (result.status !== 200) { |
|
|
|
|
NotificationManager.error( |
|
|
|
|