Passed
Push — feature/partner-department ( 5d5173...64e9f7 )
by
unknown
08:01
created

resources/assets/js/components/Application/Review/ApplicationPreview.tsx   A

Complexity

Total Complexity 21
Complexity/F 0

Size

Lines of Code 813
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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