Skip to content

Commit

Permalink
move constants to own folder
Browse files Browse the repository at this point in the history
  • Loading branch information
katrina-cityofdetroit committed Jul 29, 2024
1 parent 125c981 commit b0a647d
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/js/components/accordion/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {Baseline, CurrentFund, Fund, Supplemental, FundLookupTable} from '../../
import { formatCurrency, cleanString } from "../../utils/common_utils.js";
import Table from "../table/table.js";
import { visitPage } from '../../views/view_logic.js';
import { TARGET } from '../../init.js';
import { TARGET } from '../../constants/';

function redirectForEdit(){
const row = document.querySelector(`.active-editing`);
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/sidebar/sidebar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './sidebar.css'

import { formatCurrency } from "../../utils/common_utils.js";
import { TARGET } from "../../init.js";
import { TARGET } from '../../constants/';
import {Baseline, Supplemental} from '../../models/';


Expand Down
2 changes: 1 addition & 1 deletion src/js/components/tooltip/tooltip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FISCAL_YEAR } from '../../init';
import { FISCAL_YEAR } from '../../constants/';
import Cell from '../table/subcomponents/cells';
import { formatCurrency } from '../../utils/common_utils';
import CurrentPage from '../../models/current_page';
Expand Down
5 changes: 5 additions & 0 deletions src/js/constants/app_constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// temporary hard-coding
export let TARGET = 10000000;

// Set to equal current fiscal year
export var FISCAL_YEAR = '26';
21 changes: 21 additions & 0 deletions src/js/constants/excel_constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// sheets to expect on detail sheet
export const SHEETS = {
'FTE, Salary-Wage, & Benefits' : 'personnel' ,
'Overtime & Other Personnel' : 'overtime',
'Non-Personnel Operating' : 'nonpersonnel',
'Revenue' : 'revenue'
}

export const OBJ_CATEGORIES = {
list : [
// 'Salaries & Wages',
// 'Employee Benefits',
'Professional & Contractual Services',
'Operating Supplies',
'Operating Services',
'Equipment Acquisition',
'Capital Outlays',
'Fixed Charges',
'Other Expenses'
]
}
2 changes: 2 additions & 0 deletions src/js/constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './app_constants';
export * from './excel_constants';
28 changes: 0 additions & 28 deletions src/js/init.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
// import styles
import '../css/common.css';

// temporary hard-coding
export let TARGET = 10000000;
// Set to equal current fiscal year
export var FISCAL_YEAR = '26';

// import functions
import CurrentPage from './models/current_page.js';

// sheets to expect on detail sheet
export const SHEETS = {
'FTE, Salary-Wage, & Benefits' : 'personnel' ,
'Overtime & Other Personnel' : 'overtime',
'Non-Personnel Operating' : 'nonpersonnel',
'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();
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/models/fund.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { colSum } from "../utils/common_utils";
import { FISCAL_YEAR } from "../init";
import { FISCAL_YEAR } from '../constants/';

// Class to hold information on a specific fund and table
class StoredTable {
Expand Down
2 changes: 1 addition & 1 deletion src/js/utils/XLSX_handlers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


import { SHEETS } from '../init.js';
import { SHEETS } from '../constants/';
import FundLookupTable from '../models/fund_lookup_table.js';
import { removeNewLines } from './common_utils.js';
import Baseline from '../models/baseline.js';
Expand Down
4 changes: 2 additions & 2 deletions src/js/views/06_nonpersonnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Form from '../components/form/form.js';
import Table from '../components/table/table.js';
import { FundLookupTable, Services } from '../models/';
import { unformatCurrency } from '../utils/common_utils.js';
import { ObjectCategories } from '../init.js';
import { OBJ_CATEGORIES } from '../constants/';

export class NonPersonnelView extends View {

Expand Down Expand Up @@ -52,7 +52,7 @@ class NonPersonnelTable extends ViewTable {
// form questions to add a new row
Form.NewField.dropdown('Appropriation:', 'approp-name', FundLookupTable.getApprops(), true);
Form.NewField.dropdown('Cost Center:', 'cc-name', FundLookupTable.getCostCenters(), true);
Form.NewField.dropdown('Object Category:', 'object-category', ObjectCategories.list, true);
Form.NewField.dropdown('Object Category:', 'object-category', OBJ_CATEGORIES.list, true);
// TODO: maybe give dropdown based on selected obj category
Form.NewField.shortText('Object Number (if known):', 'object', false);
Form.NewField.dropdown('Service', 'service', Services.list(), true);
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/07_new_initiatives.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 FundLookupTable from '../models/fund_lookup_table.js';
import { FISCAL_YEAR } from "../init.js";
import { FISCAL_YEAR } from '../constants/';


const dropdownOptions = ['N/A', 'One-Time', 'Recurring']
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/08_summary.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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";
import { formatCurrency } from '../utils/common_utils.js';
import { View } from "./view_class.js";
import Prompt from "../components/prompt/prompt.js";
import { downloadXLSX } from "../utils/XLSX_handlers.js";
import WelcomeView from './00_welcome.js';
import { TARGET } from '../constants/app_constants.js';

export function compareToTarget(){
const baseline = new Baseline;
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/view_logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import InitiativesView from './07_new_initiatives.js';
import SummaryView from './08_summary.js';

import { FundLookupTable, CurrentFund, CurrentPage } from '../models/';
import { FISCAL_YEAR } from '../init.js';
import { FISCAL_YEAR } from '../constants/';

export function initializePages() {
const PAGES = {
Expand Down

0 comments on commit b0a647d

Please sign in to comment.