datastake-daf 0.6.766 → 0.6.768

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 (51) hide show
  1. package/dist/components/index.js +269 -140
  2. package/dist/pages/index.js +4736 -5657
  3. package/dist/utils/index.js +16 -1
  4. package/package.json +4 -1
  5. package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +5 -2
  6. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +67 -28
  7. package/src/@daf/core/components/Dashboard/Map/StakeholderIcon/index.js +3 -0
  8. package/src/@daf/core/components/Dashboard/Map/hook.js +57 -33
  9. package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +49 -11
  10. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +8 -4
  11. package/src/@daf/core/components/Screens/BaseScreen/index.jsx +1 -1
  12. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +1 -1
  13. package/src/@daf/core/components/UI/MissingTagButton/index.jsx +36 -0
  14. package/src/@daf/hooks/useMapHelper.js +5 -0
  15. package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +3 -2
  16. package/src/@daf/pages/Documents/config.js +0 -10
  17. package/src/@daf/pages/Documents/index.jsx +51 -108
  18. package/src/@daf/pages/Events/Activities/config.js +1 -11
  19. package/src/@daf/pages/Events/Activities/index.jsx +47 -105
  20. package/src/@daf/pages/Events/Incidents/config.js +1 -11
  21. package/src/@daf/pages/Events/Incidents/index.jsx +47 -105
  22. package/src/@daf/pages/Events/config.js +18 -34
  23. package/src/@daf/pages/Events/helper.js +0 -1
  24. package/src/@daf/pages/Events/index.jsx +49 -111
  25. package/src/@daf/pages/Locations/MineSite/columns.js +1 -1
  26. package/src/@daf/pages/Locations/MineSite/config.js +0 -10
  27. package/src/@daf/pages/Locations/MineSite/index.jsx +47 -105
  28. package/src/@daf/pages/Locations/config.js +4 -16
  29. package/src/@daf/pages/Locations/index.jsx +53 -110
  30. package/src/@daf/pages/Stakeholders/Operators/config.js +0 -10
  31. package/src/@daf/pages/Stakeholders/Operators/index.jsx +47 -105
  32. package/src/@daf/pages/Stakeholders/Workers/config.js +0 -10
  33. package/src/@daf/pages/Stakeholders/Workers/index.jsx +47 -105
  34. package/src/@daf/pages/Stakeholders/config.js +3 -15
  35. package/src/@daf/pages/Stakeholders/index.jsx +53 -109
  36. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +5 -1
  37. package/src/@daf/pages/TablePage/config.js +78 -0
  38. package/src/@daf/pages/{Events → TablePage}/create.jsx +11 -8
  39. package/src/@daf/pages/TablePage/hook.js +123 -0
  40. package/src/@daf/pages/TablePage/index.jsx +142 -0
  41. package/src/constants/locales/en/translation.js +5 -0
  42. package/src/constants/locales/fr/translation.js +5 -0
  43. package/src/index.js +1 -0
  44. package/src/@daf/pages/Documents/create.jsx +0 -105
  45. package/src/@daf/pages/Events/Activities/create.jsx +0 -104
  46. package/src/@daf/pages/Events/Incidents/create.jsx +0 -104
  47. package/src/@daf/pages/Locations/MineSite/create.jsx +0 -104
  48. package/src/@daf/pages/Locations/create.jsx +0 -104
  49. package/src/@daf/pages/Stakeholders/Operators/create.jsx +0 -104
  50. package/src/@daf/pages/Stakeholders/Workers/create.jsx +0 -104
  51. package/src/@daf/pages/Stakeholders/create.jsx +0 -105
@@ -3,9 +3,9 @@ import { message } from 'antd';
3
3
  import { MessageTypes } from '../../../helpers/messages.js';
4
4
  import DynamicForm from '../../core/components/DynamicForm/index.jsx';
5
5
 
