angular.module('myApp').controller('reportController' , function ($scope , $http) {

    $scope.request = {
        "currentDate": ""
    };

     $http({
         method: 'GET',
         url:"http://localhost:8081/admin/report/project"

     }).then(function successCallback(response) {
         console.log(response);
         $scope.projects = response.data;
     }, function errorCallback(response) {
         console.log(response)
     });

    $scope.timeSheetList = function(pro) {
        var date = new Date();
        $scope.request.currentDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
        $http({
            method: 'GET',
            url: "http://localhost:8081/admin/report/project/"+pro.id+"/timeSheet/"+$scope.request.currentDate

        }).then(function successCallback(response) {
            console.log(response);
            $scope.sheets= response.data;
            console.log($scope.sheets);
        }, function errorCallback(response) {
            console.log(response)
        });
    }


});