datastake-daf 0.6.793 → 0.6.794
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/dist/components/index.js +4321 -3157
- package/dist/services/index.js +69 -3
- package/dist/utils/index.js +14 -17
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +0 -1
- 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 +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/columns.js +79 -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 +18 -8
- 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 +6 -7
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +272 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +223 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +65 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +73 -45
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +37 -37
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +48 -22
- package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +81 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +76 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +38 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +13 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +77 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +38 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +75 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +3 -1
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/SidebarMenu/index.jsx +5 -3
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +13 -8
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +3 -4
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +81 -2
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +180 -0
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +27 -0
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +157 -0
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +31 -0
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +77 -0
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +117 -0
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +54 -0
- package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
- package/src/@daf/services/AdminService.js +79 -7
- package/src/@daf/services/DashboardService.js +2 -1
- package/src/@daf/utils/filters.js +15 -13
- package/src/constants/locales/en/translation.js +7 -0
- package/src/constants/locales/fr/translation.js +1 -1
- package/src/constants/locales/sp/translation.js +1 -1
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
}
|
|
@@ -37,7 +37,7 @@ export default function Edit({
|
|
|
37
37
|
|
|
38
38
|
const deleteUser = useCallback(
|
|
39
39
|
(id) => {
|
|
40
|
-
// TODO: add call
|
|
40
|
+
// TODO: add call
|
|
41
41
|
console.log("DELETE", id);
|
|
42
42
|
fetchData();
|
|
43
43
|
},
|
|
@@ -174,6 +174,8 @@ export default function Edit({
|
|
|
174
174
|
);
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
+
console.log(conf,"data");
|
|
178
|
+
|
|
177
179
|
return (
|
|
178
180
|
<div className="form-edit flex-row">
|
|
179
181
|
<Form
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Menu } from "antd";
|
|
2
|
-
import { config } from "../../config";
|
|
2
|
+
import { config as defaultConfig } from "../../config";
|
|
3
3
|
|
|
4
|
-
export default function SideBarMenu({ selectedGroup, onChange = () => {}, t }) {
|
|
4
|
+
export default function SideBarMenu({ selectedGroup, onChange = () => {}, t, config }) {
|
|
5
|
+
const menuConfig = config || defaultConfig;
|
|
6
|
+
|
|
5
7
|
return (
|
|
6
8
|
<Menu
|
|
7
9
|
mode="inline"
|
|
@@ -12,7 +14,7 @@ export default function SideBarMenu({ selectedGroup, onChange = () => {}, t }) {
|
|
|
12
14
|
onChange(g.key);
|
|
13
15
|
}}
|
|
14
16
|
items={
|
|
15
|
-
|
|
17
|
+
menuConfig.map((conf) => {
|
|
16
18
|
return {
|
|
17
19
|
key: conf.key,
|
|
18
20
|
label: t(conf.label),
|
|
@@ -167,10 +167,7 @@ export const getColumns = ({
|
|
|
167
167
|
return cols.filter((v) => v.show);
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
export const checkboxConfig = {
|
|
171
|
-
name: "Name",
|
|
172
|
-
datastakeId: "ID",
|
|
173
|
-
};
|
|
170
|
+
export const checkboxConfig = {};
|
|
174
171
|
|
|
175
172
|
export const selectFiltersConfig = {
|
|
176
173
|
userRole: {
|
|
@@ -194,9 +191,17 @@ export const selectFiltersConfig = {
|
|
|
194
191
|
};
|
|
195
192
|
|
|
196
193
|
export const filtersConfig = {
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
search: "",
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export const defaultUrlParams = {
|
|
198
|
+
search: "",
|
|
199
|
+
userRole: null,
|
|
200
|
+
status: null,
|
|
199
201
|
};
|
|
200
202
|
|
|
201
|
-
export const
|
|
202
|
-
|
|
203
|
+
export const defaultTableFilters = {
|
|
204
|
+
search: "",
|
|
205
|
+
userRole: null,
|
|
206
|
+
status: null,
|
|
207
|
+
};
|
|
@@ -60,10 +60,10 @@ export default function Users({
|
|
|
60
60
|
userRole: userRoles.filter((u) => !u.isForAppAdmin),
|
|
61
61
|
status: accountStatuses,
|
|
62
62
|
};
|
|
63
|
-
}, [userRoles]);
|
|
63
|
+
}, [userRoles, accountStatuses]);
|
|
64
64
|
|
|
65
65
|
const canClearSearch = useMemo(() => {
|
|
66
|
-
return !!activeFilters.search;
|
|
66
|
+
return !!activeFilters.search || !!activeFilters.userRole || !!activeFilters.status;
|
|
67
67
|
}, [activeFilters]);
|
|
68
68
|
|
|
69
69
|
const onDeleteUserClick = useCallback(
|
|
@@ -55,7 +55,6 @@ function AdminView({
|
|
|
55
55
|
}, [data]);
|
|
56
56
|
|
|
57
57
|
const goToView = useCallback(() => {
|
|
58
|
-
console.log("goToView");
|
|
59
58
|
changeNotificationState({
|
|
60
59
|
onYes: () => {
|
|
61
60
|
setEditData(data);
|
|
@@ -63,7 +62,7 @@ function AdminView({
|
|
|
63
62
|
goTo(`/app/accounts/view/${id}/${group}`);
|
|
64
63
|
},
|
|
65
64
|
});
|
|
66
|
-
}, [goTo, changeNotificationState, data]);
|
|
65
|
+
}, [goTo, changeNotificationState, data, id, group]);
|
|
67
66
|
|
|
68
67
|
const breadCrumbs = useMemo(() => {
|
|
69
68
|
return renderBreadCrumbs({
|
|
@@ -99,9 +98,9 @@ function AdminView({
|
|
|
99
98
|
setIsChanged(false);
|
|
100
99
|
setLoading(false);
|
|
101
100
|
} catch (err) {
|
|
102
|
-
|
|
101
|
+
handleError?.(err);
|
|
103
102
|
}
|
|
104
|
-
}, [id]);
|
|
103
|
+
}, [id, getAccountData, module, handleError]);
|
|
105
104
|
|
|
106
105
|
useEffect(() => {
|
|
107
106
|
fetchData();
|
|
@@ -5,6 +5,7 @@ import AdminAccountsScreen from "./AdminScreens/Accounts.jsx";
|
|
|
5
5
|
import AdminAccountsViewScreen from "./AdminScreens/AccountsView.jsx";
|
|
6
6
|
import AdminSubjectsScreen from "./AdminScreens/Subjects.jsx";
|
|
7
7
|
import AdminLocationScreen from "./AdminScreens/Location.jsx";
|
|
8
|
+
import AdminSubjectsViewScreen from "./AdminScreens/SubjectsView.jsx";
|
|
8
9
|
|
|
9
10
|
export function getAdminRoutes(config) {
|
|
10
11
|
const {
|
|
@@ -15,6 +16,8 @@ export function getAdminRoutes(config) {
|
|
|
15
16
|
useAdminAccountsViewConfig,
|
|
16
17
|
useAdminSubjectsConfig,
|
|
17
18
|
useAdminLocationConfig,
|
|
19
|
+
useAdminSubjectsViewConfig,
|
|
20
|
+
useAdminLocationViewConfig,
|
|
18
21
|
userIsAdmin,
|
|
19
22
|
} = config;
|
|
20
23
|
|
|
@@ -56,6 +59,38 @@ export function getAdminRoutes(config) {
|
|
|
56
59
|
return <AdminLocationScreen config={locationConfig} />;
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
function LocationViewWrapper() {
|
|
63
|
+
const locationViewConfig =
|
|
64
|
+
typeof useAdminLocationViewConfig === "function"
|
|
65
|
+
? useAdminLocationViewConfig()
|
|
66
|
+
: undefined;
|
|
67
|
+
return <AdminSubjectsViewScreen config={{ ...locationViewConfig, subject: "location" }} />;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function StakeholderViewWrapper() {
|
|
71
|
+
const stakeholderViewConfig =
|
|
72
|
+
typeof useAdminSubjectsViewConfig === "function"
|
|
73
|
+
? useAdminSubjectsViewConfig()
|
|
74
|
+
: undefined;
|
|
75
|
+
return <AdminSubjectsViewScreen config={{ ...stakeholderViewConfig, subject: "stakeholder" }} />;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function LocationEditWrapper() {
|
|
79
|
+
const locationViewConfig =
|
|
80
|
+
typeof useAdminLocationViewConfig === "function"
|
|
81
|
+
? useAdminLocationViewConfig()
|
|
82
|
+
: undefined;
|
|
83
|
+
return <AdminSubjectsViewScreen config={{ ...locationViewConfig, subject: "location", mode: "edit" }} />;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function StakeholderEditWrapper() {
|
|
87
|
+
const stakeholderViewConfig =
|
|
88
|
+
typeof useAdminSubjectsViewConfig === "function"
|
|
89
|
+
? useAdminSubjectsViewConfig()
|
|
90
|
+
: undefined;
|
|
91
|
+
return <AdminSubjectsViewScreen config={{ ...stakeholderViewConfig, subject: "stakeholder", mode: "edit" }} />;
|
|
92
|
+
}
|
|
93
|
+
|
|
59
94
|
const subjectsIndexComponent =
|
|
60
95
|
typeof useAdminLocationConfig === "function"
|
|
61
96
|
? <LocationWrapper />
|
|
@@ -104,7 +139,7 @@ export function getAdminRoutes(config) {
|
|
|
104
139
|
...(typeof useAdminLocationConfig === "function"
|
|
105
140
|
? [
|
|
106
141
|
{
|
|
107
|
-
path: "subjects/location",
|
|
142
|
+
path: "management/subjects/location",
|
|
108
143
|
key: `${APP_PREFIX}_ADMIN_SUBJECTS_LOCATIONS`,
|
|
109
144
|
exact: true,
|
|
110
145
|
visible: (user) => userIsAdmin(user),
|
|
@@ -115,7 +150,7 @@ export function getAdminRoutes(config) {
|
|
|
115
150
|
...(typeof useAdminSubjectsConfig === "function"
|
|
116
151
|
? [
|
|
117
152
|
{
|
|
118
|
-
path: "subjects/stakeholder",
|
|
153
|
+
path: "management/subjects/stakeholder",
|
|
119
154
|
key: `${APP_PREFIX}_ADMIN_SUBJECTS_STAKEHOLDERS`,
|
|
120
155
|
exact: true,
|
|
121
156
|
visible: (user) => userIsAdmin(user),
|
|
@@ -123,6 +158,50 @@ export function getAdminRoutes(config) {
|
|
|
123
158
|
},
|
|
124
159
|
]
|
|
125
160
|
: []),
|
|
161
|
+
...(typeof useAdminLocationViewConfig === "function"
|
|
162
|
+
? [
|
|
163
|
+
{
|
|
164
|
+
path: "management/subject/location/:id",
|
|
165
|
+
key: `${APP_PREFIX}_ADMIN_LOCATION_VIEW`,
|
|
166
|
+
exact: true,
|
|
167
|
+
visible: (user) => userIsAdmin(user),
|
|
168
|
+
component: <LocationViewWrapper />,
|
|
169
|
+
},
|
|
170
|
+
]
|
|
171
|
+
: []),
|
|
172
|
+
...(typeof useAdminSubjectsViewConfig === "function"
|
|
173
|
+
? [
|
|
174
|
+
{
|
|
175
|
+
path: "management/subject/stakeholder/:id",
|
|
176
|
+
key: `${APP_PREFIX}_ADMIN_STAKEHOLDER_VIEW`,
|
|
177
|
+
exact: true,
|
|
178
|
+
visible: (user) => userIsAdmin(user),
|
|
179
|
+
component: <StakeholderViewWrapper />,
|
|
180
|
+
},
|
|
181
|
+
]
|
|
182
|
+
: []),
|
|
183
|
+
...(typeof useAdminLocationViewConfig === "function"
|
|
184
|
+
? [
|
|
185
|
+
{
|
|
186
|
+
path: "management/subject/location/edit/:id",
|
|
187
|
+
key: `${APP_PREFIX}_ADMIN_LOCATION_EDIT`,
|
|
188
|
+
exact: true,
|
|
189
|
+
visible: (user) => userIsAdmin(user),
|
|
190
|
+
component: <LocationEditWrapper />,
|
|
191
|
+
},
|
|
192
|
+
]
|
|
193
|
+
: []),
|
|
194
|
+
...(typeof useAdminSubjectsViewConfig === "function"
|
|
195
|
+
? [
|
|
196
|
+
{
|
|
197
|
+
path: "management/subject/stakeholder/edit/:id",
|
|
198
|
+
key: `${APP_PREFIX}_ADMIN_STAKEHOLDER_EDIT`,
|
|
199
|
+
exact: true,
|
|
200
|
+
visible: (user) => userIsAdmin(user),
|
|
201
|
+
component: <StakeholderEditWrapper />,
|
|
202
|
+
},
|
|
203
|
+
]
|
|
204
|
+
: []),
|
|
126
205
|
];
|
|
127
206
|
|
|
128
207
|
return routes;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip } from 'antd';
|
|
3
|
+
import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
|
|
4
|
+
import { renderDateFormatted } from '../../../../helpers/Forms.js';
|
|
5
|
+
import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
|
|
6
|
+
import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
|
|
7
|
+
import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
|
|
8
|
+
import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
|
|
9
|
+
import MoreOptions from '../../../core/components/Table/MoreOptions/index.jsx';
|
|
10
|
+
import { renderStatusTag } from '../../../utils/tags.js';
|
|
11
|
+
|
|
12
|
+
export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
|
|
13
|
+
{
|
|
14
|
+
dataIndex: 'datastakeId',
|
|
15
|
+
title: t('ID'),
|
|
16
|
+
ellipsis: true,
|
|
17
|
+
show: true,
|
|
18
|
+
render: (v, all) => {
|
|
19
|
+
if (all.empty) {
|
|
20
|
+
return <div className="daf-default-cell" />
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
dataIndex: 'name',
|
|
28
|
+
title: t('Name'),
|
|
29
|
+
ellipsis: true,
|
|
30
|
+
show: true,
|
|
31
|
+
render: (v, all) => {
|
|
32
|
+
if (all.empty) {
|
|
33
|
+
return <div className="daf-default-cell" />
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
dataIndex: 'category',
|
|
41
|
+
title: t('Category'),
|
|
42
|
+
ellipsis: true,
|
|
43
|
+
show: true,
|
|
44
|
+
render: (v, all) => {
|
|
45
|
+
if (all.empty) {
|
|
46
|
+
return <div className="daf-default-cell" />
|
|
47
|
+
}
|
|
48
|
+
const category = findOptions(v, options?.locationCategories);
|
|
49
|
+
|
|
50
|
+
return <Tooltip title={category}>{category}</Tooltip>;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
dataIndex: 'lealForm',
|
|
55
|
+
title: t('Legal Form'),
|
|
56
|
+
ellipsis: true,
|
|
57
|
+
show: true,
|
|
58
|
+
render: (v, all) => {
|
|
59
|
+
if (all.empty) {
|
|
60
|
+
return <div className="daf-default-cell" />
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const legalForm = findOptions(v, options?.legalFormOptions);
|
|
64
|
+
|
|
65
|
+
return legalForm ? <Tooltip title={legalForm}>{legalForm}</Tooltip> : '-';
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
dataIndex: 'country',
|
|
70
|
+
title: t('Country'),
|
|
71
|
+
ellipsis: true,
|
|
72
|
+
show: true,
|
|
73
|
+
render: (v, all) => {
|
|
74
|
+
if (all.empty) {
|
|
75
|
+
return <div className="daf-default-cell" />
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const country = findOptions(v, options?.countryOptions);
|
|
79
|
+
|
|
80
|
+
return country ? <Tooltip title={country}>{country}</Tooltip> : '-';
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// {
|
|
85
|
+
// dataIndex: 'operator',
|
|
86
|
+
// title: t('Operator'),
|
|
87
|
+
// ellipsis: true,
|
|
88
|
+
// show: true,
|
|
89
|
+
// render: (v, all) => {
|
|
90
|
+
// if (all.empty) {
|
|
91
|
+
// return <div className="daf-default-cell" />
|
|
92
|
+
// }
|
|
93
|
+
|
|
94
|
+
// const operators = all?.operator?.map((operator) => operator?.locationClient?.name)?.filter(Boolean);
|
|
95
|
+
// return (operators && operators.length > 0) ? <MoreOptions data={operators || []} toolTipPlacement={operators?.length < 2 ? "topLeft" : "top"} /> : '-';
|
|
96
|
+
// },
|
|
97
|
+
// },
|
|
98
|
+
{
|
|
99
|
+
title: t("Last Update"),
|
|
100
|
+
dataIndex: "updatedAt",
|
|
101
|
+
key: "updatedAt",
|
|
102
|
+
width: 125,
|
|
103
|
+
render: (date, all) => {
|
|
104
|
+
if (all.empty) {
|
|
105
|
+
return <div className="daf-default-cell" />;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
109
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
110
|
+
},
|
|
111
|
+
ellipsis: true,
|
|
112
|
+
},
|
|
113
|
+
// {
|
|
114
|
+
// title: t("Status"),
|
|
115
|
+
// dataIndex: 'status',
|
|
116
|
+
// ellipsis: true,
|
|
117
|
+
// show: activeTab == "own",
|
|
118
|
+
// render: (v, all) => {
|
|
119
|
+
// if (all.empty) {
|
|
120
|
+
// return <div className="daf-default-cell" />
|
|
121
|
+
// }
|
|
122
|
+
// const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
|
|
123
|
+
|
|
124
|
+
// return renderStatusTag({ value: _val, t });
|
|
125
|
+
// },
|
|
126
|
+
// },
|
|
127
|
+
|
|
128
|
+
// {
|
|
129
|
+
// title: t("Sources"),
|
|
130
|
+
// dataIndex: 'sources',
|
|
131
|
+
// ellipsis: true,
|
|
132
|
+
// show: activeTab !== "own",
|
|
133
|
+
// render: (v, all) => {
|
|
134
|
+
// if (all.empty) {
|
|
135
|
+
// return <div className="daf-default-cell" />
|
|
136
|
+
// }
|
|
137
|
+
// const sources = sourceAvatarConfig(v, user, applications);
|
|
138
|
+
// return <AvatarGroup items={sources}></AvatarGroup>;
|
|
139
|
+
// },
|
|
140
|
+
// },
|
|
141
|
+
{
|
|
142
|
+
id: 'actions',
|
|
143
|
+
title: "",
|
|
144
|
+
width: 60,
|
|
145
|
+
render: (_, all) => {
|
|
146
|
+
if (all.empty) {
|
|
147
|
+
return <div className="daf-default-cell" />;
|
|
148
|
+
}
|
|
149
|
+
const onClick = () => {
|
|
150
|
+
let link = `/app/view/${subject}/${all.datastakeId}`;
|
|
151
|
+
if (activeTab === "shared") {
|
|
152
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
153
|
+
}
|
|
154
|
+
goTo(getRedirectLink(link));
|
|
155
|
+
};
|
|
156
|
+
const moreMenuItems = [
|
|
157
|
+
{
|
|
158
|
+
label: t("Details"),
|
|
159
|
+
value: "details",
|
|
160
|
+
onClick: onClick,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
label: t("Summary"),
|
|
164
|
+
value: "Summary",
|
|
165
|
+
onClick: () => {
|
|
166
|
+
let link = `/app/mine-summary/${all.datastakeId}`
|
|
167
|
+
if (activeTab === "shared") {
|
|
168
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
169
|
+
}
|
|
170
|
+
goTo(getRedirectLink(link));
|
|
171
|
+
},
|
|
172
|
+
// disabled: true,
|
|
173
|
+
},
|
|
174
|
+
];
|
|
175
|
+
return <div >
|
|
176
|
+
<MoreMenu items={moreMenuItems} />
|
|
177
|
+
</div>;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
].filter((column) => column.show !== false);
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
|
+
import TabsHeader from '../../../../core/components/Header/TabsHeader'
|
|
3
|
+
import {Widget} from '../../../../core/components/Dashboard/Widget'
|
|
4
|
+
import {getColumns} from './columns.js'
|
|
5
|
+
import {useParams} from 'react-router-dom'
|
|
6
|
+
import {DAFTable} from '../../../../core/components/Table'
|
|
7
|
+
import {useIsDatastake} from '../../../../hooks/useIsDatastake.js'
|
|
8
|
+
|
|
9
|
+
const AssociatedInformationTable = () => {
|
|
10
|
+
const tabs =[
|
|
11
|
+
{value:"stakeholders", label:"Stakeholders"},
|
|
12
|
+
{value:"locations", label:"Locations"},
|
|
13
|
+
{values:"events", label:"Events"},
|
|
14
|
+
{values:"DOcuments",label:"Documents"},
|
|
15
|
+
]
|
|
16
|
+
const [activeTab, setActiveTab] = useState("stakeholders");
|
|
17
|
+
const [data,setData]= useState({
|
|
18
|
+
stakeholders:[],
|
|
19
|
+
locations:[],
|
|
20
|
+
events:[],
|
|
21
|
+
documents:[],
|
|
22
|
+
})
|
|
23
|
+
const [_options, _setOptions] = useState({});
|
|
24
|
+
const params = useParams();
|
|
25
|
+
const { user } = useSelector((state) => state.authentication);
|
|
26
|
+
const { getRedirectLink } = useIsDatastake();
|
|
27
|
+
}
|