@ -193,12 +193,12 @@ function openPopupCanvas(button) {
var fileName = currentURL . substring ( currentURL . lastIndexOf ( '/' ) + 1 ) ;
// Get the list of projects
var count = 0 ; var myNumber ;
var count = 0 ; var myNumber = 0 ;
const projectList = [ ] ;
PROJECTS . items . forEach ( ( houses ) => {
projectList . push ( houses . xname ) ;
// get the number/order of the config selected element
if ( houses . xname = myParam ) { myNumber = count ; }
if ( houses . xname == myParam ) { myNumber = count ; }
count ++ ;
} ) ;
@ -265,8 +265,8 @@ document.getElementById("HDParameter").innerHTML = listParametersOptions;
< p > $ { myHouse . subtitle } < / p >
< / d i v >
< div class = "col-md-6" >
< img src = "${myHouse.image}" class = "card-img-top img-fluid imgshadow" alt = "..." >
< img src = "${myHouse.map}" class = "card-img-top img-fluid imgshadow" alt = "..." >
< a href = "${myHouse.image}" target = "picture of ${myHouse.hname}" > < img src = "${myHouse.image}" class = "card-img-top img-fluid imgshadow" alt = "..." > < / a >
< a href = "${myHouse.map_url}" target = "map of ${myHouse.hname}" > < img src = "${myHouse.map}" class = "card-img-top img-fluid imgshadow" alt = "..." > < / < >
< / d i v >
< / d i v >
< / d i v > ` ;
@ -342,7 +342,6 @@ document.getElementById("HDParameter").innerHTML = listParametersOptions;
var parts = inDay . split ( "/" ) ;
var day = ` ${ parts [ 2 ] } - ${ parts [ 1 ] } - ${ parts [ 0 ] } ` ;
var myTitle = document . getElementById ( "PDTitle" ) . value ;
var family = document . getElementById ( "PDFamSensor" ) . value ;
var type = document . getElementById ( "PDParameter" ) . value ;
// Building API query
@ -357,6 +356,7 @@ document.getElementById("HDParameter").innerHTML = listParametersOptions;
var inYear = inWeek . split ( "/" ) ;
var year = inYear [ 2 ] ;
var family = document . getElementById ( "PWFamSensor" ) . value ;
var myTitle = document . getElementById ( "PWTitle" ) . value ;
var type = document . getElementById ( "PWParameter" ) . value ;
// BUILDING API query
var apiUrl = "parallel/weekly?family=" + family + "&type=" + type + "&year=" + year + "&week=" + week ;
@ -370,6 +370,7 @@ document.getElementById("HDParameter").innerHTML = listParametersOptions;
var month = parseInt ( parts [ 0 ] , 10 ) ; // Parse the month as an integer
var year = parseInt ( parts [ 1 ] , 10 ) ; // Parse the year as an integer
var family = document . getElementById ( "PMFamSensor" ) . value ;
var myTitle = document . getElementById ( "PMTitle" ) . value ;
var type = document . getElementById ( "PMParameter" ) . value ;
// BUILDING API query
var apiUrl = "parallel/monthly?family=" + family + "&type=" + type + "&year=" + year + "&month=" + month ;
@ -380,6 +381,7 @@ document.getElementById("HDParameter").innerHTML = listParametersOptions;
case "PY" :
var year = document . getElementById ( "PYYear" ) . value ;
var family = document . getElementById ( "PYFamSensor" ) . value ;
var myTitle = document . getElementById ( "PYTitle" ) . value ;
var type = document . getElementById ( "PYParameter" ) . value ;
// BUILDING API query
var apiUrl = "parallel/yearly?family=" + family + "&type=" + type + "&year=" + year ;
@ -994,60 +996,77 @@ function do_horizon_row(data, myid, title, myDates) {
////////////////////////////////
// SAVE DASHBOARF :: export diagrams + texts to the API
function getApiUrls ( ) {
var apiUrlsLeft = { } ;
var apiUrlsCenter = { } ;
var apiUrlsRight = { } ;
document . querySelectorAll ( '#col-left div' ) . forEach ( function ( element ) {
var apiUrl = element . getAttribute ( 'apiurl' ) ;
var id = element . id ;
if ( apiUrl === 'txt' ) {
var clone = element . cloneNode ( true ) ;
clone . querySelectorAll ( 'span' ) . forEach ( function ( span ) {
span . parentNode . removeChild ( span ) ;
} ) ;
var innerHTML = clone . innerHTML . trim ( ) ;
apiUrlsLeft [ id ] = innerHTML ;
} else if ( apiUrl ) {
apiUrlsLeft [ id ] = apiUrl ;
}
var apiUrlsLeft = [ ] ;
var apiUrlsCenter = [ ] ;
var apiUrlsRight = [ ] ;
document . querySelectorAll ( '#col-left div' ) . forEach ( function ( element , index ) {
var apiUrl = element . getAttribute ( 'apiurl' ) ;
var id = element . id ;
var order = apiUrlsCenter . length ;
if ( apiUrl === 'txt' ) {
var clone = element . cloneNode ( true ) ;
clone . querySelectorAll ( 'span' ) . forEach ( function ( span ) {
span . parentNode . removeChild ( span ) ;
} ) ;
var innerText = clone . innerText . trim ( ) ;
apiUrlsLeft . push ( { order : order , id : id , text : innerText , api _url : null } ) ;
} else if ( apiUrl ) {
var h2Element = element . querySelector ( 'h2' ) ;
text = h2Element ? h2Element . innerText . trim ( ) : '' ;
apiUrlsLeft . push ( { order : order , id : id , text : text , api _url : apiUrl } ) ;
}
} ) ;
document . querySelectorAll ( '#col-center div' ) . forEach ( function ( element ) {
var apiUrl = element . getAttribute ( 'apiurl' ) ;
var id = element . id ;
if ( apiUrl === 'txt' ) {
var clone = element . cloneNode ( true ) ;
clone . querySelectorAll ( 'span' ) . forEach ( function ( span ) {
span . parentNode . removeChild ( span ) ;
} ) ;
var innerHTML = clone . innerHTML . trim ( ) ;
apiUrlsCenter [ id ] = innerHTML ;
} else if ( apiUrl ) {
apiUrlsCenter [ id ] = apiUrl ;
}
document . querySelectorAll ( '#col-center div' ) . forEach ( function ( element , index ) {
var apiUrl = element . getAttribute ( 'apiurl' ) ;
var id = element . id ;
var text = element . innerHTML . trim ( ) ; // Assuming the text is the innerHTML of the element
var order = apiUrlsCenter . length ;
if ( apiUrl === 'txt' ) {
var clone = element . cloneNode ( true ) ;
clone . querySelectorAll ( 'span' ) . forEach ( function ( span ) {
span . parentNode . removeChild ( span ) ;
} ) ;
var innerText = clone . innerText . trim ( ) ;
apiUrlsCenter . push ( { order : order , id : id , text : innerText , api _url : null } ) ;
} else if ( apiUrl ) {
var h2Element = element . querySelector ( 'h2' ) ;
text = h2Element ? h2Element . myLen . trim ( ) : '' ;
apiUrlsCenter . push ( { order : order , id : id , text : text , api _url : apiUrl } ) ;
}
} ) ;
document . querySelectorAll ( '#col-right div' ) . forEach ( function ( element ) {
var apiUrl = element . getAttribute ( 'apiurl' ) ;
var id = element . id ;
if ( apiUrl === 'txt' ) {
var clone = element . cloneNode ( true ) ;
clone . querySelectorAll ( 'span' ) . forEach ( function ( span ) {
span . parentNode . removeChild ( span ) ;
} ) ;
var innerHTML = clone . innerHTML . trim ( ) ;
apiUrlsRight [ id ] = innerHTML ;
} else if ( apiUrl ) {
apiUrlsRight [ id ] = apiUrl ;
}
document . querySelectorAll ( '#col-right div' ) . forEach ( function ( element , index ) {
var apiUrl = element . getAttribute ( 'apiurl' ) ;
var id = element . id ;
var text = element . innerHTML . trim ( ) ; // Assuming the text is the innerHTML of the element
var order = apiUrlsCenter . length ;
if ( apiUrl === 'txt' ) {
var clone = element . cloneNode ( true ) ;
clone . querySelectorAll ( 'span' ) . forEach ( function ( span ) {
span . parentNode . removeChild ( span ) ;
} ) ;
var innerText = clone . innerText . trim ( ) ;
apiUrlsRight . push ( { order : order , id : id , text : innerText , api _url : null } ) ;
} else if ( apiUrl ) {
var h2Element = element . querySelector ( 'h2' ) ;
text = h2Element ? h2Element . innerText . trim ( ) : '' ;
apiUrlsRight . push ( { order : order , id : id , text : text , api _url : apiUrl } ) ;
}
} ) ;
// Similar modifications for #col-center and #col-right
var result = {
"col-left" : apiUrlsLeft ,
"col-center" : apiUrlsCenter ,
"col-right" : apiUrlsRight
"name" : myHouse . xname ,
"description" : myHouse . subtitle ,
"col-left" : apiUrlsLeft ,
"col-center" : apiUrlsCenter ,
"col-right" : apiUrlsRight
} ;
return alert ( JSON . stringify ( result ) ) ;
@ -1056,6 +1075,7 @@ function getApiUrls() {
///////////////////////////////
// Template 3 columns 100%
const colLeft = document . getElementById ( "col-left" ) ;