Skip to content

Commit

Permalink
fix detail bug on new init page
Browse files Browse the repository at this point in the history
  • Loading branch information
katrina-cityofdetroit committed Jul 26, 2024
1 parent 2e38c3c commit 9268321
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/js/components/table/subcomponents/rows.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import Header from "./headers.js";
import { formatCurrency } from "../../../utils/common_utils.js";

async function addNewRow(data_dictionary, columns = []){

console.log(data_dictionary);


// Get the table element by its ID
const table = document.getElementById('main-table');

Expand Down
2 changes: 1 addition & 1 deletion src/js/components/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Table = {
clear : clearTable,
hide : hideTable,
show : showTable,
save : function() {
save : async function() {
// remove the detail text
Tooltip.unlink();
saveTableData();
Expand Down
1 change: 1 addition & 0 deletions src/js/utils/data_utils/local_storage_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function saveTableData() {
var save_as = CurrentPage.load();
}
localStorage.setItem(save_as, convertToJSON(table, ['Edit']));
console.log('saved');
Sidebar.updateTotals();
}

Expand Down
1 change: 0 additions & 1 deletion src/js/views/04_personnel/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ function handleSubmitNewJob(event){
// edit inputs from modal
responses['avg-salary'] = unformatCurrency(responses['avg-salary']);
responses['fringe'] = parseFloat(responses['fringe']) / 100;
console.log(responses['approp-name']);
responses['account-string'] = AccountString.build(responses['approp-name'], responses['cc-name'])
responses['approp'] = AccountString.getNumber(responses['approp-name']);
responses['cc'] = AccountString.getNumber(responses['cc-name']);
Expand Down
15 changes: 9 additions & 6 deletions src/js/views/07_new_initiatives/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const initiativesCols = [
{ title: 'Initiative Name', className: 'init-name' },
{ title: 'Account String', className: 'account-string' },
{ title: 'Ballpark Total Expenses', className: 'total', isCost: true },
{ title: 'Revenue', className: 'revenue', isCost: true },
{ title: 'Personnel Cost', className: 'personnel', isCost: true },
{ title: 'Non-personnel Cost', className: 'nonpersonnel', isCost: true },
{ title: 'One-time v. Recurring', className: 'rev-type' },
{ title: 'Revenue', className: 'revenue', isCost: true },
{ title: 'Revenue Type', className: 'rev-type' },
{ title: 'Edit', className : 'edit' },

// hide the explanation columns
Expand Down Expand Up @@ -110,16 +110,19 @@ function assignClasses() {
}

export async function initializeInitTable(){

// load table data from storage
if(await Table.Data.load()) {
// after table is loaded, fill it
Table.Columns.addAtEnd(Table.Buttons.edit_confirm_btns, "Edit");
assignClasses();
// enable editing
Table.Buttons.Edit.init(rowOnEdit, Table.save);
// show table
Table.save();
Table.show();
// enable editing
Table.Buttons.Edit.init(rowOnEdit, Table.save);
} else {
Table.clear();
console.log('no data');
}
}

Expand All @@ -128,14 +131,14 @@ function rowOnEdit(){
Table.Cell.createTextbox('revenue', true);
Table.Cell.createTextbox('personnel', true);
Table.Cell.createTextbox('nonpersonnel', true);
Table.Cell.createTextbox('account-string');
Table.Cell.createTextbox('init-name');
Table.Cell.createDropdown('rev-type', dropdownOptions);
}

function submitNewRow(event){
// get answers from form, hide form, show answers in table
const responses = Form.fetchAllResponses(event);
console.log(responses);

// create account string columns
responses['approp'] = AccountString.getNumber(responses['approp-name']);
Expand Down
6 changes: 6 additions & 0 deletions src/js/views/view_logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export function lastPage(){

// clean up current page
if (CLEANUP[page_state]) { CLEANUP[page_state]() };

// if on new-inits, circle back to fund selection
if (CurrentPage.load() == 'new-inits'){
visitPage('baseline-landing');
return;
}

// Check if there is a next key
if (currentIndex >= 1) {
Expand Down

0 comments on commit 9268321

Please sign in to comment.