diff --git a/index.html b/index.html index 8736ae3..6fef4b2 100644 --- a/index.html +++ b/index.html @@ -1,23 +1,76 @@ - + RCPCH ROP Window Calculator + + + @@ -68,7 +121,7 @@ value="2023-01-01" /> -
+

Not Eligible

All infants less than 31 weeks gestational age (up to and including 30 weeks @@ -77,17 +130,29 @@

Not Eligible

(Grade: B)]

-
-
-

Window Start

+
+
+
+ + Start + +
- +
+
+
+
+
+
+ + End +
-
-
-

Window End

- +
+
+
+
@@ -96,10 +161,13 @@

Window End

const form = document.querySelector("form"); const notEligiblePanel = document.getElementById("not-eligible"); - const outputPanel = document.getElementById("output"); + const screeningWindowPanel = document.getElementById("screening-window"); - const windowStartBox = document.getElementById("window_start"); - const windowEndBox = document.getElementById("window_end"); + const windowStartDate = document.getElementById("window_start_date"); + const windowStartDays = document.getElementById("window_start_days"); + + const windowEndDate = document.getElementById("window_end_date"); + const windowEndDays = document.getElementById("window_end_days"); function getIntValue(id) { return parseInt(document.getElementById(id).value, 10); @@ -143,7 +211,7 @@

Window End

function updateOutput() { notEligiblePanel.style.display = 'none'; - outputPanel.style.display = 'none'; + screeningWindowPanel.style.display = 'none'; if(form.checkValidity()) { const gestationalAgeWeeks = getIntValue("gestational_age_weeks"); @@ -156,7 +224,7 @@

Window End

const gestationalAge = (gestationalAgeWeeks * 7) + gestationalAgeDays; if(isEligible(gestationalAge, birthWeight)) { - outputPanel.style.display = 'block'; + screeningWindowPanel.style.display = 'block'; const { start, end } = calculateWindow(gestationalAge, dateOfBirth); @@ -167,9 +235,11 @@

Window End

const endDate = end.toLocaleString(luxon.DateTime.DATE_SHORT); const endDaysFromBirth = end.diff(dateOfBirth, 'days').days; + windowStartDate.innerHTML = startDate; + windowStartDays.innerHTML = `${startDaysFromBirth} days from birth`; - windowStartBox.innerHTML = `${startDate} (${startDaysFromBirth} days from birth)`; - windowEndBox.innerHTML = `${endDate} (${endDaysFromBirth} days from birth)`; + windowEndDate.innerHTML = endDate; + windowEndDays.innerHTML = `${endDaysFromBirth} days from birth`; } else { notEligiblePanel.style.display = 'block'; }