Passed
Push — task/manager-application-revie... ( 7275ed...5af2e3 )
by Yonathan
04:36
created

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

Complexity

Total Complexity 20
Complexity/F 0

Size

Lines of Code 803
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 20
eloc 657
c 0
b 0
f 0
dl 0
loc 803
rs 9.943
mnd 20
bc 20
fnc 0
bpm 0
cpm 0
noi 0
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
      >
300
        <FormattedMessage
301
          id="application.review.experienceViewButton"
302
          defaultMessage="All Experience"
303
          description="Button text for the experience view of the Review page."
304
        />
305
      </button>
306
    );
307
    const skillsButton = (
308
      <button
309
        data-c-button={`${
310
          experienceView === "skills" ? "solid" : "outline"
311
        }(c1)`}
312
        type="button"
313
        data-c-radius="rounded"
314
        data-c-margin="right(.5)"
315
        className="gtag-application-review-skill-experience"
316
        data-experience-view="skills"
317
        onClick={handleViewClick}
318
      >
319
        <FormattedMessage
320
          id="application.review.skillsViewButton"
321
          defaultMessage="Skills for This Job"
322
          description="Button text for the skills view of the Review page."
323
        />
324
      </button>
325
    );
326
    const educationButton = (
327
      <button
328
        data-c-button={`${
329
          experienceView === "education" ? "solid" : "outline"
330
        }(c1)`}
331
        type="button"
332
        data-c-radius="rounded"
333
        data-c-margin="right(.5)"
334
        className="gtag-application-review-education-experience"
335
        data-experience-view="education"
336
        onClick={handleViewClick}
337
      >
338
        <FormattedMessage
339
          id="application.review.educationViewButton"
340
          defaultMessage="Education Requirements for This Job"
341
          description="Button text for the education view of the Review page."
342
        />
343
      </button>
344
    );
345
346
    const buttonView = buttonOrder.map((button) => {
347
      switch (button) {
348
        case "experience":
349
          return experienceButton;
350
        case "skills":
351
          return skillsButton;
352
        case "education":
353
          return educationButton;
354
        default:
355
          return null;
356
      }
357
    });
358
359
    return <>{...buttonView}</>;
360
  };
