datastake-daf 0.6.847 → 0.6.849
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 +191 -57
- package/dist/hooks/index.js +9 -8
- package/dist/pages/index.js +5216 -5489
- package/dist/services/index.js +11 -11
- package/dist/utils/index.js +23 -12
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +59 -77
- package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +1 -8
- package/src/@daf/core/components/Screens/TableScreen/StandardTablePage/index.jsx +108 -0
- package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -2
- package/src/@daf/core/components/TableScreen/TablePageWithTabs/index.jsx +13 -3
- package/src/@daf/hooks/useSources.js +6 -4
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/config.js +3 -0
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/hook.js +69 -4
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +29 -92
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/hook.js +59 -34
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/index.js +36 -69
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/hook.js +56 -0
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/index.js +50 -75
- package/src/@daf/pages/Dashboards/ConflictManagement/index.js +14 -14
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +46 -51
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +20 -20
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/index.js +26 -2
- package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +0 -1
- package/src/@daf/pages/Dashboards/UserDashboard/components/DataChainOfCustody/index.jsx +2 -1
- package/src/@daf/pages/Dashboards/UserDashboard/index.jsx +1 -0
- package/src/@daf/pages/Dashboards/helper.js +25 -20
- package/src/@daf/pages/Edit/index.jsx +3 -0
- package/src/@daf/pages/Partners/columns.js +2 -2
- package/src/@daf/pages/Partners/config.js +22 -0
- package/src/@daf/pages/Partners/hook.js +7 -11
- package/src/@daf/pages/Partners/index.jsx +128 -140
- package/src/@daf/pages/ResetPassword/index.jsx +2 -3
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +3 -2
- package/src/@daf/pages/TablePage/hook.js +51 -42
- package/src/@daf/pages/TablePage/index.jsx +95 -61
- package/src/@daf/{core/components/Screens → pages}/Users/columns.js +15 -10
- package/src/@daf/{core/components/Screens → pages}/Users/config.js +6 -16
- package/src/@daf/{core/components/Screens → pages}/Users/create.jsx +1 -1
- package/src/@daf/pages/Users/index.jsx +129 -0
- package/src/@daf/pages/View/hooks/useCallToGetData.js +5 -1
- package/src/@daf/pages/View/index.jsx +6 -3
- package/src/@daf/pages/hook.js +26 -7
- package/src/@daf/services/EventsService.js +2 -2
- package/src/@daf/services/MineSiteService.js +2 -2
- package/src/@daf/services/OperatorService.js +2 -2
- package/src/@daf/services/PartnerService.js +2 -2
- package/src/@daf/services/SourceService.js +1 -1
- package/src/@daf/services/WorkersService.js +2 -2
- package/src/constants/locales/fr/translation.js +23 -11
- package/src/constants/locales/sp/translation.js +1 -0
- package/src/index.js +1 -1
- package/src/pages.js +1 -1
- package/dist/style/datastake/mapbox-gl.css +0 -330
- package/src/@daf/core/components/Screens/Users/index.jsx +0 -173
|
@@ -2,8 +2,8 @@ import React, { useState, useMemo, useEffect, useCallback } from 'react'
|
|
|
2
2
|
import { Modal } from 'antd';
|
|
3
3
|
import { usePartnersActions } from './hook.js';
|
|
4
4
|
import { getColumns } from './columns.js';
|
|
5
|
-
import
|
|
6
|
-
import { checkboxConfig,
|
|
5
|
+
import TablePage from '../TablePage/index.jsx';
|
|
6
|
+
import { checkboxConfig, filtersConfig, getSelectFiltersConfig, getFilterOptions } from './config.js';
|
|
7
7
|
import Create from './create.jsx';
|
|
8
8
|
import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
|
|
9
9
|
import ModalHeader from '../../core/components/Header/ModalHeader/index.jsx';
|
|
@@ -37,47 +37,6 @@ const PartnersTable = ({
|
|
|
37
37
|
const [pendingEditId, setPendingEditId] = useState(null);
|
|
38
38
|
const [openModal, setOpenModal] = useState(false);
|
|
39
39
|
|
|
40
|
-
const tabs = useMemo(() => [
|
|
41
|
-
{ label: t("List"), key: "partners" },
|
|
42
|
-
{ label: (
|
|
43
|
-
<div className="tab-cont">
|
|
44
|
-
<div className="flex flex-column justify-content-center">
|
|
45
|
-
{t('Requests')}
|
|
46
|
-
</div>
|
|
47
|
-
{typeof totalRequests === 'number' ? (
|
|
48
|
-
<div className="flex flex-column justify-content-center">
|
|
49
|
-
<div className="bubble">
|
|
50
|
-
<div className="flex flex-column justify-content-center">
|
|
51
|
-
{totalRequests}
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
) : null}
|
|
56
|
-
</div>
|
|
57
|
-
),
|
|
58
|
-
key: "requests"
|
|
59
|
-
},
|
|
60
|
-
], [t, totalRequests]);
|
|
61
|
-
|
|
62
|
-
const { paginationQuery, searchParams, otherParams, sortBy, sortDir, } = useGetQueryParams({location});
|
|
63
|
-
|
|
64
|
-
const filters = useMemo(() => {
|
|
65
|
-
const cleanSearchParams = Object.fromEntries(
|
|
66
|
-
Object.entries(searchParams).filter(([_, value]) => value != null && value !== '')
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
pagination: paginationQuery,
|
|
71
|
-
...(Object.keys(otherParams).length > 0 && otherParams ),
|
|
72
|
-
...(Object.keys(cleanSearchParams).length > 0 && { search: cleanSearchParams }),
|
|
73
|
-
tab: activeTab,
|
|
74
|
-
sortBy: {
|
|
75
|
-
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
76
|
-
},
|
|
77
|
-
...extendingFilters,
|
|
78
|
-
}
|
|
79
|
-
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
80
|
-
|
|
81
40
|
const {
|
|
82
41
|
loading,
|
|
83
42
|
data,
|
|
@@ -93,8 +52,6 @@ const PartnersTable = ({
|
|
|
93
52
|
initFetchDone,
|
|
94
53
|
setInitFetchDone,
|
|
95
54
|
} = usePartnersActions({
|
|
96
|
-
activeTab,
|
|
97
|
-
filters,
|
|
98
55
|
setTotalRequests,
|
|
99
56
|
t,
|
|
100
57
|
});
|
|
@@ -110,18 +67,8 @@ const PartnersTable = ({
|
|
|
110
67
|
selectOptions,
|
|
111
68
|
block,
|
|
112
69
|
setOpen: setOpenModal,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const handleActiveTabChange = useCallback((value) => {
|
|
116
|
-
setActiveTab(value);
|
|
117
|
-
}, []);
|
|
118
|
-
|
|
119
|
-
useEffect(() => {
|
|
120
|
-
if (requestDataFetch) {
|
|
121
|
-
fetchData();
|
|
122
|
-
setRequestDataFetch(false);
|
|
123
|
-
}
|
|
124
|
-
}, [requestDataFetch, fetchData, setRequestDataFetch]);
|
|
70
|
+
options,
|
|
71
|
+
}), [t, accept, decline, suspend, resendInvite, activate, activeTab, selectOptions, block, setOpenModal, options]);
|
|
125
72
|
|
|
126
73
|
useEffect(() => {
|
|
127
74
|
if (searchLocationParams.has("datastakeId") && !pendingEditId) {
|
|
@@ -139,97 +86,138 @@ const PartnersTable = ({
|
|
|
139
86
|
}
|
|
140
87
|
}, [data, pendingEditId]);
|
|
141
88
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
89
|
+
const tabs = useMemo(() => [
|
|
90
|
+
{ label: t("List"), key: "partners" },
|
|
91
|
+
{
|
|
92
|
+
label: (
|
|
93
|
+
<div className="tab-cont">
|
|
94
|
+
<div className="flex flex-column justify-content-center">
|
|
95
|
+
{t('Requests')}
|
|
96
|
+
</div>
|
|
97
|
+
{typeof totalRequests === 'number' ? (
|
|
98
|
+
<div className="flex flex-column justify-content-center">
|
|
99
|
+
<div className="bubble">
|
|
100
|
+
<div className="flex flex-column justify-content-center">
|
|
101
|
+
{totalRequests}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
) : null}
|
|
106
|
+
</div>
|
|
107
|
+
),
|
|
108
|
+
key: "requests"
|
|
109
|
+
},
|
|
110
|
+
], [t, totalRequests]);
|
|
145
111
|
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
112
|
+
const selectFiltersConfig = useMemo(() => {
|
|
113
|
+
return getSelectFiltersConfig({t});
|
|
114
|
+
}, [t]);
|
|
115
|
+
|
|
116
|
+
const filterOptions = useMemo(() => {
|
|
117
|
+
return getFilterOptions(options, t);
|
|
118
|
+
}, [options, t]);
|
|
119
|
+
|
|
120
|
+
const headerInfo = useMemo(() => ({
|
|
121
|
+
title: "Partners",
|
|
122
|
+
createTitle: "Create Partner",
|
|
123
|
+
tooltip: {
|
|
124
|
+
title: t("Partners"),
|
|
125
|
+
content: (
|
|
126
|
+
<div className="max-w-250">
|
|
127
|
+
{t("Partners are organisations sharing their information with you, or receiving your information.")}
|
|
128
|
+
<br />
|
|
129
|
+
{t("Only authorised users can create partnerships.")}
|
|
130
|
+
</div>
|
|
131
|
+
),
|
|
132
|
+
},
|
|
133
|
+
drawerTooltip: {
|
|
134
|
+
content: (
|
|
135
|
+
<div className="max-w-250">
|
|
136
|
+
{t("Source: This partner will share information with you.")},
|
|
137
|
+
<br />
|
|
138
|
+
{t("Client: You will share information with this partner.")},
|
|
139
|
+
<br />
|
|
140
|
+
{t("Exchange: You will both share information with each other.")}
|
|
141
|
+
</div>
|
|
142
|
+
),
|
|
143
|
+
},
|
|
169
144
|
}), [t]);
|
|
170
|
-
|
|
171
|
-
|
|
145
|
+
|
|
146
|
+
const customCreate = useCallback(({ onDrawerClose }) => (
|
|
147
|
+
<Create
|
|
148
|
+
query={query}
|
|
149
|
+
goTo={goTo}
|
|
150
|
+
user={user}
|
|
151
|
+
t={t}
|
|
152
|
+
ajaxForms={ajaxForms}
|
|
153
|
+
changeAjaxForms={changeAjaxForms}
|
|
154
|
+
ajaxOptions={ajaxOptions}
|
|
155
|
+
changeAjaxOptions={changeAjaxOptions}
|
|
156
|
+
onClose={onDrawerClose}
|
|
157
|
+
fetchData={() => setRequestDataFetch(true)}
|
|
158
|
+
APP={APP}
|
|
159
|
+
getAppHeader={getAppHeader}
|
|
160
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
161
|
+
/>
|
|
162
|
+
), [query, goTo, user, t, ajaxForms, changeAjaxForms, ajaxOptions, changeAjaxOptions, APP, getAppHeader, getApiBaseUrl, setRequestDataFetch]);
|
|
163
|
+
|
|
164
|
+
const customModal = useMemo(() => (
|
|
172
165
|
<>
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
location={location}
|
|
179
|
-
loading={loading}
|
|
180
|
-
goTo={goTo}
|
|
181
|
-
defaultActiveTab={"partners"}
|
|
182
|
-
columns={columns}
|
|
183
|
-
data={data}
|
|
184
|
-
checkboxConfig={checkboxConfig}
|
|
185
|
-
APP={APP}
|
|
186
|
-
getApiBaseUrl={getApiBaseUrl}
|
|
187
|
-
selectOptions={selectOptions}
|
|
188
|
-
selectFiltersConfig={selectFiltersConfig}
|
|
189
|
-
getRedirectLink={getRedirectLink}
|
|
190
|
-
filtersConfig={filtersConfig}
|
|
191
|
-
isMobile={isMobile}
|
|
192
|
-
view="partners"
|
|
193
|
-
getActiveTab={handleActiveTabChange}
|
|
194
|
-
headerTooltip={headerTooltip}
|
|
195
|
-
drawerTitle={t("Create Partner")}
|
|
196
|
-
drawerTooltip={drawerTooltip}
|
|
166
|
+
<Modal
|
|
167
|
+
open={!!openModal}
|
|
168
|
+
onCancel={() => setOpenModal(false)}
|
|
169
|
+
footer={null}
|
|
170
|
+
title={<ModalHeader title={t("Edit Settings")} />}
|
|
197
171
|
>
|
|
198
|
-
{
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
goTo={goTo}
|
|
202
|
-
user={user}
|
|
203
|
-
t={t}
|
|
204
|
-
ajaxForms={ajaxForms}
|
|
205
|
-
changeAjaxForms={changeAjaxForms}
|
|
206
|
-
ajaxOptions={ajaxOptions}
|
|
207
|
-
changeAjaxOptions={changeAjaxOptions}
|
|
208
|
-
onClose={onDrawerClose}
|
|
172
|
+
{openModal ? (
|
|
173
|
+
<Edit
|
|
174
|
+
partner={openModal}
|
|
209
175
|
fetchData={() => setRequestDataFetch(true)}
|
|
210
|
-
|
|
211
|
-
getAppHeader={getAppHeader}
|
|
212
|
-
getApiBaseUrl={getApiBaseUrl}
|
|
213
|
-
/>
|
|
214
|
-
)}
|
|
215
|
-
</TablePageWithTabs>
|
|
216
|
-
<Modal
|
|
217
|
-
open={!!openModal}
|
|
218
|
-
onCancel={() => setOpenModal(false)}
|
|
219
|
-
footer={null}
|
|
220
|
-
title={<ModalHeader title={t("Edit Settings")} />}
|
|
221
|
-
>
|
|
222
|
-
{openModal ? (
|
|
223
|
-
<Edit
|
|
224
|
-
partner={openModal}
|
|
225
|
-
fetchData={() => setRequestDataFetch(true)}
|
|
226
|
-
onClose={() => setOpenModal(false)}
|
|
176
|
+
onClose={() => setOpenModal(false)}
|
|
227
177
|
t={t}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
178
|
+
/>
|
|
179
|
+
) : null}
|
|
180
|
+
</Modal>
|
|
231
181
|
<input id="myInput" hidden />
|
|
232
182
|
</>
|
|
183
|
+
), [openModal, t, setRequestDataFetch]);
|
|
184
|
+
|
|
185
|
+
const handleActiveTabChange = useCallback((value) => {
|
|
186
|
+
setActiveTab(value);
|
|
187
|
+
}, []);
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<TablePage
|
|
191
|
+
t={t}
|
|
192
|
+
goTo={goTo}
|
|
193
|
+
user={user}
|
|
194
|
+
options={filterOptions}
|
|
195
|
+
getRedirectLink={getRedirectLink}
|
|
196
|
+
theme={theme}
|
|
197
|
+
loading={loading}
|
|
198
|
+
data={data}
|
|
199
|
+
isMobile={isMobile}
|
|
200
|
+
APP={APP}
|
|
201
|
+
location={location}
|
|
202
|
+
headerInfo={headerInfo}
|
|
203
|
+
extendingFilters={extendingFilters}
|
|
204
|
+
getData={fetchData}
|
|
205
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
206
|
+
getAppHeader={getAppHeader}
|
|
207
|
+
applications={applications}
|
|
208
|
+
subject="partners"
|
|
209
|
+
breadcrumbs={breadcrumbs}
|
|
210
|
+
customCreate={customCreate}
|
|
211
|
+
customModal={customModal}
|
|
212
|
+
customTabs={tabs}
|
|
213
|
+
defaultActiveTab="partners"
|
|
214
|
+
customColumns={columns}
|
|
215
|
+
customCheckboxConfig={checkboxConfig}
|
|
216
|
+
customFiltersConfig={filtersConfig}
|
|
217
|
+
customSelectFiltersConfig={selectFiltersConfig}
|
|
218
|
+
getActiveTab={handleActiveTabChange}
|
|
219
|
+
refetchTrigger={requestDataFetch}
|
|
220
|
+
/>
|
|
233
221
|
)
|
|
234
222
|
}
|
|
235
223
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import DafButton from "
|
|
3
|
-
import
|
|
4
|
-
import AuthForm from "../../../AuthForm/index.jsx";
|
|
2
|
+
import DafButton from "../../core/components/Button/index.jsx";
|
|
3
|
+
import AuthForm from "../../core/components/AuthForm/index.jsx";
|
|
5
4
|
|
|
6
5
|
const step = 1;
|
|
7
6
|
|
|
@@ -29,11 +29,12 @@ const cols = [
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const title = all?.published
|
|
32
|
-
? t("general-information")
|
|
33
|
-
: t("registration")
|
|
32
|
+
? `${t("general-information")}-KYC`
|
|
33
|
+
: `${t("registration")}-KYC`;
|
|
34
34
|
|
|
35
35
|
return <Tooltip title={title}>{title}</Tooltip>;
|
|
36
36
|
},
|
|
37
|
+
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
40
|
dataIndex: "completion",
|
|
@@ -9,53 +9,54 @@ import {
|
|
|
9
9
|
getViewConfig
|
|
10
10
|
} from './config.js';
|
|
11
11
|
import { getColumns } from './columns.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
import { useFetchData } from '../hook.js';
|
|
13
|
+
|
|
14
|
+
// export const useFetchData = ({
|
|
15
|
+
// location,
|
|
16
|
+
// getData,
|
|
17
|
+
// activeTab,
|
|
18
|
+
// extendingFilters,
|
|
19
|
+
// subject,
|
|
20
|
+
// }) => {
|
|
21
|
+
// const { paginationQuery, searchParams, otherParams, sortBy, sortDir, } = useGetQueryParams({location});
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
// const prevParamsRef = useRef();
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
// useEffect(() => {
|
|
26
|
+
// const cleanSearchParams = Object.fromEntries(
|
|
27
|
+
// Object.entries(searchParams).filter(([_, value]) => value != null && value !== '')
|
|
28
|
+
// );
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
// const hasPagination = paginationQuery.skip != null || paginationQuery.take != null;
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
// if (!hasPagination) {
|
|
33
|
+
// return;
|
|
34
|
+
// }
|
|
35
|
+
|
|
36
|
+
// const extendingSortKey = extendingFilters?.sortBy ? Object.keys(extendingFilters.sortBy)[0] : null;
|
|
37
|
+
// const extendingSortDir = extendingFilters?.sortBy && extendingSortKey ? extendingFilters.sortBy[extendingSortKey] : null;
|
|
38
|
+
|
|
39
|
+
// const currentParams = {
|
|
40
|
+
// ...extendingFilters,
|
|
41
|
+
// pagination: paginationQuery,
|
|
42
|
+
// ...(Object.keys(otherParams).length > 0 && otherParams ),
|
|
43
|
+
// ...(Object.keys(cleanSearchParams).length > 0 && { search: cleanSearchParams }),
|
|
44
|
+
// tab: activeTab,
|
|
45
|
+
// sortBy: {
|
|
46
|
+
// [sortBy || extendingSortKey || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : (extendingSortDir || -1),
|
|
47
|
+
// },
|
|
48
|
+
// };
|
|
49
|
+
|
|
50
|
+
// const currentParamsString = JSON.stringify(currentParams);
|
|
51
|
+
// if (prevParamsRef.current === currentParamsString) {
|
|
52
|
+
// return;
|
|
53
|
+
// }
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
// prevParamsRef.current = currentParamsString;
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
57
|
+
// getData(currentParams, subject);
|
|
58
|
+
// }, [location.search, JSON.stringify(extendingFilters), activeTab]);
|
|
59
|
+
// }
|
|
59
60
|
|
|
60
61
|
export const useTablePage = ({
|
|
61
62
|
subject,
|
|
@@ -72,9 +73,13 @@ export const useTablePage = ({
|
|
|
72
73
|
applications,
|
|
73
74
|
subjectClear,
|
|
74
75
|
APP,
|
|
76
|
+
defaultActiveTab = "own",
|
|
77
|
+
getActiveTab,
|
|
78
|
+
refetchTrigger,
|
|
79
|
+
noTabs = false,
|
|
75
80
|
}) => {
|
|
76
81
|
const [selectOptions, setSelectOptions] = useState();
|
|
77
|
-
const [activeTab, setActiveTab] = useState(
|
|
82
|
+
const [activeTab, setActiveTab] = useState(noTabs ? null : defaultActiveTab);
|
|
78
83
|
|
|
79
84
|
useFetchData({
|
|
80
85
|
location,
|
|
@@ -82,6 +87,7 @@ export const useTablePage = ({
|
|
|
82
87
|
activeTab,
|
|
83
88
|
extendingFilters: extendingFilters,
|
|
84
89
|
subject,
|
|
90
|
+
refetchTrigger,
|
|
85
91
|
});
|
|
86
92
|
|
|
87
93
|
const columns = useMemo(() =>
|
|
@@ -133,6 +139,9 @@ export const useTablePage = ({
|
|
|
133
139
|
);
|
|
134
140
|
const handleActiveTabChange = useCallback((value) => {
|
|
135
141
|
setActiveTab(value);
|
|
142
|
+
if (getActiveTab && typeof getActiveTab === 'function' && !noTabs) {
|
|
143
|
+
getActiveTab(value);
|
|
144
|
+
}
|
|
136
145
|
}, []);
|
|
137
146
|
|
|
138
147
|
useEffect(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import TablePageWithTabs from '../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx';
|
|
3
|
+
import StandardTablePage from '../../core/components/Screens/TableScreen/StandardTablePage/index.jsx';
|
|
3
4
|
import Create from './create.jsx';
|
|
4
5
|
import { displayMessage } from '../../../helpers/messages.js';
|
|
5
6
|
import { useTablePage } from './hook.js';
|
|
@@ -40,8 +41,19 @@ const TablePage = ({
|
|
|
40
41
|
subject,
|
|
41
42
|
breadcrumbs = [],
|
|
42
43
|
onDownload,
|
|
44
|
+
customCreate,
|
|
45
|
+
customModal,
|
|
46
|
+
customTabs,
|
|
47
|
+
defaultActiveTab = "own",
|
|
48
|
+
customColumns,
|
|
49
|
+
customCheckboxConfig,
|
|
50
|
+
customFiltersConfig,
|
|
51
|
+
customSelectFiltersConfig,
|
|
52
|
+
getActiveTab,
|
|
53
|
+
noTabs = false,
|
|
54
|
+
refetchTrigger,
|
|
55
|
+
externalOpenDrawer = false,
|
|
43
56
|
}) => {
|
|
44
|
-
|
|
45
57
|
const {
|
|
46
58
|
activeTab,
|
|
47
59
|
selectOptions,
|
|
@@ -53,6 +65,7 @@ const TablePage = ({
|
|
|
53
65
|
formInfo,
|
|
54
66
|
viewConfig,
|
|
55
67
|
} = useTablePage({
|
|
68
|
+
defaultActiveTab,
|
|
56
69
|
subject,
|
|
57
70
|
location,
|
|
58
71
|
getData,
|
|
@@ -67,69 +80,90 @@ const TablePage = ({
|
|
|
67
80
|
applications,
|
|
68
81
|
subjectClear,
|
|
69
82
|
APP,
|
|
83
|
+
getActiveTab,
|
|
84
|
+
refetchTrigger,
|
|
70
85
|
});
|
|
71
86
|
|
|
87
|
+
const TableComponent = noTabs ? StandardTablePage : TablePageWithTabs;
|
|
88
|
+
|
|
89
|
+
const commonProps = {
|
|
90
|
+
t,
|
|
91
|
+
title: t(headerInfo?.title || viewConfig?.title || ""),
|
|
92
|
+
breadCrumbs: breadcrumbs,
|
|
93
|
+
location,
|
|
94
|
+
loading,
|
|
95
|
+
goTo,
|
|
96
|
+
columns: customColumns || columns,
|
|
97
|
+
data,
|
|
98
|
+
checkboxConfig: customCheckboxConfig || checkboxConfig,
|
|
99
|
+
APP,
|
|
100
|
+
getApiBaseUrl,
|
|
101
|
+
selectOptions,
|
|
102
|
+
selectFiltersConfig: customSelectFiltersConfig || selectFiltersConfig,
|
|
103
|
+
getRedirectLink,
|
|
104
|
+
filtersConfig: customFiltersConfig || _filtersConfig,
|
|
105
|
+
isMobile,
|
|
106
|
+
view: subject,
|
|
107
|
+
onDownload: onDownload && typeof onDownload === 'function' ? onDownload : undefined,
|
|
108
|
+
drawerTitle: t(headerInfo?.createTitle || viewConfig?.createTitle || ""),
|
|
109
|
+
headerTooltip: headerInfo?.tooltip,
|
|
110
|
+
drawerTooltip: headerInfo?.drawerTooltip,
|
|
111
|
+
externalOpenDrawer,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const tabsOnlyProps = noTabs ? {} : {
|
|
115
|
+
tabs: customTabs,
|
|
116
|
+
defaultActiveTab,
|
|
117
|
+
getActiveTab: handleActiveTabChange,
|
|
118
|
+
};
|
|
119
|
+
|
|
72
120
|
return (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
changeAjaxForms={formConfig.changeAjaxForms}
|
|
120
|
-
ajaxOptions={formConfig.ajaxOptions}
|
|
121
|
-
changeAjaxOptions={formConfig.changeAjaxOptions}
|
|
122
|
-
formData={formConfig.formData}
|
|
123
|
-
formValue={formConfig.formValue}
|
|
124
|
-
form={formConfig.form}
|
|
125
|
-
namespace={formConfig?.namespace || formInfo?.namespace}
|
|
126
|
-
view={formConfig?.view || formInfo.view}
|
|
127
|
-
scope={formConfig?.scope || formInfo.scope}
|
|
128
|
-
formType={formConfig?.formType || formInfo.formType}
|
|
129
|
-
defaultData={defaultValues}
|
|
130
|
-
/>
|
|
131
|
-
)}
|
|
132
|
-
</TablePageWithTabs>
|
|
121
|
+
<>
|
|
122
|
+
<TableComponent
|
|
123
|
+
{...commonProps}
|
|
124
|
+
{...tabsOnlyProps}
|
|
125
|
+
>
|
|
126
|
+
{({onDrawerClose, setOpenCreateDrawer}) =>
|
|
127
|
+
customCreate ? customCreate({ onDrawerClose, setOpenCreateDrawer }) : (
|
|
128
|
+
<Create
|
|
129
|
+
t={t}
|
|
130
|
+
goTo={goTo}
|
|
131
|
+
user={user}
|
|
132
|
+
APP={APP}
|
|
133
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
134
|
+
getAppHeader={getAppHeader}
|
|
135
|
+
getData={formConfig.getFormData}
|
|
136
|
+
saveData={formConfig.saveFormData}
|
|
137
|
+
loading={formConfig.formLoading}
|
|
138
|
+
onSubmitted={(type, m, data) => {
|
|
139
|
+
if (data.datastakeId) {
|
|
140
|
+
displayMessage(
|
|
141
|
+
type,
|
|
142
|
+
t("affirmations::subject-created-successfully") || m,
|
|
143
|
+
);
|
|
144
|
+
goTo(`/app/edit/${subject}/${data.datastakeId}`);
|
|
145
|
+
}
|
|
146
|
+
}}
|
|
147
|
+
onCancel={onDrawerClose}
|
|
148
|
+
query={formConfig.query}
|
|
149
|
+
ajaxForms={formConfig.ajaxForms}
|
|
150
|
+
changeAjaxForms={formConfig.changeAjaxForms}
|
|
151
|
+
ajaxOptions={formConfig.ajaxOptions}
|
|
152
|
+
changeAjaxOptions={formConfig.changeAjaxOptions}
|
|
153
|
+
formData={formConfig.formData}
|
|
154
|
+
formValue={formConfig.formValue}
|
|
155
|
+
form={formConfig.form}
|
|
156
|
+
namespace={formConfig?.namespace || formInfo?.namespace}
|
|
157
|
+
view={formConfig?.view || formInfo.view}
|
|
158
|
+
scope={formConfig?.scope || formInfo.scope}
|
|
159
|
+
formType={formConfig?.formType || formInfo.formType}
|
|
160
|
+
defaultData={defaultValues}
|
|
161
|
+
/>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
</TableComponent>
|
|
165
|
+
{customModal}
|
|
166
|
+
</>
|
|
133
167
|
);
|
|
134
168
|
};
|
|
135
169
|
|