@@ -52,13 +52,12 @@ function buildHierarchy(data) {
52
52
roundSize : data [ key ] . RoundSize , // For displaying size rounded, will make this a function later
53
53
roundSpend : data [ key ] . RoundSpend , // For displaying spending rounded, will make this a function later
54
54
site : data [ key ] . Site , // URL to Mass.gov site for each service
55
- description : data [ key ] . Description , // Description of service, (Testing, not fully added yet)
56
- income : data [ key ] . Income , // Max Income for eligibility (Testing, not fully added yet)
57
- age : data [ key ] . Age , // Age for eligibility, (Testing, not fully added yet)
58
- other : data [ key ] . Other , // Other factor of eligibility, (Testing, not fully added yet)
55
+ description : data [ key ] . Description , // Description of service
56
+ eligibility : data [ key ] . Elig , // Eligibility criteria
59
57
children : [ ]
60
58
} ) ;
61
59
} ) ;
60
+
62
61
dataMap . forEach ( ( value , key ) => { // Second pass to link children to their parents
63
62
if ( value . parent === "Services" ) { // Check if the node is a child of the root
64
63
root . children . push ( value ) ; // Add to root's children
@@ -208,22 +207,26 @@ function handleNodeClick(d) {
208
207
*/
209
208
function displayNodeInfo ( data ) {
210
209
const statisticsDiv = document . getElementById ( 'statistics' ) ;
210
+ const isAllResidents = data . eligibility === "All Residents" ; // For all services file, some services this is not applicable
211
+ const eligibility = data . eligibility && typeof data . eligibility === 'object' ;
212
+
211
213
statisticsDiv . innerHTML = `
212
214
<h2>${ data . name } </h2>
213
- <h3><a href="${ data . site } ">${ data . description } </a></h3>
215
+ <h3><a href="${ data . site } " target="_blank" >${ data . description } </a></h3>
214
216
215
217
<p>People: ${ data . roundSize } </p>
216
218
<p>Spend: $${ data . roundSpend } </p>
217
219
<p>Department: ${ data . department } </p>
218
220
221
+ ${ ! isAllResidents && eligibility ? `
219
222
<h3>Eligibility Criteria</h3>
220
- <p>Max Income: ${ data . income } </p>
221
- <p>Age Requirement: ${ data . age } </p>
222
- <p>Other Requirements: ${ data . other } </p>
223
+ <p>Max Income: ${ data . eligibility . Income } </p>
224
+ <p>Age: ${ data . eligibility . Age } </p>
225
+ <p>Other: ${ data . eligibility . Other } </p>
226
+ ` : '' }
223
227
` ;
224
228
}
225
229
226
-
227
230
/**
228
231
* clearSidebar()
229
232
* Clears the content of the sidebar.
0 commit comments