@lysaab/lysa-pep 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,122 +1,122 @@
1
- import React, { FunctionComponent } from "react";
2
- import "./PepAnswers.scss";
3
- import { PepRequest } from "../model/PepModel";
4
- import { countries } from "../model/Countries";
5
- import { LABELS } from "../model/PepTexts";
6
- import { roleAlternatives, militaryAlternatives } from "../pages/PepRolePage";
7
- import { EntityType, PepType } from "../pages/PepContext";
8
-
9
- interface Props {
10
- answer: PepRequest;
11
- }
12
-
13
- export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
14
- if (!answer.type || answer.type === PepType.NOT_PEP) {
15
- return <div>Inte PEP</div>;
16
- }
17
-
18
- const labels = LABELS("");
19
- const country = countries.find(country => country.value === answer.country);
20
- const role = roleAlternatives.find(alt => alt.value === answer.role);
21
- const militaryRank = militaryAlternatives.find(
22
- alt => alt.value === answer.militaryRank
23
- );
24
- return (
25
- <div>
26
- {answer.type && (
27
- <StaticInput
28
- label="Vem är pep"
29
- value={labels[EntityType.PERSON].GENERIC.IS_PEP[answer.type]}
30
- />
31
- )}
32
- {answer.relationToPEP && (
33
- <StaticInput
34
- label="Relation"
35
- value={
36
- labels[EntityType.PERSON][PepType.RELATIVE].RELATION[
37
- answer.relationToPEP
38
- ]
39
- }
40
- />
41
- )}
42
- {answer.businessRelation && (
43
- <StaticInput
44
- label="Relation"
45
- value={
46
- labels[EntityType.PERSON][PepType.COLLEAGUE].BUSINESS_RELATION[
47
- answer.businessRelation
48
- ]
49
- }
50
- />
51
- )}
52
- {answer.nameOfPEP && (
53
- <StaticInput label="Namn på personen" value={answer.nameOfPEP} />
54
- )}
55
- {answer.birthdayOfPEP && (
56
- <StaticInput
57
- label="Födelsedag för personen"
58
- value={answer.birthdayOfPEP}
59
- />
60
- )}
61
- {answer.ended ? (
62
- <React.Fragment>
63
- <StaticInput label="Status" value="Avslutad" />
64
- <StaticInput label="Avslutades" value={answer.ended} />
65
- </React.Fragment>
66
- ) : (
67
- <StaticInput label="Status" value="Pågående" />
68
- )}
69
- {answer.birthdayOfPEP && (
70
- <StaticInput label="Roll" value={answer.birthdayOfPEP} />
71
- )}
72
- {answer.country && (
73
- <StaticInput
74
- label="Land"
75
- value={country ? country.label : answer.country}
76
- />
77
- )}
78
- {role && <StaticInput label="Roll" value={role.text} />}
79
- {answer.ambassadorCountry && (
80
- <StaticInput label="Ambassadörsland" value={answer.ambassadorCountry} />
81
- )}
82
- {answer.governmentCompany && (
83
- <StaticInput label="Företagets namn" value={answer.governmentCompany} />
84
- )}
85
- {answer.governmentCompanyRole && (
86
- <StaticInput
87
- label="Roll på företaget"
88
- value={answer.governmentCompanyRole}
89
- />
90
- )}
91
- {answer.internationalOrganisation && (
92
- <StaticInput
93
- label="Organisationens namn"
94
- value={answer.internationalOrganisation}
95
- />
96
- )}
97
- {answer.internationalOrganisationRole && (
98
- <StaticInput
99
- label="Roll i organisationen"
100
- value={answer.internationalOrganisationRole}
101
- />
102
- )}
103
- {militaryRank && (
104
- <StaticInput label="Militär grad" value={militaryRank.value} />
105
- )}
106
- </div>
107
- );
108
- };
109
-
110
- interface StaticInputProps {
111
- label: string;
112
- value: string | React.ReactNode;
113
- }
114
-
115
- const StaticInput: FunctionComponent<StaticInputProps> = ({ label, value }) => {
116
- return (
117
- <div className="static-input">
118
- <div className="label">{label}</div>
119
- <div className="value">{value}</div>
120
- </div>
121
- );
122
- };
1
+ import React, { FunctionComponent } from "react";
2
+ import "./PepAnswers.scss";
3
+ import { PepRequest } from "../model/PepModel";
4
+ import { countries } from "../model/Countries";
5
+ import { LABELS } from "../model/PepTexts";
6
+ import { roleAlternatives, militaryAlternatives } from "../pages/PepRolePage";
7
+ import { EntityType, PepType } from "../pages/PepContext";
8
+
9
+ interface Props {
10
+ answer: PepRequest;
11
+ }
12
+
13
+ export const PepAnswers: FunctionComponent<Props> = ({ answer }) => {
14
+ if (!answer.type || answer.type === PepType.NOT_PEP) {
15
+ return <div>Inte PEP</div>;
16
+ }
17
+
18
+ const labels = LABELS("");
19
+ const country = countries.find(country => country.value === answer.country);
20
+ const role = roleAlternatives.find(alt => alt.value === answer.role);
21
+ const militaryRank = militaryAlternatives.find(
22
+ alt => alt.value === answer.militaryRank
23
+ );
24
+ return (
25
+ <div>
26
+ {answer.type && (
27
+ <StaticInput
28
+ label="Vem är pep"
29
+ value={labels[EntityType.PERSON].GENERIC.IS_PEP[answer.type]}
30
+ />
31
+ )}
32
+ {answer.relationToPEP && (
33
+ <StaticInput
34
+ label="Relation"
35
+ value={
36
+ labels[EntityType.PERSON][PepType.RELATIVE].RELATION[
37
+ answer.relationToPEP
38
+ ]
39
+ }
40
+ />
41
+ )}
42
+ {answer.businessRelation && (
43
+ <StaticInput
44
+ label="Relation"
45
+ value={
46
+ labels[EntityType.PERSON][PepType.COLLEAGUE].BUSINESS_RELATION[
47
+ answer.businessRelation
48
+ ]
49
+ }
50
+ />
51
+ )}
52
+ {answer.nameOfPEP && (
53
+ <StaticInput label="Namn på personen" value={answer.nameOfPEP} />
54
+ )}
55
+ {answer.birthdayOfPEP && (
56
+ <StaticInput
57
+ label="Födelsedag för personen"
58
+ value={answer.birthdayOfPEP}
59
+ />
60
+ )}
61
+ {answer.ended ? (
62
+ <React.Fragment>
63
+ <StaticInput label="Status" value="Avslutad" />
64
+ <StaticInput label="Avslutades" value={answer.ended} />
65
+ </React.Fragment>
66
+ ) : (
67
+ <StaticInput label="Status" value="Pågående" />
68
+ )}
69
+ {answer.birthdayOfPEP && (
70
+ <StaticInput label="Roll" value={answer.birthdayOfPEP} />
71
+ )}
72
+ {answer.country && (
73
+ <StaticInput
74
+ label="Land"
75
+ value={country ? country.label : answer.country}
76
+ />
77
+ )}
78
+ {role && <StaticInput label="Roll" value={role.text} />}
79
+ {answer.ambassadorCountry && (
80
+ <StaticInput label="Ambassadörsland" value={answer.ambassadorCountry} />
81
+ )}
82
+ {answer.governmentCompany && (
83
+ <StaticInput label="Företagets namn" value={answer.governmentCompany} />
84
+ )}
85
+ {answer.governmentCompanyRole && (
86
+ <StaticInput
87
+ label="Roll på företaget"
88
+ value={answer.governmentCompanyRole}
89
+ />
90
+ )}
91
+ {answer.internationalOrganisation && (
92
+ <StaticInput
93
+ label="Organisationens namn"
94
+ value={answer.internationalOrganisation}
95
+ />
96
+ )}
97
+ {answer.internationalOrganisationRole && (
98
+ <StaticInput
99
+ label="Roll i organisationen"
100
+ value={answer.internationalOrganisationRole}
101
+ />
102
+ )}
103
+ {militaryRank && (
104
+ <StaticInput label="Militär grad" value={militaryRank.value} />
105
+ )}
106
+ </div>
107
+ );
108
+ };
109
+
110
+ interface StaticInputProps {
111
+ label: string;
112
+ value: string | React.ReactNode;
113
+ }
114
+
115
+ const StaticInput: FunctionComponent<StaticInputProps> = ({ label, value }) => {
116
+ return (
117
+ <div className="static-input">
118
+ <div className="label">{label}</div>
119
+ <div className="value">{value}</div>
120
+ </div>
121
+ );
122
+ };