'; }); $(".geography-aspects").html(aspects); $('.accordion').find('.accordion-toggle').click(function() { $(this).next().slideToggle('600'); $(".accordion-content").not($(this).next()).slideUp('600'); }); $('.accordion-toggle').on('click', function() { $(this).toggleClass('active').siblings().removeClass('active'); }); $(".nicescroll-box").getNiceScroll().resize(); $(".geography-aspects").getNiceScroll().resize(); }) .fail(function( jqxhr, textStatus, error ) { var err = textStatus + ", " + error; console.log( "Request Failed: " + err ); }); } $("#btnSearch").click(function(){ $('html, body').animate({ scrollTop: $("#resultdiv").offset().top }, 500); var checkedaspects = $('.aspects:checkbox:checked').map(function() { return this.value; }).get().join(); var checkedids = $('.tag').map(function () { var tagid = this.id.replace("tag_",""); return tagid; }).get().join(); allaspects = checkedids+","+checkedaspects; allaspects = allaspects.replace(/^,|,$/g,''); uniqueaspects = $.unique(allaspects.split(',').sort()); allaspects = uniqueaspects.join(","); if(allaspects != "") { //if level is subdistrict if($("input[name='radGeoLevel']:checked").val() == "4" ) { if($("#txtSubdistrictStateId").val() == "") alert("Please choose a state"); else { retrieveResponse($("input[name='radGeoLevel']:checked").val(),"",allaspects); $('.timerBtn').addClass("active"); $('.mapBtn').addClass("disabled"); $('.mapBtn').removeClass("active"); $('.filter-result-map').addClass("disabled"); $('.filter-result-map').removeClass("active"); $('.filter-result-main #table_info').addClass("active"); $('.filter-result-main #table_info').removeClass("disabled"); $('.filter-result-main #table_paginate').addClass("active"); $('.filter-result-main #table_paginate').removeClass("disabled"); $('.filter-result-main .dataTables_scroll').addClass("active"); $('.filter-result-main .dataTables_scroll').removeClass("disabled"); $('.filter-result-main #table_filter').addClass("active"); $('.filter-result-main #table_filter').removeClass("disabled"); $('.filter-result-main #table_wrapper').addClass("disabled"); $('.filter-result-main #table_wrapper').removeClass("active"); } } //if level is village else if($("input[name='radGeoLevel']:checked").val() == "5" ) { if($("#txtVillageSubdistrictId").val() == "") alert("Please choose a subdistrict"); else { retrieveResponse($("input[name='radGeoLevel']:checked").val(),"",allaspects); $('.timerBtn').addClass("active"); $('.mapBtn').addClass("disabled"); $('.mapBtn').removeClass("active"); $('.filter-result-map').addClass("disabled"); $('.filter-result-map').removeClass("active"); $('.filter-result-main #table_info').addClass("active"); $('.filter-result-main #table_info').removeClass("disabled"); $('.filter-result-main #table_paginate').addClass("active"); $('.filter-result-main #table_paginate').removeClass("disabled"); $('.filter-result-main .dataTables_scroll').addClass("active"); $('.filter-result-main .dataTables_scroll').removeClass("disabled"); $('.filter-result-main #table_filter').addClass("active"); $('.filter-result-main #table_filter').removeClass("disabled"); $('.filter-result-main #table_wrapper').addClass("disabled"); $('.filter-result-main #table_wrapper').removeClass("active"); } } //if level is town else if($("input[name='radGeoLevel']:checked").val() == "6" ) { if($("#txtTownStateId").val() == "") alert("Please choose a state"); else { retrieveResponse($("input[name='radGeoLevel']:checked").val(),"",allaspects); $('.timerBtn').addClass("active"); $('.mapBtn').addClass("disabled"); $('.mapBtn').removeClass("active"); $('.filter-result-map').addClass("disabled"); $('.filter-result-map').removeClass("active"); $('.filter-result-main #table_info').addClass("active"); $('.filter-result-main #table_info').removeClass("disabled"); $('.filter-result-main #table_paginate').addClass("active"); $('.filter-result-main #table_paginate').removeClass("disabled"); $('.filter-result-main .dataTables_scroll').addClass("active"); $('.filter-result-main .dataTables_scroll').removeClass("disabled"); $('.filter-result-main #table_filter').addClass("active"); $('.filter-result-main #table_filter').removeClass("disabled"); $('.filter-result-main #table_wrapper').addClass("disabled"); $('.filter-result-main #table_wrapper').removeClass("active"); } } //if level is ward else if($("input[name='radGeoLevel']:checked").val() == "7" ) { if($("#txtWardDistrictId").val() == "") alert("Please choose a district"); else { retrieveResponse($("input[name='radGeoLevel']:checked").val(),"",allaspects); $('.timerBtn').addClass("active"); $('.mapBtn').addClass("disabled"); $('.mapBtn').removeClass("active"); $('.filter-result-map').addClass("disabled"); $('.filter-result-map').removeClass("active"); $('.filter-result-main #table_info').addClass("active"); $('.filter-result-main #table_info').removeClass("disabled"); $('.filter-result-main #table_paginate').addClass("active"); $('.filter-result-main #table_paginate').removeClass("disabled"); $('.filter-result-main .dataTables_scroll').addClass("active"); $('.filter-result-main .dataTables_scroll').removeClass("disabled"); $('.filter-result-main #table_filter').addClass("active"); $('.filter-result-main #table_filter').removeClass("disabled"); $('.filter-result-main #table_wrapper').addClass("disabled"); $('.filter-result-main #table_wrapper').removeClass("active"); } } else { retrieveResponse($("input[name='radGeoLevel']:checked").val(),"",allaspects); $('.timerBtn').addClass("active"); $('.mapBtn').addClass("disabled"); $('.mapBtn').removeClass("active"); $('.filter-result-map').addClass("disabled"); $('.filter-result-map').removeClass("active"); $('.filter-result-main #table_info').addClass("active"); $('.filter-result-main #table_info').removeClass("disabled"); $('.filter-result-main #table_paginate').addClass("active"); $('.filter-result-main #table_paginate').removeClass("disabled"); $('.filter-result-main .dataTables_scroll').addClass("active"); $('.filter-result-main .dataTables_scroll').removeClass("disabled"); $('.filter-result-main #table_filter').addClass("active"); $('.filter-result-main #table_filter').removeClass("disabled"); $('.filter-result-main #table_wrapper').addClass("disabled"); $('.filter-result-main #table_wrapper').removeClass("active"); } } else alert("Please choose atleast one variable"); }); function displayResult(aspectid) { var splittedaspect = aspectid.split("_"); retrieveResponse($("input[name='radGeoLevel']:checked").val(),"",splittedaspect[1]); } function clearSearches() { $('.delete-tag').click(); $('.aspects').prop('checked', false); } function removeFromArray(original, remove) { return original.filter(value => !remove.includes(value)); } function filterRBIAspect(aspectid) { $.ajax({ url: "include/ajax.php", data:{aspectid:aspectid,option:"filterrbiaspect"}, dataType: 'JSON', type: "POST", success : function(response){ if(response == 0) alert("This data cannot be visualized."); else { var len = response.length; var aspects = ''; for(var i=0; i ").load(charturl); } } }); } function filterRBIAspectEmbed(aspectid) { $.ajax({ url: "include/ajax.php", data:{aspectid:aspectid,option:"filterrbiaspect"}, dataType: 'JSON', type: "POST", success : function(response){ if(response == 0) alert("This data cannot be embed."); else { var len = response.length; var aspects = ''; for(var i=0; i'); text += htmlEntities('