From 414ddff0f940e1e586864567973ceb3f66b60075 Mon Sep 17 00:00:00 2001
From: Liz Wendling <170662489+GovCIOLiz@users.noreply.github.com>
Date: Tue, 24 Dec 2024 10:43:56 -0800
Subject: [PATCH 1/4] Spelling mistake
---
src/applications/edu-benefits/10215/pages/program-intro.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/applications/edu-benefits/10215/pages/program-intro.js b/src/applications/edu-benefits/10215/pages/program-intro.js
index 82394360338a..a9c0c03f5455 100644
--- a/src/applications/edu-benefits/10215/pages/program-intro.js
+++ b/src/applications/edu-benefits/10215/pages/program-intro.js
@@ -13,7 +13,7 @@ const ProgramIntro = {
On the next several pages, you will provide all 85/15 calculations for
your institution. Submit calculations for all approved programs listed
on your most recent WEAMS-22-1998 Report. List every program and
- iclude calculations, even if a program has a Supported Student or
+ include calculations, even if a program has a Supported Student or
Total Enrollment of "0".
From 1a8d7c070af87adf2430a95cb4ea23b6973eff6c Mon Sep 17 00:00:00 2001
From: Liz Wendling <170662489+GovCIOLiz@users.noreply.github.com>
Date: Thu, 26 Dec 2024 12:07:52 -0800
Subject: [PATCH 2/4] 10215 calcs page
---
.../edu-benefits/10215/pages/calcs.js | 74 +++++++++++++++++--
1 file changed, 66 insertions(+), 8 deletions(-)
diff --git a/src/applications/edu-benefits/10215/pages/calcs.js b/src/applications/edu-benefits/10215/pages/calcs.js
index 170cf7178fb9..c3b07710efd5 100644
--- a/src/applications/edu-benefits/10215/pages/calcs.js
+++ b/src/applications/edu-benefits/10215/pages/calcs.js
@@ -1,21 +1,79 @@
-import React from 'react';
+import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
+import { querySelectorWithShadowRoot } from 'platform/utilities/ui/webComponents';
import { getFTECalcs } from '../helpers';
const Calcs = ({ data }) => {
- const programIdx = window.location.href.split('?')[0].slice(-1);
- const program = data.programs?.[programIdx];
- const { supported, nonSupported, total, supportedFTEPercent } = getFTECalcs(
- program,
- );
+ const [programData, setProgramData] = useState(null);
+ //
+ // Form data in redux not updated promptly when inputting data in edit mode hence the following code is necessary at present rather than relying on state.form.data
+ //
+ async function updateData() {
+ const supportedInput = await querySelectorWithShadowRoot(
+ 'va-text-input[name="root_fte_supported"]',
+ document,
+ );
+ const supportedInputValue = supportedInput?.shadowRoot.querySelector(
+ 'input',
+ ).value;
+ const nonSupportedInput = await querySelectorWithShadowRoot(
+ 'va-text-input[name="root_fte_nonSupported"]',
+ document,
+ );
+ const nonSupportedInputValue = nonSupportedInput?.shadowRoot.querySelector(
+ 'input',
+ ).value;
+ const fteData = {
+ fte: {
+ supported: supportedInputValue,
+ nonSupported: nonSupportedInputValue,
+ },
+ };
+ if (fteData !== programData) setProgramData(getFTECalcs(fteData));
+ }
+
+ useEffect(() => {
+ let supportedInput;
+ let nonSupportedInput;
+
+ async function getInputs() {
+ supportedInput = await querySelectorWithShadowRoot(
+ 'va-text-input[name="root_fte_supported"]',
+ document,
+ );
+ supportedInput = supportedInput?.shadowRoot?.querySelector('input');
+ nonSupportedInput = await querySelectorWithShadowRoot(
+ 'va-text-input[name="root_fte_nonSupported"]',
+ document,
+ );
+ nonSupportedInput = nonSupportedInput?.shadowRoot?.querySelector('input');
+ supportedInput?.addEventListener('change', updateData);
+ nonSupportedInput?.addEventListener('change', updateData);
+ }
+
+ if (!programData && data) {
+ const programIdx = window.location.href.split('?')[0].slice(-1);
+ const program = data.programs?.[programIdx];
+ setProgramData(getFTECalcs(program));
+ }
+
+ getInputs();
+
+ return function cleanup() {
+ supportedInput.removeEventListener('change', updateData);
+ nonSupportedInput.removeEventListener('change', updateData);
+ };
+ }, []);
return (
<>