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