$(document).ready(function(){ document.title = 'OIG Recommendation Dashboard - Office of Inspector General, U.S. Dept. of Labor'; var arrYear = ['24', '23', '22', '21', '20', '19', '18', '17', '16', '15', '14', '13', '12', '11', '10']; //98 OT AGY //08 SOL var arrAgency =['11', '13', '12', '04', '03', '06', '50', '07', '14', '09', '16', '01','10', '430', '08', '02', '15']; var objAgency = [ {id:11, name: 'BLS'}, {id:13, name: 'OCFO'}, {id:12, name: 'EBSA'}, {id:04, name: 'ESA'}, {id:03, name: 'ETA'}, {id:06, name:'MSHA'}, {id:50, name:'MULTI'}, {id:07, name:'OASAM'}, {id:14, name:'OFCCP'}, {id:09, name:'OIG'}, {id:16, name:'OLMS'}, {id:01, name:'OSEC'}, {id:10, name:'OSHA'}, {id:430, name:'OWCP'}, {id:08, name:'SOL'}, {id:02, name:'VETS'}, {id:15, name:'WHD'} ]; //get total var totalamount = 0; $(".row-recomm, .row-recomm-suffix").each(function(){ varDataId = $(this).attr('data-amount'); totalamount = totalamount + parseInt(varDataId); }); ///End of filter results function checkedFilters(e){ //alert(e); var checked = []; var checkfilter = e + " input:checked:enabled"; //if(checkfilter.match()) $(checkfilter).each(function(){ var inptvalue = $(this).attr('value'); /* if(/^\d/.test(inptvalue)){ console.log('yes is number'); inptvalue = parseInt(inptvalue); } */ if(inptvalue == '11'){ checked.push(parseInt($(this).attr('value'))); } else{ checked.push($(this).attr('value')); } //checked.push($(this).attr('value')); //checked.push(inptvalue); console.log(inptvalue); }); if(checked.length > 0 ){ return checked; } else{ return false; } }; $('#chkAgency input:checkbox, #chkYear input:checkbox, #chkStatus input:checkbox').on('change', function(){ $('#rpt-number').val(''); var chkboxgroupname = $(this).attr("name"); var chkboxgroupid = $(this).closest('div').attr('id'); var inputchkboxgroupname = "input:checkbox[name='"+ chkboxgroupname +"']"; var chkboxgroupvalue = $(this).attr("value"); var len = $('#' + chkboxgroupid + ' input[name="' + chkboxgroupname + '"]:checked').length; if($('input#chk370').is(':disabled') && !$('input#chk03').is(':checked') ) { $('input#chk370').prop('checked', false); $('input#chk370').prop('disabled', false); if(len == 1){ len = 0; } // } if (chkboxgroupname == 'status') { $(inputchkboxgroupname).not(this).prop('checked', false); } else if((chkboxgroupname == 'agency'|| 'year') && chkboxgroupvalue == 'all'){ $(inputchkboxgroupname).not(this).prop('checked', false); //$('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('disabled', true); if(chkboxgroupname == 'agency'){ $('input#chk370').prop('disabled', false); } } else if(len == 0){ $('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('checked', true); //$('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('disabled', true); } else{ $('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('checked', false); //$('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('disabled', false); } var statusBox = dashStatusView(); varchkboxstatusname = $("input[name='status']:checked").val(); var fltrStatus = checkedFilters('#chkStatus') || null; var fltrAgency = checkedFilters('#chkAgency') || null; var fltrYear = checkedFilters('#chkYear') || null; //reset expand/collapse id and img expandCollapse('expandAll'); // Test New 051019 $('#openRecmBoxChart').fadeTo("slow", 0.4); $('#data-results').fadeTo("slow", 0.4); //alert('input change filter 1 of 6'); //alert('check agy 102219 - ' + fltrAgency); if(chkboxgroupname == 'status'){ //102219 //alert('agency filter - ' + fltrStatus); fltrAgency = fltrYear = null; $("#chkAgency input").prop('checked', false); $('#chkAgency input:checkbox[value="all"]').prop('checked', true); //$('#chkAgency input:checkbox[value="all"]').prop('disabled', true); $("#chkYear input").prop('checked', false); $('#chkYear input:checkbox[value="all"]').prop('checked', true); //$('#chkYear input:checkbox[value="all"]').prop('disabled', true); } $("#data-results").load("recommendation_filter_080119-tm-www.php", { filterYear: fltrYear, filterAgency: fltrAgency, filterStatus: fltrStatus, filterSearch: null }, function(data, status){ runEveryTime(fltrAgency, statusBox, chkboxgroupname, 1); }); }); /////////////////////////////////////////// // check all mobile filters and update/load page /////////////////////////////////////////// //$('#mFilterGroup').change(function(){ $('#mchkAgency input:checkbox, #mchkYear input:checkbox, #mchkStatus input:checkbox').on('change', function(){ //alert('mobile'); $('#rpt-number').val(''); /////////// NEW 6/3 mobile for all, open, or closed var chkboxgroupname = $(this).attr("name"); var chkboxgroupid = $(this).closest('div').attr('id'); var inputchkboxgroupname = "input:checkbox[name='"+ chkboxgroupname +"']"; var chkboxgroupvalue = $(this).attr("value"); var len = $('#' + chkboxgroupid + ' input[name="' + chkboxgroupname + '"]:checked').length; //if(chkboxgroupid == 'chkAgency' && len == 1 && ($('input#chk370').is(':disabled')) ){ if($('input#chk370').is(':disabled') && !$('input#chk03').is(':checked') ) { $('input#chk370').prop('checked', false); $('input#chk370').prop('disabled', false); if(len == 1){ len = 0; } } if (chkboxgroupname == 'mstatus') { $(inputchkboxgroupname).not(this).prop('checked', false); } else if((chkboxgroupname == 'magency'|| 'myear') && chkboxgroupvalue == 'all'){ $(inputchkboxgroupname).not(this).prop('checked', false); //$('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('disabled', true); } else if(len == 0){ $('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('checked', true); //$('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('disabled', true); } else{ $('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('checked', false); // $('#' + chkboxgroupid + ' input:checkbox[value="all"]').prop('disabled', false); } ///////////EOF NEW 6/3 mobile for all, open, or closed var statusBox = dashStatusView('m'); var fltrStatus = checkedFilters('#mchkStatus') || null; var fltrAgency = checkedFilters('#mchkAgency') || null; var fltrYear = checkedFilters('#mchkYear') || null; //reset expand/collapse id and img expandCollapse('expandAll'); // Test New 051019 $('#openRecmBoxChart').fadeTo("slow", 0.4); $('#data-results').fadeTo("slow", 0.4); //alert('mFilterGroup filter 2 of 6'); //console.log('Hello!'); //console.log(chkboxgroupname); if(chkboxgroupname == 'mstatus'){ fltrAgency = fltrYear = null; $("#mchkAgency input").prop('checked', false); $('input#chk370').prop('disabled', false); $('#mchkAgency input:checkbox[value="all"]').prop('checked', true); //$('#mchkAgency input:checkbox[value="all"]').prop('disabled', true); $("#mchkYear input").prop('checked', false); $('#mchkYear input:checkbox[value="all"]').prop('checked', true); //$('#mchkYear input:checkbox[value="all"]').prop('disabled', true); } $("#data-results").load("recommendation_filter_080119-tm-www.php", { filterYear: fltrYear, filterAgency: fltrAgency, filterStatus: fltrStatus, filterSearch: null }, function(data, status){ runEveryTime(fltrAgency, statusBox, chkboxgroupname, 2); }); }); //when loading page //preload //temp runEveryTime(null, 'open', 'yes'); /////////////////////////// // Mobile Filter Menu $('div#mFilterGroup> div').hide(); $('div#mFilterTitle> div').hide(); $('div#mFilterGroup> h3').click(function() { $(this).next('div').slideToggle('normal') .siblings('div:visible').slideUp('normal'); }); /////////////////////////// // EOF Mobile Filter Menu /////////////////////////// //********************* // 052319 now counting all 3 status all, open, closed and monetary value of each //********************* //** Run when status filter equals all 5/28/19 function totalAmount(){ var totalamount = 0; $(".row-recomm, .row-recomm-suffix").each(function(){ varDataId = $(this).attr('data-amount'); totalamount = totalamount + parseInt(varDataId); }); totalamt = totalamount.toString(); totalamt = totalamt.replace(/\B(?=(\d{3})+(?!\d))/g, ","); $('#openamount').text('$' + totalamt); }; function totalRecommendation(agency){ var cntTotalRecomm = $('.row-recomm').length; console.log(agency); console.log(cntTotalRecomm); cntTotalRecomm = cntTotalRecomm.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2'); var CntSecAgy = 0; if(agency){ var cntArrAgy = agency; var lenAgy = cntArrAgy.length; while (lenAgy--){ //alert("ln 318 " + cntArrAgy[lenAgy]); //var CntSecAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "']").length + CntSecAgy; //alert('318 ' + CntSecAgy); tempAgyLen = cntArrAgy[lenAgy].length; if(tempAgyLen == 2){ if(cntArrAgy[lenAgy] == 4 ){ var CntSecAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "'][data-program='001']").length + CntSecAgy; } else{ var CntSecAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "']").length + CntSecAgy; } } else if(tempAgyLen == 3){ var CntSecAgy = $(".row-recomm[data-program='" + cntArrAgy[lenAgy] + "']").length + CntSecAgy; if(cntArrAgy[lenAgy] == 420){ var CntSecAgy = $(".row-recomm[data-agency='15']").length + CntSecAgy; } if(cntArrAgy[lenAgy] == 430){ var CntSecAgy = $(".row-recomm[data-agency='04'][data-program='431']").length + CntSecAgy; var CntSecAgy = $(".row-recomm[data-agency='04'][data-program='432']").length + CntSecAgy; } } else{ if(typeof cntArrAgy[lenAgy] != "string"){ var agencynumber = cntArrAgy[lenAgy].toString(); var CntSecAgy = $(".row-recomm[data-agency='" + agencynumber + "']").length + CntSecAgy; } } } cntTotalRecomm = CntSecAgy; } $('#openrecomm').text(cntTotalRecomm); }; //** Run when status filter equals open 5/28/19 function countOpenAmt(){ var openamount = 0; $(".row-recomm, .row-recomm-suffix").each(function(){ test = $(this).attr('data-amount'); if($(this).attr('data-status') == 'open'){ openamount = openamount + parseInt(test); } }); amt = openamount.toString(); amt = amt.replace(/\B(?=(\d{3})+(?!\d))/g, ","); $('#openamount').text('$' + amt); // 051019 return false; }; function openRecommendation(cntSec){ var countRecomm = $('.row-recomm[data-status="open"]').length; var CntSecAgy = 0; if(cntSec){ var cntArrAgy = cntSec; var lenAgy = cntArrAgy.length; while (lenAgy--){ tempAgyLen = cntArrAgy[lenAgy].length; //alert(cntArrAgy[lenAgy]); if(tempAgyLen == 2){ ; if(cntArrAgy[lenAgy] == 4 ){ var CntSecAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "'][data-program='001']").length + CntSecAgy; } else{ var CntSecAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "']").length + CntSecAgy; } } else if(tempAgyLen == 3){ var CntSecAgy = $(".row-recomm[data-program='" + cntArrAgy[lenAgy] + "']").length + CntSecAgy; //"div .row-recomm[data-agency='04'][data-program='430']"; if(cntArrAgy[lenAgy] == 430){ var CntSecAgy = $(".row-recomm[data-agency='04'][data-program='431']").length + CntSecAgy; var CntSecAgy = $(".row-recomm[data-agency='04'][data-program='432']").length + CntSecAgy; } } else{ if(typeof cntArrAgy[lenAgy] != "string"){ var agencynumber = cntArrAgy[lenAgy].toString(); var CntSecAgy = $(".row-recomm[data-agency='" + agencynumber + "']").length + CntSecAgy; } } } countRecomm = CntSecAgy; } $('#openrecomm').text(countRecomm); // 051019 return false; }; //** Run when status filter equals close 5/28/19 function countClosedAmt(){ var closedamount = 0; $(".row-recomm, .row-recomm-suffix").each(function(){ test = $(this).attr('data-amount'); if($(this).attr('data-status') == 'closed'){ closedamount = closedamount + parseInt(test); } }); amt = closedamount.toString(); amt = amt.replace(/\B(?=(\d{3})+(?!\d))/g, ","); $('#openamount').text('$' + amt); // 051019 //return false; }; function closedRecommendation(cntSec){ //alert('ln 359 ' + cntSec); var CntSecAgy = tempAgyLen = 0; var countRecomm = $('.row-recomm[data-status="closed"]').length; //alert('ln 362 ' + countRecomm); if(cntSec){ var cntArrAgy = cntSec; var lenAgy = cntArrAgy.length; while (lenAgy--){ /* alert("nl 379 " + cntArrAgy[lenAgy]); var CntSecAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "']").length + CntSecAgy; alert('381 ' + CntSecAgy); */ tempAgyLen = cntArrAgy[lenAgy].length; //alert(cntArrAgy[lenAgy]); if(tempAgyLen == 2){ if(cntArrAgy[lenAgy] == 4 ){ var CntSecAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "'][data-program='001']").length + CntSecAgy; } else{ var CntSecAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "']").length + CntSecAgy; } } else if(tempAgyLen == 3){ var CntSecAgy = $(".row-recomm[data-program='" + cntArrAgy[lenAgy] + "']").length + CntSecAgy; //"div .row-recomm[data-agency='04'][data-program='430']"; if(cntArrAgy[lenAgy] == 430){ var CntSecAgy = $(".row-recomm[data-agency='04'][data-program='431']").length + CntSecAgy; var CntSecAgy = $(".row-recomm[data-agency='04'][data-program='432']").length + CntSecAgy; } } else{ if(typeof cntArrAgy[lenAgy] != "string"){ var agencynumber = cntArrAgy[lenAgy].toString(); var CntSecAgy = $(".row-recomm[data-agency='" + agencynumber + "']").length + CntSecAgy; } } } //alert('count 384 is ' + CntSecAgy); countRecomm = CntSecAgy; } //countRecomm = countRecomm - CntSecAgy; $('#openrecomm').text(countRecomm); // 051019 return false; }; function countYears(agency){ //alert("cnt sec " + cntSec); $.each(arrYear, function (index, value){ var cntYear = ".row-recomm[data-year='" + value + "']"; count=0; count = $(cntYear).length; var CntYrsAgy = TempAgyLen = 0; //alert("cntSec - " + cntSec); if(agency){ var cntArrAgy = agency; var lenAgy = cntArrAgy.length; while (lenAgy--){ tempAgyLen = cntArrAgy[lenAgy].length; if(tempAgyLen == 2){ if(cntArrAgy[lenAgy] == 4 ){ var CntYrsAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "'][data-program='001'][data-year='" + value + "']").length + CntYrsAgy; } else{ var CntYrsAgy = $(".row-recomm[data-agency='" + cntArrAgy[lenAgy] + "'][data-year='" + value + "']").length + CntYrsAgy; } } else if(tempAgyLen == 3){ var CntYrsAgy = $(".row-recomm[data-program='" + cntArrAgy[lenAgy] + "'][data-year='" + value + "']").length + CntYrsAgy; if(cntArrAgy[lenAgy] == 420){ var CntYrsAgy = $(".row-recomm[data-agency='15'][data-year='" + value + "']").length + CntYrsAgy; } if(cntArrAgy[lenAgy] == 430){ var CntYrsAgy = $(".row-recomm[data-agency='04'][data-program='431'][data-year='" + value + "']").length + CntYrsAgy; var CntYrsAgy = $(".row-recomm[data-agency='04'][data-program='432'][data-year='" + value + "']").length + CntYrsAgy; //var CntYrsAgy = $(".row-recomm[data-agency='04'][data-year='" + value + "']").length + CntYrsAgy; } } else{ if(typeof cntArrAgy[lenAgy] != "string"){ var agencynumber = cntArrAgy[lenAgy].toString(); var CntYrsAgy = $(".row-recomm[data-agency='" + agencynumber + "'][data-year='" + value + "']").length + CntYrsAgy; } } }//while count = CntYrsAgy; } //eof if agency tmpClass='.chk' + value; //alert(tmpClass + " count - " + count); $(tmpClass).text(count); }); // 051019 return false; }; function countAgency(cntagy, updfilter){ var cntagy, updfilter; cntagy = cntagy || null; updfilter = updfilter || 'yes'; if(updfilter == 'status' || updfilter =='mstatus'){ updfilter = 'yes'; } //console.log(updfilter); //alert(updfilter); var recms = { rAgency : [], rTotal : [] }; //array check for checked agency already passed var arrFltrAgyChkd = []; $.each(arrAgency, function (index, value){ varAgency = "tr.row-recomm[data-agency='" + value + "']"; ////Removed 8/22 so chart matches open recms //varSecAgency = "tr.row-recomm[data-sec-agency='" + value + "']"; count=0; count = $(varAgency).length; //Removed 8/22 so chart matches open recms //countSec = 0; //countSec = $(varSecAgency).length; //count = count + countSec; tmpClass = '.chkAgy' + value; //For filter Agency if(cntagy != null){ var $tmpContinue = 0; $.each(cntagy, function(i, v){ if(v == value) { if(jQuery.inArray(v, arrFltrAgyChkd)!= -1){ //alert('the value - ' + value + '(v ' + v + ')'); $tmpContinue = 0; return; } if(jQuery.inArray(v, arrAgency)){ //and v not already arrFltrAgyChkd.push(v); $tmpContinue = 0; return false; } } else{ $tmpContinue = 1; } }); } if($tmpContinue == 1){ if(value == '03'){ //if Job Corps is selected and not ETA if( $('input#chk370').prop('checked')){ value = '03-370'; } else{ // 072519 don't show agency count } } else{ // 072519 don't show agency count return; } } // 5/31/19 EOF JC if(value == '04'){ //alert('ln 557 tm inside 04'); agyCnt410 = agyCnt420 = agyCnt430 = agyCnt431 = agyCnt432 = agySecCnt410 = agySecCnt430 = agySecCnt431 = agySecCnt432 = 0; //Subract from 04 ESA var410 = "div .row-recomm[data-agency='04'][data-program='410']"; var420 = "div .row-recomm[data-agency='04'][data-program='420']"; var430 = "div .row-recomm[data-agency='04'][data-program='430']"; var431 = "div .row-recomm[data-agency='04'][data-program='431']"; var432 = "div .row-recomm[data-agency='04'][data-program='432']"; varSec410 = "div .row-recomm[data-sec-agency='04'][data-sec-program='410']"; varSec420 = "div .row-recomm[data-sec-agency='04'][data-sec-program='420']"; varSec430 = "div .row-recomm[data-sec-agency='04'][data-sec-program='430']"; varSec431 = "div .row-recomm[data-sec-agency='04'][data-sec-program='431']"; varSec432 = "div .row-recomm[data-sec-agency='04'][data-sec-program='432']"; // agyCnt410 = $(var410).length; agyCnt420 = $(var420).length; agyCnt430 = $(var430).length; agyCnt431 = $(var431).length; agyCnt432 = $(var432).length; agySecCnt410 = $(varSec410).length; agySecCnt420 = $(varSec420).length; agySecCnt430 = $(varSec430).length; agySecCnt431 = $(varSec431).length; agySecCnt432 = $(varSec432).length; arrAgy04 = ['410', '420', '430', '431', '432']; $.each(arrAgy04, function(i, val){ //alert(window['agySecCnt' + val]); }); count = count - agyCnt410 - agyCnt420 - agyCnt430 - agyCnt431 - agyCnt432; UpdChartAgency(value, count); //alert(count); } else if(value == '03'){ var370 = $('input#chk370').prop('checked'); if(var370 && count == 0){ $('input#chk370').prop('checked', false); $('input#chk370').prop('disabled', false); } else if(count > 0 && cntagy != null && $('input#chk03').prop('checked') ){ $('input#chk370').prop('checked', true); $('input#chk370').prop('disabled', true); } else{ //alert('no 370 value 03 is not checked'); } //Fix ETA zero when ch if($tmpContinue == 1){ // 072519 don't show agency count } else{ // 072519 don't show agency count UpdChartAgency(value, count); } //Job Corps varAgency370 = "div .row-recomm[data-agency='03'][data-program='370']"; count370 = $(varAgency370).length; // 072519 don't show agency count } else if(value == '03-370'){ //alert('only 370'); varAgency370 = "div .row-recomm[data-agency='03'][data-program='370']"; count370 = $(varAgency370).length; // 072519 don't show agency count varAgency03 = "div .row-recomm[data-agency='03']"; count03 = $(varAgency03).length; UpdChartAgency('3-370', count03); } else if(value == '13'){ // 07/31/19 TEMP Fix for 22-12-002-13-001 b/c has both open/closed suffix //count = count - 1; UpdChartAgency(value, count); } else if(value == '14'){ //varAgency16 = "div .row-recomm[data-agency='16']"; varAgency410 = "div .row-recomm[data-agency='04'][data-program='410']"; count410 = $(varAgency410).length; count = count + count410; UpdChartAgency(value, count); } else if(value == '16'){ //varAgency16 = "div .row-recomm[data-agency='16']"; varAgency421 = "div .row-recomm[data-agency='04'][data-program='421']"; count421 = $(varAgency421).length; count = count + count421; UpdChartAgency(value, count); } //for 410, 420, 43[012] else if(value.length == 3 ){ varAgency = "div .row-recomm[data-agency='04'][data-program='" + value + "']"; //Removed 8/22 so chart matches open recms //varSecAgency = "div .row-recomm[data-sec-agency='04'][data-sec-program='" + value + "']"; count = $(varAgency).length; tmpClass = '.chkAgy' + value; if(value ==430){ //alert(varAgency); varAgency431 = "div .row-recomm[data-agency='04'][data-program='431']"; varAgency432 = "div .row-recomm[data-agency='04'][data-program='432']"; tmp431 = $(varAgency431).length; tmp432 = $(varAgency432).length; //count = count + tmp431 + tmp432 + tmpSec431 + tmpSec432; count = count + tmp431 + tmp432; } //7-18-19 // 072519 don't show agency count UpdChartAgency(value, count); } else{ //7-18-19 // 072519 don't show agency count UpdChartAgency(value, count); }; /* new for updating barchart */ function UpdChartAgency(tmpId, tmpCount){ //alert('updchart') var objA = $.grep(objAgency, function(objA){return objA.id == tmpId;})[0]; if(tmpId == '3-370'){ recms.rAgency.push('ETA-JC'); recms.rTotal.push(tmpCount); } if(!$.isEmptyObject(objA) && tmpCount > 0){ //alert(objA.name); //alert('upd ' + objA.name + ' ' + tmpCount); recms.rAgency.push(objA.name); recms.rTotal.push(tmpCount); } // 051019 return false; } }); //eof each barChart.data.labels = recms.rAgency; barChart.data.datasets[0].data = recms.rTotal; barChart.update(); // 051019 return false; }; //eof countAgency function countStatus(cntSec){ var countOpen = $('tr.row-recomm[data-status="open"]').length; var countClose = $('tr.row-recomm[data-status="closed"]').length; var CntSecAgyOpen = CntSecAgyClose = 0; if(cntSec){ var cntArrAgy = cntSec; var lenAgy = cntArrAgy.length; while (lenAgy--){ tempAgyLen = cntArrAgy[lenAgy].length; if(tempAgyLen == 2){ if(cntArrAgy[lenAgy] == 4 ){ var CntSecAgyOpen = $(".row-recomm[data-status='open'][data-agency='" + cntArrAgy[lenAgy] + "'][data-program='001']").length + CntSecAgyOpen; var CntSecAgyClose = $(".row-recomm[data-status='closed'][data-agency='" + cntArrAgy[lenAgy] + "'][data-program='001']").length + CntSecAgyClose; } else{ var CntSecAgyOpen = $(".row-recomm[data-status='open'][data-agency='" + cntArrAgy[lenAgy] + "']").length + CntSecAgyOpen; var CntSecAgyClose = $(".row-recomm[data-status='closed'][data-agency='" + cntArrAgy[lenAgy] + "']").length + CntSecAgyClose; } } else if(tempAgyLen == 3){ var CntSecAgyOpen = $(".row-recomm[data-status='open'][data-program='" + cntArrAgy[lenAgy] + "']").length + CntSecAgyOpen; var CntSecAgyClose = $(".row-recomm[data-status='closed'][data-program='" + cntArrAgy[lenAgy] + "']").length + CntSecAgyClose; if(cntArrAgy[lenAgy] == 420){ var CntSecAgyOpen = $(".row-recomm[data-status='open'][data-agency='15']").length + CntSecAgyOpen; var CntSecAgyClose = $(".row-recomm[data-status='closed'][data-agency='15']").length + CntSecAgyClose; } if(cntArrAgy[lenAgy] == 430){ var CntSecAgyOpen = $(".row-recomm[data-status='open'][data-agency='04'][data-program='431']").length + CntSecAgyOpen; var CntSecAgyOpen = $(".row-recomm[data-status='open'][data-agency='04'][data-program='432']").length + CntSecAgyOpen; var CntSecAgyClose = $(".row-recomm[data-status='closed'][data-agency='04'][data-program='431']").length + CntSecAgyClose; var CntSecAgyClose = $(".row-recomm[data-status='closed'][data-agency='04'][data-program='432']").length + CntSecAgyClose; } } else{ if(typeof cntArrAgy[lenAgy] != "string"){ var agencynumber = cntArrAgy[lenAgy].toString(); var CntSecAgyOpen = $(".row-recomm[data-status='open'][data-agency='" + agencynumber + "']").length + CntSecAgyOpen; var CntSecAgyClose = $(".row-recomm[data-status='closed'][data-agency='" + agencynumber + "']").length + CntSecAgyClose; } } } countOpen = CntSecAgyOpen; countClose = CntSecAgyClose; } if(countOpen < 0){ countOpen = 0; } if(countClose < 0){ countClose = 0; } $('.chkopen').text(countOpen); $('.chkclose').text(countClose); // 051019 return false; }; function countSuffix(){ var cntExtrSuffix = ".row-recomm-suffix[data-suffix-rmv='1']"; count=0; count = $(cntExtrSuffix).length; // 051019 return false; }; function runEveryTime(agy, shwtotal, updfilter, php){ var agy; if(agy == 'all'){ agy = null; } var shwtotal; if(shwtotal == 'showtotal'){ $('#status').text('All'); totalRecommendation(agy); totalAmount(); } else if(shwtotal == 'open'){ $('#status').text(shwtotal); //alert(agy); openRecommendation(agy); countOpenAmt(); } else{ $('#status').text(shwtotal); //alert("ln 782 agy " + agy); closedRecommendation(agy); countClosedAmt(); } //filters countYears(agy); countStatus(agy); countAgency(agy, updfilter); //countSecAgency(); countSuffix(); //$('#openRecmBoxChart').fadeIn(); $('#openRecmBoxChart').fadeTo("slow", 1); $('#data-results').fadeTo("slow", 1); }; //Start of Search Filter - search / clear $('#search').click(function(){ var fltrStatus = null; var fltrAgency = null; var fltrYear = null; var fltrSearch = document.getElementById("rpt-number").value; //set all filters to all $("#chkStatus input").prop('checked', false); $("#chkAgency input").prop('checked', false); $('#chkStatus input:checkbox[value="all"]').prop('checked', true); //$('#chkStatus input:checkbox[value="all"]').prop('disabled', true); $('#chkAgency input:checkbox[value="all"]').prop('checked', true); $('#chkAgency input:checkbox[value="all"]').prop('disabled', true); $("#chkYear input").prop('checked', false); $('#chkYear input:checkbox[value="all"]').prop('checked', true); //$('#chkYear input:checkbox[value="all"]').prop('disabled', true); var statusBox = dashStatusView(); // Test New 051019 $('#openRecmBoxChart').fadeTo("slow", 0.4); $('#data-results').fadeTo("slow", 0.4); //reset expand collapse expandCollapse('expandAll'); //alert('search filter 4 of 6'); $("#data-results").load("recommendation_filter_080119-tm-www.php", { filterYear: fltrYear, filterAgency: fltrAgency, filterStatus: fltrStatus, filterSearch: fltrSearch }, function(data, status){ runEveryTime(fltrAgency, statusBox, 'no', 4); }); // 011019 return false; }); $('#clear').click(function(){ $('#rpt-number').val(''); //reset status to open $("#chkStatus input").prop('checked', false); $('#chkStatus input:checkbox[value="open"]').prop('checked', true); //$('#chkStatus input:checkbox[value="all"]').prop('enabled', true); var fltrStatus = checkedFilters('#chkStatus') || null; var fltrAgency = checkedFilters('#chkAgency') || null; var fltrYear = checkedFilters('#chkYear') || null; var fltrSearch = null; var statusBox = dashStatusView(); //alert (statusBox); expandCollapse('expandAll'); // Test New 051019 $('#openRecmBoxChart').fadeTo("slow", 0.4); $('#data-results').fadeTo("slow", 0.4); //alert('clear filter 5 of 6'); $("#data-results").load("recommendation_filter_080119-tm-www.php", { filterYear: fltrYear, filterAgency: fltrAgency, filterStatus: fltrStatus, filterSearch: fltrSearch }, function(data, status){ runEveryTime(fltrAgency, statusBox, 'no', 5); }); // 011019 return false; }); $('#mFilterTitle h3.reset').click(function(){ $('#rpt-number').val(''); var fltrStatus = null; var fltrAgency = null; var fltrYear = null; //071919 //update checkbox //alert('reset'); $("#mchkStatus input").prop('checked', false); $('#mchkStatus input:checkbox[value="open"]').prop('checked', true); $("#mchkAgency input").prop('checked', false); $('#mchkAgency input:checkbox[value="all"]').prop('checked', true); //$('#mchkAgency input:checkbox[value="all"]').prop('disabled', true); $("#mchkYear input").prop('checked', false); $('#mchkYear input:checkbox[value="all"]').prop('checked', true); //$('#mchkYear input:checkbox[value="all"]').prop('disabled', true); var statusBox = dashStatusView(); //alert (statusBox); // Test New 051019 $('#openRecmBoxChart').fadeTo("slow", 0.4); $('#data-results').fadeTo("slow", 0.4); //reset expand collapse expandCollapse('expandAll'); //alert('search filter new 6 of 6'); $("#data-results").load("recommendation_filter_080119-tm-www.php", { filterYear: fltrYear, filterAgency: fltrAgency, filterStatus: fltrStatus, filterSearch: null }, function(data, status){ runEveryTime(fltrAgency, statusBox, 'no', 6); }); }); //EOF Search Filter // GET Status Fitler for Dashboard Boxes // 5/31/19 function dashStatusView(e){ var e; var inptvalue = 'input'; if(e == 'm'){ var inptvalue = '#mchkStatus input'; } //if( $('input#open').prop('checked') ){ if( $(inptvalue + '#open').prop('checked') ){ //alert('not all only open'); $(inptvalue + '#all').removeAttr('disabled'); statusBox = 'open'; } else if( $(inptvalue + '#close').prop('checked') ){ //alert('not all only closed'); $(inptvalue + '#all').removeAttr('disabled'); statusBox = 'close'; } else{ //alert('All'); $(inptvalue + '#all').prop('checked', true); //$(inptvalue + '#all').prop('disabled', true); statusBox = 'showtotal'; } return statusBox; }; // EOF Status Filter for Dashboard Boxes }); //EOF Ready ///////////////////////////// // EOF READY /////// ///////////////////////////// /////****************************************************** function filterMenu(){ $('div#mFilterTitle> div').toggle(); $('div#mFilterGroup> div').hide(); // 011019 return false; }; //////////////////////////////////////// // TESTING Functions Outside On Ready // 5/10/19 //////////////////////////////////////// ///////////////////// /// new 5/8/19 $('.allReports').keydown(function(event){ //do something on keydown if(event.keyCode==13){ //enter key was pressed //alert('works'); $('.allReports').click(); } }); $('.reset').keydown(function(event){ //keydow if(event.keyCode==13){ $("#resetStatus").click(); } }); /// eof ///////////////////// // 5/2/19 Expand / Collapse all $('.allReports').click(function(){ $strDivClass = $(this).attr('class'); $strDivId = $(this).attr('id'); if($strDivId == 'expandAll'){ $strReplaceId = 'collapseAll'; //$('.recm-container').show(); } else{ //$('.recm-container').hide(); $strReplaceId = 'expandAll'; } expandCollapse($strReplaceId); // 051019 return false; }); function expandCollapse(e){ if(e == 'expandAll'){ $('.recm-container').hide(); //var drpDownImg = (openclose == 'upImage') ? '/homepage/img/dropdown-b-up.png' : '/homepage/img/dropdown-b.png'; $('img#imgAllRpts').attr('src', '/homepage/img/dropdown-b_black.png'); $('img.drpdown').attr('src', '/homepage/img/dropdown-b_black.png'); $('div.row-title').removeClass('rptTitleGrey'); } else{ $('.recm-container').show(); $('div.row-title').addClass('rptTitleGrey'); $('img#imgAllRpts').attr('src', '/homepage/img/dropdown-b-up.png'); $('img.drpdown').attr('src', '/homepage/img/dropdown-b-up.png'); } $('div.allReports').attr('id', e); // 051019 return false; } // EOF Expand / Collapse All