From ecfbac54bf38cb970945e8a10e5404f0d5c34cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=20Keskim=C3=A4ki?= Date: Thu, 7 Sep 2023 14:52:08 +0300 Subject: [PATCH] Add warning when manual entry dates are changed --- client/components/NewReportPage/NewReportTable.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/components/NewReportPage/NewReportTable.js b/client/components/NewReportPage/NewReportTable.js index 80735ed..177b034 100644 --- a/client/components/NewReportPage/NewReportTable.js +++ b/client/components/NewReportPage/NewReportTable.js @@ -57,6 +57,7 @@ export default withRouter(({ rows, batchId, history }) => { const graders = useSelector((state) => state.graders.data) const [sent, setSent] = useState(false) const onlyMissingEnrollments = rows.every(({ entry }) => entry.type === 'ENTRY' && entry.missingEnrolment) + const dateHasChanged = rows.some(({ entry, attainmentDate }) => !moment(attainmentDate).isSame(moment(entry.completionDate), 'day')) useEffect(() => { if (sent && !pending && !(error || {}).genericError) { @@ -148,6 +149,15 @@ export default withRouter(({ rows, batchId, history }) => { ) : null + const ChangedDateInfo = () => + dateHasChanged ? ( + + One or more completion date has been changed to match the study right in the enrollment. +
+ The changed dates are marked with a pencil icon. Please check the new dates before approving. +
+ ) : null + const CompletionDate = ({ attainmentDate, completionDate }) => completionDate ? (
@@ -179,6 +189,7 @@ export default withRouter(({ rows, batchId, history }) => { after student enrolls to the course.{' '}

+ {sent && error ? (