datastake-daf 0.6.742 → 0.6.743

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.
Files changed (29) hide show
  1. package/build/favicon.ico +0 -0
  2. package/build/logo192.png +0 -0
  3. package/build/logo512.png +0 -0
  4. package/build/manifest.json +25 -0
  5. package/build/robots.txt +3 -0
  6. package/dist/hooks/index.js +4658 -19
  7. package/dist/pages/index.js +1525 -110
  8. package/package.json +1 -1
  9. package/src/@daf/pages/dashboards/AllInformation/Documents/columns.js +4 -3
  10. package/src/@daf/pages/dashboards/AllInformation/Documents/index.jsx +3 -1
  11. package/src/@daf/pages/dashboards/AllInformation/Events/columns.js +4 -3
  12. package/src/@daf/pages/dashboards/AllInformation/Events/index.jsx +3 -1
  13. package/src/@daf/pages/dashboards/AllInformation/Locations/columns.js +4 -3
  14. package/src/@daf/pages/dashboards/AllInformation/Locations/index.jsx +3 -1
  15. package/src/@daf/pages/dashboards/AllInformation/Stakeholders/columns.js +5 -2
  16. package/src/@daf/pages/dashboards/AllInformation/Stakeholders/index.jsx +4 -2
  17. package/src/@daf/pages/dashboards/DueDilligence/Activities/columns.js +221 -0
  18. package/src/@daf/pages/dashboards/DueDilligence/Activities/config.js +166 -0
  19. package/src/@daf/pages/dashboards/DueDilligence/Activities/create.jsx +104 -0
  20. package/src/@daf/pages/dashboards/DueDilligence/Activities/index.jsx +157 -0
  21. package/src/@daf/pages/dashboards/Operations/Operators/columns.js +4 -3
  22. package/src/@daf/pages/dashboards/Operations/Operators/config.js +0 -1
  23. package/src/@daf/pages/dashboards/Operations/Operators/index.jsx +3 -1
  24. package/src/@daf/pages/dashboards/Operations/Workers/columns.js +176 -0
  25. package/src/@daf/pages/dashboards/Operations/Workers/config.js +166 -0
  26. package/src/@daf/pages/dashboards/Operations/Workers/create.jsx +104 -0
  27. package/src/@daf/pages/dashboards/Operations/Workers/index.jsx +157 -0
  28. package/src/helpers/sourceAvatarConfig.js +37 -0
  29. package/src/pages.js +3 -0
