|
|
|
@ -584,15 +584,23 @@ const DashboardProject = () => {
|
|
|
|
|
{!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 = null; |
|
|
|
|
let today = null; |
|
|
|
|
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); |
|
|
|
|
today = moment(new Date()); |
|
|
|
|
diffDays = today.diff(end_date, 'days'); |
|
|
|
|
message = `Overdue by ${diffDays} days`; |
|
|
|
|
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} /> |
|
|
|
|
})} |
|
|
|
|