<commit_before>define(["./employees.js"], function (employees) {

    function OnDataChange(bezl) {
        // Loop through the employees list and add them to bezl.vars.employees no matter what
        // and to the team if the SupervisorID matches the currenly logged in user
        if (bezl.data.Employees) {
            bezl.vars.employees = [];

            // Grab a reference to the logged in employee
            var currentEmployee = bezl.data.Employees.find(e => e.EmployeeEmail.toUpper() == bezl.env.currentUser.toUpper());

            for (var i = 0; i < bezl.data.Employees.length; i++) {
                bezl.vars.employees.push({
                    selected: false,
                    key: bezl.data.Employees[i].EmpID,
                    display: bezl.data.Employees[i].Name,
                    clockedIn: bezl.data.Employees[i].ClockedIn,
                    laborId: bezl.data.Employees[i].LaborID,
                    currentActivity: bezl.data.Employees[i].CurrentActivity,
                    laborType: bezl.data.Employees[i].LaborType,
                    pendingQty: bezl.data.Employees[i].PendingQty,
                    shift: bezl.data.Employees[i].Shift,
                    department: bezl.data.Employees[i].Department,
                    data: bezl.data.Employees[i],
                    show: true
                });

                if ((bezl.vars.config.AssociateTeamBy == 'SupervisorEmail' && bezl.data.Employees[i].SupervisorEmail.toUpper() == bezl.env.currentUser.toUpper())
                    || (bezl.vars.config.AssociateTeamBy == 'DepartmentShift' && bezl.data.Employees[i].Department == currentEmployee.Department)
                    || bezl.data.Employees[i].EmployeeEmail.toUpper() == bezl.env.currentUser.toUpper()
                ) {
                    var teamMemberFound = false;

                    for (var x = 0; x < bezl.vars.team.length; x++) {
                        if (bezl.vars.team[x].key == bezl.data.Employees[i].EmpID) {
                            var teamMemberFound = true;
                            bezl.vars.team[x].clockedIn = bezl.data.Employees[i].ClockedIn;
                            bezl.vars.team[x].laborId = bezl.data.Employees[i].LaborID;
                            bezl.vars.team[x].currentActivity = bezl.data.Employees[i].CurrentActivity;
                            bezl.vars.team[x].laborType = bezl.data.Employees[i].LaborType;
                            bezl.vars.team[x].pendingQty = bezl.data.Employees[i].PendingQty;
                            bezl.vars.team[x].data = bezl.data.Employees[i];
                        }
                    }

                    if (!teamMemberFound) {
                        bezl.vars.team.push({
                            selected: false,
                            key: bezl.data.Employees[i].EmpID,
                            display: bezl.data.Employees[i].Name,
                            clockedIn: bezl.data.Employees[i].ClockedIn,
                            laborId: bezl.data.Employees[i].LaborID,
                            currentActivity: bezl.data.Employees[i].CurrentActivity,
                            laborType: bezl.data.Employees[i].LaborType,
                            pendingQty: bezl.data.Employees[i].PendingQty,
                            employeeEmail: bezl.data.Employees[i].EmployeeEmail,
                            shift: bezl.data.Employees[i].Shift,
                            department: bezl.data.Employees[i].Department,
                            data: bezl.data.Employees[i],
                            show: true
                        });
                    }

                    // Pull the shift from the database into bezl.vars.config.Shift
                    if (bezl.data.Employees[i].EmployeeEmail.toUpper() == bezl.env.currentUser.toUpper()) {
                        bezl.vars.shift = bezl.data.Employees[i].Shift;
                    }
                }
            }

            // Custom sorting.  Supervisor always first, then by shift, then by department.
            bezl.vars.team.sort(function (a, b) {
                var ae = a['employeeEmail'].toUpper();
                var be = b['employeeEmail'].toUpper();

                if (ae == bezl.env.currentUser.toUpper()) {
                    return -1;
                } else {
                    // Now by shift
                    var as = a['shift'] || Number.MAX_SAFE_INTEGER;
                    var bs = b['shift'] || Number.MAX_SAFE_INTEGER;

                    if (be != bezl.env.currentUser.toUpper() && bs > as) {
                        return -1
                    } else {
                        // Lastly by department
                        var ad = a['department'];
                        var bd = b['department'];

                        if (be != bezl.env.currentUser.toUpper() && bs == as && bd > ad) {
                            return -1;
                        } else {
                            return 1;
                        }
                    }

                }
            });

            // Configure the typeahead controls for the team search.  For full documentation of
            // available settings here see http://www.runningcoder.org/jquerytypeahead/documentation/
            $('.js-typeahead-team').typeahead({<commit_msg>toUpper => toUpperCase<commit_after>define(["./employees.js"], function (employees) {

    function OnDataChange(bezl) {
        // Loop through the employees list and add them to bezl.vars.employees no matter what
        // and to the team if the SupervisorID matches the currenly logged in user
        if (bezl.data.Employees) {
            bezl.vars.employees = [];

            // Grab a reference to the logged in employee
            var currentEmployee = bezl.data.Employees.find(e => e.EmployeeEmail.toUpperCase() == bezl.env.currentUser.toUpperCase());

            for (var i = 0; i < bezl.data.Employees.length; i++) {
                bezl.vars.employees.push({
                    selected: false,
                    key: bezl.data.Employees[i].EmpID,
                    display: bezl.data.Employees[i].Name,
                    clockedIn: bezl.data.Employees[i].ClockedIn,
                    laborId: bezl.data.Employees[i].LaborID,
                    currentActivity: bezl.data.Employees[i].CurrentActivity,
                    laborType: bezl.data.Employees[i].LaborType,
                    pendingQty: bezl.data.Employees[i].PendingQty,
                    shift: bezl.data.Employees[i].Shift,
                    department: bezl.data.Employees[i].Department,
                    data: bezl.data.Employees[i],
                    show: true
                });

                if ((bezl.vars.config.AssociateTeamBy == 'SupervisorEmail' && bezl.data.Employees[i].SupervisorEmail.toUpperCase() == bezl.env.currentUser.toUpperCase())
                    || (bezl.vars.config.AssociateTeamBy == 'DepartmentShift' && bezl.data.Employees[i].Department == currentEmployee.Department)
                    || bezl.data.Employees[i].EmployeeEmail.toUpperCase() == bezl.env.currentUser.toUpperCase()
                ) {
                    var teamMemberFound = false;

                    for (var x = 0; x < bezl.vars.team.length; x++) {
                        if (bezl.vars.team[x].key == bezl.data.Employees[i].EmpID) {
                            var teamMemberFound = true;
                            bezl.vars.team[x].clockedIn = bezl.data.Employees[i].ClockedIn;
                            bezl.vars.team[x].laborId = bezl.data.Employees[i].LaborID;
                            bezl.vars.team[x].currentActivity = bezl.data.Employees[i].CurrentActivity;
                            bezl.vars.team[x].laborType = bezl.data.Employees[i].LaborType;
                            bezl.vars.team[x].pendingQty = bezl.data.Employees[i].PendingQty;
                            bezl.vars.team[x].data = bezl.data.Employees[i];
                        }
                    }

                    if (!teamMemberFound) {
                        bezl.vars.team.push({
                            selected: false,
                            key: bezl.data.Employees[i].EmpID,
                            display: bezl.data.Employees[i].Name,
                            clockedIn: bezl.data.Employees[i].ClockedIn,
                            laborId: bezl.data.Employees[i].LaborID,
                            currentActivity: bezl.data.Employees[i].CurrentActivity,
                            laborType: bezl.data.Employees[i].LaborType,
                            pendingQty: bezl.data.Employees[i].PendingQty,
                            employeeEmail: bezl.data.Employees[i].EmployeeEmail,
                            shift: bezl.data.Employees[i].Shift,
                            department: bezl.data.Employees[i].Department,
                            data: bezl.data.Employees[i],
                            show: true
                        });
                    }

                    // Pull the shift from the database into bezl.vars.config.Shift
                    if (bezl.data.Employees[i].EmployeeEmail.toUpperCase() == bezl.env.currentUser.toUpperCase()) {
                        bezl.vars.shift = bezl.data.Employees[i].Shift;
                    }
                }
            }

            // Custom sorting.  Supervisor always first, then by shift, then by department.
            bezl.vars.team.sort(function (a, b) {
                var ae = a['employeeEmail'].toUpperCase();
                var be = b['employeeEmail'].toUpperCase();

                if (ae == bezl.env.currentUser.toUpperCase()) {
                    return -1;
                } else {
                    // Now by shift
                    var as = a['shift'] || Number.MAX_SAFE_INTEGER;
                    var bs = b['shift'] || Number.MAX_SAFE_INTEGER;

                    if (be != bezl.env.currentUser.toUpperCase() && bs > as) {
                        return -1
                    } else {
                        // Lastly by department
                        var ad = a['department'];
                        var bd = b['department'];

                        if (be != bezl.env.currentUser.toUpperCase() && bs == as && bd > ad) {
                            return -1;
                        } else {
                            return 1;
                        }
                    }

                }
            });

            // Configure the typeahead controls for the team search.  For full documentation of
            // available settings here see http://www.runningcoder.org/jquerytypeahead/documentation/
            $('.js-typeahead-team').typeahead({
{'fraction_non_alphanumeric': 0.11089403665457252, 'fraction_numerical': 0.0011163829193413341, 'mean_word_length': 1.2664979970482817, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3312271', 'n_tokens_mistral': 3057, 'n_tokens_neox': 2828, 'n_words': 488}