crmApp.controller("CustomZoneController", CustomZoneController);

function CustomZoneController($scope, $window, $compile, GeneralSI, DTColumnBuilder, DTOptionsBuilder, $q, $filter) {
    vm = this;

    $scope.dtInstanceCustomZone = {};
    vm.IsPageLoad = true;

    $scope.generateCustomZone = function (typeID, viewID, zoneName, zonID, zoneIndex) {
        $scope.TypeID = typeID;
        $scope.ViewID = viewID;

        if ($scope.TypeID == 6)
            $scope.isHCLEmailBlast = true;
        else
            $scope.isHCLEmailBlast = false;

        $scope.ZoneName = zoneName;
        vm.ZoneID = zonID;
        vm.ZoneIndex = zoneIndex;
        console.log('vm.ZoneIndex : ' + vm.ZoneIndex);

        vm.IsPageLoad = false;
        initTable().then(function () {
            callServer()
        });
    };

    function initTable() {
        var deferred = $q.defer();
        $scope.dtColumnsCustomZone = [];

        $scope.dtOptionsCustomZone = DTOptionsBuilder.newOptions()
           .withOption('ajax', ajaxCallback)
           .withDataProp('data')
           .withOption('processing', true)
           .withOption('searching', true)
           .withOption('serverSide', true)
           .withOption('lengthChange', false)
           .withOption('autoWidth', false)
           .withPaginationType('full_numbers')
           .withDisplayLength(5)
           .withOption('headerCallback', function (header) {
               if (!vm.headerCompiled) {
                   // Use this headerCompiled field to only compile header once
                   vm.headerCompiled = true;
                   $compile(angular.element(header).contents())($scope);
               }
           });
        // .withOption('deferLoading', true);

        deferred.resolve();
        return deferred.promise;
    };

    var ajaxCallback = function (data, callback, settings) {
        if (!vm.IsPageLoad) {
            data.ViewID = $scope.ViewID;
            data.ViewType = $scope.TypeID;
            GeneralSI.getDashboardTableResults(data).then(function (r) {
                if (r.status == 200 && (r.data)) {
                    callback(r.data);
                }
            });
        }
    }

    function callServer() {
        var deferred = $q.defer();
        var model = {
            ViewID: $scope.ViewID,
            TableType: $scope.TypeID
        };
        console.log('model', model);

        GeneralSI.getDashboardDynamicCol(model).then(function (r) {
            if (r.status == 200) {
                $scope.dtColumnsCustomZone = [];
                var dtColumn = null;
                angular.forEach(r.data, function (item, i) {

                    if (item.FieldMapping == 'NoRujukanCukai') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type, row) {
                            var retValue = '';
                            if (data == null) {
                                retValue = '-';
                            } else if (row.TPID == null || row.TPID == undefined) {
                                retValue = data;
                            } else {
                                retValue =  '<a href="/TaxPayer/Profile/Detail/' + (row.ID == undefined ? row.TPID : row.ID) + '" target="_blank">' + data + '</a>'
                            }
                            return retValue;
                        }).withOption('defaultContent', '-');
                    }
                    else if (item.FieldMapping == 'CaseStatusLevel1ID') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).notSortable().withTitle(item.DisplayName).renderWith(function (data, type) {
                            var input = data == '2' ? '<i class="case fa fa-exclamation-circle" style="color:red;" title="Belum Selesai"></i>' : '';
                            return input;
                        }).withOption('width', '2%');
                    }
                    else if (item.FieldMapping == 'TPNoCukai') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type, row) {
                            var retValue = '';
                            if (data == null) {
                                retValue = '-';
                            } else if (row.TPID == null || row.TPID == undefined) {
                                retValue = data;
                            }
                            else {
                                retValue = '<a href="/TaxPayer/Profile/Detail/' + row.TPID + '" target="_blank">' + data + '</a>'
                            }
                            return retValue;
                        }).withOption('defaultContent', '-');
                    }
                    else if (item.FieldMapping == 'CaseRefNo') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type, row) {

                            if (data == null) {
                                retValue = '-';
                            } else if (row.CaseID == null) {
                                retValue = data;
                            }
                            else {
                                return '<a href="/Case/Profile/Detail/' + row.CaseID + '" target="_blank">' + data + '</a>'
                            }
                        }).withOption('defaultContent', '-');
                    }
                    else if (item.FieldMapping == 'ActStatusID') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).notSortable().withTitle(item.DisplayName).renderWith(function (data, type) {
                            var input = data == '261' ? '<i class="case fa fa-exclamation-circle" style="color:red;" title="Belum Selesai"></i>' : '';
                            return input;
                        }).withOption('width', '2%');
                    }
                    else if (item.FieldMapping == 'ActRefNo') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type, row) {
                            if (data == null) {
                                retValue = '-';
                            } else if (row.ID == null) {
                                retValue = data;
                            }
                            else {
                                return '<a href="/Activity/Profile/Detail/' + row.ID + '" target="_blank">' + data + '</a>'
                            }
                        }).withOption('defaultContent', '-');
                    }
                        // Outbound
                    else if (item.FieldMapping == "NamaPembayarCukai" || item.FieldMapping == "TAX_PAYER_NAME1" || item.FieldMapping == "Name") {
                        if ($scope.isHCLEmailBlast) {
                            dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type, row) {
                                return '<a target="_blank" href="/Outbound/HCLEmailBlastProfile/Detail/' + row.JenisKempenID + '/' + row.EmailDataID + '">' + data + '</a>'
                            }).withOption('defaultContent', '-').withOption('width', '200px');
                        }
                        else {
                            dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type, row) {
                                return '<a target="_blank" href="/Outbound/Profile/Detail/' + row.JenisKempenID + '/' + row.DataID + '">' + data + '</a>'
                            }).withOption('defaultContent', '-').withOption('width', '200px');
                        }
                    }

                    else if (item.FieldType == 'Currency') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).withClass('text-right').renderWith(function (data, type) {
                            return $filter('number')(data, 2);
                        }).withOption('defaultContent', '-');
                    }
                    else if (item.FieldMapping == "StatusID") {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(renderNullAsDash).withOption('width', '100px').withOption('defaultContent', '-');
                    }
                    else if (item.FieldMapping == "HasError") {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle("").notSortable().renderWith(function (data, type, row) {
                            var statusID;
                            if ($scope.isHCLEmailBlast)
                                statusID = row["EmailBlastStatusID"];
                            else
                                statusID = row["StatusID"];

                            var input = data && (statusID == vm.constStatusNew || statusID == vm.constStatusVerified) ? '<i class="case fa fa-exclamation-circle" style="color:red;" ></i >' : '';
                            return input;
                        });
                    }
                    else if (item.FieldMapping == "NoRujukanCukai") {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type, row) {
                            return $scope.isHCLEmailBlast ? (data ? row["JenisFailCukai"] + ' ' + data : '-') : data;
                        }).withOption('defaultContent', '-').withOption('width', '150px');
                    } else if (item.FieldMapping == 'PromiseToPayDate') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type) {
                            return $filter('date')(data, $scope.DateFormat);
                        }).withOption('defaultContent', '-');
                    }
                    else if (item.FieldMapping == 'PromisedToPay') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type) {
                            return $filter('date')(data, $scope.DateTFormat);
                        }).withOption('defaultContent', '-');
                    }
                    else
                        if (item.FieldType == 'Date' || item.FieldType == 'Date(SystemGenerated)') {
                            dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type) {
                                return $filter('date')(data, $scope.DateTimeFormat);
                            }).withOption('defaultContent', '-');
                        }
                        else {
                            dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).withOption('defaultContent', '-');
                        }
                    $scope.dtColumnsCustomZone.push(dtColumn);
                });
                deferred.resolve();
            }
        });
        return deferred.promise;
    }
    function loadDynamicColumns() {
        var model = {
            ViewID: $scope.ViewID,
            TableType: $scope.TypeID
        };

        GeneralSI.getDashboardDynamicCol(model).then(function (r) {
            if (r.status == 200) {
                vm.dtColumnsCustomZone = [];
                var dtColumn = null;
                angular.forEach(r.data, function (item, i) {

                    if (item.FieldMapping == 'NoRujukanCukai') {
                        dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type, row) {
                            return '<a href="/TaxPayer/Profile/Detail/' + row.ID + '" target="_blank">' + data + '</a>'
                        }).withOption('defaultContent', '-');
                    }
                    else
                        if (item.FieldType == 'Date') {
                            dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).renderWith(function (data, type) {
                                return $filter('date')(data, $scope.DateTimeFormat);
                            }).withOption('defaultContent', '-');
                        }
                        else {
                            dtColumn = DTColumnBuilder.newColumn(item.FieldMapping).withTitle(item.DisplayName).withOption('defaultContent', '-');
                        }
                    vm.dtColumnsCustomZone.push(dtColumn);
                });

                // vm.dtInstanceCustomZone.reloadData();
            }
        });

    }

}