361
362
  return (
363
    <div data-c-container="medium">
364
      <h2
365
        data-c-heading="h2"
366
        data-c-margin={!managerView ? "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>
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
      <div data-c-grid="gutter(all, 1) middle" data-c-padding="top(3)">
396
        <div data-c-grid-item="tp(2of3) tl(4of5)">
397
          <h3 data-c-font-size="h3">
398
            {!managerView
399
              ? intl.formatMessage(basicInfoMessages.heading)
400
              : intl.formatMessage(managerViewHeaders.basicInfo)}
401
          </h3>
402
        </div>
403
        {!managerView && (
404
          <div
405
            data-c-grid-item="tp(1of3) tl(1of5)"
406
            data-c-align="base(center) tp(right)"
407
          >
408
            <a
409
              href="https://talent.test/demo/application-02"
410
              title={intl.formatMessage(messages.editTitle)}
411
              data-c-color="c2"
412
              data-c-font-weight="bold"
413
            >
414
              {intl.formatMessage(messages.edit)}
415
            </a>
416
          </div>
417
        )}
418
      </div>
419
      <hr data-c-hr="thin(gray)" data-c-margin="top(1)" />
420
      <p
421
        data-c-font-weight="bold"
422
        data-c-color="c2"
423
        data-c-margin="top(1) bottom(.5)"
424
      >
425
        {intl.formatMessage(basicInfoMessages.citizenshipLabel)}
426
      </p>
427
      <p>
428
        {application.citizenship_declaration_id
429
          ? intl.formatMessage(
430
              citizenshipDeclaration(application.citizenship_declaration_id),
431
            )
432
          : intl.formatMessage(messages.valueNotSet)}
433
      </p>
434
      <p
435
        data-c-font-weight="bold"
436
        data-c-color="c2"
437
        data-c-margin="top(1) bottom(.5)"
438
      >
439
        {intl.formatMessage(basicInfoMessages.veteranStatusLabel)}
440
      </p>
441
      <p>
442
        {application.veteran_status_id
443
          ? intl.formatMessage(veteranStatus(application.veteran_status_id))
444
          : intl.formatMessage(messages.valueNotSet)}
445
      </p>
446
      <p
447
        data-c-font-weight="bold"
448
        data-c-color="c2"
449
        data-c-margin="top(1) bottom(.5)"
450
      >
451
        {intl.formatMessage(basicInfoMessages.languageRequirementsHeading)}
452
      </p>
453
      <p data-c-margin="bottom(.5)">
454
        {job.language_requirement_id &&
455
          intl.formatMessage(
456
            languageRequirementDescription(job.language_requirement_id),
457
          )}
458
      </p>
459
      {job.language_requirement_id &&
460
        application.language_requirement_confirmed && (
461
          <p data-c-margin="bottom(.5)">
462
            <i
463
              className="fas fa-check"
464
              data-c-color="go"
465
              data-c-margin="right(.25)"
466
            />
467
            {intl.formatMessage(
468
              languageRequirementLabel(job.language_requirement_id),
469
            )}
470
          </p>
471
        )}
472
      {(job.language_requirement_id ===
473
        LanguageRequirementId.bilingualIntermediate ||
474
        job.language_requirement_id ===
475
          LanguageRequirementId.bilingualAdvanced) &&
476
        application.language_test_confirmed && (
477
          <p>
478
            <i
479
              className="fas fa-check"
480
              data-c-color="go"
481
              data-c-margin="right(.25)"
482
            />
483
            {intl.formatMessage(defaultBasicMessages.languageTestLabel)}
484
          </p>
485
        )}
486
      <div data-c-grid="gutter(all, 1) middle" data-c-padding="top(3)">
487
        <div data-c-grid-item="tp(2of3) tl(4of5)">
488
          <h3 data-c-font-size="h3">
489
            {!managerView
490
              ? intl.formatMessage(experienceMessages.heading)
491
              : intl.formatMessage(managerViewHeaders.experience)}
492
          </h3>
493
        </div>
494
        {!managerView && (
495
          <div
496
            data-c-grid-item="tp(1of3) tl(1of5)"
497
            data-c-align="base(center) tp(right)"
498
          >
499
            <a
500
              href="https://talent.test/demo/application-04"
501
              title={intl.formatMessage(messages.editTitle)}
502
              data-c-color="c2"
503
              data-c-font-weight="bold"
504
            >
505
              {intl.formatMessage(messages.edit)}
506
            </a>
507
          </div>
508
        )}
509
      </div>
510
      <hr data-c-hr="thin(gray)" data-c-margin="tb(1)" />
511
      <p data-c-padding="bottom(.5)" data-c-font-weight="bold">
512
        <FormattedMessage
513
          id="application.review.changeViewHeading"
514
          defaultMessage="Change Your View:"
515
          description="Heading for the Review section with the buttons to change the layout."
516
        />
517
      </p>
518
      <div data-c-padding="bottom(1)">
519
        {experienceViewButtons(experienceViewButtonOrder)}
520
      </div>
521
      {experienceView === "experience" && (
522
        <div className="experience-list">
523
          <p data-c-margin="bottom(1)">
524
            <FormattedMessage
525
              id="application.review.experienceViewHeading"
526
              defaultMessage="This view is a summary of all the experiences you will be sending as a part of your application."
527
              description="Heading for the experience view section of the Review page."
528
            />
529
          </p>
530
          <div data-c-accordion-group="">
531
            {experiences.map((experience) => {
532
              const irrelevantSkillCount = getIrrelevantSkillCount(
533
                criteria,
534
                experience,
535
                experienceSkills,
536
              );
537
              const relevantSkills = experienceSkills.filter(
538
                (experienceSkill) =>
539
                  experienceSkill.experience_type === experience.type &&
540
                  experienceSkill.experience_id === experience.id,
541
              );
542
              return (
543
                <ExperienceAccordion
544
                  key={`${experience.type}-${experience.id}`}
545
                  experience={experience}
546
                  experienceSkills={relevantSkills}
547
                  skills={skills}
548
                  irrelevantSkillCount={irrelevantSkillCount}
549
                  locale={locale}
550
                />
551
              );
552
            })}
553
          </div>
554
        </div>
555
      )}
556
      {experienceView === "skills" && (
557
        <div className="experience-list">
558
          <p data-c-margin="bottom(1)">
559
            <FormattedMessage
560
              id="application.review.skillsViewHeading"
561
              defaultMessage="This view organizes your experiences by the skills required for this job."
562
              description="Heading for the skills view section of the Review page."
563
            />
564
          </p>
565
          <div data-c-accordion-group="">
566
            {criteria.map((criterion) => {
567
              const skillOfCriterion = getSkillOfCriteria(criterion, skills);
568
569
              if (skillOfCriterion !== null) {
570
                const skillLevel = intl.formatMessage(
571
                  getSkillLevelName(criterion, skillOfCriterion),
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 irrelevantSkillCount = getIrrelevantSkillCount(
624
                  criteria,
625
                  educationExperience,
626
                  experienceSkills,
627
                );
628
                const relevantSkills = experienceSkills.filter(
629
                  (experienceSkill) =>
630
                    experienceSkill.experience_type ===
631
                      educationExperience.type &&
632
                    experienceSkill.experience_id === educationExperience.id,
633
                );
634
                return (
635
                  <ExperienceAccordion
636
                    key={`${educationExperience.type}-${educationExperience.id}-edu`}
637
                    experience={educationExperience}
638
                    experienceSkills={relevantSkills}
639
                    skills={skills}
640
                    irrelevantSkillCount={irrelevantSkillCount}
641
                    locale={locale}
642
                  />
643
                );
644
              })}
645
          </div>
646
        </div>
647
      )}
648
      <div data-c-grid="gutter(all, 1) middle" data-c-padding="top(3)">
649
        <div data-c-grid-item="tp(2of3) tl(4of5)">
650
          <h3 data-c-font-size="h3">
651
            {!managerView
652
              ? intl.formatMessage(fitMessages.heading)
653
              : intl.formatMessage(managerViewHeaders.fit)}
654
          </h3>
655
        </div>
656
        {!managerView && (
657
          <div
658
            data-c-grid-item="tp(1of3) tl(1of5)"
659
            data-c-align="base(center) tp(right)"
660
          >
661
            <a
662
              href="https://talent.test/demo/application-07"
663
              title={intl.formatMessage(messages.editTitle)}
664
              data-c-color="c2"
665
              data-c-font-weight="bold"
666
            >
667
              {intl.formatMessage(messages.edit)}
668
            </a>
669
          </div>
670
        )}
671
      </div>
672
      <hr data-c-hr="thin(gray)" data-c-margin="top(1)" />
673
      {jobQuestions.map((jobQuestion, index) => {
674
        const answer = jobApplicationAnswers.find(
675
          (appAnswer) => appAnswer.job_poster_question_id === jobQuestion.id,
676
        );
677
        return (
678
          <>
679
            <p
680
              data-c-font-weight="bold"
681
              data-c-color="c2"
682
              data-c-margin="top(1) bottom(.5)"
683
            >
684
              {intl.formatMessage(fitMessages.questionLabel, {
685
                index: index + 1,
686
              })}{" "}
687
              {localizeField(locale, jobQuestion, "question")}
688
            </p>
689
            <p>
690
              {answer ? (
691
                answer.answer
692
              ) : (
693
                <FormattedMessage
694
                  id="application.review.missingAnswer"
695
                  defaultMessage="Not yet answered."
696
                  description="Message displayed if the applicant did not yet answer one of the Fit questions."
697
                />
698
              )}
699
            </p>
700
          </>
701
        );
702
      })}
703
      <div data-c-grid="gutter(all, 1) middle" data-c-padding="top(3)">
704
        <div data-c-grid-item="tp(2of3) tl(4of5)">
705
          <h3 data-c-font-size="h3">
706
            {!managerView ? (
707
              <FormattedMessage
708
                id="application.review.accountSettingsHeading"
709
                defaultMessage="Account Settings"
710
              />
711
            ) : (
712
              intl.formatMessage(managerViewHeaders.accountSettings)
713
            )}
714
          </h3>
715
        </div>
716
        {!managerView && (
717
          <div
718
            data-c-grid-item="tp(1of3) tl(1of5)"
719
            data-c-align="base(center) tp(right)"
720
          >
721
            <a
722
              href="https://talent.test/demo/application-07"
723
              title={intl.formatMessage(messages.editTitle)}
724
              data-c-color="c2"
725
              data-c-font-weight="bold"
726
            >
727
              {intl.formatMessage(messages.edit)}
728
            </a>
729
          </div>
730
        )}
731
      </div>
732
      <hr data-c-hr="thin(gray)" data-c-margin="top(1)" />
733
      <p
734
        data-c-font-weight="bold"
735
        data-c-color="c2"
736
        data-c-margin="top(1) bottom(.5)"
737
      >
738
        <FormattedMessage
739
          id="application.review.contactLabel"
740
          defaultMessage="Contact & Communication"
741
        />
742
      </p>
743
      {user.contact_language === "en" && (
744
        <p data-c-margin="bottom(.5)">
745
          <i
746
            className="fas fa-check"
747
            data-c-color="go"
748
            data-c-margin="right(.25)"
749
          />
750
          {intl.formatMessage(messages.communicationEn)}
751
        </p>
752
      )}
753
      {user.contact_language === "fr" && (
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.communicationFr)}
761
        </p>
762
      )}
763
      {user.contact_language !== "en" && user.contact_language !== "fr" && (
764
        <p data-c-margin="bottom(.5)">
765
          <i
766
            className="fas fa-times"
767
            data-c-color="stop"
768
            data-c-margin="right(.25)"
769
          />
770
          {intl.formatMessage(messages.communicationNotSet)}
771
        </p>
772
      )}
773
      <p data-c-margin={!managerView ? "bottom(.5)" : "bottom(2)"}>
774
        <i
775
          className={`fas fa-${user.job_alerts ? "check" : "times"}`}
776
          data-c-color={user.job_alerts ? "go" : "stop"}
777
          data-c-margin={`right(.${user.job_alerts ? "25" : "5"})`}
778
        />
779
        {user.job_alerts ? (
780
          <FormattedMessage
781
            id="application.review.userContact"
782
            defaultMessage="I would like Talent Cloud to contact me at {email} about related jobs."
783
            values={{
784
              email: user.email,
785
            }}
786
          />
787
        ) : (
788
          <FormattedMessage
789
            id="application.review.userNoContact"
790
            defaultMessage="I do not want Talent Cloud to contact me at {email} about related jobs."
791
            values={{
792
              email: user.email,
793
            }}
794
          />
795
        )}
796
      </p>
797
      {children}
798
    </div>
799
  );
800
};
801
802
export default ApplicationPreview;
803