Completed
Push — master ( 02c732...1cf8a6 )
by Grant
04:10 queued 10s
created

CreateEditProfileAPI.updateManagerProfileWithDetails   D

Complexity

Conditions 12
Paths 2048

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 12
nc 2048
nop 0
dl 0
loc 1
rs 4.8
c 0
b 0
f 0

How to fix   Complexity   

Complexity

Complex classes like CreateEditProfileAPI.updateManagerProfileWithDetails often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
7
var CreateEditProfileAPI = {};
8
9
CreateEditProfileAPI.managerProfileObj = {};
10
11
CreateEditProfileAPI.ManagerProfile = function (
12
        user_manager_profile_id,
13
        user_manager_profile_department_id,
14
        user_manager_profile_twitter,
15
        user_manager_profile_linkedin,
16
        user_id,
17
        profile_pic) {
18
    this.user_manager_profile_id = user_manager_profile_id;
19
    this.user_manager_profile_department_id = user_manager_profile_department_id;
20
    this.user_manager_profile_twitter = user_manager_profile_twitter;
21
    this.user_manager_profile_linkedin = user_manager_profile_linkedin;
22
    this.user_id = user_id,
0 ignored issues
show
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
23
            this.profile_pic = profile_pic;
0 ignored issues
show
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
24
};
25
26
CreateEditProfileAPI.ManagerProfileDetails = function (
27
        user_manager_profile_details_id,
28
        user_manager_profile_details_locale_id,
29
        user_manager_profile_details_aboutme,
30
        user_manager_profile_details_proud,
31
        user_manager_profile_details_branch,
32
        user_manager_profile_details_division,
33
        user_manager_profile_details_position,
34
        user_manager_profile_details_lead_style,
35
        user_manager_profile_details_emp_learn,
36
        user_manager_profile_details_expectations,
37
        user_manager_profile_id,
38
        user_manager_profile_review_options,
39
        user_manager_profile_staylate,
40
        user_manager_profile_engage,
41
        user_manager_profile_devops,
42
        user_manager_profile_lvwrequests,
43
        user_manager_profile_work_experience,
44
        user_manager_profile_education) {
45
    this.user_manager_profile_details_id = user_manager_profile_details_id;
46
    this.user_manager_profile_details_locale_id = user_manager_profile_details_locale_id;
47
    this.user_manager_profile_details_aboutme = user_manager_profile_details_aboutme;
48
    this.user_manager_profile_details_proud = user_manager_profile_details_proud;
49
    this.user_manager_profile_details_branch = user_manager_profile_details_branch;
50
    this.user_manager_profile_details_division = user_manager_profile_details_division;
51
    this.user_manager_profile_details_position = user_manager_profile_details_position;
52
    this.user_manager_profile_details_lead_style = user_manager_profile_details_lead_style;
53
    this.user_manager_profile_details_emp_learn = user_manager_profile_details_emp_learn;
54
    this.user_manager_profile_details_expectations = user_manager_profile_details_expectations;
55
    this.user_manager_profile_id = user_manager_profile_id;
56
    this.user_manager_profile_review_options = user_manager_profile_review_options;
57
    this.user_manager_profile_staylate = user_manager_profile_staylate;
58
    this.user_manager_profile_engage = user_manager_profile_engage;
59
    this.user_manager_profile_devops = user_manager_profile_devops;
60
    this.user_manager_profile_lvwrequests = user_manager_profile_lvwrequests;
61
    this.user_manager_profile_work_experience = user_manager_profile_work_experience;
62
    this.user_manager_profile_education = user_manager_profile_education;
63
64
};
65
66
/**
67
 *
68
 * @param {TalentCloudAPI.Content} siteContent
69
 * @return {undefined}
70
 */