6
- const EventsCreate = ({
7
- namespace = 'event',
8
- view = 'scoping',
6
+ const Create = ({
7
+ namespace,
8
+ view,
9
9
  edit = false,
10
10
  formData = {},
11
11
  loading = false,
@@ -27,6 +27,8 @@ const EventsCreate = ({
27
27
  changeAjaxOptions = () => {},
28
28
  getAppHeader = () => {},
29
29
  getApiBaseUrl = () => {},
30
+ scope,
31
+ formType
30
32
  }) => {
31
33
  let {
32
34
  form = {},
@@ -39,19 +41,19 @@ const EventsCreate = ({
39
41
  useEffect(() => {
40
42
  if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
41
43
  if (!edit) {
42
- getData({ namespace, module: APP, view, scope: 'create' });
44
+ getData({ namespace, module: APP, view, scope });
43
45
  } else {
44
46
  form = formConfig;
45
47
  data = formValue;
46
48
  }
47
49
  }
48
- }, [edit, user?.language]);
50
+ }, [edit, user?.language, scope]);
49
51
 
50
52
  return (
51
53
  <div className="daf-create-form">
52
54
  <DynamicForm
53
55
  form={form}
54
- data={data}
56
+ data={{...defaultData, ...data}}
55
57
  showSaveAndNext={false}
56
58
  module={APP}
57
59
  onCancel={onCancel}
@@ -74,8 +76,9 @@ const EventsCreate = ({
74
76
  const newPayload = {
75
77
  ...defaultData,
76
78
  ...payloadData,
77
- form: 'location'
79
+ form: formType
78
80
  };
81
+
79
82
 
80
83
  const callback = (type, m, data) => {
81
84
  if (setSelectedFormNext) {
@@ -101,4 +104,4 @@ const EventsCreate = ({
101
104
  )
102
105
  }
103
106
 
104
- export default EventsCreate
107
+ export default Create
@@ -0,0 +1,123 @@
1
+ import { useState, useEffect, useCallback, useMemo } from 'react';
2
+ import { useGetQueryParams } from "../../hooks/useGetQueryParams.js";
3
+ import { getFiltersConfig, getFilterOptions, getCheckboxConfig, getSelectFiltersConfig } from './config.js';
4
+
5
+ export const useFetchData = ({
6
+ location,
7
+ getData,
8
+ activeTab,
9
+ extendingFilters,
10
+ subject,
11
+ }) => {
12
+ const { paginationQuery, searchParams, otherParams, sortBy, sortDir, } = useGetQueryParams({location});
13
+ useEffect(() => {
14
+ const cleanSearchParams = Object.fromEntries(
15
+ Object.entries(searchParams).filter(([_, value]) => value != null && value !== '')
16
+ );
17
+
18
+ const hasPagination = paginationQuery.skip != null || paginationQuery.take != null;
19
+
20
+ if (!hasPagination) {
21
+ return;
22
+ }
23
+
24
+ getData({
25
+ ...extendingFilters,
26
+ pagination: paginationQuery,
27
+ ...(Object.keys(otherParams).length > 0 && otherParams ),
28
+ ...(Object.keys(cleanSearchParams).length > 0 && { search: cleanSearchParams }),
29
+ tab: activeTab,
30
+ sortBy: {
31
+ [sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
32
+ },
33
+ }, subject)
34
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
35
+ }
36
+
37
+ export const useTablePage = ({
38
+ subject,
39
+ location,
40
+ getData,
41
+ getColumns,
42
+ extendingFilters,
43
+ options,
44
+ t,
45
+ goTo,
46
+ user,
47
+ getRedirectLink,
48
+ theme,
49
+ data,
50
+ applications,
51
+ subjectClear,
52
+ }) => {
53
+ const [selectOptions, setSelectOptions] = useState();
54
+ const [activeTab, setActiveTab] = useState("own");
55
+
56
+ useFetchData({
57
+ location,
58
+ getData,
59
+ activeTab,
60
+ extendingFilters: extendingFilters,
61
+ subject,
62
+ });
63
+
64
+ const columns = useMemo(() =>
65
+ getColumns({
66
+ t,
67
+ goTo,
68
+ user,
69
+ options,
70
+ activeTab,
71
+ getRedirectLink,
72
+ theme,
73
+ subject,
74
+ data,
75
+ applications,
76
+ }),
77
+ [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns]
78
+ );
79
+
80
+ const selectFiltersConfig = useMemo(() =>
81
+ getFiltersConfig({ t, subject }),
82
+ [t, subject, getFiltersConfig]
83
+ );
84
+
85
+ useEffect(() => {
86
+ setSelectOptions((prev) => ({
87
+ ...prev,
88
+ ...getFilterOptions({ t, subject, options }),
89
+ }));
90
+ }, [options, t, subject, getFilterOptions]);
91
+
92
+ const checkboxConfig = useMemo(() =>
93
+ getCheckboxConfig({ subject }),
94
+ [subject, getCheckboxConfig]
95
+ );
96
+
97
+ const _filtersConfig = useMemo(() => {
98
+ return getSelectFiltersConfig({ subject });
99
+ }, [subject, getSelectFiltersConfig]);
100
+
101
+ const handleActiveTabChange = useCallback((value) => {
102
+ setActiveTab(value);
103
+ }, []);
104
+
105
+ useEffect(
106
+ () => () => {
107
+ if (subjectClear && typeof subjectClear === 'function') {
108
+ subjectClear();
109
+ }
110
+ },
111
+ [subjectClear]
112
+ );
113
+
114
+ return {
115
+ activeTab,
116
+ selectOptions,
117
+ columns,
118
+ selectFiltersConfig,
119
+ handleActiveTabChange,
120
+ checkboxConfig,
121
+ _filtersConfig,
122
+ };
123
+ }
@@ -0,0 +1,142 @@
1
+ import React from 'react';
2
+ import TablePageWithTabs from '../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx';
3
+ import Create from './create.jsx';
4
+ import { displayMessage } from '../../../helpers/messages.js';
5
+ import { useTablePage } from './hook.js';
6
+
7
+ const TablePage = ({
8
+ t = () => {},
9
+ goTo = () => {},
10
+ user = {},
11
+ options = {},
12
+ getRedirectLink = () => {},
13
+ theme = {},
14
+ loading = false,
15
+ data = {},
16
+ isMobile,
17
+ APP,
18
+ location,
19
+ formConfig = {
20
+ getFormData: () => {},
21
+ saveFormData: () => {},
22
+ formLoading: false,
23
+ query: {},
24
+ ajaxForms: {},
25
+ changeAjaxForms: () => {},
26
+ ajaxOptions: {},
27
+ changeAjaxOptions: () => {},
28
+ formData: {},
29
+ formValue: {},
30
+ form: {},
31
+ namespace: '',
32
+ view: '',
33
+ scope: '',
34
+ formType: '',
35
+ defaultValues: {},
36
+ },
37
+ extendingFilters = {},
38
+ getData = () => {},
39
+ getApiBaseUrl = () => {},
40
+ getAppHeader = () => {},
41
+ applications = [],
42
+ subjectClear,
43
+ subject,
44
+ getColumns = () => {},
45
+ viewConfig = {
46
+ title: '',
47
+ breadcrumbs: [],
48
+ createTitle: '',
49
+ },
50
+ onDownload,
51
+ }) => {
52
+
53
+ const {
54
+ activeTab,
55
+ selectOptions,
56
+ columns,
57
+ selectFiltersConfig,
58
+ handleActiveTabChange,
59
+ checkboxConfig,
60
+ _filtersConfig,
61
+ } = useTablePage({
62
+ subject,
63
+ location,
64
+ getData,
65
+ getColumns,
66
+ extendingFilters,
67
+ options,
68
+ t,
69
+ goTo,
70
+ user,
71
+ getRedirectLink,
72
+ theme,
73
+ data,
74
+ applications,
75
+ subjectClear,
76
+ });
77
+
78
+ return (
79
+ <TablePageWithTabs
80
+ t={t}
81
+ title={t(viewConfig.title || "")}
82
+ breadCrumbs={viewConfig.breadcrumbs}
83
+ location={location}
84
+ loading={loading}
85
+ goTo={goTo}
86
+ defaultActiveTab={"own"}
87
+ columns={columns}
88
+ data={data}
89
+ checkboxConfig={checkboxConfig}
90
+ APP={APP}
91
+ getApiBaseUrl={getApiBaseUrl}
92
+ selectOptions={selectOptions}
93
+ selectFiltersConfig={selectFiltersConfig}
94
+ getRedirectLink={getRedirectLink}
95
+ filtersConfig={_filtersConfig}
96
+ isMobile={isMobile}
97
+ view={subject}
98
+ getActiveTab={handleActiveTabChange}
99
+ onDownload={onDownload && typeof onDownload === 'function' ? onDownload : undefined}
100
+ drawerTitle={t(viewConfig.createTitle || "")}
101
+ >
102
+ {({onDrawerClose}) => (
103
+ <Create
104
+ t={t}
105
+ goTo={goTo}
106
+ user={user}
107
+ APP={APP}
108
+ getApiBaseUrl={getApiBaseUrl}
109
+ getAppHeader={getAppHeader}
110
+ getData={formConfig.getFormData}
111
+ saveData={formConfig.saveFormData}
112
+ loading={formConfig.formLoading}
113
+ onSubmitted={(type, m, data) => {
114
+ if (data.datastakeId) {
115
+ displayMessage(
116
+ type,
117
+ t("affirmations::subject-created-successfully") || m,
118
+ );
119
+ goTo(`/app/edit/${subject}/${data.datastakeId}`);
120
+ }
121
+ }}
122
+ onCancel={onDrawerClose}
123
+ query={formConfig.query}
124
+ ajaxForms={formConfig.ajaxForms}
125
+ changeAjaxForms={formConfig.changeAjaxForms}
126
+ ajaxOptions={formConfig.ajaxOptions}
127
+ changeAjaxOptions={formConfig.changeAjaxOptions}
128
+ formData={formConfig.formData}
129
+ formValue={formConfig.formValue}
130
+ form={formConfig.form}
131
+ namespace={formConfig.namespace}
132
+ view={formConfig.view}
133
+ scope={formConfig.scope}
134
+ formType={formConfig.formType}
135
+ defaultData={formConfig.defaultValues}
136
+ />
137
+ )}
138
+ </TablePageWithTabs>
139
+ );
140
+ };
141
+
142
+ export default TablePage;
@@ -1,4 +1,9 @@
1
1
  const en = {
2
+ "accounts": "Accounts",
3
+ "users": "Users",
4
+ "subjects": "Subjects",
5
+ "active-users": "Active Users",
6
+ "total-data-points": "Total Data Points",
2
7
  "Identified Customers": "Identified Customers",
3
8
  "Identified Suppliers": "Identified Suppliers",
4
9
  "Associated Mine Sites": "Associated Mine Sites",
@@ -1,4 +1,9 @@
1
1
  const fr = {
2
+ "accounts": "Comptes",
3
+ "users": "Utilisateurs",
4
+ "subjects": "Sujets",
5
+ "active-users": "Utilisateurs Actifs",
6
+ "total-data-points": "Total Points de Données",
2
7
  "Identified Customers": "Clients identifiés",
3
8
  "Identified Suppliers": "Fournisseurs identifiés",
4
9
  "Associated Mine Sites": "Sites miniers associés",
package/src/index.js CHANGED
@@ -193,6 +193,7 @@ export { InformationChannelProvider } from "./@daf/core/components/Screens/Infor
193
193
  export { default as SDGIcons } from "./@daf/core/components/UI/SDGIcon/index.jsx";
194
194
  export { default as CountryFlag } from "./@daf/core/components/UI/CountryFlag/index.jsx"
195
195
  export { default as KeyIndicatorNavigateLabel } from "./@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx";
196
+ export { default as MissingTagButton } from "./@daf/core/components/UI/MissingTagButton/index.jsx";
196
197
 
197
198
  //Settings
198
199
  export { default as Settings } from "./@daf/core/components/Screens/Settings/index.js";
@@ -1,105 +0,0 @@
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 = 'stakeholders',
8
- view = 'scoping',
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: 'create' });
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: 'document'
78
- };
79
-
80
-
81
- const callback = (type, m, data) => {
82
- if (setSelectedFormNext) {
83
- setSelectedFormNext();
84
- }
85
- if (type === MessageTypes.SUCCESS) {
86
- if (onSubmitted) onSubmitted(type, m, data);
87
- } else {
88
- message.error(m);
89
- }
90
- };
91
-
92
- saveData(
93
- !data && !data.id ? newPayload : Object.assign(newPayload, { id: data.id }),
94
- callback,
95
- );
96
- }}
97
- isFormDisabled={() => {
98
- return !data || !data.typeOfEvent;
99
- }}
100
- />
101
- </div>
102
- )
103
- }
104
-
105
- export default StakeholdersCreate
@@ -1,104 +0,0 @@
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 = "corrective-actions",
8
- view = "corrective-actions",
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: 'createActivity' });
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
@@ -1,104 +0,0 @@
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 = "incident",
8
- view = "incident",
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: 'createIncident' });
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