datastake-daf 0.6.743 → 0.6.744
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/pages/index.js +1743 -160
- package/dist/services/index.js +2 -2
- package/package.json +1 -1
- package/src/@daf/pages/dashboards/AllInformation/Documents/columns.js +39 -14
- package/src/@daf/pages/dashboards/AllInformation/Documents/create.jsx +5 -4
- package/src/@daf/pages/dashboards/AllInformation/Documents/index.jsx +16 -26
- package/src/@daf/pages/dashboards/AllInformation/Events/config.js +158 -6
- package/src/@daf/pages/dashboards/AllInformation/Events/create.jsx +2 -2
- package/src/@daf/pages/dashboards/AllInformation/Events/index.jsx +8 -0
- package/src/@daf/pages/dashboards/AllInformation/Locations/create.jsx +1 -1
- package/src/@daf/pages/dashboards/AllInformation/Locations/index.jsx +8 -0
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/create.jsx +1 -1
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/index.jsx +9 -1
- package/src/@daf/pages/dashboards/DueDilligence/Incidents/columns.js +221 -0
- package/src/@daf/pages/dashboards/DueDilligence/Incidents/config.js +166 -0
- package/src/@daf/pages/dashboards/DueDilligence/Incidents/create.jsx +104 -0
- package/src/@daf/pages/dashboards/DueDilligence/Incidents/index.jsx +157 -0
- package/src/@daf/pages/dashboards/DueDilligence/Incidents2/columns.js +176 -0
- package/src/@daf/pages/dashboards/DueDilligence/Incidents2/config.js +171 -0
- package/src/@daf/pages/dashboards/DueDilligence/Incidents2/create.jsx +104 -0
- package/src/@daf/pages/dashboards/DueDilligence/Incidents2/index.jsx +156 -0
- package/src/@daf/pages/dashboards/Operations/ProductionSites/columns.js +150 -0
- package/src/@daf/pages/dashboards/Operations/ProductionSites/config.js +165 -0
- package/src/@daf/pages/dashboards/Operations/ProductionSites/create.jsx +104 -0
- package/src/@daf/pages/dashboards/Operations/ProductionSites/index.jsx +155 -0
- package/src/@daf/services/LinkedSubjects.js +2 -2
- package/src/pages.js +3 -0
package/dist/pages/index.js
CHANGED
|
@@ -13547,7 +13547,7 @@ const getTabs = t => {
|
|
|
13547
13547
|
label: t("Events")
|
|
13548
13548
|
}];
|
|
13549
13549
|
};
|
|
13550
|
-
const getFiltersConfig$
|
|
13550
|
+
const getFiltersConfig$9 = (t, filters, locationCategories) => {
|
|
13551
13551
|
const value = filters.type ? {
|
|
13552
13552
|
value: filters.type
|
|
13553
13553
|
} : {};
|
|
@@ -13756,7 +13756,7 @@ function MineSites({
|
|
|
13756
13756
|
config: dataFetchConfig
|
|
13757
13757
|
});
|
|
13758
13758
|
const tabs = React.useMemo(() => getTabs(t), [t]);
|
|
13759
|
-
const filtersConfig = React.useMemo(() => getFiltersConfig$
|
|
13759
|
+
const filtersConfig = React.useMemo(() => getFiltersConfig$9(t, filters, locationCategories), [activeTab, filters, t, locationCategories]);
|
|
13760
13760
|
const onFilterChange = filters => {
|
|
13761
13761
|
setFilters(p => ({
|
|
13762
13762
|
...p,
|
|
@@ -16025,13 +16025,13 @@ function sourceAvatarConfig(items, user, applications) {
|
|
|
16025
16025
|
});
|
|
16026
16026
|
}
|
|
16027
16027
|
|
|
16028
|
-
const getLinkValue$
|
|
16028
|
+
const getLinkValue$5 = (value, linkingObject) => {
|
|
16029
16029
|
if (linkingObject && linkingObject?.[value]) {
|
|
16030
16030
|
return linkingObject?.[value]?.name;
|
|
16031
16031
|
}
|
|
16032
16032
|
return null;
|
|
16033
16033
|
};
|
|
16034
|
-
const getColumns$
|
|
16034
|
+
const getColumns$8 = ({
|
|
16035
16035
|
t,
|
|
16036
16036
|
goTo,
|
|
16037
16037
|
user,
|
|
@@ -16119,7 +16119,7 @@ const getColumns$6 = ({
|
|
|
16119
16119
|
className: "daf-default-cell"
|
|
16120
16120
|
});
|
|
16121
16121
|
}
|
|
16122
|
-
const region = getLinkValue$
|
|
16122
|
+
const region = getLinkValue$5(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
|
|
16123
16123
|
return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
16124
16124
|
title: region,
|
|
16125
16125
|
children: region
|
|
@@ -16136,7 +16136,7 @@ const getColumns$6 = ({
|
|
|
16136
16136
|
className: "daf-default-cell"
|
|
16137
16137
|
});
|
|
16138
16138
|
}
|
|
16139
|
-
const district = getLinkValue$
|
|
16139
|
+
const district = getLinkValue$5(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
|
|
16140
16140
|
return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
16141
16141
|
title: district,
|
|
16142
16142
|
children: district
|
|
@@ -16204,11 +16204,11 @@ const getColumns$6 = ({
|
|
|
16204
16204
|
}
|
|
16205
16205
|
}].filter(column => column.show !== false);
|
|
16206
16206
|
|
|
16207
|
-
const checkboxConfig$
|
|
16207
|
+
const checkboxConfig$8 = {
|
|
16208
16208
|
name: 'Name',
|
|
16209
16209
|
datastakeId: 'ID'
|
|
16210
16210
|
};
|
|
16211
|
-
const getFiltersConfig$
|
|
16211
|
+
const getFiltersConfig$8 = ({
|
|
16212
16212
|
t
|
|
16213
16213
|
}) => {
|
|
16214
16214
|
return {
|
|
@@ -16376,11 +16376,11 @@ const getFiltersConfig$6 = ({
|
|
|
16376
16376
|
}
|
|
16377
16377
|
};
|
|
16378
16378
|
};
|
|
16379
|
-
const filtersConfig$
|
|
16379
|
+
const filtersConfig$8 = {
|
|
16380
16380
|
name: '',
|
|
16381
16381
|
datastakeId: ''
|
|
16382
16382
|
};
|
|
16383
|
-
const getFilterOptions$
|
|
16383
|
+
const getFilterOptions$8 = (options, t) => {
|
|
16384
16384
|
const {
|
|
16385
16385
|
statusOptions = [],
|
|
16386
16386
|
categoryOptions = [],
|
|
@@ -30110,7 +30110,7 @@ function DynamicForm({
|
|
|
30110
30110
|
});
|
|
30111
30111
|
}
|
|
30112
30112
|
|
|
30113
|
-
const StakeholdersCreate$
|
|
30113
|
+
const StakeholdersCreate$6 = ({
|
|
30114
30114
|
namespace = "OPERATOR",
|
|
30115
30115
|
view = ['scoping', 'new'],
|
|
30116
30116
|
edit = false,
|
|
@@ -30245,7 +30245,7 @@ const OperatorsTable = ({
|
|
|
30245
30245
|
}) => {
|
|
30246
30246
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
30247
30247
|
const [activeTab, setActiveTab] = React.useState();
|
|
30248
|
-
const columns = React.useMemo(() => getColumns$
|
|
30248
|
+
const columns = React.useMemo(() => getColumns$8({
|
|
30249
30249
|
t,
|
|
30250
30250
|
goTo,
|
|
30251
30251
|
user,
|
|
@@ -30288,14 +30288,14 @@ const OperatorsTable = ({
|
|
|
30288
30288
|
}, 'operators');
|
|
30289
30289
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
30290
30290
|
const selectFiltersConfig = React.useMemo(() => {
|
|
30291
|
-
return getFiltersConfig$
|
|
30291
|
+
return getFiltersConfig$8({
|
|
30292
30292
|
t
|
|
30293
30293
|
});
|
|
30294
30294
|
}, [t]);
|
|
30295
30295
|
React.useEffect(() => {
|
|
30296
30296
|
setSelectOptions(prev => ({
|
|
30297
30297
|
...prev,
|
|
30298
|
-
...getFilterOptions$
|
|
30298
|
+
...getFilterOptions$8(options)
|
|
30299
30299
|
}));
|
|
30300
30300
|
}, [options, t]);
|
|
30301
30301
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -30311,13 +30311,13 @@ const OperatorsTable = ({
|
|
|
30311
30311
|
defaultActiveTab: "all",
|
|
30312
30312
|
columns: columns,
|
|
30313
30313
|
data: data,
|
|
30314
|
-
checkboxConfig: checkboxConfig$
|
|
30314
|
+
checkboxConfig: checkboxConfig$8,
|
|
30315
30315
|
APP: APP,
|
|
30316
30316
|
getApiBaseUrl: getApiBaseUrl,
|
|
30317
30317
|
selectOptions: selectOptions,
|
|
30318
30318
|
selectFiltersConfig: selectFiltersConfig,
|
|
30319
30319
|
getRedirectLink: getRedirectLink,
|
|
30320
|
-
filtersConfig: filtersConfig$
|
|
30320
|
+
filtersConfig: filtersConfig$8,
|
|
30321
30321
|
isMobile: isMobile,
|
|
30322
30322
|
view: "operators",
|
|
30323
30323
|
getActiveTab: handleActiveTabChange,
|
|
@@ -30327,7 +30327,7 @@ const OperatorsTable = ({
|
|
|
30327
30327
|
drawerTitle: t("Create Operator"),
|
|
30328
30328
|
children: ({
|
|
30329
30329
|
onDrawerClose
|
|
30330
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$
|
|
30330
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$6, {
|
|
30331
30331
|
defaultData: createDefaultValues,
|
|
30332
30332
|
t: t,
|
|
30333
30333
|
goTo: goTo,
|
|
@@ -30358,13 +30358,13 @@ const OperatorsTable = ({
|
|
|
30358
30358
|
});
|
|
30359
30359
|
};
|
|
30360
30360
|
|
|
30361
|
-
const getLinkValue$
|
|
30361
|
+
const getLinkValue$4 = (value, linkingObject) => {
|
|
30362
30362
|
if (linkingObject && linkingObject?.[value]) {
|
|
30363
30363
|
return linkingObject?.[value]?.name;
|
|
30364
30364
|
}
|
|
30365
30365
|
return null;
|
|
30366
30366
|
};
|
|
30367
|
-
const getColumns$
|
|
30367
|
+
const getColumns$7 = ({
|
|
30368
30368
|
t,
|
|
30369
30369
|
goTo,
|
|
30370
30370
|
user,
|
|
@@ -30452,7 +30452,7 @@ const getColumns$5 = ({
|
|
|
30452
30452
|
className: "daf-default-cell"
|
|
30453
30453
|
});
|
|
30454
30454
|
}
|
|
30455
|
-
const region = getLinkValue$
|
|
30455
|
+
const region = getLinkValue$4(v, all?.linking?.SCL);
|
|
30456
30456
|
return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30457
30457
|
title: region,
|
|
30458
30458
|
children: region
|
|
@@ -30469,7 +30469,7 @@ const getColumns$5 = ({
|
|
|
30469
30469
|
className: "daf-default-cell"
|
|
30470
30470
|
});
|
|
30471
30471
|
}
|
|
30472
|
-
const district = getLinkValue$
|
|
30472
|
+
const district = getLinkValue$4(v, all?.linking?.SCL);
|
|
30473
30473
|
return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30474
30474
|
title: district,
|
|
30475
30475
|
children: district
|
|
@@ -30537,11 +30537,11 @@ const getColumns$5 = ({
|
|
|
30537
30537
|
}
|
|
30538
30538
|
}].filter(column => column.show !== false);
|
|
30539
30539
|
|
|
30540
|
-
const checkboxConfig$
|
|
30540
|
+
const checkboxConfig$7 = {
|
|
30541
30541
|
name: 'Name',
|
|
30542
30542
|
datastakeId: 'ID'
|
|
30543
30543
|
};
|
|
30544
|
-
const getFiltersConfig$
|
|
30544
|
+
const getFiltersConfig$7 = ({
|
|
30545
30545
|
t
|
|
30546
30546
|
}) => {
|
|
30547
30547
|
return {
|
|
@@ -30559,11 +30559,11 @@ const getFiltersConfig$5 = ({
|
|
|
30559
30559
|
}
|
|
30560
30560
|
};
|
|
30561
30561
|
};
|
|
30562
|
-
const filtersConfig$
|
|
30562
|
+
const filtersConfig$7 = {
|
|
30563
30563
|
name: '',
|
|
30564
30564
|
datastakeId: ''
|
|
30565
30565
|
};
|
|
30566
|
-
const getFilterOptions$
|
|
30566
|
+
const getFilterOptions$7 = (options, t) => {
|
|
30567
30567
|
const {
|
|
30568
30568
|
countries
|
|
30569
30569
|
} = options || {};
|
|
@@ -30573,7 +30573,7 @@ const getFilterOptions$5 = (options, t) => {
|
|
|
30573
30573
|
return _default;
|
|
30574
30574
|
};
|
|
30575
30575
|
|
|
30576
|
-
const StakeholdersCreate$
|
|
30576
|
+
const StakeholdersCreate$5 = ({
|
|
30577
30577
|
namespace = 'locations',
|
|
30578
30578
|
view = 'scoping',
|
|
30579
30579
|
edit = false,
|
|
@@ -30612,7 +30612,7 @@ const StakeholdersCreate$3 = ({
|
|
|
30612
30612
|
namespace,
|
|
30613
30613
|
module: APP,
|
|
30614
30614
|
view,
|
|
30615
|
-
scope: '
|
|
30615
|
+
scope: 'create'
|
|
30616
30616
|
});
|
|
30617
30617
|
} else {
|
|
30618
30618
|
form = formConfig;
|
|
@@ -30699,11 +30699,12 @@ const LocationsTable = ({
|
|
|
30699
30699
|
formData = {},
|
|
30700
30700
|
formValue = {},
|
|
30701
30701
|
form = {},
|
|
30702
|
-
applications = []
|
|
30702
|
+
applications = [],
|
|
30703
|
+
subjectClear = () => {}
|
|
30703
30704
|
}) => {
|
|
30704
30705
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
30705
30706
|
const [activeTab, setActiveTab] = React.useState();
|
|
30706
|
-
const columns = React.useMemo(() => getColumns$
|
|
30707
|
+
const columns = React.useMemo(() => getColumns$7({
|
|
30707
30708
|
t,
|
|
30708
30709
|
goTo,
|
|
30709
30710
|
user,
|
|
@@ -30739,19 +30740,22 @@ const LocationsTable = ({
|
|
|
30739
30740
|
data
|
|
30740
30741
|
});
|
|
30741
30742
|
const selectFiltersConfig = React.useMemo(() => {
|
|
30742
|
-
return getFiltersConfig$
|
|
30743
|
+
return getFiltersConfig$7({
|
|
30743
30744
|
t
|
|
30744
30745
|
});
|
|
30745
30746
|
}, [t]);
|
|
30746
30747
|
React.useEffect(() => {
|
|
30747
30748
|
setSelectOptions(prev => ({
|
|
30748
30749
|
...prev,
|
|
30749
|
-
...getFilterOptions$
|
|
30750
|
+
...getFilterOptions$7(options)
|
|
30750
30751
|
}));
|
|
30751
30752
|
}, [options, t]);
|
|
30752
30753
|
const handleActiveTabChange = React.useCallback(value => {
|
|
30753
30754
|
setActiveTab(value);
|
|
30754
30755
|
}, []);
|
|
30756
|
+
React.useEffect(() => () => {
|
|
30757
|
+
subjectClear();
|
|
30758
|
+
}, []);
|
|
30755
30759
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
30756
30760
|
t: t,
|
|
30757
30761
|
title: t("Locations"),
|
|
@@ -30762,13 +30766,13 @@ const LocationsTable = ({
|
|
|
30762
30766
|
defaultActiveTab: "all",
|
|
30763
30767
|
columns: columns,
|
|
30764
30768
|
data: data,
|
|
30765
|
-
checkboxConfig: checkboxConfig$
|
|
30769
|
+
checkboxConfig: checkboxConfig$7,
|
|
30766
30770
|
APP: APP,
|
|
30767
30771
|
getApiBaseUrl: getApiBaseUrl,
|
|
30768
30772
|
selectOptions: selectOptions,
|
|
30769
30773
|
selectFiltersConfig: selectFiltersConfig,
|
|
30770
30774
|
getRedirectLink: getRedirectLink,
|
|
30771
|
-
filtersConfig: filtersConfig$
|
|
30775
|
+
filtersConfig: filtersConfig$7,
|
|
30772
30776
|
isMobile: isMobile,
|
|
30773
30777
|
view: "locations",
|
|
30774
30778
|
getActiveTab: handleActiveTabChange,
|
|
@@ -30778,7 +30782,7 @@ const LocationsTable = ({
|
|
|
30778
30782
|
drawerTitle: t("Create Location"),
|
|
30779
30783
|
children: ({
|
|
30780
30784
|
onDrawerClose
|
|
30781
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$
|
|
30785
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$5, {
|
|
30782
30786
|
t: t,
|
|
30783
30787
|
goTo: goTo,
|
|
30784
30788
|
user: user,
|
|
@@ -30807,7 +30811,7 @@ const LocationsTable = ({
|
|
|
30807
30811
|
});
|
|
30808
30812
|
};
|
|
30809
30813
|
|
|
30810
|
-
const getColumns$
|
|
30814
|
+
const getColumns$6 = ({
|
|
30811
30815
|
t,
|
|
30812
30816
|
goTo,
|
|
30813
30817
|
user,
|
|
@@ -30965,11 +30969,11 @@ const getColumns$4 = ({
|
|
|
30965
30969
|
}
|
|
30966
30970
|
}].filter(column => column.show !== false);
|
|
30967
30971
|
|
|
30968
|
-
const checkboxConfig$
|
|
30972
|
+
const checkboxConfig$6 = {
|
|
30969
30973
|
name: 'Name',
|
|
30970
30974
|
datastakeId: 'ID'
|
|
30971
30975
|
};
|
|
30972
|
-
const getFiltersConfig$
|
|
30976
|
+
const getFiltersConfig$6 = ({
|
|
30973
30977
|
t
|
|
30974
30978
|
}) => {
|
|
30975
30979
|
return {
|
|
@@ -30987,11 +30991,11 @@ const getFiltersConfig$4 = ({
|
|
|
30987
30991
|
}
|
|
30988
30992
|
};
|
|
30989
30993
|
};
|
|
30990
|
-
const filtersConfig$
|
|
30994
|
+
const filtersConfig$6 = {
|
|
30991
30995
|
name: '',
|
|
30992
30996
|
datastakeId: ''
|
|
30993
30997
|
};
|
|
30994
|
-
const getFilterOptions$
|
|
30998
|
+
const getFilterOptions$6 = (options, t) => {
|
|
30995
30999
|
const {
|
|
30996
31000
|
countries
|
|
30997
31001
|
} = options || {};
|
|
@@ -31001,7 +31005,7 @@ const getFilterOptions$4 = (options, t) => {
|
|
|
31001
31005
|
return _default;
|
|
31002
31006
|
};
|
|
31003
31007
|
|
|
31004
|
-
const StakeholdersCreate$
|
|
31008
|
+
const StakeholdersCreate$4 = ({
|
|
31005
31009
|
namespace = 'stakeholders',
|
|
31006
31010
|
view = 'scoping',
|
|
31007
31011
|
edit = false,
|
|
@@ -31040,7 +31044,7 @@ const StakeholdersCreate$2 = ({
|
|
|
31040
31044
|
namespace,
|
|
31041
31045
|
module: APP,
|
|
31042
31046
|
view,
|
|
31043
|
-
scope: '
|
|
31047
|
+
scope: 'create'
|
|
31044
31048
|
});
|
|
31045
31049
|
} else {
|
|
31046
31050
|
form = formConfig;
|
|
@@ -31127,11 +31131,12 @@ const StakeholdersTable = ({
|
|
|
31127
31131
|
formData = {},
|
|
31128
31132
|
formValue = {},
|
|
31129
31133
|
form = {},
|
|
31130
|
-
applications = []
|
|
31134
|
+
applications = [],
|
|
31135
|
+
subjectClear = () => {}
|
|
31131
31136
|
}) => {
|
|
31132
31137
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
31133
31138
|
const [activeTab, setActiveTab] = React.useState();
|
|
31134
|
-
const columns = React.useMemo(() => getColumns$
|
|
31139
|
+
const columns = React.useMemo(() => getColumns$6({
|
|
31135
31140
|
t,
|
|
31136
31141
|
goTo,
|
|
31137
31142
|
user,
|
|
@@ -31163,19 +31168,22 @@ const StakeholdersTable = ({
|
|
|
31163
31168
|
}, 'stakeholders');
|
|
31164
31169
|
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
31165
31170
|
const selectFiltersConfig = React.useMemo(() => {
|
|
31166
|
-
return getFiltersConfig$
|
|
31171
|
+
return getFiltersConfig$6({
|
|
31167
31172
|
t
|
|
31168
31173
|
});
|
|
31169
31174
|
}, [t]);
|
|
31170
31175
|
React.useEffect(() => {
|
|
31171
31176
|
setSelectOptions(prev => ({
|
|
31172
31177
|
...prev,
|
|
31173
|
-
...getFilterOptions$
|
|
31178
|
+
...getFilterOptions$6(options)
|
|
31174
31179
|
}));
|
|
31175
31180
|
}, [options, t]);
|
|
31176
31181
|
const handleActiveTabChange = React.useCallback(value => {
|
|
31177
31182
|
setActiveTab(value);
|
|
31178
31183
|
}, []);
|
|
31184
|
+
React.useEffect(() => () => {
|
|
31185
|
+
subjectClear();
|
|
31186
|
+
}, []);
|
|
31179
31187
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
31180
31188
|
t: t,
|
|
31181
31189
|
title: t("Stakeholders"),
|
|
@@ -31186,13 +31194,13 @@ const StakeholdersTable = ({
|
|
|
31186
31194
|
defaultActiveTab: "all",
|
|
31187
31195
|
columns: columns,
|
|
31188
31196
|
data: data,
|
|
31189
|
-
checkboxConfig: checkboxConfig$
|
|
31197
|
+
checkboxConfig: checkboxConfig$6,
|
|
31190
31198
|
APP: APP,
|
|
31191
31199
|
getApiBaseUrl: getApiBaseUrl,
|
|
31192
31200
|
selectOptions: selectOptions,
|
|
31193
31201
|
selectFiltersConfig: selectFiltersConfig,
|
|
31194
31202
|
getRedirectLink: getRedirectLink,
|
|
31195
|
-
filtersConfig: filtersConfig$
|
|
31203
|
+
filtersConfig: filtersConfig$6,
|
|
31196
31204
|
isMobile: isMobile,
|
|
31197
31205
|
view: "stakeholders",
|
|
31198
31206
|
getActiveTab: handleActiveTabChange,
|
|
@@ -31202,7 +31210,7 @@ const StakeholdersTable = ({
|
|
|
31202
31210
|
drawerTitle: t("Create Stakeholder"),
|
|
31203
31211
|
children: ({
|
|
31204
31212
|
onDrawerClose
|
|
31205
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$
|
|
31213
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$4, {
|
|
31206
31214
|
t: t,
|
|
31207
31215
|
goTo: goTo,
|
|
31208
31216
|
user: user,
|
|
@@ -31215,7 +31223,7 @@ const StakeholdersTable = ({
|
|
|
31215
31223
|
onSubmitted: (type, m, data) => {
|
|
31216
31224
|
if (data.datastakeId) {
|
|
31217
31225
|
displayMessage(type, t("affirmations::subject-created-successfully") || m);
|
|
31218
|
-
goTo(`/app/stakeholders`);
|
|
31226
|
+
goTo(`/app/edit/stakeholders/${data.datastakeId}`);
|
|
31219
31227
|
}
|
|
31220
31228
|
},
|
|
31221
31229
|
onCancel: onDrawerClose,
|
|
@@ -31231,13 +31239,13 @@ const StakeholdersTable = ({
|
|
|
31231
31239
|
});
|
|
31232
31240
|
};
|
|
31233
31241
|
|
|
31234
|
-
const getLinkValue$
|
|
31242
|
+
const getLinkValue$3 = (value, linkingObject) => {
|
|
31235
31243
|
if (linkingObject && linkingObject?.[value]) {
|
|
31236
31244
|
return linkingObject?.[value]?.name;
|
|
31237
31245
|
}
|
|
31238
31246
|
return null;
|
|
31239
31247
|
};
|
|
31240
|
-
const getColumns$
|
|
31248
|
+
const getColumns$5 = ({
|
|
31241
31249
|
t,
|
|
31242
31250
|
goTo,
|
|
31243
31251
|
user,
|
|
@@ -31325,7 +31333,7 @@ const getColumns$3 = ({
|
|
|
31325
31333
|
className: "daf-default-cell"
|
|
31326
31334
|
});
|
|
31327
31335
|
}
|
|
31328
|
-
const scope = getLinkValue$
|
|
31336
|
+
const scope = getLinkValue$3(v, all?.linking?.SCL);
|
|
31329
31337
|
return scope ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
31330
31338
|
title: scope,
|
|
31331
31339
|
children: scope
|
|
@@ -31411,17 +31419,187 @@ const getColumns$3 = ({
|
|
|
31411
31419
|
}
|
|
31412
31420
|
}].filter(column => column.show !== false);
|
|
31413
31421
|
|
|
31414
|
-
const checkboxConfig$
|
|
31422
|
+
const checkboxConfig$5 = {
|
|
31415
31423
|
name: 'Name',
|
|
31416
31424
|
datastakeId: 'ID'
|
|
31417
31425
|
};
|
|
31418
|
-
const getFiltersConfig$
|
|
31426
|
+
const getFiltersConfig$5 = ({
|
|
31419
31427
|
t
|
|
31420
31428
|
}) => {
|
|
31421
31429
|
return {
|
|
31430
|
+
timeframe: {
|
|
31431
|
+
type: "timeframe",
|
|
31432
|
+
label: "Timeframe",
|
|
31433
|
+
style: {
|
|
31434
|
+
flex: 1
|
|
31435
|
+
}
|
|
31436
|
+
},
|
|
31422
31437
|
country: {
|
|
31423
31438
|
type: 'select',
|
|
31424
|
-
|
|
31439
|
+
label: 'Country',
|
|
31440
|
+
placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
31441
|
+
style: {
|
|
31442
|
+
flex: 1
|
|
31443
|
+
},
|
|
31444
|
+
labelStyle: {
|
|
31445
|
+
flex: 1
|
|
31446
|
+
},
|
|
31447
|
+
getLabel: option => option.label,
|
|
31448
|
+
getValue: option => option.value
|
|
31449
|
+
},
|
|
31450
|
+
administrativeLevel1: {
|
|
31451
|
+
type: 'ajaxSelect',
|
|
31452
|
+
label: ({
|
|
31453
|
+
t = s => s,
|
|
31454
|
+
options = {},
|
|
31455
|
+
filters = {},
|
|
31456
|
+
language = 'en'
|
|
31457
|
+
}) => {
|
|
31458
|
+
const {
|
|
31459
|
+
administrativeLevel1
|
|
31460
|
+
} = options;
|
|
31461
|
+
if (administrativeLevel1) {
|
|
31462
|
+
if (options.country) {
|
|
31463
|
+
const _item = administrativeLevel1[filters.country];
|
|
31464
|
+
if (_item) {
|
|
31465
|
+
if (_item[language]) {
|
|
31466
|
+
return _item[language];
|
|
31467
|
+
}
|
|
31468
|
+
}
|
|
31469
|
+
}
|
|
31470
|
+
}
|
|
31471
|
+
return t('Province');
|
|
31472
|
+
},
|
|
31473
|
+
placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
|
|
31474
|
+
filters: data => ({
|
|
31475
|
+
country: data.country,
|
|
31476
|
+
level: 'level_1'
|
|
31477
|
+
}),
|
|
31478
|
+
show: data => !data.country,
|
|
31479
|
+
disabled: data => !data.country,
|
|
31480
|
+
mapper: {
|
|
31481
|
+
label: "name",
|
|
31482
|
+
value: "id"
|
|
31483
|
+
},
|
|
31484
|
+
method: 'getOptions',
|
|
31485
|
+
entity: 'AdministrativeLevel',
|
|
31486
|
+
style: {
|
|
31487
|
+
flex: 1
|
|
31488
|
+
},
|
|
31489
|
+
labelStyle: {
|
|
31490
|
+
flex: 1
|
|
31491
|
+
}
|
|
31492
|
+
},
|
|
31493
|
+
administrativeLevel2: {
|
|
31494
|
+
type: 'ajaxSelect',
|
|
31495
|
+
label: ({
|
|
31496
|
+
t = s => s,
|
|
31497
|
+
options = {},
|
|
31498
|
+
filters = {},
|
|
31499
|
+
language = 'en'
|
|
31500
|
+
}) => {
|
|
31501
|
+
const {
|
|
31502
|
+
administrativeLevel2
|
|
31503
|
+
} = options;
|
|
31504
|
+
if (administrativeLevel2) {
|
|
31505
|
+
if (options.country) {
|
|
31506
|
+
const _item = administrativeLevel2[filters.country];
|
|
31507
|
+
if (_item) {
|
|
31508
|
+
if (_item[language]) {
|
|
31509
|
+
return _item[language];
|
|
31510
|
+
}
|
|
31511
|
+
}
|
|
31512
|
+
}
|
|
31513
|
+
}
|
|
31514
|
+
return t('Province');
|
|
31515
|
+
},
|
|
31516
|
+
show: data => !(data.country && data.administrativeLevel1),
|
|
31517
|
+
placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
|
|
31518
|
+
filters: data => ({
|
|
31519
|
+
country: data.country,
|
|
31520
|
+
level: 'level_2',
|
|
31521
|
+
administrativeLevel1: data.administrativeLevel1
|
|
31522
|
+
}),
|
|
31523
|
+
disabled: data => !(data.country && data.administrativeLevel1),
|
|
31524
|
+
mapper: {
|
|
31525
|
+
label: "name",
|
|
31526
|
+
value: "id"
|
|
31527
|
+
},
|
|
31528
|
+
method: 'getOptions',
|
|
31529
|
+
entity: 'AdministrativeLevel',
|
|
31530
|
+
style: {
|
|
31531
|
+
flex: 1
|
|
31532
|
+
},
|
|
31533
|
+
labelStyle: {
|
|
31534
|
+
flex: 1
|
|
31535
|
+
}
|
|
31536
|
+
},
|
|
31537
|
+
subCategory: {
|
|
31538
|
+
type: 'select',
|
|
31539
|
+
label: 'Category',
|
|
31540
|
+
placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
31541
|
+
style: {
|
|
31542
|
+
flex: 1
|
|
31543
|
+
},
|
|
31544
|
+
labelStyle: {
|
|
31545
|
+
flex: 1
|
|
31546
|
+
},
|
|
31547
|
+
getLabel: option => option.label,
|
|
31548
|
+
getValue: option => option.value,
|
|
31549
|
+
filterOptions: val => {
|
|
31550
|
+
if (val) {
|
|
31551
|
+
const {
|
|
31552
|
+
option,
|
|
31553
|
+
filters
|
|
31554
|
+
} = val;
|
|
31555
|
+
if (filters && option) {
|
|
31556
|
+
const {
|
|
31557
|
+
filters: optionFilters
|
|
31558
|
+
} = option;
|
|
31559
|
+
if (Array.isArray(optionFilters) && optionFilters.length) {
|
|
31560
|
+
const {
|
|
31561
|
+
value,
|
|
31562
|
+
condition
|
|
31563
|
+
} = optionFilters[0];
|
|
31564
|
+
if (condition === 'includes') {
|
|
31565
|
+
return value.includes('corporation');
|
|
31566
|
+
}
|
|
31567
|
+
}
|
|
31568
|
+
}
|
|
31569
|
+
}
|
|
31570
|
+
return true;
|
|
31571
|
+
}
|
|
31572
|
+
},
|
|
31573
|
+
positionInTheMineralSupplyChain: {
|
|
31574
|
+
type: 'select',
|
|
31575
|
+
label: 'Position',
|
|
31576
|
+
placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
|
|
31577
|
+
style: {
|
|
31578
|
+
flex: 1
|
|
31579
|
+
},
|
|
31580
|
+
labelStyle: {
|
|
31581
|
+
flex: 1
|
|
31582
|
+
},
|
|
31583
|
+
getLabel: option => option.label,
|
|
31584
|
+
getValue: option => option.value
|
|
31585
|
+
},
|
|
31586
|
+
status: {
|
|
31587
|
+
type: "select",
|
|
31588
|
+
label: "Status",
|
|
31589
|
+
placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
31590
|
+
style: {
|
|
31591
|
+
flex: 1
|
|
31592
|
+
},
|
|
31593
|
+
labelStyle: {
|
|
31594
|
+
fley: 1
|
|
31595
|
+
},
|
|
31596
|
+
getLabel: option => option.label,
|
|
31597
|
+
getValue: option => option.value
|
|
31598
|
+
},
|
|
31599
|
+
category: {
|
|
31600
|
+
type: 'select',
|
|
31601
|
+
label: 'Category',
|
|
31602
|
+
placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
31425
31603
|
style: {
|
|
31426
31604
|
flex: 1
|
|
31427
31605
|
},
|
|
@@ -31433,27 +31611,53 @@ const getFiltersConfig$3 = ({
|
|
|
31433
31611
|
}
|
|
31434
31612
|
};
|
|
31435
31613
|
};
|
|
31436
|
-
const filtersConfig$
|
|
31614
|
+
const filtersConfig$5 = {
|
|
31437
31615
|
name: '',
|
|
31438
31616
|
datastakeId: ''
|
|
31439
31617
|
};
|
|
31440
|
-
const getFilterOptions$
|
|
31618
|
+
const getFilterOptions$5 = (options, t) => {
|
|
31441
31619
|
const {
|
|
31442
|
-
|
|
31620
|
+
timeframe = [],
|
|
31621
|
+
statusOptions = [],
|
|
31622
|
+
categoryOptions = [],
|
|
31623
|
+
countries = [],
|
|
31624
|
+
subCategory = [],
|
|
31625
|
+
subCategoriesOptions,
|
|
31626
|
+
stakeholderCategoryOptions,
|
|
31627
|
+
stakeholderSubCategoriesOptions,
|
|
31628
|
+
administrativeLevel1,
|
|
31629
|
+
administrativeLevel2,
|
|
31630
|
+
category = []
|
|
31443
31631
|
} = options || {};
|
|
31632
|
+
console.log({
|
|
31633
|
+
options
|
|
31634
|
+
});
|
|
31444
31635
|
const _default = {
|
|
31445
|
-
|
|
31446
|
-
|
|
31447
|
-
|
|
31448
|
-
|
|
31449
|
-
|
|
31450
|
-
|
|
31451
|
-
|
|
31452
|
-
|
|
31453
|
-
|
|
31454
|
-
|
|
31455
|
-
|
|
31456
|
-
|
|
31636
|
+
timeframe: timeframe,
|
|
31637
|
+
country: countries,
|
|
31638
|
+
category: stakeholderCategoryOptions || categoryOptions,
|
|
31639
|
+
administrativeLevel1,
|
|
31640
|
+
administrativeLevel2,
|
|
31641
|
+
// subCategory: subCategoriesOptions,
|
|
31642
|
+
category: category,
|
|
31643
|
+
status: [{
|
|
31644
|
+
value: "submitted",
|
|
31645
|
+
label: "Submitted"
|
|
31646
|
+
}, {
|
|
31647
|
+
value: "private",
|
|
31648
|
+
label: "Private"
|
|
31649
|
+
}]
|
|
31650
|
+
};
|
|
31651
|
+
return _default;
|
|
31652
|
+
};
|
|
31653
|
+
|
|
31654
|
+
const EventsCreate = ({
|
|
31655
|
+
namespace = 'event',
|
|
31656
|
+
view = 'scoping',
|
|
31657
|
+
edit = false,
|
|
31658
|
+
formData = {},
|
|
31659
|
+
loading = false,
|
|
31660
|
+
onSubmitted = () => {},
|
|
31457
31661
|
onCancel = () => {},
|
|
31458
31662
|
getData = () => {},
|
|
31459
31663
|
saveData = () => {},
|
|
@@ -31486,7 +31690,7 @@ const EventsCreate = ({
|
|
|
31486
31690
|
namespace,
|
|
31487
31691
|
module: APP,
|
|
31488
31692
|
view,
|
|
31489
|
-
scope: '
|
|
31693
|
+
scope: 'create'
|
|
31490
31694
|
});
|
|
31491
31695
|
} else {
|
|
31492
31696
|
form = formConfig;
|
|
@@ -31574,11 +31778,12 @@ const EventsTable = ({
|
|
|
31574
31778
|
formValue = {},
|
|
31575
31779
|
form = {},
|
|
31576
31780
|
extendingFilters = {},
|
|
31577
|
-
applications = []
|
|
31781
|
+
applications = [],
|
|
31782
|
+
subjectClear = () => {}
|
|
31578
31783
|
}) => {
|
|
31579
31784
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
31580
31785
|
const [activeTab, setActiveTab] = React.useState();
|
|
31581
|
-
const columns = React.useMemo(() => getColumns$
|
|
31786
|
+
const columns = React.useMemo(() => getColumns$5({
|
|
31582
31787
|
t,
|
|
31583
31788
|
goTo,
|
|
31584
31789
|
user,
|
|
@@ -31627,19 +31832,22 @@ const EventsTable = ({
|
|
|
31627
31832
|
data
|
|
31628
31833
|
});
|
|
31629
31834
|
const selectFiltersConfig = React.useMemo(() => {
|
|
31630
|
-
return getFiltersConfig$
|
|
31835
|
+
return getFiltersConfig$5({
|
|
31631
31836
|
t
|
|
31632
31837
|
});
|
|
31633
31838
|
}, [t]);
|
|
31634
31839
|
React.useEffect(() => {
|
|
31635
31840
|
setSelectOptions(prev => ({
|
|
31636
31841
|
...prev,
|
|
31637
|
-
...getFilterOptions$
|
|
31842
|
+
...getFilterOptions$5(options)
|
|
31638
31843
|
}));
|
|
31639
31844
|
}, [options, t]);
|
|
31640
31845
|
const handleActiveTabChange = React.useCallback(value => {
|
|
31641
31846
|
setActiveTab(value);
|
|
31642
31847
|
}, []);
|
|
31848
|
+
React.useEffect(() => () => {
|
|
31849
|
+
subjectClear();
|
|
31850
|
+
}, []);
|
|
31643
31851
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
31644
31852
|
t: t,
|
|
31645
31853
|
title: t("events"),
|
|
@@ -31650,13 +31858,13 @@ const EventsTable = ({
|
|
|
31650
31858
|
defaultActiveTab: "all",
|
|
31651
31859
|
columns: columns,
|
|
31652
31860
|
data: data,
|
|
31653
|
-
checkboxConfig: checkboxConfig$
|
|
31861
|
+
checkboxConfig: checkboxConfig$5,
|
|
31654
31862
|
APP: APP,
|
|
31655
31863
|
getApiBaseUrl: getApiBaseUrl,
|
|
31656
31864
|
selectOptions: selectOptions,
|
|
31657
31865
|
selectFiltersConfig: selectFiltersConfig,
|
|
31658
31866
|
getRedirectLink: getRedirectLink,
|
|
31659
|
-
filtersConfig: filtersConfig$
|
|
31867
|
+
filtersConfig: filtersConfig$5,
|
|
31660
31868
|
isMobile: isMobile,
|
|
31661
31869
|
view: "events",
|
|
31662
31870
|
getActiveTab: handleActiveTabChange,
|
|
@@ -31696,7 +31904,7 @@ const EventsTable = ({
|
|
|
31696
31904
|
});
|
|
31697
31905
|
};
|
|
31698
31906
|
|
|
31699
|
-
const getColumns$
|
|
31907
|
+
const getColumns$4 = ({
|
|
31700
31908
|
t,
|
|
31701
31909
|
goTo,
|
|
31702
31910
|
user,
|
|
@@ -31705,7 +31913,6 @@ const getColumns$2 = ({
|
|
|
31705
31913
|
getRedirectLink,
|
|
31706
31914
|
theme,
|
|
31707
31915
|
subject,
|
|
31708
|
-
data,
|
|
31709
31916
|
applications
|
|
31710
31917
|
}) => [{
|
|
31711
31918
|
dataIndex: 'datastakeId',
|
|
@@ -31724,8 +31931,8 @@ const getColumns$2 = ({
|
|
|
31724
31931
|
});
|
|
31725
31932
|
}
|
|
31726
31933
|
}, {
|
|
31727
|
-
dataIndex: '
|
|
31728
|
-
title: t('
|
|
31934
|
+
dataIndex: 'name',
|
|
31935
|
+
title: t('Name'),
|
|
31729
31936
|
ellipsis: true,
|
|
31730
31937
|
show: true,
|
|
31731
31938
|
render: (v, all) => {
|
|
@@ -31740,8 +31947,8 @@ const getColumns$2 = ({
|
|
|
31740
31947
|
});
|
|
31741
31948
|
}
|
|
31742
31949
|
}, {
|
|
31743
|
-
dataIndex: '
|
|
31744
|
-
title: t('
|
|
31950
|
+
dataIndex: 'category',
|
|
31951
|
+
title: t('Category'),
|
|
31745
31952
|
ellipsis: true,
|
|
31746
31953
|
show: true,
|
|
31747
31954
|
render: (v, all) => {
|
|
@@ -31750,10 +31957,44 @@ const getColumns$2 = ({
|
|
|
31750
31957
|
className: "daf-default-cell"
|
|
31751
31958
|
});
|
|
31752
31959
|
}
|
|
31753
|
-
const
|
|
31754
|
-
return
|
|
31755
|
-
title:
|
|
31756
|
-
children:
|
|
31960
|
+
const category = findOptions(v, options?.categoriesOptions);
|
|
31961
|
+
return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
31962
|
+
title: category,
|
|
31963
|
+
children: category
|
|
31964
|
+
}) : '-';
|
|
31965
|
+
}
|
|
31966
|
+
}, {
|
|
31967
|
+
dataIndex: 'subCategory',
|
|
31968
|
+
title: t('Sub Category'),
|
|
31969
|
+
ellipsis: true,
|
|
31970
|
+
show: true,
|
|
31971
|
+
render: (v, all) => {
|
|
31972
|
+
if (all.empty) {
|
|
31973
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31974
|
+
className: "daf-default-cell"
|
|
31975
|
+
});
|
|
31976
|
+
}
|
|
31977
|
+
const subCategory = findOptions(v, options?.subCategoriesOptions);
|
|
31978
|
+
return subCategory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
31979
|
+
title: subCategory,
|
|
31980
|
+
children: subCategory
|
|
31981
|
+
}) : '-';
|
|
31982
|
+
}
|
|
31983
|
+
}, {
|
|
31984
|
+
dataIndex: 'country',
|
|
31985
|
+
title: t('Country'),
|
|
31986
|
+
ellipsis: true,
|
|
31987
|
+
show: true,
|
|
31988
|
+
render: (v, all) => {
|
|
31989
|
+
if (all.empty) {
|
|
31990
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31991
|
+
className: "daf-default-cell"
|
|
31992
|
+
});
|
|
31993
|
+
}
|
|
31994
|
+
const country = findOptions(v, options?.countries);
|
|
31995
|
+
return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
31996
|
+
title: country,
|
|
31997
|
+
children: country
|
|
31757
31998
|
}) : '-';
|
|
31758
31999
|
}
|
|
31759
32000
|
}, {
|
|
@@ -31785,6 +32026,9 @@ const getColumns$2 = ({
|
|
|
31785
32026
|
className: "daf-default-cell"
|
|
31786
32027
|
});
|
|
31787
32028
|
}
|
|
32029
|
+
if (!val || val?.length === 0) {
|
|
32030
|
+
return "--";
|
|
32031
|
+
}
|
|
31788
32032
|
const sources = sourceAvatarConfig(val, user, applications);
|
|
31789
32033
|
return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
|
|
31790
32034
|
items: sources
|
|
@@ -31818,11 +32062,11 @@ const getColumns$2 = ({
|
|
|
31818
32062
|
}
|
|
31819
32063
|
}].filter(column => column.show !== false);
|
|
31820
32064
|
|
|
31821
|
-
const checkboxConfig$
|
|
32065
|
+
const checkboxConfig$4 = {
|
|
31822
32066
|
name: 'Name',
|
|
31823
32067
|
datastakeId: 'ID'
|
|
31824
32068
|
};
|
|
31825
|
-
const getFiltersConfig$
|
|
32069
|
+
const getFiltersConfig$4 = ({
|
|
31826
32070
|
t
|
|
31827
32071
|
}) => {
|
|
31828
32072
|
return {
|
|
@@ -31840,11 +32084,11 @@ const getFiltersConfig$2 = ({
|
|
|
31840
32084
|
}
|
|
31841
32085
|
};
|
|
31842
32086
|
};
|
|
31843
|
-
const filtersConfig$
|
|
32087
|
+
const filtersConfig$4 = {
|
|
31844
32088
|
name: '',
|
|
31845
32089
|
datastakeId: ''
|
|
31846
32090
|
};
|
|
31847
|
-
const getFilterOptions$
|
|
32091
|
+
const getFilterOptions$4 = (options, t) => {
|
|
31848
32092
|
const {
|
|
31849
32093
|
countries
|
|
31850
32094
|
} = options || {};
|
|
@@ -31854,8 +32098,8 @@ const getFilterOptions$2 = (options, t) => {
|
|
|
31854
32098
|
return _default;
|
|
31855
32099
|
};
|
|
31856
32100
|
|
|
31857
|
-
const
|
|
31858
|
-
namespace = '
|
|
32101
|
+
const StakeholdersCreate$3 = ({
|
|
32102
|
+
namespace = 'stakeholders',
|
|
31859
32103
|
view = 'scoping',
|
|
31860
32104
|
edit = false,
|
|
31861
32105
|
formData = {},
|
|
@@ -31893,7 +32137,7 @@ const DocumentsCreate = ({
|
|
|
31893
32137
|
namespace,
|
|
31894
32138
|
module: APP,
|
|
31895
32139
|
view,
|
|
31896
|
-
scope: '
|
|
32140
|
+
scope: 'create'
|
|
31897
32141
|
});
|
|
31898
32142
|
} else {
|
|
31899
32143
|
form = formConfig;
|
|
@@ -31980,12 +32224,12 @@ const DocumentsTable = ({
|
|
|
31980
32224
|
formData = {},
|
|
31981
32225
|
formValue = {},
|
|
31982
32226
|
form = {},
|
|
31983
|
-
|
|
31984
|
-
|
|
32227
|
+
applications = [],
|
|
32228
|
+
subjectClear = () => {}
|
|
31985
32229
|
}) => {
|
|
31986
32230
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
31987
32231
|
const [activeTab, setActiveTab] = React.useState();
|
|
31988
|
-
const columns = React.useMemo(() => getColumns$
|
|
32232
|
+
const columns = React.useMemo(() => getColumns$4({
|
|
31989
32233
|
t,
|
|
31990
32234
|
goTo,
|
|
31991
32235
|
user,
|
|
@@ -31994,62 +32238,48 @@ const DocumentsTable = ({
|
|
|
31994
32238
|
getRedirectLink,
|
|
31995
32239
|
theme,
|
|
31996
32240
|
subject: 'documents',
|
|
31997
|
-
data,
|
|
31998
32241
|
applications
|
|
31999
|
-
}), [t, goTo, user, options, activeTab, getRedirectLink, theme,
|
|
32242
|
+
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
|
|
32000
32243
|
const breadCrumbs = [];
|
|
32001
32244
|
const {
|
|
32002
32245
|
paginationQuery,
|
|
32003
32246
|
searchParams,
|
|
32004
|
-
otherParams
|
|
32005
|
-
sortBy,
|
|
32006
|
-
sortDir
|
|
32247
|
+
otherParams
|
|
32007
32248
|
} = useGetQueryParams({
|
|
32008
32249
|
location
|
|
32009
32250
|
});
|
|
32010
|
-
const filters = React.useMemo(() => {
|
|
32011
|
-
return {
|
|
32012
|
-
...otherParams,
|
|
32013
|
-
...extendingFilters
|
|
32014
|
-
};
|
|
32015
|
-
}, [otherParams, extendingFilters]);
|
|
32016
32251
|
React.useEffect(() => {
|
|
32017
|
-
console.log("fetching data");
|
|
32018
32252
|
getData({
|
|
32019
32253
|
pagination: paginationQuery,
|
|
32020
|
-
...(Object.keys(
|
|
32021
|
-
filters:
|
|
32254
|
+
...(Object.keys(otherParams).length > 0 && {
|
|
32255
|
+
filters: otherParams
|
|
32022
32256
|
}),
|
|
32023
32257
|
...(Object.keys(searchParams).length > 0 && {
|
|
32024
32258
|
search: searchParams
|
|
32025
32259
|
}),
|
|
32026
|
-
tab: activeTab
|
|
32027
|
-
sortBy: {
|
|
32028
|
-
[sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
|
|
32029
|
-
}
|
|
32260
|
+
tab: activeTab
|
|
32030
32261
|
}, 'documents');
|
|
32031
|
-
|
|
32032
|
-
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
32033
|
-
console.log({
|
|
32034
|
-
data
|
|
32035
|
-
});
|
|
32262
|
+
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
32036
32263
|
const selectFiltersConfig = React.useMemo(() => {
|
|
32037
|
-
return getFiltersConfig$
|
|
32264
|
+
return getFiltersConfig$4({
|
|
32038
32265
|
t
|
|
32039
32266
|
});
|
|
32040
32267
|
}, [t]);
|
|
32041
32268
|
React.useEffect(() => {
|
|
32042
32269
|
setSelectOptions(prev => ({
|
|
32043
32270
|
...prev,
|
|
32044
|
-
...getFilterOptions$
|
|
32271
|
+
...getFilterOptions$4(options)
|
|
32045
32272
|
}));
|
|
32046
32273
|
}, [options, t]);
|
|
32047
32274
|
const handleActiveTabChange = React.useCallback(value => {
|
|
32048
32275
|
setActiveTab(value);
|
|
32049
32276
|
}, []);
|
|
32277
|
+
React.useEffect(() => () => {
|
|
32278
|
+
subjectClear();
|
|
32279
|
+
}, []);
|
|
32050
32280
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
32051
32281
|
t: t,
|
|
32052
|
-
title: t("
|
|
32282
|
+
title: t("Documents"),
|
|
32053
32283
|
breadCrumbs: breadCrumbs,
|
|
32054
32284
|
location: location,
|
|
32055
32285
|
loading: loading,
|
|
@@ -32057,13 +32287,13 @@ const DocumentsTable = ({
|
|
|
32057
32287
|
defaultActiveTab: "all",
|
|
32058
32288
|
columns: columns,
|
|
32059
32289
|
data: data,
|
|
32060
|
-
checkboxConfig: checkboxConfig$
|
|
32290
|
+
checkboxConfig: checkboxConfig$4,
|
|
32061
32291
|
APP: APP,
|
|
32062
32292
|
getApiBaseUrl: getApiBaseUrl,
|
|
32063
32293
|
selectOptions: selectOptions,
|
|
32064
32294
|
selectFiltersConfig: selectFiltersConfig,
|
|
32065
32295
|
getRedirectLink: getRedirectLink,
|
|
32066
|
-
filtersConfig: filtersConfig$
|
|
32296
|
+
filtersConfig: filtersConfig$4,
|
|
32067
32297
|
isMobile: isMobile,
|
|
32068
32298
|
view: "documents",
|
|
32069
32299
|
getActiveTab: handleActiveTabChange,
|
|
@@ -32073,7 +32303,7 @@ const DocumentsTable = ({
|
|
|
32073
32303
|
drawerTitle: t("Create Document"),
|
|
32074
32304
|
children: ({
|
|
32075
32305
|
onDrawerClose
|
|
32076
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(
|
|
32306
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$3, {
|
|
32077
32307
|
t: t,
|
|
32078
32308
|
goTo: goTo,
|
|
32079
32309
|
user: user,
|
|
@@ -32086,7 +32316,6 @@ const DocumentsTable = ({
|
|
|
32086
32316
|
onSubmitted: (type, m, data) => {
|
|
32087
32317
|
if (data.datastakeId) {
|
|
32088
32318
|
displayMessage(type, t("affirmations::subject-created-successfully") || m);
|
|
32089
|
-
// goTo(`/app/edit/stakeholders/${data.datastakeId}`);
|
|
32090
32319
|
goTo(`/app/edit/documents/${data.datastakeId}`);
|
|
32091
32320
|
}
|
|
32092
32321
|
},
|
|
@@ -32103,7 +32332,7 @@ const DocumentsTable = ({
|
|
|
32103
32332
|
});
|
|
32104
32333
|
};
|
|
32105
32334
|
|
|
32106
|
-
const renderStatusTag$
|
|
32335
|
+
const renderStatusTag$2 = ({
|
|
32107
32336
|
value,
|
|
32108
32337
|
t = s => s
|
|
32109
32338
|
}) => {
|
|
@@ -32138,7 +32367,7 @@ const renderStatusTag$1 = ({
|
|
|
32138
32367
|
});
|
|
32139
32368
|
}
|
|
32140
32369
|
};
|
|
32141
|
-
const getColumns$
|
|
32370
|
+
const getColumns$3 = ({
|
|
32142
32371
|
t,
|
|
32143
32372
|
goTo,
|
|
32144
32373
|
user,
|
|
@@ -32277,7 +32506,7 @@ const getColumns$1 = ({
|
|
|
32277
32506
|
});
|
|
32278
32507
|
}
|
|
32279
32508
|
const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
|
|
32280
|
-
return renderStatusTag$
|
|
32509
|
+
return renderStatusTag$2({
|
|
32281
32510
|
value: _val,
|
|
32282
32511
|
t
|
|
32283
32512
|
});
|
|
@@ -32310,11 +32539,11 @@ const getColumns$1 = ({
|
|
|
32310
32539
|
}
|
|
32311
32540
|
}].filter(column => column.show !== false);
|
|
32312
32541
|
|
|
32313
|
-
const checkboxConfig$
|
|
32542
|
+
const checkboxConfig$3 = {
|
|
32314
32543
|
name: 'Name',
|
|
32315
32544
|
datastakeId: 'ID'
|
|
32316
32545
|
};
|
|
32317
|
-
const getFiltersConfig$
|
|
32546
|
+
const getFiltersConfig$3 = ({
|
|
32318
32547
|
t
|
|
32319
32548
|
}) => {
|
|
32320
32549
|
return {
|
|
@@ -32482,11 +32711,11 @@ const getFiltersConfig$1 = ({
|
|
|
32482
32711
|
}
|
|
32483
32712
|
};
|
|
32484
32713
|
};
|
|
32485
|
-
const filtersConfig$
|
|
32714
|
+
const filtersConfig$3 = {
|
|
32486
32715
|
name: '',
|
|
32487
32716
|
datastakeId: ''
|
|
32488
32717
|
};
|
|
32489
|
-
const getFilterOptions$
|
|
32718
|
+
const getFilterOptions$3 = (options, t) => {
|
|
32490
32719
|
const {
|
|
32491
32720
|
statusOptions = [],
|
|
32492
32721
|
categoryOptions = [],
|
|
@@ -32519,7 +32748,7 @@ const getFilterOptions$1 = (options, t) => {
|
|
|
32519
32748
|
return _default;
|
|
32520
32749
|
};
|
|
32521
32750
|
|
|
32522
|
-
const StakeholdersCreate$
|
|
32751
|
+
const StakeholdersCreate$2 = ({
|
|
32523
32752
|
namespace = "WORKERS",
|
|
32524
32753
|
view = ['scoping', 'new'],
|
|
32525
32754
|
edit = false,
|
|
@@ -32654,7 +32883,7 @@ const WorkersTable = ({
|
|
|
32654
32883
|
}) => {
|
|
32655
32884
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
32656
32885
|
const [activeTab, setActiveTab] = React.useState();
|
|
32657
|
-
const columns = React.useMemo(() => getColumns$
|
|
32886
|
+
const columns = React.useMemo(() => getColumns$3({
|
|
32658
32887
|
t,
|
|
32659
32888
|
goTo,
|
|
32660
32889
|
user,
|
|
@@ -32697,14 +32926,14 @@ const WorkersTable = ({
|
|
|
32697
32926
|
}, 'workers');
|
|
32698
32927
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
32699
32928
|
const selectFiltersConfig = React.useMemo(() => {
|
|
32700
|
-
return getFiltersConfig$
|
|
32929
|
+
return getFiltersConfig$3({
|
|
32701
32930
|
t
|
|
32702
32931
|
});
|
|
32703
32932
|
}, [t]);
|
|
32704
32933
|
React.useEffect(() => {
|
|
32705
32934
|
setSelectOptions(prev => ({
|
|
32706
32935
|
...prev,
|
|
32707
|
-
...getFilterOptions$
|
|
32936
|
+
...getFilterOptions$3(options)
|
|
32708
32937
|
}));
|
|
32709
32938
|
}, [options, t]);
|
|
32710
32939
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -32720,13 +32949,13 @@ const WorkersTable = ({
|
|
|
32720
32949
|
defaultActiveTab: "all",
|
|
32721
32950
|
columns: columns,
|
|
32722
32951
|
data: data,
|
|
32723
|
-
checkboxConfig: checkboxConfig$
|
|
32952
|
+
checkboxConfig: checkboxConfig$3,
|
|
32724
32953
|
APP: APP,
|
|
32725
32954
|
getApiBaseUrl: getApiBaseUrl,
|
|
32726
32955
|
selectOptions: selectOptions,
|
|
32727
32956
|
selectFiltersConfig: selectFiltersConfig,
|
|
32728
32957
|
getRedirectLink: getRedirectLink,
|
|
32729
|
-
filtersConfig: filtersConfig$
|
|
32958
|
+
filtersConfig: filtersConfig$3,
|
|
32730
32959
|
isMobile: isMobile,
|
|
32731
32960
|
view: "workers",
|
|
32732
32961
|
getActiveTab: handleActiveTabChange,
|
|
@@ -32736,7 +32965,7 @@ const WorkersTable = ({
|
|
|
32736
32965
|
drawerTitle: t("Create Worker"),
|
|
32737
32966
|
children: ({
|
|
32738
32967
|
onDrawerClose
|
|
32739
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$
|
|
32968
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$2, {
|
|
32740
32969
|
defaultData: createDefaultValues,
|
|
32741
32970
|
t: t,
|
|
32742
32971
|
goTo: goTo,
|
|
@@ -32767,13 +32996,13 @@ const WorkersTable = ({
|
|
|
32767
32996
|
});
|
|
32768
32997
|
};
|
|
32769
32998
|
|
|
32770
|
-
const getLinkValue = (value, linkingObject) => {
|
|
32999
|
+
const getLinkValue$2 = (value, linkingObject) => {
|
|
32771
33000
|
if (linkingObject && linkingObject?.[value]) {
|
|
32772
33001
|
return linkingObject?.[value]?.name;
|
|
32773
33002
|
}
|
|
32774
33003
|
return null;
|
|
32775
33004
|
};
|
|
32776
|
-
const getEventCategoryBySubject = (eventCategoryObject, subject) => {
|
|
33005
|
+
const getEventCategoryBySubject$1 = (eventCategoryObject, subject) => {
|
|
32777
33006
|
if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
|
|
32778
33007
|
return null;
|
|
32779
33008
|
}
|
|
@@ -32781,7 +33010,7 @@ const getEventCategoryBySubject = (eventCategoryObject, subject) => {
|
|
|
32781
33010
|
const key = `typeOfEvent is ${subjectSingular}`;
|
|
32782
33011
|
return eventCategoryObject[key] || null;
|
|
32783
33012
|
};
|
|
32784
|
-
const renderStatusTag = ({
|
|
33013
|
+
const renderStatusTag$1 = ({
|
|
32785
33014
|
value,
|
|
32786
33015
|
t = s => s
|
|
32787
33016
|
}) => {
|
|
@@ -32816,7 +33045,7 @@ const renderStatusTag = ({
|
|
|
32816
33045
|
});
|
|
32817
33046
|
}
|
|
32818
33047
|
};
|
|
32819
|
-
const getColumns = ({
|
|
33048
|
+
const getColumns$2 = ({
|
|
32820
33049
|
t,
|
|
32821
33050
|
goTo,
|
|
32822
33051
|
user,
|
|
@@ -32906,7 +33135,7 @@ const getColumns = ({
|
|
|
32906
33135
|
className: "daf-default-cell"
|
|
32907
33136
|
});
|
|
32908
33137
|
}
|
|
32909
|
-
const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
|
|
33138
|
+
const region = getLinkValue$2(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
|
|
32910
33139
|
return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
32911
33140
|
title: region,
|
|
32912
33141
|
children: region
|
|
@@ -32923,7 +33152,7 @@ const getColumns = ({
|
|
|
32923
33152
|
className: "daf-default-cell"
|
|
32924
33153
|
});
|
|
32925
33154
|
}
|
|
32926
|
-
const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
|
|
33155
|
+
const district = getLinkValue$2(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
|
|
32927
33156
|
return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
32928
33157
|
title: district,
|
|
32929
33158
|
children: district
|
|
@@ -32941,7 +33170,7 @@ const getColumns = ({
|
|
|
32941
33170
|
});
|
|
32942
33171
|
}
|
|
32943
33172
|
const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
|
|
32944
|
-
const categoryValue = getEventCategoryBySubject(eventCategory, subject);
|
|
33173
|
+
const categoryValue = getEventCategoryBySubject$1(eventCategory, subject);
|
|
32945
33174
|
return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
32946
33175
|
title: categoryValue,
|
|
32947
33176
|
children: categoryValue
|
|
@@ -32975,7 +33204,7 @@ const getColumns = ({
|
|
|
32975
33204
|
});
|
|
32976
33205
|
}
|
|
32977
33206
|
const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
|
|
32978
|
-
return renderStatusTag({
|
|
33207
|
+
return renderStatusTag$1({
|
|
32979
33208
|
value: _val,
|
|
32980
33209
|
t
|
|
32981
33210
|
});
|
|
@@ -33025,11 +33254,11 @@ const getColumns = ({
|
|
|
33025
33254
|
}
|
|
33026
33255
|
}].filter(column => column.show !== false);
|
|
33027
33256
|
|
|
33028
|
-
const checkboxConfig = {
|
|
33257
|
+
const checkboxConfig$2 = {
|
|
33029
33258
|
name: 'Name',
|
|
33030
33259
|
datastakeId: 'ID'
|
|
33031
33260
|
};
|
|
33032
|
-
const getFiltersConfig = ({
|
|
33261
|
+
const getFiltersConfig$2 = ({
|
|
33033
33262
|
t
|
|
33034
33263
|
}) => {
|
|
33035
33264
|
return {
|
|
@@ -33197,11 +33426,11 @@ const getFiltersConfig = ({
|
|
|
33197
33426
|
}
|
|
33198
33427
|
};
|
|
33199
33428
|
};
|
|
33200
|
-
const filtersConfig = {
|
|
33429
|
+
const filtersConfig$2 = {
|
|
33201
33430
|
name: '',
|
|
33202
33431
|
datastakeId: ''
|
|
33203
33432
|
};
|
|
33204
|
-
const getFilterOptions = (options, t) => {
|
|
33433
|
+
const getFilterOptions$2 = (options, t) => {
|
|
33205
33434
|
const {
|
|
33206
33435
|
statusOptions = [],
|
|
33207
33436
|
categoryOptions = [],
|
|
@@ -33234,7 +33463,7 @@ const getFilterOptions = (options, t) => {
|
|
|
33234
33463
|
return _default;
|
|
33235
33464
|
};
|
|
33236
33465
|
|
|
33237
|
-
const StakeholdersCreate = ({
|
|
33466
|
+
const StakeholdersCreate$1 = ({
|
|
33238
33467
|
namespace = "corrective-actions",
|
|
33239
33468
|
view = "corrective-actions",
|
|
33240
33469
|
edit = false,
|
|
@@ -33369,7 +33598,7 @@ const ActivitiesTable = ({
|
|
|
33369
33598
|
}) => {
|
|
33370
33599
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
33371
33600
|
const [activeTab, setActiveTab] = React.useState();
|
|
33372
|
-
const columns = React.useMemo(() => getColumns({
|
|
33601
|
+
const columns = React.useMemo(() => getColumns$2({
|
|
33373
33602
|
t,
|
|
33374
33603
|
goTo,
|
|
33375
33604
|
user,
|
|
@@ -33412,14 +33641,14 @@ const ActivitiesTable = ({
|
|
|
33412
33641
|
}, 'activities');
|
|
33413
33642
|
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
33414
33643
|
const selectFiltersConfig = React.useMemo(() => {
|
|
33415
|
-
return getFiltersConfig({
|
|
33644
|
+
return getFiltersConfig$2({
|
|
33416
33645
|
t
|
|
33417
33646
|
});
|
|
33418
33647
|
}, [t]);
|
|
33419
33648
|
React.useEffect(() => {
|
|
33420
33649
|
setSelectOptions(prev => ({
|
|
33421
33650
|
...prev,
|
|
33422
|
-
...getFilterOptions(options)
|
|
33651
|
+
...getFilterOptions$2(options)
|
|
33423
33652
|
}));
|
|
33424
33653
|
}, [options, t]);
|
|
33425
33654
|
const handleActiveTabChange = React.useCallback(value => {
|
|
@@ -33435,13 +33664,13 @@ const ActivitiesTable = ({
|
|
|
33435
33664
|
defaultActiveTab: "all",
|
|
33436
33665
|
columns: columns,
|
|
33437
33666
|
data: data,
|
|
33438
|
-
checkboxConfig: checkboxConfig,
|
|
33667
|
+
checkboxConfig: checkboxConfig$2,
|
|
33439
33668
|
APP: APP,
|
|
33440
33669
|
getApiBaseUrl: getApiBaseUrl,
|
|
33441
33670
|
selectOptions: selectOptions,
|
|
33442
33671
|
selectFiltersConfig: selectFiltersConfig,
|
|
33443
33672
|
getRedirectLink: getRedirectLink,
|
|
33444
|
-
filtersConfig: filtersConfig,
|
|
33673
|
+
filtersConfig: filtersConfig$2,
|
|
33445
33674
|
isMobile: isMobile,
|
|
33446
33675
|
view: "activities",
|
|
33447
33676
|
getActiveTab: handleActiveTabChange,
|
|
@@ -33451,7 +33680,7 @@ const ActivitiesTable = ({
|
|
|
33451
33680
|
drawerTitle: t("Create Activity"),
|
|
33452
33681
|
children: ({
|
|
33453
33682
|
onDrawerClose
|
|
33454
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate, {
|
|
33683
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$1, {
|
|
33455
33684
|
defaultData: createDefaultValues,
|
|
33456
33685
|
t: t,
|
|
33457
33686
|
goTo: goTo,
|
|
@@ -33482,11 +33711,1365 @@ const ActivitiesTable = ({
|
|
|
33482
33711
|
});
|
|
33483
33712
|
};
|
|
33484
33713
|
|
|
33714
|
+
const getLinkValue$1 = (value, linkingObject) => {
|
|
33715
|
+
if (linkingObject && linkingObject?.[value]) {
|
|
33716
|
+
return linkingObject?.[value]?.name;
|
|
33717
|
+
}
|
|
33718
|
+
return null;
|
|
33719
|
+
};
|
|
33720
|
+
const getEventCategoryBySubject = (eventCategoryObject, subject) => {
|
|
33721
|
+
if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
|
|
33722
|
+
return null;
|
|
33723
|
+
}
|
|
33724
|
+
const subjectSingular = subject.endsWith('ies') ? subject.slice(0, -3) + 'y' : subject.endsWith('s') ? subject.slice(0, -1) : subject;
|
|
33725
|
+
const key = `typeOfEvent is ${subjectSingular}`;
|
|
33726
|
+
return eventCategoryObject[key] || null;
|
|
33727
|
+
};
|
|
33728
|
+
const renderStatusTag = ({
|
|
33729
|
+
value,
|
|
33730
|
+
t = s => s
|
|
33731
|
+
}) => {
|
|
33732
|
+
const width = 87;
|
|
33733
|
+
switch (value) {
|
|
33734
|
+
case "edited":
|
|
33735
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
33736
|
+
color: "yellow",
|
|
33737
|
+
style: {
|
|
33738
|
+
width
|
|
33739
|
+
},
|
|
33740
|
+
className: "text-center",
|
|
33741
|
+
children: t("Edited")
|
|
33742
|
+
});
|
|
33743
|
+
case "submitted":
|
|
33744
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
33745
|
+
color: "green",
|
|
33746
|
+
style: {
|
|
33747
|
+
width
|
|
33748
|
+
},
|
|
33749
|
+
className: "text-center",
|
|
33750
|
+
children: t("Submitted")
|
|
33751
|
+
});
|
|
33752
|
+
default:
|
|
33753
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
33754
|
+
color: "blue",
|
|
33755
|
+
style: {
|
|
33756
|
+
width
|
|
33757
|
+
},
|
|
33758
|
+
className: "text-center",
|
|
33759
|
+
children: t("Private")
|
|
33760
|
+
});
|
|
33761
|
+
}
|
|
33762
|
+
};
|
|
33763
|
+
const getColumns$1 = ({
|
|
33764
|
+
t,
|
|
33765
|
+
goTo,
|
|
33766
|
+
user,
|
|
33767
|
+
options,
|
|
33768
|
+
activeTab,
|
|
33769
|
+
getRedirectLink,
|
|
33770
|
+
theme,
|
|
33771
|
+
subject,
|
|
33772
|
+
data,
|
|
33773
|
+
applications
|
|
33774
|
+
}) => [{
|
|
33775
|
+
dataIndex: 'datastakeId',
|
|
33776
|
+
title: t('ID'),
|
|
33777
|
+
ellipsis: true,
|
|
33778
|
+
show: true,
|
|
33779
|
+
render: (v, all) => {
|
|
33780
|
+
if (all.empty) {
|
|
33781
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33782
|
+
className: "daf-default-cell"
|
|
33783
|
+
});
|
|
33784
|
+
}
|
|
33785
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
33786
|
+
title: v,
|
|
33787
|
+
children: v
|
|
33788
|
+
});
|
|
33789
|
+
}
|
|
33790
|
+
}, {
|
|
33791
|
+
dataIndex: 'name',
|
|
33792
|
+
title: t('Title'),
|
|
33793
|
+
ellipsis: true,
|
|
33794
|
+
show: true,
|
|
33795
|
+
render: (v, all) => {
|
|
33796
|
+
if (all.empty) {
|
|
33797
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33798
|
+
className: "daf-default-cell"
|
|
33799
|
+
});
|
|
33800
|
+
}
|
|
33801
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
33802
|
+
title: v,
|
|
33803
|
+
children: v
|
|
33804
|
+
});
|
|
33805
|
+
}
|
|
33806
|
+
}, {
|
|
33807
|
+
title: t("Date"),
|
|
33808
|
+
dataIndex: "date",
|
|
33809
|
+
key: "date",
|
|
33810
|
+
render: (date, all) => {
|
|
33811
|
+
if (all.empty) {
|
|
33812
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33813
|
+
className: "daf-default-cell"
|
|
33814
|
+
});
|
|
33815
|
+
}
|
|
33816
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
33817
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
33818
|
+
title: _date,
|
|
33819
|
+
children: _date
|
|
33820
|
+
});
|
|
33821
|
+
},
|
|
33822
|
+
ellipsis: true
|
|
33823
|
+
}, {
|
|
33824
|
+
dataIndex: 'mineSite',
|
|
33825
|
+
title: t('Location'),
|
|
33826
|
+
ellipsis: true,
|
|
33827
|
+
show: true,
|
|
33828
|
+
render: (v, all) => {
|
|
33829
|
+
if (all.empty) {
|
|
33830
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33831
|
+
className: "daf-default-cell"
|
|
33832
|
+
});
|
|
33833
|
+
}
|
|
33834
|
+
|
|
33835
|
+
// const country = findOptions(v, data?.options?.positionSupplyChainOptions);
|
|
33836
|
+
const mineSite = all?.location?.name;
|
|
33837
|
+
return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
33838
|
+
title: mineSite,
|
|
33839
|
+
children: mineSite
|
|
33840
|
+
}) : '-';
|
|
33841
|
+
}
|
|
33842
|
+
}, {
|
|
33843
|
+
dataIndex: 'province',
|
|
33844
|
+
title: t('Province'),
|
|
33845
|
+
ellipsis: true,
|
|
33846
|
+
show: true,
|
|
33847
|
+
render: (v, all) => {
|
|
33848
|
+
if (all.empty) {
|
|
33849
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33850
|
+
className: "daf-default-cell"
|
|
33851
|
+
});
|
|
33852
|
+
}
|
|
33853
|
+
const region = getLinkValue$1(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
|
|
33854
|
+
return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
33855
|
+
title: region,
|
|
33856
|
+
children: region
|
|
33857
|
+
}) : '-';
|
|
33858
|
+
}
|
|
33859
|
+
}, {
|
|
33860
|
+
dataIndex: 'territory',
|
|
33861
|
+
title: t('Territory'),
|
|
33862
|
+
ellipsis: true,
|
|
33863
|
+
show: true,
|
|
33864
|
+
render: (v, all) => {
|
|
33865
|
+
if (all.empty) {
|
|
33866
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33867
|
+
className: "daf-default-cell"
|
|
33868
|
+
});
|
|
33869
|
+
}
|
|
33870
|
+
const district = getLinkValue$1(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
|
|
33871
|
+
return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
33872
|
+
title: district,
|
|
33873
|
+
children: district
|
|
33874
|
+
}) : '-';
|
|
33875
|
+
}
|
|
33876
|
+
}, {
|
|
33877
|
+
dataIndex: 'eventCategory',
|
|
33878
|
+
title: t('Category'),
|
|
33879
|
+
ellipsis: true,
|
|
33880
|
+
show: true,
|
|
33881
|
+
render: (v, all) => {
|
|
33882
|
+
if (all.empty) {
|
|
33883
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33884
|
+
className: "daf-default-cell"
|
|
33885
|
+
});
|
|
33886
|
+
}
|
|
33887
|
+
const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
|
|
33888
|
+
const categoryValue = getEventCategoryBySubject(eventCategory, subject);
|
|
33889
|
+
return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
33890
|
+
title: categoryValue,
|
|
33891
|
+
children: categoryValue
|
|
33892
|
+
}) : '-';
|
|
33893
|
+
}
|
|
33894
|
+
}, {
|
|
33895
|
+
title: t("Sources"),
|
|
33896
|
+
dataIndex: "sources",
|
|
33897
|
+
key: "sources",
|
|
33898
|
+
show: activeTab !== "own",
|
|
33899
|
+
render: (val, all) => {
|
|
33900
|
+
if (all.empty) {
|
|
33901
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33902
|
+
className: "daf-default-cell"
|
|
33903
|
+
});
|
|
33904
|
+
}
|
|
33905
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
33906
|
+
return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
|
|
33907
|
+
items: sources
|
|
33908
|
+
});
|
|
33909
|
+
}
|
|
33910
|
+
}, {
|
|
33911
|
+
title: t("Status"),
|
|
33912
|
+
dataIndex: "status",
|
|
33913
|
+
key: "status",
|
|
33914
|
+
show: activeTab === "own",
|
|
33915
|
+
render: (val, all) => {
|
|
33916
|
+
if (all.empty) {
|
|
33917
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33918
|
+
className: "daf-default-cell"
|
|
33919
|
+
});
|
|
33920
|
+
}
|
|
33921
|
+
const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
|
|
33922
|
+
return renderStatusTag({
|
|
33923
|
+
value: _val,
|
|
33924
|
+
t
|
|
33925
|
+
});
|
|
33926
|
+
}
|
|
33927
|
+
}, {
|
|
33928
|
+
title: t("Last Update"),
|
|
33929
|
+
dataIndex: "updatedAt",
|
|
33930
|
+
key: "updatedAt",
|
|
33931
|
+
render: (date, all) => {
|
|
33932
|
+
if (all.empty) {
|
|
33933
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33934
|
+
className: "daf-default-cell"
|
|
33935
|
+
});
|
|
33936
|
+
}
|
|
33937
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
33938
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
33939
|
+
title: _date,
|
|
33940
|
+
children: _date
|
|
33941
|
+
});
|
|
33942
|
+
},
|
|
33943
|
+
ellipsis: true
|
|
33944
|
+
}, {
|
|
33945
|
+
id: 'actions',
|
|
33946
|
+
title: "",
|
|
33947
|
+
width: 60,
|
|
33948
|
+
render: (_, all) => {
|
|
33949
|
+
if (all.empty) {
|
|
33950
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33951
|
+
className: "daf-default-cell"
|
|
33952
|
+
});
|
|
33953
|
+
}
|
|
33954
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
33955
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
33956
|
+
style: {
|
|
33957
|
+
display: "flex",
|
|
33958
|
+
justifyContent: "center"
|
|
33959
|
+
},
|
|
33960
|
+
children: /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
33961
|
+
href: getRedirectLink(link),
|
|
33962
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
33963
|
+
name: "Link",
|
|
33964
|
+
size: 15,
|
|
33965
|
+
color: theme.baseGray70
|
|
33966
|
+
})
|
|
33967
|
+
})
|
|
33968
|
+
});
|
|
33969
|
+
}
|
|
33970
|
+
}].filter(column => column.show !== false);
|
|
33971
|
+
|
|
33972
|
+
const checkboxConfig$1 = {
|
|
33973
|
+
name: 'Name',
|
|
33974
|
+
datastakeId: 'ID'
|
|
33975
|
+
};
|
|
33976
|
+
const getFiltersConfig$1 = ({
|
|
33977
|
+
t
|
|
33978
|
+
}) => {
|
|
33979
|
+
return {
|
|
33980
|
+
country: {
|
|
33981
|
+
type: 'select',
|
|
33982
|
+
label: 'Country',
|
|
33983
|
+
placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
33984
|
+
style: {
|
|
33985
|
+
flex: 1
|
|
33986
|
+
},
|
|
33987
|
+
labelStyle: {
|
|
33988
|
+
flex: 1
|
|
33989
|
+
},
|
|
33990
|
+
getLabel: option => option.label,
|
|
33991
|
+
getValue: option => option.value
|
|
33992
|
+
},
|
|
33993
|
+
administrativeLevel1: {
|
|
33994
|
+
type: 'ajaxSelect',
|
|
33995
|
+
label: ({
|
|
33996
|
+
t = s => s,
|
|
33997
|
+
options = {},
|
|
33998
|
+
filters = {},
|
|
33999
|
+
language = 'en'
|
|
34000
|
+
}) => {
|
|
34001
|
+
const {
|
|
34002
|
+
administrativeLevel1
|
|
34003
|
+
} = options;
|
|
34004
|
+
if (administrativeLevel1) {
|
|
34005
|
+
if (options.country) {
|
|
34006
|
+
const _item = administrativeLevel1[filters.country];
|
|
34007
|
+
if (_item) {
|
|
34008
|
+
if (_item[language]) {
|
|
34009
|
+
return _item[language];
|
|
34010
|
+
}
|
|
34011
|
+
}
|
|
34012
|
+
}
|
|
34013
|
+
}
|
|
34014
|
+
return t('Province');
|
|
34015
|
+
},
|
|
34016
|
+
placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
|
|
34017
|
+
filters: data => ({
|
|
34018
|
+
country: data.country,
|
|
34019
|
+
level: 'level_1'
|
|
34020
|
+
}),
|
|
34021
|
+
show: data => !data.country,
|
|
34022
|
+
disabled: data => !data.country,
|
|
34023
|
+
mapper: {
|
|
34024
|
+
label: "name",
|
|
34025
|
+
value: "id"
|
|
34026
|
+
},
|
|
34027
|
+
method: 'getOptions',
|
|
34028
|
+
entity: 'AdministrativeLevel',
|
|
34029
|
+
style: {
|
|
34030
|
+
flex: 1
|
|
34031
|
+
},
|
|
34032
|
+
labelStyle: {
|
|
34033
|
+
flex: 1
|
|
34034
|
+
}
|
|
34035
|
+
},
|
|
34036
|
+
administrativeLevel2: {
|
|
34037
|
+
type: 'ajaxSelect',
|
|
34038
|
+
label: ({
|
|
34039
|
+
t = s => s,
|
|
34040
|
+
options = {},
|
|
34041
|
+
filters = {},
|
|
34042
|
+
language = 'en'
|
|
34043
|
+
}) => {
|
|
34044
|
+
const {
|
|
34045
|
+
administrativeLevel2
|
|
34046
|
+
} = options;
|
|
34047
|
+
if (administrativeLevel2) {
|
|
34048
|
+
if (options.country) {
|
|
34049
|
+
const _item = administrativeLevel2[filters.country];
|
|
34050
|
+
if (_item) {
|
|
34051
|
+
if (_item[language]) {
|
|
34052
|
+
return _item[language];
|
|
34053
|
+
}
|
|
34054
|
+
}
|
|
34055
|
+
}
|
|
34056
|
+
}
|
|
34057
|
+
return t('Province');
|
|
34058
|
+
},
|
|
34059
|
+
show: data => !(data.country && data.administrativeLevel1),
|
|
34060
|
+
placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
|
|
34061
|
+
filters: data => ({
|
|
34062
|
+
country: data.country,
|
|
34063
|
+
level: 'level_2',
|
|
34064
|
+
administrativeLevel1: data.administrativeLevel1
|
|
34065
|
+
}),
|
|
34066
|
+
disabled: data => !(data.country && data.administrativeLevel1),
|
|
34067
|
+
mapper: {
|
|
34068
|
+
label: "name",
|
|
34069
|
+
value: "id"
|
|
34070
|
+
},
|
|
34071
|
+
method: 'getOptions',
|
|
34072
|
+
entity: 'AdministrativeLevel',
|
|
34073
|
+
style: {
|
|
34074
|
+
flex: 1
|
|
34075
|
+
},
|
|
34076
|
+
labelStyle: {
|
|
34077
|
+
flex: 1
|
|
34078
|
+
}
|
|
34079
|
+
},
|
|
34080
|
+
activity: {
|
|
34081
|
+
type: 'select',
|
|
34082
|
+
label: 'Activity',
|
|
34083
|
+
placeholder: t => `${t('Filter by')} ${t('Activity').toLowerCase()}`,
|
|
34084
|
+
style: {
|
|
34085
|
+
flex: 1
|
|
34086
|
+
},
|
|
34087
|
+
labelStyle: {
|
|
34088
|
+
flex: 1
|
|
34089
|
+
},
|
|
34090
|
+
getLabel: option => option.label,
|
|
34091
|
+
getValue: option => option.value,
|
|
34092
|
+
filterOptions: val => {
|
|
34093
|
+
if (val) {
|
|
34094
|
+
const {
|
|
34095
|
+
option,
|
|
34096
|
+
filters
|
|
34097
|
+
} = val;
|
|
34098
|
+
if (filters && option) {
|
|
34099
|
+
const {
|
|
34100
|
+
filters: optionFilters
|
|
34101
|
+
} = option;
|
|
34102
|
+
if (Array.isArray(optionFilters) && optionFilters.length) {
|
|
34103
|
+
const {
|
|
34104
|
+
value,
|
|
34105
|
+
condition
|
|
34106
|
+
} = optionFilters[0];
|
|
34107
|
+
if (condition === 'includes') {
|
|
34108
|
+
return value.includes('corporation');
|
|
34109
|
+
}
|
|
34110
|
+
}
|
|
34111
|
+
}
|
|
34112
|
+
}
|
|
34113
|
+
return true;
|
|
34114
|
+
}
|
|
34115
|
+
},
|
|
34116
|
+
positionInTheMineralSupplyChain: {
|
|
34117
|
+
type: 'select',
|
|
34118
|
+
label: 'Position',
|
|
34119
|
+
placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
|
|
34120
|
+
style: {
|
|
34121
|
+
flex: 1
|
|
34122
|
+
},
|
|
34123
|
+
labelStyle: {
|
|
34124
|
+
flex: 1
|
|
34125
|
+
},
|
|
34126
|
+
getLabel: option => option.label,
|
|
34127
|
+
getValue: option => option.value
|
|
34128
|
+
},
|
|
34129
|
+
status: {
|
|
34130
|
+
type: "select",
|
|
34131
|
+
label: "Status",
|
|
34132
|
+
placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
34133
|
+
style: {
|
|
34134
|
+
flex: 1
|
|
34135
|
+
},
|
|
34136
|
+
labelStyle: {
|
|
34137
|
+
fley: 1
|
|
34138
|
+
},
|
|
34139
|
+
getLabel: option => option.label,
|
|
34140
|
+
getValue: option => option.value
|
|
34141
|
+
}
|
|
34142
|
+
};
|
|
34143
|
+
};
|
|
34144
|
+
const filtersConfig$1 = {
|
|
34145
|
+
name: '',
|
|
34146
|
+
datastakeId: ''
|
|
34147
|
+
};
|
|
34148
|
+
const getFilterOptions$1 = (options, t) => {
|
|
34149
|
+
const {
|
|
34150
|
+
statusOptions = [],
|
|
34151
|
+
categoryOptions = [],
|
|
34152
|
+
countries = [],
|
|
34153
|
+
subCategory = [],
|
|
34154
|
+
activityAtSiteOptions = [],
|
|
34155
|
+
stakeholderCategoryOptions,
|
|
34156
|
+
stakeholderSubCategoriesOptions,
|
|
34157
|
+
administrativeLevel1,
|
|
34158
|
+
administrativeLevel2,
|
|
34159
|
+
positionInMineralSupplyChainOptions,
|
|
34160
|
+
subCategoriesOptions
|
|
34161
|
+
} = options || {};
|
|
34162
|
+
const _default = {
|
|
34163
|
+
status: [{
|
|
34164
|
+
value: "submitted",
|
|
34165
|
+
label: "Submitted"
|
|
34166
|
+
}, {
|
|
34167
|
+
value: "private",
|
|
34168
|
+
label: "Private"
|
|
34169
|
+
}],
|
|
34170
|
+
category: stakeholderCategoryOptions || categoryOptions,
|
|
34171
|
+
country: countries,
|
|
34172
|
+
subCategory: subCategoriesOptions,
|
|
34173
|
+
activity: activityAtSiteOptions,
|
|
34174
|
+
administrativeLevel1,
|
|
34175
|
+
administrativeLevel2,
|
|
34176
|
+
positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions
|
|
34177
|
+
};
|
|
34178
|
+
return _default;
|
|
34179
|
+
};
|
|
34180
|
+
|
|
34181
|
+
const StakeholdersCreate = ({
|
|
34182
|
+
namespace = "incident",
|
|
34183
|
+
view = "incident",
|
|
34184
|
+
edit = false,
|
|
34185
|
+
formData = {},
|
|
34186
|
+
loading = false,
|
|
34187
|
+
onSubmitted = () => {},
|
|
34188
|
+
onCancel = () => {},
|
|
34189
|
+
getData = () => {},
|
|
34190
|
+
saveData = () => {},
|
|
34191
|
+
form: formConfig = {},
|
|
34192
|
+
formValue = {},
|
|
34193
|
+
defaultData = {},
|
|
34194
|
+
user = {},
|
|
34195
|
+
APP,
|
|
34196
|
+
query,
|
|
34197
|
+
goTo = () => {},
|
|
34198
|
+
t = () => {},
|
|
34199
|
+
ajaxForms = {},
|
|
34200
|
+
changeAjaxForms = () => {},
|
|
34201
|
+
ajaxOptions = {},
|
|
34202
|
+
changeAjaxOptions = () => {},
|
|
34203
|
+
getAppHeader = () => {},
|
|
34204
|
+
getApiBaseUrl = () => {}
|
|
34205
|
+
}) => {
|
|
34206
|
+
let {
|
|
34207
|
+
form = {},
|
|
34208
|
+
data = defaultData || {}
|
|
34209
|
+
} = !edit ? formData[`${APP}-${view}`] || {} : {
|
|
34210
|
+
form: formConfig,
|
|
34211
|
+
data: formValue
|
|
34212
|
+
};
|
|
34213
|
+
React.useEffect(() => {
|
|
34214
|
+
if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
|
|
34215
|
+
if (!edit) {
|
|
34216
|
+
getData({
|
|
34217
|
+
namespace,
|
|
34218
|
+
module: APP,
|
|
34219
|
+
view,
|
|
34220
|
+
scope: 'createIncident'
|
|
34221
|
+
});
|
|
34222
|
+
} else {
|
|
34223
|
+
form = formConfig;
|
|
34224
|
+
data = formValue;
|
|
34225
|
+
}
|
|
34226
|
+
}
|
|
34227
|
+
}, [edit, user?.language]);
|
|
34228
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34229
|
+
className: "daf-create-form",
|
|
34230
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
|
|
34231
|
+
form: form,
|
|
34232
|
+
data: {
|
|
34233
|
+
...defaultData,
|
|
34234
|
+
...data
|
|
34235
|
+
},
|
|
34236
|
+
showSaveAndNext: false,
|
|
34237
|
+
module: APP,
|
|
34238
|
+
onCancel: onCancel,
|
|
34239
|
+
isCreate: true,
|
|
34240
|
+
t: t,
|
|
34241
|
+
excludedKeys: ["title"],
|
|
34242
|
+
user: user,
|
|
34243
|
+
ajaxForms: ajaxForms,
|
|
34244
|
+
ajaxOptions: ajaxOptions,
|
|
34245
|
+
getAppHeader: getAppHeader,
|
|
34246
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
34247
|
+
changeAjaxOptions: changeAjaxOptions,
|
|
34248
|
+
app: APP,
|
|
34249
|
+
query: query,
|
|
34250
|
+
goTo: goTo,
|
|
34251
|
+
changeAjaxForms: changeAjaxForms,
|
|
34252
|
+
submit: (payload, setSelectedFormNext) => {
|
|
34253
|
+
const payloadData = {
|
|
34254
|
+
...payload,
|
|
34255
|
+
module: APP,
|
|
34256
|
+
namespace
|
|
34257
|
+
};
|
|
34258
|
+
const newPayload = {
|
|
34259
|
+
...defaultData,
|
|
34260
|
+
...payloadData,
|
|
34261
|
+
form: 'worker'
|
|
34262
|
+
};
|
|
34263
|
+
const callback = (type, m, data) => {
|
|
34264
|
+
if (setSelectedFormNext) {
|
|
34265
|
+
setSelectedFormNext();
|
|
34266
|
+
}
|
|
34267
|
+
if (type === MessageTypes.SUCCESS) {
|
|
34268
|
+
if (onSubmitted) onSubmitted(type, m, data);
|
|
34269
|
+
} else {
|
|
34270
|
+
antd.message.error(m);
|
|
34271
|
+
}
|
|
34272
|
+
};
|
|
34273
|
+
saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
|
|
34274
|
+
id: data.id
|
|
34275
|
+
}), callback);
|
|
34276
|
+
},
|
|
34277
|
+
isFormDisabled: () => {
|
|
34278
|
+
return !data || !data.typeOfEvent;
|
|
34279
|
+
}
|
|
34280
|
+
})
|
|
34281
|
+
});
|
|
34282
|
+
};
|
|
34283
|
+
|
|
34284
|
+
const IncidentsTable = ({
|
|
34285
|
+
t = () => {},
|
|
34286
|
+
goTo = () => {},
|
|
34287
|
+
user = {},
|
|
34288
|
+
options = {},
|
|
34289
|
+
getRedirectLink = () => {},
|
|
34290
|
+
theme = {},
|
|
34291
|
+
loading = false,
|
|
34292
|
+
data = {},
|
|
34293
|
+
isMobile,
|
|
34294
|
+
APP,
|
|
34295
|
+
location,
|
|
34296
|
+
getData = () => {},
|
|
34297
|
+
getApiBaseUrl = () => {},
|
|
34298
|
+
getAppHeader = () => {},
|
|
34299
|
+
getFormData = () => {},
|
|
34300
|
+
saveFormData = () => {},
|
|
34301
|
+
formLoading = false,
|
|
34302
|
+
query = {},
|
|
34303
|
+
ajaxForms = {},
|
|
34304
|
+
changeAjaxForms = () => {},
|
|
34305
|
+
ajaxOptions = {},
|
|
34306
|
+
changeAjaxOptions = () => {},
|
|
34307
|
+
formData = {},
|
|
34308
|
+
formValue = {},
|
|
34309
|
+
form = {},
|
|
34310
|
+
extendingFilters = {},
|
|
34311
|
+
createDefaultValues = {},
|
|
34312
|
+
applications = []
|
|
34313
|
+
}) => {
|
|
34314
|
+
const [selectOptions, setSelectOptions] = React.useState();
|
|
34315
|
+
const [activeTab, setActiveTab] = React.useState();
|
|
34316
|
+
const columns = React.useMemo(() => getColumns$1({
|
|
34317
|
+
t,
|
|
34318
|
+
goTo,
|
|
34319
|
+
user,
|
|
34320
|
+
options,
|
|
34321
|
+
activeTab,
|
|
34322
|
+
getRedirectLink,
|
|
34323
|
+
theme,
|
|
34324
|
+
subject: 'incidents',
|
|
34325
|
+
data,
|
|
34326
|
+
applications
|
|
34327
|
+
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
34328
|
+
const breadCrumbs = [];
|
|
34329
|
+
const {
|
|
34330
|
+
paginationQuery,
|
|
34331
|
+
searchParams,
|
|
34332
|
+
otherParams,
|
|
34333
|
+
sortBy,
|
|
34334
|
+
sortDir
|
|
34335
|
+
} = useGetQueryParams({
|
|
34336
|
+
location
|
|
34337
|
+
});
|
|
34338
|
+
React.useMemo(() => {
|
|
34339
|
+
return {
|
|
34340
|
+
...otherParams,
|
|
34341
|
+
...extendingFilters
|
|
34342
|
+
};
|
|
34343
|
+
}, [otherParams, extendingFilters]);
|
|
34344
|
+
React.useEffect(() => {
|
|
34345
|
+
getData({
|
|
34346
|
+
pagination: paginationQuery,
|
|
34347
|
+
...(Object.keys(searchParams).length > 0 && {
|
|
34348
|
+
search: searchParams
|
|
34349
|
+
}),
|
|
34350
|
+
...otherParams,
|
|
34351
|
+
tab: activeTab,
|
|
34352
|
+
sortBy: {
|
|
34353
|
+
[sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
|
|
34354
|
+
},
|
|
34355
|
+
...extendingFilters
|
|
34356
|
+
}, 'incidents');
|
|
34357
|
+
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
34358
|
+
const selectFiltersConfig = React.useMemo(() => {
|
|
34359
|
+
return getFiltersConfig$1({
|
|
34360
|
+
t
|
|
34361
|
+
});
|
|
34362
|
+
}, [t]);
|
|
34363
|
+
React.useEffect(() => {
|
|
34364
|
+
setSelectOptions(prev => ({
|
|
34365
|
+
...prev,
|
|
34366
|
+
...getFilterOptions$1(options)
|
|
34367
|
+
}));
|
|
34368
|
+
}, [options, t]);
|
|
34369
|
+
const handleActiveTabChange = React.useCallback(value => {
|
|
34370
|
+
setActiveTab(value);
|
|
34371
|
+
}, []);
|
|
34372
|
+
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
34373
|
+
t: t,
|
|
34374
|
+
title: t("Incidents"),
|
|
34375
|
+
breadCrumbs: breadCrumbs,
|
|
34376
|
+
location: location,
|
|
34377
|
+
loading: loading,
|
|
34378
|
+
goTo: goTo,
|
|
34379
|
+
defaultActiveTab: "all",
|
|
34380
|
+
columns: columns,
|
|
34381
|
+
data: data,
|
|
34382
|
+
checkboxConfig: checkboxConfig$1,
|
|
34383
|
+
APP: APP,
|
|
34384
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
34385
|
+
selectOptions: selectOptions,
|
|
34386
|
+
selectFiltersConfig: selectFiltersConfig,
|
|
34387
|
+
getRedirectLink: getRedirectLink,
|
|
34388
|
+
filtersConfig: filtersConfig$1,
|
|
34389
|
+
isMobile: isMobile,
|
|
34390
|
+
view: "incidents",
|
|
34391
|
+
getActiveTab: handleActiveTabChange,
|
|
34392
|
+
onDownload: () => {
|
|
34393
|
+
console.log("download");
|
|
34394
|
+
},
|
|
34395
|
+
drawerTitle: t("Create Incidents"),
|
|
34396
|
+
children: ({
|
|
34397
|
+
onDrawerClose
|
|
34398
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate, {
|
|
34399
|
+
defaultData: createDefaultValues,
|
|
34400
|
+
t: t,
|
|
34401
|
+
goTo: goTo,
|
|
34402
|
+
user: user,
|
|
34403
|
+
APP: APP,
|
|
34404
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
34405
|
+
getAppHeader: getAppHeader,
|
|
34406
|
+
getData: getFormData,
|
|
34407
|
+
saveData: saveFormData,
|
|
34408
|
+
loading: formLoading,
|
|
34409
|
+
onSubmitted: (type, m, data) => {
|
|
34410
|
+
if (data.datastakeId) {
|
|
34411
|
+
displayMessage(type, t("affirmations::subject-created-successfully") || m);
|
|
34412
|
+
// goTo(`/app/edit/stakeholders/${data.datastakeId}`);
|
|
34413
|
+
goTo(`/app/edit/incidents/${data.datastakeId}`);
|
|
34414
|
+
}
|
|
34415
|
+
},
|
|
34416
|
+
onCancel: onDrawerClose,
|
|
34417
|
+
query: query,
|
|
34418
|
+
ajaxForms: ajaxForms,
|
|
34419
|
+
changeAjaxForms: changeAjaxForms,
|
|
34420
|
+
ajaxOptions: ajaxOptions,
|
|
34421
|
+
changeAjaxOptions: changeAjaxOptions,
|
|
34422
|
+
formData: formData,
|
|
34423
|
+
formValue: formValue,
|
|
34424
|
+
form: form
|
|
34425
|
+
})
|
|
34426
|
+
});
|
|
34427
|
+
};
|
|
34428
|
+
|
|
34429
|
+
const getLinkValue = (value, linkingObject) => {
|
|
34430
|
+
if (linkingObject && linkingObject?.[value]) {
|
|
34431
|
+
return linkingObject?.[value]?.name;
|
|
34432
|
+
}
|
|
34433
|
+
return null;
|
|
34434
|
+
};
|
|
34435
|
+
const getColumns = ({
|
|
34436
|
+
t,
|
|
34437
|
+
goTo,
|
|
34438
|
+
user,
|
|
34439
|
+
options,
|
|
34440
|
+
activeTab,
|
|
34441
|
+
getRedirectLink,
|
|
34442
|
+
theme,
|
|
34443
|
+
subject,
|
|
34444
|
+
data
|
|
34445
|
+
}) => [{
|
|
34446
|
+
dataIndex: 'datastakeId',
|
|
34447
|
+
title: t('ID'),
|
|
34448
|
+
ellipsis: true,
|
|
34449
|
+
show: true,
|
|
34450
|
+
render: (v, all) => {
|
|
34451
|
+
if (all.empty) {
|
|
34452
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34453
|
+
className: "daf-default-cell"
|
|
34454
|
+
});
|
|
34455
|
+
}
|
|
34456
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
34457
|
+
title: v,
|
|
34458
|
+
children: v
|
|
34459
|
+
});
|
|
34460
|
+
}
|
|
34461
|
+
}, {
|
|
34462
|
+
dataIndex: 'name',
|
|
34463
|
+
title: t('Name'),
|
|
34464
|
+
ellipsis: true,
|
|
34465
|
+
show: true,
|
|
34466
|
+
render: (v, all) => {
|
|
34467
|
+
if (all.empty) {
|
|
34468
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34469
|
+
className: "daf-default-cell"
|
|
34470
|
+
});
|
|
34471
|
+
}
|
|
34472
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
34473
|
+
title: v,
|
|
34474
|
+
children: v
|
|
34475
|
+
});
|
|
34476
|
+
}
|
|
34477
|
+
}, {
|
|
34478
|
+
dataIndex: 'province',
|
|
34479
|
+
title: t('Province'),
|
|
34480
|
+
ellipsis: true,
|
|
34481
|
+
show: true,
|
|
34482
|
+
render: (v, all) => {
|
|
34483
|
+
if (all.empty) {
|
|
34484
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34485
|
+
className: "daf-default-cell"
|
|
34486
|
+
});
|
|
34487
|
+
}
|
|
34488
|
+
const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
|
|
34489
|
+
return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
34490
|
+
title: region,
|
|
34491
|
+
children: region
|
|
34492
|
+
}) : '-';
|
|
34493
|
+
}
|
|
34494
|
+
}, {
|
|
34495
|
+
dataIndex: 'territory',
|
|
34496
|
+
title: t('Territory'),
|
|
34497
|
+
ellipsis: true,
|
|
34498
|
+
show: true,
|
|
34499
|
+
render: (v, all) => {
|
|
34500
|
+
if (all.empty) {
|
|
34501
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34502
|
+
className: "daf-default-cell"
|
|
34503
|
+
});
|
|
34504
|
+
}
|
|
34505
|
+
const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
|
|
34506
|
+
return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
34507
|
+
title: district,
|
|
34508
|
+
children: district
|
|
34509
|
+
}) : '-';
|
|
34510
|
+
}
|
|
34511
|
+
}, {
|
|
34512
|
+
title: t("Products"),
|
|
34513
|
+
dataIndex: "products",
|
|
34514
|
+
key: "products",
|
|
34515
|
+
show: activeTab !== "own",
|
|
34516
|
+
render: (val, all) => {
|
|
34517
|
+
if (all.empty) {
|
|
34518
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34519
|
+
className: "daf-default-cell"
|
|
34520
|
+
});
|
|
34521
|
+
}
|
|
34522
|
+
console.log({
|
|
34523
|
+
val,
|
|
34524
|
+
all
|
|
34525
|
+
});
|
|
34526
|
+
return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
|
|
34527
|
+
items: val
|
|
34528
|
+
});
|
|
34529
|
+
}
|
|
34530
|
+
},, {
|
|
34531
|
+
dataIndex: 'operator',
|
|
34532
|
+
title: t('Operator'),
|
|
34533
|
+
ellipsis: true,
|
|
34534
|
+
show: true,
|
|
34535
|
+
render: (v, all) => {
|
|
34536
|
+
if (all.empty) {
|
|
34537
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34538
|
+
className: "daf-default-cell"
|
|
34539
|
+
});
|
|
34540
|
+
}
|
|
34541
|
+
const operator = getLinkValue(all?.operator, all?.linking?.SCL);
|
|
34542
|
+
return operator ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
34543
|
+
title: operator,
|
|
34544
|
+
children: operator
|
|
34545
|
+
}) : '-';
|
|
34546
|
+
}
|
|
34547
|
+
}, {
|
|
34548
|
+
title: t("Last Update"),
|
|
34549
|
+
dataIndex: "updatedAt",
|
|
34550
|
+
key: "updatedAt",
|
|
34551
|
+
width: 125,
|
|
34552
|
+
render: (date, all) => {
|
|
34553
|
+
if (all.empty) {
|
|
34554
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34555
|
+
className: "daf-default-cell"
|
|
34556
|
+
});
|
|
34557
|
+
}
|
|
34558
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
34559
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
34560
|
+
title: _date,
|
|
34561
|
+
children: _date
|
|
34562
|
+
});
|
|
34563
|
+
},
|
|
34564
|
+
ellipsis: true
|
|
34565
|
+
}, {
|
|
34566
|
+
title: t("Status"),
|
|
34567
|
+
dataIndex: 'status',
|
|
34568
|
+
ellipsis: true,
|
|
34569
|
+
show: activeTab == "own",
|
|
34570
|
+
render: (v, all) => {
|
|
34571
|
+
if (all.empty) {
|
|
34572
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34573
|
+
className: "daf-default-cell"
|
|
34574
|
+
});
|
|
34575
|
+
}
|
|
34576
|
+
const status = findOptions(v, data?.options?.statusOptions);
|
|
34577
|
+
return status ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
34578
|
+
title: status,
|
|
34579
|
+
children: status
|
|
34580
|
+
}) : '-';
|
|
34581
|
+
}
|
|
34582
|
+
}, {
|
|
34583
|
+
id: 'actions',
|
|
34584
|
+
title: "",
|
|
34585
|
+
width: 60,
|
|
34586
|
+
render: (_, all) => {
|
|
34587
|
+
if (all.empty) {
|
|
34588
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34589
|
+
className: "daf-default-cell"
|
|
34590
|
+
});
|
|
34591
|
+
}
|
|
34592
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
34593
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34594
|
+
style: {
|
|
34595
|
+
display: "flex",
|
|
34596
|
+
justifyContent: "center"
|
|
34597
|
+
},
|
|
34598
|
+
children: /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
34599
|
+
href: getRedirectLink(link),
|
|
34600
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
34601
|
+
name: "Link",
|
|
34602
|
+
size: 15,
|
|
34603
|
+
color: theme.baseGray70
|
|
34604
|
+
})
|
|
34605
|
+
})
|
|
34606
|
+
});
|
|
34607
|
+
}
|
|
34608
|
+
}].filter(column => column.show !== false);
|
|
34609
|
+
|
|
34610
|
+
const checkboxConfig = {
|
|
34611
|
+
name: 'Name',
|
|
34612
|
+
datastakeId: 'ID'
|
|
34613
|
+
};
|
|
34614
|
+
const getFiltersConfig = ({
|
|
34615
|
+
t
|
|
34616
|
+
}) => {
|
|
34617
|
+
return {
|
|
34618
|
+
country: {
|
|
34619
|
+
type: 'select',
|
|
34620
|
+
label: 'Country',
|
|
34621
|
+
placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
34622
|
+
style: {
|
|
34623
|
+
flex: 1
|
|
34624
|
+
},
|
|
34625
|
+
labelStyle: {
|
|
34626
|
+
flex: 1
|
|
34627
|
+
},
|
|
34628
|
+
getLabel: option => option.label,
|
|
34629
|
+
getValue: option => option.value
|
|
34630
|
+
},
|
|
34631
|
+
administrativeLevel1: {
|
|
34632
|
+
type: 'ajaxSelect',
|
|
34633
|
+
label: ({
|
|
34634
|
+
t = s => s,
|
|
34635
|
+
options = {},
|
|
34636
|
+
filters = {},
|
|
34637
|
+
language = 'en'
|
|
34638
|
+
}) => {
|
|
34639
|
+
const {
|
|
34640
|
+
administrativeLevel1
|
|
34641
|
+
} = options;
|
|
34642
|
+
if (administrativeLevel1) {
|
|
34643
|
+
if (options.country) {
|
|
34644
|
+
const _item = administrativeLevel1[filters.country];
|
|
34645
|
+
if (_item) {
|
|
34646
|
+
if (_item[language]) {
|
|
34647
|
+
return _item[language];
|
|
34648
|
+
}
|
|
34649
|
+
}
|
|
34650
|
+
}
|
|
34651
|
+
}
|
|
34652
|
+
return t('Province');
|
|
34653
|
+
},
|
|
34654
|
+
placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
|
|
34655
|
+
filters: data => ({
|
|
34656
|
+
country: data.country,
|
|
34657
|
+
level: 'level_1'
|
|
34658
|
+
}),
|
|
34659
|
+
show: data => !data.country,
|
|
34660
|
+
disabled: data => !data.country,
|
|
34661
|
+
mapper: {
|
|
34662
|
+
label: "name",
|
|
34663
|
+
value: "id"
|
|
34664
|
+
},
|
|
34665
|
+
method: 'getOptions',
|
|
34666
|
+
entity: 'AdministrativeLevel',
|
|
34667
|
+
style: {
|
|
34668
|
+
flex: 1
|
|
34669
|
+
},
|
|
34670
|
+
labelStyle: {
|
|
34671
|
+
flex: 1
|
|
34672
|
+
}
|
|
34673
|
+
},
|
|
34674
|
+
administrativeLevel2: {
|
|
34675
|
+
type: 'ajaxSelect',
|
|
34676
|
+
label: ({
|
|
34677
|
+
t = s => s,
|
|
34678
|
+
options = {},
|
|
34679
|
+
filters = {},
|
|
34680
|
+
language = 'en'
|
|
34681
|
+
}) => {
|
|
34682
|
+
const {
|
|
34683
|
+
administrativeLevel2
|
|
34684
|
+
} = options;
|
|
34685
|
+
if (administrativeLevel2) {
|
|
34686
|
+
if (options.country) {
|
|
34687
|
+
const _item = administrativeLevel2[filters.country];
|
|
34688
|
+
if (_item) {
|
|
34689
|
+
if (_item[language]) {
|
|
34690
|
+
return _item[language];
|
|
34691
|
+
}
|
|
34692
|
+
}
|
|
34693
|
+
}
|
|
34694
|
+
}
|
|
34695
|
+
return t('Province');
|
|
34696
|
+
},
|
|
34697
|
+
show: data => !(data.country && data.administrativeLevel1),
|
|
34698
|
+
placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
|
|
34699
|
+
filters: data => ({
|
|
34700
|
+
country: data.country,
|
|
34701
|
+
level: 'level_2',
|
|
34702
|
+
administrativeLevel1: data.administrativeLevel1
|
|
34703
|
+
}),
|
|
34704
|
+
disabled: data => !(data.country && data.administrativeLevel1),
|
|
34705
|
+
mapper: {
|
|
34706
|
+
label: "name",
|
|
34707
|
+
value: "id"
|
|
34708
|
+
},
|
|
34709
|
+
method: 'getOptions',
|
|
34710
|
+
entity: 'AdministrativeLevel',
|
|
34711
|
+
style: {
|
|
34712
|
+
flex: 1
|
|
34713
|
+
},
|
|
34714
|
+
labelStyle: {
|
|
34715
|
+
flex: 1
|
|
34716
|
+
}
|
|
34717
|
+
},
|
|
34718
|
+
product: {
|
|
34719
|
+
type: 'select',
|
|
34720
|
+
label: 'Product',
|
|
34721
|
+
placeholder: t => `${t('Filter by')} ${t('Product').toLowerCase()}`,
|
|
34722
|
+
style: {
|
|
34723
|
+
flex: 1
|
|
34724
|
+
},
|
|
34725
|
+
labelStyle: {
|
|
34726
|
+
flex: 1
|
|
34727
|
+
},
|
|
34728
|
+
getLabel: option => option.label,
|
|
34729
|
+
getValue: option => option.value,
|
|
34730
|
+
filterOptions: val => {
|
|
34731
|
+
if (val) {
|
|
34732
|
+
const {
|
|
34733
|
+
option,
|
|
34734
|
+
filters
|
|
34735
|
+
} = val;
|
|
34736
|
+
if (filters && option) {
|
|
34737
|
+
const {
|
|
34738
|
+
filters: optionFilters
|
|
34739
|
+
} = option;
|
|
34740
|
+
if (Array.isArray(optionFilters) && optionFilters.length) {
|
|
34741
|
+
const {
|
|
34742
|
+
value,
|
|
34743
|
+
condition
|
|
34744
|
+
} = optionFilters[0];
|
|
34745
|
+
if (condition === 'includes') {
|
|
34746
|
+
return value.includes('corporation');
|
|
34747
|
+
}
|
|
34748
|
+
}
|
|
34749
|
+
}
|
|
34750
|
+
}
|
|
34751
|
+
return true;
|
|
34752
|
+
}
|
|
34753
|
+
},
|
|
34754
|
+
positionInTheMineralSupplyChain: {
|
|
34755
|
+
type: 'select',
|
|
34756
|
+
label: 'Position',
|
|
34757
|
+
placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
|
|
34758
|
+
style: {
|
|
34759
|
+
flex: 1
|
|
34760
|
+
},
|
|
34761
|
+
labelStyle: {
|
|
34762
|
+
flex: 1
|
|
34763
|
+
},
|
|
34764
|
+
getLabel: option => option.label,
|
|
34765
|
+
getValue: option => option.value
|
|
34766
|
+
},
|
|
34767
|
+
status: {
|
|
34768
|
+
type: "select",
|
|
34769
|
+
label: "Status",
|
|
34770
|
+
placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
34771
|
+
style: {
|
|
34772
|
+
flex: 1
|
|
34773
|
+
},
|
|
34774
|
+
labelStyle: {
|
|
34775
|
+
fley: 1
|
|
34776
|
+
},
|
|
34777
|
+
getLabel: option => option.label,
|
|
34778
|
+
getValue: option => option.value
|
|
34779
|
+
}
|
|
34780
|
+
};
|
|
34781
|
+
};
|
|
34782
|
+
const filtersConfig = {
|
|
34783
|
+
name: '',
|
|
34784
|
+
datastakeId: ''
|
|
34785
|
+
};
|
|
34786
|
+
const getFilterOptions = (options, t) => {
|
|
34787
|
+
const {
|
|
34788
|
+
statusOptions = [],
|
|
34789
|
+
categoryOptions = [],
|
|
34790
|
+
countries = [],
|
|
34791
|
+
product = [],
|
|
34792
|
+
subCategory = [],
|
|
34793
|
+
subCategoriesOptions,
|
|
34794
|
+
stakeholderCategoryOptions,
|
|
34795
|
+
stakeholderSubCategoriesOptions,
|
|
34796
|
+
administrativeLevel1,
|
|
34797
|
+
administrativeLevel2
|
|
34798
|
+
} = options || {};
|
|
34799
|
+
console.log({
|
|
34800
|
+
options
|
|
34801
|
+
});
|
|
34802
|
+
const _default = {
|
|
34803
|
+
category: stakeholderCategoryOptions || categoryOptions,
|
|
34804
|
+
country: countries,
|
|
34805
|
+
product: product,
|
|
34806
|
+
administrativeLevel1,
|
|
34807
|
+
administrativeLevel2,
|
|
34808
|
+
subCategory: subCategoriesOptions,
|
|
34809
|
+
status: [{
|
|
34810
|
+
value: "submitted",
|
|
34811
|
+
label: "Submitted"
|
|
34812
|
+
}, {
|
|
34813
|
+
value: "private",
|
|
34814
|
+
label: "Private"
|
|
34815
|
+
}]
|
|
34816
|
+
};
|
|
34817
|
+
return _default;
|
|
34818
|
+
};
|
|
34819
|
+
|
|
34820
|
+
const ProductionSitesCreate = ({
|
|
34821
|
+
namespace = "PRODUCTION SITES",
|
|
34822
|
+
view = ['scoping', 'new'],
|
|
34823
|
+
edit = false,
|
|
34824
|
+
formData = {},
|
|
34825
|
+
loading = false,
|
|
34826
|
+
onSubmitted = () => {},
|
|
34827
|
+
onCancel = () => {},
|
|
34828
|
+
getData = () => {},
|
|
34829
|
+
saveData = () => {},
|
|
34830
|
+
form: formConfig = {},
|
|
34831
|
+
formValue = {},
|
|
34832
|
+
defaultData = {},
|
|
34833
|
+
user = {},
|
|
34834
|
+
APP,
|
|
34835
|
+
query,
|
|
34836
|
+
goTo = () => {},
|
|
34837
|
+
t = () => {},
|
|
34838
|
+
ajaxForms = {},
|
|
34839
|
+
changeAjaxForms = () => {},
|
|
34840
|
+
ajaxOptions = {},
|
|
34841
|
+
changeAjaxOptions = () => {},
|
|
34842
|
+
getAppHeader = () => {},
|
|
34843
|
+
getApiBaseUrl = () => {}
|
|
34844
|
+
}) => {
|
|
34845
|
+
let {
|
|
34846
|
+
form = {},
|
|
34847
|
+
data = defaultData || {}
|
|
34848
|
+
} = !edit ? formData[`${APP}-${view}`] || {} : {
|
|
34849
|
+
form: formConfig,
|
|
34850
|
+
data: formValue
|
|
34851
|
+
};
|
|
34852
|
+
React.useEffect(() => {
|
|
34853
|
+
if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
|
|
34854
|
+
if (!edit) {
|
|
34855
|
+
getData({
|
|
34856
|
+
namespace,
|
|
34857
|
+
module: APP,
|
|
34858
|
+
view,
|
|
34859
|
+
scope: 'global'
|
|
34860
|
+
});
|
|
34861
|
+
} else {
|
|
34862
|
+
form = formConfig;
|
|
34863
|
+
data = formValue;
|
|
34864
|
+
}
|
|
34865
|
+
}
|
|
34866
|
+
}, [edit, user?.language]);
|
|
34867
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34868
|
+
className: "daf-create-form",
|
|
34869
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
|
|
34870
|
+
form: form,
|
|
34871
|
+
data: {
|
|
34872
|
+
...defaultData,
|
|
34873
|
+
...data
|
|
34874
|
+
},
|
|
34875
|
+
showSaveAndNext: false,
|
|
34876
|
+
module: APP,
|
|
34877
|
+
onCancel: onCancel,
|
|
34878
|
+
isCreate: true,
|
|
34879
|
+
t: t,
|
|
34880
|
+
excludedKeys: ["title"],
|
|
34881
|
+
user: user,
|
|
34882
|
+
ajaxForms: ajaxForms,
|
|
34883
|
+
ajaxOptions: ajaxOptions,
|
|
34884
|
+
getAppHeader: getAppHeader,
|
|
34885
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
34886
|
+
changeAjaxOptions: changeAjaxOptions,
|
|
34887
|
+
app: APP,
|
|
34888
|
+
query: query,
|
|
34889
|
+
goTo: goTo,
|
|
34890
|
+
changeAjaxForms: changeAjaxForms,
|
|
34891
|
+
submit: (payload, setSelectedFormNext) => {
|
|
34892
|
+
const payloadData = {
|
|
34893
|
+
...payload,
|
|
34894
|
+
module: APP,
|
|
34895
|
+
namespace
|
|
34896
|
+
};
|
|
34897
|
+
const newPayload = {
|
|
34898
|
+
...defaultData,
|
|
34899
|
+
...payloadData,
|
|
34900
|
+
form: 'production-sites'
|
|
34901
|
+
};
|
|
34902
|
+
const callback = (type, m, data) => {
|
|
34903
|
+
if (setSelectedFormNext) {
|
|
34904
|
+
setSelectedFormNext();
|
|
34905
|
+
}
|
|
34906
|
+
if (type === MessageTypes.SUCCESS) {
|
|
34907
|
+
if (onSubmitted) onSubmitted(type, m, data);
|
|
34908
|
+
} else {
|
|
34909
|
+
antd.message.error(m);
|
|
34910
|
+
}
|
|
34911
|
+
};
|
|
34912
|
+
saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
|
|
34913
|
+
id: data.id
|
|
34914
|
+
}), callback);
|
|
34915
|
+
},
|
|
34916
|
+
isFormDisabled: () => {
|
|
34917
|
+
return !data || !data.typeOfEvent;
|
|
34918
|
+
}
|
|
34919
|
+
})
|
|
34920
|
+
});
|
|
34921
|
+
};
|
|
34922
|
+
|
|
34923
|
+
const ProductionSitesTable = ({
|
|
34924
|
+
t = () => {},
|
|
34925
|
+
goTo = () => {},
|
|
34926
|
+
user = {},
|
|
34927
|
+
options = {},
|
|
34928
|
+
getRedirectLink = () => {},
|
|
34929
|
+
theme = {},
|
|
34930
|
+
loading = false,
|
|
34931
|
+
data = {},
|
|
34932
|
+
isMobile,
|
|
34933
|
+
APP,
|
|
34934
|
+
location,
|
|
34935
|
+
getData = () => {},
|
|
34936
|
+
getApiBaseUrl = () => {},
|
|
34937
|
+
getAppHeader = () => {},
|
|
34938
|
+
getFormData = () => {},
|
|
34939
|
+
saveFormData = () => {},
|
|
34940
|
+
formLoading = false,
|
|
34941
|
+
query = {},
|
|
34942
|
+
ajaxForms = {},
|
|
34943
|
+
changeAjaxForms = () => {},
|
|
34944
|
+
ajaxOptions = {},
|
|
34945
|
+
changeAjaxOptions = () => {},
|
|
34946
|
+
formData = {},
|
|
34947
|
+
formValue = {},
|
|
34948
|
+
form = {},
|
|
34949
|
+
extendingFilters = {},
|
|
34950
|
+
createDefaultValues = {}
|
|
34951
|
+
}) => {
|
|
34952
|
+
const [selectOptions, setSelectOptions] = React.useState();
|
|
34953
|
+
const [activeTab, setActiveTab] = React.useState();
|
|
34954
|
+
const columns = React.useMemo(() => getColumns({
|
|
34955
|
+
t,
|
|
34956
|
+
goTo,
|
|
34957
|
+
user,
|
|
34958
|
+
options,
|
|
34959
|
+
activeTab,
|
|
34960
|
+
getRedirectLink,
|
|
34961
|
+
theme,
|
|
34962
|
+
subject: 'production-sites',
|
|
34963
|
+
data
|
|
34964
|
+
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
|
|
34965
|
+
const breadCrumbs = [];
|
|
34966
|
+
const {
|
|
34967
|
+
paginationQuery,
|
|
34968
|
+
searchParams,
|
|
34969
|
+
otherParams,
|
|
34970
|
+
sortBy,
|
|
34971
|
+
sortDir
|
|
34972
|
+
} = useGetQueryParams({
|
|
34973
|
+
location
|
|
34974
|
+
});
|
|
34975
|
+
React.useMemo(() => {
|
|
34976
|
+
return {
|
|
34977
|
+
...otherParams,
|
|
34978
|
+
...extendingFilters
|
|
34979
|
+
};
|
|
34980
|
+
}, [otherParams, extendingFilters]);
|
|
34981
|
+
React.useEffect(() => {
|
|
34982
|
+
getData({
|
|
34983
|
+
pagination: paginationQuery,
|
|
34984
|
+
...(Object.keys(searchParams).length > 0 && {
|
|
34985
|
+
search: searchParams
|
|
34986
|
+
}),
|
|
34987
|
+
...otherParams,
|
|
34988
|
+
tab: activeTab,
|
|
34989
|
+
sortBy: {
|
|
34990
|
+
[sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
|
|
34991
|
+
},
|
|
34992
|
+
...extendingFilters
|
|
34993
|
+
}, 'production-sites');
|
|
34994
|
+
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
34995
|
+
const selectFiltersConfig = React.useMemo(() => {
|
|
34996
|
+
return getFiltersConfig({
|
|
34997
|
+
t
|
|
34998
|
+
});
|
|
34999
|
+
}, [t]);
|
|
35000
|
+
React.useEffect(() => {
|
|
35001
|
+
setSelectOptions(prev => ({
|
|
35002
|
+
...prev,
|
|
35003
|
+
...getFilterOptions(options)
|
|
35004
|
+
}));
|
|
35005
|
+
}, [options, t]);
|
|
35006
|
+
const handleActiveTabChange = React.useCallback(value => {
|
|
35007
|
+
setActiveTab(value);
|
|
35008
|
+
}, []);
|
|
35009
|
+
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
35010
|
+
t: t,
|
|
35011
|
+
title: t("production-sites"),
|
|
35012
|
+
breadCrumbs: breadCrumbs,
|
|
35013
|
+
location: location,
|
|
35014
|
+
loading: loading,
|
|
35015
|
+
goTo: goTo,
|
|
35016
|
+
defaultActiveTab: "all",
|
|
35017
|
+
columns: columns,
|
|
35018
|
+
data: data,
|
|
35019
|
+
checkboxConfig: checkboxConfig,
|
|
35020
|
+
APP: APP,
|
|
35021
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
35022
|
+
selectOptions: selectOptions,
|
|
35023
|
+
selectFiltersConfig: selectFiltersConfig,
|
|
35024
|
+
getRedirectLink: getRedirectLink,
|
|
35025
|
+
filtersConfig: filtersConfig,
|
|
35026
|
+
isMobile: isMobile,
|
|
35027
|
+
view: "production-sites",
|
|
35028
|
+
getActiveTab: handleActiveTabChange,
|
|
35029
|
+
onDownload: () => {
|
|
35030
|
+
console.log("download");
|
|
35031
|
+
},
|
|
35032
|
+
drawerTitle: t("Create Production Site"),
|
|
35033
|
+
children: ({
|
|
35034
|
+
onDrawerClose
|
|
35035
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(ProductionSitesCreate, {
|
|
35036
|
+
defaultData: createDefaultValues,
|
|
35037
|
+
t: t,
|
|
35038
|
+
goTo: goTo,
|
|
35039
|
+
user: user,
|
|
35040
|
+
APP: APP,
|
|
35041
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
35042
|
+
getAppHeader: getAppHeader,
|
|
35043
|
+
getData: getFormData,
|
|
35044
|
+
saveData: saveFormData,
|
|
35045
|
+
loading: formLoading,
|
|
35046
|
+
onSubmitted: (type, m, data) => {
|
|
35047
|
+
if (data.datastakeId) {
|
|
35048
|
+
displayMessage(type, t("affirmations::subject-created-successfully") || m);
|
|
35049
|
+
// goTo(`/app/edit/stakeholders/${data.datastakeId}`);
|
|
35050
|
+
goTo(`/app/edit/production-sites/${data.datastakeId}`);
|
|
35051
|
+
}
|
|
35052
|
+
},
|
|
35053
|
+
onCancel: onDrawerClose,
|
|
35054
|
+
query: query,
|
|
35055
|
+
ajaxForms: ajaxForms,
|
|
35056
|
+
changeAjaxForms: changeAjaxForms,
|
|
35057
|
+
ajaxOptions: ajaxOptions,
|
|
35058
|
+
changeAjaxOptions: changeAjaxOptions,
|
|
35059
|
+
formData: formData,
|
|
35060
|
+
formValue: formValue,
|
|
35061
|
+
form: form
|
|
35062
|
+
})
|
|
35063
|
+
});
|
|
35064
|
+
};
|
|
35065
|
+
|
|
33485
35066
|
exports.ActivitiesTable = ActivitiesTable;
|
|
33486
35067
|
exports.DocumentsTable = DocumentsTable;
|
|
33487
35068
|
exports.EventsTable = EventsTable;
|
|
35069
|
+
exports.IncidentsTable = IncidentsTable;
|
|
33488
35070
|
exports.LocationsTable = LocationsTable;
|
|
33489
35071
|
exports.OperatorsTable = OperatorsTable;
|
|
35072
|
+
exports.ProductionSitesTable = ProductionSitesTable;
|
|
33490
35073
|
exports.StakeholdersTable = StakeholdersTable;
|
|
33491
35074
|
exports.SupplyChainDashboard = SupplyChain;
|
|
33492
35075
|
exports.TablePageWithTabs = TablePageWithTabs;
|