|
|
@ -584,15 +584,23 @@ const DashboardProject = () => { |
|
|
|
{!isReadyOverdueActivities && <ListLoader />} |
|
|
|
{!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 < 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) => { |
|
|
|
{isReadyOverdueActivities && overdueActivities && overdueActivities.length > 0 && overdueActivities.map((item, idx) => { |
|
|
|
let end_date = null; |
|
|
|
let end_date; |
|
|
|
let today = null; |
|
|
|
let planned_end; |
|
|
|
let diffDays = 0; |
|
|
|
let diffDays = 0; |
|
|
|
let message = ''; |
|
|
|
let message = ''; |
|
|
|
if (item.end_date && item.end_date !== null) { |
|
|
|
if (item.end_date && item.end_date !== null) { |
|
|
|
end_date = moment(item.end_date); |
|
|
|
end_date = moment(item.end_date); |
|
|
|
today = moment(new Date()); |
|
|
|
planned_end = moment(item.planned_end); |
|
|
|
diffDays = today.diff(end_date, 'days'); |
|
|
|
diffDays = end_date.diff(planned_end, 'days'); |
|
|
|
message = `Overdue by ${diffDays} 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} /> |
|
|
|
return <BehindTaskItem key={idx} name={item.name} message={message} /> |
|
|
|
})} |
|
|
|
})} |
|
|
|