datastake-daf 0.6.737 → 0.6.738
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 +12 -5
- package/dist/hooks/index.js +4 -2
- package/dist/layouts/index.js +18 -5
- package/dist/pages/index.js +1410 -70
- package/dist/services/index.js +84 -0
- package/dist/utils/index.js +4 -4
- package/package.json +1 -1
- package/public/assets/favicons/datastake-black.svg +13 -0
- package/public/assets/favicons/datastake-white.svg +13 -0
- package/src/@daf/core/components/Sidenav/index.jsx +15 -3
- package/src/@daf/hooks/useGetQueryParams.js +2 -2
- package/src/@daf/layouts/AppLayout/components/Sidenav/index.js +2 -0
- package/src/@daf/layouts/AppLayout/index.jsx +6 -1
- package/src/@daf/pages/dashboards/AllInformation/Documents/columns.js +106 -0
- package/src/@daf/pages/dashboards/AllInformation/Documents/config.js +31 -0
- package/src/@daf/pages/dashboards/AllInformation/Documents/create.jsx +104 -0
- package/src/@daf/pages/dashboards/AllInformation/Documents/index.jsx +156 -0
- package/src/@daf/pages/dashboards/AllInformation/Events/columns.js +150 -0
- package/src/@daf/pages/dashboards/AllInformation/Events/config.js +31 -0
- package/src/@daf/pages/dashboards/AllInformation/Events/create.jsx +104 -0
- package/src/@daf/pages/dashboards/AllInformation/Events/index.jsx +156 -0
- package/src/@daf/pages/dashboards/AllInformation/Locations/index.jsx +1 -2
- package/src/@daf/pages/dashboards/Operations/Operators/columns.js +150 -0
- package/src/@daf/pages/dashboards/Operations/Operators/config.js +31 -0
- package/src/@daf/pages/dashboards/Operations/Operators/create.jsx +104 -0
- package/src/@daf/pages/dashboards/Operations/Operators/index.jsx +156 -0
- package/src/@daf/pages/pages/TablePageWithTabs/index.jsx +2 -2
- package/src/@daf/services/OperatorService.js +90 -0
- package/src/helpers/StringHelper.js +4 -4
- package/src/pages.js +5 -2
- package/src/services.js +2 -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
- package/dist/style/datastake/mapbox-gl.css +0 -330
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
|
|
8
|
+
const getLinkValue = (value, linkingObject) => {
|
|
9
|
+
if(linkingObject && linkingObject?.[value]) {
|
|
10
|
+
return linkingObject?.[value]?.name;
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data}) => [
|
|
16
|
+
{
|
|
17
|
+
dataIndex: 'datastakeId',
|
|
18
|
+
title: t('ID'),
|
|
19
|
+
ellipsis: true,
|
|
20
|
+
show: true,
|
|
21
|
+
render: (v, all) => {
|
|
22
|
+
if (all.empty) {
|
|
23
|
+
return <div className="daf-default-cell" />
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
dataIndex: 'name',
|
|
31
|
+
title: t('Name'),
|
|
32
|
+
ellipsis: true,
|
|
33
|
+
show: true,
|
|
34
|
+
render: (v, all) => {
|
|
35
|
+
if (all.empty) {
|
|
36
|
+
return <div className="daf-default-cell" />
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
dataIndex: 'category',
|
|
44
|
+
title: t('Category'),
|
|
45
|
+
ellipsis: true,
|
|
46
|
+
show: true,
|
|
47
|
+
render: (v, all) => {
|
|
48
|
+
if (all.empty) {
|
|
49
|
+
return <div className="daf-default-cell" />
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const category = findOptions(v, data?.options?.locationCategories);
|
|
53
|
+
|
|
54
|
+
return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
dataIndex: 'country',
|
|
59
|
+
title: t('Country'),
|
|
60
|
+
ellipsis: true,
|
|
61
|
+
show: true,
|
|
62
|
+
render: (v, all) => {
|
|
63
|
+
if (all.empty) {
|
|
64
|
+
return <div className="daf-default-cell" />
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const country = findOptions(v, options?.countries);
|
|
68
|
+
|
|
69
|
+
return country ? <Tooltip title={country}>{country}</Tooltip> : '-';
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
dataIndex: 'administrativeLevel1',
|
|
74
|
+
title: t('Region'),
|
|
75
|
+
ellipsis: true,
|
|
76
|
+
show: true,
|
|
77
|
+
render: (v, all) => {
|
|
78
|
+
if (all.empty) {
|
|
79
|
+
return <div className="daf-default-cell" />
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const region = getLinkValue(v, all?.linking?.SCL);
|
|
83
|
+
|
|
84
|
+
return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
dataIndex: 'administrativeLevel2',
|
|
89
|
+
title: t('District'),
|
|
90
|
+
ellipsis: true,
|
|
91
|
+
show: true,
|
|
92
|
+
render: (v, all) => {
|
|
93
|
+
if (all.empty) {
|
|
94
|
+
return <div className="daf-default-cell" />
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const district = getLinkValue(v, all?.linking?.SCL);
|
|
98
|
+
|
|
99
|
+
return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
title: t("Last Update"),
|
|
104
|
+
dataIndex: "updatedAt",
|
|
105
|
+
key: "updatedAt",
|
|
106
|
+
width: 125,
|
|
107
|
+
render: (date, all) => {
|
|
108
|
+
if (all.empty) {
|
|
109
|
+
return <div className="daf-default-cell" />;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
113
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
114
|
+
},
|
|
115
|
+
ellipsis: true,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
title: t("Sources"),
|
|
119
|
+
dataIndex: "sources",
|
|
120
|
+
key: "sources",
|
|
121
|
+
show: activeTab !== "own",
|
|
122
|
+
render: (val, all) => {
|
|
123
|
+
if (all.empty) {
|
|
124
|
+
return <div className="daf-default-cell" />;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
console.log({val, all})
|
|
128
|
+
|
|
129
|
+
return <AvatarGroup items={val}></AvatarGroup>;
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: 'actions',
|
|
134
|
+
title: "",
|
|
135
|
+
width: 60,
|
|
136
|
+
render: (_, all) => {
|
|
137
|
+
if (all.empty) {
|
|
138
|
+
return <div className="daf-default-cell" />;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
142
|
+
|
|
143
|
+
return <div style={{ display: "flex", justifyContent: "center" }}>
|
|
144
|
+
<a href={getRedirectLink(link)}>
|
|
145
|
+
<CustomIcon name="Link" size={15} color={theme.baseGray70} />
|
|
146
|
+
</a>
|
|
147
|
+
</div>;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
].filter((column) => column.show !== false);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const checkboxConfig = {
|
|
2
|
+
name: 'Name',
|
|
3
|
+
datastakeId: 'ID'
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const getFiltersConfig = ({t}) => {
|
|
7
|
+
return {
|
|
8
|
+
country: {
|
|
9
|
+
type: 'select',
|
|
10
|
+
placeholder: t('Country'),
|
|
11
|
+
style: { flex: 1 },
|
|
12
|
+
labelStyle: { flex: 1 },
|
|
13
|
+
getLabel: (option) => option.label,
|
|
14
|
+
getValue: (option) => option.value,
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const filtersConfig = {
|
|
20
|
+
name: '',
|
|
21
|
+
datastakeId: '',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const getFilterOptions = (options, t) => {
|
|
25
|
+
const { countries } = options || {};
|
|
26
|
+
const _default = {
|
|
27
|
+
country: countries,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return _default;
|
|
31
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React, { useEffect} from 'react'
|
|
2
|
+
import { message } from 'antd';
|
|
3
|
+
import { MessageTypes } from '../../../../../helpers/messages.js';
|
|
4
|
+
import DynamicForm from '../../../../core/components/DynamicForm/index.jsx';
|
|
5
|
+
|
|
6
|
+
const StakeholdersCreate = ({
|
|
7
|
+
namespace = "OPERATOR",
|
|
8
|
+
view = ['scoping', 'new'],
|
|
9
|
+
edit = false,
|
|
10
|
+
formData = {},
|
|
11
|
+
loading = false,
|
|
12
|
+
onSubmitted = () => {},
|
|
13
|
+
onCancel = () => {},
|
|
14
|
+
getData = () => {},
|
|
15
|
+
saveData = () => {},
|
|
16
|
+
form: formConfig = {},
|
|
17
|
+
formValue = {},
|
|
18
|
+
defaultData = {},
|
|
19
|
+
user = {},
|
|
20
|
+
APP,
|
|
21
|
+
query,
|
|
22
|
+
goTo = () => {},
|
|
23
|
+
t = () => {},
|
|
24
|
+
ajaxForms = {},
|
|
25
|
+
changeAjaxForms = () => {},
|
|
26
|
+
ajaxOptions = {},
|
|
27
|
+
changeAjaxOptions = () => {},
|
|
28
|
+
getAppHeader = () => {},
|
|
29
|
+
getApiBaseUrl = () => {},
|
|
30
|
+
}) => {
|
|
31
|
+
let {
|
|
32
|
+
form = {},
|
|
33
|
+
data = defaultData || {},
|
|
34
|
+
} = !edit ? (formData[`${APP}-${view}`] || {}) : {
|
|
35
|
+
form: formConfig,
|
|
36
|
+
data: formValue
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
|
|
41
|
+
if (!edit) {
|
|
42
|
+
getData({ namespace, module: APP, view, scope: 'global' });
|
|
43
|
+
} else {
|
|
44
|
+
form = formConfig;
|
|
45
|
+
data = formValue;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, [edit, user?.language]);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className="daf-create-form">
|
|
52
|
+
<DynamicForm
|
|
53
|
+
form={form}
|
|
54
|
+
data={data}
|
|
55
|
+
showSaveAndNext={false}
|
|
56
|
+
module={APP}
|
|
57
|
+
onCancel={onCancel}
|
|
58
|
+
isCreate
|
|
59
|
+
t={t}
|
|
60
|
+
excludedKeys={["title"]}
|
|
61
|
+
user={user}
|
|
62
|
+
ajaxForms={ajaxForms}
|
|
63
|
+
ajaxOptions={ajaxOptions}
|
|
64
|
+
getAppHeader={getAppHeader}
|
|
65
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
66
|
+
changeAjaxOptions={changeAjaxOptions}
|
|
67
|
+
app={APP}
|
|
68
|
+
query={query}
|
|
69
|
+
goTo={goTo}
|
|
70
|
+
changeAjaxForms={changeAjaxForms}
|
|
71
|
+
submit={(payload, setSelectedFormNext) => {
|
|
72
|
+
const payloadData = { ...payload, module: APP, namespace };
|
|
73
|
+
|
|
74
|
+
const newPayload = {
|
|
75
|
+
...defaultData,
|
|
76
|
+
...payloadData,
|
|
77
|
+
form: 'operator'
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const callback = (type, m, data) => {
|
|
81
|
+
if (setSelectedFormNext) {
|
|
82
|
+
setSelectedFormNext();
|
|
83
|
+
}
|
|
84
|
+
if (type === MessageTypes.SUCCESS) {
|
|
85
|
+
if (onSubmitted) onSubmitted(type, m, data);
|
|
86
|
+
} else {
|
|
87
|
+
message.error(m);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
saveData(
|
|
92
|
+
!data && !data.id ? newPayload : Object.assign(newPayload, { id: data.id }),
|
|
93
|
+
callback,
|
|
94
|
+
);
|
|
95
|
+
}}
|
|
96
|
+
isFormDisabled={() => {
|
|
97
|
+
return !data || !data.typeOfEvent;
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export default StakeholdersCreate
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import React, { useMemo, useState, useEffect, useCallback } from 'react'
|
|
2
|
+
import TablePageWithTabs from '../../../pages/TablePageWithTabs/index.jsx'
|
|
3
|
+
import { getColumns } from './columns.js';
|
|
4
|
+
import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
|
|
5
|
+
import { useGetQueryParams } from '../../../../hooks/useGetQueryParams.js';
|
|
6
|
+
import StakeholdersCreate from './create.jsx';
|
|
7
|
+
import { displayMessage } from '../../../../../helpers/messages.js';
|
|
8
|
+
|
|
9
|
+
const OperatorsTable = ({
|
|
10
|
+
t = () => {},
|
|
11
|
+
goTo = () => {},
|
|
12
|
+
user = {},
|
|
13
|
+
options = {},
|
|
14
|
+
getRedirectLink = () => {},
|
|
15
|
+
theme = {},
|
|
16
|
+
loading = false,
|
|
17
|
+
data = {},
|
|
18
|
+
isMobile,
|
|
19
|
+
APP,
|
|
20
|
+
location,
|
|
21
|
+
getData = () => {},
|
|
22
|
+
getApiBaseUrl = () => {},
|
|
23
|
+
getAppHeader = () => {},
|
|
24
|
+
getFormData = () => {},
|
|
25
|
+
saveFormData = () => {},
|
|
26
|
+
formLoading = false,
|
|
27
|
+
query = {},
|
|
28
|
+
ajaxForms = {},
|
|
29
|
+
changeAjaxForms = () => {},
|
|
30
|
+
ajaxOptions = {},
|
|
31
|
+
changeAjaxOptions = () => {},
|
|
32
|
+
formData = {},
|
|
33
|
+
formValue = {},
|
|
34
|
+
form = {},
|
|
35
|
+
extendingFilters = {},
|
|
36
|
+
}) => {
|
|
37
|
+
const [selectOptions, setSelectOptions] = useState();
|
|
38
|
+
const [activeTab, setActiveTab] = useState();
|
|
39
|
+
|
|
40
|
+
const columns = useMemo(() => getColumns({
|
|
41
|
+
t,
|
|
42
|
+
goTo,
|
|
43
|
+
user,
|
|
44
|
+
options,
|
|
45
|
+
activeTab,
|
|
46
|
+
getRedirectLink,
|
|
47
|
+
theme,
|
|
48
|
+
subject: 'operators',
|
|
49
|
+
data,
|
|
50
|
+
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
|
|
51
|
+
|
|
52
|
+
const breadCrumbs = [];
|
|
53
|
+
|
|
54
|
+
const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
|
|
55
|
+
|
|
56
|
+
const filters = useMemo(() => {
|
|
57
|
+
return {
|
|
58
|
+
...otherParams,
|
|
59
|
+
...extendingFilters
|
|
60
|
+
}
|
|
61
|
+
}, [otherParams, extendingFilters])
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
console.log("fetching data")
|
|
65
|
+
getData({
|
|
66
|
+
pagination: paginationQuery,
|
|
67
|
+
...(Object.keys(filters).length > 0 && { filters: filters }),
|
|
68
|
+
...(Object.keys(searchParams).length > 0 && { search: searchParams }),
|
|
69
|
+
tab: activeTab,
|
|
70
|
+
sortBy: {
|
|
71
|
+
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
72
|
+
}
|
|
73
|
+
}, 'operators')
|
|
74
|
+
console.log("data fetched")
|
|
75
|
+
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
76
|
+
|
|
77
|
+
console.log({data})
|
|
78
|
+
|
|
79
|
+
const selectFiltersConfig = useMemo(() => {
|
|
80
|
+
return getFiltersConfig({t});
|
|
81
|
+
}, [t]);
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
setSelectOptions((prev) => ({
|
|
85
|
+
...prev,
|
|
86
|
+
...getFilterOptions(options, t),
|
|
87
|
+
}))
|
|
88
|
+
}, [options, t])
|
|
89
|
+
|
|
90
|
+
const handleActiveTabChange = useCallback((value) => {
|
|
91
|
+
setActiveTab(value);
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<TablePageWithTabs
|
|
96
|
+
t={t}
|
|
97
|
+
title={t("Operators")}
|
|
98
|
+
breadCrumbs={breadCrumbs}
|
|
99
|
+
location={location}
|
|
100
|
+
loading={loading}
|
|
101
|
+
goTo={goTo}
|
|
102
|
+
defaultActiveTab={"all"}
|
|
103
|
+
columns={columns}
|
|
104
|
+
data={data}
|
|
105
|
+
checkboxConfig={checkboxConfig}
|
|
106
|
+
APP={APP}
|
|
107
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
108
|
+
selectOptions={selectOptions}
|
|
109
|
+
selectFiltersConfig={selectFiltersConfig}
|
|
110
|
+
getRedirectLink={getRedirectLink}
|
|
111
|
+
filtersConfig={filtersConfig}
|
|
112
|
+
isMobile={isMobile}
|
|
113
|
+
view="operators"
|
|
114
|
+
getActiveTab={handleActiveTabChange}
|
|
115
|
+
onDownload={() => {
|
|
116
|
+
console.log("download");
|
|
117
|
+
}}
|
|
118
|
+
drawerTitle={t("Create Operator")}
|
|
119
|
+
>
|
|
120
|
+
{({onDrawerClose}) => (
|
|
121
|
+
<StakeholdersCreate
|
|
122
|
+
t={t}
|
|
123
|
+
goTo={goTo}
|
|
124
|
+
user={user}
|
|
125
|
+
APP={APP}
|
|
126
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
127
|
+
getAppHeader={getAppHeader}
|
|
128
|
+
getData={getFormData}
|
|
129
|
+
saveData={saveFormData}
|
|
130
|
+
loading={formLoading}
|
|
131
|
+
onSubmitted={(type, m, data) => {
|
|
132
|
+
if (data.datastakeId) {
|
|
133
|
+
displayMessage(
|
|
134
|
+
type,
|
|
135
|
+
t("affirmations::subject-created-successfully") || m,
|
|
136
|
+
);
|
|
137
|
+
// goTo(`/app/edit/stakeholders/${data.datastakeId}`);
|
|
138
|
+
goTo(`/app/edit/operators/${data.datastakeId}`)
|
|
139
|
+
}
|
|
140
|
+
}}
|
|
141
|
+
onCancel={onDrawerClose}
|
|
142
|
+
query={query}
|
|
143
|
+
ajaxForms={ajaxForms}
|
|
144
|
+
changeAjaxForms={changeAjaxForms}
|
|
145
|
+
ajaxOptions={ajaxOptions}
|
|
146
|
+
changeAjaxOptions={changeAjaxOptions}
|
|
147
|
+
formData={formData}
|
|
148
|
+
formValue={formValue}
|
|
149
|
+
form={form}
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
152
|
+
</TablePageWithTabs>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export default OperatorsTable
|
|
@@ -31,7 +31,7 @@ const TablePageWithTabs = ({
|
|
|
31
31
|
onCreateModalClose = () => {},
|
|
32
32
|
children
|
|
33
33
|
}) => {
|
|
34
|
-
const params = new URLSearchParams(location
|
|
34
|
+
const params = new URLSearchParams(location?.search);
|
|
35
35
|
const [activeTab, setActiveTab] = useState(params.get("tab") || defaultActiveTab);
|
|
36
36
|
const [openCreateModal, setOpenCreateModal] = useState(false);
|
|
37
37
|
|
|
@@ -75,7 +75,7 @@ const TablePageWithTabs = ({
|
|
|
75
75
|
|
|
76
76
|
setActiveTab(val);
|
|
77
77
|
|
|
78
|
-
const newParams = new URLSearchParams(location
|
|
78
|
+
const newParams = new URLSearchParams(location?.search);
|
|
79
79
|
newParams.set("tab", val);
|
|
80
80
|
goTo(`${location.pathname}?${newParams.toString()}`);
|
|
81
81
|
}}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { BaseService } from "./BaseService.js";
|
|
2
|
+
import { createLazyService } from "./helpers/LazyService.js";
|
|
3
|
+
import { filterCreateData } from "../../helpers/Forms.js";
|
|
4
|
+
|
|
5
|
+
const namespaceEnums = {
|
|
6
|
+
scl: "location",
|
|
7
|
+
workers: "worker",
|
|
8
|
+
operators: "operator",
|
|
9
|
+
testimonials: "nashirikiEvent",
|
|
10
|
+
armedGroups: "armed-groups",
|
|
11
|
+
conflictAreas: "location",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class OperatorService extends BaseService {
|
|
16
|
+
get(params) {
|
|
17
|
+
return this.apiGet({
|
|
18
|
+
url: "/stakeholder",
|
|
19
|
+
params,
|
|
20
|
+
isApp: true,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getForm(scope = "create", language = "en") {
|
|
25
|
+
return this.apiGet({
|
|
26
|
+
url: `/forms/${namespaceEnums["operators"]}`,
|
|
27
|
+
isApp: true,
|
|
28
|
+
params: { scope, language },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getData(id, sourceId) {
|
|
33
|
+
return this.apiGet({
|
|
34
|
+
isApp: true,
|
|
35
|
+
url: `/stakeholder/${id}`,
|
|
36
|
+
params: { authorId: sourceId },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
submit(payload) {
|
|
41
|
+
if (payload.id) {
|
|
42
|
+
return this.apiPut({
|
|
43
|
+
isApp: true,
|
|
44
|
+
url: `/stakeholder/${payload.id}`,
|
|
45
|
+
data: filterCreateData(payload),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (payload?.form) {
|
|
49
|
+
delete payload.form;
|
|
50
|
+
return this.apiPost({
|
|
51
|
+
isApp: true,
|
|
52
|
+
url: "/stakeholder",
|
|
53
|
+
data: filterCreateData(payload),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return this.apiPost({
|
|
57
|
+
isApp: true,
|
|
58
|
+
url: "/stakeholder",
|
|
59
|
+
data: filterCreateData(payload),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
submitStep(data, id) {
|
|
64
|
+
return this.apiPut({
|
|
65
|
+
isApp: true,
|
|
66
|
+
url: `/stakeholder/submit/${id}`,
|
|
67
|
+
data: filterCreateData(data),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
remove(id, data) {
|
|
72
|
+
return this.apiDelete({
|
|
73
|
+
url: `/stakeholder/${id}/remove`,
|
|
74
|
+
isApp: true,
|
|
75
|
+
data: data,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
getOptions(id = "optionPositionSupplyChain,subCategory,activityAtSite,category,countries") {
|
|
80
|
+
return this.apiGet({
|
|
81
|
+
isApp: true,
|
|
82
|
+
url: `/forms/options`,
|
|
83
|
+
params: {
|
|
84
|
+
id: id,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default createLazyService(OperatorService);
|
|
@@ -26,12 +26,12 @@ export const titleToCamelCase = str => str
|
|
|
26
26
|
export const findOptions = (value, options) => {
|
|
27
27
|
if (value instanceof Array) {
|
|
28
28
|
return value.map(v => {
|
|
29
|
-
const op = options
|
|
29
|
+
const op = Array.isArray(options) ? options.find(o => o.value === v) : null;
|
|
30
30
|
return op ? op.label : v;
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
if (typeof value === "string") {
|
|
34
|
-
const op = options
|
|
34
|
+
const op = Array.isArray(options) ? options.find(o => o.value === value) : null;
|
|
35
35
|
return op ? op.label : value;
|
|
36
36
|
}
|
|
37
37
|
return value;
|
|
@@ -39,12 +39,12 @@ export const findOptions = (value, options) => {
|
|
|
39
39
|
export const getOptionAsObject = (value, options) => {
|
|
40
40
|
if (value instanceof Array) {
|
|
41
41
|
return value.map(v => {
|
|
42
|
-
const op = options.find(o => o.value === v);
|
|
42
|
+
const op = Array.isArray(options) ? options.find(o => o.value === v) : null;
|
|
43
43
|
return op || { label: v, value: v };
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
if (typeof value === "string") {
|
|
47
|
-
const op = options.find(o => o.value === value);
|
|
47
|
+
const op = Array.isArray(options) ? options.find(o => o.value === value) : null;
|
|
48
48
|
return op || { value, label: value };
|
|
49
49
|
}
|
|
50
50
|
return value;
|
package/src/pages.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// Dashboards
|
|
2
2
|
export { default as SupplyChainDashboard } from './@daf/pages/dashboards/SupplyChain/index.jsx';
|
|
3
3
|
export { default as UserDashboard } from './@daf/pages/dashboards/UserDashboard/index.jsx';
|
|
4
|
+
export { default as OperatorsTable } from './@daf/pages/dashboards/Operations/Operators/index.jsx';
|
|
5
|
+
export { default as LocationsTable } from './@daf/pages/dashboards/AllInformation/Locations/index.jsx';
|
|
4
6
|
export { default as StakeholdersTable } from './@daf/pages/dashboards/AllInformation/Stakeholders/index.jsx';
|
|
5
|
-
|
|
7
|
+
export { default as EventsTable } from './@daf/pages/dashboards/AllInformation/Events/index.jsx';
|
|
8
|
+
export { default as DocumentsTable } from './@daf/pages/dashboards/AllInformation/Documents/index.jsx';
|
|
6
9
|
// Pages
|
|
7
10
|
export { default as TablePageWithTabs } from './@daf/pages/pages/TablePageWithTabs/index.jsx';
|
|
8
|
-
|
|
11
|
+
|
package/src/services.js
CHANGED
|
@@ -16,4 +16,5 @@ export { default as QueryService } from './@daf/services/QueryService.js';
|
|
|
16
16
|
export { default as UserService } from './@daf/services/UserService.js';
|
|
17
17
|
export { default as SourceService } from './@daf/services/SourceService.js';
|
|
18
18
|
export { default as DashboardService } from './@daf/services/DashboardService.js';
|
|
19
|
-
export { default as LinkedSubjectsService } from './@daf/services/LinkedSubjects.js';
|
|
19
|
+
export { default as LinkedSubjectsService } from './@daf/services/LinkedSubjects.js';
|
|
20
|
+
export { default as OperatorService } from './@daf/services/OperatorService.js';
|
package/build/favicon.ico
DELETED
|
Binary file
|
package/build/logo192.png
DELETED
|
Binary file
|
package/build/logo512.png
DELETED
|
Binary file
|
package/build/manifest.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React App",
|
|
3
|
-
"name": "Create React App Sample",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
package/build/robots.txt
DELETED