"use strict";
appCore.controller("BirthdayReport", ["$state", "$scope", "$http", "$timeout", "vServices", "$uibModal", "$document", function ($state, $scope, $http, $timeout, vServices, $uibModal, $document) {
    $scope.$root.page.title = "Heroes Birthday Report";
    $scope.params = $state.params;    
    $scope.reportList = [];
    $scope.month = '0';
    $scope.dTable = null;
    $scope.projectsDatatable = [];

    const init = () => {
        if($scope.dTable)$scope.dTable.destroy();
        vServices.callApi("commonfunc/getMonthlyBirthdayReports", "GET", {}).then((res) => {
            if(res && res.length > 0){
                $scope.reportList = res;
            }
            $scope.$root.callDataTable(".dataList123", 500, (t) => {
                $scope.dTable = t;
            }, {orientation: "landscape"});
        });
    };
    init();
    
    /*Get all Certified Employee In Drapdown & List Created By Suresh Yadav----------------------------------*/
     $scope.selectBirthday = function(val){
        if($scope.dTable)$scope.dTable.destroy();
        $scope.reportList = [];
        vServices.callApi("commonfunc/getMonthlyBirthdayReports?month="+ val , "GET", {}).then((res) => {
            if(res && res.length > 0){
                $scope.reportList = res;
            }
            $scope.$root.callDataTable(".dataList123", 500, (t) => {
                $scope.dTable = t;
            }, {orientation: "landscape"});

        });
    }     
}]);
