datastake-daf 0.6.732 → 0.6.734
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/hooks/index.js +1 -1
- package/dist/pages/index.js +500 -40
- package/dist/services/index.js +1 -1
- package/package.json +1 -1
- package/src/@daf/core/components/DynamicForm/storyConfig.js +192 -264
- package/src/@daf/hooks/useWidgetFetch.js +1 -1
- package/src/@daf/pages/dashboards/AllInformation/Locations/columns.js +150 -0
- package/src/@daf/pages/dashboards/AllInformation/Locations/config.js +31 -0
- package/src/@daf/pages/dashboards/AllInformation/Locations/create.jsx +104 -0
- package/src/@daf/pages/dashboards/AllInformation/Locations/index.jsx +143 -0
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/columns.js +4 -4
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/create.jsx +2 -0
- package/src/@daf/pages/dashboards/AllInformation/Stakeholders/index.jsx +2 -5
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/components/Identification/index.js +2 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/TradeRelationships/index.js +1 -1
- package/src/@daf/pages/dashboards/UserDashboard/components/MineSites/index.jsx +3 -0
- package/src/@daf/pages/dashboards/helper.js +6 -5
- package/src/@daf/services/LinkedSubjects.js +1 -1
- package/src/pages.js +2 -1
package/dist/hooks/index.js
CHANGED
package/dist/pages/index.js
CHANGED
|
@@ -6788,7 +6788,7 @@ const useWidgetFetch = ({
|
|
|
6788
6788
|
};
|
|
6789
6789
|
React.useEffect(() => {
|
|
6790
6790
|
fetchData();
|
|
6791
|
-
}, []);
|
|
6791
|
+
}, [config]);
|
|
6792
6792
|
return {
|
|
6793
6793
|
data,
|
|
6794
6794
|
loading,
|
|
@@ -11990,30 +11990,32 @@ const mapIcon = category => {
|
|
|
11990
11990
|
};
|
|
11991
11991
|
const leftBackground = theme.colorPrimary3;
|
|
11992
11992
|
const rightBackground = theme.colorPrimary6;
|
|
11993
|
-
const mapDataForChainOfCustody = (data = {}, options =
|
|
11993
|
+
const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
|
|
11994
11994
|
const mapChildren = (items, type, parentId, isDirect = true) => {
|
|
11995
|
-
return (items ?? []).map(item =>
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
11995
|
+
return (items ?? []).map(item => {
|
|
11996
|
+
return {
|
|
11997
|
+
id: item.id,
|
|
11998
|
+
number: 0,
|
|
11999
|
+
name: item.name,
|
|
12000
|
+
sources: parentId ? [parentId] : [],
|
|
12001
|
+
subTitle: findOptions(item?.category, options?.categoriesOptions),
|
|
12002
|
+
leftIcon: type === "client" ? rightIcon : leftIcon,
|
|
12003
|
+
leftBackground: type === "client" ? rightBackground : leftBackground,
|
|
12004
|
+
topIcon: mapIcon(item.category),
|
|
12005
|
+
children: mapChildren(item.sources ?? item.clients ?? [], type, item.id, false),
|
|
12006
|
+
onClick: () => {
|
|
12007
|
+
if (isDirect && parentId === data.id) {
|
|
12008
|
+
goTo(`/app/partners?datastakeId=${item.id}`);
|
|
12009
|
+
}
|
|
12008
12010
|
}
|
|
12009
|
-
}
|
|
12010
|
-
})
|
|
12011
|
+
};
|
|
12012
|
+
});
|
|
12011
12013
|
};
|
|
12012
12014
|
return {
|
|
12013
12015
|
id: data.id,
|
|
12014
12016
|
number: 0,
|
|
12015
12017
|
name: data.name,
|
|
12016
|
-
subTitle: findOptions(data
|
|
12018
|
+
subTitle: findOptions(data?.category, options?.categoriesOptions),
|
|
12017
12019
|
leftIcon: middleIcon,
|
|
12018
12020
|
leftBackground: theme.colorPrimary10,
|
|
12019
12021
|
topIcon: mapIcon(data.category),
|
|
@@ -12044,7 +12046,7 @@ function TradeRelationships({
|
|
|
12044
12046
|
} = useWidgetFetch({
|
|
12045
12047
|
config: fetchConfig
|
|
12046
12048
|
});
|
|
12047
|
-
const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options
|
|
12049
|
+
const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options, goTo);
|
|
12048
12050
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
12049
12051
|
loading: loading,
|
|
12050
12052
|
title: t("Trade Relationships"),
|
|
@@ -12430,6 +12432,9 @@ function Identification({
|
|
|
12430
12432
|
label: t("Monthly"),
|
|
12431
12433
|
value: "monthly"
|
|
12432
12434
|
}], [t]);
|
|
12435
|
+
console.log({
|
|
12436
|
+
identificationData: data
|
|
12437
|
+
});
|
|
12433
12438
|
const chartConfig = useIdentification({
|
|
12434
12439
|
data,
|
|
12435
12440
|
theme,
|
|
@@ -13518,7 +13523,7 @@ const getTabs = t => {
|
|
|
13518
13523
|
label: t("Events")
|
|
13519
13524
|
}];
|
|
13520
13525
|
};
|
|
13521
|
-
const getFiltersConfig$
|
|
13526
|
+
const getFiltersConfig$2 = (t, filters, locationCategories) => {
|
|
13522
13527
|
const value = filters.type ? {
|
|
13523
13528
|
value: filters.type
|
|
13524
13529
|
} : {};
|
|
@@ -13713,6 +13718,12 @@ function MineSites({
|
|
|
13713
13718
|
defaultData: [],
|
|
13714
13719
|
stop: selectedPartners?.loading
|
|
13715
13720
|
}), [activeTab, selectedPartners]);
|
|
13721
|
+
console.log({
|
|
13722
|
+
activeTab
|
|
13723
|
+
});
|
|
13724
|
+
console.log({
|
|
13725
|
+
dataFetchConfig
|
|
13726
|
+
});
|
|
13716
13727
|
const {
|
|
13717
13728
|
data,
|
|
13718
13729
|
loading,
|
|
@@ -13721,7 +13732,7 @@ function MineSites({
|
|
|
13721
13732
|
config: dataFetchConfig
|
|
13722
13733
|
});
|
|
13723
13734
|
const tabs = React.useMemo(() => getTabs(t), [t]);
|
|
13724
|
-
const filtersConfig = React.useMemo(() => getFiltersConfig$
|
|
13735
|
+
const filtersConfig = React.useMemo(() => getFiltersConfig$2(t, filters, locationCategories), [activeTab, filters, t, locationCategories]);
|
|
13725
13736
|
const onFilterChange = filters => {
|
|
13726
13737
|
setFilters(p => ({
|
|
13727
13738
|
...p,
|
|
@@ -15957,7 +15968,7 @@ function AvatarGroup({
|
|
|
15957
15968
|
});
|
|
15958
15969
|
}
|
|
15959
15970
|
|
|
15960
|
-
const getColumns = ({
|
|
15971
|
+
const getColumns$1 = ({
|
|
15961
15972
|
t,
|
|
15962
15973
|
goTo,
|
|
15963
15974
|
user,
|
|
@@ -16050,9 +16061,9 @@ const getColumns = ({
|
|
|
16050
16061
|
}) : '-';
|
|
16051
16062
|
}
|
|
16052
16063
|
}, {
|
|
16053
|
-
title: t("
|
|
16054
|
-
dataIndex: "
|
|
16055
|
-
key: "
|
|
16064
|
+
title: t("Last Update"),
|
|
16065
|
+
dataIndex: "updatedAt",
|
|
16066
|
+
key: "updatedAt",
|
|
16056
16067
|
width: 125,
|
|
16057
16068
|
render: (date, all) => {
|
|
16058
16069
|
if (all.empty) {
|
|
@@ -16113,11 +16124,11 @@ const getColumns = ({
|
|
|
16113
16124
|
}
|
|
16114
16125
|
}].filter(column => column.show !== false);
|
|
16115
16126
|
|
|
16116
|
-
const checkboxConfig = {
|
|
16127
|
+
const checkboxConfig$1 = {
|
|
16117
16128
|
name: 'Name',
|
|
16118
16129
|
datastakeId: 'ID'
|
|
16119
16130
|
};
|
|
16120
|
-
const getFiltersConfig = ({
|
|
16131
|
+
const getFiltersConfig$1 = ({
|
|
16121
16132
|
t
|
|
16122
16133
|
}) => {
|
|
16123
16134
|
return {
|
|
@@ -16135,11 +16146,11 @@ const getFiltersConfig = ({
|
|
|
16135
16146
|
}
|
|
16136
16147
|
};
|
|
16137
16148
|
};
|
|
16138
|
-
const filtersConfig = {
|
|
16149
|
+
const filtersConfig$1 = {
|
|
16139
16150
|
name: '',
|
|
16140
16151
|
datastakeId: ''
|
|
16141
16152
|
};
|
|
16142
|
-
const getFilterOptions = (options, t) => {
|
|
16153
|
+
const getFilterOptions$1 = (options, t) => {
|
|
16143
16154
|
const {
|
|
16144
16155
|
countries
|
|
16145
16156
|
} = options || {};
|
|
@@ -29848,7 +29859,7 @@ function DynamicForm({
|
|
|
29848
29859
|
});
|
|
29849
29860
|
}
|
|
29850
29861
|
|
|
29851
|
-
const StakeholdersCreate = ({
|
|
29862
|
+
const StakeholdersCreate$1 = ({
|
|
29852
29863
|
namespace = 'stakeholders',
|
|
29853
29864
|
view = 'scoping',
|
|
29854
29865
|
edit = false,
|
|
@@ -29924,7 +29935,8 @@ const StakeholdersCreate = ({
|
|
|
29924
29935
|
};
|
|
29925
29936
|
const newPayload = {
|
|
29926
29937
|
...defaultData,
|
|
29927
|
-
...payloadData
|
|
29938
|
+
...payloadData,
|
|
29939
|
+
form: 'stakeholder'
|
|
29928
29940
|
};
|
|
29929
29941
|
const callback = (type, m, data) => {
|
|
29930
29942
|
if (setSelectedFormNext) {
|
|
@@ -29976,7 +29988,7 @@ const StakeholdersTable = ({
|
|
|
29976
29988
|
}) => {
|
|
29977
29989
|
const [selectOptions, setSelectOptions] = React.useState();
|
|
29978
29990
|
const [activeTab, setActiveTab] = React.useState();
|
|
29979
|
-
const columns = React.useMemo(() => getColumns({
|
|
29991
|
+
const columns = React.useMemo(() => getColumns$1({
|
|
29980
29992
|
t,
|
|
29981
29993
|
goTo,
|
|
29982
29994
|
user,
|
|
@@ -29984,7 +29996,7 @@ const StakeholdersTable = ({
|
|
|
29984
29996
|
activeTab,
|
|
29985
29997
|
getRedirectLink,
|
|
29986
29998
|
theme,
|
|
29987
|
-
subject: '
|
|
29999
|
+
subject: 'stakeholders'
|
|
29988
30000
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme]);
|
|
29989
30001
|
const breadCrumbs = [];
|
|
29990
30002
|
const {
|
|
@@ -30006,6 +30018,455 @@ const StakeholdersTable = ({
|
|
|
30006
30018
|
tab: activeTab
|
|
30007
30019
|
}, 'stakeholders');
|
|
30008
30020
|
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
30021
|
+
const selectFiltersConfig = React.useMemo(() => {
|
|
30022
|
+
return getFiltersConfig$1({
|
|
30023
|
+
t
|
|
30024
|
+
});
|
|
30025
|
+
}, [t]);
|
|
30026
|
+
React.useEffect(() => {
|
|
30027
|
+
setSelectOptions(prev => ({
|
|
30028
|
+
...prev,
|
|
30029
|
+
...getFilterOptions$1(options)
|
|
30030
|
+
}));
|
|
30031
|
+
}, [options, t]);
|
|
30032
|
+
const handleActiveTabChange = React.useCallback(value => {
|
|
30033
|
+
setActiveTab(value);
|
|
30034
|
+
}, []);
|
|
30035
|
+
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
30036
|
+
t: t,
|
|
30037
|
+
title: t("Stakeholders"),
|
|
30038
|
+
breadCrumbs: breadCrumbs,
|
|
30039
|
+
location: location,
|
|
30040
|
+
loading: loading,
|
|
30041
|
+
goTo: goTo,
|
|
30042
|
+
defaultActiveTab: "all",
|
|
30043
|
+
columns: columns,
|
|
30044
|
+
data: data,
|
|
30045
|
+
checkboxConfig: checkboxConfig$1,
|
|
30046
|
+
APP: APP,
|
|
30047
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
30048
|
+
selectOptions: selectOptions,
|
|
30049
|
+
selectFiltersConfig: selectFiltersConfig,
|
|
30050
|
+
getRedirectLink: getRedirectLink,
|
|
30051
|
+
filtersConfig: filtersConfig$1,
|
|
30052
|
+
isMobile: isMobile,
|
|
30053
|
+
view: "stakeholders",
|
|
30054
|
+
getActiveTab: handleActiveTabChange,
|
|
30055
|
+
onDownload: () => {
|
|
30056
|
+
console.log("download");
|
|
30057
|
+
},
|
|
30058
|
+
drawerTitle: t("Create Stakeholder"),
|
|
30059
|
+
children: ({
|
|
30060
|
+
onDrawerClose
|
|
30061
|
+
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$1, {
|
|
30062
|
+
t: t,
|
|
30063
|
+
goTo: goTo,
|
|
30064
|
+
user: user,
|
|
30065
|
+
APP: APP,
|
|
30066
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
30067
|
+
getAppHeader: getAppHeader,
|
|
30068
|
+
getData: getFormData,
|
|
30069
|
+
saveData: saveFormData,
|
|
30070
|
+
loading: formLoading,
|
|
30071
|
+
onSubmitted: (type, m, data) => {
|
|
30072
|
+
if (data.datastakeId) {
|
|
30073
|
+
displayMessage(type, t("affirmations::subject-created-successfully") || m);
|
|
30074
|
+
goTo(`/app/stakeholders`);
|
|
30075
|
+
}
|
|
30076
|
+
},
|
|
30077
|
+
onCancel: onDrawerClose,
|
|
30078
|
+
query: query,
|
|
30079
|
+
ajaxForms: ajaxForms,
|
|
30080
|
+
changeAjaxForms: changeAjaxForms,
|
|
30081
|
+
ajaxOptions: ajaxOptions,
|
|
30082
|
+
changeAjaxOptions: changeAjaxOptions,
|
|
30083
|
+
formData: formData,
|
|
30084
|
+
formValue: formValue,
|
|
30085
|
+
form: form
|
|
30086
|
+
})
|
|
30087
|
+
});
|
|
30088
|
+
};
|
|
30089
|
+
|
|
30090
|
+
const getLinkValue = (value, linkingObject) => {
|
|
30091
|
+
if (linkingObject && linkingObject?.[value]) {
|
|
30092
|
+
return linkingObject?.[value]?.name;
|
|
30093
|
+
}
|
|
30094
|
+
return null;
|
|
30095
|
+
};
|
|
30096
|
+
const getColumns = ({
|
|
30097
|
+
t,
|
|
30098
|
+
goTo,
|
|
30099
|
+
user,
|
|
30100
|
+
options,
|
|
30101
|
+
activeTab,
|
|
30102
|
+
getRedirectLink,
|
|
30103
|
+
theme,
|
|
30104
|
+
subject,
|
|
30105
|
+
data
|
|
30106
|
+
}) => [{
|
|
30107
|
+
dataIndex: 'datastakeId',
|
|
30108
|
+
title: t('ID'),
|
|
30109
|
+
ellipsis: true,
|
|
30110
|
+
show: true,
|
|
30111
|
+
render: (v, all) => {
|
|
30112
|
+
if (all.empty) {
|
|
30113
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30114
|
+
className: "daf-default-cell"
|
|
30115
|
+
});
|
|
30116
|
+
}
|
|
30117
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30118
|
+
title: v,
|
|
30119
|
+
children: v
|
|
30120
|
+
});
|
|
30121
|
+
}
|
|
30122
|
+
}, {
|
|
30123
|
+
dataIndex: 'name',
|
|
30124
|
+
title: t('Name'),
|
|
30125
|
+
ellipsis: true,
|
|
30126
|
+
show: true,
|
|
30127
|
+
render: (v, all) => {
|
|
30128
|
+
if (all.empty) {
|
|
30129
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30130
|
+
className: "daf-default-cell"
|
|
30131
|
+
});
|
|
30132
|
+
}
|
|
30133
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30134
|
+
title: v,
|
|
30135
|
+
children: v
|
|
30136
|
+
});
|
|
30137
|
+
}
|
|
30138
|
+
}, {
|
|
30139
|
+
dataIndex: 'category',
|
|
30140
|
+
title: t('Category'),
|
|
30141
|
+
ellipsis: true,
|
|
30142
|
+
show: true,
|
|
30143
|
+
render: (v, all) => {
|
|
30144
|
+
if (all.empty) {
|
|
30145
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30146
|
+
className: "daf-default-cell"
|
|
30147
|
+
});
|
|
30148
|
+
}
|
|
30149
|
+
const category = findOptions(v, data?.options?.locationCategories);
|
|
30150
|
+
return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30151
|
+
title: category,
|
|
30152
|
+
children: category
|
|
30153
|
+
}) : '-';
|
|
30154
|
+
}
|
|
30155
|
+
}, {
|
|
30156
|
+
dataIndex: 'country',
|
|
30157
|
+
title: t('Country'),
|
|
30158
|
+
ellipsis: true,
|
|
30159
|
+
show: true,
|
|
30160
|
+
render: (v, all) => {
|
|
30161
|
+
if (all.empty) {
|
|
30162
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30163
|
+
className: "daf-default-cell"
|
|
30164
|
+
});
|
|
30165
|
+
}
|
|
30166
|
+
const country = findOptions(v, options?.countries);
|
|
30167
|
+
return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30168
|
+
title: country,
|
|
30169
|
+
children: country
|
|
30170
|
+
}) : '-';
|
|
30171
|
+
}
|
|
30172
|
+
}, {
|
|
30173
|
+
dataIndex: 'administrativeLevel1',
|
|
30174
|
+
title: t('Region'),
|
|
30175
|
+
ellipsis: true,
|
|
30176
|
+
show: true,
|
|
30177
|
+
render: (v, all) => {
|
|
30178
|
+
if (all.empty) {
|
|
30179
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30180
|
+
className: "daf-default-cell"
|
|
30181
|
+
});
|
|
30182
|
+
}
|
|
30183
|
+
const region = getLinkValue(v, all?.linking?.SCL);
|
|
30184
|
+
return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30185
|
+
title: region,
|
|
30186
|
+
children: region
|
|
30187
|
+
}) : '-';
|
|
30188
|
+
}
|
|
30189
|
+
}, {
|
|
30190
|
+
dataIndex: 'administrativeLevel2',
|
|
30191
|
+
title: t('District'),
|
|
30192
|
+
ellipsis: true,
|
|
30193
|
+
show: true,
|
|
30194
|
+
render: (v, all) => {
|
|
30195
|
+
if (all.empty) {
|
|
30196
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30197
|
+
className: "daf-default-cell"
|
|
30198
|
+
});
|
|
30199
|
+
}
|
|
30200
|
+
const district = getLinkValue(v, all?.linking?.SCL);
|
|
30201
|
+
return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30202
|
+
title: district,
|
|
30203
|
+
children: district
|
|
30204
|
+
}) : '-';
|
|
30205
|
+
}
|
|
30206
|
+
}, {
|
|
30207
|
+
title: t("Last Update"),
|
|
30208
|
+
dataIndex: "updatedAt",
|
|
30209
|
+
key: "updatedAt",
|
|
30210
|
+
width: 125,
|
|
30211
|
+
render: (date, all) => {
|
|
30212
|
+
if (all.empty) {
|
|
30213
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30214
|
+
className: "daf-default-cell"
|
|
30215
|
+
});
|
|
30216
|
+
}
|
|
30217
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
30218
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
30219
|
+
title: _date,
|
|
30220
|
+
children: _date
|
|
30221
|
+
});
|
|
30222
|
+
},
|
|
30223
|
+
ellipsis: true
|
|
30224
|
+
}, {
|
|
30225
|
+
title: t("Sources"),
|
|
30226
|
+
dataIndex: "sources",
|
|
30227
|
+
key: "sources",
|
|
30228
|
+
show: activeTab !== "own",
|
|
30229
|
+
render: (val, all) => {
|
|
30230
|
+
if (all.empty) {
|
|
30231
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30232
|
+
className: "daf-default-cell"
|
|
30233
|
+
});
|
|
30234
|
+
}
|
|
30235
|
+
console.log({
|
|
30236
|
+
val,
|
|
30237
|
+
all
|
|
30238
|
+
});
|
|
30239
|
+
return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
|
|
30240
|
+
items: val
|
|
30241
|
+
});
|
|
30242
|
+
}
|
|
30243
|
+
}, {
|
|
30244
|
+
id: 'actions',
|
|
30245
|
+
title: "",
|
|
30246
|
+
width: 60,
|
|
30247
|
+
render: (_, all) => {
|
|
30248
|
+
if (all.empty) {
|
|
30249
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30250
|
+
className: "daf-default-cell"
|
|
30251
|
+
});
|
|
30252
|
+
}
|
|
30253
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
30254
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30255
|
+
style: {
|
|
30256
|
+
display: "flex",
|
|
30257
|
+
justifyContent: "center"
|
|
30258
|
+
},
|
|
30259
|
+
children: /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
30260
|
+
href: getRedirectLink(link),
|
|
30261
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
30262
|
+
name: "Link",
|
|
30263
|
+
size: 15,
|
|
30264
|
+
color: theme.baseGray70
|
|
30265
|
+
})
|
|
30266
|
+
})
|
|
30267
|
+
});
|
|
30268
|
+
}
|
|
30269
|
+
}].filter(column => column.show !== false);
|
|
30270
|
+
|
|
30271
|
+
const checkboxConfig = {
|
|
30272
|
+
name: 'Name',
|
|
30273
|
+
datastakeId: 'ID'
|
|
30274
|
+
};
|
|
30275
|
+
const getFiltersConfig = ({
|
|
30276
|
+
t
|
|
30277
|
+
}) => {
|
|
30278
|
+
return {
|
|
30279
|
+
country: {
|
|
30280
|
+
type: 'select',
|
|
30281
|
+
placeholder: t('Country'),
|
|
30282
|
+
style: {
|
|
30283
|
+
flex: 1
|
|
30284
|
+
},
|
|
30285
|
+
labelStyle: {
|
|
30286
|
+
flex: 1
|
|
30287
|
+
},
|
|
30288
|
+
getLabel: option => option.label,
|
|
30289
|
+
getValue: option => option.value
|
|
30290
|
+
}
|
|
30291
|
+
};
|
|
30292
|
+
};
|
|
30293
|
+
const filtersConfig = {
|
|
30294
|
+
name: '',
|
|
30295
|
+
datastakeId: ''
|
|
30296
|
+
};
|
|
30297
|
+
const getFilterOptions = (options, t) => {
|
|
30298
|
+
const {
|
|
30299
|
+
countries
|
|
30300
|
+
} = options || {};
|
|
30301
|
+
const _default = {
|
|
30302
|
+
country: countries
|
|
30303
|
+
};
|
|
30304
|
+
return _default;
|
|
30305
|
+
};
|
|
30306
|
+
|
|
30307
|
+
const StakeholdersCreate = ({
|
|
30308
|
+
namespace = 'locations',
|
|
30309
|
+
view = 'scoping',
|
|
30310
|
+
edit = false,
|
|
30311
|
+
formData = {},
|
|
30312
|
+
loading = false,
|
|
30313
|
+
onSubmitted = () => {},
|
|
30314
|
+
onCancel = () => {},
|
|
30315
|
+
getData = () => {},
|
|
30316
|
+
saveData = () => {},
|
|
30317
|
+
form: formConfig = {},
|
|
30318
|
+
formValue = {},
|
|
30319
|
+
defaultData = {},
|
|
30320
|
+
user = {},
|
|
30321
|
+
APP,
|
|
30322
|
+
query,
|
|
30323
|
+
goTo = () => {},
|
|
30324
|
+
t = () => {},
|
|
30325
|
+
ajaxForms = {},
|
|
30326
|
+
changeAjaxForms = () => {},
|
|
30327
|
+
ajaxOptions = {},
|
|
30328
|
+
changeAjaxOptions = () => {},
|
|
30329
|
+
getAppHeader = () => {},
|
|
30330
|
+
getApiBaseUrl = () => {}
|
|
30331
|
+
}) => {
|
|
30332
|
+
let {
|
|
30333
|
+
form = {},
|
|
30334
|
+
data = defaultData || {}
|
|
30335
|
+
} = !edit ? formData[`${APP}-${view}`] || {} : {
|
|
30336
|
+
form: formConfig,
|
|
30337
|
+
data: formValue
|
|
30338
|
+
};
|
|
30339
|
+
React.useEffect(() => {
|
|
30340
|
+
if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
|
|
30341
|
+
if (!edit) {
|
|
30342
|
+
getData({
|
|
30343
|
+
namespace,
|
|
30344
|
+
module: APP,
|
|
30345
|
+
view,
|
|
30346
|
+
scope: 'global'
|
|
30347
|
+
});
|
|
30348
|
+
} else {
|
|
30349
|
+
form = formConfig;
|
|
30350
|
+
data = formValue;
|
|
30351
|
+
}
|
|
30352
|
+
}
|
|
30353
|
+
}, [edit, user?.language]);
|
|
30354
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
30355
|
+
className: "daf-create-form",
|
|
30356
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
|
|
30357
|
+
form: form,
|
|
30358
|
+
data: data,
|
|
30359
|
+
showSaveAndNext: false,
|
|
30360
|
+
module: APP,
|
|
30361
|
+
onCancel: onCancel,
|
|
30362
|
+
isCreate: true,
|
|
30363
|
+
t: t,
|
|
30364
|
+
excludedKeys: ["title"],
|
|
30365
|
+
user: user,
|
|
30366
|
+
ajaxForms: ajaxForms,
|
|
30367
|
+
ajaxOptions: ajaxOptions,
|
|
30368
|
+
getAppHeader: getAppHeader,
|
|
30369
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
30370
|
+
changeAjaxOptions: changeAjaxOptions,
|
|
30371
|
+
app: APP,
|
|
30372
|
+
query: query,
|
|
30373
|
+
goTo: goTo,
|
|
30374
|
+
changeAjaxForms: changeAjaxForms,
|
|
30375
|
+
submit: (payload, setSelectedFormNext) => {
|
|
30376
|
+
const payloadData = {
|
|
30377
|
+
...payload,
|
|
30378
|
+
module: APP,
|
|
30379
|
+
namespace
|
|
30380
|
+
};
|
|
30381
|
+
const newPayload = {
|
|
30382
|
+
...defaultData,
|
|
30383
|
+
...payloadData,
|
|
30384
|
+
form: 'location'
|
|
30385
|
+
};
|
|
30386
|
+
const callback = (type, m, data) => {
|
|
30387
|
+
if (setSelectedFormNext) {
|
|
30388
|
+
setSelectedFormNext();
|
|
30389
|
+
}
|
|
30390
|
+
if (type === MessageTypes.SUCCESS) {
|
|
30391
|
+
if (onSubmitted) onSubmitted(type, m, data);
|
|
30392
|
+
} else {
|
|
30393
|
+
antd.message.error(m);
|
|
30394
|
+
}
|
|
30395
|
+
};
|
|
30396
|
+
saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
|
|
30397
|
+
id: data.id
|
|
30398
|
+
}), callback);
|
|
30399
|
+
},
|
|
30400
|
+
isFormDisabled: () => {
|
|
30401
|
+
return !data || !data.typeOfEvent;
|
|
30402
|
+
}
|
|
30403
|
+
})
|
|
30404
|
+
});
|
|
30405
|
+
};
|
|
30406
|
+
|
|
30407
|
+
const LocationsTable = ({
|
|
30408
|
+
t = () => {},
|
|
30409
|
+
goTo = () => {},
|
|
30410
|
+
user = {},
|
|
30411
|
+
options = {},
|
|
30412
|
+
getRedirectLink = () => {},
|
|
30413
|
+
theme = {},
|
|
30414
|
+
loading = false,
|
|
30415
|
+
data = {},
|
|
30416
|
+
isMobile,
|
|
30417
|
+
APP,
|
|
30418
|
+
location,
|
|
30419
|
+
getData = () => {},
|
|
30420
|
+
getApiBaseUrl = () => {},
|
|
30421
|
+
getAppHeader = () => {},
|
|
30422
|
+
getFormData = () => {},
|
|
30423
|
+
saveFormData = () => {},
|
|
30424
|
+
formLoading = false,
|
|
30425
|
+
query = {},
|
|
30426
|
+
ajaxForms = {},
|
|
30427
|
+
changeAjaxForms = () => {},
|
|
30428
|
+
ajaxOptions = {},
|
|
30429
|
+
changeAjaxOptions = () => {},
|
|
30430
|
+
formData = {},
|
|
30431
|
+
formValue = {},
|
|
30432
|
+
form = {}
|
|
30433
|
+
}) => {
|
|
30434
|
+
const [selectOptions, setSelectOptions] = React.useState();
|
|
30435
|
+
const [activeTab, setActiveTab] = React.useState();
|
|
30436
|
+
const columns = React.useMemo(() => getColumns({
|
|
30437
|
+
t,
|
|
30438
|
+
goTo,
|
|
30439
|
+
user,
|
|
30440
|
+
options,
|
|
30441
|
+
activeTab,
|
|
30442
|
+
getRedirectLink,
|
|
30443
|
+
theme,
|
|
30444
|
+
subject: 'locations',
|
|
30445
|
+
data
|
|
30446
|
+
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
|
|
30447
|
+
const breadCrumbs = [];
|
|
30448
|
+
const {
|
|
30449
|
+
paginationQuery,
|
|
30450
|
+
searchParams,
|
|
30451
|
+
otherParams
|
|
30452
|
+
} = useGetQueryParams({
|
|
30453
|
+
location
|
|
30454
|
+
});
|
|
30455
|
+
React.useEffect(() => {
|
|
30456
|
+
getData({
|
|
30457
|
+
pagination: paginationQuery,
|
|
30458
|
+
...(Object.keys(otherParams).length > 0 && {
|
|
30459
|
+
filters: otherParams
|
|
30460
|
+
}),
|
|
30461
|
+
...(Object.keys(searchParams).length > 0 && {
|
|
30462
|
+
search: searchParams
|
|
30463
|
+
}),
|
|
30464
|
+
tab: activeTab
|
|
30465
|
+
}, 'locations');
|
|
30466
|
+
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
30467
|
+
console.log({
|
|
30468
|
+
data
|
|
30469
|
+
});
|
|
30009
30470
|
const selectFiltersConfig = React.useMemo(() => {
|
|
30010
30471
|
return getFiltersConfig({
|
|
30011
30472
|
t
|
|
@@ -30022,7 +30483,7 @@ const StakeholdersTable = ({
|
|
|
30022
30483
|
}, []);
|
|
30023
30484
|
return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
|
|
30024
30485
|
t: t,
|
|
30025
|
-
title: t("
|
|
30486
|
+
title: t("Locations"),
|
|
30026
30487
|
breadCrumbs: breadCrumbs,
|
|
30027
30488
|
location: location,
|
|
30028
30489
|
loading: loading,
|
|
@@ -30038,12 +30499,12 @@ const StakeholdersTable = ({
|
|
|
30038
30499
|
getRedirectLink: getRedirectLink,
|
|
30039
30500
|
filtersConfig: filtersConfig,
|
|
30040
30501
|
isMobile: isMobile,
|
|
30041
|
-
view: "
|
|
30502
|
+
view: "locations",
|
|
30042
30503
|
getActiveTab: handleActiveTabChange,
|
|
30043
30504
|
onDownload: () => {
|
|
30044
30505
|
console.log("download");
|
|
30045
30506
|
},
|
|
30046
|
-
drawerTitle: t("Create
|
|
30507
|
+
drawerTitle: t("Create Location"),
|
|
30047
30508
|
children: ({
|
|
30048
30509
|
onDrawerClose
|
|
30049
30510
|
}) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate, {
|
|
@@ -30053,16 +30514,14 @@ const StakeholdersTable = ({
|
|
|
30053
30514
|
APP: APP,
|
|
30054
30515
|
getApiBaseUrl: getApiBaseUrl,
|
|
30055
30516
|
getAppHeader: getAppHeader,
|
|
30056
|
-
defaultData: {
|
|
30057
|
-
economicSector: 'miningMineralTrade'
|
|
30058
|
-
},
|
|
30059
30517
|
getData: getFormData,
|
|
30060
30518
|
saveData: saveFormData,
|
|
30061
30519
|
loading: formLoading,
|
|
30062
30520
|
onSubmitted: (type, m, data) => {
|
|
30063
30521
|
if (data.datastakeId) {
|
|
30064
30522
|
displayMessage(type, t("affirmations::subject-created-successfully") || m);
|
|
30065
|
-
goTo(`/app/edit/stakeholders/${data.datastakeId}`);
|
|
30523
|
+
// goTo(`/app/edit/stakeholders/${data.datastakeId}`);
|
|
30524
|
+
goTo('/app/locations');
|
|
30066
30525
|
}
|
|
30067
30526
|
},
|
|
30068
30527
|
onCancel: onDrawerClose,
|
|
@@ -30078,6 +30537,7 @@ const StakeholdersTable = ({
|
|
|
30078
30537
|
});
|
|
30079
30538
|
};
|
|
30080
30539
|
|
|
30540
|
+
exports.LocationsTable = LocationsTable;
|
|
30081
30541
|
exports.StakeholdersTable = StakeholdersTable;
|
|
30082
30542
|
exports.SupplyChainDashboard = SupplyChain;
|
|
30083
30543
|
exports.TablePageWithTabs = TablePageWithTabs;
|
package/dist/services/index.js
CHANGED
|
@@ -1359,7 +1359,7 @@ class LinkedSubjectsService extends BaseService {
|
|
|
1359
1359
|
}) {
|
|
1360
1360
|
const _namespace = getNamespace(namespace);
|
|
1361
1361
|
return this.apiGet({
|
|
1362
|
-
url: `/${_namespace}
|
|
1362
|
+
url: `/${_namespace}`,
|
|
1363
1363
|
isApp: true,
|
|
1364
1364
|
params: query,
|
|
1365
1365
|
signal
|