Skip to content

Commit

Permalink
#22 redirect to summary page after edit from summary page
Browse files Browse the repository at this point in the history
  • Loading branch information
katrina-cityofdetroit committed Jul 19, 2024
1 parent 162495c commit 4765d5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/js/views/08_summary/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 8 additions & 0 deletions src/js/views/view_logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 4765d5a

Please sign in to comment.