Skip to content

Commit

Permalink
#38 added OT tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
katrina-cityofdetroit committed Jul 23, 2024
1 parent e23caa2 commit 7c47d5f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
23 changes: 22 additions & 1 deletion src/js/components/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ function showFinalPersonnelCost(event){
editTooltipText(message);
}

function showFICA(event){
const row = event.target.parentElement;
const fica = parseFloat(Cell.getText(row, 'fica'));
const ficaPercentage = (fica * 100).toFixed(2);
const message = `This total is overtime wages plus overtime salary plus FICA,
which is ${ficaPercentage}% for this cost center.`
editTooltipText(message);
}

export const Tooltip = {

hide : hideTooltip,
Expand Down Expand Up @@ -114,10 +123,22 @@ export const Tooltip = {
})
},

linkAll : function() {
linkTotalNPCol : function() {
// get all relevant cells
document.querySelectorAll('.total').forEach( (cell) => {
this.link(cell, showFICA);
})
},

linkAllPersonnel : function() {
this.linkAccountStringCol();
this.linkSalaryCol();
this.linkTotalPersonnelCostCol();
},

linkAllOvertime : function() {
// this.linkAccountStringCol();
this.linkTotalNPCol();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/js/views/04_personnel/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ export async function initializePersonnelTable(){
// activate edit buttons
Table.Buttons.Edit.init(personnelRowOnEdit, updateDisplayandTotals);
initializeRowAddition();
// Link up tooltips to display more info on hover
Tooltip.linkAllPersonnel();
} else {
Prompt.Text.update('No personnel expenditures for this fund.')
}
// Link up tooltips to display more info on hover
Tooltip.linkAll();
}

function initializeRowAddition(){
Expand Down
10 changes: 7 additions & 3 deletions src/js/views/05_overtime/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Subtitle from '../../components/header/header.js';
import Sidebar from '../../components/sidebar/sidebar.js';
import Table from '../../components/table/table.js';
import { Services } from '../../utils/data_utils/budget_data_handlers.js';
import Tooltip from '../../components/tooltip/tooltip.js';

export function preparePageView(){
// prepare page view
Expand All @@ -28,16 +29,17 @@ export function preparePageView(){
function assignClasses() {
// record columns and their classes
const OT_cols = [
{ title: 'Account String', className: 'string' },
{ title: `Cost Center Name`, className: 'cc' },
// { title: 'Account String', className: 'account-string' },
{ title: `Cost Center Name`, className: 'cc-name' },
{ title: 'Appropriation Name', className: 'approp-name'},
{ title: 'Service', className: 'service' },
{ title: 'Recurring or One-Time', className: 'recurring'},
{ title: 'Hourly Employee Overtime (Wages)', className: 'OT-wages', isCost: true },
{ title: 'Salaried Employee Overtime (Salary)', className: 'OT-salary', isCost: true },
{ title: 'Total Cost (including benefits)', className : 'total', isCost: true},
{ title: 'Edit', className: 'edit'},
// calc columns
{ title: 'FICA Rate', className: 'fica', hide: true}
{ title: 'FICA Rate', className: 'fica', hide: true},
];

// assign cost classes
Expand All @@ -61,6 +63,8 @@ export async function initializeOTTable(){
updateDisplayandTotals();
// activate edit buttons
Table.Buttons.Edit.init(OTRowOnEdit, updateDisplayandTotals);
// wire up tooltips to show info on click
Tooltip.linkAllOvertime();
} else {
Prompt.Text.update('No overtime expenditures for this fund.')
}
Expand Down
13 changes: 9 additions & 4 deletions src/js/views/06_nonpersonnel/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ import Subtitle from "../../components/header/header.js";

const nonPersonnelColumns = [
{ title: 'FY26 Request', className: 'request', isCost: true },
{ title: 'Amount Remaining on Contract', className: 'remaining', isCost: true },
{ title: 'Service', className : 'service' },
{ title: 'Edit', className : 'edit' },
{ title : 'Account String', className : 'account-string'},
{ title : 'CPA #', className : 'cpa'},
{ title : 'Contract End Date', className : 'contract-end'},
{ title: 'Recurring or One-Time', className: 'recurring'},
{ title: 'Object Category', className: 'object'}

{ title : 'CPA #', className : 'cpa'},
{ title : 'Contract End Date', className : 'contract-end', hide:true},
{ title: 'Amount Remaining on Contract', className: 'remaining', isCost: true , hide: true},

// hidden columns used for calcs and info boxes
{ title: 'Object Name', className: 'object-name', hide: true},
{ title: 'Vendor Name', className: 'vendor', hide: true},
{ title: 'Object Category', className: 'object-category', hide: true}
];

export function preparePageView(){
Expand Down

0 comments on commit 7c47d5f

Please sign in to comment.