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