From 3ac5db4b71331619fbef9f9bd341b273bd42d187 Mon Sep 17 00:00:00 2001 From: Katrina Wheelan Date: Mon, 29 Jul 2024 14:44:31 -0400 Subject: [PATCH] fix all imports --- src/js/components/accordion/accordion.js | 7 +++++-- src/js/components/table/subcomponents/data.js | 5 ++--- src/js/components/tooltip/tooltip.js | 3 ++- src/js/models/fund.js | 3 ++- src/js/models/supplemental.js | 3 ++- src/js/utils/data_utils/XLSX_handlers.js | 3 ++- src/js/views/02_baseline_landing.js | 2 +- src/js/views/04_personnel.js | 3 ++- src/js/views/05_overtime.js | 4 +++- src/js/views/06_nonpersonnel.js | 2 +- src/js/views/07_new_initiatives.js | 2 +- src/js/views/08_summary.js | 3 ++- src/js/views/view_logic.js | 2 +- 13 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/js/components/accordion/accordion.js b/src/js/components/accordion/accordion.js index c66d348..93b9074 100644 --- a/src/js/components/accordion/accordion.js +++ b/src/js/components/accordion/accordion.js @@ -1,9 +1,12 @@ import './accordion.css' -import { Baseline, CurrentFund, Fund, Supplemental } from "../../utils/data_utils/local_storage_handlers.js"; +import Baseline from '../../models/baseline.js'; +import CurrentFund from '../../models/current_fund.js'; +import Fund from '../../models/fund.js'; +import Supplemental from '../../models/supplemental.js'; import { formatCurrency, cleanString } from "../../utils/common_utils.js"; import Table from "../table/table.js"; -import { FundLookupTable } from "../../utils/data_utils/budget_data_handlers.js"; +import FundLookupTable from '../../models/fund_lookup_table.js'; import { visitPage } from '../../views/view_logic.js'; import { TARGET } from '../../init.js'; diff --git a/src/js/components/table/subcomponents/data.js b/src/js/components/table/subcomponents/data.js index 16f2188..23c96dc 100644 --- a/src/js/components/table/subcomponents/data.js +++ b/src/js/components/table/subcomponents/data.js @@ -1,4 +1,4 @@ -import { FundLookupTable } from "../../../utils/data_utils/budget_data_handlers.js"; +import FundLookupTable from '../../../models/fund_lookup_table.js'; import CurrentFund from '../../../models/current_fund.js' import CurrentPage from '../../../models/current_page.js' @@ -45,9 +45,8 @@ async function loadFromStorage(){ } // load from local storage const data = localStorage.getItem(key); - // if nothing in storage, return a zero - if ( data == '' || data == '[]' ) { + if ( !data ) { return 0; }; // otherwise, fill table in HTML and return success (1) diff --git a/src/js/components/tooltip/tooltip.js b/src/js/components/tooltip/tooltip.js index c86dd88..09f0a4c 100644 --- a/src/js/components/tooltip/tooltip.js +++ b/src/js/components/tooltip/tooltip.js @@ -1,8 +1,9 @@ import { FISCAL_YEAR } from '../../init'; import Cell from '../table/subcomponents/cells'; import { formatCurrency } from '../../utils/common_utils'; +import CurrentPage from '../../models/current_page'; + import './tooltip.css' -import { CurrentFund, CurrentPage } from '../../utils/data_utils/local_storage_handlers'; function hideTooltip() { document.getElementById('tooltip').style.visibility = 'hidden'; diff --git a/src/js/models/fund.js b/src/js/models/fund.js index 59268c2..4d43df4 100644 --- a/src/js/models/fund.js +++ b/src/js/models/fund.js @@ -1,12 +1,13 @@ import { colSum } from "../utils/common_utils"; +import { FISCAL_YEAR } from "../init"; // Class to hold information on a specific fund and table class StoredTable { constructor(page, fund){ this.name = `${page}_${fund}`; this.page = page; - this.table = loadTableData(this.name); + this.table = JSON.parse(localStorage.getItem(this.name)); } totalCol() { diff --git a/src/js/models/supplemental.js b/src/js/models/supplemental.js index 1cfb9ca..5126324 100644 --- a/src/js/models/supplemental.js +++ b/src/js/models/supplemental.js @@ -1,10 +1,11 @@ import Initiative from "./initiative.js"; +import { colSum } from "../utils/common_utils.js"; // data structure to hold supplemental requests export class Supplemental { constructor() { - this.table = loadTableData('new-inits'); + this.table = JSON.parse(localStorage.getItem(this.name)); this.initiatives = []; if(this.table){ this.table.forEach((row) => { diff --git a/src/js/utils/data_utils/XLSX_handlers.js b/src/js/utils/data_utils/XLSX_handlers.js index 1b16ec3..3f40774 100644 --- a/src/js/utils/data_utils/XLSX_handlers.js +++ b/src/js/utils/data_utils/XLSX_handlers.js @@ -1,7 +1,8 @@ import { SHEETS } from '../../init.js'; -import { FundLookupTable, Services } from './budget_data_handlers.js'; +import FundLookupTable from '../../models/fund_lookup_table.js'; +import { Services } from './budget_data_handlers.js'; import { removeNewLines } from '../common_utils.js'; import { Baseline } from './local_storage_handlers.js'; diff --git a/src/js/views/02_baseline_landing.js b/src/js/views/02_baseline_landing.js index c72af89..53f9681 100644 --- a/src/js/views/02_baseline_landing.js +++ b/src/js/views/02_baseline_landing.js @@ -1,7 +1,7 @@ import NavButtons from "../components/nav_buttons/nav_buttons.js"; import Table from "../components/table/table.js"; import { View, ViewTable } from './view_class.js' -import { CurrentFund } from "../utils/data_utils/local_storage_handlers.js"; +import CurrentFund from "../models/current_fund.js"; export class FundView extends View { diff --git a/src/js/views/04_personnel.js b/src/js/views/04_personnel.js index 070be96..8bba500 100644 --- a/src/js/views/04_personnel.js +++ b/src/js/views/04_personnel.js @@ -3,7 +3,8 @@ import { View, ViewTable } from './view_class.js' import Table from "../components/table/table.js"; import Form from "../components/form/form.js"; -import { Services, FundLookupTable } from "../utils/data_utils/budget_data_handlers.js"; +import { Services } from "../utils/data_utils/budget_data_handlers.js"; +import FundLookupTable from '../models/fund_lookup_table.js'; import { unformatCurrency } from "../utils/common_utils.js"; export class PersonnelView extends View { diff --git a/src/js/views/05_overtime.js b/src/js/views/05_overtime.js index 96a925d..c6f32e9 100644 --- a/src/js/views/05_overtime.js +++ b/src/js/views/05_overtime.js @@ -4,7 +4,9 @@ import { View, ViewTable } from './view_class.js' import Table from '../components/table/table.js'; import Form from '../components/form/form.js'; -import { FundLookupTable, Services } from '../utils/data_utils/budget_data_handlers.js'; +import FundLookupTable from '../models/fund_lookup_table.js'; + +import { Services } from '../utils/data_utils/budget_data_handlers.js'; import { unformatCurrency } from '../utils/common_utils.js'; export class OvertimeView extends View { diff --git a/src/js/views/06_nonpersonnel.js b/src/js/views/06_nonpersonnel.js index 93f8088..c446abf 100644 --- a/src/js/views/06_nonpersonnel.js +++ b/src/js/views/06_nonpersonnel.js @@ -1,7 +1,7 @@ import { View, ViewTable } from './view_class.js' import Form from '../components/form/form.js'; import Table from '../components/table/table.js'; -import { FundLookupTable } from '../utils/data_utils/budget_data_handlers.js'; +import FundLookupTable from '../models/fund_lookup_table.js'; import { ObjectCategories, Services } from '../utils/data_utils/budget_data_handlers.js'; import { unformatCurrency } from '../utils/common_utils.js'; diff --git a/src/js/views/07_new_initiatives.js b/src/js/views/07_new_initiatives.js index 1f27cf8..d2720b1 100644 --- a/src/js/views/07_new_initiatives.js +++ b/src/js/views/07_new_initiatives.js @@ -2,7 +2,7 @@ import { View, ViewTable } from './view_class.js' import Table from "../components/table/table.js"; import Form from "../components/form/form.js"; -import { FundLookupTable } from "../utils/data_utils/budget_data_handlers.js"; +import FundLookupTable from '../models/fund_lookup_table.js'; import { FISCAL_YEAR } from "../init.js"; diff --git a/src/js/views/08_summary.js b/src/js/views/08_summary.js index d922be1..70cce64 100644 --- a/src/js/views/08_summary.js +++ b/src/js/views/08_summary.js @@ -1,4 +1,5 @@ -import { CurrentFund, Baseline } from "../utils/data_utils/local_storage_handlers.js"; +import CurrentFund from '../models/current_fund.js'; +import Baseline from '../models/baseline.js'; import { TARGET } from '../init.js'; import { Accordion } from "../components/accordion/accordion.js"; import { visitPage } from "./view_logic.js"; diff --git a/src/js/views/view_logic.js b/src/js/views/view_logic.js index ee42a6a..ad34088 100644 --- a/src/js/views/view_logic.js +++ b/src/js/views/view_logic.js @@ -8,7 +8,7 @@ import NonPersonnelView from './06_nonpersonnel.js'; import InitiativesView from './07_new_initiatives.js'; import SummaryView from './08_summary.js'; -import { FundLookupTable } from '../utils/data_utils/budget_data_handlers.js'; +import FundLookupTable from '../models/fund_lookup_table.js'; import CurrentFund from '../models/current_fund.js'; import CurrentPage from '../models/current_page.js'; import { FISCAL_YEAR } from '../init.js';