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

    angular
        .module('app')
        .controller('Projects.IndexController', Controller)
        .controller('Projects.AddProjectController', AddProjectController)
        .controller('Projects.AssignUsersController', AssignUsersController)
        .controller('Projects.AssignUserModel', AssignUserModel)
        .controller('Projects.ClientModel', ClientModel)
        .controller('Projects.ClientsController', ClientsController)
        .controller('Projects.UsersController', UsersController)
        .controller('Projects.UserProjectsController', UserProjectsController)
        .filter('searchProjectUser', searchProjectUser)
        .filter('searchUserProject', searchUserProject)
        .filter('searchProject', searchProject)

    function Controller(UserService, ProjectService, $filter, _, FlashService, NgTableParams, noty) {
        var vm = this;
        vm.user = {};
        vm.clients = [];
        vm.projects = [];
        vm.projectTypes = [
            { projectTypeId: "", projectTypeName: "All" },
            { projectTypeId: "billed", projectTypeName: "Billed" },
            { projectTypeId: "bizdev", projectTypeName: "Bizdev" },
            { projectTypeId: "ops", projectTypeName: "ops" },
            { projectTypeId: "sales", projectTypeName: "Sales" }
        ];
        vm.projectBillTypes = [
            { projectBillId: "", projectBillName: "All" },
            { projectBillId: "fixed-bid", projectBillName: "Fixed bid" },
            { projectBillId: "time-material", projectBillName: "Time and material" }
        ];
        vm.projectBusinessUnits = ["All", "Launchpad", "Enterprise", "Operations", "Sales&Marketing", "SAS Products", "R&D", "iCancode-Training", "WL-Training", "Skill Up"];

        function getProjects() {
            ProjectService.getAll().then(function(response) {
                vm.projects = response;
            }, function(error) {
                console.log(error);
            });
        }
        vm.search = {
            clientId: "",
            projectName: "",
            projectBillType: "",
            projectType: "",
            businessUnit: "All"
        };

        function getClients() {
            ProjectService.getClients().then(function(response) {
                vm.clients = response;
                vm.clients.unshift({ _id: "", "clientName": "All" });
            }, function(error) {
                console.log(error);
            });
        }

        vm.delProject = function(projectId) {
            ProjectService.delete(projectId).then(function(response) {
                getProjects();
            }, function(error) {
                if (error) {
                    vm.alerts.push({ msg: error, type: 'danger' });
                }
            });
        }

        initController();

        function initController() {
            UserService.GetCurrent().then(function(user) {
                vm.user = user;
                if (vm.user.admin !== true) {

                }
            });
            getClients();
            getProjects();
        }
    }

    function searchProject($filter) {
        return function(input, searchObj) {
            var output = input;
            if (searchObj.clientId && searchObj.clientId.length > 0) {
                output = $filter('filter')(output, { clientId: searchObj.clientId });
            }
            if (searchObj.projectName && searchObj.projectName.length > 0) {
                output = $filter('filter')(output, { projectName: searchObj.projectName });
            }
            if (searchObj.projectBillType && searchObj.projectBillType.length > 0) {
                output = $filter('filter')(output, { projectBillType: searchObj.projectBillType });
            }
            if (searchObj.projectType && searchObj.projectType.length > 0) {
                output = $filter('filter')(output, { projectType: searchObj.projectType });
            }
            if (searchObj.businessUnit && searchObj.businessUnit.length > 0 && searchObj.businessUnit != "All") {
                output = $filter('filter')(output, { businessUnit: searchObj.businessUnit });
            }
            return output;
        }
    }

    function AddProjectController($state, UserService, ProjectService, $stateParams, $filter, _, FlashService, noty, $uibModal) {
        var vm = this;
        vm.user = {};
        vm.clients = [];
        var currentDay = new Date().getDay();
        vm.open2 = function() {
            vm.popup2.opened = true;
        };
        vm.popup2 = {
            opened: false
        };
        vm.dateOptions = {
            formatYear: 'yy',
            maxDate: new Date(2020, 5, 22),
            startingDay: 1
        };
        vm.alerts = [];
        vm.closeAlert = function(index) {
            vm.alerts.splice(index, 1);
        };
        vm.obj = {
            visibility: 'Private'
        };
        vm.isNew = true;
        vm.projectTypes = [
            { projectTypeId: "billed", projectTypeName: "Billed" },
            { projectTypeId: "bizdev", projectTypeName: "Bizdev" },
            { projectTypeId: "ops", projectTypeName: "ops" },
            { projectTypeId: "sales", projectTypeName: "Sales" }
        ];
        vm.projectBillTypes = [
            { projectBillId: "fixed-bid", projectBillName: "Fixed bid" },
            { projectBillId: "time-material", projectBillName: "Time and material" }
        ];
        vm.projectBillTypes = [
            { projectBillId: "fixed-bid", projectBillName: "Fixed bid" },
            { projectBillId: "time-material", projectBillName: "Time and material" }
        ];
        vm.projectBusinessUnits = ["All", "Launchpad", "Enterprise", "Operations", "Sales&Marketing", "SAS Products", "R&D", "iCancode-Training", "WL-Training", "Skill Up"];

        vm.getClients = function() {
            ProjectService.getClients().then(function(response) {
                vm.clients = response;
            }, function(error) {
                if (error) {
                    vm.alerts.push({ msg: error, type: 'danger' });
                }
            });
        }

        vm.getProject = function(projectId) {
            ProjectService.getById(projectId).then(function(response) {
                vm.obj = response;
                vm.obj.startDate = new Date(vm.obj.startDate);
            }, function(error) {
                if (error) {
                    vm.alerts.push({ msg: error, type: 'danger' });
                }
            });
        }

        vm.saveProject = function(form) {
            if (form.$valid) {
                var clientObj = _.find(vm.clients, { _id: vm.obj.clientId });
                if (clientObj) {<commit_msg>Business units changes<commit_after>﻿(function() {
    'use strict';

    angular
        .module('app')
        .controller('Projects.IndexController', Controller)
        .controller('Projects.AddProjectController', AddProjectController)
        .controller('Projects.AssignUsersController', AssignUsersController)
        .controller('Projects.AssignUserModel', AssignUserModel)
        .controller('Projects.ClientModel', ClientModel)
        .controller('Projects.ClientsController', ClientsController)
        .controller('Projects.UsersController', UsersController)
        .controller('Projects.UserProjectsController', UserProjectsController)
        .filter('searchProjectUser', searchProjectUser)
        .filter('searchUserProject', searchUserProject)
        .filter('searchProject', searchProject)

    function Controller(UserService, ProjectService, $filter, _, FlashService, NgTableParams, noty) {
        var vm = this;
        vm.user = {};
        vm.clients = [];
        vm.projects = [];
        vm.projectTypes = [
            { projectTypeId: "", projectTypeName: "All" },
            { projectTypeId: "billed", projectTypeName: "Billed" },
            { projectTypeId: "bizdev", projectTypeName: "Bizdev" },
            { projectTypeId: "ops", projectTypeName: "ops" },
            { projectTypeId: "sales", projectTypeName: "Sales" }
        ];
        vm.projectBillTypes = [
            { projectBillId: "", projectBillName: "All" },
            { projectBillId: "fixed-bid", projectBillName: "Fixed bid" },
            { projectBillId: "time-material", projectBillName: "Time and material" }
        ];
        vm.projectBusinessUnits = ["All", "Launchpad", "Enterprise", "Operations", "Sales&Marketing", "SAS Products", "R&D", "iCancode-Training", "WL-Training", "Skill Up"];

        function getProjects() {
            ProjectService.getAll().then(function(response) {
                vm.projects = response;
            }, function(error) {
                console.log(error);
            });
        }
        vm.search = {
            clientId: "",
            projectName: "",
            projectBillType: "",
            projectType: "",
            businessUnit: "All"
        };

        function getClients() {
            ProjectService.getClients().then(function(response) {
                vm.clients = response;
                vm.clients.unshift({ _id: "", "clientName": "All" });
            }, function(error) {
                console.log(error);
            });
        }

        vm.delProject = function(projectId) {
            ProjectService.delete(projectId).then(function(response) {
                getProjects();
            }, function(error) {
                if (error) {
                    vm.alerts.push({ msg: error, type: 'danger' });
                }
            });
        }

        initController();

        function initController() {
            UserService.GetCurrent().then(function(user) {
                vm.user = user;
                if (vm.user.admin !== true) {

                }
            });
            getClients();
            getProjects();
        }
    }

    function searchProject($filter) {
        return function(input, searchObj) {
            var output = input;
            if (searchObj.clientId && searchObj.clientId.length > 0) {
                output = $filter('filter')(output, { clientId: searchObj.clientId });
            }
            if (searchObj.projectName && searchObj.projectName.length > 0) {
                output = $filter('filter')(output, { projectName: searchObj.projectName });
            }
            if (searchObj.projectBillType && searchObj.projectBillType.length > 0) {
                output = $filter('filter')(output, { projectBillType: searchObj.projectBillType });
            }
            if (searchObj.projectType && searchObj.projectType.length > 0) {
                output = $filter('filter')(output, { projectType: searchObj.projectType });
            }
            if (searchObj.businessUnit && searchObj.businessUnit.length > 0 && searchObj.businessUnit != "All") {
                output = $filter('filter')(output, { businessUnit: searchObj.businessUnit });
            }
            return output;
        }
    }

    function AddProjectController($state, UserService, ProjectService, $stateParams, $filter, _, FlashService, noty, $uibModal) {
        var vm = this;
        vm.user = {};
        vm.clients = [];
        var currentDay = new Date().getDay();
        vm.open2 = function() {
            vm.popup2.opened = true;
        };
        vm.popup2 = {
            opened: false
        };
        vm.dateOptions = {
            formatYear: 'yy',
            maxDate: new Date(2020, 5, 22),
            startingDay: 1
        };
        vm.alerts = [];
        vm.closeAlert = function(index) {
            vm.alerts.splice(index, 1);
        };
        vm.obj = {
            visibility: 'Private'
        };
        vm.isNew = true;
        vm.projectTypes = [
            { projectTypeId: "billed", projectTypeName: "Billed" },
            { projectTypeId: "bizdev", projectTypeName: "Bizdev" },
            { projectTypeId: "ops", projectTypeName: "ops" },
            { projectTypeId: "sales", projectTypeName: "Sales" }
        ];
        vm.projectBillTypes = [
            { projectBillId: "fixed-bid", projectBillName: "Fixed bid" },
            { projectBillId: "time-material", projectBillName: "Time and material" }
        ];
        vm.projectBillTypes = [
            { projectBillId: "fixed-bid", projectBillName: "Fixed bid" },
            { projectBillId: "time-material", projectBillName: "Time and material" }
        ];
        vm.projectBusinessUnits = ["Launchpad", "Enterprise", "Operations", "Sales&Marketing", "SAS Products", "R&D", "iCancode-Training", "WL-Training", "Skill Up"];

        vm.getClients = function() {
            ProjectService.getClients().then(function(response) {
                vm.clients = response;
            }, function(error) {
                if (error) {
                    vm.alerts.push({ msg: error, type: 'danger' });
                }
            });
        }

        vm.getProject = function(projectId) {
            ProjectService.getById(projectId).then(function(response) {
                vm.obj = response;
                vm.obj.startDate = new Date(vm.obj.startDate);
            }, function(error) {
                if (error) {
                    vm.alerts.push({ msg: error, type: 'danger' });
                }
            });
        }

        vm.saveProject = function(form) {
            if (form.$valid) {
                var clientObj = _.find(vm.clients, { _id: vm.obj.clientId });
                if (clientObj) {
{'fraction_non_alphanumeric': 0.1331706595681751, 'fraction_numerical': 0.0025140490979000296, 'mean_word_length': 1.8606175972927241, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 13, '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': '5194130', 'n_tokens_mistral': 3707, 'n_tokens_neox': 3569, 'n_words': 655}