Skip to content

Commit

Permalink
fix detail appearance for new inits
Browse files Browse the repository at this point in the history
  • Loading branch information
katrina-cityofdetroit committed Jul 26, 2024
1 parent 6e1130d commit 2e38c3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/js/components/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ function showAccountString(row){
const approp = Cell.getText(row, 'approp-name');
const cc = Cell.getText(row, 'cc-name');
const obj = Cell.getText(row, 'object-name');
const fund = Cell.getText(row, 'fund-name');
var message =
`<strong>Fund</strong>: ${CurrentFund.name()}<br>
`<strong>Fund</strong>: ${fund}<br>
<strong>Appropriation</strong>: ${approp}<br>
<strong>Cost Center</strong>: ${cc}`;
if (obj) { message += `<br><strong>Object</strong>: ${obj}`}
Expand Down Expand Up @@ -176,6 +177,9 @@ export const Tooltip = {
case 'revenue':
linkAccountStringCol();
break;
case 'new-inits':
linkAccountStringCol();
break;
default:
break;

Expand Down
10 changes: 4 additions & 6 deletions src/js/views/07_new_initiatives/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function setUpForm() {

Form.SubmitButton.add();
// Initialize form submission to table data
Modal.Submit.init(handleNewInitSubmission);
Modal.Submit.init(submitNewRow);
}

function assignClasses() {
Expand All @@ -110,7 +110,6 @@ function assignClasses() {
}

export async function initializeInitTable(){
Table.clear();
// load table data from storage
if(await Table.Data.load()) {
// after table is loaded, fill it
Expand All @@ -119,6 +118,7 @@ export async function initializeInitTable(){
// enable editing
Table.Buttons.Edit.init(rowOnEdit, Table.save);
// show table
Table.save();
Table.show();
}
}
Expand All @@ -133,7 +133,7 @@ function rowOnEdit(){
Table.Cell.createDropdown('rev-type', dropdownOptions);
}

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

Expand All @@ -145,13 +145,11 @@ function handleNewInitSubmission(event){

// make sure it's not an empty response
if (Object.values(responses)[0] != ''){
Modal.hide();
// add data to table
Table.Rows.add(responses, initiativesCols);
// save it
Table.save();
// show updated table
initializeInitTable();
Modal.hide();
Table.Buttons.AddRow.updateText('Add another new initiative');
}
}
Expand Down

0 comments on commit 2e38c3c

Please sign in to comment.