crmApp.controller('StackedBarCtrlTest', function ($scope, $window, $q, $filter, GeneralSI) {
    vm = this;
    $scope.init = function () {
        $scope.labels = ["January", "February", "March", "April", "May", "June", "July"];
        $scope.series = ['Series A', 'Series B'];
        $scope.data = [
          [65, 59, 80, 81, 56, 55, 40],
          [28, 48, 40, 19, 86, 27, 90]
        ];
        $scope.onClick = function (points, evt) {
            console.log(points, evt);
        };

        $scope.colours = [
        {
            backgroundColor: '#b71c1c',
            borderColor: '#b71c1c',
            hoverBackgroundColor: '#b71c1c',
            hoverBorderColor: '#b71c1c'
        },
        {
            backgroundColor: '#e0e5e0',
            borderColor: '#e0e5e0',
            hoverBackgroundColor: '#e0e5e0',
            hoverBorderColor: '#e0e5e0'
        },
        {
            backgroundColor: '#65C6BB',
            borderColor: '#65C6BB',
            hoverBackgroundColor: '#65C6BB',
            hoverBorderColor: '#65C6BB'
        },
        {
            backgroundColor: '#A2DED0',
            borderColor: '#A2DED0',
            hoverBackgroundColor: '#A2DED0',
            hoverBorderColor: '#A2DED0'
        }
        ];
        $scope.options = {
            responsive: true,
            maintainAspectRatio: false,
            scales: {
                xAxes: [{
                    stacked: true,
                    gridLines: {
                        display: false
                    }
                }],
                yAxes: [{
                    stacked: true,
                    ticks: {
                        stepSize: 1
                    }
                }]
            }
        };
    }
});

