/*

*/
angular.module("myApp").controller("leaveFormDetailController", function($scope, $http, $stateParams, $state) {
    console.log("Leave Form Detail Controller");
    $http({
        method : 'GET',
        url : "http://localhost:8080/timesheet/leaveform/" + $stateParams.id
    }).then(function successCallback(response) {
        console.log(response);
        $scope.leaveFormDetail=response.data;
    }, function errorCallback(response) {
        console.log(response)
    });

    $scope.updateStatus = updateStatus;
    function updateStatus(id){
        $http({
            method : 'POST',
            url : "http://localhost:8080/timesheet/leaveform/"+id+"/status",
        }).then(function successCallback(response) {
            console.log(response);
            $state.reload();
        }, function errorCallback(response) {
            console.log(response);
            $state.reload();
        });
    }
});