var project={"_id":"587d1976a6062f9f391e6413","id":"0a52dbcf58f39e66045deeb4407d56e05d6e309e","name":"Training app (TPeMS & iSTARS)","user":"57dfeb1654955f1127d5672b","description":"TRAINAIR PLUS training information","created":"2016-09-19T19:01:03.377Z","shared":false,"server":"micro","datafiles":[{"file":{"link":"http://api.anbdata.com/anb/states/system/trainair-TrainingCenters-list?api_key=b463f5b0-47a3-11e6-9ee7-176072942bca","type":"URL/API","url":"http://api.anbdata.com/anb/states/system/trainair-TrainingCenters-list?api_key=b463f5b0-47a3-11e6-9ee7-176072942bca","message":{"error":false,"text":""}},"varname":"allcenters","title":"Training Centers","activated":true,"name":"datafile","linkedtofile":true,"optional":true,"content":"","sendtojs":true},{"file":{"link":"http://api.anbdata.com/anb/states/system/trainair-CoursesDelivered-list?api_key=b463f5b0-47a3-11e6-9ee7-176072942bca","type":"URL/API","url":"http://api.anbdata.com/anb/states/system/trainair-CoursesDelivered-list?api_key=b463f5b0-47a3-11e6-9ee7-176072942bca","message":{"error":false,"text":""}},"varname":"alldelivered","title":"Courses Delivered","activated":true,"name":"datafile","linkedtofile":true,"optional":true,"content":"","sendtojs":true},{"file":{"link":"http://api.anbdata.com/anb/states/system/trainair-CoursesDeveloped-list?api_key=b463f5b0-47a3-11e6-9ee7-176072942bca","type":"URL/API","url":"http://api.anbdata.com/anb/states/system/trainair-CoursesDeveloped-list?api_key=b463f5b0-47a3-11e6-9ee7-176072942bca","message":{"error":false,"text":""}},"varname":"alldeveloped","title":"Courses Developed","activated":true,"name":"datafile","linkedtofile":true,"optional":true,"content":"","sendtojs":true},{"file":{"link":"https://v4p4sz5ijk.execute-api.us-east-1.amazonaws.com/anbdata/states/names/icao-member-states?api_key=b463f5b0-47a3-11e6-9ee7-176072942bca","type":"URL/API","url":"https://v4p4sz5ijk.execute-api.us-east-1.amazonaws.com/anbdata/states/names/icao-member-states?api_key=b463f5b0-47a3-11e6-9ee7-176072942bca","message":{"error":false,"text":""}},"varname":"statenames","title":"statenames","activated":true,"name":"datafile","linkedtofile":true,"optional":true,"content":"","sendtojs":true},{"file":{"link":"https://v4p4sz5ijk.execute-api.us-east-1.amazonaws.com/anbdata/services/groupselect","type":"URL/API","url":"https://v4p4sz5ijk.execute-api.us-east-1.amazonaws.com/anbdata/services/groupselect","message":{"error":false,"text":""}},"varname":"groups","title":"Groups","activated":true,"name":"datafile","linkedtofile":true,"optional":true,"content":""}],"packs":["bootstrap","jquery"],"container":"mainpart","js":{"file":{"type":"","url":"","link":"","message":{"error":true,"text":"File not defined"},"depurl":"https://quipslibistars.s3.amazonaws.com/prod/0a52dbcf58f39e66045deeb4407d56e05d6e309e/script.js"},"title":"Javascript","activated":true,"name":"js","linkedtofile":false,"optional":true,"content":"\nvar d = new Date();\nvar n = d.getFullYear();\nvar year = range(2012, n);\nvar year_mem = range(2011, n);\nvar num_course = range_zeros(2012, n);\nvar num_par = range_zeros(2012, n);\n\nvar date = [];\nvar participants = [];\n//change MM\n//var thisuseremail=\"mmerens@icao.int\"\nvar thisuseremail=\"hwen@icao.int\"\nif (typeof(getEmail)==\"function\") {\n getEmail(function(e){\n thisuseremail=e;\n $(\"#emailaddress\").val(e);\n })\n}else{\n\t$(\"#emailaddress\").val(\"Enter your email\")\n\t$(\"#email\").show();\n\t$(\"#emailaddress\").show();\n}\n\n// Marco Add - translation\n$(\".showoriginal a\").click(function(e){\n e.preventDefault()\n $(this).closest(\"li\").find(\".coursetitle\").show()\n $(this).closest(\"li\").find(\".coursetitletranslated\").hide()\n $(this).closest(\"li\").find(\".showoriginal\").hide()\n})\n$(\".translate button\").click(function(e){\n e.preventDefault()\n var lan=$(this).attr(\"key\")\n var ctitle=$(this).closest(\"li\").find(\"span.coursetitle\").text()\n var area=$(this).closest(\"li\")\n $.getJSON(\"https://www.googleapis.com/language/translate/v2?callback=?\",\n {q:ctitle,target:lan,format:\"text\",key:\"AIzaSyCmao0WNy34b6-lEPWWLn15MrLDXQMSF3U\"},\n function(res){\n console.log(res)\n var t=res.data.translations[0].translatedText\n $(area).find(\".coursetitletranslated\").text(t)\n $(area).find(\".coursetitletranslated\").show()\n $(area).find(\".showoriginal\").show()\n $(area).find(\".coursetitle\").hide()\n })\n})\n\n$(\"#groupsel\").change(function(e){\n\n drawgroup()\n})\n$(\"#showval\").click(function(e){\n\n drawgroup()\n})\n\nif (getParameterByName(\"print\")) {\n $(\".noprint\").hide()\n $(\"#groupsel\").val(getParameterByName(\"state\"))\n $(\".translate\").hide()\n $(\".delivered\").hide()\n}\nelse {\n $(\"#topbar\").css(\"margin-top\",\"20px\")\n $(\"#groupsel\").val(\"FRA\")\n}\n\nfunction getParameterByName( name ){\n var regexS = \"[\\\\?&]\"+name+\"=([^&]*)\", \n regex = new RegExp( regexS ),\n results = regex.exec( window.location.search );\n if( results == null ){\n return \"\";\n } else{\n return decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n }\n}\n\nfunction drawgroup(){\n var g=$(\"#groupsel\").val()\n if (g.length==3) {\n $(\".summarypanel\").hide()\n $(\".trainingpanel\").hide()\n $(\".trainingpanel[state='\"+g+\"']\").show()\n $(\"#header\").text($(\"#groupsel option:selected\").text())\n draw([g])\n }\n else {\n $.getJSON(\"https://v4p4sz5ijk.execute-api.us-east-1.amazonaws.com/anbdata/services/groupcomp?callback=?\",\n {group:g},function(gcomp){\n\n $(\"#header\").text(\"States in \"+$(\"#groupsel option:selected\").text())\n $(\".trainingpanel\").hide()\n \n $(gcomp.Composition).each(function(i,v){\n $(\".trainingpanel[state='\"+v+\"']\").hide(); //----HIDE for now to only show regional summary... add back later?\n });\n \n $(\"#header_sp\").text(\"Summary of Training Activities in \"+$(\"#groupsel option:selected\").text())\n $(\".summarypanel\").show()\n \n draw(gcomp.Composition)\n drawgroupgraphs(gcomp.Composition)\n }) \n }\n\n}\n\n//-----\n$(\"#print\").click(function(e){\n if($(\"#emailaddress\").val()==\"Enter your email\"){\n\t\talert(\"Please enter your email address.\")\n\t\treturn;\n\t}\n e.preventDefault();\n thisuseremail = $(\"#emailaddress\").val();\n $.getJSON(\"https://v4p4sz5ijk.execute-api.us-east-1.amazonaws.com/anbdata/services/genpdf?callback=?\",\n {file:\"http://quips.anbdata.com/project/prod/0a52dbcf58f39e66045deeb4407d56e05d6e309e.html?print=true&state=\"+$(\"#groupsel\").val(),\n key:\"GAT/\"+Math.round(new Date().getTime()/1000)+\"/gatreport.pdf\",\n header:\"GAT Report\",\n email:thisuseremail},function(res){\n \n })\n alert(\"The report was sent to your email \"+thisuseremail+\". You may need to check your spam or junk folder.\")\n})\nvar chart_del={\n chart: {\n alignTicks: false,\n zoomType: 'xy',\n spacingBottom: 15,\n spacingTop: 10,\n spacingLeft: 10,\n spacingRight: 10\n },\n title: {\n text: 'Courses Delivered'\n },\n subtitle: {\n text: \"country\",\n style: {\n color: '#36c',\n }\n },\n xAxis: {\n categories: [],\n crosshair: true\n },\n yAxis: { // Primary yAxis\n //min: 0,\n //gridLineWidth: 0,\n allowDecimals: false,\n title: {\n text: 'Courses',\n style: {\n color: '#36c',\n font: '14px Trebuchet MS, Verdana, sans-serif'\n }\n }\n },\n tooltip: {\n shared: true\n },\n credits:{\n enabled:false\n },\n plotOptions: {\n column: {\n stacking: 'normal'\n },\n series: {\n animation: false\n }\n },\n series: [{\n name: 'Number of Courses',\n type: 'column',\n color: 'rgb(53,97,143)',\n dataLabels:{\n enabled:true, \n color: 'Black',\n y: -20,\n verticalAlign: 'top',\n formatter:function() {\n if(this.y > 0) {\n return this.y;\n }\n }\n },\n showInLegend: false,\n data: []\n\n }/*, {\n name: 'Number of Participants',\n type: 'column',\n color: 'Blue',\n dataLabels:{enabled:true, inside: true, align:'center'},\n data: []\n }*/]\n };\n \nvar chart_par={\n chart: {\n alignTicks: false,\n zoomType: 'xy',\n spacingBottom: 15,\n spacingTop: 10,\n spacingLeft: 10,\n spacingRight: 10\n },\n title: {\n text: 'Course Participants'\n },\n subtitle: {\n text: \"country\",\n style: {\n color: '#36c',\n }\n },\n xAxis: {\n categories: [],\n crosshair: true\n },\n yAxis: { // Primary yAxis\n //min: 0,\n //gridLineWidth: 0,\n allowDecimals: false,\n title: {\n text: 'Participants',\n style: {\n color: '#36c',\n font: '14px Trebuchet MS, Verdana, sans-serif'\n }\n }\n },\n tooltip: {\n shared: true\n },\n credits:{\n enabled:false\n },\n plotOptions: {\n column: {\n stacking: 'normal'\n },\n series: {\n animation: false\n }\n },\n series: [{\n name: 'Number of Participants',\n type: 'column',\n color: 'rgb(153,124,251)',\n dataLabels:{\n enabled:true, \n color: 'Black',\n y: -20,\n verticalAlign: 'top',\n formatter:function() {\n if(this.y > 0) {\n return this.y;\n }\n }\n },\n showInLegend: false,\n data: []\n\n }/*, {\n name: 'Series name 2',\n type: 'column',\n color: 'DeepSkyBlue',\n dataLabels:{enabled:true, inside: true, align:'center'},\n data: []\n }*/]\n };\n\nvar chart_cen_state ={\n chart: {\n alignTicks: false,\n zoomType: 'xy',\n spacingBottom: 15,\n spacingTop: 10,\n spacingLeft: 10,\n spacingRight: 10,\n type: 'column'\n },\n title: {\n text: 'TRAINAIR PLUS Members by State'\n },\n subtitle: {\n text: \"State\",\n style: {\n color: '#36c',\n }\n },\n xAxis: {\n categories: [],\n crosshair: true,\n labels : {\n \trotation : -45,\n \talign : 'right'\n\n }\n },\n yAxis: {\n allowDecimals: false,\n title: {\n text: 'Centres',\n style: {\n color: '#36c',\n font: '14px Trebuchet MS, Verdana, sans-serif'\n }\n },\n stackLabels: {\n enabled: true,\n style: {\n fontWeight: 'bold',\n color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'\n },\n formatter : function () {\n \tif (this.total != 0) {\n \t\treturn this.total;\n \t}\n }\n }\n },\n legend: {\n backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',\n borderColor: '#CCC',\n borderWidth: 1\n },\n tooltip: {\n headerFormat: '{point.x}
',\n pointFormat: '{series.name}: {point.y}
Total: {point.stackTotal}'\n },\n credits:{\n enabled:false\n },\n plotOptions: {\n column: {\n stacking: 'normal',\n dataLabels: {\n enabled: false,\n color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',\n formatter : function () {\n \tif (this.y != 0) {\n \t\treturn this.y;\n \t}else{\n return null\n }\n }\n }\n },\n series: {\n animation: false\n }\n },\n series: [{\n name: 'RTCE',\n data: [],\n color: 'Green'\n\n }, {\n name: 'Full Members',\n data: [],\n color: 'DarkGoldenRod'\n }, {\n name: 'Associate Members',\n data: [],\n color: 'DarkGrey'\n }, {\n name: 'Corporate Members',\n data: [],\n color: 'DimGrey'\n }]\n};\n\nvar chart_cen_year ={\n chart: {\n alignTicks: false,\n zoomType: 'xy',\n spacingBottom: 15,\n spacingTop: 10,\n spacingLeft: 10,\n spacingRight: 10,\n type: 'line'\n },\n title: {\n text: 'Cumulative TRAINAIR PLUS Members per year'\n },\n subtitle: {\n text: \"State\",\n style: {\n color: '#36c',\n }\n },\n xAxis: {\n categories: [],\n crosshair: true\n },\n yAxis: {\n allowDecimals: false,\n title: {\n text: 'Centres',\n style: {\n color: '#36c',\n font: '14px Trebuchet MS, Verdana, sans-serif'\n }\n }\n },\n legend: {\n backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',\n borderColor: '#CCC',\n borderWidth: 1\n },\n credits:{\n enabled:false\n },\n plotOptions: {\n line: {\n dataLabels: {\n enabled: true\n }\n },\n series: {\n animation: false\n }\n },\n series: [{\n name: 'Number of members',\n data: [],\n color: 'rgb(53,97,143)',\n showInLegend: false\n },{\n name: 'RTCE',\n type: 'column',\n data: [],\n color: 'SeaGreen'\n\n }, {\n name: 'Full Members',\n type: 'column',\n data: [],\n color: 'DarkGoldenRod'\n }, {\n name: 'Associate Members',\n type: 'column',\n data: [],\n color: 'DarkGrey'\n }, {\n name: 'Corporate Members',\n type: 'column',\n data: [],\n color: 'DimGrey'\n }]\n}; \n\nvar treemap_cen_state={\n series: [{\n type: \"treemap\",\n layoutAlgorithm: 'squarified',\n alternateStartingDirection: true,\n levels: [{\n level: 1,\n layoutAlgorithm: 'sliceAndDice',\n dataLabels: {\n enabled: true,\n align: 'left',\n verticalAlign: 'top',\n style: {\n fontSize: '15px',\n fontWeight: 'bold'\n }\n }\n }],\n data: []\n }],\n title: {\n text: 'TRAINAIR PLUS Members by Membership'\n },\n subtitle: {\n text: \"State\",\n style: {\n color: '#36c',\n }\n },\n tooltip: {\n formatter : function () {\n \tif (typeof this.point.tt != 'undefined') {\n \t\treturn this.point.tt + ': ' + this.point.value;\n \t} else {\n \t\treturn 'Error: value cannot be displayed';\n \t}\n }\n },\n plotOptions: {\n series: {\n animation: false\n }\n },\n credits:{\n enabled:false\n }\n}\n\nfunction draw(states){\n$(states).each(function(k,state)\n{\n var delivered=alldelivered.filter(function(d){return d.StateCode==state});\n\n if (delivered.length>0)\n {\n // Get data\n for (var i=0; i 0) {\n \tvar map_val = [state, centers.length];\n \tmap_states.push(map_val);\n }\n\n //Get data for delivered courses per State\n for (var i=0; i=0){\n count_cen[a]+=1;\n (centers[i].Membership==\"RTCE\")?y_rtce[a]+=1:\n ((centers[i].Membership==\"Full\")?y_full[a]+=1:\n (centers[i].Membership==\"Associate\")?y_associate[a]+=1:\n (centers[i].Membership==\"Corporate\")?y_corporate[a]+=1:y_other[a]+=1)\n }else{test_null_mem.push(centers[i].Name);}\n }else\n {\n test_null_mem.push(centers[i].Name);\n }\n }\n \n //Type of Centers per State\n $(centers).each(function(j,cen)\n {\n (cen.Membership==\"RTCE\")?count_mem[0]+=1:((cen.Membership==\"Full\")?count_mem[1]+=1:((cen.Membership==\"Associate\")?count_mem[2]+=1:((cen.Membership==\"Corporate\")?count_mem[3]+=1:count_mem[4]+=1)))\n });\n if (count_mem[0] != 0 || count_mem[1] != 0 || count_mem[2] != 0 || count_mem[3] != 0 || count_mem[4] != 0) {\n m_states.push(state);\n \tm_rtce.push(count_mem[0]);\n \tm_full.push(count_mem[1]);\n \tm_associate.push(count_mem[2]);\n \tm_corporate.push(count_mem[3]);\n \tm_other.push(count_mem[4]);\n \tif (count_mem[4] > 0) {\n \t\tisNewMemberType = true\n \t}\n \n }\n \n //treemap data\n if (count_mem[0] != 0)\n {\n treemap_cen_state.series[0].data.push({\"name\":state, \"parent\":'R',\"value\":count_mem[0], \"tt\":codetoname(state)})\n }\n\t\tif (count_mem[1] != 0)\n {\n treemap_cen_state.series[0].data.push({\"name\":state, \"parent\":'F',\"value\":count_mem[1], \"tt\":codetoname(state)})\n }\n\t\tif (count_mem[2] != 0)\n {\n treemap_cen_state.series[0].data.push({\"name\":state, \"parent\":'A',\"value\":count_mem[2], \"tt\":codetoname(state)})\n }\n\t\tif (count_mem[3] != 0)\n {\n treemap_cen_state.series[0].data.push({\"name\":state, \"parent\":'C',\"value\":count_mem[3], \"tt\":codetoname(state)})\n }\n\t\tif (count_mem[4] != 0)\n {\n treemap_cen_state.series[0].data.push({\"name\":state, \"parent\":'O',\"value\":count_mem[4], \"tt\":codetoname(state)})\n }\n \n //Reset for next iteration\n count_mem=[0,0,0,0,0];\n \n });\n //Parse data for delivered courses regionally\n for (var y=0; y0?(\" Missing(\"+test_null_mem.length+\"): \"+test_null_mem):'');\n chart_cen_year.xAxis.categories=year_mem;\n chart_cen_year.series[0].data=count_cum_cen;\n chart_cen_year.series[1].data=y_cum_rtce;\n chart_cen_year.series[2].data=y_cum_full;\n chart_cen_year.series[3].data=y_cum_associate;\n chart_cen_year.series[4].data=y_cum_corporate;\n \n $(\".stategraph[name='del_group']\").highcharts(chart_del);\n $(\".stategraph[name='par_group']\").highcharts(chart_par);\n $(\".stategraph[name='cen_state_group']\").highcharts(chart_cen_state);\n $(\".stategraph[name='cen_year_group']\").highcharts(chart_cen_year);\n \n //test treemap\n treemap_cen_state.subtitle.text=groupname;\n treemap_cen_state.series[0].data.push({\n \tid : 'R',\n \tname : 'RTCE',\n \tcolor : 'Green'\n }, {\n \tid : 'F',\n \tname : 'Full Members',\n \tcolor : 'DarkGoldenRod'\n }, {\n \tid : 'A',\n \tname : 'Associate Member',\n \tcolor : 'LightGrey'\n }, {\n \tid : 'C',\n \tname : 'Corporate Members',\n \tcolor : 'DimGrey'\n }, {\n \tid : 'O',\n \tname : 'Other',\n \tcolor : 'DarkGrey'\n });\n $(\".stategraph[name='cen_state_group2']\").highcharts(treemap_cen_state)\n treemap_cen_state.series[0].data = [];\n //Reset\n g_date=[];\n g_participants=[];\n num_course=range_zeros(2012, n);\n num_par=range_zeros(2012, n);\n m_rtce=[];\n m_full=[];\n m_associate=[];\n m_corporate=[];\n m_other=[];\n m_states=[];\n isNewMemberType=false;\n \n \n //Text to display\n $(\"#intro_sp\").text(totalcenter==0?\"There are no TRAINAIR PLUS Members in \"+groupname:(totalcenter==1?\"There is one TRAINAIR PLUS Member in \"+groupname:\"There are \"+totalcenter+\" TRAINAIR PLUS Members in \"+groupname))\n $(\"#intro_sp\").text($(\"#intro_sp\").text()+\". \")\n $(\"#intro_sp\").text($(\"#intro_sp\").text()+(totaldeveloped==0?\"No ICAO-recognized courses have been developed. \":(totaldeveloped==1?\"One ICAO-recognized course has been developed. \":totaldeveloped+\" ICAO-recognized courses have been developed. \")))\n\t$(\"#intro_sp\").text($(\"#intro_sp\").text()+(totalunderdev==0?\"No ICAO-recognized courses are under development. \":(totalunderdev==1?\"One ICAO-recognized course is under development. \":totalunderdev+\" ICAO-recognized courses are under development. \")))\n $(\"#intro_sp\").text($(\"#intro_sp\").text()+(totaldelivered==0?\"No ICAO-recognized courses have been delivered.\":(totaldelivered==1?\"In total, one ICAO-recognized course has been delivered with \"+totalpar+\" participants.\":\"In total, \"+totaldelivered+\" ICAO-recognized courses have been delivered with \"+totalpar+\" participants.\")))\n \n $(\".totaldelivered_g\").text(totaldelivered)\n $(\".totaldeveloped_g\").text(totaldeveloped)\n $(\".totalcenter_g\").text(totalcenter)\n $(\".totalpar_g\").text(totalpar)\n \n //Generate Map\n var chart_map = {\n \tchart : {\n \t\tspacingBottom : 15,\n \t\tspacingTop : 10,\n \t\tspacingLeft : 10,\n \t\tspacingRight : 10\n \t},\n \ttitle : {\n \t\ttext : 'Distribution of TRAINAIR PLUS Members'\n \t},\n \tsubtitle : {\n \t\ttext : groupname,\n \t\tstyle : {\n \t\t\tcolor : '#36c',\n \t\t}\n \t},\n \tcolorAxis : {\n \t\tmin : 0 // enable colorAxis\n \t},\n \tmapNavigation : {\n \t\tenabled : true,\n \t\tbuttonOptions : {\n \t\t\tverticalAlign : 'bottom'\n \t\t}\n \t},\n \tcredits : {\n \t\tenabled : false\n \t},\n \tseries : [{\n \t\t\tdata : map_states,\n \t\t\tmapData : Highcharts.maps['custom/world-palestine-highres'],\n \t\t\tjoinBy : 'iso-a3',\n \t\t\tkeys : ['iso-a3', 'value'],\n \t\t\tname : 'Number of members',\n \t\t\tstates : {\n \t\t\t\thover : {\n \t\t\t\t\tcolor : '#a4edba'\n \t\t\t\t}\n \t\t\t},\n \t\t\tdataLabels : {\n \t\t\t\t//enabled : true,\n \t\t\t\t//format : '{point.properties.postal}'\n \t\t\t\t//format: '{point.name}'\n \t\t\t}\n \t\t}\n \t]\n };\n if (showmapval){\n chart_map.series[0].dataLabels.enabled=true;\n }\n //Highcharts.mapChart('map', chart_map);\n\n}\n\nfunction range(start, end) {\n var foo = [];\n for (var i = start; i <= end; i++) {\n foo.push(i);\n }\n return foo;\n}\n\nfunction range_zeros(start, end) {\n var foo = [];\n for (var i = start; i <= end; i++) {\n foo.push(0);\n }\n return foo;\n}\n\nfunction codetoname(statecode) {\n var foo = statenames.filter(function(d){return d.iso_3_code==statecode});\n if (foo.length != 0){\n return foo[0].UN_state_name;\n }else{\n return statecode;\n }\n}\n\ndrawgroup();\nCollapsibleLists.apply();"},"css":{"file":{"type":"","url":"","link":"","message":{"error":true,"text":"File not defined"}},"title":"Cascading Style Sheet (CSS)","activated":true,"name":"css","linkedtofile":false,"optional":true,"content":"p{\n font-size:1.4em;\n}"},"jade":{"file":{"type":"","url":"","link":"","message":{"error":true,"text":"File not defined"},"depurl":"https://quipslibistars.s3.amazonaws.com/prod/0a52dbcf58f39e66045deeb4407d56e05d6e309e/main.jade"},"title":"Jade","activated":true,"name":"jade","linkedtofile":false,"optional":false,"content":"p#email.noprint(style=\"display:none\") Provide your email: \n input#emailaddress.noprint(style=\"display:none\",value=\"hwen@icao.int\")\n\np.noprint Select a State or Region \n select#groupsel\n !{groups.html}\n//a#print.noprint(href=\"#\"): em Send PDF by email\n\n.container(style=\"width:950px\")\n div#topbar(style=\"margin-top:200px\")\n img(style=\"width:500px;margin: 0px auto;display:block\",src=\"https://s3.amazonaws.com/istarsscripts/images/State-Safety-Report_title-page_ICAO-logo.png\")\n .page-header(style=\"page-break-after:always\")\n h1(style='color:#0055A5;text-align:center'+(printit?\";margin-top:50px\":\"\")) Global Aviation Training Briefing\n h3#header(style='text-align:center;color:#5A6870') France\n h5(style='text-align:center;color:#5A6870'): em=\"Automatically Generated \"+new Date().toISOString().substring(0,10)\n //Regional Summary\n .summarypanel.panel.panel-primary\n .panel-heading\n h2#header_sp\n .panel-content\n p#intro_sp(style=\"text-align:justify;padding:10px\")\n .row\n .col-xs-3.text-center\n p(style=\"font-size:22px;font-weight:bold\") Courses Delivered\n br\n .label(style=\"background-color:rgb(53,97,143);font-size:16px;padding:10px\").label-info.totaldelivered_g\n .col-xs-3.text-center\n p(style=\"font-size:22px;font-weight:bold\") Courses Developed\n br\n .label(style=\"background-color:rgb(117,158,229);font-size:16px;padding:10px\").label-info.totaldeveloped_g\n .col-xs-3.text-center\n p(style=\"font-size:22px;font-weight:bold\") Training Centres\n br\n .label(style=\"background-color:rgb(75,200,230);font-size:16px;padding:10px\").label-info.totalcenter_g\n .col-xs-3.text-center\n p(style=\"font-size:22px;font-weight:bold\") Total Participants\n br\n .label(style=\"background-color:rgb(153,124,251);font-size:16px;padding:10px\").label-info.totalpar_g\n hr\n .row\n .col-xs-6.text-center\n .stategraph(name=\"del_group\",style=\"margin:auto;width:400px;height:250px\")\n .col-xs-6.text-center\n .stategraph(name=\"par_group\",style=\"margin:auto;width:400px;height:250px\")\n hr\n .row\n .stategraph(name=\"cen_state_group\",style=\"margin:auto;padding:20px\")\n //hr\n //.row\n // .stategraph(name=\"cen_state_group2\",style=\"margin:auto;padding:20px\")\n hr\n .row\n .stategraph(name=\"cen_year_group\",style=\"margin:auto;padding:20px\")\n //hr\n //input#showval(type=\"checkbox\", checked=true)\n //span Show values\n //.row\n // #map.stategraph(name=\"cen_map\",style=\"margin:auto;padding:20px\")\n //Individual States\n for state in statenames.sort(function(a,b){return (a.UN_state_name0)\n .row\n .col-xs-3.text-center\n p(style=\"font-size:22px;font-weight:bold\") Courses Delivered\n br\n .label(style=\"background-color:rgb(53,97,143);font-size:16px;padding:10px\").label-info=delivered.length\n .col-xs-3.text-center\n p(style=\"font-size:22px;font-weight:bold\") Courses Developed\n br\n .label(style=\"background-color:rgb(117,158,229);font-size:16px;padding:10px\").label-info=developed.length\n .col-xs-3.text-center\n p(style=\"font-size:22px;font-weight:bold\") Training Centres\n br\n .label(style=\"background-color:rgb(75,200,230);font-size:16px;padding:10px\").label-info=centers.length\n .col-xs-3.text-center\n p(style=\"font-size:22px;font-weight:bold\") Total Participants\n br\n .totalpar.label(style=\"background-color:rgb(153,124,251);font-size:16px;padding:10px\").label-info=totalpar\n if (delivered.length>0)\n hr \n .row\n .col-xs-6.text-center\n .stategraph(name=\"del_\"+state.UN_state_name,style=\"margin:auto;width:400px;height:250px\")\n .col-xs-6.text-center\n .stategraph(name=\"par_\"+state.UN_state_name,style=\"margin:auto;width:400px;height:250px\")\n //br\n .list-group(style=\"margin-top:25px\")\n for element in centers\n - var coursesdelivered=delivered.filter(function(d){return element.Name==d.TrainingCenter})\n - var coursesdeveloped=developed.filter(function(d){ return element.Name==d.TrainingCenter })\n - var coursesunderdev=underdev.filter(function(d){ return element.Name==d.TrainingCenter })\n .list-group-item(style=\"border-left-color:rgb(75,200,230);border-left-width:8px\")\n p(style=\"font-size:16px;font-weight:bold\")=element.Name\n if (element.Membership==\"Full\")\n span.badge(style=\"background-color:DarkGoldenRod;font-size:12px;margin-left:10px;font-weight:normal\")=element.Membership+\" Member\"\n else if (element.Membership==\"Associate\")\n span.badge(style=\"background-color:DarkGrey;font-size:12px;margin-left:10px;font-weight:normal\")=element.Membership+\" Member\"\n else if (element.Membership==\"RTCE\")\n span.badge(style=\"background-color:Green;font-size:12px;margin-left:10px;font-weight:normal\")=element.Membership\n else\n //A membership level not handled above\n span.badge(style=\"background-color:Orange;font-size:12px;margin-left:10px;font-weight:normal\")=element.Membership+\" Member\"\n br\n span(style=\"font-size:14px;font-style:italic\")=element.Type+\" Training Organization\"\n -var last = new Date(element.LastAssessment);\n -var next = new Date(element.NextAssessment);\n -var since = new Date(element.MemberSince);\n if (element.MemberSince)\n span(style=\"font-size:14px;font-style:italic\")=\", Member since \"+ since.toLocaleString(locale, { month: \"long\" }) + \" \" + since.getUTCFullYear()\n br\n if (centers.length==1)\n if (coursesdelivered.length>0 || coursesdeveloped.length>0)\n p Courses delivered: \n span.badge(style=\"background-color:rgb(53,97,143)\")=delivered.filter(function(d){return d.TrainingCenter==element.Name}).length\n span(style=\"margin-left:20px\") Courses developed: \n span.badge(style=\"background-color:rgb(117,158,229)\")=coursesdeveloped.length\n span(style=\"margin-left:20px\") Courses under development: \n span.badge(style=\"background-color:rgb(75,200,230)\")=coursesunderdev.length\n else if (coursesdeveloped.length==0)\n p No courses developed yet\n else \n p Courses delivered: \n span.badge(style=\"background-color:rgb(53,97,143)\")=delivered.filter(function(d){return d.TrainingCenter==element.Name}).length\n span(style=\"margin-left:20px\") Courses developed: \n span.badge(style=\"background-color:rgb(117,158,229)\")=coursesdeveloped.length\n span(style=\"margin-left:20px\") Courses under development: \n span.badge(style=\"background-color:rgb(75,200,230)\")=coursesunderdev.length\n //Courses Developed\n if (coursesdeveloped.length>0)\n span(style=\"font-size:14px;font-style:italic;font-weight:bold\")=\"Courses Developed:\"\n ul\n for c in coursesdeveloped\n -var c_delivered=alldelivered.filter(function(d){return d.Code==c.Code})\n li\n span.coursetitle=c.Title\n span.coursetitletranslated(style=\"background-color:LightGoldenRodYellow ;display:none\")=c.Title\n span=\" \"\n span=\" (\"+c.Code+\")\"\n span(style=\"font-size:12px;font-style:italic;color:DimGrey\")=(c_delivered.length>0?(c_delivered.length==1?\", delivered once\":\", delivered \"+c_delivered.length+\" times\"):(\", \"+c.Status))\n br\n .translate\n em.showoriginal(style=\"display:none;font-size:8px\")\n a(href=\"#\") See Original\n br\n button.btn.btn-xs.btn-link(key=\"en\") en\n button.btn.btn-xs.btn-link(key=\"fr\") fr\n button.btn.btn-xs.btn-link(key=\"zh-CN\") cn\n button.btn.btn-xs.btn-link(key=\"ar\") ar\n button.btn.btn-xs.btn-link(key=\"es\") es\n button.btn.btn-xs.btn-link(key=\"ru\") ru\n \n //Courses Under Development\n if (coursesunderdev.length>0)\n span(style=\"font-size:14px;font-style:italic;font-weight:bold\")=\"Courses Under Development:\"\n ul\n for c in coursesunderdev\n li\n span.coursetitle=c.Title\n span.coursetitletranslated(style=\"background-color:LightGoldenRodYellow ;display:none\")=c.Title\n span=\" \"\n span=\" (\"+c.Code+\")\"\n br\n .translate\n em.showoriginal(style=\"display:none;font-size:8px\")\n a(href=\"#\") See Original\n br\n button.btn.btn-xs.btn-link(key=\"en\") en\n button.btn.btn-xs.btn-link(key=\"fr\") fr\n button.btn.btn-xs.btn-link(key=\"zh-CN\") cn\n button.btn.btn-xs.btn-link(key=\"ar\") ar\n button.btn.btn-xs.btn-link(key=\"es\") es\n button.btn.btn-xs.btn-link(key=\"ru\") ru\n \n //Courses Delivered\n -var coursetitles=coursesdelivered.map(function(d){return d.Title})\n -var uniquecoursetitles=coursetitles.filter(function(item, pos, self){return self.indexOf(item)==pos})\n\n -var uniqueDel = []\n for u in uniquecoursetitles\n -var del = {}\n -del.Title=u\n -del.totalPar = coursesdelivered.reduce(function(total, curval){ if(u==curval.Title){return total+curval.TotalParticipants}else{return total} },0)\n -del.totalDel = coursesdelivered.reduce(function(total, curval){ if(u==curval.Title){return total+1}else{return total} },0)\n -uniqueDel.push(del)\n \n if (coursesdelivered.length>0)\n span(style=\"font-size:14px;font-style:italic;font-weight:bold\")=\"Courses Delivered - Summary:\"\n ul\n for c in uniqueDel\n li\n span.coursetitle=c.Title\n span.coursetitletranslated(style=\"background-color:LightGoldenRodYellow ;display:none\")=c.Title\n span(style=\"font-size:12px;font-style:italic;color:DimGrey\")=(c.totalDel>1?(\", delivered \"+c.totalDel+\" times with \"+c.totalPar+\" participants total\"):(\", delivered \"+c.totalDel+\" time with \"+c.totalPar+\" participants total\"))\n br\n .translate\n em.showoriginal(style=\"display:none;font-size:8px\")\n a(href=\"#\") See Original\n br\n button.btn.btn-xs.btn-link(key=\"en\") en\n button.btn.btn-xs.btn-link(key=\"fr\") fr\n button.btn.btn-xs.btn-link(key=\"zh-CN\") cn\n button.btn.btn-xs.btn-link(key=\"ar\") ar\n button.btn.btn-xs.btn-link(key=\"es\") es\n button.btn.btn-xs.btn-link(key=\"ru\") ru\n \n //Courses Delivered\n .delivered\n if (coursesdelivered.length>0)\n ul.collapsibleList(style=\"font-size:14px;font-style:italic;font-weight:bold;list-style:none;padding:0px\")\n li\n | + Courses Delivered - Detailed (click to expand)\n ul(style=\"font-size:12px;font-style:italic;font-weight:normal\")\n for c in coursesdelivered\n li=c.Title+\" (\"+c.Code+\")\"\n span(style=\"font-size:12px;font-style:italic;color:DimGrey\")=\", delivered \"+c.FromDate+\" with \"+c.TotalParticipants+\" participants\"\n \n"},"prod":true,"capture":"https://quipslibistars.s3.amazonaws.com/prod/0a52dbcf58f39e66045deeb4407d56e05d6e309e/capture.png","morejs":[{"url":"https://code.highcharts.com/highcharts.js"},{"url":"https://code.highcharts.com/stock/modules/map.js"},{"url":"https://code.highcharts.com/maps/modules/map.js"},{"url":"https://code.highcharts.com/mapdata/custom/world-palestine-highres.js"},{"url":"https://s3.amazonaws.com/istarsshare/CollapsibleLists.js"},{"url":"https://code.highcharts.com/modules/treemap.js"}],"deploydate":"2023-03-10T19:29:25.280Z","sharedwith":["5969034e9b111eaf654f4aab"],"libs":[{"_id":"5672b285f36b083214f3e63b","description":"A sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.","key":"","version":"3.3.6","link":"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css,https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css,https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js","name":"bootstrap","__v":0,"haskey":false,"required":false,"website":"http://www.getbootstrap.com"},{"_id":"5672b602f36b083214f3e63e","description":"The Write Less, Do More, JavaScript Library","key":"","version":"2.1.1","link":"https://code.jquery.com/jquery-2.1.4.js","name":"jquery","__v":0,"required":true,"haskey":false,"website":"https://jquery.com"}],"host":"https://quips.anbdata.com","version":"prod"} function loadjquery(url,callback) { if(typeof jQuery=='undefined') { loadScript(url,callback) } else { callback() } } function loadScript(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function () { callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } (function () { loadjquery("https://code.jquery.com/jquery-2.1.4.js", function () { //jQuery loaded $("#"+project.container).html("") var libs=[] $(project.libs).each(function(i,v){ if (v.name!="jquery") { $(v.link.split(",")).each(function(j,u){ if (u.slice(-2)=="js") { libs.push(u+(v.haskey?"?key="+project[v.name+"key"]:"")) } else { $("head").append("") } }) } }) if (project.morejs) { $(project.morejs).each(function(i,v){ if ((v.url.substring(0,2)=="//")||(v.url.substring(0,8)=="https://")||(v.url.substring(0,7)=="http://")) { libs.push(v.url) } }) } if (project.morecss) { $(project.morecss).each(function(i,v){ $("head").append("") }) } loadlibs(libs.reverse()) }); })(); function loadlibs(libs){ if (libs.length>0) { var l=libs.pop() loadScript(l,function(){ //$.getScript(l,function(res){ loadlibs(libs) }) //.fail(function(e){ // loadlibs(libs) // //}) } else { start() } } function putscriptcontent(content){ var script = document.createElement("script") script.type = "text/javascript"; $(script).text(content) document.getElementsByTagName("head")[0].appendChild(script); } function start(){ //load jade $.getJSON(project.host+"/project/"+project.version+"/"+project.id+"/render?callback=?"+(project.datachange?"&data="+project.datachange:""),function(res){ $("#"+project.container).html(res.html) if (project.css.activated) { if (project.css.linkedtofile) { $("head").append("")} else { $("head").append("")} } if (project.js.activated) { if (project.js.linkedtofile) { $.getScript(project.js.file[(project.prod?"depurl":"url")])} else { putscriptcontent(project.js.content)} if (project.mainjs) { window[project.mainjs]() } } }) }