crmApp.controller('PieChartCtrlTest', function ($scope, $window, $q, $filter, GeneralSI) {
    vm = this;
    $scope.init = function () {

        $scope.chart = new CanvasJS.Chart("chartContainer", {
            //title: {
            //    text: "Legend in a Doughnut Chart"
            //},
            data: [
            {
                type: "pie",
                radius: "90%",
                indexLabelOrientation: "horizontal",
                indexLabelPlacement: "outside",
                indexLabel: "{name} - {y}%",
                showInLegend: false, legendText: "Apples",
                dataPoints: [
                { x: 1, y: 230, label: "January", name: "jan" },
                { x: 2, y: 245, label: "February", name: "feb" },
                { x: 3, y: 345, label: "March", name: "mar" },
                { x: 4, y: 367, label: "April", name: "apr" },
                { x: 5, y: 453, label: "May", name: "may" },
                { x: 6, y: 256, label: "June", name: "jun" },
                { x: 7, y: 478, label: "July", name: "jul" },
                { x: 8, y: 543, label: "August", name: "aug" },
                { x: 9, y: 234, label: "September", name: "sep" },
                { x: 10, y: 456, label: "October", name: "oct" }
                ]
            }
            ]
        });

        $scope.chart.render(); //render the chart for the first time

        $scope.changeChartType = function (chartType) {
            $scope.chart.options.data[0].type = chartType;
            $scope.chart.render(); //re-render the chart to display the new layout
        }

    }
});

