diff --git a/src/js/views/08_summary/helpers.js b/src/js/views/08_summary/helpers.js index 0315209..21dd1ea 100644 --- a/src/js/views/08_summary/helpers.js +++ b/src/js/views/08_summary/helpers.js @@ -5,15 +5,20 @@ import Subtitle from "../../components/header/header.js"; import { visitPage } from "../view_logic.js"; import { Accordion } from "../../components/accordion/accordion.js"; import { downloadXLSX } from "../../utils/data_utils/XLSX_handlers.js"; -import { Baseline } from '../../utils/data_utils/local_storage_handlers.js'; +import { Baseline, CurrentFund } from '../../utils/data_utils/local_storage_handlers.js'; import { TARGET } from '../../init.js'; import { formatCurrency } from '../../utils/common_utils.js'; export function summaryView(){ + + // show/hide elements Body.reset(); Accordion.build(); Accordion.show(); + // set fund to none + CurrentFund.reset(); + // prompt buttons Prompt.Buttons.Right.updateText('Download Excel'); Prompt.Buttons.Left.updateText('Start over'); diff --git a/src/js/views/view_logic.js b/src/js/views/view_logic.js index 581483c..b32751d 100644 --- a/src/js/views/view_logic.js +++ b/src/js/views/view_logic.js @@ -60,6 +60,14 @@ export function nextPage(){ return; } } + + // unless on personnel (which will go to overtime), return to summary if all funds are viewed + const returnPages = ['revenue', 'nonpersonnel', 'new-inits', 'overtime']; + if (!FundLookupTable.fundsLeft() && returnPages.includes(CurrentPage.load())) { + visitPage('summary'); + return; + } + if (currentIndex >= 0 && currentIndex < keys.length - 1) { // Check if there is a next key, and get it const nextKey = keys[currentIndex + 1];