datastake-daf 0.6.765 → 0.6.766
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.js +312 -143
- package/dist/layouts/index.js +0 -3
- package/dist/pages/index.js +206 -219
- package/dist/services/index.js +18 -0
- package/dist/utils/index.js +312 -4
- package/package.json +1 -2
- package/src/@daf/core/components/Charts/BarChart/index.jsx +4 -0
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +0 -7
- package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +0 -2
- package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +3 -4
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/config.js +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/helper.js +4 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/index.jsx +5 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +34 -26
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/index.jsx +56 -52
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +52 -67
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +96 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +96 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +116 -89
- package/src/@daf/core/components/Table/MoreTags/index.jsx +17 -5
- package/src/@daf/layouts/AuthLayout/components/Navbar/index.jsx +0 -1
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +10 -10
- package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +6 -3
- package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/helper.js +1 -14
- package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +12 -5
- package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/index.jsx +1 -1
- package/src/@daf/pages/Dashboards/UserDashboard/components/Triangulation/hook.js +1 -1
- package/src/@daf/pages/Data/Channels/columns.js +175 -0
- package/src/@daf/pages/Data/Channels/config.js +0 -0
- package/src/@daf/pages/Data/Channels/create.jsx +0 -0
- package/src/@daf/pages/Data/Channels/index.jsx +0 -0
- package/src/@daf/pages/Events/Activities/columns.js +1 -4
- package/src/@daf/pages/Events/helper.js +3 -2
- package/src/@daf/pages/Events/index.jsx +1 -1
- package/src/@daf/pages/Locations/MineSite/columns.js +6 -4
- package/src/@daf/pages/Stakeholders/Operators/columns.js +4 -2
- package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +1 -0
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +2 -2
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +7 -7
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +3 -2
- package/src/@daf/pages/Summary/Minesite/index.jsx +3 -1
- package/src/@daf/pages/Summary/Operator/components/Governance/index.js +0 -1
- package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +33 -21
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +13 -13
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +8 -8
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +5 -2
- package/src/@daf/pages/Summary/Operator/index.jsx +3 -0
- package/src/@daf/pages/Summary/components/InformationAvailability/index.js +4 -3
- package/src/@daf/services/AdminService.js +14 -0
- package/src/constants/locales/en/translation.js +104 -2
- package/src/constants/locales/fr/translation.js +104 -1
- package/src/constants/locales/sp/translation.js +104 -1
- package/src/index.js +2 -0
- package/dist/style/datastake/mapbox-gl.css +0 -330
package/dist/components/index.js
CHANGED
|
@@ -6384,7 +6384,10 @@ function MoreTags(_ref) {
|
|
|
6384
6384
|
values = [],
|
|
6385
6385
|
maxWidthCont = 120,
|
|
6386
6386
|
maxTextCont = 100,
|
|
6387
|
-
diff = 30
|
|
6387
|
+
diff = 30,
|
|
6388
|
+
style = {},
|
|
6389
|
+
tagColor,
|
|
6390
|
+
limit
|
|
6388
6391
|
} = _ref;
|
|
6389
6392
|
const ref = React.useRef();
|
|
6390
6393
|
const [width, setWidth] = React.useState(0);
|
|
@@ -6399,6 +6402,11 @@ function MoreTags(_ref) {
|
|
|
6399
6402
|
return () => resizeObserver.disconnect();
|
|
6400
6403
|
}, []);
|
|
6401
6404
|
const _calculate = () => {
|
|
6405
|
+
// If limit prop is provided and valid, use it instead of calculating
|
|
6406
|
+
if (typeof limit === 'number' && limit > 0) {
|
|
6407
|
+
setIndexToReturn(Math.min(limit - 1, values.length - 1));
|
|
6408
|
+
return;
|
|
6409
|
+
}
|
|
6402
6410
|
const tabs = ref.current.querySelectorAll(".check-tabs");
|
|
6403
6411
|
let filled = 0;
|
|
6404
6412
|
let indexToReturn;
|
|
@@ -6425,34 +6433,36 @@ function MoreTags(_ref) {
|
|
|
6425
6433
|
const other = hasMore ? values.slice(indexToReturn + 1, values.length + 1) : [];
|
|
6426
6434
|
React.useEffect(() => {
|
|
6427
6435
|
_calculate();
|
|
6428
|
-
}, [width, values]);
|
|
6436
|
+
}, [width, values, limit]);
|
|
6429
6437
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6430
6438
|
className: "daf-more-tags",
|
|
6431
6439
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6432
6440
|
className: "list",
|
|
6433
6441
|
children: [toShow.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag() : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
6434
|
-
style: {
|
|
6442
|
+
style: _objectSpread2({
|
|
6435
6443
|
maxWidth: _maxWidthCont,
|
|
6436
6444
|
overflow: "hidden",
|
|
6437
6445
|
textOverflow: "ellipsis",
|
|
6438
6446
|
whiteSpace: "nowrap"
|
|
6439
|
-
},
|
|
6440
|
-
color: ac.color,
|
|
6447
|
+
}, style),
|
|
6448
|
+
color: tagColor || ac.color,
|
|
6441
6449
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
6442
6450
|
title: typeof ac === "object" ? ac.label : ac,
|
|
6443
6451
|
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
6444
|
-
style: {
|
|
6452
|
+
style: _objectSpread2({
|
|
6445
6453
|
maxWidth: _maxWidthTxt,
|
|
6446
6454
|
overflow: "hidden",
|
|
6447
6455
|
textOverflow: "ellipsis",
|
|
6448
6456
|
whiteSpace: "nowrap"
|
|
6449
|
-
},
|
|
6457
|
+
}, style),
|
|
6450
6458
|
children: typeof ac === "object" ? ac.label : ac
|
|
6451
6459
|
})
|
|
6452
6460
|
})
|
|
6453
6461
|
}, "".concat(typeof ac === "object" ? ac.value : ac, "-").concat(i))), other.length ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
6454
6462
|
title: other.map(ac => typeof ac === "object" ? ac.label : ac).join(", "),
|
|
6455
6463
|
children: /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
|
|
6464
|
+
color: tagColor || 'default',
|
|
6465
|
+
style: style,
|
|
6456
6466
|
children: ["+", other.length]
|
|
6457
6467
|
})
|
|
6458
6468
|
}) : null]
|
|
@@ -6460,11 +6470,11 @@ function MoreTags(_ref) {
|
|
|
6460
6470
|
className: "list hidden",
|
|
6461
6471
|
ref: ref,
|
|
6462
6472
|
children: values.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag("check-tabs") : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
6463
|
-
color: ac.color,
|
|
6473
|
+
color: tagColor || ac.color,
|
|
6464
6474
|
className: "check-tabs",
|
|
6465
|
-
style: {
|
|
6475
|
+
style: _objectSpread2({
|
|
6466
6476
|
maxWidth: _maxWidthCont
|
|
6467
|
-
},
|
|
6477
|
+
}, style),
|
|
6468
6478
|
children: /*#__PURE__*/jsxRuntime.jsx(Text$1, {
|
|
6469
6479
|
ellipsis: {
|
|
6470
6480
|
tooltip: typeof ac === "object" ? ac.label : ac
|
|
@@ -6482,7 +6492,8 @@ MoreTags.propTypes = {
|
|
|
6482
6492
|
values: PropTypes__default["default"].array,
|
|
6483
6493
|
maxWidthCont: PropTypes__default["default"].number,
|
|
6484
6494
|
maxTextCont: PropTypes__default["default"].number,
|
|
6485
|
-
diff: PropTypes__default["default"].number
|
|
6495
|
+
diff: PropTypes__default["default"].number,
|
|
6496
|
+
limit: PropTypes__default["default"].number
|
|
6486
6497
|
};
|
|
6487
6498
|
|
|
6488
6499
|
const pageValues = [10, 20, 50, 100];
|
|
@@ -9930,44 +9941,44 @@ function useAjaxModal$2({
|
|
|
9930
9941
|
}
|
|
9931
9942
|
|
|
9932
9943
|
const mergeObject = obj => {
|
|
9933
|
-
return Object.entries(obj || {}).reduce((acc,
|
|
9944
|
+
return Object.entries(obj || {}).reduce((acc, _ref) => {
|
|
9945
|
+
let [key, value] = _ref;
|
|
9934
9946
|
if (typeof value === "object" && !Array.isArray(value) && value !== null) {
|
|
9935
|
-
return {
|
|
9936
|
-
...acc,
|
|
9937
|
-
...value
|
|
9938
|
-
};
|
|
9947
|
+
return _objectSpread2(_objectSpread2({}, acc), value);
|
|
9939
9948
|
}
|
|
9940
|
-
return {
|
|
9941
|
-
...acc,
|
|
9949
|
+
return _objectSpread2(_objectSpread2({}, acc), {}, {
|
|
9942
9950
|
[key]: value
|
|
9943
|
-
};
|
|
9951
|
+
});
|
|
9944
9952
|
}, {});
|
|
9945
9953
|
};
|
|
9946
|
-
const handleDataLinkGroupWithTableKeys =
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9954
|
+
const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
9955
|
+
var _inputConfig$meta, _config$meta2, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
|
|
9956
|
+
let {
|
|
9957
|
+
config,
|
|
9958
|
+
inputConfig,
|
|
9959
|
+
inputKey,
|
|
9960
|
+
value,
|
|
9961
|
+
level,
|
|
9962
|
+
t,
|
|
9963
|
+
rootForm,
|
|
9964
|
+
allData,
|
|
9965
|
+
user,
|
|
9966
|
+
getApiBaseUrl = () => {},
|
|
9967
|
+
getAppHeader = () => {},
|
|
9968
|
+
app,
|
|
9969
|
+
TreeNodeComponent
|
|
9970
|
+
} = _ref2;
|
|
9961
9971
|
if (!(config.type === 'dataLinkGroup' || config.type === 'dataLink')) {
|
|
9962
9972
|
return null;
|
|
9963
9973
|
}
|
|
9964
|
-
if (inputConfig
|
|
9974
|
+
if ((inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type) !== 'dataLink' || !(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta = inputConfig.meta) !== null && _inputConfig$meta !== void 0 && _inputConfig$meta.tableKeys)) {
|
|
9965
9975
|
const parentInputKeys = Object.keys(config.inputs || {});
|
|
9966
9976
|
const isHandledBySiblingDataLink = parentInputKeys.some(otherInputKey => {
|
|
9967
9977
|
const otherConfig = config.inputs[otherInputKey];
|
|
9968
|
-
if (otherConfig
|
|
9969
|
-
|
|
9970
|
-
const
|
|
9978
|
+
if ((otherConfig === null || otherConfig === void 0 ? void 0 : otherConfig.type) === 'dataLink') {
|
|
9979
|
+
var _otherConfig$meta, _config$meta;
|
|
9980
|
+
const siblingTableKeys = (otherConfig === null || otherConfig === void 0 || (_otherConfig$meta = otherConfig.meta) === null || _otherConfig$meta === void 0 ? void 0 : _otherConfig$meta.tableKeys) || [];
|
|
9981
|
+
const additionalTableKeys = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.additionalTableKeys) || [];
|
|
9971
9982
|
const allSiblingKeys = [...siblingTableKeys, ...additionalTableKeys];
|
|
9972
9983
|
return allSiblingKeys.includes(inputKey) && otherInputKey !== inputKey;
|
|
9973
9984
|
}
|
|
@@ -9981,23 +9992,26 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
9981
9992
|
return null;
|
|
9982
9993
|
}
|
|
9983
9994
|
const tableKeys = inputConfig.meta.tableKeys;
|
|
9984
|
-
const additionalTableKeys = config.meta
|
|
9995
|
+
const additionalTableKeys = ((_config$meta2 = config.meta) === null || _config$meta2 === void 0 ? void 0 : _config$meta2.additionalTableKeys) || [];
|
|
9985
9996
|
const parentInputKeys = Object.keys(config.inputs || {});
|
|
9986
9997
|
const siblingInputsMatchingTableKeys = parentInputKeys.filter(siblingKey => siblingKey !== inputKey).filter(siblingKey => tableKeys.includes(siblingKey) || additionalTableKeys.includes(siblingKey));
|
|
9987
9998
|
[...new Set([...tableKeys, ...siblingInputsMatchingTableKeys])];
|
|
9988
|
-
const isAjaxModal = React.useMemo(() =>
|
|
9999
|
+
const isAjaxModal = React.useMemo(() => {
|
|
10000
|
+
var _inputConfig$meta2;
|
|
10001
|
+
return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
|
|
10002
|
+
}, [inputConfig]);
|
|
9989
10003
|
const ajaxModalValues = useAjaxModal$2({
|
|
9990
10004
|
name: inputKey,
|
|
9991
10005
|
user,
|
|
9992
|
-
namespace: inputConfig
|
|
9993
|
-
skipFetch: inputConfig
|
|
10006
|
+
namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
|
|
10007
|
+
skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
|
|
9994
10008
|
isAjaxModal,
|
|
9995
|
-
formScope: inputConfig
|
|
10009
|
+
formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
|
|
9996
10010
|
APP: app,
|
|
9997
10011
|
apiBaseUrl: getApiBaseUrl(),
|
|
9998
10012
|
_getAppHeader: getAppHeader
|
|
9999
10013
|
});
|
|
10000
|
-
const dataLinkForm = ajaxModalValues
|
|
10014
|
+
const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
|
|
10001
10015
|
const createInputsAndValues = item => {
|
|
10002
10016
|
const inputs = {};
|
|
10003
10017
|
const values = {};
|
|
@@ -10009,12 +10023,12 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10009
10023
|
'videos': 'Video'
|
|
10010
10024
|
};
|
|
10011
10025
|
tableKeys.filter(tableKey => tableKey !== 'datastakeId').forEach(tableKey => {
|
|
10012
|
-
|
|
10026
|
+
var _dataLinkForm$identif;
|
|
10027
|
+
const formInputConfig = (dataLinkForm === null || dataLinkForm === void 0 ? void 0 : dataLinkForm[tableKey]) || (dataLinkForm === null || dataLinkForm === void 0 || (_dataLinkForm$identif = dataLinkForm['identification']) === null || _dataLinkForm$identif === void 0 ? void 0 : _dataLinkForm$identif[tableKey]);
|
|
10013
10028
|
if (formInputConfig) {
|
|
10014
|
-
inputs[tableKey] = {
|
|
10015
|
-
...formInputConfig,
|
|
10029
|
+
inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
|
|
10016
10030
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
|
|
10017
|
-
};
|
|
10031
|
+
});
|
|
10018
10032
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
10019
10033
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
10020
10034
|
let resolvedLabel = null;
|
|
@@ -10022,7 +10036,7 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10022
10036
|
const parts = labelKey.split(' is ');
|
|
10023
10037
|
if (parts.length === 2) {
|
|
10024
10038
|
const [conditionKey, conditionValue] = parts;
|
|
10025
|
-
if (item
|
|
10039
|
+
if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
|
|
10026
10040
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10027
10041
|
break;
|
|
10028
10042
|
}
|
|
@@ -10030,37 +10044,37 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10030
10044
|
}
|
|
10031
10045
|
inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
|
|
10032
10046
|
}
|
|
10033
|
-
values[tableKey] = item
|
|
10047
|
+
values[tableKey] = item === null || item === void 0 ? void 0 : item[tableKey];
|
|
10034
10048
|
} else {
|
|
10049
|
+
var _item$linking;
|
|
10035
10050
|
inputs[tableKey] = {
|
|
10036
10051
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
|
|
10037
|
-
type: inputConfig
|
|
10052
|
+
type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
|
|
10038
10053
|
};
|
|
10039
|
-
values[tableKey] = item
|
|
10054
|
+
values[tableKey] = (item === null || item === void 0 || (_item$linking = item.linking) === null || _item$linking === void 0 || (_item$linking = _item$linking.SCL) === null || _item$linking === void 0 || (_item$linking = _item$linking[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking === void 0 ? void 0 : _item$linking.name) || (item === null || item === void 0 ? void 0 : item[tableKey]);
|
|
10040
10055
|
}
|
|
10041
10056
|
});
|
|
10042
10057
|
siblingInputsMatchingTableKeys.forEach(siblingKey => {
|
|
10043
10058
|
const siblingConfig = config.inputs[siblingKey];
|
|
10044
10059
|
if (siblingConfig) {
|
|
10045
|
-
inputs[siblingKey] = {
|
|
10046
|
-
...siblingConfig,
|
|
10060
|
+
inputs[siblingKey] = _objectSpread2(_objectSpread2({}, siblingConfig), {}, {
|
|
10047
10061
|
label: siblingConfig.label || siblingKey
|
|
10048
|
-
};
|
|
10049
|
-
values[siblingKey] = item
|
|
10062
|
+
});
|
|
10063
|
+
values[siblingKey] = item === null || item === void 0 ? void 0 : item[siblingKey];
|
|
10050
10064
|
}
|
|
10051
10065
|
});
|
|
10052
|
-
if (dataLinkForm
|
|
10066
|
+
if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
|
|
10053
10067
|
Object.keys(dataLinkForm.identification).filter(fieldKey => fieldKey !== 'datastakeId' && !tableKeys.includes(fieldKey)).filter(fieldKey => {
|
|
10054
10068
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10055
10069
|
return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
|
|
10056
10070
|
}).forEach(fieldKey => {
|
|
10071
|
+
var _item$linking2;
|
|
10057
10072
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10058
|
-
inputs[fieldKey] = {
|
|
10059
|
-
...formInputConfig,
|
|
10073
|
+
inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
|
|
10060
10074
|
label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
|
|
10061
|
-
};
|
|
10062
|
-
if (formInputConfig
|
|
10063
|
-
const dynamicLabelKeys = Object.keys(formInputConfig
|
|
10075
|
+
});
|
|
10076
|
+
if (formInputConfig !== null && formInputConfig !== void 0 && formInputConfig.label && typeof (formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label) === 'object') {
|
|
10077
|
+
const dynamicLabelKeys = Object.keys(formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label);
|
|
10064
10078
|
let resolvedLabel = null;
|
|
10065
10079
|
for (const labelKey of dynamicLabelKeys) {
|
|
10066
10080
|
const parts = labelKey.split(' is ');
|
|
@@ -10069,7 +10083,7 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10069
10083
|
const flattenedItem = Object.assign({}, item.location, {
|
|
10070
10084
|
address: item.address
|
|
10071
10085
|
});
|
|
10072
|
-
if (flattenedItem
|
|
10086
|
+
if ((flattenedItem === null || flattenedItem === void 0 ? void 0 : flattenedItem[conditionKey]) === conditionValue) {
|
|
10073
10087
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10074
10088
|
break;
|
|
10075
10089
|
}
|
|
@@ -10077,7 +10091,7 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10077
10091
|
}
|
|
10078
10092
|
inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
|
|
10079
10093
|
}
|
|
10080
|
-
values[fieldKey] = item
|
|
10094
|
+
values[fieldKey] = (item === null || item === void 0 || (_item$linking2 = item.linking) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2.SCL) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2[item === null || item === void 0 ? void 0 : item[fieldKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
|
|
10081
10095
|
});
|
|
10082
10096
|
}
|
|
10083
10097
|
return {
|
|
@@ -10087,16 +10101,17 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10087
10101
|
};
|
|
10088
10102
|
if (Array.isArray(value)) {
|
|
10089
10103
|
return value.map((item, itemIndex) => {
|
|
10104
|
+
var _merged$inputKey;
|
|
10090
10105
|
const merged = mergeObject(item);
|
|
10091
|
-
const datastakeIdValue = merged
|
|
10106
|
+
const datastakeIdValue = (merged === null || merged === void 0 || (_merged$inputKey = merged[inputKey]) === null || _merged$inputKey === void 0 ? void 0 : _merged$inputKey.datastakeId) || (merged === null || merged === void 0 ? void 0 : merged.datastakeId);
|
|
10092
10107
|
const {
|
|
10093
10108
|
inputs,
|
|
10094
10109
|
values
|
|
10095
10110
|
} = createInputsAndValues(merged);
|
|
10096
10111
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10097
|
-
nodeKey: datastakeIdValue || t(
|
|
10112
|
+
nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
|
|
10098
10113
|
config: {
|
|
10099
|
-
label: datastakeIdValue || t(
|
|
10114
|
+
label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
|
|
10100
10115
|
type: 'custom-datalink-group',
|
|
10101
10116
|
inputs: inputs
|
|
10102
10117
|
},
|
|
@@ -10110,11 +10125,12 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10110
10125
|
getApiBaseUrl: getApiBaseUrl,
|
|
10111
10126
|
getAppHeader: getAppHeader,
|
|
10112
10127
|
app: app
|
|
10113
|
-
},
|
|
10128
|
+
}, "".concat(inputKey, "-").concat(itemIndex));
|
|
10114
10129
|
});
|
|
10115
10130
|
} else {
|
|
10131
|
+
var _merged$inputKey2;
|
|
10116
10132
|
const merged = mergeObject(value);
|
|
10117
|
-
const datastakeIdValue = merged
|
|
10133
|
+
const datastakeIdValue = (merged === null || merged === void 0 || (_merged$inputKey2 = merged[inputKey]) === null || _merged$inputKey2 === void 0 ? void 0 : _merged$inputKey2.datastakeId) || (merged === null || merged === void 0 ? void 0 : merged.datastakeId);
|
|
10118
10134
|
const {
|
|
10119
10135
|
inputs,
|
|
10120
10136
|
values
|
|
@@ -10136,7 +10152,7 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10136
10152
|
getApiBaseUrl: getApiBaseUrl,
|
|
10137
10153
|
getAppHeader: getAppHeader,
|
|
10138
10154
|
app: app
|
|
10139
|
-
},
|
|
10155
|
+
}, "".concat(inputKey, "-group"));
|
|
10140
10156
|
}
|
|
10141
10157
|
};
|
|
10142
10158
|
|
|
@@ -13723,12 +13739,6 @@ function LocationIcon({
|
|
|
13723
13739
|
}).addTo(mapRef);
|
|
13724
13740
|
const div = document.getElementById(markerId);
|
|
13725
13741
|
root.current = client.createRoot(div);
|
|
13726
|
-
console.log({
|
|
13727
|
-
locationID: data.datastakeId,
|
|
13728
|
-
stakeholder,
|
|
13729
|
-
index,
|
|
13730
|
-
parentId: data.datastakeId
|
|
13731
|
-
});
|
|
13732
13742
|
root.current.render( /*#__PURE__*/jsxRuntime.jsx(StakeholderIcon$1, {
|
|
13733
13743
|
data: stakeholder,
|
|
13734
13744
|
zoom: zoom,
|
|
@@ -46290,7 +46300,7 @@ const Container$1 = styled__default["default"].div`
|
|
|
46290
46300
|
width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
|
|
46291
46301
|
`;
|
|
46292
46302
|
|
|
46293
|
-
const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width"];
|
|
46303
|
+
const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width", "xAxisConfig"];
|
|
46294
46304
|
const {
|
|
46295
46305
|
useToken: useToken$g
|
|
46296
46306
|
} = antd.theme;
|
|
@@ -46377,7 +46387,8 @@ function BarChart(_ref) {
|
|
|
46377
46387
|
t = s => s,
|
|
46378
46388
|
isPdf = false,
|
|
46379
46389
|
legendConfig = {},
|
|
46380
|
-
width
|
|
46390
|
+
width,
|
|
46391
|
+
xAxisConfig = {}
|
|
46381
46392
|
} = _ref;
|
|
46382
46393
|
_objectWithoutProperties(_ref, _excluded$7);
|
|
46383
46394
|
const containerRef = React__default["default"].useRef(null);
|
|
@@ -46404,14 +46415,14 @@ function BarChart(_ref) {
|
|
|
46404
46415
|
data,
|
|
46405
46416
|
xField: xFieldKey,
|
|
46406
46417
|
yField: yFieldKey,
|
|
46407
|
-
xAxis: _objectSpread2(_objectSpread2({}, isPercentage ? {
|
|
46418
|
+
xAxis: _objectSpread2(_objectSpread2(_objectSpread2({}, isPercentage ? {
|
|
46408
46419
|
tickMethod: () => {
|
|
46409
46420
|
return Array.from(new Array(11), (v, i) => i * 10);
|
|
46410
46421
|
}
|
|
46411
|
-
} : {}), {}, {
|
|
46412
|
-
label: {
|
|
46422
|
+
} : {}), xAxisConfig), {}, {
|
|
46423
|
+
label: _objectSpread2({
|
|
46413
46424
|
formatter: isPercentage ? v => "".concat(v).replace(/\d{1,3}(?=(\d{3})+$)/g, s => "".concat(s, ",")) + " %" : formattedXAxis
|
|
46414
|
-
}
|
|
46425
|
+
}, xAxisConfig === null || xAxisConfig === void 0 ? void 0 : xAxisConfig.label)
|
|
46415
46426
|
}),
|
|
46416
46427
|
yAxis: {
|
|
46417
46428
|
label: {
|
|
@@ -46435,7 +46446,7 @@ function BarChart(_ref) {
|
|
|
46435
46446
|
} else {
|
|
46436
46447
|
chartRef.current.update(config);
|
|
46437
46448
|
}
|
|
46438
|
-
}, [data, xFieldKey, yFieldKey, renderTooltipContent, tooltipConfig, animated, isStack, isGroup, isPercentage, seriesField, formattedYAxis, formattedXAxis, color, token.colorPrimary7]);
|
|
46449
|
+
}, [data, xFieldKey, yFieldKey, renderTooltipContent, tooltipConfig, animated, isStack, isGroup, isPercentage, seriesField, formattedYAxis, formattedXAxis, color, token.colorPrimary7, xAxisConfig]);
|
|
46439
46450
|
React__default["default"].useEffect(() => {
|
|
46440
46451
|
return () => {
|
|
46441
46452
|
if (chartRef.current) {
|
|
@@ -49148,7 +49159,6 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
|
|
|
49148
49159
|
withDuration = true,
|
|
49149
49160
|
onFilterChange,
|
|
49150
49161
|
isPdf,
|
|
49151
|
-
zoomOutTransition = false,
|
|
49152
49162
|
...props
|
|
49153
49163
|
}, ref) {
|
|
49154
49164
|
const {
|
|
@@ -49171,8 +49181,8 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
|
|
|
49171
49181
|
fitView({
|
|
49172
49182
|
padding: 0.4,
|
|
49173
49183
|
nodes: [...nodesToFit],
|
|
49174
|
-
duration: withDuration ? 300 : undefined,
|
|
49175
|
-
maxZoom: 0.
|
|
49184
|
+
// duration: withDuration ? 300 : undefined,
|
|
49185
|
+
maxZoom: 0.9
|
|
49176
49186
|
});
|
|
49177
49187
|
});
|
|
49178
49188
|
}, [JSON.stringify(nodesToFit), withDuration]);
|
|
@@ -49204,11 +49214,8 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
|
|
|
49204
49214
|
fitView: true // zoom out on default
|
|
49205
49215
|
,
|
|
49206
49216
|
fitViewOptions: {
|
|
49207
|
-
padding: 0.2
|
|
49208
|
-
//
|
|
49209
|
-
...(zoomOutTransition ? {
|
|
49210
|
-
duration: withDuration ? 300 : undefined
|
|
49211
|
-
} : {})
|
|
49217
|
+
padding: 0.2 //zoom out on default
|
|
49218
|
+
// ...(zoomOutTransition ? { duration: withDuration ? 300 : undefined } : {}),
|
|
49212
49219
|
},
|
|
49213
49220
|
...props,
|
|
49214
49221
|
children: !isPdf && /*#__PURE__*/jsxRuntime.jsxs(react.Controls, {
|
|
@@ -49805,8 +49812,7 @@ function StakeholderMappings(_ref3) {
|
|
|
49805
49812
|
iconOffsetY = 250,
|
|
49806
49813
|
t = s => s,
|
|
49807
49814
|
emptyString = undefined,
|
|
49808
|
-
isPdf = false
|
|
49809
|
-
zoomOutTransition = false
|
|
49815
|
+
isPdf = false
|
|
49810
49816
|
} = _ref3;
|
|
49811
49817
|
const reactFlowWrapper = React.useRef(null);
|
|
49812
49818
|
const [nodes, setNodes] = react.useNodesState([]);
|
|
@@ -50071,7 +50077,6 @@ function StakeholderMappings(_ref3) {
|
|
|
50071
50077
|
});
|
|
50072
50078
|
}, [reactFlowWrapper.current, JSON.stringify(data), JSON.stringify(selectedIconNodes), isAllOpenDefault, isSelectable, isChanged, emptyString]);
|
|
50073
50079
|
return /*#__PURE__*/jsxRuntime.jsx(BaseGraph, {
|
|
50074
|
-
zoomOutTransition: zoomOutTransition,
|
|
50075
50080
|
nodes: nodes,
|
|
50076
50081
|
mandatoryNodesToFit: mandatoryNodesToFit,
|
|
50077
50082
|
edges: edges,
|
|
@@ -50266,7 +50271,7 @@ function getConfig(data, goTo, t) {
|
|
|
50266
50271
|
className: "flex",
|
|
50267
50272
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
50268
50273
|
className: "flex-1",
|
|
50269
|
-
children: t(
|
|
50274
|
+
children: t(`${item.title}`)
|
|
50270
50275
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
50271
50276
|
className: "cursor-pointer",
|
|
50272
50277
|
onClick: () => goTo(item.goToPath),
|
|
@@ -50337,6 +50342,8 @@ const getColor = (users, items) => {
|
|
|
50337
50342
|
};
|
|
50338
50343
|
function useConfig(data) {
|
|
50339
50344
|
const config = React.useMemo(() => {
|
|
50345
|
+
// Ensure data is an array to prevent "data.find is not a function" error
|
|
50346
|
+
const safeData = Array.isArray(data) ? data : [];
|
|
50340
50347
|
const start = moment__default["default"]().add(-1, "years").format("MMM YY");
|
|
50341
50348
|
let now = moment__default["default"](start, "MMM YY");
|
|
50342
50349
|
const _config = [];
|
|
@@ -50349,7 +50356,7 @@ function useConfig(data) {
|
|
|
50349
50356
|
while (true) {
|
|
50350
50357
|
DAYS$1.forEach(d => {
|
|
50351
50358
|
if (d === nowMonth.format("dd") && now.format("MMM YY") === nowMonth.format("MMM YY")) {
|
|
50352
|
-
const users =
|
|
50359
|
+
const users = safeData.find(d => d._id === nowMonth.format("YYYY-MM-DD"))?.count || 0;
|
|
50353
50360
|
conf.push({
|
|
50354
50361
|
date: nowMonth.format("DD MMM YY"),
|
|
50355
50362
|
active: true,
|
|
@@ -50400,6 +50407,9 @@ function UserActivity({
|
|
|
50400
50407
|
const {
|
|
50401
50408
|
isCollapsed
|
|
50402
50409
|
} = useResizeContext();
|
|
50410
|
+
|
|
50411
|
+
// console.log("userActivityyyyy",data);
|
|
50412
|
+
|
|
50403
50413
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
50404
50414
|
title: t(`admin::user-activity`),
|
|
50405
50415
|
loading: loading,
|
|
@@ -50843,6 +50853,13 @@ function UserStatistics({
|
|
|
50843
50853
|
t,
|
|
50844
50854
|
translationKeys
|
|
50845
50855
|
}) {
|
|
50856
|
+
// console.log("UserStatistics:loading", loading);
|
|
50857
|
+
// console.log("UserStatistics:loadingUserGrowth", loadingUserGrowth);
|
|
50858
|
+
// console.log("UserStatistics:data", data);
|
|
50859
|
+
// console.log("UserStatistics:userActivityData", data?.userActivityData);
|
|
50860
|
+
// console.log("UserStatistics:topContributorsData", data?.topContributorsData);
|
|
50861
|
+
// console.log("UserStatistics:userGrowthData", data?.userGrowthData);
|
|
50862
|
+
|
|
50846
50863
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
50847
50864
|
title: t(`${translationKeys}-admin::usage-statistics`),
|
|
50848
50865
|
className: "with-border-header",
|
|
@@ -50850,18 +50867,18 @@ function UserStatistics({
|
|
|
50850
50867
|
className: "flex flex-column gap-6",
|
|
50851
50868
|
children: [/*#__PURE__*/jsxRuntime.jsx(UserActivity, {
|
|
50852
50869
|
loading: loading,
|
|
50853
|
-
data: data.userActivityData,
|
|
50870
|
+
data: data.userActivityData || [],
|
|
50854
50871
|
t: t
|
|
50855
50872
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
50856
50873
|
className: "flex flex-row flex-col-mobile gap-6",
|
|
50857
50874
|
children: [/*#__PURE__*/jsxRuntime.jsx(TopContributors, {
|
|
50858
|
-
data: data.topContributorsData,
|
|
50875
|
+
data: data.topContributorsData || [],
|
|
50859
50876
|
loading: loading,
|
|
50860
50877
|
t: t
|
|
50861
50878
|
}), /*#__PURE__*/jsxRuntime.jsx(UserGrowth, {
|
|
50862
50879
|
t: t,
|
|
50863
50880
|
loading: loadingUserGrowth,
|
|
50864
|
-
data: data.userGrowthData,
|
|
50881
|
+
data: data.userGrowthData || [],
|
|
50865
50882
|
fetchUserGrowth: fetchUserGrowth,
|
|
50866
50883
|
translationKeys: translationKeys
|
|
50867
50884
|
})]
|
|
@@ -50879,11 +50896,11 @@ function AdminDashboard(_ref) {
|
|
|
50879
50896
|
adminTranslationIdentifier,
|
|
50880
50897
|
t,
|
|
50881
50898
|
loadingUserGrowth,
|
|
50882
|
-
fetchUserGrowth = () => {}
|
|
50899
|
+
fetchUserGrowth = () => {},
|
|
50900
|
+
userGrowthData
|
|
50883
50901
|
} = _ref;
|
|
50884
|
-
const
|
|
50885
|
-
|
|
50886
|
-
} = data;
|
|
50902
|
+
const keyIndicatorsCards = Array.isArray(data === null || data === void 0 ? void 0 : data.keyIndicatorsData) ? data.keyIndicatorsData : [];
|
|
50903
|
+
console.log("AdminDashboard:data", data);
|
|
50887
50904
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
50888
50905
|
className: "daf-analysis admin-dashboard",
|
|
50889
50906
|
children: [/*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
@@ -50897,22 +50914,21 @@ function AdminDashboard(_ref) {
|
|
|
50897
50914
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
50898
50915
|
className: "sections-cont w-pt",
|
|
50899
50916
|
children: [/*#__PURE__*/jsxRuntime.jsx("section", {
|
|
50900
|
-
children: actionWidgetConfig.map(widgetConfig => {
|
|
50901
|
-
|
|
50902
|
-
|
|
50903
|
-
|
|
50904
|
-
}), widgetConfig.title);
|
|
50905
|
-
})
|
|
50917
|
+
children: actionWidgetConfig.map(widgetConfig => /*#__PURE__*/jsxRuntime.jsx(ActionWidget, _objectSpread2(_objectSpread2({}, widgetConfig), {}, {
|
|
50918
|
+
onClick: () => goTo(widgetConfig.goToPath),
|
|
50919
|
+
title: t("".concat(widgetConfig.title))
|
|
50920
|
+
}), widgetConfig.title))
|
|
50906
50921
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
50907
50922
|
children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
|
|
50908
|
-
data:
|
|
50923
|
+
data: keyIndicatorsCards,
|
|
50909
50924
|
loading: loading,
|
|
50910
50925
|
goTo: goTo,
|
|
50911
50926
|
t: t
|
|
50912
50927
|
})
|
|
50913
50928
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
50914
50929
|
children: /*#__PURE__*/jsxRuntime.jsx(UserStatistics, {
|
|
50915
|
-
data: data,
|
|
50930
|
+
data: _objectSpread2({}, data),
|
|
50931
|
+
userGrowthData: userGrowthData,
|
|
50916
50932
|
loading: loading,
|
|
50917
50933
|
t: t,
|
|
50918
50934
|
loadingUserGrowth: loadingUserGrowth,
|
|
@@ -55038,45 +55054,34 @@ function AdminDashboardScreen({
|
|
|
55038
55054
|
fetchUserGrowth,
|
|
55039
55055
|
userGrowthDataLoading
|
|
55040
55056
|
} = useWidgetFetch();
|
|
55057
|
+
console.log({
|
|
55058
|
+
userGrowthData
|
|
55059
|
+
});
|
|
55041
55060
|
const actionsWidgetsConfig = React.useMemo(() => getActionWidgetsConfig({
|
|
55042
55061
|
getRedirectLink
|
|
55043
|
-
}), [getRedirectLink]);
|
|
55062
|
+
}), [getRedirectLink, getActionWidgetsConfig]);
|
|
55044
55063
|
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsConfig({
|
|
55045
55064
|
getRedirectLink,
|
|
55046
|
-
|
|
55047
|
-
}), [data?.keyInformation, getRedirectLink]);
|
|
55048
|
-
|
|
55049
|
-
|
|
55050
|
-
const
|
|
55051
|
-
label: "Contributor 1",
|
|
55052
|
-
Score: 0
|
|
55053
|
-
}, {
|
|
55054
|
-
label: "Contributor 2",
|
|
55055
|
-
Score: 0
|
|
55056
|
-
}, {
|
|
55057
|
-
label: "Contributor 3",
|
|
55058
|
-
Score: 0
|
|
55059
|
-
}, {
|
|
55060
|
-
label: "Contributor 4",
|
|
55061
|
-
Score: 0
|
|
55062
|
-
}, {
|
|
55063
|
-
label: "Contributor 5",
|
|
55064
|
-
Score: 0
|
|
55065
|
-
}];
|
|
55065
|
+
keyIndicators: data?.keyIndicators ?? data?.keyInformation
|
|
55066
|
+
}), [data?.keyIndicators, data?.keyInformation, getRedirectLink, getKeyIndicatorsConfig]);
|
|
55067
|
+
const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
|
|
55068
|
+
const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
|
|
55069
|
+
const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
|
|
55066
55070
|
return /*#__PURE__*/jsxRuntime.jsx(AdminDashboard, {
|
|
55067
55071
|
t: t,
|
|
55068
|
-
loading: loading,
|
|
55069
55072
|
goTo: goTo,
|
|
55073
|
+
loading: loading,
|
|
55070
55074
|
actionWidgetConfig: actionsWidgetsConfig,
|
|
55071
55075
|
loadingUserGrowth: userGrowthDataLoading,
|
|
55072
55076
|
fetchUserGrowth: fetchUserGrowth,
|
|
55077
|
+
adminTranslationIdentifier: appName,
|
|
55073
55078
|
data: {
|
|
55074
55079
|
keyIndicatorsData: keyIndicatorsConfig,
|
|
55075
|
-
userActivityData:
|
|
55076
|
-
topContributorsData:
|
|
55077
|
-
userGrowthData:
|
|
55078
|
-
|
|
55079
|
-
|
|
55080
|
+
userActivityData: safeUserActivity,
|
|
55081
|
+
topContributorsData: safeTopContributors,
|
|
55082
|
+
userGrowthData: safeUserGrowth,
|
|
55083
|
+
data: data
|
|
55084
|
+
}
|
|
55080
55085
|
});
|
|
55081
55086
|
}
|
|
55082
55087
|
|
|
@@ -55293,6 +55298,136 @@ function AdminAccountsViewScreen({
|
|
|
55293
55298
|
});
|
|
55294
55299
|
}
|
|
55295
55300
|
|
|
55301
|
+
function AdminSubjectsScreen({
|
|
55302
|
+
config
|
|
55303
|
+
}) {
|
|
55304
|
+
const {
|
|
55305
|
+
appName = "app",
|
|
55306
|
+
module,
|
|
55307
|
+
goTo,
|
|
55308
|
+
t,
|
|
55309
|
+
location,
|
|
55310
|
+
isMobile,
|
|
55311
|
+
getRedirectLink,
|
|
55312
|
+
AdminService,
|
|
55313
|
+
options,
|
|
55314
|
+
handleError,
|
|
55315
|
+
defaultPageSize = 20,
|
|
55316
|
+
view,
|
|
55317
|
+
headerTitle = "subjects",
|
|
55318
|
+
breadcrumbs,
|
|
55319
|
+
refetchTrigger,
|
|
55320
|
+
getData
|
|
55321
|
+
} = config;
|
|
55322
|
+
const handleMergeSubjects = React.useCallback(async mergeData => {
|
|
55323
|
+
try {
|
|
55324
|
+
if (AdminService.mergeSubjects) {
|
|
55325
|
+
await AdminService.mergeSubjects(mergeData);
|
|
55326
|
+
antd.message.success(t("Subjects merged successfully"));
|
|
55327
|
+
} else {
|
|
55328
|
+
console.warn("AdminService.mergeSubjects is not implemented");
|
|
55329
|
+
antd.message.success(t("Subjects merged successfully"));
|
|
55330
|
+
}
|
|
55331
|
+
} catch (err) {
|
|
55332
|
+
handleError?.(err);
|
|
55333
|
+
}
|
|
55334
|
+
}, [AdminService, t, handleError]);
|
|
55335
|
+
|
|
55336
|
+
// Use custom getData if provided, otherwise use default AdminService.getSubjects
|
|
55337
|
+
const getSubjects = React.useCallback(params => {
|
|
55338
|
+
if (getData) {
|
|
55339
|
+
return getData(params);
|
|
55340
|
+
}
|
|
55341
|
+
return AdminService.getSubjects(params);
|
|
55342
|
+
}, [getData, AdminService]);
|
|
55343
|
+
return /*#__PURE__*/jsxRuntime.jsx(SubjectsTable, {
|
|
55344
|
+
t: t,
|
|
55345
|
+
goTo: goTo,
|
|
55346
|
+
getRedirectLink: getRedirectLink,
|
|
55347
|
+
location: location,
|
|
55348
|
+
module: module,
|
|
55349
|
+
headerTitle: headerTitle,
|
|
55350
|
+
getData: getSubjects,
|
|
55351
|
+
isMobile: isMobile,
|
|
55352
|
+
defaultPageSize: defaultPageSize,
|
|
55353
|
+
view: view,
|
|
55354
|
+
breadcrumbs: breadcrumbs,
|
|
55355
|
+
mergeSubjectsFunction: handleMergeSubjects,
|
|
55356
|
+
refetchTrigger: refetchTrigger,
|
|
55357
|
+
config: {
|
|
55358
|
+
options: {
|
|
55359
|
+
category: options?.category,
|
|
55360
|
+
countries: options?.countries
|
|
55361
|
+
}
|
|
55362
|
+
}
|
|
55363
|
+
});
|
|
55364
|
+
}
|
|
55365
|
+
|
|
55366
|
+
function AdminLocationScreen({
|
|
55367
|
+
config
|
|
55368
|
+
}) {
|
|
55369
|
+
const {
|
|
55370
|
+
appName = "app",
|
|
55371
|
+
module,
|
|
55372
|
+
goTo,
|
|
55373
|
+
t,
|
|
55374
|
+
location,
|
|
55375
|
+
isMobile,
|
|
55376
|
+
getRedirectLink,
|
|
55377
|
+
AdminService,
|
|
55378
|
+
options,
|
|
55379
|
+
handleError,
|
|
55380
|
+
defaultPageSize = 20,
|
|
55381
|
+
view,
|
|
55382
|
+
headerTitle = "location",
|
|
55383
|
+
breadcrumbs,
|
|
55384
|
+
refetchTrigger,
|
|
55385
|
+
getData
|
|
55386
|
+
} = config;
|
|
55387
|
+
const handleMergeLocations = React.useCallback(async mergeData => {
|
|
55388
|
+
try {
|
|
55389
|
+
if (AdminService.mergeLocations) {
|
|
55390
|
+
await AdminService.mergeLocations(mergeData);
|
|
55391
|
+
antd.message.success(t("Locations merged successfully"));
|
|
55392
|
+
} else {
|
|
55393
|
+
console.warn("AdminService.mergeLocations is not implemented");
|
|
55394
|
+
antd.message.success(t("Locations merged successfully"));
|
|
55395
|
+
}
|
|
55396
|
+
} catch (err) {
|
|
55397
|
+
handleError?.(err);
|
|
55398
|
+
}
|
|
55399
|
+
}, [AdminService, t, handleError]);
|
|
55400
|
+
|
|
55401
|
+
// Use custom getData if provided, otherwise use default AdminService.getLocations
|
|
55402
|
+
const getLocations = React.useCallback(params => {
|
|
55403
|
+
if (getData) {
|
|
55404
|
+
return getData(params);
|
|
55405
|
+
}
|
|
55406
|
+
return AdminService.getLocations(params);
|
|
55407
|
+
}, [getData, AdminService]);
|
|
55408
|
+
return /*#__PURE__*/jsxRuntime.jsx(LocationTable, {
|
|
55409
|
+
t: t,
|
|
55410
|
+
goTo: goTo,
|
|
55411
|
+
getRedirectLink: getRedirectLink,
|
|
55412
|
+
location: location,
|
|
55413
|
+
module: module,
|
|
55414
|
+
headerTitle: headerTitle,
|
|
55415
|
+
getData: getLocations,
|
|
55416
|
+
isMobile: isMobile,
|
|
55417
|
+
defaultPageSize: defaultPageSize,
|
|
55418
|
+
view: view,
|
|
55419
|
+
breadcrumbs: breadcrumbs,
|
|
55420
|
+
mergeSubjectsFunction: handleMergeLocations,
|
|
55421
|
+
refetchTrigger: refetchTrigger,
|
|
55422
|
+
config: {
|
|
55423
|
+
options: {
|
|
55424
|
+
category: options?.category,
|
|
55425
|
+
countries: options?.countries
|
|
55426
|
+
}
|
|
55427
|
+
}
|
|
55428
|
+
});
|
|
55429
|
+
}
|
|
55430
|
+
|
|
55296
55431
|
function getAdminRoutes(config) {
|
|
55297
55432
|
const {
|
|
55298
55433
|
appName,
|
|
@@ -55300,11 +55435,11 @@ function getAdminRoutes(config) {
|
|
|
55300
55435
|
useAdminUsersConfig,
|
|
55301
55436
|
useAdminAccountsConfig,
|
|
55302
55437
|
useAdminAccountsViewConfig,
|
|
55438
|
+
useAdminSubjectsConfig,
|
|
55439
|
+
useAdminLocationConfig,
|
|
55303
55440
|
userIsAdmin
|
|
55304
55441
|
} = config;
|
|
55305
55442
|
const APP_PREFIX = "APP_".concat(appName.toUpperCase());
|
|
55306
|
-
|
|
55307
|
-
// Wrapper components that use the configuration hooks
|
|
55308
55443
|
function DashboardWrapper() {
|
|
55309
55444
|
const dashboardConfig = useAdminDashboardConfig();
|
|
55310
55445
|
return /*#__PURE__*/jsxRuntime.jsx(AdminDashboardScreen, {
|
|
@@ -55329,11 +55464,24 @@ function getAdminRoutes(config) {
|
|
|
55329
55464
|
config: accountsViewConfig
|
|
55330
55465
|
});
|
|
55331
55466
|
}
|
|
55332
|
-
|
|
55467
|
+
function SubjectsWrapper() {
|
|
55468
|
+
const subjectsConfig = typeof useAdminSubjectsConfig === "function" ? useAdminSubjectsConfig() : undefined;
|
|
55469
|
+
return /*#__PURE__*/jsxRuntime.jsx(AdminSubjectsScreen, {
|
|
55470
|
+
config: subjectsConfig
|
|
55471
|
+
});
|
|
55472
|
+
}
|
|
55473
|
+
function LocationWrapper() {
|
|
55474
|
+
const locationConfig = typeof useAdminLocationConfig === "function" ? useAdminLocationConfig() : undefined;
|
|
55475
|
+
return /*#__PURE__*/jsxRuntime.jsx(AdminLocationScreen, {
|
|
55476
|
+
config: locationConfig
|
|
55477
|
+
});
|
|
55478
|
+
}
|
|
55479
|
+
const subjectsIndexComponent = typeof useAdminLocationConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(LocationWrapper, {}) : typeof useAdminSubjectsConfig === "function" ? /*#__PURE__*/jsxRuntime.jsx(SubjectsWrapper, {}) : /*#__PURE__*/jsxRuntime.jsx("div", {});
|
|
55480
|
+
const routes = [{
|
|
55333
55481
|
path: "",
|
|
55334
55482
|
key: "".concat(APP_PREFIX, "_DASHBOARD"),
|
|
55335
55483
|
exact: true,
|
|
55336
|
-
visible:
|
|
55484
|
+
visible: user => userIsAdmin(user),
|
|
55337
55485
|
component: /*#__PURE__*/jsxRuntime.jsx(DashboardWrapper, {})
|
|
55338
55486
|
}, {
|
|
55339
55487
|
path: "accounts",
|
|
@@ -55353,7 +55501,26 @@ function getAdminRoutes(config) {
|
|
|
55353
55501
|
exact: true,
|
|
55354
55502
|
visible: user => userIsAdmin(user),
|
|
55355
55503
|
component: /*#__PURE__*/jsxRuntime.jsx(AccountsViewWrapper, {})
|
|
55356
|
-
}
|
|
55504
|
+
}, {
|
|
55505
|
+
path: "subjects",
|
|
55506
|
+
key: "".concat(APP_PREFIX, "_SUBJECTS_INDEX"),
|
|
55507
|
+
exact: true,
|
|
55508
|
+
visible: user => userIsAdmin(user),
|
|
55509
|
+
component: subjectsIndexComponent
|
|
55510
|
+
}, ...(typeof useAdminLocationConfig === "function" ? [{
|
|
55511
|
+
path: "subjects/location",
|
|
55512
|
+
key: "".concat(APP_PREFIX, "_ADMIN_SUBJECTS_LOCATIONS"),
|
|
55513
|
+
exact: true,
|
|
55514
|
+
visible: user => userIsAdmin(user),
|
|
55515
|
+
component: /*#__PURE__*/jsxRuntime.jsx(LocationWrapper, {})
|
|
55516
|
+
}] : []), ...(typeof useAdminSubjectsConfig === "function" ? [{
|
|
55517
|
+
path: "subjects/stakeholder",
|
|
55518
|
+
key: "".concat(APP_PREFIX, "_ADMIN_SUBJECTS_STAKEHOLDERS"),
|
|
55519
|
+
exact: true,
|
|
55520
|
+
visible: user => userIsAdmin(user),
|
|
55521
|
+
component: /*#__PURE__*/jsxRuntime.jsx(SubjectsWrapper, {})
|
|
55522
|
+
}] : [])];
|
|
55523
|
+
return routes;
|
|
55357
55524
|
}
|
|
55358
55525
|
|
|
55359
55526
|
const isUnderDevelopmentType = backgroundType => {
|
|
@@ -61581,6 +61748,8 @@ exports.AdminAccountsScreen = AdminAccountsScreen;
|
|
|
61581
61748
|
exports.AdminAccountsViewScreen = AdminAccountsViewScreen;
|
|
61582
61749
|
exports.AdminDashboard = AdminDashboard;
|
|
61583
61750
|
exports.AdminDashboardScreen = AdminDashboardScreen;
|
|
61751
|
+
exports.AdminLocationScreen = AdminLocationScreen;
|
|
61752
|
+
exports.AdminSubjectsScreen = AdminSubjectsScreen;
|
|
61584
61753
|
exports.AdminUsersScreen = AdminUsersScreen;
|
|
61585
61754
|
exports.AdminView = AdminView$1;
|
|
61586
61755
|
exports.AjaxSelect = AjaxSelectMain;
|