crmApp.controller('PieChartCtrlTest2', function ($scope, $window, $q, $filter, $timeout, GeneralSI) {
    vm = this;

    $scope.$on("$includeContentLoaded", function (event, target) {
        isChartContainerLoaded = true;
        updateChart();
    });

    $scope.init = function (chartid, chartType, axisXTitle) {
        $scope.ChartID = chartid;
        $scope.ChartType = chartType.toLowerCase();
        $scope.ShowInLegend = false;
        //$scope.AxisXTitle = axisXTitle?;
        //$scope.AxisYTitle = axisYTitle?;

        if ($scope.ChartType == 'pie') {
            $scope.ShowInLegend = true;
        }
        else if ($scope.ChartType == 'bar') {
            $scope.ChartType = 'column';
        }

        $scope.chartOptions =
            {
                //title: {
                //    text: "Legend in a Doughnut Chart"
                //},
                animationEnabled: true,
                animationDuration: 1500,
                axisX: {
                    title: 'Bulan 2019',
                    titleFontSize: 14,
                    titleFontWeight: "bold",
                    labelFontSize: 14,
                    tickLength: 1,
                    gridThickness: 0,
                    labelAngle: 45
                },
                axisY: {
                    title: 'Jumlah Apple',
                    titleFontSize: 14,
                    titleFontWeight: "bold",
                    labelFontSize: 12,
                    gridThickness: 0.3,
                    labelAngle: 45
                },
                data: [
                {
                    type: $scope.ChartType,
                    radius: "90%",
                    indexLabelOrientation: "horizontal",
                    indexLabelPlacement: "outside",
                    toolTipContent: "{label}<br/><strong>{y}</strong>",
                    indexLabel: "{y}",
                    dataPointWidth: 1,
                    showInLegend: $scope.ShowInLegend,
                    dataPoints: [
                        { x: 1, y: 230, label: "January", name: "jan" },
                        { x: 2, y: 245, label: "February", name: "feb" },
                        { x: 3, y: 345, label: "March", name: "mar" },
                        { x: 4, y: 367, label: "April", name: "apr" },
                        { x: 5, y: 453, label: "May", name: "may" },
                        { x: 6, y: 256, label: "June", name: "jun" },
                        { x: 7, y: 478, label: "July", name: "jul" },
                        { x: 8, y: 543, label: "August", name: "aug" },
                        { x: 9, y: 234, label: "September", name: "sep" },
                        { x: 10, y: 456, label: "October", name: "oct" }
                    ]
                }
                ]
            };


        //$scope.chart.render(); //render the chart for the first time

        $scope.changeChartType = function (chartType) {
            $scope.chart.options.data[0].type = chartType;
            $scope.chart.render(); //re-render the chart to display the new layout
        }

    }

    function updateChart() {
        //if (isChartContainerLoaded && wfReqSummaryData) {
        //    var totalReq = 0;
        //    var dataIndex = 0;

        //    angular.forEach(wfReqSummaryData.WFItems, function (v, k) {
        //        dataIndex = v.WFAssigneeRole == "Checker" ? 1 : (v.WFAssigneeRole == "Approver" ? 2 : 0);

        //        angular.forEach(v.Details, function (v2, k2) {
        //            totalReq += v2.Total;
        //            $scope.chartOptions.data[dataIndex].dataPoints.push({
        //                y: v2.Total > 0 ? v2.Total : null,
        //                label: v2.Label
        //            });

        //        });
        //    });

        //    $scope.showChart = totalReq > 0;

        //    if ($scope.showChart) {
        drawChart();
        //    }
        //}
    }

    function drawChart() {
        var divChart = document.querySelector('#' + $scope.ChartID);

        if (divChart) {
            $scope.chart = new CanvasJS.Chart($scope.ChartID, $scope.chartOptions);
            $scope.chart.render();
        }
        else {
            $timeout(drawChart, 200);
        }
    }

});

