MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/demo.imensosoftware.com/matrix/js/report.js
var app= {};

// app.location = window.location.origin+"/matrix/admin/";
app.location = window.location.origin+"/matrix/admin/";
if(window.location.hostname=="sh018.hostgator.tempwebhost.net")
{
    app.location = "http://sh018.hostgator.tempwebhost.net/~a16102wt/matrix/admin/";
}

app.filter = { start_date:"", end_date:"" };

$(document).ready(function(){
	app.getReport();
    

    var curr = new Date();
    // var firstday = new Date(curr.setDate(curr.getDate() - curr.getDay()+6));
    var firstday = new Date();
    var lastday = new Date(curr.setDate(curr.getDate() - curr.getDay()));

    app.filter.start_date = firstday;
    app.filter.end_date = lastday;

    $('#start_date').datepicker({
        uiLibrary: 'bootstrap4',
        format: 'yyyy-mm-dd',
        autoclose: true,
        value: formatDate(firstday),
        maxDate: formatDate(firstday),     
    });
    $('#end_date').datepicker({
        uiLibrary: 'bootstrap4',
        format: 'yyyy-mm-dd',
        autoclose: true,
        value: formatDate(lastday),
        maxDate: function () {
            return $('#start_date').val();
        }
    });

    $('#end_date').change(function() {
        var end_date = $(this).val(); 
        var start_date = $("#start_date").val(); 
        if(start_date!="" && end_date!="")
        {
            app.filter.start_date = start_date;
            app.filter.end_date = end_date;
            app.getReport();
        }
        else
        {
            alert("Please select date");
        }
    });
});

function formatDate(date) {
    var year = date.getFullYear().toString();
    var month = (date.getMonth() + 101).toString().substring(1);
    var day = (date.getDate() + 100).toString().substring(1);
    return year + "-" + month + "-" + day;
}

app.getReport = function ()
{
    console.log(app.filter);
    $.ajax({
            url : app.location+"report_code.php",
            type: "POST", 
            data:{filter:app.filter},
            dataType:"json",
            success : function(data){

                for (var i = 0; i < data.dataAshwin.length; i++) {
               data.dataAshwin[i]['x'] = new Date(data.dataAshwin[i]['label']);     
            }
            for (var i = 0; i < data.dataVarun.length; i++) {
               data.dataVarun[i]['x'] = new Date(data.dataVarun[i]['label']);
            }
            for (var i = 0; i < data.dataSachin.length; i++) {
               data.dataSachin[i]['x'] = new Date(data.dataSachin[i]['label']);
            }
            for (var i = 0; i < data.dataMansi.length; i++) {
               data.dataMansi[i]['x'] = new Date(data.dataMansi[i]['label']);
            }
            for (var i = 0; i < data.dataDipanjali.length; i++) {
               data.dataDipanjali[i]['x'] = new Date(data.dataDipanjali[i]['label']);
            }
             for (var i = 0; i < data.dataKiranteja.length; i++) {
               data.dataKiranteja[i]['x'] = new Date(data.dataKiranteja[i]['label']);
            }
             for (var i = 0; i < data.dataDeeksha.length; i++) {
               data.dataDeeksha[i]['x'] = new Date(data.dataDeeksha[i]['label']);
            }

                console.log(data);
                app.reportChart(data);
            },
            error : function(data) {

            }
        });
}

app.reportChart = function(data)
{
    
    var chart = new CanvasJS.Chart("chartContainer", {
        animationEnabled: true, 
        title: {
            text: ""
        },
        legend: {
            verticalAlign: "top",
            horizontalAlign: "center",
            dockInsidePlotArea: false,
            fontSize: 14,
        },
        axisX:{
            valueFormatString: "DD MMM YYYY",
            /*crosshair: {
                enabled: true,
                snapToDataPoint: true
            },*/
            interval:2,
            intervalType: "day",
        },
        axisY: {
            title: "",
            titleFontColor: "#4F81BC",
            suffix: "",
            // valueFormatString: "###",
            /*crosshair: {
                enabled: true
            },*/
        },
        data: 
        [
            {
                toolTipContent: "{label}<br/> <strong>{name}</strong> : <strong>{y}</strong>",
                indexLabelFontColor: "darkSlateGray",
                name: "Sachin",
                type: "line",
                yValueFormatString: "###",
                showInLegend: true,
                legendMarkerType: "square",
                color: "rgba(0,69,238,.7)",
                dataPoints: data.dataSachin,
            },
            {
                toolTipContent: "{label}<br/> <strong>{name}</strong> : <strong>{y}</strong>",
                indexLabelFontColor: "darkSlateGray",
                name: "Aswin",
                type: "line",
                yValueFormatString: "###",
                showInLegend: true,
                legendMarkerType: "square",
                color: "rgba(112,173,71,.7)",
                dataPoints: data.dataAshwin
            },
            {
                toolTipContent: "{label}<br/> <strong>{name}</strong> : <strong>{y}</strong>", 
                indexLabelFontColor: "darkSlateGray",
                name: "Deeksha",
                type: "line",
                yValueFormatString: "###",
                showInLegend: true,
                legendMarkerType: "square",
                color: "rgba(255,192,37,.7)",
                dataPoints: data.dataDeeksha
            },
            {
                toolTipContent: "{label}<br/> <strong>{name}</strong> : <strong>{y}</strong>", 
                indexLabelFontColor: "darkSlateGray",
                name: "Varun",
                type: "line",
                yValueFormatString: "###",
                showInLegend: true,
                legendMarkerType: "square",
                color: "rgba(87, 87, 87)",
                dataPoints: data.dataVarun
            },
            {
                toolTipContent: "{label}<br/> <strong>{name}</strong> : <strong>{y}</strong>",
                indexLabelFontColor: "darkSlateGray",
                name: "Dipanjali",
                type: "line",
                yValueFormatString: "###",
                showInLegend: true,
                legendMarkerType: "square",
                color: "rgba(87, 87, 87)",
                xValueType: "{y}",
                dataPoints: data.dataDipanjali
            },
            {
                toolTipContent: "{label}<br/> <strong>{name}</strong> : <strong>{y}</strong>",
                indexLabelFontColor: "darkSlateGray",
                name: "Kiranteja",
                type: "line",
                yValueFormatString: "###",
                showInLegend: true,
                legendMarkerType: "square",
                color: "rgba(87, 87, 87)",
                xValueType: "{y}",
                dataPoints: data.dataKiranteja
            },
            {
                toolTipContent: "{label}<br/> <strong>{name}</strong> : <strong>{y}</strong>",
                indexLabelFontColor: "darkSlateGray",
                name: "Mansi",
                type: "line",
                yValueFormatString: "###",
                showInLegend: true,
                legendMarkerType: "square",
                color: "rgba(87, 87, 87)",
                xValueType: "{y}",
                dataPoints: data.dataMansi
            }
        ]
    });
    chart.render();
}



app.getData = function(){
    if ($('ul.list-group > li').hasClass('done')) {
        if(length>0)
        {
            $('ul.list-group > li.done:first>a').trigger('click');
            $('ul.list-group > li.done:first').addClass('active');
        }
    }
}