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