datastake-daf 0.6.744 → 0.6.746
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 +620 -900
- package/dist/context/index.js +0 -3
- package/dist/hooks/index.js +19 -4658
- package/dist/layouts/index.js +573 -916
- package/dist/pages/index.css +1 -0
- package/dist/pages/index.js +4391 -997
- package/dist/services/index.js +1 -7
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/dist/utils/index.js +466 -808
- package/package.json +3 -1
- package/rollup.config.js +7 -2
- package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/index.jsx +75 -54
- package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/style.js +44 -0
- package/src/@daf/core/components/DynamicForm/components/ajaxModal.js +1 -1
- package/src/@daf/core/components/EditForm/components/Comment/index.js +1 -1
- package/src/@daf/core/components/EditForm/components/DataLink/ajaxSelectDataLink.js +1 -1
- package/src/@daf/core/components/EditForm/components/DataLink/flat.js +1 -1
- package/src/@daf/core/components/EditForm/components/DataLink/index.js +1 -1
- package/src/@daf/core/components/EditForm/components/DataLinkGroup/index.js +1 -1
- package/src/@daf/core/components/EditForm/components/Repeatable/index.js +1 -1
- package/src/@daf/core/components/EditForm/components/ajaxSelect.js +1 -1
- package/src/@daf/core/components/EditForm/components/geolocation.js +1 -0
- package/src/@daf/core/components/EditForm/helper.js +0 -4
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineAccount/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +1 -1
- package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +128 -0
- package/src/@daf/{pages/pages → core/components/TableScreen}/TablePageWithTabs/index.jsx +5 -5
- package/src/@daf/layouts/AppLayout/index.jsx +5 -4
- package/src/@daf/layouts/AuthLayout/components/Select/style.js +1 -1
- package/src/@daf/layouts/AuthLayout/style.js +1 -1
- package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Identification/index.js +0 -2
- package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/KeyIndicators/config.js +2 -2
- package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/index.jsx +1 -5
- package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/config.js +2 -2
- package/src/@daf/pages/Documents/columns.js +102 -0
- package/src/@daf/pages/{dashboards/AllInformation/Documents → Documents}/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/AllInformation/Documents → Documents}/index.jsx +9 -6
- package/src/@daf/pages/{dashboards/DueDilligence/Incidents → Events/Activities}/columns.js +8 -7
- package/src/@daf/pages/{dashboards/DueDilligence → Events}/Activities/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/DueDilligence → Events}/Activities/index.jsx +6 -6
- package/src/@daf/pages/{dashboards/DueDilligence/Activities → Events/Incidents}/columns.js +5 -5
- package/src/@daf/pages/{dashboards/DueDilligence → Events}/Incidents/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/DueDilligence → Events}/Incidents/index.jsx +5 -5
- package/src/@daf/pages/Events/columns.js +226 -0
- package/src/@daf/pages/{dashboards/AllInformation/Events → Events}/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/AllInformation/Events → Events}/index.jsx +5 -9
- package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/columns.js +4 -4
- package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/index.jsx +5 -5
- package/src/@daf/pages/{dashboards/AllInformation/Locations → Locations}/columns.js +5 -5
- package/src/@daf/pages/{dashboards/AllInformation/Locations → Locations}/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/AllInformation/Locations → Locations}/index.jsx +5 -5
- package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Operators/columns.js +5 -5
- package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Operators/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Operators/index.jsx +5 -5
- package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Workers/columns.js +6 -6
- package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Workers/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Workers/index.jsx +5 -5
- package/src/@daf/pages/{dashboards/AllInformation/Documents → Stakeholders}/columns.js +5 -5
- package/src/@daf/pages/{dashboards/AllInformation/Stakeholders → Stakeholders}/create.jsx +2 -2
- package/src/@daf/pages/{dashboards/AllInformation/Stakeholders → Stakeholders}/index.jsx +5 -5
- package/src/@daf/pages/Summary/Activities/Restoration/config.js +36 -0
- package/src/@daf/pages/Summary/Activities/Restoration/helper.js +98 -0
- package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +178 -0
- package/src/@daf/pages/Summary/minesite/index.js +0 -0
- package/src/@daf/pages/Summary/operator/index.jsx +76 -0
- package/src/@daf/services/AuthenticationService.js +0 -1
- package/src/@daf/services/LinkedSubjects.js +1 -2
- package/src/pages.js +15 -13
- package/src/@daf/pages/dashboards/AllInformation/Events/columns.js +0 -151
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/columns.js +0 -132
- package/src/@daf/pages/dashboards/DueDilligence/Incidents2/columns.js +0 -176
- package/src/@daf/pages/dashboards/DueDilligence/Incidents2/config.js +0 -171
- package/src/@daf/pages/dashboards/DueDilligence/Incidents2/create.jsx +0 -104
- package/src/@daf/pages/dashboards/DueDilligence/Incidents2/index.jsx +0 -156
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Identification/hook.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Locations/config.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Locations/index.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/index.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/KeyIndicators/config.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/KeyIndicators/index.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/SupplyChainMap/index.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/TradeRelationships/index.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/config.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/AccumulationGraph/hook.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/AccumulationGraph/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/helper.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/hook.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/CustomSegment/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataChainOfCustody/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataCompilation/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataConsilidation/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/KeyIndicators/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/config.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/helper.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/config.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/hook.js +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/index.jsx +0 -0
- /package/src/@daf/pages/{dashboards → Dashboards}/helper.js +0 -0
- /package/src/@daf/pages/{dashboards/AllInformation/Documents → Documents}/config.js +0 -0
- /package/src/@daf/pages/{dashboards/DueDilligence → Events}/Activities/config.js +0 -0
- /package/src/@daf/pages/{dashboards/DueDilligence → Events}/Incidents/config.js +0 -0
- /package/src/@daf/pages/{dashboards/AllInformation/Events → Events}/config.js +0 -0
- /package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/config.js +0 -0
- /package/src/@daf/pages/{dashboards/AllInformation/Locations → Locations}/config.js +0 -0
- /package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Operators/config.js +0 -0
- /package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Workers/config.js +0 -0
- /package/src/@daf/pages/{dashboards/AllInformation/Stakeholders → Stakeholders}/config.js +0 -0
|
@@ -7,12 +7,12 @@ export const getActionWidgetsConfig = ({ goTo, getRedirectLink, APP, t }) => [
|
|
|
7
7
|
{
|
|
8
8
|
icon: "FileEdit",
|
|
9
9
|
title: "Report Activity",
|
|
10
|
-
onClick: () => goTo(getRedirectLink("/app/
|
|
10
|
+
onClick: () => goTo(getRedirectLink("/app/activities?create=true")),
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
icon: "ReportIncidents",
|
|
14
14
|
title: "Report Incident",
|
|
15
|
-
onClick: () => goTo(getRedirectLink("/app/
|
|
15
|
+
onClick: () => goTo(getRedirectLink("/app/incidents?create=true")),
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
icon: "Search",
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip } from 'antd';
|
|
3
|
+
import { findOptions } 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
|
+
|
|
9
|
+
export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink, theme, subject, applications }) => [
|
|
10
|
+
{
|
|
11
|
+
dataIndex: 'datastakeId',
|
|
12
|
+
title: t('ID'),
|
|
13
|
+
ellipsis: true,
|
|
14
|
+
show: true,
|
|
15
|
+
render: (v, all) => {
|
|
16
|
+
if (all.empty) {
|
|
17
|
+
return <div className="daf-default-cell" />
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
dataIndex: 'name',
|
|
25
|
+
title: t('Title'),
|
|
26
|
+
ellipsis: true,
|
|
27
|
+
show: true,
|
|
28
|
+
render: (v, all) => {
|
|
29
|
+
if (all.empty) {
|
|
30
|
+
return <div className="daf-default-cell" />
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: t("Date"),
|
|
38
|
+
dataIndex: "date",
|
|
39
|
+
key: "date",
|
|
40
|
+
width: 125,
|
|
41
|
+
render: (date, all) => {
|
|
42
|
+
if (all.empty) {
|
|
43
|
+
return <div className="daf-default-cell" />;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
47
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
48
|
+
},
|
|
49
|
+
ellipsis: true,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: t("Sources"),
|
|
53
|
+
dataIndex: "sources",
|
|
54
|
+
key: "sources",
|
|
55
|
+
show: activeTab !== "own",
|
|
56
|
+
render: (val, all) => {
|
|
57
|
+
if (all.empty) {
|
|
58
|
+
return <div className="daf-default-cell" />;
|
|
59
|
+
}
|
|
60
|
+
if (!val || val?.length === 0) {
|
|
61
|
+
return "--";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
65
|
+
|
|
66
|
+
return <AvatarGroup items={sources}></AvatarGroup>;
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: t("Last Update"),
|
|
71
|
+
dataIndex: "updatedAt",
|
|
72
|
+
key: "updatedAt",
|
|
73
|
+
width: 125,
|
|
74
|
+
render: (date, all) => {
|
|
75
|
+
if (all.empty) {
|
|
76
|
+
return <div className="daf-default-cell" />;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
80
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
81
|
+
},
|
|
82
|
+
ellipsis: true,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'actions',
|
|
86
|
+
title: "",
|
|
87
|
+
width: 60,
|
|
88
|
+
render: (_, all) => {
|
|
89
|
+
if (all.empty) {
|
|
90
|
+
return <div className="daf-default-cell" />;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
94
|
+
|
|
95
|
+
return <div style={{ display: "flex", justifyContent: "center" }}>
|
|
96
|
+
<a href={getRedirectLink(link)}>
|
|
97
|
+
<CustomIcon name="Link" size={15} color={theme.baseGray70} />
|
|
98
|
+
</a>
|
|
99
|
+
</div>;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
].filter((column) => column.show !== false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect} from 'react'
|
|
2
2
|
import { message } from 'antd';
|
|
3
|
-
import { MessageTypes } from '
|
|
4
|
-
import DynamicForm from '
|
|
3
|
+
import { MessageTypes } from '../../../helpers/messages.js';
|
|
4
|
+
import DynamicForm from '../../core/components/DynamicForm/index.jsx';
|
|
5
5
|
|
|
6
6
|
const StakeholdersCreate = ({
|
|
7
7
|
namespace = 'stakeholders',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect, useCallback } from 'react'
|
|
2
|
-
import TablePageWithTabs from '
|
|
2
|
+
import TablePageWithTabs from '../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
|
|
3
3
|
import { getColumns } from './columns.js';
|
|
4
4
|
import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
|
|
5
|
-
import { useGetQueryParams } from '
|
|
5
|
+
import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
|
|
6
6
|
import StakeholdersCreate from './create.jsx';
|
|
7
|
-
import { displayMessage } from '
|
|
7
|
+
import { displayMessage } from '../../../helpers/messages.js';
|
|
8
8
|
|
|
9
9
|
const DocumentsTable = ({
|
|
10
10
|
t = () => {},
|
|
@@ -36,7 +36,7 @@ const DocumentsTable = ({
|
|
|
36
36
|
subjectClear = () => {},
|
|
37
37
|
}) => {
|
|
38
38
|
const [selectOptions, setSelectOptions] = useState();
|
|
39
|
-
const [activeTab, setActiveTab] = useState();
|
|
39
|
+
const [activeTab, setActiveTab] = useState("own");
|
|
40
40
|
const columns = useMemo(() => getColumns({
|
|
41
41
|
t,
|
|
42
42
|
goTo,
|
|
@@ -51,7 +51,7 @@ const DocumentsTable = ({
|
|
|
51
51
|
|
|
52
52
|
const breadCrumbs = [];
|
|
53
53
|
|
|
54
|
-
const { paginationQuery, searchParams, otherParams } = useGetQueryParams({location});
|
|
54
|
+
const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
|
|
55
55
|
|
|
56
56
|
useEffect(() => {
|
|
57
57
|
getData({
|
|
@@ -59,6 +59,9 @@ const DocumentsTable = ({
|
|
|
59
59
|
...(Object.keys(otherParams).length > 0 && { filters: otherParams }),
|
|
60
60
|
...(Object.keys(searchParams).length > 0 && { search: searchParams }),
|
|
61
61
|
tab: activeTab,
|
|
62
|
+
sortBy: {
|
|
63
|
+
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
64
|
+
}
|
|
62
65
|
}, 'documents')
|
|
63
66
|
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
64
67
|
|
|
@@ -92,7 +95,7 @@ const DocumentsTable = ({
|
|
|
92
95
|
location={location}
|
|
93
96
|
loading={loading}
|
|
94
97
|
goTo={goTo}
|
|
95
|
-
defaultActiveTab={"
|
|
98
|
+
defaultActiveTab={"own"}
|
|
96
99
|
columns={columns}
|
|
97
100
|
data={data}
|
|
98
101
|
checkboxConfig={checkboxConfig}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Tooltip, Tag } from 'antd';
|
|
3
|
-
import { findOptions } from '
|
|
4
|
-
import { renderDateFormatted } from '
|
|
5
|
-
import CustomIcon from '
|
|
6
|
-
import AvatarGroup from '
|
|
7
|
-
import sourceAvatarConfig from '
|
|
3
|
+
import { findOptions } 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
8
|
|
|
9
9
|
const getLinkValue = (value, linkingObject) => {
|
|
10
10
|
if(linkingObject && linkingObject?.[value]) {
|
|
@@ -20,8 +20,6 @@ const getEventCategoryBySubject = (eventCategoryObject, subject) => {
|
|
|
20
20
|
|
|
21
21
|
const subjectSingular = subject.endsWith('ies')
|
|
22
22
|
? subject.slice(0, -3) + 'y'
|
|
23
|
-
: subject.endsWith('s')
|
|
24
|
-
? subject.slice(0, -1)
|
|
25
23
|
: subject;
|
|
26
24
|
|
|
27
25
|
const key = `typeOfEvent is ${subjectSingular}`;
|
|
@@ -152,6 +150,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
152
150
|
|
|
153
151
|
const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
|
|
154
152
|
const categoryValue = getEventCategoryBySubject(eventCategory, subject);
|
|
153
|
+
console.log({categoryValue})
|
|
154
|
+
console.log({eventCategory})
|
|
155
|
+
console.log({subject})
|
|
155
156
|
|
|
156
157
|
return categoryValue ? <Tooltip title={categoryValue}>{categoryValue}</Tooltip> : '-';
|
|
157
158
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect} from 'react'
|
|
2
2
|
import { message } from 'antd';
|
|
3
|
-
import { MessageTypes } from '
|
|
4
|
-
import DynamicForm from '
|
|
3
|
+
import { MessageTypes } from '../../../../helpers/messages.js';
|
|
4
|
+
import DynamicForm from '../../../core/components/DynamicForm/index.jsx';
|
|
5
5
|
|
|
6
6
|
const StakeholdersCreate = ({
|
|
7
7
|
namespace = "corrective-actions",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect, useCallback } from 'react'
|
|
2
|
-
import TablePageWithTabs from '../../../
|
|
2
|
+
import TablePageWithTabs from '../../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
|
|
3
3
|
import { getColumns } from './columns.js';
|
|
4
4
|
import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
|
|
5
|
-
import { useGetQueryParams } from '
|
|
5
|
+
import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
|
|
6
6
|
import StakeholdersCreate from './create.jsx';
|
|
7
|
-
import { displayMessage } from '
|
|
7
|
+
import { displayMessage } from '../../../../helpers/messages.js';
|
|
8
8
|
|
|
9
9
|
const ActivitiesTable = ({
|
|
10
10
|
t = () => {},
|
|
@@ -37,7 +37,7 @@ const ActivitiesTable = ({
|
|
|
37
37
|
applications = [],
|
|
38
38
|
}) => {
|
|
39
39
|
const [selectOptions, setSelectOptions] = useState();
|
|
40
|
-
const [activeTab, setActiveTab] = useState();
|
|
40
|
+
const [activeTab, setActiveTab] = useState("own");
|
|
41
41
|
|
|
42
42
|
const columns = useMemo(() => getColumns({
|
|
43
43
|
t,
|
|
@@ -47,7 +47,7 @@ const ActivitiesTable = ({
|
|
|
47
47
|
activeTab,
|
|
48
48
|
getRedirectLink,
|
|
49
49
|
theme,
|
|
50
|
-
subject: '
|
|
50
|
+
subject: 'correctiveActions',
|
|
51
51
|
data,
|
|
52
52
|
applications,
|
|
53
53
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
@@ -99,7 +99,7 @@ const ActivitiesTable = ({
|
|
|
99
99
|
location={location}
|
|
100
100
|
loading={loading}
|
|
101
101
|
goTo={goTo}
|
|
102
|
-
defaultActiveTab={"
|
|
102
|
+
defaultActiveTab={"own"}
|
|
103
103
|
columns={columns}
|
|
104
104
|
data={data}
|
|
105
105
|
checkboxConfig={checkboxConfig}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Tooltip, Tag } from 'antd';
|
|
3
|
-
import { findOptions } from '
|
|
4
|
-
import { renderDateFormatted } from '
|
|
5
|
-
import CustomIcon from '
|
|
6
|
-
import AvatarGroup from '
|
|
7
|
-
import sourceAvatarConfig from '
|
|
3
|
+
import { findOptions } 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
8
|
|
|
9
9
|
const getLinkValue = (value, linkingObject) => {
|
|
10
10
|
if(linkingObject && linkingObject?.[value]) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect} from 'react'
|
|
2
2
|
import { message } from 'antd';
|
|
3
|
-
import { MessageTypes } from '
|
|
4
|
-
import DynamicForm from '
|
|
3
|
+
import { MessageTypes } from '../../../../helpers/messages.js';
|
|
4
|
+
import DynamicForm from '../../../core/components/DynamicForm/index.jsx';
|
|
5
5
|
|
|
6
6
|
const StakeholdersCreate = ({
|
|
7
7
|
namespace = "incident",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect, useCallback } from 'react'
|
|
2
|
-
import TablePageWithTabs from '../../../
|
|
2
|
+
import TablePageWithTabs from '../../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
|
|
3
3
|
import { getColumns } from './columns.js';
|
|
4
4
|
import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
|
|
5
|
-
import { useGetQueryParams } from '
|
|
5
|
+
import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
|
|
6
6
|
import StakeholdersCreate from './create.jsx';
|
|
7
|
-
import { displayMessage } from '
|
|
7
|
+
import { displayMessage } from '../../../../helpers/messages.js';
|
|
8
8
|
|
|
9
9
|
const IncidentsTable = ({
|
|
10
10
|
t = () => {},
|
|
@@ -37,7 +37,7 @@ const IncidentsTable = ({
|
|
|
37
37
|
applications = [],
|
|
38
38
|
}) => {
|
|
39
39
|
const [selectOptions, setSelectOptions] = useState();
|
|
40
|
-
const [activeTab, setActiveTab] = useState();
|
|
40
|
+
const [activeTab, setActiveTab] = useState("own");
|
|
41
41
|
|
|
42
42
|
const columns = useMemo(() => getColumns({
|
|
43
43
|
t,
|
|
@@ -99,7 +99,7 @@ const IncidentsTable = ({
|
|
|
99
99
|
location={location}
|
|
100
100
|
loading={loading}
|
|
101
101
|
goTo={goTo}
|
|
102
|
-
defaultActiveTab={"
|
|
102
|
+
defaultActiveTab={"own"}
|
|
103
103
|
columns={columns}
|
|
104
104
|
data={data}
|
|
105
105
|
checkboxConfig={checkboxConfig}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip, Tag } from 'antd';
|
|
3
|
+
import { findOptions } from '../../../helpers/StringHelper.js';
|
|
4
|
+
import { renderDateFormatted } from '../../../helpers/Forms.js';
|
|
5
|
+
import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
|
|
6
|
+
// import CustomIcon from '../../core/components/';
|
|
7
|
+
import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
|
|
8
|
+
import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
|
|
9
|
+
import MoreTags from '../../core/components/Table/MoreTags/index.jsx';
|
|
10
|
+
|
|
11
|
+
const getLinkValue = (value, linkingObject) => {
|
|
12
|
+
if (linkingObject && linkingObject?.[value]) {
|
|
13
|
+
return linkingObject?.[value]?.name;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const renderEventStatusTag = ({ value, t = (s) => s }) => {
|
|
19
|
+
const width = 87;
|
|
20
|
+
|
|
21
|
+
switch (value) {
|
|
22
|
+
case "edited":
|
|
23
|
+
return (
|
|
24
|
+
<Tag color="orange" style={{ width }} className="text-center">
|
|
25
|
+
{t("Edited")}
|
|
26
|
+
</Tag>
|
|
27
|
+
);
|
|
28
|
+
case "submitted":
|
|
29
|
+
return (
|
|
30
|
+
<Tag color="green" style={{ width }} className="text-center">
|
|
31
|
+
{t("Submitted")}
|
|
32
|
+
</Tag>
|
|
33
|
+
);
|
|
34
|
+
default:
|
|
35
|
+
return (
|
|
36
|
+
<Tag color="blue" style={{ width }} className="text-center">
|
|
37
|
+
{t("Private")}
|
|
38
|
+
</Tag>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications }) => [
|
|
44
|
+
{
|
|
45
|
+
dataIndex: 'datastakeId',
|
|
46
|
+
title: t('ID'),
|
|
47
|
+
ellipsis: true,
|
|
48
|
+
show: true,
|
|
49
|
+
render: (v, all) => {
|
|
50
|
+
if (all.empty) {
|
|
51
|
+
return <div className="daf-default-cell" />
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
dataIndex: 'name',
|
|
59
|
+
title: t('Title'),
|
|
60
|
+
ellipsis: true,
|
|
61
|
+
show: true,
|
|
62
|
+
render: (v, all) => {
|
|
63
|
+
if (all.empty) {
|
|
64
|
+
return <div className="daf-default-cell" />
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
dataIndex: 'typeOfEvent',
|
|
72
|
+
title: t('Type'),
|
|
73
|
+
ellipsis: true,
|
|
74
|
+
show: true,
|
|
75
|
+
render: (v, all) => {
|
|
76
|
+
if (all.empty) {
|
|
77
|
+
return <div className="daf-default-cell" />
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const type = findOptions(v, data?.options?.eventsType);
|
|
81
|
+
|
|
82
|
+
return type ? <Tooltip title={type}>{type}</Tooltip> : '-';
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
dataIndex: 'keyStakeholder',
|
|
87
|
+
title: t('Key Stakeholder'),
|
|
88
|
+
ellipsis: true,
|
|
89
|
+
show: true,
|
|
90
|
+
render: (v, all) => {
|
|
91
|
+
if (all.empty) {
|
|
92
|
+
return <div className="daf-default-cell" />
|
|
93
|
+
}
|
|
94
|
+
const val = (all?.stakeholderKey || []).map((sk) => {
|
|
95
|
+
return sk?.name;
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
if (val?.length === 0) {
|
|
99
|
+
return "--";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return <MoreTags values={val} />;
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
title: t("Date"),
|
|
107
|
+
dataIndex: "date",
|
|
108
|
+
key: "date",
|
|
109
|
+
testimonials: true,
|
|
110
|
+
incident: true,
|
|
111
|
+
correctiveActions: true,
|
|
112
|
+
show: true,
|
|
113
|
+
sorter: () => 0 + 0,
|
|
114
|
+
searchType: "date",
|
|
115
|
+
width: 125,
|
|
116
|
+
render: (date, all) => {
|
|
117
|
+
if (all.empty) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const title = date ? renderDateFormatted(date, "DD MMM YYYY") : "--";
|
|
122
|
+
return <Tooltip title={title}>{title}</Tooltip>;
|
|
123
|
+
},
|
|
124
|
+
ellipsis: true,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
dataIndex: 'scope',
|
|
128
|
+
title: t('Scope'),
|
|
129
|
+
ellipsis: true,
|
|
130
|
+
show: true,
|
|
131
|
+
render: (value, all) => {
|
|
132
|
+
if (all.empty) {
|
|
133
|
+
return <div className="daf-default-cell" />;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!value) {
|
|
137
|
+
return "--";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Form the moment the intend of the if block is to be executed only in event table
|
|
141
|
+
if (typeof value === "string") {
|
|
142
|
+
if (all.navigationEventType === "other") {
|
|
143
|
+
return "--";
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const categoryOptions = (data?.options?.categoryOptions || []).map((c) => {
|
|
147
|
+
const searchTerm = `typeOfEvent is ${all.navigationEventType}`;
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
value: c.value,
|
|
151
|
+
label: c.label[searchTerm],
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const relaxantOptions = [
|
|
156
|
+
...categoryOptions,
|
|
157
|
+
...(data?.options?.eventsType || []),
|
|
158
|
+
...(data?.options?.testimonialsType || []),
|
|
159
|
+
];
|
|
160
|
+
|
|
161
|
+
const title = relaxantOptions.find((v) => v.value === value)?.label || "--";
|
|
162
|
+
|
|
163
|
+
return <Tooltip title={title}>{title}</Tooltip>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const val = value.map((v, i) => ({ label: v.name, value: `${v.name}-${i}` }));
|
|
167
|
+
return val.length ? <MoreTags values={val} /> : "--";
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
title: t("Sources"),
|
|
172
|
+
dataIndex: "sources",
|
|
173
|
+
key: "sources",
|
|
174
|
+
show: activeTab !== "own",
|
|
175
|
+
render: (val, all) => {
|
|
176
|
+
if (all.empty) {
|
|
177
|
+
return <div className="daf-default-cell" />;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
181
|
+
|
|
182
|
+
return <AvatarGroup items={sources}></AvatarGroup>;
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
title: t("Status"),
|
|
187
|
+
dataIndex: "status",
|
|
188
|
+
key: "status",
|
|
189
|
+
show: activeTab === "own",
|
|
190
|
+
correctiveActions: activeTab === "own",
|
|
191
|
+
testimonials: activeTab === "own",
|
|
192
|
+
incident: activeTab === "own",
|
|
193
|
+
width: 120,
|
|
194
|
+
render: (value, all) => {
|
|
195
|
+
if (all.empty) {
|
|
196
|
+
return <div className="daf-default-cell" />;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (activeTab !== "own") {
|
|
200
|
+
return all?.authorId?.name;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const _val = all?.published || all?.status === "submitted" ? "submitted" : value;
|
|
204
|
+
return renderEventStatusTag({ value: _val, t });
|
|
205
|
+
},
|
|
206
|
+
ellipsis: true,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: 'actions',
|
|
210
|
+
title: "",
|
|
211
|
+
width: 60,
|
|
212
|
+
render: (_, all) => {
|
|
213
|
+
if (all.empty) {
|
|
214
|
+
return <div className="daf-default-cell" />;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
218
|
+
|
|
219
|
+
return <div style={{ display: "flex", justifyContent: "center" }}>
|
|
220
|
+
<a href={getRedirectLink(link)}>
|
|
221
|
+
<CustomIcon name="Link" size={15} color={theme.baseGray70} />
|
|
222
|
+
</a>
|
|
223
|
+
</div>;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
].filter((column) => column.show !== false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect} from 'react'
|
|
2
2
|
import { message } from 'antd';
|
|
3
|
-
import { MessageTypes } from '
|
|
4
|
-
import DynamicForm from '
|
|
3
|
+
import { MessageTypes } from '../../../helpers/messages.js';
|
|
4
|
+
import DynamicForm from '../../core/components/DynamicForm/index.jsx';
|
|
5
5
|
|
|
6
6
|
const EventsCreate = ({
|
|
7
7
|
namespace = 'event',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState, useEffect, useCallback } from 'react'
|
|
2
|
-
import TablePageWithTabs from '
|
|
2
|
+
import TablePageWithTabs from '../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
|
|
3
3
|
import { getColumns } from './columns.js';
|
|
4
4
|
import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
|
|
5
|
-
import { useGetQueryParams } from '
|
|
5
|
+
import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
|
|
6
6
|
import EventsCreate from './create.jsx';
|
|
7
|
-
import { displayMessage } from '
|
|
7
|
+
import { displayMessage } from '../../../helpers/messages.js';
|
|
8
8
|
|
|
9
9
|
const EventsTable = ({
|
|
10
10
|
t = () => {},
|
|
@@ -37,7 +37,7 @@ const EventsTable = ({
|
|
|
37
37
|
subjectClear = () => {},
|
|
38
38
|
}) => {
|
|
39
39
|
const [selectOptions, setSelectOptions] = useState();
|
|
40
|
-
const [activeTab, setActiveTab] = useState();
|
|
40
|
+
const [activeTab, setActiveTab] = useState("own");
|
|
41
41
|
|
|
42
42
|
const columns = useMemo(() => getColumns({
|
|
43
43
|
t,
|
|
@@ -64,7 +64,6 @@ const EventsTable = ({
|
|
|
64
64
|
}, [otherParams, extendingFilters])
|
|
65
65
|
|
|
66
66
|
useEffect(() => {
|
|
67
|
-
console.log("fetching data")
|
|
68
67
|
getData({
|
|
69
68
|
pagination: paginationQuery,
|
|
70
69
|
...(Object.keys(filters).length > 0 && { filters: filters }),
|
|
@@ -74,11 +73,8 @@ const EventsTable = ({
|
|
|
74
73
|
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
75
74
|
}
|
|
76
75
|
}, 'events')
|
|
77
|
-
console.log("data fetched")
|
|
78
76
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
79
77
|
|
|
80
|
-
console.log({data})
|
|
81
|
-
|
|
82
78
|
const selectFiltersConfig = useMemo(() => {
|
|
83
79
|
return getFiltersConfig({t});
|
|
84
80
|
}, [t]);
|
|
@@ -109,7 +105,7 @@ const EventsTable = ({
|
|
|
109
105
|
location={location}
|
|
110
106
|
loading={loading}
|
|
111
107
|
goTo={goTo}
|
|
112
|
-
defaultActiveTab={"
|
|
108
|
+
defaultActiveTab={"own"}
|
|
113
109
|
columns={columns}
|
|
114
110
|
data={data}
|
|
115
111
|
checkboxConfig={checkboxConfig}
|
package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/columns.js
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Tooltip } from 'antd';
|
|
3
|
-
import { findOptions } from '
|
|
4
|
-
import { renderDateFormatted } from '
|
|
5
|
-
import CustomIcon from '
|
|
6
|
-
import AvatarGroup from '
|
|
3
|
+
import { findOptions } 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
7
|
|
|
8
8
|
const getLinkValue = (value, linkingObject) => {
|
|
9
9
|
if(linkingObject && linkingObject?.[value]) {
|
package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/create.jsx
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect} from 'react'
|
|
2
2
|
import { message } from 'antd';
|
|
3
|
-
import { MessageTypes } from '
|
|
4
|
-
import DynamicForm from '
|
|
3
|
+
import { MessageTypes } from '../../../../helpers/messages.js';
|
|
4
|
+
import DynamicForm from '../../../core/components/DynamicForm/index.jsx';
|
|
5
5
|
|
|
6
6
|
const ProductionSitesCreate = ({
|
|
7
7
|
namespace = "PRODUCTION SITES",
|