datastake-daf 0.6.762 → 0.6.764
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 +205 -165
- package/dist/hooks/index.js +1 -5
- package/dist/layouts/index.js +36 -11
- package/dist/pages/index.js +1922 -1021
- package/dist/services/index.js +1 -21
- package/dist/utils/index.js +0 -6
- package/package.json +1 -1
- package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +2 -0
- package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +2 -1
- package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -4
- package/src/@daf/core/components/Screens/Users/config.js +0 -1
- package/src/@daf/core/components/Table/index.jsx +2 -2
- package/src/@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx +29 -0
- package/src/@daf/hooks/useFilters.js +1 -3
- package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +4 -2
- package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +23 -2
- package/src/@daf/layouts/AppLayout/index.jsx +2 -0
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +7 -6
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -1
- package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/config.js +29 -53
- package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
- package/src/@daf/pages/Dashboards/UserDashboard/components/DataCompilation/index.jsx +1 -0
- package/src/@daf/pages/Dashboards/UserDashboard/components/DataConsilidation/index.jsx +0 -1
- package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/config.js +36 -70
- package/src/@daf/pages/Documents/index.jsx +9 -13
- package/src/@daf/pages/Events/Activities/index.jsx +8 -21
- package/src/@daf/pages/Events/Incidents/index.jsx +8 -21
- package/src/@daf/pages/Events/config.js +0 -1
- package/src/@daf/pages/Events/index.jsx +8 -20
- package/src/@daf/pages/Locations/MineSite/columns.js +3 -3
- package/src/@daf/pages/Locations/MineSite/config.js +0 -1
- package/src/@daf/pages/Locations/MineSite/index.jsx +8 -21
- package/src/@daf/pages/Locations/index.jsx +9 -12
- package/src/@daf/pages/Partners/columns.js +421 -0
- package/src/@daf/pages/Partners/config.js +32 -0
- package/src/@daf/pages/Partners/create.jsx +145 -0
- package/src/@daf/pages/Partners/edit.jsx +98 -0
- package/src/@daf/pages/Partners/hook.js +153 -0
- package/src/@daf/pages/Partners/index.jsx +233 -8
- package/src/@daf/pages/Stakeholders/Operators/index.jsx +8 -22
- package/src/@daf/pages/Stakeholders/Workers/index.jsx +8 -21
- package/src/@daf/pages/Stakeholders/index.jsx +9 -10
- package/src/@daf/pages/hook.js +34 -0
- package/src/@daf/services/PartnerService.js +1 -16
- package/src/helpers/breadCrumbs.js +0 -2
- package/src/index.js +1 -1
- package/src/pages.js +1 -0
|
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
|
|
|
5
5
|
import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
|
|
6
6
|
import StakeholdersCreate from './create.jsx';
|
|
7
7
|
import { displayMessage } from '../../../../helpers/messages.js';
|
|
8
|
+
import { useFetchData } from '../../hook.js';
|
|
8
9
|
|
|
9
10
|
const ActivitiesTable = ({
|
|
10
11
|
t = () => {},
|
|
@@ -53,27 +54,13 @@ const ActivitiesTable = ({
|
|
|
53
54
|
applications,
|
|
54
55
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [otherParams, extendingFilters])
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
getData({
|
|
67
|
-
pagination: paginationQuery,
|
|
68
|
-
...(Object.keys(searchParams).length > 0 && { search: searchParams }),
|
|
69
|
-
...otherParams,
|
|
70
|
-
tab: activeTab,
|
|
71
|
-
sortBy: {
|
|
72
|
-
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
73
|
-
},
|
|
74
|
-
...extendingFilters
|
|
75
|
-
}, 'activities')
|
|
76
|
-
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
57
|
+
useFetchData({
|
|
58
|
+
location,
|
|
59
|
+
getData,
|
|
60
|
+
activeTab,
|
|
61
|
+
extendingFilters,
|
|
62
|
+
subject: 'activities',
|
|
63
|
+
})
|
|
77
64
|
|
|
78
65
|
const selectFiltersConfig = useMemo(() => {
|
|
79
66
|
return getFiltersConfig({t});
|
|
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
|
|
|
5
5
|
import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
|
|
6
6
|
import StakeholdersCreate from './create.jsx';
|
|
7
7
|
import { displayMessage } from '../../../../helpers/messages.js';
|
|
8
|
+
import { useFetchData } from '../../hook.js';
|
|
8
9
|
|
|
9
10
|
const IncidentsTable = ({
|
|
10
11
|
t = () => {},
|
|
@@ -53,27 +54,13 @@ const IncidentsTable = ({
|
|
|
53
54
|
applications,
|
|
54
55
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [otherParams, extendingFilters])
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
getData({
|
|
67
|
-
pagination: paginationQuery,
|
|
68
|
-
...(Object.keys(searchParams).length > 0 && { search: searchParams }),
|
|
69
|
-
...otherParams,
|
|
70
|
-
tab: activeTab,
|
|
71
|
-
sortBy: {
|
|
72
|
-
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
73
|
-
},
|
|
74
|
-
...extendingFilters
|
|
75
|
-
}, 'incidents')
|
|
76
|
-
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
57
|
+
useFetchData({
|
|
58
|
+
location,
|
|
59
|
+
getData,
|
|
60
|
+
activeTab,
|
|
61
|
+
extendingFilters,
|
|
62
|
+
subject: 'incidents',
|
|
63
|
+
})
|
|
77
64
|
|
|
78
65
|
const selectFiltersConfig = useMemo(() => {
|
|
79
66
|
return getFiltersConfig({t});
|
|
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
|
|
|
5
5
|
import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
|
|
6
6
|
import EventsCreate from './create.jsx';
|
|
7
7
|
import { displayMessage } from '../../../helpers/messages.js';
|
|
8
|
+
import { useFetchData } from '../hook.js';
|
|
8
9
|
|
|
9
10
|
const EventsTable = ({
|
|
10
11
|
t = () => {},
|
|
@@ -53,26 +54,13 @@ const EventsTable = ({
|
|
|
53
54
|
applications,
|
|
54
55
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [otherParams, extendingFilters])
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
getData({
|
|
67
|
-
pagination: paginationQuery,
|
|
68
|
-
...(Object.keys(filters).length > 0 && { filters: filters }),
|
|
69
|
-
...(Object.keys(searchParams).length > 0 && { search: searchParams }),
|
|
70
|
-
tab: activeTab,
|
|
71
|
-
sortBy: {
|
|
72
|
-
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
73
|
-
}
|
|
74
|
-
}, 'events')
|
|
75
|
-
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
57
|
+
useFetchData({
|
|
58
|
+
location,
|
|
59
|
+
getData,
|
|
60
|
+
activeTab,
|
|
61
|
+
extendingFilters,
|
|
62
|
+
subject: 'events',
|
|
63
|
+
})
|
|
76
64
|
|
|
77
65
|
const selectFiltersConfig = useMemo(() => {
|
|
78
66
|
return getFiltersConfig({t});
|
|
@@ -6,6 +6,7 @@ import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
|
|
|
6
6
|
import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
|
|
7
7
|
import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
|
|
8
8
|
import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
|
|
9
|
+
import MoreOptions from '../../../core/components/Table/MoreOptions/index.jsx';
|
|
9
10
|
|
|
10
11
|
export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
|
|
11
12
|
{
|
|
@@ -88,9 +89,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
88
89
|
return <div className="daf-default-cell" />
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
return operator ? <Tooltip title={operator}>{operator}</Tooltip> : '-';
|
|
92
|
+
const operators = all?.operatorOfLocation?.map((operator) => operator?.clientLocation?.name);
|
|
93
|
+
return (operators && operators.length > 0) ? <MoreOptions data={operators || []} tooltipPlacement="topLeft" /> : '-';
|
|
94
94
|
},
|
|
95
95
|
},
|
|
96
96
|
{
|
|
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
|
|
|
5
5
|
import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
|
|
6
6
|
import ProductionSitesCreate from './create.jsx';
|
|
7
7
|
import { displayMessage } from '../../../../helpers/messages.js';
|
|
8
|
+
import { useFetchData } from '../../hook.js';
|
|
8
9
|
|
|
9
10
|
const ProductionSitesTable = ({
|
|
10
11
|
t = () => {},
|
|
@@ -53,27 +54,13 @@ const ProductionSitesTable = ({
|
|
|
53
54
|
applications,
|
|
54
55
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [otherParams, extendingFilters])
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
getData({
|
|
67
|
-
pagination: paginationQuery,
|
|
68
|
-
...(Object.keys(searchParams).length > 0 && { search: searchParams }),
|
|
69
|
-
...otherParams,
|
|
70
|
-
tab: activeTab,
|
|
71
|
-
sortBy: {
|
|
72
|
-
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
73
|
-
},
|
|
74
|
-
...extendingFilters
|
|
75
|
-
}, 'production-sites')
|
|
76
|
-
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
57
|
+
useFetchData({
|
|
58
|
+
location,
|
|
59
|
+
getData,
|
|
60
|
+
activeTab,
|
|
61
|
+
extendingFilters,
|
|
62
|
+
subject: 'production-sites',
|
|
63
|
+
})
|
|
77
64
|
|
|
78
65
|
const selectFiltersConfig = useMemo(() => {
|
|
79
66
|
return getFiltersConfig({t});
|
|
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
|
|
|
5
5
|
import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
|
|
6
6
|
import StakeholdersCreate from './create.jsx';
|
|
7
7
|
import { displayMessage } from '../../../helpers/messages.js';
|
|
8
|
+
import { useFetchData } from '../hook.js';
|
|
8
9
|
|
|
9
10
|
const LocationsTable = ({
|
|
10
11
|
t = () => {},
|
|
@@ -35,6 +36,7 @@ const LocationsTable = ({
|
|
|
35
36
|
applications = [],
|
|
36
37
|
subjectClear = () => {},
|
|
37
38
|
breadcrumbs = [],
|
|
39
|
+
extendingFilters = {},
|
|
38
40
|
}) => {
|
|
39
41
|
const [selectOptions, setSelectOptions] = useState();
|
|
40
42
|
const [activeTab, setActiveTab] = useState("own");
|
|
@@ -52,18 +54,13 @@ const LocationsTable = ({
|
|
|
52
54
|
applications,
|
|
53
55
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
tab: activeTab,
|
|
63
|
-
}, 'locations')
|
|
64
|
-
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
65
|
-
|
|
66
|
-
console.log({data})
|
|
57
|
+
useFetchData({
|
|
58
|
+
location,
|
|
59
|
+
getData,
|
|
60
|
+
activeTab,
|
|
61
|
+
extendingFilters,
|
|
62
|
+
subject: 'locations',
|
|
63
|
+
})
|
|
67
64
|
|
|
68
65
|
const selectFiltersConfig = useMemo(() => {
|
|
69
66
|
return getFiltersConfig({t});
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Modal, Popover, Tag, message } from "antd";
|
|
3
|
+
import MoreMenu from '../../core/components/Table/MoreMenu/index.jsx';
|
|
4
|
+
import TooltipIcon from '../../core/components/Icon/TooltipIcon.jsx';
|
|
5
|
+
import { findOptions, camelCaseToTitle } from '../../../helpers/StringHelper.js';
|
|
6
|
+
import { copyToClipboard } from '../../../helpers/copyToClipboard.js';
|
|
7
|
+
import { partnershipTypes, partnerTypes } from './config.js';
|
|
8
|
+
|
|
9
|
+
export const getColumns = ({
|
|
10
|
+
t,
|
|
11
|
+
accept,
|
|
12
|
+
decline,
|
|
13
|
+
suspend,
|
|
14
|
+
selectOptions = {},
|
|
15
|
+
resendInvite,
|
|
16
|
+
activate,
|
|
17
|
+
activeTab,
|
|
18
|
+
setOpen,
|
|
19
|
+
block,
|
|
20
|
+
}) => [
|
|
21
|
+
{
|
|
22
|
+
title: t("ID"),
|
|
23
|
+
dataIndex: "datastakeId",
|
|
24
|
+
key: "datastakeId",
|
|
25
|
+
ellipsis: true,
|
|
26
|
+
render: (v, all) => {
|
|
27
|
+
if (all.empty) {
|
|
28
|
+
return <div className="daf-default-cell" />;
|
|
29
|
+
}
|
|
30
|
+
// THE FALLBACK WAS DEPENDS BEFORE
|
|
31
|
+
return v || "-";
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: (
|
|
36
|
+
<div className="flex-row">
|
|
37
|
+
{t("Partner Type")}
|
|
38
|
+
<Popover
|
|
39
|
+
title={t("Partner Type")}
|
|
40
|
+
content={
|
|
41
|
+
<div className="max-w-250">
|
|
42
|
+
{t("Source: This partner shares information with your organisation.")}{" "}
|
|
43
|
+
<br />
|
|
44
|
+
<br />
|
|
45
|
+
{t("Client: This partner receives information from your organisation.")}
|
|
46
|
+
<br />
|
|
47
|
+
<br />
|
|
48
|
+
{t("Exchange: You share information with each other.")}
|
|
49
|
+
</div>
|
|
50
|
+
}
|
|
51
|
+
>
|
|
52
|
+
<div className="ml-2 flex flex-column justify-content-center">
|
|
53
|
+
<TooltipIcon fontSize={12} />
|
|
54
|
+
</div>
|
|
55
|
+
</Popover>
|
|
56
|
+
</div>
|
|
57
|
+
),
|
|
58
|
+
dataIndex: "partnershipType",
|
|
59
|
+
key: "partnershipType",
|
|
60
|
+
ellipsis: true,
|
|
61
|
+
render: (val, all) => {
|
|
62
|
+
if (all.empty) {
|
|
63
|
+
return <div className="daf-default-cell" />;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return partnershipTypes.find((v) => v.value === val)?.label || val || "-";
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: <div className="flex-row">{t("Entity Type")}</div>,
|
|
71
|
+
dataIndex: "partnerType",
|
|
72
|
+
key: "partnerType",
|
|
73
|
+
ellipsis: true,
|
|
74
|
+
render: (val, all) => {
|
|
75
|
+
if (all.empty) {
|
|
76
|
+
return <div className="daf-default-cell" />;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return partnerTypes.find((v) => v.value === val)?.label || val || "-";
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
title: t("Name"),
|
|
84
|
+
dataIndex: "nickName",
|
|
85
|
+
key: "nickName",
|
|
86
|
+
ellipsis: true,
|
|
87
|
+
render: (v, all) => {
|
|
88
|
+
if (all.empty) {
|
|
89
|
+
return <div className="daf-default-cell" />;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return v || "-";
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
title: t("Email"),
|
|
97
|
+
dataIndex: "email",
|
|
98
|
+
key: "email",
|
|
99
|
+
ellipsis: true,
|
|
100
|
+
render: (v, all) => {
|
|
101
|
+
if (all.empty) {
|
|
102
|
+
return <div className="daf-default-cell" />;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return v || "-";
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
title: t("Category"),
|
|
110
|
+
dataIndex: "category",
|
|
111
|
+
key: "category",
|
|
112
|
+
ellipsis: true,
|
|
113
|
+
render: (v, all) => {
|
|
114
|
+
if (all.empty) {
|
|
115
|
+
return <div className="daf-default-cell" />;
|
|
116
|
+
}
|
|
117
|
+
return v ? findOptions(v, selectOptions?.category || []) : "-";
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
title: (
|
|
122
|
+
<div className="flex-row">
|
|
123
|
+
{t("Settings")}
|
|
124
|
+
<Popover
|
|
125
|
+
title={t("Settings")}
|
|
126
|
+
content={
|
|
127
|
+
<div className="max-w-250">
|
|
128
|
+
{t(
|
|
129
|
+
"Standard: information is licensed with citation and available without restriction.",
|
|
130
|
+
)}
|
|
131
|
+
<br />
|
|
132
|
+
<br />
|
|
133
|
+
{t(
|
|
134
|
+
"Custom: Information sharing settings have been adjusted by the Source as reflected in the corresponding Channel.",
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
<div className="ml-2 flex flex-column justify-content-center">
|
|
140
|
+
<TooltipIcon fontSize={12} />
|
|
141
|
+
</div>
|
|
142
|
+
</Popover>
|
|
143
|
+
</div>
|
|
144
|
+
),
|
|
145
|
+
dataIndex: "settings",
|
|
146
|
+
key: "settings",
|
|
147
|
+
ellipsis: true,
|
|
148
|
+
render: (v, all) => {
|
|
149
|
+
if (all.empty) {
|
|
150
|
+
return <div className="daf-default-cell" />;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return v ? t(camelCaseToTitle(v)) : "-";
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
title: (
|
|
158
|
+
<div className="flex-row">
|
|
159
|
+
{t("Status")}
|
|
160
|
+
<Popover
|
|
161
|
+
title={t("Status")}
|
|
162
|
+
content={
|
|
163
|
+
<div className="max-w-250">
|
|
164
|
+
{t(
|
|
165
|
+
"Information is shared in accordance with settings for partners designated as Active.",
|
|
166
|
+
)}
|
|
167
|
+
<br />
|
|
168
|
+
<br />
|
|
169
|
+
{t(
|
|
170
|
+
"Information sharing is suspended for partners designated as Inactive.",
|
|
171
|
+
)}
|
|
172
|
+
</div>
|
|
173
|
+
}
|
|
174
|
+
>
|
|
175
|
+
<div className="ml-2 flex flex-column justify-content-center">
|
|
176
|
+
<TooltipIcon fontSize={12} />
|
|
177
|
+
</div>
|
|
178
|
+
</Popover>
|
|
179
|
+
</div>
|
|
180
|
+
),
|
|
181
|
+
dataIndex: "status",
|
|
182
|
+
key: "status",
|
|
183
|
+
// ellipsis: true,
|
|
184
|
+
// width: 150,
|
|
185
|
+
render: (val, all) => {
|
|
186
|
+
if (all.empty) {
|
|
187
|
+
return <div className="daf-default-cell" />;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
switch (val) {
|
|
191
|
+
case "active":
|
|
192
|
+
return (
|
|
193
|
+
<Tag
|
|
194
|
+
color="green"
|
|
195
|
+
style={{
|
|
196
|
+
width: 100,
|
|
197
|
+
textAlign: "center",
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
{t("Active")}
|
|
201
|
+
</Tag>
|
|
202
|
+
);
|
|
203
|
+
case "declined":
|
|
204
|
+
return (
|
|
205
|
+
<Tag
|
|
206
|
+
color="red"
|
|
207
|
+
style={{
|
|
208
|
+
width: 100,
|
|
209
|
+
textAlign: "center",
|
|
210
|
+
}}
|
|
211
|
+
>
|
|
212
|
+
{t("Declined")}
|
|
213
|
+
</Tag>
|
|
214
|
+
);
|
|
215
|
+
case "pending":
|
|
216
|
+
return (
|
|
217
|
+
<Tag
|
|
218
|
+
color="orange"
|
|
219
|
+
style={{
|
|
220
|
+
width: 100,
|
|
221
|
+
textAlign: "center",
|
|
222
|
+
}}
|
|
223
|
+
>
|
|
224
|
+
{t("Pending")}
|
|
225
|
+
</Tag>
|
|
226
|
+
);
|
|
227
|
+
case "blocked":
|
|
228
|
+
return (
|
|
229
|
+
<Tag
|
|
230
|
+
color="red-inverse"
|
|
231
|
+
style={{
|
|
232
|
+
width: 100,
|
|
233
|
+
textAlign: "center",
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
236
|
+
{t("Blocked")}
|
|
237
|
+
</Tag>
|
|
238
|
+
);
|
|
239
|
+
case "suspended":
|
|
240
|
+
return (
|
|
241
|
+
<Tag
|
|
242
|
+
style={{
|
|
243
|
+
width: 100,
|
|
244
|
+
textAlign: "center",
|
|
245
|
+
}}
|
|
246
|
+
>
|
|
247
|
+
{t("Suspended")}
|
|
248
|
+
</Tag>
|
|
249
|
+
);
|
|
250
|
+
default:
|
|
251
|
+
return "-";
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
title: "",
|
|
257
|
+
dataIndex: "actions",
|
|
258
|
+
width: 60,
|
|
259
|
+
show: true,
|
|
260
|
+
key: "actions",
|
|
261
|
+
render: (_, val) => {
|
|
262
|
+
if (val.empty) {
|
|
263
|
+
return <div className="daf-default-cell" />;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
let items = [];
|
|
267
|
+
|
|
268
|
+
if (activeTab === "requests") {
|
|
269
|
+
switch (val.status) {
|
|
270
|
+
case "declined":
|
|
271
|
+
items.push({
|
|
272
|
+
label: t("Block User"),
|
|
273
|
+
key: "block",
|
|
274
|
+
onClick: () =>
|
|
275
|
+
Modal.confirm({
|
|
276
|
+
title: t("Are you sure you want to block this user?"),
|
|
277
|
+
onOk: () => block(val.id),
|
|
278
|
+
cancelText: t("No"),
|
|
279
|
+
okText: t("Yes"),
|
|
280
|
+
closable: true,
|
|
281
|
+
}),
|
|
282
|
+
});
|
|
283
|
+
break;
|
|
284
|
+
case "pending":
|
|
285
|
+
items.push(
|
|
286
|
+
...[
|
|
287
|
+
{
|
|
288
|
+
label: t("Approve"),
|
|
289
|
+
key: "approve",
|
|
290
|
+
onClick: () =>
|
|
291
|
+
Modal.confirm({
|
|
292
|
+
content: t(
|
|
293
|
+
"Are you sure you want to approve this request?",
|
|
294
|
+
),
|
|
295
|
+
title: t("Approve"),
|
|
296
|
+
onOk: () => accept(val.id),
|
|
297
|
+
cancelText: t("No"),
|
|
298
|
+
okText: t("Yes"),
|
|
299
|
+
closable: true,
|
|
300
|
+
}),
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
label: t("Decline"),
|
|
304
|
+
key: "decline",
|
|
305
|
+
onClick: () =>
|
|
306
|
+
Modal.confirm({
|
|
307
|
+
title: t("Decline"),
|
|
308
|
+
content: t(
|
|
309
|
+
"Are you sure you want to decline this request?",
|
|
310
|
+
),
|
|
311
|
+
onOk: () => decline(val.id),
|
|
312
|
+
cancelText: t("No"),
|
|
313
|
+
okText: t("Yes"),
|
|
314
|
+
closable: true,
|
|
315
|
+
}),
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
);
|
|
319
|
+
break;
|
|
320
|
+
default:
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
switch (val.status) {
|
|
324
|
+
case "pending":
|
|
325
|
+
items.push({
|
|
326
|
+
label: t("Details"),
|
|
327
|
+
key: "edit",
|
|
328
|
+
onClick: () => setOpen(val),
|
|
329
|
+
});
|
|
330
|
+
items.push({
|
|
331
|
+
label: t("Suspend Partner"),
|
|
332
|
+
key: "suspend",
|
|
333
|
+
onClick: () =>
|
|
334
|
+
Modal.confirm({
|
|
335
|
+
title: t("Suspend Partner"),
|
|
336
|
+
content: t("Are you sure you want to suspend this partner?"),
|
|
337
|
+
onOk: () => suspend(val.id),
|
|
338
|
+
cancelText: t("No"),
|
|
339
|
+
okText: t("Yes"),
|
|
340
|
+
closable: true,
|
|
341
|
+
}),
|
|
342
|
+
});
|
|
343
|
+
items.push({
|
|
344
|
+
label: t("Copy Invitation Link"),
|
|
345
|
+
key: "copyInvitationLink",
|
|
346
|
+
disabled: !val.code,
|
|
347
|
+
onClick: () => {
|
|
348
|
+
const copyText = document.getElementById("myInput");
|
|
349
|
+
copyText.value = val.datastakeId
|
|
350
|
+
? `${window.location.origin}/app-invitation?code=${val.code}`
|
|
351
|
+
: `${window.location.origin}/register?code=${val.code}`;
|
|
352
|
+
copyToClipboard("myInput");
|
|
353
|
+
message.info(t("Invitation link copied!"));
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
items.push({
|
|
357
|
+
label: t("Resend Invite"),
|
|
358
|
+
key: "resendInvite",
|
|
359
|
+
onClick: () =>
|
|
360
|
+
Modal.confirm({
|
|
361
|
+
title: t("Resend Invitation"),
|
|
362
|
+
content: t(
|
|
363
|
+
"Are you sure you want to invite this user again? This user will receive a new notification",
|
|
364
|
+
),
|
|
365
|
+
onOk: () => resendInvite(val.id),
|
|
366
|
+
cancelText: t("No"),
|
|
367
|
+
okText: t("Yes"),
|
|
368
|
+
closable: true,
|
|
369
|
+
}),
|
|
370
|
+
});
|
|
371
|
+
break;
|
|
372
|
+
case "suspended":
|
|
373
|
+
items.push({
|
|
374
|
+
label: t("Details"),
|
|
375
|
+
key: "details",
|
|
376
|
+
onClick: () => setOpen(val),
|
|
377
|
+
});
|
|
378
|
+
items.push({
|
|
379
|
+
label: t("Activate Partner"),
|
|
380
|
+
key: "activate",
|
|
381
|
+
onClick: () =>
|
|
382
|
+
Modal.confirm({
|
|
383
|
+
title: t("Re-activate Partnership"),
|
|
384
|
+
content: t(
|
|
385
|
+
"Are you sure you want to re-activate this collaboration?",
|
|
386
|
+
),
|
|
387
|
+
onOk: () => activate(val.id),
|
|
388
|
+
cancelText: t("No"),
|
|
389
|
+
okText: t("Yes"),
|
|
390
|
+
closable: true,
|
|
391
|
+
}),
|
|
392
|
+
});
|
|
393
|
+
break;
|
|
394
|
+
case "active":
|
|
395
|
+
items.push({
|
|
396
|
+
label: t("Details"),
|
|
397
|
+
key: "edit",
|
|
398
|
+
onClick: () => setOpen(val),
|
|
399
|
+
});
|
|
400
|
+
items.push({
|
|
401
|
+
label: t("Suspend Partner"),
|
|
402
|
+
key: "suspend",
|
|
403
|
+
onClick: () =>
|
|
404
|
+
Modal.confirm({
|
|
405
|
+
title: t("Suspend Partner"),
|
|
406
|
+
content: t("Are you sure you want to suspend this partner?"),
|
|
407
|
+
onOk: () => suspend(val.id),
|
|
408
|
+
cancelText: t("No"),
|
|
409
|
+
okText: t("Yes"),
|
|
410
|
+
closable: true,
|
|
411
|
+
}),
|
|
412
|
+
});
|
|
413
|
+
break;
|
|
414
|
+
default:
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return <MoreMenu items={items} />;
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
];
|