From c59c391a23f61bfa5cfa4c6f2de45da94c2fb872 Mon Sep 17 00:00:00 2001 From: Michael Dickson Date: Wed, 14 Aug 2024 15:35:42 -0400 Subject: [PATCH] display msg when no deliverables in calendar --- blocks/gmo-program-details/gmo-program-details.css | 6 ++++++ scripts/program-calendar.js | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/blocks/gmo-program-details/gmo-program-details.css b/blocks/gmo-program-details/gmo-program-details.css index f79a0d4..b877e35 100644 --- a/blocks/gmo-program-details/gmo-program-details.css +++ b/blocks/gmo-program-details/gmo-program-details.css @@ -189,6 +189,12 @@ body { } .tab.calendar { margin-top:10px; + & > .no-data-msg { + height: 100px; + margin-top: 15px; + display: flex; + align-items: center; + } & > .control-wrapper { height: 32px; padding-top: 1px; diff --git a/scripts/program-calendar.js b/scripts/program-calendar.js index 7bb73b1..c61b324 100644 --- a/scripts/program-calendar.js +++ b/scripts/program-calendar.js @@ -28,6 +28,14 @@ export async function buildCalendar(dataObj, block, type, mappingArray, period) const currentDate = new Date(); const currentYear = currentDate.getFullYear(); + // if there are no deliverables, display msg to user and end construction. + if (deliverables.length === 0) { + const calendarTab = document.querySelector('.calendar.tab'); + calendarTab.innerHTML = ` +
Required Data is Unavailable.
+ `; + return; + } // get start of the view viewStart = getTimeBounds(deliverables, "start", startDateProp);