datastake-daf 0.6.794 → 0.6.795
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/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +3159 -4303
- package/dist/pages/index.js +2045 -3246
- package/dist/services/index.js +3 -69
- package/dist/utils/index.js +20 -14
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Map/hook.js +25 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/helper.js +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +8 -18
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -6
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +7 -6
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +45 -73
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +37 -37
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +22 -48
- package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +1 -3
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/SidebarMenu/index.jsx +3 -5
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +8 -13
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +4 -3
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +2 -81
- package/src/@daf/pages/Dashboards/SelfAssesment/components/AssociatedInformation/index.jsx +1 -1
- package/src/@daf/pages/Dashboards/SelfAssesment/components/OrganisationInformation/columns.js +0 -1
- package/src/@daf/pages/Dashboards/SelfAssesment/components/ProductionSites/columns.js +3 -2
- package/src/@daf/pages/Dashboards/SelfAssesment/components/ProductionSites/index.jsx +13 -4
- package/src/@daf/pages/Dashboards/SelfAssesment/index.jsx +22 -20
- package/src/@daf/pages/Events/Activities/columns.js +1 -1
- package/src/@daf/pages/Events/Activities/config.js +23 -30
- package/src/@daf/pages/Events/Incidents/columns.js +1 -1
- package/src/@daf/pages/Events/Incidents/config.js +23 -30
- package/src/@daf/pages/Events/config.js +7 -7
- package/src/@daf/pages/Locations/MineSite/columns.js +3 -3
- package/src/@daf/pages/Locations/MineSite/config.js +20 -14
- package/src/@daf/pages/Locations/config.js +3 -3
- package/src/@daf/pages/Stakeholders/Operators/columns.js +2 -2
- package/src/@daf/pages/Stakeholders/Operators/config.js +9 -16
- package/src/@daf/pages/Stakeholders/Workers/columns.js +1 -1
- package/src/@daf/pages/Stakeholders/Workers/config.js +23 -29
- package/src/@daf/pages/Stakeholders/config.js +3 -3
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +1 -1
- package/src/@daf/pages/TablePage/helper.js +17 -1
- package/src/@daf/pages/TablePage/hook.js +3 -1
- package/src/@daf/pages/TablePage/index.jsx +8 -6
- package/src/@daf/pages/View/index.jsx +4 -2
- package/src/@daf/services/AdminService.js +7 -79
- package/src/@daf/services/DashboardService.js +1 -2
- package/src/@daf/utils/filters.js +26 -15
- package/src/constants/locales/en/translation.js +1 -7
- package/src/constants/locales/fr/translation.js +2 -1
- package/src/constants/locales/sp/translation.js +2 -1
- package/src/pages.js +1 -10
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/columns.js +0 -79
- package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +0 -272
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +0 -223
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +0 -65
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +0 -81
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +0 -76
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +0 -38
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +0 -13
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +0 -77
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +0 -38
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +0 -75
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +0 -180
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +0 -27
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +0 -157
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +0 -31
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +0 -77
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +0 -117
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +0 -54
- package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { Checkbox, Tooltip, Avatar } from "antd";
|
|
2
|
-
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
3
|
-
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
4
|
-
import { getNameByLevel } from "../../AdminViews/ViewLocation/helpers.js";
|
|
5
|
-
|
|
6
|
-
export const getColumns = ({
|
|
7
|
-
t,
|
|
8
|
-
goTo = () => {},
|
|
9
|
-
show = "show",
|
|
10
|
-
getRedirectLink = () => {},
|
|
11
|
-
token,
|
|
12
|
-
selectedLocations,
|
|
13
|
-
setSelectedLocations,
|
|
14
|
-
selectOptions,
|
|
15
|
-
entity,
|
|
16
|
-
}) => {
|
|
17
|
-
const cols = [
|
|
18
|
-
{
|
|
19
|
-
title: "",
|
|
20
|
-
dataIndex: "select",
|
|
21
|
-
key: "select",
|
|
22
|
-
width: 50,
|
|
23
|
-
show: true,
|
|
24
|
-
render: (v, all) => {
|
|
25
|
-
if (all.empty) {
|
|
26
|
-
return <div className="daf-default-cell" />;
|
|
27
|
-
}
|
|
28
|
-
return (
|
|
29
|
-
<Checkbox
|
|
30
|
-
onChange={() =>
|
|
31
|
-
setSelectedLocations((prev) => {
|
|
32
|
-
const isSelected = prev.some((p) => p.id === all.id);
|
|
33
|
-
if (isSelected) {
|
|
34
|
-
return prev.filter((p) => p.id !== all.id);
|
|
35
|
-
}
|
|
36
|
-
return [...prev, all];
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
checked={selectedLocations.some((p) => p.id === all.id)}
|
|
40
|
-
disabled={
|
|
41
|
-
selectedLocations?.length >= 3 &&
|
|
42
|
-
!selectedLocations.some((p) => p.id === all.id)
|
|
43
|
-
}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
title: t("ID"),
|
|
50
|
-
dataIndex: "datastakeId",
|
|
51
|
-
key: "datastakeId",
|
|
52
|
-
ellipsis: true,
|
|
53
|
-
show: true,
|
|
54
|
-
render: (value, all) => {
|
|
55
|
-
if (all.empty) {
|
|
56
|
-
return <div className="daf-default-cell" />;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return <Tooltip title={value}>{value}</Tooltip>;
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
title: t("Name"),
|
|
64
|
-
dataIndex: "name",
|
|
65
|
-
key: "name",
|
|
66
|
-
ellipsis: true,
|
|
67
|
-
show: true,
|
|
68
|
-
render: (value, all) => {
|
|
69
|
-
if (all.empty) {
|
|
70
|
-
return <div className="daf-default-cell" />;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return <Tooltip title={value}>{value}</Tooltip>;
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
title: t("Category"),
|
|
78
|
-
dataIndex: "category",
|
|
79
|
-
key: "category",
|
|
80
|
-
ellipsis: true,
|
|
81
|
-
show: true,
|
|
82
|
-
render: (value, all) => {
|
|
83
|
-
if (all.empty) {
|
|
84
|
-
return <div className="daf-default-cell" />;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const category = findOptions(value, selectOptions?.category || []) || "--";
|
|
88
|
-
|
|
89
|
-
return <Tooltip title={category}>{category}</Tooltip>;
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
title: t("Country"),
|
|
94
|
-
dataIndex: "country",
|
|
95
|
-
key: "country",
|
|
96
|
-
ellipsis: true,
|
|
97
|
-
show: true,
|
|
98
|
-
render: (value, all) => {
|
|
99
|
-
if (all.empty) {
|
|
100
|
-
return <div className="daf-default-cell" />;
|
|
101
|
-
}
|
|
102
|
-
const country = findOptions(value, selectOptions?.country || []) || "--";
|
|
103
|
-
|
|
104
|
-
return <Tooltip title={country}>{country}</Tooltip>;
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
title: t("Admin Level 1"),
|
|
109
|
-
dataIndex: "administrativeLevel1",
|
|
110
|
-
key: "administrativeLevel1",
|
|
111
|
-
ellipsis: true,
|
|
112
|
-
show: entity.includes("location"),
|
|
113
|
-
render: (value, all) => {
|
|
114
|
-
if (all.empty) {
|
|
115
|
-
return <div className="daf-default-cell" />;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let label;
|
|
119
|
-
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
120
|
-
label = all?.linking?.SCL?.[value]?.name
|
|
121
|
-
} else {
|
|
122
|
-
label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
title: t("Admin Level 2"),
|
|
130
|
-
dataIndex: "administrativeLevel2",
|
|
131
|
-
key: "administrativeLevel2",
|
|
132
|
-
show: entity.includes("location"),
|
|
133
|
-
ellipsis: true,
|
|
134
|
-
render: (value, all) => {
|
|
135
|
-
if (all.empty) {
|
|
136
|
-
return <div className="daf-default-cell" />;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
let label;
|
|
140
|
-
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
141
|
-
label = all?.linking?.SCL?.[value]?.name
|
|
142
|
-
} else {
|
|
143
|
-
label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
title: t("Sources"),
|
|
151
|
-
dataIndex: "sources",
|
|
152
|
-
key: "sources",
|
|
153
|
-
show: true,
|
|
154
|
-
render: (value, all) => {
|
|
155
|
-
if (all.empty) {
|
|
156
|
-
return <div className="daf-default-cell" />;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const MAX_SOURCES = 3;
|
|
160
|
-
const count = value?.length === MAX_SOURCES + 1 ? value?.length : MAX_SOURCES;
|
|
161
|
-
return (
|
|
162
|
-
Array.isArray(value) && value?.length > 0 ? <Avatar.Group
|
|
163
|
-
max={{
|
|
164
|
-
count: count,
|
|
165
|
-
style: {
|
|
166
|
-
color: token.baseGray90,
|
|
167
|
-
backgroundColor: token.baseGray20,
|
|
168
|
-
border: `1px solid ${token.baseGray40}`,
|
|
169
|
-
},
|
|
170
|
-
}}
|
|
171
|
-
size={"small"}
|
|
172
|
-
>
|
|
173
|
-
{value.map((v, i) => (
|
|
174
|
-
<Avatar
|
|
175
|
-
key={i}
|
|
176
|
-
size={"small"}
|
|
177
|
-
style={{
|
|
178
|
-
backgroundColor: token.baseGray20,
|
|
179
|
-
color: token.baseGray90,
|
|
180
|
-
border: `1px solid ${token.baseGray40}`,
|
|
181
|
-
display: "flex",
|
|
182
|
-
alignItems: "center",
|
|
183
|
-
justifyContent: "center",
|
|
184
|
-
}}
|
|
185
|
-
>
|
|
186
|
-
<CustomIcon
|
|
187
|
-
name="Organisation02"
|
|
188
|
-
width={18}
|
|
189
|
-
height={18}
|
|
190
|
-
color={token.baseGray90}
|
|
191
|
-
/>
|
|
192
|
-
</Avatar>
|
|
193
|
-
))}
|
|
194
|
-
</Avatar.Group> : '-'
|
|
195
|
-
);
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
title: "",
|
|
200
|
-
dataIndex: "actions",
|
|
201
|
-
key: "actions",
|
|
202
|
-
width: 60,
|
|
203
|
-
show: true,
|
|
204
|
-
render: (value, all) => {
|
|
205
|
-
if (all.empty) {
|
|
206
|
-
return <div className="daf-default-cell" />;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<div
|
|
211
|
-
className="cursor-pointer"
|
|
212
|
-
onClick={() => {
|
|
213
|
-
goTo(getRedirectLink(`/app/management/subject/location/${all.id}`)); }}
|
|
214
|
-
>
|
|
215
|
-
<CustomIcon name="Link" width={18} height={18} />
|
|
216
|
-
</div>
|
|
217
|
-
);
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
];
|
|
221
|
-
|
|
222
|
-
return cols.filter((c) => c[show]);
|
|
223
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export const getTabs = ({ t }) => {
|
|
2
|
-
return [
|
|
3
|
-
{
|
|
4
|
-
key: "active",
|
|
5
|
-
label: t("Active"),
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
key: "pending",
|
|
9
|
-
label: t("Pending"),
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
key: 'suspended',
|
|
13
|
-
label: t("Suspended"),
|
|
14
|
-
}
|
|
15
|
-
];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const selectFiltersConfig = {
|
|
19
|
-
category: {
|
|
20
|
-
type: "select",
|
|
21
|
-
label: "Category",
|
|
22
|
-
placeholder: (t) => t("Category"),
|
|
23
|
-
style: { flex: 1 },
|
|
24
|
-
labelStyle: { flex: 1 },
|
|
25
|
-
getLabel: (option) => option.label,
|
|
26
|
-
getValue: (option) => option.value,
|
|
27
|
-
},
|
|
28
|
-
country: {
|
|
29
|
-
type: "select",
|
|
30
|
-
label: "Country",
|
|
31
|
-
placeholder: (t) => t("Country"),
|
|
32
|
-
style: { flex: 1 },
|
|
33
|
-
labelStyle: { flex: 1 },
|
|
34
|
-
getLabel: (option) => option.label,
|
|
35
|
-
getValue: (option) => option.value,
|
|
36
|
-
},
|
|
37
|
-
sources: {
|
|
38
|
-
type: "select",
|
|
39
|
-
label: "Sources",
|
|
40
|
-
placeholder: (t) => t("Sources"),
|
|
41
|
-
style: { flex: 1 },
|
|
42
|
-
labelStyle: { flex: 1 },
|
|
43
|
-
getLabel: (option) => option.label,
|
|
44
|
-
getValue: (option) => option.value,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const filtersConfig = {
|
|
49
|
-
name: "",
|
|
50
|
-
datastakeId: "",
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const defaultUrlParams = { activeTab: "active" };
|
|
54
|
-
|
|
55
|
-
export const checkboxConfig = {
|
|
56
|
-
name: "Name",
|
|
57
|
-
datastakeId: "ID",
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const getNameByLevel = (data, level) => {
|
|
61
|
-
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
62
|
-
return entry;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Form, Input, Select } from "antd";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { useForms } from "../../../../../context/Forms";
|
|
4
|
-
export default function EditLocation({
|
|
5
|
-
t,
|
|
6
|
-
conf,
|
|
7
|
-
data = {},
|
|
8
|
-
formOptions = {},
|
|
9
|
-
MainForm,
|
|
10
|
-
setData = () => {},
|
|
11
|
-
isChanged,
|
|
12
|
-
setIsChanged,
|
|
13
|
-
goToView,
|
|
14
|
-
}) {
|
|
15
|
-
const { addCheck, removeCheck } = useForms();
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (isChanged) {
|
|
19
|
-
addCheck(() => goToView());
|
|
20
|
-
} else {
|
|
21
|
-
removeCheck();
|
|
22
|
-
}
|
|
23
|
-
}, [isChanged, addCheck, removeCheck, goToView]);
|
|
24
|
-
|
|
25
|
-
const renderItem = (item) => {
|
|
26
|
-
const getValue = () => {
|
|
27
|
-
switch (item.type) {
|
|
28
|
-
case "select":
|
|
29
|
-
return (
|
|
30
|
-
<Select
|
|
31
|
-
options={(formOptions[item.optionsName] || []).map((o) => ({
|
|
32
|
-
value: o.value,
|
|
33
|
-
label: t(o.label),
|
|
34
|
-
}))}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
37
|
-
case "administrative":
|
|
38
|
-
|
|
39
|
-
return <Input disabled />;
|
|
40
|
-
default:
|
|
41
|
-
return <Input />;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className="group" key={item.key}>
|
|
47
|
-
<Form.Item label={t(item.label)} name={item.key}>
|
|
48
|
-
{getValue()}
|
|
49
|
-
</Form.Item>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// Safety check for conf and conf.items
|
|
55
|
-
if (!conf || !conf.items || !Array.isArray(conf.items)) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<div className="form-edit flex-row">
|
|
61
|
-
<Form
|
|
62
|
-
onValuesChange={(changedData) => {
|
|
63
|
-
setIsChanged(true);
|
|
64
|
-
setData((prev) => ({ ...prev, ...changedData }));
|
|
65
|
-
}}
|
|
66
|
-
style={{ width: 700 }}
|
|
67
|
-
layout="vertical"
|
|
68
|
-
form={MainForm}
|
|
69
|
-
>
|
|
70
|
-
<div className="group">
|
|
71
|
-
<div className="daf-title with-subtitle">
|
|
72
|
-
<h1>{t(conf.title)}</h1>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
{conf.items.map((item) => renderItem(item))}
|
|
77
|
-
</Form>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Form, Input, Select } from "antd";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { useForms } from "../../../../../context/Forms";
|
|
4
|
-
|
|
5
|
-
export default function EditStakeholder({
|
|
6
|
-
t,
|
|
7
|
-
conf,
|
|
8
|
-
data = {},
|
|
9
|
-
formOptions = {},
|
|
10
|
-
MainForm,
|
|
11
|
-
setData = () => {},
|
|
12
|
-
isChanged,
|
|
13
|
-
setIsChanged,
|
|
14
|
-
goToView,
|
|
15
|
-
}) {
|
|
16
|
-
const { addCheck, removeCheck } = useForms();
|
|
17
|
-
console.log(conf,"data");
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (isChanged) {
|
|
20
|
-
addCheck(() => goToView());
|
|
21
|
-
} else {
|
|
22
|
-
removeCheck();
|
|
23
|
-
}
|
|
24
|
-
}, [isChanged, addCheck, removeCheck, goToView]);
|
|
25
|
-
|
|
26
|
-
const renderItem = (item) => {
|
|
27
|
-
const getValue = () => {
|
|
28
|
-
switch (item.type) {
|
|
29
|
-
case "select":
|
|
30
|
-
return (
|
|
31
|
-
<Select
|
|
32
|
-
options={(formOptions[item.optionsName] || []).map((o) => ({
|
|
33
|
-
value: o.value,
|
|
34
|
-
label: t(o.label),
|
|
35
|
-
}))}
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
38
|
-
default:
|
|
39
|
-
return <Input />;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className="group" key={item.key}>
|
|
45
|
-
<Form.Item label={t(item.label)} name={item.key}>
|
|
46
|
-
{getValue()}
|
|
47
|
-
</Form.Item>
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<div className="form-edit flex-row">
|
|
56
|
-
<Form
|
|
57
|
-
onValuesChange={(changedData) => {
|
|
58
|
-
setIsChanged(true);
|
|
59
|
-
setData((prev) => ({ ...prev, ...changedData }));
|
|
60
|
-
}}
|
|
61
|
-
style={{ width: 700 }}
|
|
62
|
-
layout="vertical"
|
|
63
|
-
form={MainForm}
|
|
64
|
-
>
|
|
65
|
-
<div className="group">
|
|
66
|
-
<div className="daf-title with-subtitle">
|
|
67
|
-
<h1>{t(conf.title)}</h1>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
{conf.items.map((item) => renderItem(item))}
|
|
72
|
-
</Form>
|
|
73
|
-
</div>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export const config = [
|
|
2
|
-
{
|
|
3
|
-
label: "Core Data",
|
|
4
|
-
key: "core-data",
|
|
5
|
-
title: "Core Data",
|
|
6
|
-
items: [
|
|
7
|
-
{
|
|
8
|
-
label: "Name",
|
|
9
|
-
key: "name",
|
|
10
|
-
type: "input"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
label: "Category",
|
|
14
|
-
key: "category",
|
|
15
|
-
type: "select",
|
|
16
|
-
optionsName: "category"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: "Country",
|
|
20
|
-
key: "country",
|
|
21
|
-
type: "select",
|
|
22
|
-
optionsName: "countries"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
label: "Province",
|
|
26
|
-
key: "administrativeLevel1",
|
|
27
|
-
type: "administrative",
|
|
28
|
-
level: "level_1"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: "Territory",
|
|
32
|
-
key: "administrativeLevel2",
|
|
33
|
-
type: "administrative",
|
|
34
|
-
level: "level_2"
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const getNameByLevel = (data, level) => {
|
|
2
|
-
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
3
|
-
return entry?.name || "-";
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export const getAdministrativeLevel1 = (location) => {
|
|
7
|
-
return getNameByLevel(location?.linking?.SCL, "level_1");
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const getAdministrativeLevel2 = (location) => {
|
|
11
|
-
return getNameByLevel(location?.linking?.SCL, "level_2");
|
|
12
|
-
};
|
|
13
|
-
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
2
|
-
import { getNameByLevel } from "./helpers.js";
|
|
3
|
-
import LocationTable from "../../AdminTables/LocationTable/index.jsx";
|
|
4
|
-
|
|
5
|
-
const isView = true;
|
|
6
|
-
|
|
7
|
-
export default function View({
|
|
8
|
-
userRoles = [],
|
|
9
|
-
conf,
|
|
10
|
-
data = {},
|
|
11
|
-
formOptions = {},
|
|
12
|
-
t,
|
|
13
|
-
goTo,
|
|
14
|
-
location,
|
|
15
|
-
getRedirectLink,
|
|
16
|
-
accountStatuses,
|
|
17
|
-
module,
|
|
18
|
-
}) {
|
|
19
|
-
const renderItem = (item) => {
|
|
20
|
-
if (item.type === "location") {
|
|
21
|
-
return (
|
|
22
|
-
<LocationTable
|
|
23
|
-
isView={isView}
|
|
24
|
-
entityData={data}
|
|
25
|
-
goTo={goTo}
|
|
26
|
-
getRedirectLink={getRedirectLink}
|
|
27
|
-
t={t}
|
|
28
|
-
location={location}
|
|
29
|
-
module={module}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const getValue = () => {
|
|
35
|
-
const val =
|
|
36
|
-
item.getFormApps === true
|
|
37
|
-
? data?.apps?.find((app) => app.app === module)?.[item?.propertyName]
|
|
38
|
-
: data?.[item.key];
|
|
39
|
-
|
|
40
|
-
if (item.type === "select") {
|
|
41
|
-
const option = findOptions(val, formOptions[item.optionsName] || []);
|
|
42
|
-
return option ? t(option) : "-";
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (item.type === "administrative") {
|
|
46
|
-
return getNameByLevel(data?.linking?.SCL, item.level) || "-";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return val ?? "-";
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<div className="input" key={item.key}>
|
|
54
|
-
<p className="label">
|
|
55
|
-
<span>{t(item.label)}</span>
|
|
56
|
-
</p>
|
|
57
|
-
<p className="value">{getValue()}</p>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<div className="content">
|
|
66
|
-
<div className="wrapper" style={{ width: 700 }}>
|
|
67
|
-
<div className="group">
|
|
68
|
-
<div className="daf-title with-subtitle">
|
|
69
|
-
<h1>{t(conf.title)}</h1>
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
{conf.items.map((item) => renderItem(item))}
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export const config = [
|
|
2
|
-
{
|
|
3
|
-
label: "Core Data",
|
|
4
|
-
key: "core-data",
|
|
5
|
-
title: "Core Data",
|
|
6
|
-
items: [
|
|
7
|
-
{
|
|
8
|
-
label: "Name",
|
|
9
|
-
key: "name",
|
|
10
|
-
type: "input"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
label: "Category",
|
|
14
|
-
key: "category",
|
|
15
|
-
type: "select",
|
|
16
|
-
optionsName: "category"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: "Country",
|
|
20
|
-
key: "country",
|
|
21
|
-
type: "select",
|
|
22
|
-
optionsName: "countries"
|
|
23
|
-
},
|
|
24
|
-
// {
|
|
25
|
-
// label: "Province",
|
|
26
|
-
// key: "administrativeLevel1",
|
|
27
|
-
// type: "administrative",
|
|
28
|
-
// level: "level_1"
|
|
29
|
-
// },
|
|
30
|
-
// {
|
|
31
|
-
// label: "Territory",
|
|
32
|
-
// key: "administrativeLevel2",
|
|
33
|
-
// type: "administrative",
|
|
34
|
-
// level: "level_2"
|
|
35
|
-
// },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
];
|
|
File without changes
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
2
|
-
import StakeholderTable from "../../AdminTables/SubjectsTable/index.jsx";
|
|
3
|
-
const isView = true;
|
|
4
|
-
|
|
5
|
-
export default function View({
|
|
6
|
-
userRoles = [],
|
|
7
|
-
conf,
|
|
8
|
-
data = {},
|
|
9
|
-
formOptions = {},
|
|
10
|
-
t,
|
|
11
|
-
goTo,
|
|
12
|
-
stakeholder,
|
|
13
|
-
getRedirectLink,
|
|
14
|
-
accountStatuses,
|
|
15
|
-
module,
|
|
16
|
-
}) {
|
|
17
|
-
const renderItem = (item) => {
|
|
18
|
-
if (item.type === "stakeholder") {
|
|
19
|
-
return (
|
|
20
|
-
<StakeholderTable
|
|
21
|
-
isView={isView}
|
|
22
|
-
entityData={data}
|
|
23
|
-
goTo={goTo}
|
|
24
|
-
getRedirectLink={getRedirectLink}
|
|
25
|
-
t={t}
|
|
26
|
-
stakeholder={stakeholder}
|
|
27
|
-
module={module}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const getValue = () => {
|
|
33
|
-
const val =
|
|
34
|
-
item.getFormApps === true
|
|
35
|
-
? data?.apps?.find((app) => app.app === module)?.[item?.propertyName]
|
|
36
|
-
: data?.[item.key];
|
|
37
|
-
|
|
38
|
-
if (item.type === "select") {
|
|
39
|
-
const option = findOptions(val, formOptions[item.optionsName] || []);
|
|
40
|
-
return option ? t(option) : "-";
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (item.type === "administrative") {
|
|
44
|
-
return getNameByLevel(data?.linking?.SCL, item.level) || "-";
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return val ?? "-";
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div className="input" key={item.key}>
|
|
52
|
-
<p className="label">
|
|
53
|
-
<span>{t(item.label)}</span>
|
|
54
|
-
</p>
|
|
55
|
-
<p className="value">{getValue()}</p>
|
|
56
|
-
</div>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div className="content">
|
|
64
|
-
<div className="wrapper" style={{ width: 700 }}>
|
|
65
|
-
<div className="group">
|
|
66
|
-
<div className="daf-title with-subtitle">
|
|
67
|
-
<h1>{t(conf.title)}</h1>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
{conf.items.map((item) => renderItem(item))}
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
);
|
|
75
|
-
}
|