@lysaab/lysa-pep 1.0.0 → 1.0.1-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/.vscode/settings.json +4 -0
- package/lib/Exports.d.ts +7 -8
- package/lib/Exports.js +7 -8
- package/lib/components/CountrySelect.d.ts +15 -22
- package/lib/components/CountrySelect.js +30 -21
- package/lib/components/PepAnswers.d.ts +8 -8
- package/lib/components/PepAnswers.js +131 -39
- package/lib/components/PepAnswers.scss +7 -7
- 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 +322 -380
- package/lib/model/PepTexts.js +467 -552
- package/lib/pages/IsPep/IsPepMessages.d.ts +32 -0
- package/lib/pages/IsPep/IsPepMessages.js +74 -0
- package/lib/pages/IsPep/IsPepPage.d.ts +14 -0
- package/lib/pages/IsPep/IsPepPage.js +39 -0
- package/lib/pages/PepContext.d.ts +80 -80
- package/lib/pages/PepContext.js +88 -88
- package/lib/pages/PepIsPepPage.d.ts +6 -15
- package/lib/pages/PepIsPepPage.js +57 -59
- package/lib/pages/PepRelationPage.d.ts +6 -6
- package/lib/pages/PepRelationPage.js +83 -79
- package/lib/pages/PepRolePage.d.ts +9 -10
- package/lib/pages/PepRolePage.js +127 -127
- package/lib/pages/PepStatusPage.d.ts +6 -6
- package/lib/pages/PepStatusPage.js +57 -58
- package/lib/pages/RelationPage/RelationMessages.d.ts +105 -0
- package/lib/pages/RelationPage/RelationMessages.js +282 -0
- package/lib/pages/RelationPage/RelationPage.d.ts +6 -0
- package/lib/pages/RelationPage/RelationPage.js +142 -0
- package/lib/pages/RolePage/RoleMessages.d.ts +185 -0
- package/lib/pages/RolePage/RoleMessages.js +381 -0
- package/lib/pages/RolePage/RolePage.d.ts +11 -0
- package/lib/pages/RolePage/RolePage.js +214 -0
- package/lib/pages/StatusPage/StatusMessages.d.ts +72 -0
- package/lib/pages/StatusPage/StatusMessages.js +74 -0
- package/lib/pages/StatusPage/StatusPage.d.ts +6 -0
- package/lib/pages/StatusPage/StatusPage.js +75 -0
- package/package.json +57 -53
- package/src/Exports.ts +12 -13
- package/src/components/CountrySelect.tsx +47 -43
- package/src/components/PepAnswers.scss +7 -7
- package/src/components/PepAnswers.tsx +252 -120
- package/src/demo/Done.tsx +16 -20
- package/src/demo/Pep.tsx +112 -106
- package/src/model/PepModel.ts +52 -52
- package/src/pages/IsPep/IsPepMessages.ts +75 -0
- package/src/pages/IsPep/IsPepPage.tsx +94 -0
- package/src/pages/PepContext.tsx +144 -144
- package/src/pages/RelationPage/RelationMessages.ts +287 -0
- package/src/pages/RelationPage/RelationPage.tsx +269 -0
- package/src/pages/RolePage/RoleMessages.ts +389 -0
- package/src/pages/RolePage/RolePage.tsx +342 -0
- package/src/pages/StatusPage/StatusMessages.ts +80 -0
- package/src/pages/StatusPage/StatusPage.tsx +172 -0
- package/src/model/PepTexts.ts +0 -607
- package/src/pages/PepIsPepPage.tsx +0 -107
- package/src/pages/PepRelationPage.tsx +0 -188
- package/src/pages/PepRolePage.tsx +0 -272
- package/src/pages/PepStatusPage.tsx +0 -157
|
@@ -1,157 +0,0 @@
|
|
|
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 { Alternative } from "@lysaab/ui-2/components/input/InputAPI";
|
|
16
|
-
import { PepContext, PepStatus, EntityType, PepType } from "./PepContext";
|
|
17
|
-
import { CountrySelect } from "../components/CountrySelect";
|
|
18
|
-
import {
|
|
19
|
-
LABELS,
|
|
20
|
-
getStatusOngoingHeader,
|
|
21
|
-
getStatusCountryHeader,
|
|
22
|
-
} from "../model/PepTexts";
|
|
23
|
-
|
|
24
|
-
const stateAlternatives: Alternative<PepStatus>[] = [
|
|
25
|
-
{
|
|
26
|
-
text: "Pågående",
|
|
27
|
-
value: PepStatus.ONGOING,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
text: "Avslutad",
|
|
31
|
-
value: PepStatus.ENDED,
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
const isSwedenAlternatives: Alternative<string>[] = [
|
|
36
|
-
{ text: "Sverige", value: "sweden" },
|
|
37
|
-
{ text: "Annat", value: "other" },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
interface Props {
|
|
41
|
-
next: () => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const PepStatusPage: FunctionComponent<Props> = ({ next }) => {
|
|
45
|
-
const pepContext = useContext(PepContext);
|
|
46
|
-
const formRef = useRef<LysaFormRef>();
|
|
47
|
-
|
|
48
|
-
const nextPage = useCallback(() => {
|
|
49
|
-
if (formRef.current && formRef.current.isValid) {
|
|
50
|
-
next();
|
|
51
|
-
}
|
|
52
|
-
}, [formRef, next]);
|
|
53
|
-
|
|
54
|
-
const updateIsSweden = useCallback(
|
|
55
|
-
(alternative: Alternative<string>) => {
|
|
56
|
-
pepContext.setState({ isSweden: alternative.value });
|
|
57
|
-
|
|
58
|
-
if (alternative.value === "other") {
|
|
59
|
-
pepContext.setState({ country: undefined });
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
[pepContext]
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const updateIsOngoing = useCallback(
|
|
66
|
-
(alternative: Alternative<PepStatus>) => {
|
|
67
|
-
pepContext.setState({ isOngoing: alternative.value });
|
|
68
|
-
|
|
69
|
-
if (alternative.value === PepStatus.ONGOING) {
|
|
70
|
-
pepContext.setState({ ended: undefined });
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
[pepContext]
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const labels = LABELS(pepContext.state.ownerName);
|
|
77
|
-
const entityType = pepContext.state.legalEntityType || EntityType.PERSON;
|
|
78
|
-
const type = pepContext.state.type;
|
|
79
|
-
|
|
80
|
-
if (!type || type === PepType.NOT_PEP) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<div>
|
|
86
|
-
<Form
|
|
87
|
-
lysaFormRef={formRef}
|
|
88
|
-
onSubmit={() => {
|
|
89
|
-
nextPage();
|
|
90
|
-
}}
|
|
91
|
-
>
|
|
92
|
-
<RadioGroup
|
|
93
|
-
alternatives={stateAlternatives}
|
|
94
|
-
header={getStatusOngoingHeader(
|
|
95
|
-
entityType,
|
|
96
|
-
type,
|
|
97
|
-
pepContext.state.relationToPEP,
|
|
98
|
-
pepContext.state.businessRelation,
|
|
99
|
-
pepContext.state.ownerName
|
|
100
|
-
)}
|
|
101
|
-
onChange={updateIsOngoing}
|
|
102
|
-
value={stateAlternatives.find(
|
|
103
|
-
(alt) => alt.value === pepContext.state.isOngoing
|
|
104
|
-
)}
|
|
105
|
-
validators={[new RequiredValidator("Du måste välja ett alternativ")]}
|
|
106
|
-
/>
|
|
107
|
-
|
|
108
|
-
{pepContext.state.isOngoing &&
|
|
109
|
-
pepContext.state.isOngoing === PepStatus.ENDED ? (
|
|
110
|
-
<Datepicker
|
|
111
|
-
label="När avslutades uppdraget?"
|
|
112
|
-
selected={pepContext.state.ended}
|
|
113
|
-
onChange={(event) =>
|
|
114
|
-
pepContext.setState({ ended: event || undefined })
|
|
115
|
-
}
|
|
116
|
-
validators={[new RequiredValidator("Du måste ange datum")]}
|
|
117
|
-
showMonthYearPicker
|
|
118
|
-
dateFormat="yyyy-MM"
|
|
119
|
-
maxDate={new Date()}
|
|
120
|
-
/>
|
|
121
|
-
) : null}
|
|
122
|
-
|
|
123
|
-
<RadioGroup
|
|
124
|
-
alternatives={isSwedenAlternatives}
|
|
125
|
-
header={getStatusCountryHeader(
|
|
126
|
-
entityType,
|
|
127
|
-
type,
|
|
128
|
-
pepContext.state.relationToPEP,
|
|
129
|
-
pepContext.state.businessRelation,
|
|
130
|
-
pepContext.state.ownerName
|
|
131
|
-
)}
|
|
132
|
-
onChange={updateIsSweden}
|
|
133
|
-
value={isSwedenAlternatives.find(
|
|
134
|
-
(alt) => alt.value === pepContext.state.isSweden
|
|
135
|
-
)}
|
|
136
|
-
validators={[new RequiredValidator("Du måste välja ett alternativ")]}
|
|
137
|
-
/>
|
|
138
|
-
|
|
139
|
-
{pepContext.state.isSweden && pepContext.state.isSweden === "other" ? (
|
|
140
|
-
<CountrySelect
|
|
141
|
-
label="Välj i vilket land befattningen är"
|
|
142
|
-
onChange={(event) =>
|
|
143
|
-
pepContext.setState({
|
|
144
|
-
country: event.value ? event.value.toString() : undefined,
|
|
145
|
-
})
|
|
146
|
-
}
|
|
147
|
-
validators={[new RequiredValidator("Du måste välja land")]}
|
|
148
|
-
value={pepContext.state.country}
|
|
149
|
-
removeSweden={true}
|
|
150
|
-
/>
|
|
151
|
-
) : null}
|
|
152
|
-
|
|
153
|
-
<PrimaryButton type="submit">Nästa</PrimaryButton>
|
|
154
|
-
</Form>
|
|
155
|
-
</div>
|
|
156
|
-
);
|
|
157
|
-
};
|