diff --git a/src/js/components/file_upload/file_upload.js b/src/js/components/file_upload/file_upload.js index 43cc3d4..719ba59 100644 --- a/src/js/components/file_upload/file_upload.js +++ b/src/js/components/file_upload/file_upload.js @@ -1,6 +1,6 @@ import './file_upload.css'; -import { processWorkbook } from "../../utils/data_utils/XLSX_handlers.js"; +import { processWorkbook } from "../../utils/XLSX_handlers.js"; import Sidebar from '../sidebar/sidebar.js'; export const FileUpload = { diff --git a/src/js/components/table/subcomponents/cells.js b/src/js/components/table/subcomponents/cells.js index 73e8eec..67d13b0 100644 --- a/src/js/components/table/subcomponents/cells.js +++ b/src/js/components/table/subcomponents/cells.js @@ -1,5 +1,5 @@ import { formatCurrency, displayWithCommas } from "../../../utils/common_utils.js"; -import { Services } from "../../../utils/data_utils/budget_data_handlers.js"; +import Services from "../../../models/services.js"; import Dropdown from "../../form/subcomponents/dropdown.js"; // return cell value attribute or 0 if it does not exist diff --git a/src/js/components/table/table.js b/src/js/components/table/table.js index 9986323..8ecf231 100644 --- a/src/js/components/table/table.js +++ b/src/js/components/table/table.js @@ -7,7 +7,7 @@ import Header from './subcomponents/headers.js' import Rows from './subcomponents/rows.js' import Data from './subcomponents/data.js' import Tooltip from '../tooltip/tooltip.js'; -import { convertToJSON } from "../../utils/data_utils/JSON_data_handlers.js"; +import { convertToJSON } from "../../utils/JSON_data_handlers.js"; import Sidebar from '../sidebar/sidebar.js'; import CurrentFund from '../../models/current_fund.js'; import CurrentPage from '../../models/current_page.js'; diff --git a/src/js/init.js b/src/js/init.js index e079cef..e70d7e2 100644 --- a/src/js/init.js +++ b/src/js/init.js @@ -17,6 +17,21 @@ export const SHEETS = { 'Revenue' : 'revenue' } +export const ObjectCategories = { + list : [ + // 'Salaries & Wages', + // 'Employee Benefits', + 'Professional & Contractual Services', + 'Operating Supplies', + 'Operating Services', + 'Equipment Acquisition', + 'Capital Outlays', + 'Fixed Charges', + 'Other Expenses' + ] +} + + document.addEventListener('DOMContentLoaded', function () { CurrentPage.visit(); }); diff --git a/src/js/utils/data_utils/budget_data_handlers.js b/src/js/models/account_string.js similarity index 67% rename from src/js/utils/data_utils/budget_data_handlers.js rename to src/js/models/account_string.js index 6b3b64e..cf8095a 100644 --- a/src/js/utils/data_utils/budget_data_handlers.js +++ b/src/js/models/account_string.js @@ -1,29 +1,5 @@ -// data structure to save the possible service options for the department -export const Services = { - save : function(services){ - localStorage.setItem('services-list', JSON.stringify(services)); - }, - list : function(){ - return JSON.parse(localStorage.getItem('services-list')) || {}; - } -} - -export const ObjectCategories = { - list : [ - // 'Salaries & Wages', - // 'Employee Benefits', - 'Professional & Contractual Services', - 'Operating Supplies', - 'Operating Services', - 'Equipment Acquisition', - 'Capital Outlays', - 'Fixed Charges', - 'Other Expenses' - ] -} - export const AccountString = { getNumber: function(input) { // isolate the numerical part of a appropriation/cost center/object @@ -62,4 +38,6 @@ export const AccountString = { object : function(account_string) { return this.getAccountStringSection(account_string, 3) }, -} \ No newline at end of file +} + +export default AccountString; \ No newline at end of file diff --git a/src/js/models/services.js b/src/js/models/services.js new file mode 100644 index 0000000..9cf60e0 --- /dev/null +++ b/src/js/models/services.js @@ -0,0 +1,11 @@ +// data structure to save the possible service options for the department +export const Services = { + save : function(services){ + localStorage.setItem('services-list', JSON.stringify(services)); + }, + list : function(){ + return JSON.parse(localStorage.getItem('services-list')) || {}; + } +} + +export default Services; \ No newline at end of file diff --git a/src/js/utils/data_utils/JSON_data_handlers.js b/src/js/utils/JSON_data_handlers.js similarity index 100% rename from src/js/utils/data_utils/JSON_data_handlers.js rename to src/js/utils/JSON_data_handlers.js diff --git a/src/js/utils/data_utils/XLSX_handlers.js b/src/js/utils/XLSX_handlers.js similarity index 95% rename from src/js/utils/data_utils/XLSX_handlers.js rename to src/js/utils/XLSX_handlers.js index 3f40774..3548605 100644 --- a/src/js/utils/data_utils/XLSX_handlers.js +++ b/src/js/utils/XLSX_handlers.js @@ -1,10 +1,10 @@ -import { SHEETS } from '../../init.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'; +import { SHEETS } from '../init.js'; +import FundLookupTable from '../models/fund_lookup_table.js'; +import { removeNewLines } from './common_utils.js'; +import Baseline from '../models/baseline.js'; +import Services from '../models/services.js'; function deleteTopRowsUntilFullData(data) { // function to try to find the top of the usable data diff --git a/src/js/utils/data_utils/local_storage_handlers.js b/src/js/utils/data_utils/local_storage_handlers.js deleted file mode 100644 index 644a197..0000000 --- a/src/js/utils/data_utils/local_storage_handlers.js +++ /dev/null @@ -1,18 +0,0 @@ -// import { initializePages } from "../../views/view_logic.js"; -// import { fetchJSON } from "./JSON_data_handlers.js"; - -// function deleteTable(name){ -// localStorage.setItem(name, ''); -// } - -// export async function deleteAllTables(){ -// var funds = await fetchJSON(DATA_ROOT + 'funds.json'); -// funds = funds.map((item) => { return item.Name }); -// for (const page in initializePages()){ -// for(const i in funds){ -// deleteTable(`${page}_${funds[i]}`); -// } -// } -// deleteTable('new-inits'); -// } - diff --git a/src/js/views/04_personnel.js b/src/js/views/04_personnel.js index 8bba500..a93f4b0 100644 --- a/src/js/views/04_personnel.js +++ b/src/js/views/04_personnel.js @@ -3,7 +3,7 @@ import { View, ViewTable } from './view_class.js' import Table from "../components/table/table.js"; import Form from "../components/form/form.js"; -import { Services } from "../utils/data_utils/budget_data_handlers.js"; +import Services from '../models/services.js'; import FundLookupTable from '../models/fund_lookup_table.js'; import { unformatCurrency } from "../utils/common_utils.js"; diff --git a/src/js/views/05_overtime.js b/src/js/views/05_overtime.js index c6f32e9..82816b0 100644 --- a/src/js/views/05_overtime.js +++ b/src/js/views/05_overtime.js @@ -6,7 +6,7 @@ import Form from '../components/form/form.js'; import FundLookupTable from '../models/fund_lookup_table.js'; -import { Services } from '../utils/data_utils/budget_data_handlers.js'; +import Services from '../models/services.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 c446abf..dc44be2 100644 --- a/src/js/views/06_nonpersonnel.js +++ b/src/js/views/06_nonpersonnel.js @@ -2,8 +2,9 @@ import { View, ViewTable } from './view_class.js' import Form from '../components/form/form.js'; import Table from '../components/table/table.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'; +import { ObjectCategories } from '../init.js'; +import Services from '../models/services.js'; export class NonPersonnelView extends View { diff --git a/src/js/views/08_summary.js b/src/js/views/08_summary.js index 70cce64..88267f7 100644 --- a/src/js/views/08_summary.js +++ b/src/js/views/08_summary.js @@ -6,7 +6,7 @@ import { visitPage } from "./view_logic.js"; import { formatCurrency } from '../utils/common_utils.js'; import { View } from "./view_class.js"; import Prompt from "../components/prompt/prompt.js"; -import { downloadXLSX } from "../utils/data_utils/XLSX_handlers.js"; +import { downloadXLSX } from "../utils/XLSX_handlers.js"; export function compareToTarget(){ const baseline = new Baseline; diff --git a/src/js/views/view_class.js b/src/js/views/view_class.js index 09b8ba0..813dd43 100644 --- a/src/js/views/view_class.js +++ b/src/js/views/view_class.js @@ -8,7 +8,8 @@ import Form from "../components/form/form.js"; import Modal from "../components/modal/modal.js"; import CurrentPage from "../models/current_page.js"; -import { AccountString } from "../utils/data_utils/budget_data_handlers.js"; +import AccountString from '../models/account_string.js' + export class View {