crmApp.controller('ChartController', function ($scope, $window, $q, $filter, $timeout, GeneralSI) {
    vm = this;

    $scope.$on("$includeContentLoaded", function (event, target) {
        isChartContainerLoaded = true;
        updateChart();
    });

    $scope.init = function (chartid, typeID, viewID, zoneName, zonID, zoneIndex,chartType, axisXTitle, axisYTitle, axisXFieldID, axisYFieldID) {

        $scope.ShowLoading = true;
        $scope.ChartID = chartid + zonID;
        $scope.ChartType = chartType ? chartType.toLowerCase() : 'pie';
        $scope.ShowInLegend = false;
        $scope.TypeID = typeID;
        $scope.ViewID = viewID;
        $scope.ZoneName = zoneName;
        $scope.DashboardZonID = zonID;
        $scope.AxisXTitle = axisXTitle;
        $scope.AxisYTitle = axisYTitle;
        $scope.AxisXFieldMappingID = axisXFieldID;
        $scope.AxisYFieldMappingID = axisYFieldID;
        recursionCount = 0;
        $scope.ChartData = null;
        if ($scope.ChartType == 'pie') {
            $scope.ShowInLegend = true;
            $scope.IndexLabel = "{name} - {y}";
            $scope.IndexOrientation = "horizontal"
        }
        else if ($scope.ChartType == 'bar') {
            $scope.ChartType = 'column';
            $scope.IndexLabel = "{y}";
            $scope.IndexOrientation = "horizontal";
        }

        $scope.chartOptions =
                {
                    //title: {
                    //    text: "Legend in a Doughnut Chart"
                    //},
                    animationEnabled: true,
                    animationDuration: 1200,
                    axisX: {
                        title: $scope.AxisXTitle,
                        titleFontSize: 14,
                        titleFontWeight: "bold",
                        labelFontSize: 14,
                        tickLength: 1,
                        gridThickness: 0,
                        labelAngle: 45//,
                        //interval: 1 // To show all x axis label, if not set, system will auto hide some to avoid overlapping
                    },
                    axisY: {
                        title: $scope.AxisYTitle,
                        titleFontSize: 14,
                        titleFontWeight: "bold",
                        labelFontSize: 12,
                        gridThickness: 0.3,
                        labelAngle: 45
                    },
                    data: [
                        {
                            type: $scope.ChartType,
                            radius: "90%",
                            indexLabelOrientation: $scope.IndexOrientation,
                            indexLabelPlacement: "outside",
                            toolTipContent: "{label}<br/><strong>{y}</strong>",
                            indexLabel: $scope.IndexLabel,
                            dataPointWidth: 0,
                            showInLegend: $scope.ShowInLegend,
                            dataPoints: [
                            ]
                        }
                    ]
                };
        
        callServer().then(function (results) {
            $scope.ChartData = results;
            updateChart();
        });
        //$scope.chart.render(); //render the chart for the first time

        $scope.changeChartType = function (chartType) {
            $scope.chart.options.data[0].type = chartType;
            $scope.chart.render(); //re-render the chart to display the new layout
        }

    }

    function updateChart() {
        if ($scope.ChartData) {
            //    var totalReq = 0;
            var dataIndex = 0;
                angular.forEach($scope.ChartData.ChartResults, function (v, k) {
                    var index = 0;
                    angular.forEach(v.Result, function (v2, k2) {
                        index++;
                        $scope.chartOptions.data[dataIndex].dataPoints.push({
                            x: index,
                            y: v2.y,
                            label: v2.Label,
                            name: v2.Label
                        });

                    });
                });

                if ($scope.chartOptions.data[dataIndex].dataPoints.length > 1) {
                    $scope.chartOptions.axisX.interval = 1;
                }
                console.log('Chart Data', $scope.ChartData);

            //    $scope.showChart = totalReq > 0;

            //    if ($scope.showChart) {
                drawChart();
            //    }
        }
    }

    function callServer() {
        var deferred = $q.defer();
        var data = {
            DashboardZonID: 0,
            ViewID: 0,
            ViewType: 0,
            xFieldMappingID: 0,
            yFieldMappingID:0
        };
        data.DashboardZonID = $scope.DashboardZonID;
        data.ViewID = $scope.ViewID;
        data.ViewType = $scope.TypeID;
        data.xFieldMappingID = $scope.AxisXFieldMappingID;
        data.yFieldMappingID = $scope.AxisYFieldMappingID;

        GeneralSI.getDashboardChartResults(data).then(function (resp) {
            if (resp.status === 200) {
                deferred.resolve(resp.data);
            }
        });
        $scope.ChartZone = 'chartZone';
        return deferred.promise;
    }

    function drawChart() {
        $scope.divChart = document.querySelector('#' + $scope.ChartID);

        if ($scope.divChart) {

            $scope.chart = new CanvasJS.Chart($scope.ChartID, $scope.chartOptions);
            $scope.chart.render();

            $scope.ShowLoading = false;
        }
        else {
            $timeout(drawChart, 200);
        }
    }

});