@@ -0,0 +1,157 @@
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 ActivitiesTable = ({
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
+ createDefaultValues = {},
37
+ applications = [],
38
+ }) => {
39
+ const [selectOptions, setSelectOptions] = useState();
40
+ const [activeTab, setActiveTab] = useState();
41
+
42
+ const columns = useMemo(() => getColumns({
43
+ t,
44
+ goTo,
45
+ user,
46
+ options,
47
+ activeTab,
48
+ getRedirectLink,
49
+ theme,
50
+ subject: 'activities',
51
+ data,
52
+ applications,
53
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
54
+
55
+ const breadCrumbs = [];
56
+
57
+ const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
58
+
59
+ const filters = useMemo(() => {
60
+ return {
61
+ ...otherParams,
62
+ ...extendingFilters
63
+ }
64
+ }, [otherParams, extendingFilters])
65
+
66
+ useEffect(() => {
67
+ getData({
68
+ pagination: paginationQuery,
69
+ ...(Object.keys(searchParams).length > 0 && { search: searchParams }),
70
+ ...otherParams,
71
+ tab: activeTab,
72
+ sortBy: {
73
+ [sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
74
+ },
75
+ ...extendingFilters
76
+ }, 'activities')
77
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
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("Activities")}
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="activities"
114
+ getActiveTab={handleActiveTabChange}
115
+ onDownload={() => {
116
+ console.log("download");
117
+ }}
118
+ drawerTitle={t("Create Activity")}
119
+ >
120
+ {({onDrawerClose}) => (
121
+ <StakeholdersCreate
122
+ defaultData={createDefaultValues}
123
+ t={t}
124
+ goTo={goTo}
125
+ user={user}
126
+ APP={APP}
127
+ getApiBaseUrl={getApiBaseUrl}
128
+ getAppHeader={getAppHeader}
129
+ getData={getFormData}
130
+ saveData={saveFormData}
131
+ loading={formLoading}
132
+ onSubmitted={(type, m, data) => {
133
+ if (data.datastakeId) {
134
+ displayMessage(
135
+ type,
136
+ t("affirmations::subject-created-successfully") || m,
137
+ );
138
+ // goTo(`/app/edit/stakeholders/${data.datastakeId}`);
139
+ goTo(`/app/edit/activities/${data.datastakeId}`)
140
+ }
141
+ }}
142
+ onCancel={onDrawerClose}
143
+ query={query}
144
+ ajaxForms={ajaxForms}
145
+ changeAjaxForms={changeAjaxForms}
146
+ ajaxOptions={ajaxOptions}
147
+ changeAjaxOptions={changeAjaxOptions}
148
+ formData={formData}
149
+ formValue={formValue}
150
+ form={form}
151
+ />
152
+ )}
153
+ </TablePageWithTabs>
154
+ )
155
+ }
156
+
157
+ export default ActivitiesTable
@@ -4,6 +4,7 @@ import { findOptions } from '../../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
7
8
 
8
9
  const getLinkValue = (value, linkingObject) => {
9
10
  if(linkingObject && linkingObject?.[value]) {
@@ -12,7 +13,7 @@ const getLinkValue = (value, linkingObject) => {
12
13
  return null;
13
14
  }
14
15
 
15
- export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data}) => [
16
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
16
17
  {
17
18
  dataIndex: 'datastakeId',
18
19
  title: t('ID'),
@@ -109,9 +110,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
109
110
  return <div className="daf-default-cell" />;
110
111
  }
111
112
 
112
- console.log({val, all})
113
+ const sources = sourceAvatarConfig(val, user, applications);
113
114
 
114
- return <AvatarGroup items={val}></AvatarGroup>;
115
+ return <AvatarGroup items={sources}></AvatarGroup>;
115
116
  },
116
117
  },
117
118
  {
@@ -139,7 +139,6 @@ export const getFilterOptions = (options, t) => {
139
139
  administrativeLevel1,
140
140
  administrativeLevel2,
141
141
  } = options || {};
142
- console.log({options})
143
142
 
144
143
  const _default = {
145
144
  category: stakeholderCategoryOptions || categoryOptions,
@@ -34,6 +34,7 @@ const OperatorsTable = ({
34
34
  form = {},
35
35
  extendingFilters = {},
36
36
  createDefaultValues = {},
37
+ applications = [],
37
38
  }) => {
38
39
  const [selectOptions, setSelectOptions] = useState();
39
40
  const [activeTab, setActiveTab] = useState();
@@ -48,7 +49,8 @@ const OperatorsTable = ({
48
49
  theme,
49
50
  subject: 'operators',
50
51
  data,
51
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
52
+ applications,
53
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
52
54
 
53
55
  const breadCrumbs = [];
54
56
 
@@ -0,0 +1,176 @@
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 AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
8
+
9
+ const getLinkValue = (value, linkingObject) => {
10
+ if(linkingObject && linkingObject?.[value]) {
11
+ return linkingObject?.[value]?.name;
12
+ }
13
+ return null;
14
+ }
15
+
16
+ export const renderStatusTag = ({ value, t = (s) => s }) => {
17
+ const width = 87;
18
+
19
+ switch (value) {
20
+ case "edited":
21
+ return (
22
+ <Tag color="yellow" style={{ width }} className="text-center">
23
+ {t("Edited")}
24
+ </Tag>
25
+ );
26
+ case "submitted":
27
+ return (
28
+ <Tag color="green" style={{ width }} className="text-center">
29
+ {t("Submitted")}
30
+ </Tag>
31
+ );
32
+ default:
33
+ return (
34
+ <Tag color="blue" style={{ width }} className="text-center">
35
+ {t("Private")}
36
+ </Tag>
37
+ );
38
+ }
39
+ };
40
+
41
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
42
+ // {
43
+ // dataIndex: 'datastakeId',
44
+ // title: t('ID'),
45
+ // ellipsis: true,
46
+ // show: true,
47
+ // render: (v, all) => {
48
+ // if (all.empty) {
49
+ // return <div className="daf-default-cell" />
50
+ // }
51
+
52
+ // return <Tooltip title={v}>{v}</Tooltip>;
53
+ // },
54
+ // },
55
+ {
56
+ dataIndex: 'name',
57
+ title: t('Name'),
58
+ ellipsis: true,
59
+ show: true,
60
+ render: (v, all) => {
61
+ if (all.empty) {
62
+ return <div className="daf-default-cell" />
63
+ }
64
+
65
+ return <Tooltip title={v}>{v}</Tooltip>;
66
+ },
67
+ },
68
+ {
69
+ dataIndex: 'mineSite',
70
+ title: t('Position'),
71
+ ellipsis: true,
72
+ show: true,
73
+ render: (v, all) => {
74
+ if (all.empty) {
75
+ return <div className="daf-default-cell" />
76
+ }
77
+
78
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
79
+ const mineSite = all?.location?.name
80
+
81
+ return mineSite ? <Tooltip title={mineSite}>{mineSite}</Tooltip> : '-';
82
+ },
83
+ },
84
+ {
85
+ dataIndex: 'activity',
86
+ title: t('Activity'),
87
+ ellipsis: true,
88
+ show: true,
89
+ render: (v, all) => {
90
+ if (all.empty) {
91
+ return <div className="daf-default-cell" />
92
+ }
93
+
94
+ const activity = findOptions(v, data?.options?.activityAtSiteOptions);
95
+
96
+ return activity ? <Tooltip title={activity}>{activity}</Tooltip> : '-';
97
+ },
98
+ },
99
+ {
100
+ dataIndex: 'origin',
101
+ title: t('Origin'),
102
+ ellipsis: true,
103
+ show: true,
104
+ render: (v, all) => {
105
+ if (all.empty) {
106
+ return <div className="daf-default-cell" />
107
+ }
108
+
109
+ const origin = all?.placeOfBirth?.name;
110
+
111
+ return origin ? <Tooltip title={origin}>{origin}</Tooltip> : '-';
112
+ },
113
+ },
114
+ {
115
+ title: t("Census Update"),
116
+ dataIndex: "createdAt",
117
+ key: "createdAt",
118
+ render: (date, all) => {
119
+ if (all.empty) {
120
+ return <div className="daf-default-cell" />;
121
+ }
122
+
123
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
124
+ return <Tooltip title={_date}>{_date}</Tooltip>;
125
+ },
126
+ ellipsis: true,
127
+ },
128
+ {
129
+ title: t("Sources"),
130
+ dataIndex: "sources",
131
+ key: "sources",
132
+ show: activeTab !== "own",
133
+ render: (val, all) => {
134
+ if (all.empty) {
135
+ return <div className="daf-default-cell" />;
136
+ }
137
+
138
+ const sources = sourceAvatarConfig(val, user, applications);
139
+
140
+ return <AvatarGroup items={val}></AvatarGroup>;
141
+ },
142
+ },
143
+ {
144
+ title: t("Status"),
145
+ dataIndex: "status",
146
+ key: "status",
147
+ show: activeTab === "own",
148
+ render: (val, all) => {
149
+ if (all.empty) {
150
+ return <div className="daf-default-cell" />
151
+ }
152
+
153
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
154
+
155
+ return renderStatusTag({ value: _val, t });
156
+ },
157
+ },
158
+ {
159
+ id: 'actions',
160
+ title: "",
161
+ width: 60,
162
+ render: (_, all) => {
163
+ if (all.empty) {
164
+ return <div className="daf-default-cell" />;
165
+ }
166
+
167
+ const link = `/app/view/${subject}/${all.datastakeId}`;
168
+
169
+ return <div style={{ display: "flex", justifyContent: "center" }}>
170
+ <a href={getRedirectLink(link)}>
171
+ <CustomIcon name="Link" size={15} color={theme.baseGray70} />
172
+ </a>
173
+ </div>;
174
+ }
175
+ }
176
+ ].filter((column) => column.show !== false);
@@ -0,0 +1,166 @@
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
+ label: 'Country',
11
+ placeholder: (t) => `${t('Filter by')} ${t('Country').toLowerCase()}`,
12
+ style: { flex: 1 },
13
+ labelStyle: { flex: 1 },
14
+ getLabel: (option) => option.label,
15
+ getValue: (option) => option.value,
16
+ },
17
+ administrativeLevel1: {
18
+ type: 'ajaxSelect',
19
+ label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
20
+ const { administrativeLevel1 } = options;
21
+
22
+ if (administrativeLevel1) {
23
+ if (options.country) {
24
+ const _item = administrativeLevel1[filters.country];
25
+ if (_item) {
26
+ if (_item[language]) {
27
+ return _item[language]
28
+ }
29
+ }
30
+ }
31
+ }
32
+
33
+ return t('Province');
34
+ },
35
+ placeholder: (t) => `${t('Filter by')} ${t('Province').toLowerCase()}`,
36
+ filters: (data) => ({
37
+ country: data.country,
38
+ level: 'level_1',
39
+ }),
40
+ show: (data) => !data.country,
41
+ disabled: (data) => !data.country,
42
+ mapper: { label: "name", value: "id" },
43
+ method: 'getOptions',
44
+ entity: 'AdministrativeLevel',
45
+ style: { flex: 1 },
46
+ labelStyle: { flex: 1 },
47
+ },
48
+ administrativeLevel2: {
49
+ type: 'ajaxSelect',
50
+ label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
51
+ const { administrativeLevel2 } = options;
52
+
53
+ if (administrativeLevel2) {
54
+ if (options.country) {
55
+ const _item = administrativeLevel2[filters.country];
56
+ if (_item) {
57
+ if (_item[language]) {
58
+ return _item[language]
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ return t('Province');
65
+ },
66
+ show: (data) => !(data.country && data.administrativeLevel1),
67
+ placeholder: (t) => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
68
+ filters: (data) => ({
69
+ country: data.country,
70
+ level: 'level_2',
71
+ administrativeLevel1: data.administrativeLevel1,
72
+ }),
73
+ disabled: (data) => !(data.country && data.administrativeLevel1),
74
+ mapper: { label: "name", value: "id" },
75
+ method: 'getOptions',
76
+ entity: 'AdministrativeLevel',
77
+ style: { flex: 1 },
78
+ labelStyle: { flex: 1 },
79
+ },
80
+ activity: {
81
+ type: 'select',
82
+ label: 'Activity',
83
+ placeholder: (t) => `${t('Filter by')} ${t('Activity').toLowerCase()}`,
84
+ style: { flex: 1 },
85
+ labelStyle: { flex: 1 },
86
+ getLabel: (option) => option.label,
87
+ getValue: (option) => option.value,
88
+ filterOptions: (val) => {
89
+ if (val) {
90
+ const { option, filters } = val
91
+ if (filters && option) {
92
+ const { filters: optionFilters } = option;
93
+ if (Array.isArray(optionFilters) && optionFilters.length) {
94
+ const { value, condition } = optionFilters[0];
95
+ if (condition === 'includes') {
96
+ return value.includes('corporation');
97
+ }
98
+ }
99
+ }
100
+ }
101
+ return true;
102
+ },
103
+ },
104
+ positionInTheMineralSupplyChain: {
105
+ type: 'select',
106
+ label: 'Position',
107
+ placeholder: (t) => `${t('Filter by')} ${t('Position').toLowerCase()}`,
108
+ style: { flex: 1 },
109
+ labelStyle: { flex: 1 },
110
+ getLabel: (option) => option.label,
111
+ getValue: (option) => option.value,
112
+ },
113
+ status: {
114
+ type: "select",
115
+ label: "Status",
116
+ placeholder: (t) => `${t("Filter by")} ${t("Status").toLowerCase()}`,
117
+ style: { flex: 1 },
118
+ labelStyle: { fley: 1 },
119
+ getLabel: (option) => option.label,
120
+ getValue: (option) => option.value,
121
+ },
122
+ }
123
+ }
124
+
125
+ export const filtersConfig = {
126
+ name: '',
127
+ datastakeId: '',
128
+ };
129
+
130
+ export const getFilterOptions = (options, t) => {
131
+ const {
132
+ statusOptions = [],
133
+ categoryOptions = [],
134
+ countries = [],
135
+ subCategory = [],
136
+ activityAtSiteOptions = [],
137
+ stakeholderCategoryOptions,
138
+ stakeholderSubCategoriesOptions,
139
+ administrativeLevel1,
140
+ administrativeLevel2,
141
+ positionInMineralSupplyChainOptions,
142
+ subCategoriesOptions,
143
+ } = options || {};
144
+
145
+ const _default = {
146
+ status: [
147
+ {
148
+ value: "submitted",
149
+ label: "Submitted",
150
+ },
151
+ {
152
+ value: "private",
153
+ label: "Private",
154
+ },
155
+ ],
156
+ category: stakeholderCategoryOptions || categoryOptions,
157
+ country: countries,
158
+ subCategory: subCategoriesOptions,
159
+ activity: activityAtSiteOptions,
160
+ administrativeLevel1,
161
+ administrativeLevel2,
162
+ positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions,
163
+ }
164
+
165
+ return _default;
166
+ }
@@ -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 = "WORKERS",
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={{...defaultData, ...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: 'worker'
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