From 153cb131b887967527c1f0891e58aef109145eda Mon Sep 17 00:00:00 2001 From: sandeep14k <143644790+sandeep14k@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:50:26 +0530 Subject: [PATCH 1/4] deadline --- pages/admin/rc/[rcid]/notice.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/admin/rc/[rcid]/notice.tsx b/pages/admin/rc/[rcid]/notice.tsx index c983f3ed..81117617 100644 --- a/pages/admin/rc/[rcid]/notice.tsx +++ b/pages/admin/rc/[rcid]/notice.tsx @@ -139,6 +139,7 @@ function Index() { attachment: "", created_by: "", CreatedAt: "", + deadline: "", last_reminder_at: 0, }); From 405e8f5a5ea3fee0b1d9df2abda7c052ccb15803 Mon Sep 17 00:00:00 2001 From: sandeep14k <143644790+sandeep14k@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:52:42 +0530 Subject: [PATCH 2/4] deadline --- pages/student/rc/[rcid]/notices.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/student/rc/[rcid]/notices.tsx b/pages/student/rc/[rcid]/notices.tsx index a4194ed2..c495b7bd 100644 --- a/pages/student/rc/[rcid]/notices.tsx +++ b/pages/student/rc/[rcid]/notices.tsx @@ -59,6 +59,7 @@ function Notices() { attachment: "", created_by: "", CreatedAt: "", + daedline: "", last_reminder_at: 0, }); From 44ed6fbb613c57eb61d3f6cd7eae4f5af9f28489 Mon Sep 17 00:00:00 2001 From: sandeep14k <143644790+sandeep14k@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:54:21 +0530 Subject: [PATCH 3/4] deadline --- callbacks/admin/rc/notice.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/callbacks/admin/rc/notice.ts b/callbacks/admin/rc/notice.ts index 5b233ddf..94636f2c 100644 --- a/callbacks/admin/rc/notice.ts +++ b/callbacks/admin/rc/notice.ts @@ -19,6 +19,7 @@ export interface NoticeParams { created_by: string; CreatedAt: string; last_reminder_at: number; + deadline: string; } export interface NoticeResponse { title: string; From 3f33c9cff680a51ed677f48191096606b68a7288 Mon Sep 17 00:00:00 2001 From: sandeep14k <143644790+sandeep14k@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:56:56 +0530 Subject: [PATCH 4/4] deadline --- components/Modals/ViewNotice.tsx | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/components/Modals/ViewNotice.tsx b/components/Modals/ViewNotice.tsx index 8413bb1c..667222f1 100644 --- a/components/Modals/ViewNotice.tsx +++ b/components/Modals/ViewNotice.tsx @@ -19,11 +19,22 @@ const boxStyle = { overflowY: "scroll", maxHeight: "90vh", }; + function ViewNotice({ currentNotice }: { currentNotice: NoticeParams }) { - let value = currentNotice.CreatedAt; + const value = currentNotice.CreatedAt; const publishedDateAndTime = `${new Date(value).toLocaleDateString( "en-GB" )} ${new Date(value).toLocaleTimeString()}`; + + const isOpeningTag = currentNotice.tags.includes("opening"); + function formatDeadline(deadline: string): string { + return deadline === "0001-01-01T00:00:00Z" + ? "N/A" + : new Date(deadline).toLocaleString(); + } + + const deadlineDate = formatDeadline(currentNotice.deadline); + return ( @@ -55,6 +66,20 @@ function ViewNotice({ currentNotice }: { currentNotice: NoticeParams }) { readOnly: true, }} /> + + {/* Conditionally render the deadline field if "opening" is present in tags */} + {isOpeningTag && ( + + )} + Description