crmApp.controller('StackedBarCtrl', function ($scope, $window, $q, $filter, GeneralSI) {

    $scope.stackedBarZone = 'loading.html';
    $scope.labels = [];
    $scope.type = 'StackedBar';
    $scope.series = [];
    $scope.colours = [
    {
        backgroundColor: '#b71c1c',
        borderColor: '#b71c1c',
        hoverBackgroundColor: '#b71c1c',
        hoverBorderColor: '#b71c1c'
    },
            {
                backgroundColor: '#e0e5e0',
                borderColor: '#e0e5e0',
                hoverBackgroundColor: '#e0e5e0',
                hoverBorderColor: '#e0e5e0'
            },
                {
                    backgroundColor: '#65C6BB',
                    borderColor: '#65C6BB',
                    hoverBackgroundColor: '#65C6BB',
                    hoverBorderColor: '#65C6BB'
                },
                {
                    backgroundColor: '#A2DED0',
                    borderColor: '#A2DED0',
                    hoverBackgroundColor: '#A2DED0',
                    hoverBorderColor: '#A2DED0'
                }
    ];
    $scope.options = {
        responsive: true,
        maintainAspectRatio: false,
        scales: {
            xAxes: [{
                stacked: true,
                gridLines: {
                    display: false
                }
            }],
            yAxes: [{
                stacked: true,
                ticks: {
                    stepSize: 1
                }
            }]
        }
    };
    $scope.chartClick = function (e) {
        var target = e.currentTarget || e.srcElement;
        $window.location.href = $window.sffSubLink;
    };

    $scope.data = [];

    $scope.getStackedBarChart = function () {

        callServer().then(function (summary) {
            //if (summary) {
            //    angular.forEach(summary.SubmissionDates, function (v, k) {
            //        $scope.labels.push($filter('date')(v, 'd MMM yyyy'));
            //    });
            //    angular.forEach(summary.GraphData, function (v, k) {
            //        $scope.series.push(v.Status);
            //        $scope.data.push(v.Data);
            //    })
            //    $scope.TotalSubmissions = summary.TotalSubmissions;
            //    $scope.InProgressSubmissions = summary.InProgressSubmissions;
            //    $scope.CompletedSubmissions = summary.CompletedSubmissions;
            //    $scope.DeactivatedSubmissions = summary.DeactivatedSubmissions;
            //    $scope.FailedSubmissions = summary.FailedSubmissions;
            //    $scope.OverallPerc = summary.OverallComplete;
            //    $scope.stackedBarZone = 'sffsubsummary';

            //}
        });

    }

    function callServer() {
        var deferred = $q.defer();
        //GeneralSI.getSFFSubmissionSummary().then(function (resp) {
        //    if (resp.status === 200) {
        //        deferred.resolve(resp.data);
        //    }
        //});
        deferred.resolve();
        return deferred.promise;
    }
});