From 2e38c3c3ae380012a811353a0bb8aa62489776a3 Mon Sep 17 00:00:00 2001 From: Katrina Wheelan Date: Fri, 26 Jul 2024 15:44:41 -0400 Subject: [PATCH] fix detail appearance for new inits --- src/js/components/tooltip/tooltip.js | 6 +++++- src/js/views/07_new_initiatives/helpers.js | 10 ++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/js/components/tooltip/tooltip.js b/src/js/components/tooltip/tooltip.js index 894db29..c86dd88 100644 --- a/src/js/components/tooltip/tooltip.js +++ b/src/js/components/tooltip/tooltip.js @@ -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 = - `Fund: ${CurrentFund.name()}
+ `Fund: ${fund}
Appropriation: ${approp}
Cost Center: ${cc}`; if (obj) { message += `
Object: ${obj}`} @@ -176,6 +177,9 @@ export const Tooltip = { case 'revenue': linkAccountStringCol(); break; + case 'new-inits': + linkAccountStringCol(); + break; default: break; diff --git a/src/js/views/07_new_initiatives/helpers.js b/src/js/views/07_new_initiatives/helpers.js index 8f3d6ad..7b4ebbf 100644 --- a/src/js/views/07_new_initiatives/helpers.js +++ b/src/js/views/07_new_initiatives/helpers.js @@ -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() { @@ -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 @@ -119,6 +118,7 @@ export async function initializeInitTable(){ // enable editing Table.Buttons.Edit.init(rowOnEdit, Table.save); // show table + Table.save(); Table.show(); } } @@ -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); @@ -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'); } }