<commit_before>(function() {
    'use strict';

    angular
        .module('app')
        .controller('Team.IndexController', TeamsController)
        .controller('Team.LeaveBalanceController', LeaveBalanceController);

    function TeamsController(UserService, _, $state, ProjectService) {
        var vm = this;
        vm.viewProject = viewProject;

        function filterProjects() {
            _.each(vm.user.projects, function(project) {
                if (project.ownerId == vm.user._id) {
                    getUsers(project._id)
                };
            });
        };

        function viewProject() {
            
        }

        function initController() {
            UserService.GetCurrent().then(function(user) {
                vm.user = user;
                filterProjects();
            });
        }
        initController();
    };

    function LeaveBalanceController(UserService, TimesheetService, $filter, noty) {
        var vm = this;
        vm.timesheets = {};
        vm.users = [];
        vm.search = {
            userName: "",
            userResourceType: "",
            userResourceStatus: "",
            employeeCategory: "All",
            isActive: 'true',
            orderBy: 'name',
            sortDESC: false
        };
        vm.userColumns = {
            "employeeId": {label: "Employee ID", selected: true},
            "name": {label: "Name", selected: true},
            "userResourceType": {label: "Type", selected: true},
            "phone": {label: "Mobile", selected: false},
            "employeeCategory": {label: "Category", selected: false},
            "employeeType": {label: "Employee Type", selected: false},
            "timeoffHours": {label: "Timeoff Hours", selected: true},
            "timeoffDays": {label: "Timeoff Days", selected: true},
            "isActive": {label: "Status", selected: true}
        };

        function getUserLeaves(){
            TimesheetService.usersLeaveBalance('2018-2019').then(function(response) {
                if(response){
                    _.each(response, function(userSheets){
                        var userObj = _.find(vm.users, {_id: userSheets._id});
                        var timeoffHours = 0.00;
                        var timeoffDays = 0.00;
                        _.each(userSheets.timesheets, function(sheetObj){
                            timeoffHours += parseFloat(sheetObj.timeoffHours);
                        });
                        timeoffDays = parseFloat(timeoffHours).toFixed(2);
                        if(userObj){
                            userObj.userResourceType = userSheets.userResourceType;
                            userObj.timeoffHours = timeoffHours;
                            userObj.timeoffDays = timeoffDays;
                            userObj.timesheets = userSheets.timesheets;
                        }
                    });
                }
            }, function(error) {
                console.log(error);
            });
        }
        
        function getUsers() {
            UserService.getUsers().then(function(response) {
                if(response){
                    _.each(response, function(userObj){
                        userObj.timeoffHours = 0;
                        userObj.timeoffDays = parseFloat(0).toFixed(2);
                        vm.users.push(userObj);
                    });
                    getUserLeaves();
                }
            }, function(error) {
                console.log(error);
            });
        }

        function init() {
            UserService.GetCurrent().then(function(user) {
                vm.user = user;
                getUsers();
            });
        }
        init();
    };
})();<commit_msg>Leave Balance Report<commit_after>(function() {
    'use strict';

    angular
        .module('app')
        .controller('Team.IndexController', TeamsController)
        .controller('Team.LeaveBalanceController', LeaveBalanceController);

    function TeamsController(UserService, _, $state, ProjectService) {
        var vm = this;
        vm.viewProject = viewProject;

        function filterProjects() {
            _.each(vm.user.projects, function(project) {
                if (project.ownerId == vm.user._id) {
                    getUsers(project._id)
                };
            });
        };

        function viewProject() {

        }

        function initController() {
            UserService.GetCurrent().then(function(user) {
                vm.user = user;
                filterProjects();
            });
        }
        initController();
    };

    function LeaveBalanceController(UserService, TimesheetService, $filter, noty) {
        var vm = this;
        vm.timesheets = {};
        vm.users = [];
        vm.search = {
            userName: "",
            userResourceType: "",
            userResourceStatus: "",
            employeeCategory: "All",
            isActive: 'true',
            orderBy: 'name',
            sortDESC: false
        };
        vm.userColumns = {
            "employeeId": {label: "Employee ID", selected: true},
            "name": {label: "Name", selected: true},
            "userResourceType": {label: "Type", selected: true},
            "phone": {label: "Mobile", selected: false},
            "employeeCategory": {label: "Category", selected: false},
            "employeeType": {label: "Employee Type", selected: false},
            "timeoffHours": {label: "Timeoff Hours", selected: true},
            "timeoffDays": {label: "Timeoff Days", selected: true},
            "isActive": {label: "Status", selected: true}
        };

        function getUserLeaves(){
            TimesheetService.usersLeaveBalance('2018-2019').then(function(response) {
                if(response){
                    _.each(response, function(userSheets){
                        var userObj = _.find(vm.users, {_id: userSheets._id});
                        var timeoffHours = 0.00;
                        var timeoffDays = 0.00;
                        _.each(userSheets.timesheets, function(sheetObj){
                            timeoffHours += parseFloat(sheetObj.timeoffHours);
                        });
                        timeoffDays = parseFloat((timeoffHours/8)).toFixed(2);
                        if(userObj){
                            userObj.userResourceType = userSheets.userResourceType;
                            userObj.timeoffHours = timeoffHours;
                            userObj.timeoffDays = timeoffDays;
                            userObj.timesheets = userSheets.timesheets;
                        }
                    });
                }
            }, function(error) {
                console.log(error);
            });
        }
        
        function getUsers() {
            UserService.getUsers().then(function(response) {
                if(response){
                    _.each(response, function(userObj){
                        userObj.timeoffHours = 0;
                        userObj.timeoffDays = parseFloat(0).toFixed(2);
                        vm.users.push(userObj);
                    });
                    getUserLeaves();
                }
            }, function(error) {
                console.log(error);
            });
        }

        function init() {
            UserService.GetCurrent().then(function(user) {
                vm.user = user;
                getUsers();
            });
        }
        init();
    };
})();
{'fraction_non_alphanumeric': 0.11681063122923588, 'fraction_numerical': 0.004916943521594684, 'mean_word_length': 1.362209667294413, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2733364', 'n_tokens_mistral': 1933, 'n_tokens_neox': 1806, 'n_words': 326}