71
CreateEditProfileAPI.localizeCreateEditProfile = function (siteContent) {
0 ignored issues
show
Unused Code introduced by
The parameter siteContent is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
72
    try {
73
        LookupAPI.populateDropdown("department", "createEditProfile_department");
0 ignored issues
show
Bug introduced by
The variable LookupAPI seems to be never declared. If this is a global, consider adding a /** global: LookupAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
74
    } catch (e) {
75
        (console.error || console.log).call(console, e.stack || e);
76
    }
77
};
78
79
CreateEditProfileAPI.selectedUnit = function (newID) {
80
    var option = document.getElementById(newID);
81
    option.checked = true;
82
};
83
84
//below are the functions for the tabbed layout of the 'create job poster' page for managers
85
CreateEditProfileAPI.goToStep = function (stepId) {
86
    var stepGroups = document.getElementsByClassName('stepGroup_createEditProfile');
87
    //console.log("+   " + stepGroups);
88
89
    for (var s = 0; s < stepGroups.length; s++) {
90
        var stepGroup = stepGroups[s];
91
        //console.log(stepGroup);
92
        if (!stepGroup.classList.contains('hidden')) {
93
            stepGroup.classList.add('hidden');
94
        }
95
        if (stepGroup.id === stepId) {
96
            stepGroup.classList.remove('hidden');
97
        }
98
    }
99
};
100
101
CreateEditProfileAPI.stepHighlight = function (stepID) {
102
    var s1 = document.getElementById("createJobPosterStep1Label");
103
    s1.classList.remove("create-job-poster-tab-current");
104
    var s2 = document.getElementById("createJobPosterStep2Label");
105
    s2.classList.remove("create-job-poster-tab-current");
106
    var s3 = document.getElementById("createJobPosterStep3Label");
107
    s3.classList.remove("create-job-poster-tab-current");
108
    var s4 = document.getElementById("createJobPosterStep4Label");
109
    s4.classList.remove("create-job-poster-tab-current");
110
111
    var current = document.getElementById(stepID);
112
    current.classList.add("create-job-poster-tab-current");
113
};
114
115
CreateEditProfileAPI.firstLoad = function () {
116
    DepartmentAPI.filterCreateJobPosterDepartments(true);
0 ignored issues
show
Bug introduced by
The variable DepartmentAPI seems to be never declared. If this is a global, consider adding a /** global: DepartmentAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
117
118
};
119
120
CreateEditProfileAPI.updateManagerProfileWithDetails = function () {
121
122
    var updated_manager_profile = new CreateEditProfileAPI.ManagerProfile();
123
124
    updated_manager_profile.user_id = UserAPI.getSessionUserAsJSON().user_id;
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
125
126
    updated_manager_profile.user_manager_profile_id = document.getElementById("ManagerProfileId").value;
127
128
    updated_manager_profile.user_manager_profile_department_id = document.getElementById("createEditProfile_department").value;
129
    if (updated_manager_profile.user_manager_profile_department_id === "") {
130
        //Server accepts null but not empty string ids
131
        updated_manager_profile.user_manager_profile_department_id = null;
132
    }
133
134
    updated_manager_profile.user_manager_profile_twitter = document.getElementById("createEditProfile_twitter").value;
135
    updated_manager_profile.user_manager_profile_linkedin = document.getElementById("createEditProfile_linkedin").value;
136
137
    console.log(updated_manager_profile);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
138
139
    var updated_manager_profile_details_en = new CreateEditProfileAPI.ManagerProfileDetails();
140
    var updated_manager_profile_details_fr = new CreateEditProfileAPI.ManagerProfileDetails();
141
142
    //TODO: use locale_iso instead of locale_id; requires backend change too
143
    updated_manager_profile_details_en.user_manager_profile_details_locale_id = 1;
144
    updated_manager_profile_details_en.user_manager_profile_details_locale_id = 2;
145
146
    updated_manager_profile_details_en.user_manager_profile_details_id = document.getElementById("ManagerProfileDetailsId").value;
147
    updated_manager_profile_details_fr.user_manager_profile_details_id = document.getElementById("ManagerProfileDetailsId").value;
148
149
    updated_manager_profile_details_en.user_manager_profile_id = document.getElementById("ManagerProfileId").value;
150
    updated_manager_profile_details_fr.user_manager_profile_id = document.getElementById("ManagerProfileId").value;
151
152
    updated_manager_profile_details_en.user_manager_profile_details_aboutme = document.getElementById("createEditProfile_bio").value;
153
    updated_manager_profile_details_fr.user_manager_profile_details_aboutme = document.getElementById("createEditProfile_bio_fr").value;
154
155
    updated_manager_profile_details_en.user_manager_profile_details_proud = document.getElementById("createEditProfile_proudOf").value;
156
    updated_manager_profile_details_fr.user_manager_profile_details_proud = document.getElementById("createEditProfile_proudOf_fr").value;
157
158
    updated_manager_profile_details_en.user_manager_profile_details_branch = document.getElementById("createEditProfile_branch").value;
159
    updated_manager_profile_details_fr.user_manager_profile_details_branch = document.getElementById("createEditProfile_branch_fr").value;
160
161
    updated_manager_profile_details_en.user_manager_profile_details_division = document.getElementById("createEditProfile_division").value;
162
    updated_manager_profile_details_fr.user_manager_profile_details_division = document.getElementById("createEditProfile_division_fr").value;
163
164
    updated_manager_profile_details_en.user_manager_profile_details_position = document.getElementById("createEditProfile_position").value;
165
    updated_manager_profile_details_fr.user_manager_profile_details_position = document.getElementById("createEditProfile_position_fr").value;
166
167
    updated_manager_profile_details_en.user_manager_profile_details_lead_style = document.getElementById("createEditProfile_leadership_style").value;
168
    updated_manager_profile_details_fr.user_manager_profile_details_lead_style = document.getElementById("createEditProfile_leadership_style_fr").value;
169
170
    updated_manager_profile_details_en.user_manager_profile_details_emp_learn = document.getElementById("createEditProfile_app_to_employees").value;
171
    updated_manager_profile_details_fr.user_manager_profile_details_emp_learn = document.getElementById("createEditProfile_app_to_employees_fr").value;
172
173
    updated_manager_profile_details_en.user_manager_profile_details_expectations = document.getElementById("createEditProfile_exp_of_employees").value;
174
    updated_manager_profile_details_fr.user_manager_profile_details_expectations = document.getElementById("createEditProfile_exp_of_employees_fr").value;
175
176
    updated_manager_profile_details_en.user_manager_profile_work_experience = document.getElementById("user_manager_profile_work_experience").value;
177
    updated_manager_profile_details_fr.user_manager_profile_work_experience = document.getElementById("user_manager_profile_work_experience_fr").value;
178
179
    updated_manager_profile_details_en.user_manager_profile_education = document.getElementById("user_manager_profile_education").value;
180
    updated_manager_profile_details_fr.user_manager_profile_education = document.getElementById("user_manager_profile_education_fr").value;
181
182
183
    //Get slider option values, and default to "option0" if any NOTHING in a slider is selected, default to "option0"
184
    var defaultOption = "option0";
185
186
    var reviewSelected = document.querySelector('input[name="createEditProfile_how_often_review_options"]:checked');
187
    updated_manager_profile_details_en.user_manager_profile_review_options = (reviewSelected ? reviewSelected.value : defaultOption); //Ternary Operator
188
    updated_manager_profile_details_fr.user_manager_profile_review_options = (reviewSelected ? reviewSelected.value : defaultOption);
189
190
    var staylateSelected = document.querySelector('input[name="createEditProfile_staylate"]:checked');
191
    updated_manager_profile_details_en.user_manager_profile_staylate = (staylateSelected ? staylateSelected.value : defaultOption);
192
    updated_manager_profile_details_fr.user_manager_profile_staylate = (staylateSelected ? staylateSelected.value : defaultOption);
193
194
    var engageSelected = document.querySelector('input[name="createEditProfile_engage"]:checked');
195
    updated_manager_profile_details_en.user_manager_profile_engage = (engageSelected ? engageSelected.value : defaultOption);
196
    updated_manager_profile_details_fr.user_manager_profile_engage = (engageSelected ? engageSelected.value : defaultOption);
197
198
    var devopsSelected = document.querySelector('input[name="createEditProfile_devops"]:checked');
199
    updated_manager_profile_details_en.user_manager_profile_devops = (devopsSelected ? devopsSelected.value : defaultOption);
200
    updated_manager_profile_details_fr.user_manager_profile_devops = (devopsSelected ? devopsSelected.value : defaultOption);
201
202
    var lvwrequestSelected = document.querySelector('input[name="createEditProfile_lvwrequests"]:checked');
203
    updated_manager_profile_details_en.user_manager_profile_lvwrequests = (lvwrequestSelected ? lvwrequestSelected.value : defaultOption);
204
    updated_manager_profile_details_fr.user_manager_profile_lvwrequests = (lvwrequestSelected ? lvwrequestSelected.value : defaultOption);
205
206
207
    var complete_manager_profile = {};
208
209
    complete_manager_profile.manager_profile = updated_manager_profile;
210
211
    complete_manager_profile.manager_profile_details = {};
212
    complete_manager_profile.manager_profile_details.en_CA = updated_manager_profile_details_en;
213
    complete_manager_profile.manager_profile_details.fr_CA = updated_manager_profile_details_fr;
214
215
    CreateEditProfileAPI.saveManagerProfile(complete_manager_profile);
216
217
};
218
219
CreateEditProfileAPI.saveManagerProfile = function (complete_manager_profile) {
220
221
    var complete_manager_profileJSON = JSON.stringify(complete_manager_profile);
222
223
    if (UserAPI.hasSessionUser()) {
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
224
        var user = UserAPI.getSessionUserAsJSON();
225
        var user_id = user["user_id"];
0 ignored issues
show
Coding Style introduced by
['user_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
226
        var manager_profile_url = DataAPI.baseURL + "/postManagerProfile/" + user_id;
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
227
        DataAPI.sendRequest(manager_profile_url, 'POST', {}, complete_manager_profileJSON, function(request) {
228
            if (request.status === 200) {
229
                var response = JSON.parse(request.responseText);
230
                document.getElementById("ManagerProfileId").value = response.manager_profile_id;
231
            }
232
        });
233
    }
234
};
235
236
CreateEditProfileAPI.viewProfile = function (profileObj) {
237
238
    var engFreBreak = '///';
239
240
    var viewProfileContent = document.createElement("div");
241
    viewProfileContent.setAttribute("class", "viewProfileContent");
242
    viewProfileContent.setAttribute("id", "viewProfile_ContentID");
243
244
    //'vp' stands for view profile
245
    //Name
246
    //
247
    //About me
248
    var vp_aboutMe_div = document.createElement("div");
249
    vp_aboutMe_div.setAttribute("id", "vpAboutMeContent");
250
    var vp_aboutMe = document.createElement("div");
251
    vp_aboutMe.setAttribute("id", "vpAboutMe");
252
    vp_aboutMe.innerHTML = siteContent.aboutMe;
0 ignored issues
show
Bug introduced by
The variable siteContent seems to be never declared. If this is a global, consider adding a /** global: siteContent */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
253
254
    var vp_name = document.createElement("div");
255
    vp_name.setAttribute("id", "vpName");
256
    vp_name.innerHTML = profileObj.name;
257
258
    var vp_bio = document.createElement("div");
259
    vp_bio.setAttribute("id", "vpBio");
260
    vp_bio.innerHTML = profileObj.bio + '<br>' + engFreBreak + '<br>' + profileObj.bio_fr;
261
262
    vp_aboutMe_div.appendChild(vp_aboutMe);
263
    vp_aboutMe_div.appendChild(document.createElement("hr"));
264
    vp_aboutMe_div.appendChild(vp_name);
265
    vp_aboutMe_div.appendChild(vp_bio);
266
267
268
269
    //Gneral information
270
    var vp_generalInfo_div = document.createElement("div");
271
    vp_generalInfo_div.setAttribute("id", "vpGeneralInfoContent");
272
    vp_generalInfo_div.setAttribute("class", "viewProfileGeneralInformationPane");
273
    var vp_genInfo = document.createElement("div");
274
    vp_genInfo.setAttribute("id", "vpGenInfo");
275
    vp_genInfo.innerHTML = siteContent.generalInformation;
276
277
    //GENERAL INFO (LEFT)
278
    var vp_generalInfo_div_left = document.createElement("div");
279
    //vp_generalInfo_div_left.setAttribute("class", "viewProfileLeftPane");
280
281
    var vp_dep = document.createElement("div");
282
    vp_dep.setAttribute("id", "vpSlot_department");
283
    vp_dep.setAttribute("class", "viewProfileSlot");
284
    var vp_dep_label = document.createElement("div");
285
    vp_dep_label.innerHTML = siteContent.department;
286
    vp_dep_label.setAttribute("class", "viewProfileSlotLabel");
287
    vp_dep_label.setAttribute("id", "viewProfile_slot_dep_label");
288
    var vp_dep_content = document.createElement("div");
289
    vp_dep_content.setAttribute("class", "viewProfileSlotContent");
290
    var vp_dep_img = document.createElement("div");
291
    vp_dep_img.setAttribute("class", "viewProfileSlotImg");
292
    var vp_dep_img_tag = document.createElement("img");
293
    vp_dep_img_tag.setAttribute("src", "/images/checkmark.png");
294
    vp_dep_img_tag.setAttribute("width", "24");
295
    vp_dep_img_tag.setAttribute("height", "24");
296
    vp_dep_img.appendChild(vp_dep_img_tag);
297
    var vp_dep_value = document.createElement("div");
298
    vp_dep_value.setAttribute("class", "viewProfileSlotValue");
299
    vp_dep_value.innerHTML = profileObj.department + '<br>' + engFreBreak + '<br>' + profileObj.department_fr;
300
    vp_dep_content.appendChild(vp_dep_img);
301
    vp_dep_content.appendChild(vp_dep_value);
302
    vp_dep.appendChild(vp_dep_label);
303
    vp_dep.appendChild(vp_dep_content);
304
305
    var vp_pos = document.createElement("div");
306
    vp_pos.setAttribute("id", "vpSlot_position");
307
    vp_pos.setAttribute("class", "viewProfileSlot");
308
    var vp_pos_label = document.createElement("div");
309
    vp_pos_label.innerHTML = siteContent.position;
310
    vp_pos_label.setAttribute("class", "viewProfileSlotLabel");
311
    vp_pos_label.setAttribute("id", "viewProfile_slot_pos_label");
312
    var vp_pos_content = document.createElement("div");
313
    vp_pos_content.setAttribute("class", "viewProfileSlotContent");
314
    var vp_pos_img = document.createElement("div");
315
    vp_pos_img.setAttribute("class", "viewProfileSlotImg");
316
    var vp_pos_img_tag = document.createElement("img");
317
    vp_pos_img_tag.setAttribute("src", "/images/checkmark.png");
318
    vp_pos_img_tag.setAttribute("width", "24");
319
    vp_pos_img_tag.setAttribute("height", "24");
320
    vp_pos_img.appendChild(vp_pos_img_tag);
321
    var vp_pos_value = document.createElement("div");
322
    vp_pos_value.setAttribute("class", "viewProfileSlotValue");
323
    vp_pos_value.innerHTML = profileObj.position + '<br>' + engFreBreak + '<br>' + profileObj.position_fr;
324
    vp_pos_content.appendChild(vp_pos_img);
325
    vp_pos_content.appendChild(vp_pos_value);
326
    vp_pos.appendChild(vp_pos_label);
327
    vp_pos.appendChild(vp_pos_content);
328
329
    var vp_branch = document.createElement("div");
330
    vp_branch.setAttribute("id", "vpSlot_branch");
331
    vp_branch.setAttribute("class", "viewProfileSlot");
332
    var vp_branch_label = document.createElement("div");
333
    vp_branch_label.innerHTML = siteContent.branch;
334
    vp_branch_label.setAttribute("class", "viewProfileSlotLabel");
335
    vp_branch_label.setAttribute("id", "viewProfile_slot_branch_label");
336
    var vp_branch_content = document.createElement("div");
337
    vp_branch_content.setAttribute("class", "viewProfileSlotContent");
338
    var vp_branch_img = document.createElement("div");
339
    vp_branch_img.setAttribute("class", "viewProfileSlotImg");
340
    var vp_branch_img_tag = document.createElement("img");
341
    vp_branch_img_tag.setAttribute("src", "/images/checkmark.png");
342
    vp_branch_img_tag.setAttribute("width", "24");
343
    vp_branch_img_tag.setAttribute("height", "24");
344
    vp_branch_img.appendChild(vp_branch_img_tag);
345
    var vp_branch_value = document.createElement("div");
346
    vp_branch_value.setAttribute("class", "viewProfileSlotValue");
347
    vp_branch_value.innerHTML = profileObj.branch + '<br>' + engFreBreak + '<br>' + profileObj.branch_fr;
348
    vp_branch_content.appendChild(vp_branch_img);
349
    vp_branch_content.appendChild(vp_branch_value);
350
    vp_branch.appendChild(vp_branch_label);
351
    vp_branch.appendChild(vp_branch_content);
352
353
    var vp_division = document.createElement("div");
354
    vp_division.setAttribute("id", "vpSlot_division");
355
    vp_division.setAttribute("class", "viewProfileSlot");
356
    var vp_division_label = document.createElement("div");
357
    vp_division_label.innerHTML = siteContent.division;
358
    vp_division_label.setAttribute("class", "viewProfileSlotLabel");
359
    vp_division_label.setAttribute("id", "viewProfile_slot_division_label");
360
    var vp_division_content = document.createElement("div");
361
    vp_division_content.setAttribute("class", "viewProfileSlotContent");
362
    var vp_division_img = document.createElement("div");
363
    vp_division_img.setAttribute("class", "viewProfileSlotImg");
364
    var vp_division_img_tag = document.createElement("img");
365
    vp_division_img_tag.setAttribute("src", "/images/checkmark.png");
366
    vp_division_img_tag.setAttribute("width", "24");
367
    vp_division_img_tag.setAttribute("height", "24");
368
    vp_division_img.appendChild(vp_division_img_tag);
369
    var vp_division_value = document.createElement("div");
370
    vp_division_value.setAttribute("class", "viewProfileSlotValue");
371
    vp_division_value.innerHTML = profileObj.division + '<br>' + engFreBreak + '<br>' + profileObj.division_fr;
372
    vp_division_content.appendChild(vp_division_img);
373
    vp_division_content.appendChild(vp_division_value);
374
    vp_division.appendChild(vp_division_label);
375
    vp_division.appendChild(vp_division_content);
376
377
    //TWITTER AND LINKED IN (LEFT) //(RIGHT)
378
    //var vp_generalInfo_div_right = document.createElement("div");
379
    //vp_generalInfo_div_right.setAttribute("class", "viewProfileRightPane");
380
381
    var vp_twitter = document.createElement("div");
382
    vp_twitter.setAttribute("id", "vpSlot_twitter");
383
    vp_twitter.setAttribute("class", "viewProfileSlot");
384
    var vp_twitter_label = document.createElement("div");
385
    vp_twitter_label.innerHTML = "Twitter";//siteContent.division;
386
    vp_twitter_label.setAttribute("class", "viewProfileSlotLabel");
387
    vp_twitter_label.setAttribute("id", "viewProfile_slot_twitter_label");
388
    var vp_twitter_content = document.createElement("div");
389
    vp_twitter_content.setAttribute("class", "viewProfileSlotContent");
390
    var vp_twitter_img = document.createElement("div");
391
    vp_twitter_img.setAttribute("class", "viewProfileSlotImg");
392
    var vp_twitter_img_tag = document.createElement("img");
393
    vp_twitter_img_tag.setAttribute("src", "/images/twitter.png");
394
    vp_twitter_img_tag.setAttribute("width", "32");
395
    vp_twitter_img_tag.setAttribute("height", "32");
396
    vp_twitter_img.appendChild(vp_twitter_img_tag);
397
    var vp_twitter_value = document.createElement("div");
398
    vp_twitter_value.setAttribute("class", "viewProfileSlotValue");
399
    vp_twitter_value.innerHTML = profileObj.twitter;
400
    vp_twitter_content.appendChild(vp_twitter_img);
401
    vp_twitter_content.appendChild(vp_twitter_value);
402
    vp_twitter.appendChild(vp_twitter_label);
403
    vp_twitter.appendChild(vp_twitter_content);
404
405
    var vp_linkedin = document.createElement("div");
406
    vp_linkedin.setAttribute("id", "vpSlot_linkedin");
407
    vp_linkedin.setAttribute("class", "viewProfileSlot");
408
    var vp_linkedin_label = document.createElement("div");
409
    vp_linkedin_label.innerHTML = "LinkedIn";//siteContent.linkedin;
410
    vp_linkedin_label.setAttribute("class", "viewProfileSlotLabel");
411
    vp_linkedin_label.setAttribute("id", "viewProfile_slot_linkedin_label");
412
    var vp_linkedin_content = document.createElement("div");
413
    vp_linkedin_content.setAttribute("class", "viewProfileSlotContent");
414
    var vp_linkedin_img = document.createElement("div");
415
    vp_linkedin_img.setAttribute("class", "viewProfileSlotImg");
416
    var vp_linkedin_img_tag = document.createElement("img");
417
    vp_linkedin_img_tag.setAttribute("src", "/images/linkedin.png");
418
    vp_linkedin_img_tag.setAttribute("width", "32");
419
    vp_linkedin_img_tag.setAttribute("height", "32");
420
    vp_linkedin_img.appendChild(vp_linkedin_img_tag);
421
    var vp_linkedin_value = document.createElement("div");
422
    vp_linkedin_value.setAttribute("class", "viewProfileSlotValue");
423
    vp_linkedin_value.innerHTML = profileObj.linkedin;
424
    vp_linkedin_content.appendChild(vp_linkedin_img);
425
    vp_linkedin_content.appendChild(vp_linkedin_value);
426
    vp_linkedin.appendChild(vp_linkedin_label);
427
    vp_linkedin.appendChild(vp_linkedin_content);
428
429
    //ASSEMBLE GENERAL INFO SECTION
430
    vp_generalInfo_div.appendChild(vp_genInfo);
431
432
    vp_generalInfo_div_left.appendChild(vp_dep);
433
    vp_generalInfo_div_left.appendChild(vp_pos);
434
    vp_generalInfo_div_left.appendChild(vp_branch);
435
    vp_generalInfo_div_left.appendChild(vp_division);
436
    vp_generalInfo_div_left.appendChild(vp_twitter);
437
    vp_generalInfo_div_left.appendChild(vp_linkedin);
438
439
    vp_generalInfo_div.appendChild(document.createElement("hr"));
440
    vp_generalInfo_div.appendChild(vp_generalInfo_div_left);
441
    //vp_generalInfo_div.appendChild(vp_generalInfo_div_right);
442
443
444
    //Leadership style
445
    var vp_leadershipStyle_div = document.createElement("div");
446
    vp_leadershipStyle_div.setAttribute("id", "vpLeadershipStyleContent");
447
    var vp_leadershipStyle = document.createElement("div");
448
    vp_leadershipStyle.setAttribute("id", "vpLeadershipStyle");
449
    vp_leadershipStyle.innerHTML = siteContent.leadershipStyle;
450
451
    var vp_mystyle = document.createElement("div");
452
    vp_mystyle.setAttribute("id", "vpSlot_mystyle");
453
    vp_mystyle.setAttribute("class", "viewProfileSlot");
454
    var vp_mystyle_label = document.createElement("div");
455
    vp_mystyle_label.innerHTML = siteContent.myLeadershipStyle;
456
    vp_mystyle_label.setAttribute("class", "viewProfileSlotLabel");
457
    vp_mystyle_label.setAttribute("id", "viewProfile_slot_mystyle_label");
458
    var vp_mystyle_content = document.createElement("div");
459
    vp_mystyle_content.setAttribute("class", "viewProfileSlotContent");
460
    var vp_mystyle_img = document.createElement("div");
461
    vp_mystyle_img.setAttribute("class", "viewProfileSlotImg");
462
    var vp_mystyle_img_tag = document.createElement("img");
463
    vp_mystyle_img_tag.setAttribute("src", "/images/checkmark.png");
464
    vp_mystyle_img_tag.setAttribute("width", "24");
465
    vp_mystyle_img_tag.setAttribute("height", "24");
466
    vp_mystyle_img.appendChild(vp_mystyle_img_tag);
467
    var vp_mystyle_value = document.createElement("div");
468
    vp_mystyle_value.setAttribute("class", "viewProfileSlotValue viewProfileHeightBoost");
469
    vp_mystyle_value.innerHTML = profileObj.leadership_style + '<br>' + engFreBreak + '<br>' + profileObj.leadership_style_fr;
470
    vp_mystyle_content.appendChild(vp_mystyle_img);
471
    vp_mystyle_content.appendChild(vp_mystyle_value);
472
    vp_mystyle.appendChild(vp_mystyle_label);
473
    vp_mystyle.appendChild(vp_mystyle_content);
474
475
    var vp_myapp = document.createElement("div");
476
    vp_myapp.setAttribute("id", "vpSlot_myapp");
477
    vp_myapp.setAttribute("class", "viewProfileSlot");
478
    var vp_myapp_label = document.createElement("div");
479
    vp_myapp_label.innerHTML = siteContent.myApproachToEmployee;
480
    vp_myapp_label.setAttribute("class", "viewProfileSlotLabel");
481
    vp_myapp_label.setAttribute("id", "viewProfile_slot_myapp_label");
482
    var vp_myapp_content = document.createElement("div");
483
    vp_myapp_content.setAttribute("class", "viewProfileSlotContent");
484
    var vp_myapp_img = document.createElement("div");
485
    vp_myapp_img.setAttribute("class", "viewProfileSlotImg");
486
    var vp_myapp_img_tag = document.createElement("img");
487
    vp_myapp_img_tag.setAttribute("src", "/images/checkmark.png");
488
    vp_myapp_img_tag.setAttribute("width", "24");
489
    vp_myapp_img_tag.setAttribute("height", "24");
490
    vp_myapp_img.appendChild(vp_myapp_img_tag);
491
    var vp_myapp_value = document.createElement("div");
492
    vp_myapp_value.setAttribute("class", "viewProfileSlotValue viewProfileHeightBoost");
493
    vp_myapp_value.innerHTML = profileObj.app_to_employees + '<br>' + engFreBreak + '<br>' + profileObj.app_to_employees_fr;
494
    vp_myapp_content.appendChild(vp_myapp_img);
495
    vp_myapp_content.appendChild(vp_myapp_value);
496
    vp_myapp.appendChild(vp_myapp_label);
497
    vp_myapp.appendChild(vp_myapp_content);
498
499
    var vp_myexp = document.createElement("div");
500
    vp_myexp.setAttribute("id", "vpSlot_myapp");
501
    vp_myexp.setAttribute("class", "viewProfileSlot");
502
    var vp_myexp_label = document.createElement("div");
503
    vp_myexp_label.innerHTML = siteContent.myExpectationsOfEmployees;
504
    vp_myexp_label.setAttribute("class", "viewProfileSlotLabel");
505
    vp_myexp_label.setAttribute("id", "viewProfile_slot_myapp_label");
506
    var vp_myexp_content = document.createElement("div");
507
    vp_myexp_content.setAttribute("class", "viewProfileSlotContent");
508
    var vp_myexp_img = document.createElement("div");
509
    vp_myexp_img.setAttribute("class", "viewProfileSlotImg");
510
    var vp_myexp_img_tag = document.createElement("img");
511
    vp_myexp_img_tag.setAttribute("src", "/images/checkmark.png");
512
    vp_myexp_img_tag.setAttribute("width", "24");
513
    vp_myexp_img_tag.setAttribute("height", "24");
514
    vp_myexp_img.appendChild(vp_myexp_img_tag);
515
    var vp_myexp_value = document.createElement("div");
516
    vp_myexp_value.setAttribute("class", "viewProfileSlotValue viewProfileHeightBoost");
517
    vp_myexp_value.innerHTML = profileObj.exp_of_employees + '<br>' + engFreBreak + '<br>' + profileObj.exp_of_employees_fr;
518
    vp_myexp_content.appendChild(vp_myexp_img);
519
    vp_myexp_content.appendChild(vp_myexp_value);
520
    vp_myexp.appendChild(vp_myexp_label);
521
    vp_myexp.appendChild(vp_myexp_content);
522
523
524
    //ASSEMBLE LEADERSHIP STYLE SECTION
525
    vp_leadershipStyle_div.appendChild(vp_leadershipStyle);
526
    vp_leadershipStyle_div.appendChild(document.createElement("hr"));
527
    vp_leadershipStyle_div.appendChild(vp_mystyle);
528
    vp_leadershipStyle_div.appendChild(vp_myapp);
529
    vp_leadershipStyle_div.appendChild(vp_myexp);
530
531
    //Radio buttons
532
    var vp_decisionMaking_div = document.createElement("div");
533
    vp_decisionMaking_div.setAttribute("id", "vpDecisionMakingContent");
534
    var vp_decisionMaking = document.createElement("div");
535
    vp_decisionMaking.setAttribute("id", "vpDecisionMaking");
536
    vp_decisionMaking.innerHTML = siteContent.myApproachToDecisionMaking;
537
538
    var vp_howOftenReview = document.createElement("div");
539
    var reviewVal = siteContent.howOftenDoYouReview + '&nbsp;   ' + profileObj.how_often_review;
540
    vp_howOftenReview.innerHTML = reviewVal;
541
542
    var vp_howOftenEarly = document.createElement("div");
543
    var earlyVal = siteContent.howOftenDoYouStayLate + '&nbsp;   ' + profileObj.how_often_early;
544
    vp_howOftenEarly.innerHTML = earlyVal;
545
    //if(profileObj.howOftenReview === 1)
546
547
    //vp_howOftenReview.innerHTML = reviewVal;
548
549
    //ASSEMBLE DECISION MAKING STYLE
550
    vp_decisionMaking_div.appendChild(vp_decisionMaking);
551
    vp_decisionMaking_div.appendChild(document.createElement("hr"));
552
    vp_decisionMaking_div.appendChild(vp_howOftenReview);
553
    vp_decisionMaking_div.appendChild(document.createElement("br"));
554
    vp_decisionMaking_div.appendChild(vp_howOftenEarly);
555
556
    //////////////////
557
    //AddSections to the view profile container
558
    /////////////////
559
    //Addf the about me div
560
    viewProfileContent.appendChild(document.createElement("br"));
561
    viewProfileContent.appendChild(document.createElement("br"));
562
    viewProfileContent.appendChild(vp_aboutMe_div);
563
564
    //Add the general information div
565
    viewProfileContent.appendChild(document.createElement("br"));
566
    viewProfileContent.appendChild(document.createElement("br"));
567
    viewProfileContent.appendChild(vp_generalInfo_div);
568
569
    //Add the leadership style div
570
    viewProfileContent.appendChild(document.createElement("br"));
571
    viewProfileContent.appendChild(document.createElement("br"));
572
    viewProfileContent.appendChild(vp_leadershipStyle_div);
573
574
    //Add decisin making
575
    viewProfileContent.appendChild(document.createElement("br"));
576
    viewProfileContent.appendChild(document.createElement("br"));
577
    viewProfileContent.appendChild(vp_decisionMaking_div);
578
579
    return viewProfileContent;
580
581
};
582
583
CreateEditProfileAPI.showCreateEditProfile = function () {
584
    var stateInfo = {pageInfo: 'create_edit_profile', pageTitle: 'Talent Cloud: Create/Edit Profile'};
585
    document.title = stateInfo.pageTitle;
586
    history.pushState(stateInfo, stateInfo.pageInfo, '#CreateEditProfile');
0 ignored issues
show
Bug introduced by
The variable history seems to be never declared. If this is a global, consider adding a /** global: history */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
587
588
    TalentCloudAPI.hideAllContent();
0 ignored issues
show
Bug introduced by
The variable TalentCloudAPI seems to be never declared. If this is a global, consider adding a /** global: TalentCloudAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
589
590
    var createEditProfile = document.getElementById("createEditProfileSection");
591
    createEditProfile.classList.remove("hidden");
592
593
    ProfilePicAPI.refreshUserProfilePic(document.getElementById("managerProfilePic"));
0 ignored issues
show
Bug introduced by
The variable ProfilePicAPI seems to be never declared. If this is a global, consider adding a /** global: ProfilePicAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
594
595
    CreateEditProfileAPI.getManagerProfile();
596
597
    // New Subpage Hero Scripts
598
599
    Utilities.getHeroElements();
0 ignored issues
show
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
600
601
    var profileHeroTitle = document.getElementById("profileHeroTitle");
602
    profileHeroTitle.classList.remove("hidden");
603
    profileHeroTitle.setAttribute("aria-hidden", "false");
604
605
    // Google Analytics
606
607
    ga('set', 'page', '/admin/my-profile');
608
    ga('send', 'pageview');
609
610
};
611
612
CreateEditProfileAPI.showViewProfile = function (linkElement) {
0 ignored issues
show
Unused Code introduced by
The parameter linkElement is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
613
    var stateInfo = {pageInfo: 'manager_view_profile', pageTitle: 'Talent Cloud: View Profile'};
614
    document.title = stateInfo.pageTitle;
615
    history.pushState(stateInfo, stateInfo.pageInfo, '#ViewProfile');
0 ignored issues
show
Bug introduced by
The variable history seems to be never declared. If this is a global, consider adding a /** global: history */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
616
617
    //Temp prifle obj
618
    var tempProfileObj = {name: 'John Dore',
619
        bio: 'BIo in englsih',
620
        bio_fr: 'BIo in French',
621
        position: 'Position In English',
622
        position_fr: 'Position in French',
623
        department: 'Department in Enlgish',
624
        department_fr: 'Department in French',
625
        branch_fr: 'Branch name in French',
626
        branch: 'Branch name in English',
627
        division: 'The division (in English)',
628
        division_fr: 'The division (in french)',
629
        twitter: 'Twitter Link',
630
        linkedin: 'LinkedIn Link',
631
        leadership_style: 'Leadership style in English',
632
        leadership_style_fr: 'Leadership Style in French',
633
        app_to_employees: 'Approach to employees',
634
        app_to_employees_fr: 'Approach to employees french',
635
        exp_of_employees: 'Expectations of employees',
636
        exp_of_employees_fr: 'Expectations of emplyoees in the second language',
637
        how_often_review: 'Almost Never',
638
        how_often_early: 'Usually'
639
    };
640
641
    EventsAPI.hideAllLayouts();
0 ignored issues
show
Bug introduced by
The variable EventsAPI seems to be never declared. If this is a global, consider adding a /** global: EventsAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
642
643
    var createEditProfile = document.getElementById("createEditProfileSection");
644
    createEditProfile.classList.remove("hidden");
645
646
    var viewProfileElement = document.getElementById("viewProfile");
647
    viewProfileElement.classList.remove("hidden");
648
649
    viewProfileElement.innerHTML = '';
650
    viewProfileElement.appendChild(CreateEditProfileAPI.viewProfile(tempProfileObj));
651
};
652
653
CreateEditProfileAPI.hideViewProfile = function (linkElement) {
0 ignored issues
show
Unused Code introduced by
The parameter linkElement is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
654
    var stateInfo = {pageInfo: 'talent_cloud', pageTitle: 'Talent Cloud'};
655
    document.title = stateInfo.pageTitle;
656
    history.replaceState(stateInfo, stateInfo.pageInfo, '/admin/#');
0 ignored issues
show
Bug introduced by
The variable history seems to be never declared. If this is a global, consider adding a /** global: history */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
657
658
    EventsAPI.hideAllLayouts();
0 ignored issues
show
Bug introduced by
The variable EventsAPI seems to be never declared. If this is a global, consider adding a /** global: EventsAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
659
660
    var content = document.getElementById("homePageContentSection");
661
    content.classList.remove("hidden");
662
663
    var active = document.getElementById("homeLinkListItem");
0 ignored issues
show
Unused Code introduced by
The variable active seems to be never used. Consider removing it.
Loading history...
664
    homeLinkListItem.classList.add("active");
0 ignored issues
show
Bug introduced by
The variable homeLinkListItem seems to be never declared. If this is a global, consider adding a /** global: homeLinkListItem */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
665
666
    var inactive = document.getElementById("profileLinkListItem");
0 ignored issues
show
Unused Code introduced by
The variable inactive seems to be never used. Consider removing it.
Loading history...
667
    profileLinkListItem.classList.remove("active");
0 ignored issues
show
Bug introduced by
The variable profileLinkListItem seems to be never declared. If this is a global, consider adding a /** global: profileLinkListItem */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
668
669
    window.scrollTo(0, 0);
670
    document.getElementById("skipNav").focus();
671
};
672
673
CreateEditProfileAPI.profilePicUploader = null;
674
675
CreateEditProfileAPI.showUploadProfilePic = function () {
676
    //document.body.style.overflow = "hidden";
677
    var uploadOverlay = document.getElementById('profilePicUploadOverlay');
678
    uploadOverlay.classList.remove("hidden");
679
    // ManagerEventsAPI.setFormFocus("profilePicUploadField");
680
681
    // var fileField = document.getElementById('profilePicUploadField');
682
    // var fileDrop = document.getElementById('profilePicUploadDrop');
683
    // var previewImage = document.getElementById('fileUploadPreviewImg');
684
    // var clearBtn = document.getElementById('profilePicUploadClear');
685
    // var uploadBtn = document.getElementById('profilePicUploadBtn');
686
    // CreateEditProfileAPI.profilePicUploader = new ProfilePicAPI.Uploader(
687
    //         [fileField],
688
    //         fileDrop,
689
    //         previewImage,
690
    //         clearBtn,
691
    //         uploadBtn,
692
    //         UserAPI.getSessionUserAsJSON().user_id,
693
    //         CreateEditProfileAPI.onProfilePicUploaded
694
    //     );
695
696
    AccessibilityAPI.focusElement("updateProfileChoosePhotoButtonLabel");
0 ignored issues
show
Bug introduced by
The variable AccessibilityAPI seems to be never declared. If this is a global, consider adding a /** global: AccessibilityAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
697
698
    EventsAPI.hideBodyOverflow(true);
0 ignored issues
show
Bug introduced by
The variable EventsAPI seems to be never declared. If this is a global, consider adding a /** global: EventsAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
699
700
    var fileInputButtons = [document.getElementById('updateProfileChoosePhotoButton'),
701
        document.getElementById('updateProfileChooseAltPhotoButton')];
702
    var fileDrop = document.getElementById('updateProfilePhotoDraggableArea');
703
    var imagePreview = document.getElementById('updateProfilePhotoCroppieContainer');
704
    var clearBtn = document.getElementById('updateProfilePhotoCancelButton');
705
    var uploadBtn = document.getElementById('profilePicUploadBtn');
706
707
    //Don't pass in a save button, because there is no dedicated button for pic uploading.
708
    //The save button must upload photo, as well as profile info.
709
    JobSeekerAPI.profilePicUploader = new ProfilePicAPI.Uploader(
0 ignored issues
show
Bug introduced by
The variable ProfilePicAPI seems to be never declared. If this is a global, consider adding a /** global: ProfilePicAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable JobSeekerAPI seems to be never declared. If this is a global, consider adding a /** global: JobSeekerAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
710
            fileInputButtons,
711
            fileDrop,
712
            imagePreview,
713
            clearBtn,
714
            uploadBtn,
715
            UserAPI.getSessionUserAsJSON().user_id,
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
716
            CreateEditProfileAPI.onProfilePicUploaded
717
            );
718
719
    modalSize();
720
721
};
722
723
CreateEditProfileAPI.hideUploadProfilePic = function () {
724
    document.body.style.overflow = "";
725
    document.body.classList.remove("overFlowHidden");
726
    var uploadOverlay = document.getElementById('profilePicUploadOverlay');
727
    uploadOverlay.classList.add("hidden");
728
    CreateEditProfileAPI.profilePicUploader = null;
729
};
730
731
CreateEditProfileAPI.onProfilePicUploaded = function () {
732
    ProfilePicAPI.refreshUserProfilePic(document.getElementById("managerProfilePic"));
0 ignored issues
show
Bug introduced by
The variable ProfilePicAPI seems to be never declared. If this is a global, consider adding a /** global: ProfilePicAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
733
    CreateEditProfileAPI.hideUploadProfilePic();
734
};
735
736
CreateEditProfileAPI.getManagerProfile = function () {
737
738
    if (UserAPI.hasSessionUser()) {
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
739
        var user = UserAPI.getSessionUserAsJSON();
740
        var user_id = user["user_id"];
0 ignored issues
show
Coding Style introduced by
['user_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
741
        var manager_profile_url = DataAPI.baseURL + "/getManagerProfile/" + user_id;
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
742
        DataAPI.sendRequest(manager_profile_url, 'GET', {}, null, function(request) {
743
            if (request.status === 200) {
744
                CreateEditProfileAPI.populateProfile(request.response);
745
            }
746
        });
747
    }
748
};
749
750
CreateEditProfileAPI.userLoaded = function (response) {
751
    var user_json = JSON.parse(response);
752
    var user = new UserAPI.User();
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
753
    user.id = user_json['id'];
0 ignored issues
show
Coding Style introduced by
['id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
754
755
};
756
757
CreateEditProfileAPI.populateProfile = function (response) {
758
    var manager_profile_with_details_json = JSON.parse(response);
759
760
    var manager_profile_json = manager_profile_with_details_json["manager_profile"];
0 ignored issues
show
Coding Style introduced by
['manager_profile'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
761
762
    var profile_details_json_en = manager_profile_with_details_json["manager_profile_details"]["en_CA"];
0 ignored issues
show
Coding Style introduced by
['manager_profile_details'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
Coding Style introduced by
['en_CA'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
763
    var profile_details_json_fr = manager_profile_with_details_json["manager_profile_details"]["fr_CA"];
0 ignored issues
show
Coding Style introduced by
['manager_profile_details'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
Coding Style introduced by
['fr_CA'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
764
765
    var manager_profile = new CreateEditProfileAPI.ManagerProfile();
766
767
    manager_profile.user_id = manager_profile_json["user_id"];
0 ignored issues
show
Coding Style introduced by
['user_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
768
    manager_profile.user_manager_profile_id = manager_profile_json["user_manager_profile_id"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
769
    manager_profile.user_manager_profile_department_id = manager_profile_json["user_manager_profile_department_id"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_department_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
770
    manager_profile.user_manager_profile_twitter = manager_profile_json["user_manager_profile_twitter"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_twitter'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
771
    manager_profile.user_manager_profile_linkedin = manager_profile_json["user_manager_profile_linkedin"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_linkedin'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
772
773
    var manager_profile_details_en = new CreateEditProfileAPI.ManagerProfileDetails();
774
    var manager_profile_details_fr = new CreateEditProfileAPI.ManagerProfileDetails();
775
776
    manager_profile_details_en.user_manager_profile_details_id = profile_details_json_en["user_manager_profile_details_id"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
777
    manager_profile_details_en.locale_id = profile_details_json_en["locale_id"];
0 ignored issues
show
Coding Style introduced by
['locale_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
778
    manager_profile_details_en.user_manager_profile_details_aboutme = profile_details_json_en["user_manager_profile_details_aboutme"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_aboutme'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
779
    manager_profile_details_fr.user_manager_profile_details_aboutme = profile_details_json_fr["user_manager_profile_details_aboutme"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_aboutme'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
780
    manager_profile_details_en.user_manager_profile_details_proud = profile_details_json_en["user_manager_profile_details_proud"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_proud'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
781
    manager_profile_details_fr.user_manager_profile_details_proud = profile_details_json_fr["user_manager_profile_details_proud"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_proud'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
782
    manager_profile_details_en.user_manager_profile_details_division = profile_details_json_en["user_manager_profile_details_division"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_division'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
783
    manager_profile_details_fr.user_manager_profile_details_division = profile_details_json_fr["user_manager_profile_details_division"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_division'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
784
    manager_profile_details_en.user_manager_profile_details_branch = profile_details_json_en["user_manager_profile_details_branch"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_branch'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
785
    manager_profile_details_fr.user_manager_profile_details_branch = profile_details_json_fr["user_manager_profile_details_branch"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_branch'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
786
    manager_profile_details_en.user_manager_profile_details_position = profile_details_json_en["user_manager_profile_details_position"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_position'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
787
    manager_profile_details_fr.user_manager_profile_details_position = profile_details_json_fr["user_manager_profile_details_position"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_position'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
788
    manager_profile_details_en.user_manager_profile_details_lead_style = profile_details_json_en["user_manager_profile_details_lead_style"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_lead_style'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
789
    manager_profile_details_fr.user_manager_profile_details_lead_style = profile_details_json_fr["user_manager_profile_details_lead_style"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_lead_style'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
790
    manager_profile_details_en.user_manager_profile_details_emp_learn = profile_details_json_en["user_manager_profile_details_emp_learn"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_emp_learn'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
791
    manager_profile_details_fr.user_manager_profile_details_emp_learn = profile_details_json_fr["user_manager_profile_details_emp_learn"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_emp_learn'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
792
    manager_profile_details_en.user_manager_profile_details_expectations = profile_details_json_en["user_manager_profile_details_expectations"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_expectations'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
793
    manager_profile_details_fr.user_manager_profile_details_expectations = profile_details_json_fr["user_manager_profile_details_expectations"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_expectations'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
794
    manager_profile_details_en.user_manager_profile_work_experience = profile_details_json_en["user_manager_profile_work_experience"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_work_experience'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
795
    manager_profile_details_fr.user_manager_profile_work_experience = profile_details_json_fr["user_manager_profile_work_experience"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_work_experience'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
796
    manager_profile_details_en.user_manager_profile_education = profile_details_json_en["user_manager_profile_education"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_education'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
797
    manager_profile_details_fr.user_manager_profile_education = profile_details_json_fr["user_manager_profile_education"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_education'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
798
799
    manager_profile_details_en.user_manager_profile_id = profile_details_json_en["user_manager_profile_id"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
800
    manager_profile_details_en.user_manager_profile_review_options = profile_details_json_en["user_manager_profile_review_options"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_review_options'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
801
    manager_profile_details_en.user_manager_profile_staylate = profile_details_json_en["user_manager_profile_staylate"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_staylate'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
802
    manager_profile_details_en.user_manager_profile_engage = profile_details_json_en["user_manager_profile_engage"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_engage'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
803
    manager_profile_details_en.user_manager_profile_devops = profile_details_json_en["user_manager_profile_devops"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_devops'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
804
    manager_profile_details_en.user_manager_profile_lvwrequests = profile_details_json_en["user_manager_profile_lvwrequests"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_lvwrequests'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
805
806
    //Initialize Work Environment
807
    CreateWorkEnvironmentAPI.initializeWorkEnvironmentForm(manager_profile.user_manager_profile_id);
0 ignored issues
show
Bug introduced by
The variable CreateWorkEnvironmentAPI seems to be never declared. If this is a global, consider adding a /** global: CreateWorkEnvironmentAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
808
809
    //Initialize Team Culture
810
    EditTeamCultureAPI.initializeTeamCultureForm(manager_profile.user_manager_profile_id);
0 ignored issues
show
Bug introduced by
The variable EditTeamCultureAPI seems to be never declared. If this is a global, consider adding a /** global: EditTeamCultureAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
811
812
    //set hidden field values
813
    var UserId = document.getElementById("UserId");
814
    if (manager_profile.user_id) {
815
        UserId.value = manager_profile.user_id;
816
    } else {
817
        UserId.value = "";
818
    }
819
820
    var managerProfileId = document.getElementById("ManagerProfileId");
821
    if (manager_profile.user_manager_profile_id) {
822
        managerProfileId.value = manager_profile.user_manager_profile_id;
823
    } else {
824
        managerProfileId.value = "";
825
    }
826
827
    var managerProfileDetailsId = document.getElementById("ManagerProfileDetailsId");
828
    if (manager_profile_details_en.user_manager_profile_details_id) {
829
        managerProfileDetailsId.value = manager_profile_details_en.user_manager_profile_details_id;
830
    } else {
831
        managerProfileDetailsId.value = "";
832
    }
833
834
    var createEditProfile_name_preview = document.getElementById("createEditProfile_name_preview");
835
    if (UserAPI.hasSessionUser()) {
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
836
        var session_user = UserAPI.getSessionUserAsJSON();
837
        createEditProfile_name_preview.innerHTML = session_user.name;
838
    }
839
840
    if (locale === "en_CA") {
0 ignored issues
show
Bug introduced by
The variable locale seems to be never declared. If this is a global, consider adding a /** global: locale */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
841
        var createEditProfile_position_preview = document.getElementById("createEditProfile_position_preview");
842
        createEditProfile_position_preview.innerHTML = manager_profile_details_en.user_manager_profile_details_position;
843
    } else {
844
        var createEditProfile_position_preview = document.getElementById("createEditProfile_position_preview");
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable createEditProfile_position_preview already seems to be declared on line 841. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Bug introduced by
It seems like createEditProfile_position_preview was already defined.
Loading history...
845
        createEditProfile_position_preview.innerHTML = manager_profile_details_fr.user_manager_profile_details_position;
846
    }
847
848
    //About Me (page 1)
849
    document.getElementById("createEditProfile_bio").value = manager_profile_details_en.user_manager_profile_details_aboutme;
850
    if (manager_profile_details_en.user_manager_profile_details_aboutme) {
851
852
        document.getElementById("createEditProfile_bio").parentElement.classList.add("active");
853
        document.getElementById("createEditProfile_bio").parentElement.classList.add("valid");
854
    } else {
855
        createEditProfile_bio.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_bio seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_bio */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
856
    }
857
858
    document.getElementById("createEditProfile_bio_fr").value = manager_profile_details_fr.user_manager_profile_details_aboutme;
859
    if (manager_profile_details_fr.user_manager_profile_details_aboutme) {
860
        document.getElementById("createEditProfile_bio_fr").parentElement.classList.add("active");
861
        document.getElementById("createEditProfile_bio_fr").parentElement.classList.add("valid");
862
    } else {
863
        createEditProfile_bio_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_bio_fr seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_bio_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
864
    }
865
866
    document.getElementById("createEditProfile_proudOf").value = manager_profile_details_en.user_manager_profile_details_proud;
867
    if (manager_profile_details_en.user_manager_profile_details_proud) {
868
        document.getElementById("createEditProfile_proudOf").parentElement.classList.add("active");
869
        document.getElementById("createEditProfile_proudOf").parentElement.classList.add("valid");
870
    } else {
871
        createEditProfile_proudOf.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_proudOf seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_proudOf */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
872
    }
873
874
    document.getElementById("createEditProfile_proudOf_fr").value = manager_profile_details_fr.user_manager_profile_details_proud;
875
    if (manager_profile_details_fr.user_manager_profile_details_proud) {
876
        document.getElementById("createEditProfile_proudOf_fr").parentElement.classList.add("active");
877
        document.getElementById("createEditProfile_proudOf_fr").parentElement.classList.add("valid");
878
    } else {
879
        createEditProfile_proudOf_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_proudOf_fr seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_proudOf_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
880
    }
881
882
    document.getElementById("createEditProfile_branch").value = manager_profile_details_en.user_manager_profile_details_branch;
883
    if (manager_profile_details_en.user_manager_profile_details_branch) {
884
        document.getElementById("createEditProfile_branch").parentElement.classList.add("active");
885
        document.getElementById("createEditProfile_branch").parentElement.classList.add("valid");
886
    } else {
887
        createEditProfile_branch.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_branch seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_branch */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
888
    }
889
890
    document.getElementById("createEditProfile_branch_fr").value = manager_profile_details_fr.user_manager_profile_details_branch;
891
    if (manager_profile_details_fr.user_manager_profile_details_branch) {
892
        document.getElementById("createEditProfile_branch_fr").parentElement.classList.add("active");
893
        document.getElementById("createEditProfile_branch_fr").parentElement.classList.add("valid");
894
    } else {
895
        createEditProfile_branch_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_branch_fr seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_branch_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
896
    }
897
898
    document.getElementById("createEditProfile_division").value = manager_profile_details_en.user_manager_profile_details_division;
899
    if (manager_profile_details_en.user_manager_profile_details_division) {
900
        document.getElementById("createEditProfile_division").parentElement.classList.add("active");
901
        document.getElementById("createEditProfile_division").parentElement.classList.add("valid");
902
    } else {
903
        createEditProfile_division.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_division seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_division */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
904
    }
905
906
    document.getElementById("createEditProfile_division_fr").value = manager_profile_details_fr.user_manager_profile_details_division;
907
    if (manager_profile_details_fr.user_manager_profile_details_division) {
908
        document.getElementById("createEditProfile_division_fr").parentElement.classList.add("active");
909
        document.getElementById("createEditProfile_division_fr").parentElement.classList.add("valid");
910
    } else {
911
        createEditProfile_division_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_division_fr seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_division_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
912
    }
913
914
    document.getElementById("createEditProfile_position").value = manager_profile_details_en.user_manager_profile_details_position;
915
    if (manager_profile_details_en.user_manager_profile_details_position) {
916
        document.getElementById("createEditProfile_position").parentElement.classList.add("active");
917
        document.getElementById("createEditProfile_position").parentElement.classList.add("valid");
918
    } else {
919
        createEditProfile_position.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_position seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_position */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
920
    }
921
922
    document.getElementById("createEditProfile_position_fr").value = manager_profile_details_fr.user_manager_profile_details_position;
923
    if (manager_profile_details_fr.user_manager_profile_details_position) {
924
        document.getElementById("createEditProfile_position_fr").parentElement.classList.add("active");
925
        document.getElementById("createEditProfile_position_fr").parentElement.classList.add("valid");
926
    } else {
927
        createEditProfile_position_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_position_fr seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_position_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
928
    }
929
930
    document.getElementById("createEditProfile_twitter").value = manager_profile.user_manager_profile_twitter;
931
    if (manager_profile.user_manager_profile_twitter) {
932
        document.getElementById("createEditProfile_twitter").parentElement.classList.add("active");
933
        document.getElementById("createEditProfile_twitter").parentElement.classList.add("valid");
934
    } else {
935
        createEditProfile_twitter.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_twitter seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_twitter */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
936
    }
937
938
    document.getElementById("createEditProfile_linkedin").value = manager_profile.user_manager_profile_linkedin;
939
    if (manager_profile.user_manager_profile_linkedin) {
940
        document.getElementById("createEditProfile_linkedin").parentElement.classList.add("active");
941
        document.getElementById("createEditProfile_linkedin").parentElement.classList.add("valid");
942
    } else {
943
        createEditProfile_linkedin.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_linkedin seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_linkedin */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
944
    }
945
946
    document.getElementById("createEditProfile_department").value = manager_profile.user_manager_profile_department_id;
947
    if (manager_profile.user_manager_profile_department_id) {
948
        document.getElementById("createEditProfile_department").parentElement.classList.add("active");
949
        document.getElementById("createEditProfile_department").parentElement.classList.add("valid");
950
    }
951
952
    //Leadership style (page 2)
953
    document.getElementById("createEditProfile_leadership_style").value = manager_profile_details_en.user_manager_profile_details_lead_style;
954
    if (manager_profile_details_en.user_manager_profile_details_lead_style) {
955
        document.getElementById("createEditProfile_leadership_style").parentElement.classList.add("active");
956
        document.getElementById("createEditProfile_leadership_style").parentElement.classList.add("valid");
957
    } else {
958
        createEditProfile_leadership_style.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_leadership_style seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_leadership_style */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
959
    }
960
961
    document.getElementById("createEditProfile_leadership_style_fr").value = manager_profile_details_fr.user_manager_profile_details_lead_style;
962
    if (manager_profile_details_fr.user_manager_profile_details_lead_style) {
963
        createEditProfile_leadership_style_fr.value = manager_profile_details_fr.user_manager_profile_details_lead_style;
0 ignored issues
show
Bug introduced by
The variable createEditProfile_leadership_style_fr seems to be never declared. If this is a global, consider adding a /** global: createEditPr..._leadership_style_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
964
        document.getElementById("createEditProfile_leadership_style_fr").parentElement.classList.add("active");
965
        document.getElementById("createEditProfile_leadership_style_fr").parentElement.classList.add("valid");
966
    } else {
967
        createEditProfile_leadership_style_fr.value = "";
968
    }
969
970
    document.getElementById("createEditProfile_app_to_employees").value = manager_profile_details_en.user_manager_profile_details_emp_learn;
971
    if (manager_profile_details_en.user_manager_profile_details_emp_learn) {
972
        document.getElementById("createEditProfile_app_to_employees").parentElement.classList.add("active");
973
        document.getElementById("createEditProfile_app_to_employees").parentElement.classList.add("valid");
974
    } else {
975
        createEditProfile_app_to_employees.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_app_to_employees seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_app_to_employees */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
976
    }
977
978
    document.getElementById("createEditProfile_app_to_employees_fr").value = manager_profile_details_fr.user_manager_profile_details_emp_learn;
979
    if (manager_profile_details_fr.user_manager_profile_details_emp_learn) {
980
        document.getElementById("createEditProfile_app_to_employees_fr").parentElement.classList.add("active");
981
        document.getElementById("createEditProfile_app_to_employees_fr").parentElement.classList.add("valid");
982
    } else {
983
        createEditProfile_app_to_employees_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_app_to_employees_fr seems to be never declared. If this is a global, consider adding a /** global: createEditPr..._app_to_employees_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
984
    }
985
986
    document.getElementById("createEditProfile_exp_of_employees").value = manager_profile_details_en.user_manager_profile_details_expectations;
987
    if (manager_profile_details_en.user_manager_profile_details_expectations) {
988
        document.getElementById("createEditProfile_exp_of_employees").parentElement.classList.add("active");
989
        document.getElementById("createEditProfile_exp_of_employees").parentElement.classList.add("valid");
990
    } else {
991
        createEditProfile_exp_of_employees.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_exp_of_employees seems to be never declared. If this is a global, consider adding a /** global: createEditProfile_exp_of_employees */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
992
    }
993
994
    document.getElementById("createEditProfile_exp_of_employees_fr").value = manager_profile_details_fr.user_manager_profile_details_expectations;
995
    if (manager_profile_details_fr.user_manager_profile_details_expectations) {
996
        document.getElementById("createEditProfile_exp_of_employees_fr").parentElement.classList.add("active");
997
        document.getElementById("createEditProfile_exp_of_employees_fr").parentElement.classList.add("valid");
998
    } else {
999
        createEditProfile_exp_of_employees_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable createEditProfile_exp_of_employees_fr seems to be never declared. If this is a global, consider adding a /** global: createEditPr..._exp_of_employees_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1000
    }
1001
1002
    //Multiple choice slider questions
1003
    SliderAPI.selectOptionByValue('createEditProfile_how_often_review_options', manager_profile_details_en.user_manager_profile_review_options, 'review_options');
0 ignored issues
show
Bug introduced by
The variable SliderAPI seems to be never declared. If this is a global, consider adding a /** global: SliderAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1004
    SliderAPI.selectOptionByValue('createEditProfile_staylate', manager_profile_details_en.user_manager_profile_staylate, 'staylate');
1005
    SliderAPI.selectOptionByValue('createEditProfile_engage', manager_profile_details_en.user_manager_profile_engage, 'engage');
1006
    SliderAPI.selectOptionByValue('createEditProfile_devops', manager_profile_details_en.user_manager_profile_devops, 'devops');
1007
    SliderAPI.selectOptionByValue('createEditProfile_lvwrequests', manager_profile_details_en.user_manager_profile_lvwrequests, 'lvwRequests');
1008
    SliderAPI.selectOptionByValue('createEditProfile_telework', manager_profile_details_en.user_manager_profile_telework, 'telework');
1009
    SliderAPI.selectOptionByValue('createEditProfile_flexHours', manager_profile_details_en.user_manager_profile_flexHours, 'flexHours');
1010
1011
    //Other (page 3)
1012
    document.getElementById("user_manager_profile_work_experience").value = manager_profile_details_en.user_manager_profile_work_experience;
1013
    if (manager_profile_details_en.user_manager_profile_work_experience) {
1014
        document.getElementById("user_manager_profile_work_experience").parentElement.classList.add("active");
1015
        document.getElementById("user_manager_profile_work_experience").parentElement.classList.add("valid");
1016
    } else {
1017
        user_manager_profile_work_experience.value = "";
0 ignored issues
show
Bug introduced by
The variable user_manager_profile_work_experience seems to be never declared. If this is a global, consider adding a /** global: user_manager...file_work_experience */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1018
    }
1019
1020
    document.getElementById("user_manager_profile_work_experience_fr").value = manager_profile_details_fr.user_manager_profile_work_experience;
1021
    if (manager_profile_details_fr.user_manager_profile_work_experience) {
1022
        document.getElementById("user_manager_profile_work_experience_fr").parentElement.classList.add("active");
1023
        document.getElementById("user_manager_profile_work_experience_fr").parentElement.classList.add("valid");
1024
    } else {
1025
        user_manager_profile_work_experience_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable user_manager_profile_work_experience_fr seems to be never declared. If this is a global, consider adding a /** global: user_manager...e_work_experience_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1026
    }
1027
1028
    document.getElementById("user_manager_profile_education").value = manager_profile_details_en.user_manager_profile_education;
1029
    if (manager_profile_details_en.user_manager_profile_education) {
1030
        document.getElementById("user_manager_profile_education").parentElement.classList.add("active");
1031
        document.getElementById("user_manager_profile_education").parentElement.classList.add("valid");
1032
    } else {
1033
        user_manager_profile_education.value = "";
0 ignored issues
show
Bug introduced by
The variable user_manager_profile_education seems to be never declared. If this is a global, consider adding a /** global: user_manager_profile_education */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1034
    }
1035
1036
    document.getElementById("user_manager_profile_education_fr").value = manager_profile_details_fr.user_manager_profile_education;
1037
    if (manager_profile_details_fr.user_manager_profile_education) {
1038
        document.getElementById("user_manager_profile_education_fr").parentElement.classList.add("active");
1039
        document.getElementById("user_manager_profile_education_fr").parentElement.classList.add("valid");
1040
    } else {
1041
        user_manager_profile_education_fr.value = "";
0 ignored issues
show
Bug introduced by
The variable user_manager_profile_education_fr seems to be never declared. If this is a global, consider adding a /** global: user_manager_profile_education_fr */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1042
    }
1043
1044
};
1045
1046
1047
// Functions for saving each step of the manager profile
1048
CreateEditProfileAPI.validateAboutMe = function () {
1049
    var valid = true;
1050
1051
    if (valid) {
1052
        Utilities.debug ? console.log(CreateEditProfileAPI.managerProfileObj) : null;
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
1053
        CreateEditProfileAPI.updateManagerProfileWithDetails();
1054
    }
1055
    CreateEditProfileAPI.goToStep('createEditProfile_step2');
1056
}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
1057
1058
CreateEditProfileAPI.validateLeadership = function () {
1059
    var valid = true;
1060
1061
    if (valid) {
1062
        Utilities.debug ? console.log(CreateEditProfileAPI.managerProfileObj) : null;
0 ignored issues
show
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
1063
        CreateEditProfileAPI.updateManagerProfileWithDetails();
1064
    }
1065
    CreateEditProfileAPI.goToStep('createEditProfile_workEnvironment');
1066
}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
1067
1068
CreateEditProfileAPI.validateWorkEnvironment = function () {
1069
    var valid = true;
1070
1071
    if (valid) {
1072
        var managerProfileId = document.getElementById("ManagerProfileId").value;
1073
        CreateWorkEnvironmentAPI.saveWorkEnvironment(managerProfileId);
0 ignored issues
show
Bug introduced by
The variable CreateWorkEnvironmentAPI seems to be never declared. If this is a global, consider adding a /** global: CreateWorkEnvironmentAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1074
    }
1075
    CreateEditProfileAPI.goToStep('createEditProfile_teamCulture');
1076
}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
1077
1078
CreateEditProfileAPI.validateTeamCulture = function () {
1079
    var valid = true;
1080
1081
    if (valid) {
1082
        var managerProfileId = document.getElementById("ManagerProfileId").value;
1083
        EditTeamCultureAPI.submitTeamCulture(managerProfileId);
0 ignored issues
show
Bug introduced by
The variable EditTeamCultureAPI seems to be never declared. If this is a global, consider adding a /** global: EditTeamCultureAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1084
    }
1085
    CreateEditProfileAPI.goToStep('createEditProfile_step3');
1086
}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
1087
1088
CreateEditProfileAPI.validateOther = function () {
1089
    var valid = true;
1090
1091
    if (valid) {
1092
        Utilities.debug ? console.log(CreateEditProfileAPI.managerProfileObj) : null;
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
Configuration introduced by
There were too many errors found in this file; checking aborted after 99%.

If JSHint finds too many errors in a file, it aborts checking altogether because it suspects a configuration issue.

Further Reading:

Loading history...
1093
        CreateEditProfileAPI.updateManagerProfileWithDetails();
1094
    }
1095
}
1096