@lysaab/lysa-pep 1.0.0-0 → 1.0.0
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.
- package/README.md +0 -0
- package/lib/Exports.d.ts +8 -7
- package/lib/Exports.js +8 -7
- package/lib/components/CountrySelect.d.ts +22 -15
- package/lib/components/CountrySelect.js +21 -30
- package/lib/components/PepAnswers.d.ts +8 -8
- package/lib/components/PepAnswers.js +39 -131
- package/lib/components/PepAnswers.scss +0 -0
- package/lib/model/Countries.d.ts +4 -4
- package/lib/model/Countries.js +1002 -1002
- package/lib/model/PepModel.d.ts +7 -7
- package/lib/model/PepModel.js +40 -40
- package/lib/model/PepTexts.d.ts +380 -0
- package/lib/model/PepTexts.js +552 -0
- package/lib/pages/PepContext.d.ts +80 -80
- package/lib/pages/PepContext.js +88 -88
- package/lib/pages/PepIsPepPage.d.ts +15 -0
- package/lib/pages/PepIsPepPage.js +59 -0
- package/lib/pages/{StatusPage/StatusPage.d.ts → PepRelationPage.d.ts} +6 -6
- package/lib/pages/PepRelationPage.js +79 -0
- package/lib/pages/PepRolePage.d.ts +10 -0
- package/lib/pages/PepRolePage.js +127 -0
- package/lib/pages/{RelationPage/RelationPage.d.ts → PepStatusPage.d.ts} +6 -6
- package/lib/pages/PepStatusPage.js +58 -0
- package/package.json +10 -13
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -0
- package/public/robots.txt +0 -0
- package/src/App.css +0 -0
- package/src/App.test.tsx +0 -0
- package/src/App.tsx +0 -0
- package/src/Exports.ts +8 -7
- package/src/components/CountrySelect.tsx +10 -14
- package/src/components/PepAnswers.scss +0 -0
- package/src/components/PepAnswers.tsx +34 -166
- package/src/demo/Done.tsx +6 -2
- package/src/demo/Pep.tsx +81 -87
- package/src/index.css +0 -0
- package/src/index.tsx +0 -0
- package/src/logo.svg +0 -0
- package/src/model/Countries.ts +0 -0
- package/src/model/PepModel.ts +0 -0
- package/src/model/PepTexts.ts +607 -0
- package/src/pages/PepContext.tsx +0 -0
- package/src/pages/PepIsPepPage.tsx +107 -0
- package/src/pages/PepRelationPage.tsx +188 -0
- package/src/pages/PepRolePage.tsx +272 -0
- package/src/pages/PepStatusPage.tsx +157 -0
- package/src/react-app-env.d.ts +0 -0
- package/src/serviceWorker.ts +0 -0
- package/tsconfig.json +0 -0
- package/tsconfig_build.json +0 -0
- package/.vscode/settings.json +0 -3
- package/lib/pages/IsPep/IsPepMessages.d.ts +0 -32
- package/lib/pages/IsPep/IsPepMessages.js +0 -74
- package/lib/pages/IsPep/IsPepPage.d.ts +0 -14
- package/lib/pages/IsPep/IsPepPage.js +0 -39
- package/lib/pages/RelationPage/RelationMessages.d.ts +0 -105
- package/lib/pages/RelationPage/RelationMessages.js +0 -282
- package/lib/pages/RelationPage/RelationPage.js +0 -142
- package/lib/pages/RolePage/RoleMessages.d.ts +0 -185
- package/lib/pages/RolePage/RoleMessages.js +0 -381
- package/lib/pages/RolePage/RolePage.d.ts +0 -11
- package/lib/pages/RolePage/RolePage.js +0 -214
- package/lib/pages/StatusPage/StatusMessages.d.ts +0 -72
- package/lib/pages/StatusPage/StatusMessages.js +0 -74
- package/lib/pages/StatusPage/StatusPage.js +0 -75
- package/src/pages/IsPep/IsPepMessages.ts +0 -75
- package/src/pages/IsPep/IsPepPage.tsx +0 -94
- package/src/pages/RelationPage/RelationMessages.ts +0 -287
- package/src/pages/RelationPage/RelationPage.tsx +0 -269
- package/src/pages/RolePage/RoleMessages.ts +0 -389
- package/src/pages/RolePage/RolePage.tsx +0 -342
- package/src/pages/StatusPage/StatusMessages.ts +0 -80
- package/src/pages/StatusPage/StatusPage.tsx +0 -172
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useRef, useCallback, useContext } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Form,
|
|
4
|
+
RadioGroup,
|
|
5
|
+
RequiredValidator,
|
|
6
|
+
PrimaryButton,
|
|
7
|
+
LysaFormRef,
|
|
8
|
+
} from "@lysaab/ui-2";
|
|
9
|
+
import { PepType, PepContext, EntityType } from "./PepContext";
|
|
10
|
+
import { LABELS } from "../model/PepTexts";
|
|
11
|
+
|
|
12
|
+
interface QuestionsProps {
|
|
13
|
+
ownerName?: string;
|
|
14
|
+
legalEntityType?: EntityType;
|
|
15
|
+
type?: PepType;
|
|
16
|
+
onChange: (type: PepType) => void;
|
|
17
|
+
resetValues?: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const PepIsPepQuestions: React.FC<QuestionsProps> = ({
|
|
21
|
+
ownerName,
|
|
22
|
+
legalEntityType,
|
|
23
|
+
type,
|
|
24
|
+
onChange,
|
|
25
|
+
resetValues,
|
|
26
|
+
}) => {
|
|
27
|
+
const labels = LABELS(ownerName);
|
|
28
|
+
const entityType = legalEntityType || EntityType.PERSON;
|
|
29
|
+
|
|
30
|
+
const IsPepAlternatives = [
|
|
31
|
+
{
|
|
32
|
+
text: labels[entityType].GENERIC.IS_PEP[PepType.NOT_PEP],
|
|
33
|
+
value: PepType.NOT_PEP,
|
|
34
|
+
},
|
|
35
|
+
{ text: labels[entityType].GENERIC.IS_PEP[PepType.ME], value: PepType.ME },
|
|
36
|
+
{
|
|
37
|
+
text: labels[entityType].GENERIC.IS_PEP[PepType.RELATIVE],
|
|
38
|
+
value: PepType.RELATIVE,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
text: labels[entityType].GENERIC.IS_PEP[PepType.COLLEAGUE],
|
|
42
|
+
value: PepType.COLLEAGUE,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<RadioGroup
|
|
48
|
+
alternatives={IsPepAlternatives}
|
|
49
|
+
onChange={(alternative) => {
|
|
50
|
+
onChange(alternative.value);
|
|
51
|
+
resetValues?.();
|
|
52
|
+
}}
|
|
53
|
+
value={IsPepAlternatives.find((alt) => alt.value === type)}
|
|
54
|
+
header={labels[entityType].GENERIC.IS_PEP_HEADER}
|
|
55
|
+
validators={[new RequiredValidator("Du måste välja ett alternativ")]}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
interface Props {
|
|
61
|
+
next: () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const PepIsPepPage: React.FC<Props> = ({ next }) => {
|
|
65
|
+
const pepContext = useContext(PepContext);
|
|
66
|
+
const formRef = useRef<LysaFormRef>();
|
|
67
|
+
|
|
68
|
+
const nextPage = useCallback(() => {
|
|
69
|
+
if (formRef.current && formRef.current.isValid) {
|
|
70
|
+
next();
|
|
71
|
+
}
|
|
72
|
+
}, [formRef, next]);
|
|
73
|
+
|
|
74
|
+
const resetValues = useCallback(() => {
|
|
75
|
+
pepContext.setState({
|
|
76
|
+
ambassadorCountry: undefined,
|
|
77
|
+
birthdayOfPEP: undefined,
|
|
78
|
+
businessRelation: undefined,
|
|
79
|
+
country: undefined,
|
|
80
|
+
ended: undefined,
|
|
81
|
+
governmentCompany: undefined,
|
|
82
|
+
governmentCompanyRole: undefined,
|
|
83
|
+
internationalOrganisation: undefined,
|
|
84
|
+
internationalOrganisationRole: undefined,
|
|
85
|
+
isOngoing: undefined,
|
|
86
|
+
isSweden: undefined,
|
|
87
|
+
militaryRank: undefined,
|
|
88
|
+
nameOfPEP: undefined,
|
|
89
|
+
relationToPEP: undefined,
|
|
90
|
+
role: undefined,
|
|
91
|
+
});
|
|
92
|
+
}, [pepContext]);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Form onSubmit={nextPage} lysaFormRef={formRef}>
|
|
96
|
+
<PepIsPepQuestions
|
|
97
|
+
ownerName={pepContext.state.ownerName}
|
|
98
|
+
legalEntityType={pepContext.state.legalEntityType}
|
|
99
|
+
type={pepContext.state.type}
|
|
100
|
+
onChange={(type) => pepContext.setState({ type })}
|
|
101
|
+
resetValues={resetValues}
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<PrimaryButton type="submit">Nästa</PrimaryButton>
|
|
105
|
+
</Form>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useContext,
|
|
3
|
+
useRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
FunctionComponent,
|
|
6
|
+
} from "react";
|
|
7
|
+
import {
|
|
8
|
+
PepContext,
|
|
9
|
+
PepType,
|
|
10
|
+
BusinessRelation,
|
|
11
|
+
Relation,
|
|
12
|
+
EntityType,
|
|
13
|
+
} from "./PepContext";
|
|
14
|
+
import {
|
|
15
|
+
LysaFormRef,
|
|
16
|
+
RadioGroup,
|
|
17
|
+
Form,
|
|
18
|
+
Alternative,
|
|
19
|
+
RequiredValidator,
|
|
20
|
+
TextInput,
|
|
21
|
+
Datepicker,
|
|
22
|
+
PrimaryButton,
|
|
23
|
+
} from "@lysaab/ui-2";
|
|
24
|
+
import { LABELS } from "../model/PepTexts";
|
|
25
|
+
import { DateTime } from "luxon";
|
|
26
|
+
|
|
27
|
+
const DATEPICKER_START_DATE = DateTime.fromISO("1970-01-01").toJSDate();
|
|
28
|
+
|
|
29
|
+
interface Props {
|
|
30
|
+
next: () => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const PepRelationPage: FunctionComponent<Props> = ({ next }) => {
|
|
34
|
+
const pepContext = useContext(PepContext);
|
|
35
|
+
const formRef = useRef<LysaFormRef>();
|
|
36
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
37
|
+
const type = pepContext.state.type;
|
|
38
|
+
const labels = LABELS(pepContext.state.ownerName);
|
|
39
|
+
|
|
40
|
+
const businessRelationAlternatives: Alternative<BusinessRelation>[] = [
|
|
41
|
+
{
|
|
42
|
+
text:
|
|
43
|
+
labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[
|
|
44
|
+
BusinessRelation.CO_OWNERSHIP
|
|
45
|
+
],
|
|
46
|
+
value: BusinessRelation.CO_OWNERSHIP,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
text:
|
|
50
|
+
labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[
|
|
51
|
+
BusinessRelation.CLOSE_CONNECTION
|
|
52
|
+
],
|
|
53
|
+
value: BusinessRelation.CLOSE_CONNECTION,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
text:
|
|
57
|
+
labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION[
|
|
58
|
+
BusinessRelation.COMPANY_FOR_PEP
|
|
59
|
+
],
|
|
60
|
+
value: BusinessRelation.COMPANY_FOR_PEP,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const relationAlternatives: Alternative<Relation>[] = [
|
|
65
|
+
{
|
|
66
|
+
text:
|
|
67
|
+
labels[entityType][PepType.RELATIVE].RELATION[Relation.MARRIED_PARTNER],
|
|
68
|
+
value: Relation.MARRIED_PARTNER,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
text:
|
|
72
|
+
labels[entityType][PepType.RELATIVE].RELATION[
|
|
73
|
+
Relation.COLIVING_PARTNER
|
|
74
|
+
],
|
|
75
|
+
value: Relation.COLIVING_PARTNER,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
text: labels[entityType][PepType.RELATIVE].RELATION[Relation.CHILD],
|
|
79
|
+
value: Relation.CHILD,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
text: labels[entityType][PepType.RELATIVE].RELATION[Relation.PARENT],
|
|
83
|
+
value: Relation.PARENT,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
text:
|
|
87
|
+
labels[entityType][PepType.RELATIVE].RELATION[
|
|
88
|
+
Relation.CHILD_MARRIED_PARTNER
|
|
89
|
+
],
|
|
90
|
+
value: Relation.CHILD_MARRIED_PARTNER,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
text:
|
|
94
|
+
labels[entityType][PepType.RELATIVE].RELATION[
|
|
95
|
+
Relation.CHILD_COLIVING_PARTNER
|
|
96
|
+
],
|
|
97
|
+
value: Relation.CHILD_COLIVING_PARTNER,
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
const nextPage = useCallback(() => {
|
|
102
|
+
if (formRef.current && formRef.current.isValid) {
|
|
103
|
+
next();
|
|
104
|
+
}
|
|
105
|
+
}, [formRef, next]);
|
|
106
|
+
return (
|
|
107
|
+
<Form onSubmit={() => nextPage()} lysaFormRef={formRef}>
|
|
108
|
+
{type === PepType.RELATIVE ? (
|
|
109
|
+
<RadioGroup
|
|
110
|
+
alternatives={relationAlternatives}
|
|
111
|
+
onChange={alternative => {
|
|
112
|
+
pepContext.setState({
|
|
113
|
+
relationToPEP: alternative.value,
|
|
114
|
+
});
|
|
115
|
+
}}
|
|
116
|
+
value={relationAlternatives.find(
|
|
117
|
+
alt => alt.value === pepContext.state.relationToPEP
|
|
118
|
+
)}
|
|
119
|
+
header={labels[entityType][PepType.RELATIVE].RELATION_LABEL}
|
|
120
|
+
validators={[new RequiredValidator("Du måste välja ett alternativ")]}
|
|
121
|
+
/>
|
|
122
|
+
) : null}
|
|
123
|
+
{type === PepType.COLLEAGUE ? (
|
|
124
|
+
<RadioGroup
|
|
125
|
+
alternatives={businessRelationAlternatives}
|
|
126
|
+
onChange={alternative => {
|
|
127
|
+
pepContext.setState({
|
|
128
|
+
businessRelation: alternative.value,
|
|
129
|
+
});
|
|
130
|
+
}}
|
|
131
|
+
value={businessRelationAlternatives.find(
|
|
132
|
+
alt => alt.value === pepContext.state.businessRelation
|
|
133
|
+
)}
|
|
134
|
+
header={labels[entityType][PepType.COLLEAGUE].BUSINESS_RELATION_LABEL}
|
|
135
|
+
validators={[new RequiredValidator("Du måste välja ett alternativ")]}
|
|
136
|
+
/>
|
|
137
|
+
) : null}
|
|
138
|
+
{pepContext.state.relationToPEP && type === PepType.RELATIVE ? (
|
|
139
|
+
<React.Fragment>
|
|
140
|
+
<TextInput
|
|
141
|
+
label={
|
|
142
|
+
labels[entityType][type].NAME_LABEL[
|
|
143
|
+
pepContext.state.relationToPEP
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
value={pepContext.state.nameOfPEP || ""}
|
|
147
|
+
onChange={value => {
|
|
148
|
+
pepContext.setState({ nameOfPEP: value });
|
|
149
|
+
}}
|
|
150
|
+
validators={[new RequiredValidator("Du måste ange namn")]}
|
|
151
|
+
/>
|
|
152
|
+
<Datepicker
|
|
153
|
+
label={
|
|
154
|
+
labels[entityType][type].BIRTH_LABEL[
|
|
155
|
+
pepContext.state.relationToPEP
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
selected={pepContext.state.birthdayOfPEP}
|
|
159
|
+
onChange={event =>
|
|
160
|
+
pepContext.setState({ birthdayOfPEP: event || undefined })
|
|
161
|
+
}
|
|
162
|
+
validators={[new RequiredValidator("Ange datum")]}
|
|
163
|
+
maxDate={new Date()}
|
|
164
|
+
openToDate={pepContext.state.birthdayOfPEP || DATEPICKER_START_DATE}
|
|
165
|
+
/>
|
|
166
|
+
</React.Fragment>
|
|
167
|
+
) : null}
|
|
168
|
+
|
|
169
|
+
{pepContext.state.businessRelation && type === PepType.COLLEAGUE ? (
|
|
170
|
+
<React.Fragment>
|
|
171
|
+
<TextInput
|
|
172
|
+
label={
|
|
173
|
+
labels[entityType][type].NAME_LABEL[
|
|
174
|
+
pepContext.state.businessRelation
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
value={pepContext.state.nameOfPEP || ""}
|
|
178
|
+
onChange={value => {
|
|
179
|
+
pepContext.setState({ nameOfPEP: value });
|
|
180
|
+
}}
|
|
181
|
+
validators={[new RequiredValidator("Du måste ange namn")]}
|
|
182
|
+
/>
|
|
183
|
+
</React.Fragment>
|
|
184
|
+
) : null}
|
|
185
|
+
<PrimaryButton type="submit">Nästa</PrimaryButton>
|
|
186
|
+
</Form>
|
|
187
|
+
);
|
|
188
|
+
};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
FunctionComponent,
|
|
3
|
+
useRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useContext,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { Alternative } from "@lysaab/ui-2/components/input/InputAPI";
|
|
8
|
+
import {
|
|
9
|
+
LysaFormRef,
|
|
10
|
+
Form,
|
|
11
|
+
PrimaryButton,
|
|
12
|
+
RequiredValidator,
|
|
13
|
+
TextInput,
|
|
14
|
+
Select,
|
|
15
|
+
} from "@lysaab/ui-2";
|
|
16
|
+
import {
|
|
17
|
+
PepContext,
|
|
18
|
+
Role,
|
|
19
|
+
MilitaryRank,
|
|
20
|
+
EntityType,
|
|
21
|
+
PepType,
|
|
22
|
+
} from "./PepContext";
|
|
23
|
+
import { CountrySelect } from "../components/CountrySelect";
|
|
24
|
+
import {
|
|
25
|
+
getGovernmentCompanyNameLabel,
|
|
26
|
+
getGovernmentCompanyRoleLabel,
|
|
27
|
+
getHighRankingPositionIntCorpNameLabel,
|
|
28
|
+
getHighRankingPositionIntCorpRoleLabel,
|
|
29
|
+
getMilitaryRankLabel,
|
|
30
|
+
getRoleLabel,
|
|
31
|
+
getAmbassadorLabel,
|
|
32
|
+
} from "../model/PepTexts";
|
|
33
|
+
|
|
34
|
+
interface Props {
|
|
35
|
+
next: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const roleAlternatives: Alternative<Role>[] = [
|
|
39
|
+
{ text: "Stats eller regeringschef", value: Role.HEAD_OF_GOVERNMENT },
|
|
40
|
+
{ text: "Minister eller Vice/Biträdande minister", value: Role.MINISTER },
|
|
41
|
+
{ text: "Ledamot i parlament eller riksdag", value: Role.PARLIMENT_MEMBER },
|
|
42
|
+
{
|
|
43
|
+
text: "Ledamot i centralbanks styrande organ",
|
|
44
|
+
value: Role.CENTRAL_BANK_MEMBER,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
text: "Ledamot för styrelsen i politiskt parti representerade i riksdagen",
|
|
48
|
+
value: Role.BOARD_MEMBER_POLITICAL_PARTY,
|
|
49
|
+
},
|
|
50
|
+
{ text: "Domare i högsta domstolen", value: Role.JUDGE_SUPREME_COURT },
|
|
51
|
+
{
|
|
52
|
+
text:
|
|
53
|
+
"Domare i konstitutionell domstol eller annat rättsligt organ på hög nivå vars beslut endast undantagsvis kan överklagas",
|
|
54
|
+
value: Role.JUDGE_OTHER_HIGH_COURT,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
text: "Högre tjänsteman vid revisionsmyndighet",
|
|
58
|
+
value: Role.REVISION_INSTITUTE,
|
|
59
|
+
},
|
|
60
|
+
{ text: "Ambassadör eller bestickningschef", value: Role.AMBASSADOR },
|
|
61
|
+
{ text: "Högre officer i försvarsmakt", value: Role.MILITARY_OFFICER },
|
|
62
|
+
{
|
|
63
|
+
text:
|
|
64
|
+
"Person som ingår i statsägt företags förvaltnings-, lednings eller kontrollorgan",
|
|
65
|
+
value: Role.GOVERNMENT_COMPANY,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
text: "EU-parlamentariker",
|
|
69
|
+
value: Role.EU_HIGH_RANKING_POSITION,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
text: "Befattning på hög nivå i en internationell organisation",
|
|
73
|
+
value: Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP,
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
export const militaryAlternatives: Alternative<MilitaryRank>[] = [
|
|
78
|
+
{
|
|
79
|
+
text: "General",
|
|
80
|
+
value: MilitaryRank.GENERAL,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
text: "Generallöjtnant",
|
|
84
|
+
value: MilitaryRank.LIEUTENANT_GENERAL,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
text: "Generalmajor",
|
|
88
|
+
value: MilitaryRank.MAJOR_GENERAL,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
text: "Amiral",
|
|
92
|
+
value: MilitaryRank.ADMIRAL,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
text: "Viceamiral",
|
|
96
|
+
value: MilitaryRank.VICE_ADMIRAL,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
text: "Konteramiral",
|
|
100
|
+
value: MilitaryRank.REAR_ADMIRAL,
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
export const PepRolePage: FunctionComponent<Props> = ({ next }) => {
|
|
105
|
+
const pepContext = useContext(PepContext);
|
|
106
|
+
const formRef = useRef<LysaFormRef>();
|
|
107
|
+
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
108
|
+
const type = pepContext.state.type;
|
|
109
|
+
|
|
110
|
+
const nextPage = useCallback(() => {
|
|
111
|
+
if (formRef.current && formRef.current.isValid) {
|
|
112
|
+
next();
|
|
113
|
+
}
|
|
114
|
+
}, [formRef, next]);
|
|
115
|
+
|
|
116
|
+
const resetRoleFields = useCallback(() => {
|
|
117
|
+
pepContext.setState({
|
|
118
|
+
ambassadorCountry: undefined,
|
|
119
|
+
governmentCompany: undefined,
|
|
120
|
+
governmentCompanyRole: undefined,
|
|
121
|
+
internationalOrganisation: undefined,
|
|
122
|
+
internationalOrganisationRole: undefined,
|
|
123
|
+
militaryRank: undefined,
|
|
124
|
+
});
|
|
125
|
+
}, [pepContext]);
|
|
126
|
+
|
|
127
|
+
if (!type || type === PepType.NOT_PEP) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<Form onSubmit={() => nextPage()} lysaFormRef={formRef}>
|
|
133
|
+
<Select
|
|
134
|
+
label={getRoleLabel(
|
|
135
|
+
entityType,
|
|
136
|
+
type,
|
|
137
|
+
pepContext.state.relationToPEP,
|
|
138
|
+
pepContext.state.businessRelation,
|
|
139
|
+
pepContext.state.ownerName
|
|
140
|
+
)}
|
|
141
|
+
placeholder="Välj en roll"
|
|
142
|
+
alternatives={roleAlternatives}
|
|
143
|
+
value={roleAlternatives.find(
|
|
144
|
+
alt => alt.value === pepContext.state.role
|
|
145
|
+
)}
|
|
146
|
+
onChange={event => {
|
|
147
|
+
pepContext.setState({ role: event.value as Role });
|
|
148
|
+
resetRoleFields();
|
|
149
|
+
}}
|
|
150
|
+
validators={[new RequiredValidator("Du måste välja roll")]}
|
|
151
|
+
/>
|
|
152
|
+
|
|
153
|
+
{pepContext.state.role && pepContext.state.role === Role.AMBASSADOR ? (
|
|
154
|
+
<CountrySelect
|
|
155
|
+
label={getAmbassadorLabel(
|
|
156
|
+
entityType,
|
|
157
|
+
type,
|
|
158
|
+
pepContext.state.relationToPEP,
|
|
159
|
+
pepContext.state.businessRelation,
|
|
160
|
+
pepContext.state.ownerName
|
|
161
|
+
)}
|
|
162
|
+
onChange={event =>
|
|
163
|
+
pepContext.setState({
|
|
164
|
+
ambassadorCountry: event.value
|
|
165
|
+
? event.value.toString()
|
|
166
|
+
: undefined,
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
value={pepContext.state.ambassadorCountry}
|
|
170
|
+
validators={[new RequiredValidator("Du måste välja land")]}
|
|
171
|
+
/>
|
|
172
|
+
) : null}
|
|
173
|
+
|
|
174
|
+
{pepContext.state.role &&
|
|
175
|
+
pepContext.state.role === Role.GOVERNMENT_COMPANY ? (
|
|
176
|
+
<React.Fragment>
|
|
177
|
+
<TextInput
|
|
178
|
+
label={getGovernmentCompanyNameLabel(
|
|
179
|
+
entityType,
|
|
180
|
+
type,
|
|
181
|
+
pepContext.state.relationToPEP,
|
|
182
|
+
pepContext.state.businessRelation,
|
|
183
|
+
pepContext.state.ownerName
|
|
184
|
+
)}
|
|
185
|
+
value={pepContext.state.governmentCompany || ""}
|
|
186
|
+
onChange={value => {
|
|
187
|
+
pepContext.setState({ governmentCompany: value });
|
|
188
|
+
}}
|
|
189
|
+
validators={[new RequiredValidator("Du måste ange ett namn")]}
|
|
190
|
+
/>
|
|
191
|
+
<TextInput
|
|
192
|
+
label={getGovernmentCompanyRoleLabel(
|
|
193
|
+
entityType,
|
|
194
|
+
type,
|
|
195
|
+
pepContext.state.relationToPEP,
|
|
196
|
+
pepContext.state.businessRelation,
|
|
197
|
+
pepContext.state.ownerName
|
|
198
|
+
)}
|
|
199
|
+
value={pepContext.state.governmentCompanyRole || ""}
|
|
200
|
+
onChange={value => {
|
|
201
|
+
pepContext.setState({
|
|
202
|
+
governmentCompanyRole: value,
|
|
203
|
+
});
|
|
204
|
+
}}
|
|
205
|
+
validators={[new RequiredValidator("Du måste ange roll")]}
|
|
206
|
+
/>
|
|
207
|
+
</React.Fragment>
|
|
208
|
+
) : null}
|
|
209
|
+
|
|
210
|
+
{pepContext.state.role &&
|
|
211
|
+
pepContext.state.role ===
|
|
212
|
+
Role.HIGH_RANKING_POSITION_INTERNALTIONAL_CORP ? (
|
|
213
|
+
<React.Fragment>
|
|
214
|
+
<TextInput
|
|
215
|
+
label={getHighRankingPositionIntCorpNameLabel(
|
|
216
|
+
entityType,
|
|
217
|
+
type,
|
|
218
|
+
pepContext.state.relationToPEP,
|
|
219
|
+
pepContext.state.businessRelation,
|
|
220
|
+
pepContext.state.ownerName
|
|
221
|
+
)}
|
|
222
|
+
value={pepContext.state.internationalOrganisation || ""}
|
|
223
|
+
onChange={value => {
|
|
224
|
+
pepContext.setState({ internationalOrganisation: value });
|
|
225
|
+
}}
|
|
226
|
+
validators={[new RequiredValidator("Du måste ange ett namn")]}
|
|
227
|
+
/>
|
|
228
|
+
<TextInput
|
|
229
|
+
label={getHighRankingPositionIntCorpRoleLabel(
|
|
230
|
+
entityType,
|
|
231
|
+
type,
|
|
232
|
+
pepContext.state.relationToPEP,
|
|
233
|
+
pepContext.state.businessRelation,
|
|
234
|
+
pepContext.state.ownerName
|
|
235
|
+
)}
|
|
236
|
+
value={pepContext.state.internationalOrganisationRole || ""}
|
|
237
|
+
onChange={value => {
|
|
238
|
+
pepContext.setState({
|
|
239
|
+
internationalOrganisationRole: value,
|
|
240
|
+
});
|
|
241
|
+
}}
|
|
242
|
+
validators={[new RequiredValidator("Du måste ange roll")]}
|
|
243
|
+
/>
|
|
244
|
+
</React.Fragment>
|
|
245
|
+
) : null}
|
|
246
|
+
|
|
247
|
+
{pepContext.state.role &&
|
|
248
|
+
pepContext.state.role === Role.MILITARY_OFFICER ? (
|
|
249
|
+
<Select
|
|
250
|
+
label={getMilitaryRankLabel(
|
|
251
|
+
entityType,
|
|
252
|
+
type,
|
|
253
|
+
pepContext.state.relationToPEP,
|
|
254
|
+
pepContext.state.businessRelation,
|
|
255
|
+
pepContext.state.ownerName
|
|
256
|
+
)}
|
|
257
|
+
placeholder="Välj grad"
|
|
258
|
+
alternatives={militaryAlternatives}
|
|
259
|
+
value={militaryAlternatives.find(
|
|
260
|
+
alt => alt.value === pepContext.state.militaryRank
|
|
261
|
+
)}
|
|
262
|
+
onChange={event => {
|
|
263
|
+
pepContext.setState({ militaryRank: event.value as MilitaryRank });
|
|
264
|
+
}}
|
|
265
|
+
validators={[new RequiredValidator("Du måste ange en grad")]}
|
|
266
|
+
/>
|
|
267
|
+
) : null}
|
|
268
|
+
|
|
269
|
+
<PrimaryButton type="submit">Nästa</PrimaryButton>
|
|
270
|
+
</Form>
|
|
271
|
+
);
|
|
272
|
+
};
|