diff --git a/src/index.html b/src/index.html
index 72d1302..765396e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -51,15 +51,22 @@
-
Baseline
+
+ Baseline
+
+
-
Suplemental
-
+
+ Suplemental
+
+
+
+
diff --git a/src/js/components/accordion/accordion.css b/src/js/components/accordion/accordion.css
index b6d1304..45257e7 100644
--- a/src/js/components/accordion/accordion.css
+++ b/src/js/components/accordion/accordion.css
@@ -55,10 +55,11 @@ span.amount {
.btn-add-init {
background-color: var(--spiritgreen);
border-color: var(--citygreen);
- position: absolute;
+ /* position: absolute; */
right: 0;
- margin-right: calc(20vw + 15px);
- margin-top: -8px;
+ /* margin-left: 20px; */
+ /* margin-right: calc(20vw + 15px); */
+ margin-top: 15px;
}
#supp-title {
@@ -67,4 +68,14 @@ span.amount {
.btn-add-init:hover {
background-color: var(--palegreen);
+}
+.add-init-btn-div{
+ text-align: center;
+}
+
+span.top-line-amount {
+ font-weight: bold;
+ position: absolute;
+ right: 0;
+ margin-right: calc(20vw + 20px);
}
\ No newline at end of file
diff --git a/src/js/components/accordion/accordion.js b/src/js/components/accordion/accordion.js
index 718dada..c66d348 100644
--- a/src/js/components/accordion/accordion.js
+++ b/src/js/components/accordion/accordion.js
@@ -1,10 +1,11 @@
import './accordion.css'
-import { CurrentFund, Fund, Supplemental } from "../../utils/data_utils/local_storage_handlers.js";
+import { Baseline, CurrentFund, Fund, Supplemental } from "../../utils/data_utils/local_storage_handlers.js";
import { formatCurrency, cleanString } from "../../utils/common_utils.js";
import Table from "../table/table.js";
import { FundLookupTable } from "../../utils/data_utils/budget_data_handlers.js";
import { visitPage } from '../../views/view_logic.js';
+import { TARGET } from '../../init.js';
function redirectForEdit(){
const row = document.querySelector(`.active-editing`);
@@ -150,12 +151,29 @@ export const Accordion = {
Item.updateHeader(program.name, program.name, program.net());
});
},
+ updateTopLines() {
+ // adjuse baseline
+ const baseline = new Baseline;
+ const baselineAmount = document.querySelector('#baseline-title .top-line-amount')
+ baselineAmount.textContent = formatCurrency(baseline.total());
+ // adjust supplementals
+ const supp = new Supplemental;
+ const suppAmount = document.querySelector('#supp-title .top-line-amount')
+ suppAmount.textContent = formatCurrency(supp.total());
+ // color-code baseline
+ if (baseline.total() <= TARGET){
+ baselineAmount.style.color = 'green';
+ } else {
+ baselineAmount.style.color = 'red';
+ }
+ },
build() {
this.createBaseline();
this.createSupp();
// initialize edit buttons
Table.Buttons.Edit.init(redirectForEdit);
this.AddInitButton.init();
+ this.updateTopLines();
}
}