1
|
|
|
import React, { useState } from "react"; |
2
|
|
|
import { useIntl, FormattedMessage, defineMessages } from "react-intl"; |
3
|
|
|
import { |
4
|
|
|
User, |
5
|
|
|
Job, |
6
|
|
|
Criteria, |
7
|
|
|
Experience, |
8
|
|
|
Skill, |
9
|
|
|
ExperienceSkill, |
10
|
|
|
JobPosterQuestion, |
11
|
|
|
JobApplicationAnswer, |
12
|
|
|
ApplicationNormalized, |
13
|
|
|
} from "../../../models/types"; |
14
|
|
|
import { languageRequirementDescription } from "../../../models/localizedConstants"; |
15
|
|
|
import { |
16
|
|
|
LanguageRequirementId, |
17
|
|
|
SkillTypeId, |
18
|
|
|
} from "../../../models/lookupConstants"; |
19
|
|
|
import { |
20
|
|
|
basicInfoMessages, |
21
|
|
|
experienceMessages, |
22
|
|
|
fitMessages, |
23
|
|
|
} from "../applicationMessages"; |
24
|
|
|
import defaultBasicMessages, { |
25
|
|
|
citizenshipDeclaration, |
26
|
|
|
languageRequirementLabel, |
27
|
|
|
veteranStatus, |
28
|
|
|
} from "../BasicInfo/basicInfoMessages"; |
29
|
|
|
import ExperienceAwardAccordion from "../ExperienceAccordions/ExperienceAwardAccordion"; |
30
|
|
|
import ExperienceCommunityAccordion from "../ExperienceAccordions/ExperienceCommunityAccordion"; |
31
|
|
|
import ExperienceEducationAccordion from "../ExperienceAccordions/ExperienceEducationAccordion"; |
32
|
|
|
import ExperiencePersonalAccordion from "../ExperienceAccordions/ExperiencePersonalAccordion"; |
33
|
|
|
import ExperienceWorkAccordion from "../ExperienceAccordions/ExperienceWorkAccordion"; |
34
|
|
|
import SkillAccordion from "./SkillAccordion"; |
35
|
|
|
import { |
36
|
|
|
getLocale, |
37
|
|
|
localizeField, |
38
|
|
|
localizeFieldNonNull, |
39
|
|
|
} from "../../../helpers/localize"; |
40
|
|
|
import { getSkillOfCriteria, getRelevantExpSkills } from "../helpers"; |
41
|
|
|
import { getSkillLevelName } from "../../../models/jobUtil"; |
42
|
|
|
import { Link } from "../../../helpers/router"; |
43
|
|
|
import { |
44
|
|
|
accountSettings, |
45
|
|
|
applicationBasic, |
46
|
|
|
applicationExperience, |
47
|
|
|
applicationFit, |
48
|
|
|
} from "../../../helpers/routes"; |
49
|
|
|
|
50
|
|
|
const messages = defineMessages({ |
51
|
|
|
edit: { |
52
|
|
|
id: "application.review.edit", |
53
|
|
|
defaultMessage: "Edit", |
54
|
|
|
description: "Link text for editing a section.", |
55
|
|
|
}, |
56
|
|
|
editTitle: { |
57
|
|
|
id: "application.review.editTitle", |
58
|
|
|
defaultMessage: "Edit this section.", |
59
|
|
|
description: "Link title for editing a section.", |
60
|
|
|
}, |
61
|
|
|
valueNotSet: { |
62
|
|
|
id: "application.review.valueNotSet", |
63
|
|
|
defaultMessage: "Not set", |
64
|
|
|
description: "Message displayed if a user has not yet set a given value.", |
65
|
|
|
}, |
66
|
|
|
communicationEn: { |
67
|
|
|
id: "application.review.communication.english", |
68
|
|
|
defaultMessage: "I prefer to communicate in English.", |
69
|
|
|
description: |
70
|
|
|
"Text displayed when a user selects 'en' in their profile for communication preference.", |
71
|
|
|
}, |
72
|
|
|
communicationFr: { |
73
|
|
|
id: "application.review.communication.french", |
74
|
|
|
defaultMessage: "I prefer to communicate in French.", |
75
|
|
|
description: |
76
|
|
|
"Text displayed when a user selects 'fr' in their profile for communication preference.", |
77
|
|
|
}, |
78
|
|
|
communicationNotSet: { |
79
|
|
|
id: "application.review.communication.notSet", |
80
|
|
|
defaultMessage: |
81
|
|
|
"You haven't set a communication language preference in your profile yet.", |
82
|
|
|
description: |
83
|
|
|
"Text displayed if a user has not yet selected a communication preference in their profile.", |
84
|
|
|
}, |
85
|
|
|
requiredSkillLabel: { |
86
|
|
|
id: "application.review.requiredSkillLabel", |
87
|
|
|
defaultMessage: "Required", |
88
|
|
|
description: "Text displayed before skill level.", |
89
|
|
|
}, |
90
|
|
|
}); |
91
|
|
|
|
92
|
|
|
const submittedApplicationHeaders = defineMessages({ |
93
|
|
|
basicInfo: { |
94
|
|
|
id: "application.review.manager.basicInfoHeading", |
95
|
|
|
defaultMessage: "Basic Information", |
96
|
|
|
description: |
97
|
|
|
"Manager's heading for the Basic Info section of the Application.", |
98
|
|
|
}, |
99
|
|
|
experience: { |
100
|
|
|
id: "application.review.manager.experienceHeading", |
101
|
|
|
defaultMessage: "Experience", |
102
|
|
|
description: |
103
|
|
|
"Manager's heading for the Experience section of the Application.", |
104
|
|
|
}, |
105
|
|
|
fit: { |
106
|
|
|
id: "application.review.manager.fitHeading", |
107
|
|
|
defaultMessage: "Fit", |
108
|
|
|
description: "Manager's heading for the Fit section of the Application.", |
109
|
|
|
}, |
110
|
|
|
accountSettings: { |
111
|
|
|
id: "application.review.manager.accountSettingsHeading", |
112
|
|
|
defaultMessage: "Account Settings", |
113
|
|
|
description: |
114
|
|
|
"Manager's heading for the Account Settings section of the Application.", |
115
|
|
|
}, |
116
|
|
|
}); |
117
|
|
|
|
118
|
|
|
interface ExperienceAccordionProps { |
119
|
|
|
experience: Experience; |
120
|
|
|
experienceSkills: ExperienceSkill[]; |
121
|
|
|
skills: Skill[]; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
const ExperienceAccordion: React.FC<ExperienceAccordionProps> = ({ |
125
|
|
|
experience, |
126
|
|
|
experienceSkills, |
127
|
|
|
skills, |
128
|
|
|
}) => { |
129
|
|
|
switch (experience.type) { |
130
|
|
|
case "experience_award": |
131
|
|
|
return ( |
132
|
|
|
<ExperienceAwardAccordion |
133
|
|
|
experience={experience} |
134
|
|
|
relevantSkills={experienceSkills} |
135
|
|
|
skills={skills} |
136
|
|
|
irrelevantSkillCount={0} |
137
|
|
|
showSkillDetails |
138
|
|
|
showButtons={false} |
139
|
|
|
handleEdit={(): void => {}} |
140
|
|
|
handleDelete={async (): Promise<void> => {}} |
141
|
|
|
/> |
142
|
|
|
); |
143
|
|
|
case "experience_community": |
144
|
|
|
return ( |
145
|
|
|
<ExperienceCommunityAccordion |
146
|
|
|
experience={experience} |
147
|
|
|
relevantSkills={experienceSkills} |
148
|
|
|
skills={skills} |
149
|
|
|
irrelevantSkillCount={0} |
150
|
|
|
showSkillDetails |
151
|
|
|
showButtons={false} |
152
|
|
|
handleEdit={(): void => {}} |
153
|
|
|
handleDelete={async (): Promise<void> => {}} |
154
|
|
|
/> |
155
|
|
|
); |
156
|
|
|
case "experience_education": |
157
|
|
|
return ( |
158
|
|
|
<ExperienceEducationAccordion |
159
|
|
|
experience={experience} |
160
|
|
|
relevantSkills={experienceSkills} |
161
|
|
|
skills={skills} |
162
|
|
|
irrelevantSkillCount={0} |
163
|
|
|
showSkillDetails |
164
|
|
|
showButtons={false} |
165
|
|
|
handleDelete={async (): Promise<void> => {}} |
166
|
|
|
handleEdit={(): void => {}} |
167
|
|
|
/> |
168
|
|
|
); |
169
|
|
|
case "experience_personal": |
170
|
|
|
return ( |
171
|
|
|
<ExperiencePersonalAccordion |
172
|
|
|
experience={experience} |
173
|
|
|
relevantSkills={experienceSkills} |
174
|
|
|
skills={skills} |
175
|
|
|
irrelevantSkillCount={0} |
176
|
|
|
showSkillDetails |
177
|
|
|
showButtons={false} |
178
|
|
|
handleEdit={(): void => {}} |
179
|
|
|
handleDelete={async (): Promise<void> => {}} |
180
|
|
|
/> |
181
|
|
|
); |
182
|
|
|
case "experience_work": |
183
|
|
|
return ( |
184
|
|
|
<ExperienceWorkAccordion |
185
|
|
|
experience={experience} |
186
|
|
|
relevantSkills={experienceSkills} |
187
|
|
|
skills={skills} |
188
|
|
|
irrelevantSkillCount={0} |
189
|
|
|
showSkillDetails |
190
|
|
|
showButtons={false} |
191
|
|
|
handleEdit={(): void => {}} |
192
|
|
|
handleDelete={async (): Promise<void> => {}} |
193
|
|
|
/> |
194
|
|
|
); |
195
|
|
|
default: |
196
|
|
|
return null; |
197
|
|
|
} |
198
|
|
|
}; |
199
|
|
|
|
200
|
|
|
export type ExperienceView = "experience" | "skills" | "education"; |
201
|
|
|
|
202
|
|
|
interface ApplicationPreviewProps { |
203
|
|
|
application: ApplicationNormalized; |
204
|
|
|
criteria: Criteria[]; |
205
|
|
|
experiences: Experience[]; |
206
|
|
|
experienceSkills: ExperienceSkill[]; |
207
|
|
|
experienceViewState?: ExperienceView; |
208
|
|
|
experienceViewButtonOrder?: [ExperienceView, ExperienceView, ExperienceView]; |
209
|
|
|
job: Job; |
210
|
|
|
jobQuestions: JobPosterQuestion[]; |
211
|
|
|
jobApplicationAnswers: JobApplicationAnswer[]; |
212
|
|
|
skills: Skill[]; |
213
|
|
|
user: User; |
214
|
|
|
isSubmitted?: boolean; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
const ApplicationPreview: React.FunctionComponent<ApplicationPreviewProps> = ({ |
218
|
|
|
application, |
219
|
|
|
criteria, |
220
|
|
|
experiences, |
221
|
|
|
experienceSkills, |
222
|
|
|
experienceViewState, |
223
|
|
|
experienceViewButtonOrder, |
224
|
|
|
job, |
225
|
|
|
jobQuestions, |
226
|
|
|
jobApplicationAnswers, |
227
|
|
|
isSubmitted, |
228
|
|
|
skills, |
229
|
|
|
user, |
230
|
|
|
children, |
231
|
|
|
}) => { |
232
|
|
|
const intl = useIntl(); |
233
|
|
|
const locale = getLocale(intl.locale); |
234
|
|
|
const [experienceView, setExperienceView] = useState<ExperienceView>( |
235
|
|
|
experienceViewState || "experience", |
236
|
|
|
); |
237
|
|
|
|
238
|
|
|
const hardCriteria = criteria |
239
|
|
|
.filter((criterion) => { |
240
|
|
|
const skill = getSkillOfCriteria(criterion, skills); |
241
|
|
|
return skill?.skill_type_id === SkillTypeId.Hard; |
242
|
|
|
}) |
243
|
|
|
.sort((a, b) => { |
244
|
|
|
const skillA = getSkillOfCriteria(a, skills); |
245
|
|
|
const skillB = getSkillOfCriteria(b, skills); |
246
|
|
|
// Order by essential followed by asset. |
247
|
|
|
if (a.criteria_type_id > b.criteria_type_id) { |
248
|
|
|
return 1; |
249
|
|
|
} |
250
|
|
|
if (a.criteria_type_id < b.criteria_type_id) { |
251
|
|
|
return -1; |
252
|
|
|
} |
253
|
|
|
// Order by skill name alphabetically. |
254
|
|
|
if (skillA && skillB) { |
255
|
|
|
if ( |
256
|
|
|
localizeFieldNonNull(locale, skillA, "name").toUpperCase() > |
257
|
|
|
localizeFieldNonNull(locale, skillB, "name").toUpperCase() |
258
|
|
|
) { |
259
|
|
|
return 1; |
260
|
|
|
} |
261
|
|
|
if ( |
262
|
|
|
localizeFieldNonNull(locale, skillA, "name").toUpperCase() < |
263
|
|
|
localizeFieldNonNull(locale, skillB, "name").toUpperCase() |
264
|
|
|
) { |
265
|
|
|
return -1; |
266
|
|
|
} |
267
|
|
|
} |
268
|
|
|
return 0; |
269
|
|
|
}); |
270
|
|
|
|
271
|
|
|
const handleViewClick = (e: React.MouseEvent<HTMLButtonElement>): void => { |
272
|
|
|
const viewType: ExperienceView = e.currentTarget.getAttribute( |
273
|
|
|
"data-experience-view", |
274
|
|
|
) as ExperienceView; |
275
|
|
|
if (viewType !== null) { |
276
|
|
|
setExperienceView(viewType); |
277
|
|
|
} |
278
|
|
|
}; |
279
|
|
|
|
280
|
|
|
const experienceViewButtons = ( |
281
|
|
|
buttonOrder = ["experience", "skills", "education"], |
282
|
|
|
): JSX.Element => { |
283
|
|
|
const experienceButton = ( |
284
|
|
|
<button |
285
|
|
|
data-c-button={`${ |
286
|
|
|
experienceView === "experience" ? "solid" : "outline" |
287
|
|
|
}(c1)`} |
288
|
|
|
type="button" |
289
|
|
|
data-c-radius="rounded" |
290
|
|
|
data-c-margin="right(.5)" |
291
|
|
|
className="gtag-application-review-all-experience" |
292
|
|
|
data-experience-view="experience" |
293
|
|
|
onClick={handleViewClick} |
294
|
|
|
key="experienceButton" |
295
|
|
|
> |
296
|
|
|
<FormattedMessage |
297
|
|
|
id="application.review.experienceViewButton" |
298
|
|
|
defaultMessage="All Experience" |
299
|
|
|
description="Button text for the experience view of the Review page." |
300
|
|
|
/> |
301
|
|
|
</button> |
302
|
|
|
); |
303
|
|
|
const skillsButton = ( |
304
|
|
|
<button |
305
|
|
|
data-c-button={`${ |
306
|
|
|
experienceView === "skills" ? "solid" : "outline" |
307
|
|
|
}(c1)`} |
308
|
|
|
type="button" |
309
|
|
|
data-c-radius="rounded" |
310
|
|
|
data-c-margin="right(.5)" |
311
|
|
|
className="gtag-application-review-skill-experience" |
312
|
|
|
data-experience-view="skills" |
313
|
|
|
onClick={handleViewClick} |
314
|
|
|
key="skillsButton" |
315
|
|
|
> |
316
|
|
|
<FormattedMessage |
317
|
|
|
id="application.review.skillsViewButton" |
318
|
|
|
defaultMessage="Skills for This Job" |
319
|
|
|
description="Button text for the skills view of the Review page." |
320
|
|
|
/> |
321
|
|
|
</button> |
322
|
|
|
); |
323
|
|
|
const educationButton = ( |
324
|
|
|
<button |
325
|
|
|
data-c-button={`${ |
326
|
|
|
experienceView === "education" ? "solid" : "outline" |
327
|
|
|
}(c1)`} |
328
|
|
|
type="button" |
329
|
|
|
data-c-radius="rounded" |
330
|
|
|
data-c-margin="right(.5)" |
331
|
|
|
className="gtag-application-review-education-experience" |
332
|
|
|
data-experience-view="education" |
333
|
|
|
onClick={handleViewClick} |
334
|
|
|
key="educationButton" |
335
|
|
|
> |
336
|
|
|
<FormattedMessage |
337
|
|
|
id="application.review.educationViewButton" |
338
|
|
|
defaultMessage="Education Requirements for This Job" |
339
|
|
|
description="Button text for the education view of the Review page." |
340
|
|
|
/> |
341
|
|
|
</button> |
342
|
|
|
); |
343
|
|
|
|
344
|
|
|
const buttonView = buttonOrder.map((button) => { |
345
|
|
|
switch (button) { |
346
|
|
|
case "experience": |
347
|
|
|
return experienceButton; |
348
|
|
|
case "skills": |
349
|
|
|
return skillsButton; |
350
|
|
|
case "education": |
351
|
|
|
return educationButton; |
352
|
|
|
default: |
353
|
|
|
return null; |
354
|
|
|
} |
355
|
|
|
}); |
356
|
|
|
|
357
|
|
|
return <>{buttonView}</>; |
358
|
|
|
}; |
359
|
|
|
|
360
|
|
|
return ( |
361
|
|
|
<div data-c-container="medium"> |
362
|
|
|
{!isSubmitted && ( |
363
|
|
|
<> |
364
|
|
|
<h2 |
365
|
|
|
data-c-heading="h2" |
366
|
|
|
data-c-margin={!isSubmitted ? "top(3) bottom(1)" : "bottom(1)"} |
367
|
|
|
> |
368
|
|
|
<FormattedMessage |
369
|
|
|
id="application.review.heading" |
370
|
|
|
defaultMessage="Review Your Application" |
371
|
|
|
description="Main page heading for the Review page." |
372
|
|
|
/> |
373
|
|
|
</h2> |
374
|
|
|
<p data-c-margin="bottom(1)"> |
375
|
|
|
<FormattedMessage |
376
|
|
|
id="application.review.subheadingOne" |
377
|
|
|
defaultMessage="Take one last look at your information before you submit it." |
378
|
|
|
description="First line of the subheading for the Review page." |
379
|
|
|
/> |
380
|
|
|
</p> |
381
|
|
|
<p data-c-margin="bottom(1)"> |
382
|
|
|
<FormattedMessage |
383
|
|
|
id="application.review.subheadingTwo" |
384
|
|
|
defaultMessage="Make sure everything you've said is as honest and accurate as possible." |
385
|
|
|
description="Second line of the subheading for the Review page." |
386
|
|
|
/> |
387
|
|
|
</p> |
388
|
|
|
<p data-c-margin="bottom(2)"> |
389
|
|
|
<FormattedMessage |
390
|
|
|
id="application.review.subheadingThree" |
391
|
|
|
defaultMessage={`Ask yourself, "If I was a manager, and I knew nothing about the applicant other than this application, would I think they could do a good job?"`} |
392
|
|
|
description="Third line of the subheading for the Review page." |
393
|
|
|
/> |
394
|
|
|
</p> |
395
|
|
|
</> |
396
|
|
|
)} |
397
|
|
|
<div data-c-grid="gutter(all, 1) middle"> |
398
|
|
|
<div data-c-grid-item="tp(2of3) tl(4of5)" data-c-margin="top(2)"> |
399
|
|
|
<h3 data-c-font-size="h3"> |
400
|
|
|
{!isSubmitted |
401
|
|
|
? intl.formatMessage(basicInfoMessages.heading) |
402
|
|
|
: intl.formatMessage(submittedApplicationHeaders.basicInfo)} |
403
|
|
|
</h3> |
404
|
|
|
</div> |
405
|
|
|
{!isSubmitted && ( |
406
|
|
|
<div |
407
|
|
|
data-c-grid-item="tp(1of3) tl(1of5)" |
408
|
|
|
data-c-align="base(center) tp(right)" |
409
|
|
|
> |
410
|
|
|
<Link |
411
|
|
|
href={applicationBasic(locale, application.id)} |
412
|
|
|
title={intl.formatMessage(messages.editTitle)} |
413
|
|
|
data-c-color="c2" |
414
|
|
|
data-c-font-weight="bold" |
415
|
|
|
> |
416
|
|
|
{intl.formatMessage(messages.edit)} |
417
|
|
|
</Link> |
418
|
|
|
</div> |
419
|
|
|
)} |
420
|
|
|
</div> |
421
|
|
|
<hr data-c-hr="thin(gray)" data-c-margin="top(1)" /> |
422
|
|
|
<p |
423
|
|
|
data-c-font-weight="bold" |
424
|
|
|
data-c-color="c2" |
425
|
|
|
data-c-margin="top(1) bottom(.5)" |
426
|
|
|
> |
427
|
|
|
{intl.formatMessage(basicInfoMessages.citizenshipLabel)} |
428
|
|
|
</p> |
429
|
|
|
<p> |
430
|
|
|
{application.citizenship_declaration_id |
431
|
|
|
? intl.formatMessage( |
432
|
|
|
citizenshipDeclaration(application.citizenship_declaration_id), |
433
|
|
|
) |
434
|
|
|
: intl.formatMessage(messages.valueNotSet)} |
435
|
|
|
</p> |
436
|
|
|
<p |
437
|
|
|
data-c-font-weight="bold" |
438
|
|
|
data-c-color="c2" |
439
|
|
|
data-c-margin="top(1) bottom(.5)" |
440
|
|
|
> |
441
|
|
|
{intl.formatMessage(basicInfoMessages.veteranStatusLabel)} |
442
|
|
|
</p> |
443
|
|
|
<p> |
444
|
|
|
{application.veteran_status_id |
445
|
|
|
? intl.formatMessage(veteranStatus(application.veteran_status_id)) |
446
|
|
|
: intl.formatMessage(messages.valueNotSet)} |
447
|
|
|
</p> |
448
|
|
|
<p |
449
|
|
|
data-c-font-weight="bold" |
450
|
|
|
data-c-color="c2" |
451
|
|
|
data-c-margin="top(1) bottom(.5)" |
452
|
|
|
> |
453
|
|
|
{intl.formatMessage(basicInfoMessages.languageRequirementsHeading)} |
454
|
|
|
</p> |
455
|
|
|
<p data-c-margin="bottom(.5)"> |
456
|
|
|
{job.language_requirement_id && |
457
|
|
|
intl.formatMessage( |
458
|
|
|
languageRequirementDescription(job.language_requirement_id), |
459
|
|
|
)} |
460
|
|
|
</p> |
461
|
|
|
{job.language_requirement_id && |
462
|
|
|
application.language_requirement_confirmed && ( |
463
|
|
|
<p data-c-margin="bottom(.5)"> |
464
|
|
|
<i |
465
|
|
|
className="fas fa-check" |
466
|
|
|
data-c-color="go" |
467
|
|
|
data-c-margin="right(.25)" |
468
|
|
|
/> |
469
|
|
|
{intl.formatMessage( |
470
|
|
|
languageRequirementLabel(job.language_requirement_id), |
471
|
|
|
)} |
472
|
|
|
</p> |
473
|
|
|
)} |
474
|
|
|
{(job.language_requirement_id === |
475
|
|
|
LanguageRequirementId.bilingualIntermediate || |
476
|
|
|
job.language_requirement_id === |
477
|
|
|
LanguageRequirementId.bilingualAdvanced) && |
478
|
|
|
application.language_test_confirmed && ( |
479
|
|
|
<p> |
480
|
|
|
<i |
481
|
|
|
className="fas fa-check" |
482
|
|
|
data-c-color="go" |
483
|
|
|
data-c-margin="right(.25)" |
484
|
|
|
/> |
485
|
|
|
{intl.formatMessage(defaultBasicMessages.languageTestLabel)} |
486
|
|
|
</p> |
487
|
|
|
)} |
488
|
|
|
<div data-c-grid="gutter(all, 1) middle" data-c-padding="top(2)"> |
489
|
|
|
<div data-c-grid-item="tp(2of3) tl(4of5)"> |
490
|
|
|
<h3 data-c-font-size="h3"> |
491
|
|
|
{!isSubmitted |
492
|
|
|
? intl.formatMessage(experienceMessages.heading) |
493
|
|
|
: intl.formatMessage(submittedApplicationHeaders.experience)} |
494
|
|
|
</h3> |
495
|
|
|
</div> |
496
|
|
|
{!isSubmitted && ( |
497
|
|
|
<div |
498
|
|
|
data-c-grid-item="tp(1of3) tl(1of5)" |
499
|
|
|
data-c-align="base(center) tp(right)" |
500
|
|
|
> |
501
|
|
|
<Link |
502
|
|
|
href={applicationExperience(locale, application.id)} |
503
|
|
|
title={intl.formatMessage(messages.editTitle)} |
504
|
|
|
data-c-color="c2" |
505
|
|
|
data-c-font-weight="bold" |
506
|
|
|
> |
507
|
|
|
{intl.formatMessage(messages.edit)} |
508
|
|
|
</Link> |
509
|
|
|
</div> |
510
|
|
|
)} |
511
|
|
|
</div> |
512
|
|
|
<hr data-c-hr="thin(gray)" data-c-margin="tb(1)" /> |
513
|
|
|
<p data-c-padding="bottom(.5)" data-c-font-weight="bold"> |
514
|
|
|
<FormattedMessage |
515
|
|
|
id="application.review.changeViewHeading" |
516
|
|
|
defaultMessage="Change Your View:" |
517
|
|
|
description="Heading for the Review section with the buttons to change the layout." |
518
|
|
|
/> |
519
|
|
|
</p> |
520
|
|
|
<div data-c-padding="bottom(1)"> |
521
|
|
|
{experienceViewButtons(experienceViewButtonOrder)} |
522
|
|
|
</div> |
523
|
|
|
{experienceView === "experience" && ( |
524
|
|
|
<div className="experience-list"> |
525
|
|
|
<p data-c-margin="bottom(1)"> |
526
|
|
|
<FormattedMessage |
527
|
|
|
id="application.review.experienceViewHeading" |
528
|
|
|
defaultMessage="This view is a summary of all the experiences you will be sending as a part of your application." |
529
|
|
|
description="Heading for the experience view section of the Review page." |
530
|
|
|
/> |
531
|
|
|
</p> |
532
|
|
|
<div data-c-accordion-group=""> |
533
|
|
|
{experiences.map((experience) => { |
534
|
|
|
const relevantSkills = getRelevantExpSkills( |
535
|
|
|
hardCriteria, |
536
|
|
|
experience, |
537
|
|
|
experienceSkills, |
538
|
|
|
); |
539
|
|
|
return ( |
540
|
|
|
<ExperienceAccordion |
541
|
|
|
key={`${experience.type}-${experience.id}`} |
542
|
|
|
experience={experience} |
543
|
|
|
experienceSkills={relevantSkills} |
544
|
|
|
skills={skills} |
545
|
|
|
/> |
546
|
|
|
); |
547
|
|
|
})} |
548
|
|
|
</div> |
549
|
|
|
</div> |
550
|
|
|
)} |
551
|
|
|
{experienceView === "skills" && ( |
552
|
|
|
<div className="experience-list"> |
553
|
|
|
<p data-c-margin="bottom(1)"> |
554
|
|
|
<FormattedMessage |
555
|
|
|
id="application.review.skillsViewHeading" |
556
|
|
|
defaultMessage="This view organizes your experiences by the skills required for this job." |
557
|
|
|
description="Heading for the skills view section of the Review page." |
558
|
|
|
/> |
559
|
|
|
</p> |
560
|
|
|
<div data-c-accordion-group=""> |
561
|
|
|
{hardCriteria.map((criterion) => { |
562
|
|
|
const skillOfCriterion = getSkillOfCriteria(criterion, skills); |
563
|
|
|
|
564
|
|
|
if (skillOfCriterion !== null) { |
565
|
|
|
let skillLevel = intl.formatMessage( |
566
|
|
|
getSkillLevelName(criterion, skillOfCriterion), |
567
|
|
|
); |
568
|
|
|
if (criterion.criteria_type_id === 1) { |
569
|
|
|
skillLevel = `${intl.formatMessage( |
570
|
|
|
messages.requiredSkillLabel, |
571
|
|
|
)} - ${skillLevel}`; |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
const experiencesOfCriterion = experienceSkills.filter( |
575
|
|
|
(experienceSkill) => |
576
|
|
|
experienceSkill.skill_id === criterion.skill_id, |
577
|
|
|
); |
578
|
|
|
|
579
|
|
|
const relevantExperiences = experiences.filter((experience) => |
580
|
|
|
experiencesOfCriterion.some( |
581
|
|
|
(experienceSkill) => |
582
|
|
|
experienceSkill.experience_id === experience.id && |
583
|
|
|
experienceSkill.experience_type === experience.type, |
584
|
|
|
), |
585
|
|
|
); |
586
|
|
|
|
587
|
|
|
return ( |
588
|
|
|
<SkillAccordion |
589
|
|
|
key={criterion.id} |
590
|
|
|
skill={skillOfCriterion} |
591
|
|
|
skillLevel={skillLevel} |
592
|
|
|
experiences={relevantExperiences} |
593
|
|
|
experienceSkills={experiencesOfCriterion} |
594
|
|
|
/> |
595
|
|
|
); |
596
|
|
|
} |
597
|
|
|
return null; |
598
|
|
|
})} |
599
|
|
|
</div> |
600
|
|
|
</div> |
601
|
|
|
)} |
602
|
|
|
{experienceView === "education" && ( |
603
|
|
|
<div className="experience-list"> |
604
|
|
|
<p data-c-margin="bottom(1)"> |
605
|
|
|
<FormattedMessage |
606
|
|
|
id="application.review.educationViewHeading" |
607
|
|
|
defaultMessage="This view is a summary of all the experiences you have selected that help you meet the education requirements outlined below." |
608
|
|
|
description="Heading for the education view section of the Review page." |
609
|
|
|
/> |
610
|
|
|
</p> |
611
|
|
|
<div |
612
|
|
|
data-c-background="gray(20)" |
613
|
|
|
data-c-radius="rounded" |
614
|
|
|
data-c-padding="all(1)" |
615
|
|
|
data-c-margin="bottom(1)" |
616
|
|
|
> |
617
|
|
|
<p>{localizeField(locale, job, "education")}</p> |
618
|
|
|
</div> |
619
|
|
|
<div data-c-accordion-group=""> |
620
|
|
|
{experiences |
621
|
|
|
.filter((experience) => experience.is_education_requirement) |
622
|
|
|
.map((educationExperience) => { |
623
|
|
|
const relevantSkills = getRelevantExpSkills( |
624
|
|
|
hardCriteria, |
625
|
|
|
educationExperience, |
626
|
|
|
experienceSkills, |
627
|
|
|
); |
628
|
|
|
return ( |
629
|
|
|
<ExperienceAccordion |
630
|
|
|
key={`${educationExperience.type}-${educationExperience.id}-edu`} |
631
|
|
|
experience={educationExperience} |
632
|
|
|
experienceSkills={relevantSkills} |
633
|
|
|
skills={skills} |
634
|
|
|
/> |
635
|
|
|
); |
636
|
|
|
})} |
637
|
|
|
</div> |
638
|
|
|
</div> |
639
|
|
|
)} |
640
|
|
|
<div data-c-grid="gutter(all, 1) middle" data-c-padding="top(2)"> |
641
|
|
|
<div data-c-grid-item="tp(2of3) tl(4of5)"> |
642
|
|
|
<h3 data-c-font-size="h3"> |
643
|
|
|
{!isSubmitted |
644
|
|
|
? intl.formatMessage(fitMessages.heading) |
645
|
|
|
: intl.formatMessage(submittedApplicationHeaders.fit)} |
646
|
|
|
</h3> |
647
|
|
|
</div> |
648
|
|
|
{!isSubmitted && ( |
649
|
|
|
<div |
650
|
|
|
data-c-grid-item="tp(1of3) tl(1of5)" |
651
|
|
|
data-c-align="base(center) tp(right)" |
652
|
|
|
> |
653
|
|
|
<Link |
654
|
|
|
href={applicationFit(locale, application.id)} |
655
|
|
|
title={intl.formatMessage(messages.editTitle)} |
656
|
|
|
data-c-color="c2" |
657
|
|
|
data-c-font-weight="bold" |
658
|
|
|
> |
659
|
|
|
{intl.formatMessage(messages.edit)} |
660
|
|
|
</Link> |
661
|
|
|
</div> |
662
|
|
|
)} |
663
|
|
|
</div> |
664
|
|
|
<hr data-c-hr="thin(gray)" data-c-margin="top(1)" /> |
665
|
|
|
{jobQuestions.map((jobQuestion, index) => { |
666
|
|
|
const answer = jobApplicationAnswers.find( |
667
|
|
|
(appAnswer) => appAnswer.job_poster_question_id === jobQuestion.id, |
668
|
|
|
); |
669
|
|
|
return ( |
670
|
|
|
<> |
671
|
|
|
<p |
672
|
|
|
data-c-font-weight="bold" |
673
|
|
|
data-c-color="c2" |
674
|
|
|
data-c-margin="top(1) bottom(.5)" |
675
|
|
|
> |
676
|
|
|
{intl.formatMessage(fitMessages.questionLabel, { |
677
|
|
|
index: index + 1, |
678
|
|
|
})}{" "} |
679
|
|
|
{localizeField(locale, jobQuestion, "question")} |
680
|
|
|
</p> |
681
|
|
|
<p> |
682
|
|
|
{answer ? ( |
683
|
|
|
answer.answer |
684
|
|
|
) : ( |
685
|
|
|
<FormattedMessage |
686
|
|
|
id="application.review.missingAnswer" |
687
|
|
|
defaultMessage="Not yet answered." |
688
|
|
|
description="Message displayed if the applicant did not yet answer one of the Fit questions." |
689
|
|
|
/> |
690
|
|
|
)} |
691
|
|
|
</p> |
692
|
|
|
</> |
693
|
|
|
); |
694
|
|
|
})} |
695
|
|
|
<div data-c-grid="gutter(all, 1) middle" data-c-padding="top(2)"> |
696
|
|
|
<div data-c-grid-item="tp(2of3) tl(4of5)"> |
697
|
|
|
<h3 data-c-font-size="h3"> |
698
|
|
|
{!isSubmitted ? ( |
699
|
|
|
<FormattedMessage |
700
|
|
|
id="application.review.accountSettingsHeading" |
701
|
|
|
defaultMessage="My Account Settings" |
702
|
|
|
/> |
703
|
|
|
) : ( |
704
|
|
|
intl.formatMessage(submittedApplicationHeaders.accountSettings) |
705
|
|
|
)} |
706
|
|
|
</h3> |
707
|
|
|
</div> |
708
|
|
|
{!isSubmitted && ( |
709
|
|
|
<div |
710
|
|
|
data-c-grid-item="tp(1of3) tl(1of5)" |
711
|
|
|
data-c-align="base(center) tp(right)" |
712
|
|
|
> |
713
|
|
|
<a |
714
|
|
|
href={accountSettings(locale)} |
715
|
|
|
title={intl.formatMessage(messages.editTitle)} |
716
|
|
|
data-c-color="c2" |
717
|
|
|
data-c-font-weight="bold" |
718
|
|
|
> |
719
|
|
|
{intl.formatMessage(messages.edit)} |
720
|
|
|
</a> |
721
|
|
|
</div> |
722
|
|
|
)} |
723
|
|
|
</div> |
724
|
|
|
<hr data-c-hr="thin(gray)" data-c-margin="top(1)" /> |
725
|
|
|
<p |
726
|
|
|
data-c-font-weight="bold" |
727
|
|
|
data-c-color="c2" |
728
|
|
|
data-c-margin="top(1) bottom(.5)" |
729
|
|
|
> |
730
|
|
|
<FormattedMessage |
731
|
|
|
id="application.review.contactLabel" |
732
|
|
|
defaultMessage="Contact & Communication" |
733
|
|
|
/> |
734
|
|
|
</p> |
735
|
|
|
{user.contact_language === "en" && ( |
736
|
|
|
<p data-c-margin="bottom(.5)"> |
737
|
|
|
<i |
738
|
|
|
className="fas fa-check" |
739
|
|
|
data-c-color="go" |
740
|
|
|
data-c-margin="right(.25)" |
741
|
|
|
/> |
742
|
|
|
{intl.formatMessage(messages.communicationEn)} |
743
|
|
|
</p> |
744
|
|
|
)} |
745
|
|
|
{user.contact_language === "fr" && ( |
746
|
|
|
<p data-c-margin="bottom(.5)"> |
747
|
|
|
<i |
748
|
|
|
className="fas fa-check" |
749
|
|
|
data-c-color="go" |
750
|
|
|
data-c-margin="right(.25)" |
751
|
|
|
/> |
752
|
|
|
{intl.formatMessage(messages.communicationFr)} |
753
|
|
|
</p> |
754
|
|
|
)} |
755
|
|
|
{user.contact_language !== "en" && user.contact_language !== "fr" && ( |
756
|
|
|
<p data-c-margin="bottom(.5)"> |
757
|
|
|
<i |
758
|
|
|
className="fas fa-times" |
759
|
|
|
data-c-color="stop" |
760
|
|
|
data-c-margin="right(.25)" |
761
|
|
|
/> |
762
|
|
|
{intl.formatMessage(messages.communicationNotSet)} |
763
|
|
|
</p> |
764
|
|
|
)} |
765
|
|
|
<p data-c-margin={!isSubmitted ? "bottom(.5)" : "bottom(2)"}> |
766
|
|
|
<i |
767
|
|
|
className={`fas fa-${user.job_alerts ? "check" : "times"}`} |
768
|
|
|
data-c-color={user.job_alerts ? "go" : "stop"} |
769
|
|
|
data-c-margin={`right(.${user.job_alerts ? "25" : "5"})`} |
770
|
|
|
/> |
771
|
|
|
{user.job_alerts ? ( |
772
|
|
|
<FormattedMessage |
773
|
|
|
id="application.review.userContact" |
774
|
|
|
defaultMessage="I would like Talent Cloud to contact me at {email} about related jobs." |
775
|
|
|
values={{ |
776
|
|
|
email: user.email, |
777
|
|
|
}} |
778
|
|
|
/> |
779
|
|
|
) : ( |
780
|
|
|
<FormattedMessage |
781
|
|
|
id="application.review.userNoContact" |
782
|
|
|
defaultMessage="I do not want Talent Cloud to contact me at {email} about related jobs." |
783
|
|
|
values={{ |
784
|
|
|
email: user.email, |
785
|
|
|
}} |
786
|
|
|
/> |
787
|
|
|
)} |
788
|
|
|
</p> |
789
|
|
|
{children} |
790
|
|
|
</div> |
791
|
|
|
); |
792
|
|
|
}; |
793
|
|
|
|
794
|
|
|
export default ApplicationPreview; |
795
|
|
|
|