datastake-daf 0.6.764 → 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.
Files changed (60) hide show
  1. package/dist/components/index.js +353 -191
  2. package/dist/layouts/index.js +0 -3
  3. package/dist/pages/index.js +308 -223
  4. package/dist/services/index.js +18 -0
  5. package/dist/utils/index.js +312 -4
  6. package/package.json +1 -2
  7. package/src/@daf/core/components/Charts/BarChart/index.jsx +4 -0
  8. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +0 -7
  9. package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +0 -2
  10. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +3 -4
  11. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/config.js +2 -2
  12. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/index.jsx +1 -1
  13. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/helper.js +4 -1
  14. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/index.jsx +5 -0
  15. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -0
  16. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +34 -26
  17. package/src/@daf/core/components/Screens/Admin/AdminDashboard/index.jsx +56 -52
  18. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +52 -67
  19. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +96 -0
  20. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +96 -0
  21. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
  22. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +116 -89
  23. package/src/@daf/core/components/Table/MoreTags/index.jsx +17 -5
  24. package/src/@daf/layouts/AuthLayout/components/Navbar/index.jsx +0 -1
  25. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +10 -10
  26. package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +6 -3
  27. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/helper.js +1 -14
  28. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +12 -5
  29. package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/index.jsx +1 -1
  30. package/src/@daf/pages/Dashboards/UserDashboard/components/Triangulation/hook.js +1 -1
  31. package/src/@daf/pages/Data/Channels/columns.js +175 -0
  32. package/src/@daf/pages/Data/Channels/config.js +0 -0
  33. package/src/@daf/pages/Data/Channels/create.jsx +0 -0
  34. package/src/@daf/pages/Data/Channels/index.jsx +0 -0
  35. package/src/@daf/pages/Events/Activities/columns.js +1 -4
  36. package/src/@daf/pages/Events/helper.js +3 -2
  37. package/src/@daf/pages/Events/index.jsx +1 -1
  38. package/src/@daf/pages/Locations/MineSite/columns.js +6 -4
  39. package/src/@daf/pages/Stakeholders/Operators/columns.js +4 -2
  40. package/src/@daf/pages/Summary/Activities/PlantingCycle/config.js +40 -0
  41. package/src/@daf/pages/Summary/Activities/PlantingCycle/helper.js +122 -0
  42. package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +47 -0
  43. package/src/@daf/pages/Summary/Activities/Restoration/config.js +1 -1
  44. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +2 -2
  45. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +7 -7
  46. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +3 -2
  47. package/src/@daf/pages/Summary/Minesite/index.jsx +3 -1
  48. package/src/@daf/pages/Summary/Operator/components/Governance/index.js +0 -1
  49. package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +33 -21
  50. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +13 -13
  51. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +8 -8
  52. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +5 -2
  53. package/src/@daf/pages/Summary/Operator/index.jsx +3 -0
  54. package/src/@daf/pages/Summary/components/InformationAvailability/index.js +4 -3
  55. package/src/@daf/services/AdminService.js +14 -0
  56. package/src/constants/locales/en/translation.js +104 -2
  57. package/src/constants/locales/fr/translation.js +104 -1
  58. package/src/constants/locales/sp/translation.js +104 -1
  59. package/src/index.js +2 -0
  60. package/src/pages.js +1 -0
@@ -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, [key, value]) => {
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
- config,
9948
- inputConfig,
9949
- inputKey,
9950
- value,
9951
- level,
9952
- t,
9953
- rootForm,
9954
- allData,
9955
- user,
9956
- getApiBaseUrl = () => {},
9957
- getAppHeader = () => {},
9958
- app,
9959
- TreeNodeComponent
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?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
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?.type === 'dataLink') {
9969
- const siblingTableKeys = otherConfig?.meta?.tableKeys || [];
9970
- const additionalTableKeys = config.meta?.additionalTableKeys || [];
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?.additionalTableKeys || [];
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(() => !!inputConfig?.meta?.namespace, [inputConfig]);
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?.meta?.namespace,
9993
- skipFetch: inputConfig?.meta?.skipFetch,
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?.meta?.formScope,
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?.form;
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
- const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
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?.[conditionKey] === conditionValue) {
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?.[tableKey];
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?.type
10052
+ type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
10038
10053
  };
10039
- values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
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?.[siblingKey];
10062
+ });
10063
+ values[siblingKey] = item === null || item === void 0 ? void 0 : item[siblingKey];
10050
10064
  }
10051
10065
  });
10052
- if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
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?.label && typeof formInputConfig?.label === 'object') {
10063
- const dynamicLabelKeys = Object.keys(formInputConfig?.label);
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?.[conditionKey] === conditionValue) {
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?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[fieldKey];
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?.[inputKey]?.datastakeId || merged?.datastakeId;
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(`No ID ${itemIndex + 1}`),
10112
+ nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10098
10113
  config: {
10099
- label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
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
- }, `${inputKey}-${itemIndex}`);
10128
+ }, "".concat(inputKey, "-").concat(itemIndex));
10114
10129
  });
10115
10130
  } else {
10131
+ var _merged$inputKey2;
10116
10132
  const merged = mergeObject(value);
10117
- const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
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,46 +10152,41 @@ const handleDataLinkGroupWithTableKeys = ({
10136
10152
  getApiBaseUrl: getApiBaseUrl,
10137
10153
  getAppHeader: getAppHeader,
10138
10154
  app: app
10139
- }, `${inputKey}-group`);
10155
+ }, "".concat(inputKey, "-group"));
10140
10156
  }
10141
10157
  };
10142
10158
 
10143
- const handleDataLinkWithTableKeys = _ref => {
10144
- var _inputConfig$meta, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
10145
- let {
10146
- inputConfig,
10147
- inputKey,
10148
- value,
10149
- level,
10150
- t,
10151
- rootForm,
10152
- allData,
10153
- user,
10154
- getApiBaseUrl = () => {},
10155
- getAppHeader = () => {},
10156
- app,
10157
- TreeNodeComponent
10158
- } = _ref;
10159
- 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)) {
10159
+ const handleDataLinkWithTableKeys = ({
10160
+ inputConfig,
10161
+ inputKey,
10162
+ value,
10163
+ level,
10164
+ t,
10165
+ rootForm,
10166
+ allData,
10167
+ user,
10168
+ getApiBaseUrl = () => {},
10169
+ getAppHeader = () => {},
10170
+ app,
10171
+ TreeNodeComponent
10172
+ }) => {
10173
+ if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
10160
10174
  return null;
10161
10175
  }
10162
10176
  const tableKeys = inputConfig.meta.tableKeys;
10163
- const isAjaxModal = React.useMemo(() => {
10164
- var _inputConfig$meta2;
10165
- return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
10166
- }, [inputConfig]);
10177
+ const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
10167
10178
  const ajaxModalValues = useAjaxModal$2({
10168
10179
  name: inputKey,
10169
10180
  user,
10170
- namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
10171
- skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
10181
+ namespace: inputConfig?.meta?.namespace,
10182
+ skipFetch: inputConfig?.meta?.skipFetch,
10172
10183
  isAjaxModal,
10173
- formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
10184
+ formScope: inputConfig?.meta?.formScope,
10174
10185
  APP: app,
10175
10186
  apiBaseUrl: getApiBaseUrl(),
10176
10187
  _getAppHeader: getAppHeader
10177
10188
  });
10178
- const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
10189
+ const dataLinkForm = ajaxModalValues?.form;
10179
10190
  const createInputsAndValues = item => {
10180
10191
  const inputs = {};
10181
10192
  const values = {};
@@ -10188,20 +10199,19 @@ const handleDataLinkWithTableKeys = _ref => {
10188
10199
  };
10189
10200
  const isUploadFieldEmpty = (fieldKey, itemToCheck) => {
10190
10201
  if (uploadTypeFields.includes(fieldKey)) {
10191
- const itemValue = itemToCheck === null || itemToCheck === void 0 ? void 0 : itemToCheck[fieldKey];
10202
+ const itemValue = itemToCheck?.[fieldKey];
10192
10203
  return itemValue === undefined || itemValue === null || Array.isArray(itemValue) && itemValue.length === 0;
10193
10204
  }
10194
10205
  return false;
10195
10206
  };
10196
10207
  const processedTableKeys = processConditionalTableKeys(tableKeys, item);
10197
10208
  processedTableKeys.filter(tableKey => tableKey !== 'datastakeId').filter(tableKey => !isUploadFieldEmpty(tableKey, item)).forEach(tableKey => {
10198
- var _dataLinkForm$identif;
10199
- 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]);
10209
+ const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
10200
10210
  if (formInputConfig) {
10201
- var _item$linking, _formInputConfig$meta, _formInputConfig$tabl;
10202
- inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10211
+ inputs[tableKey] = {
10212
+ ...formInputConfig,
10203
10213
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
10204
- });
10214
+ };
10205
10215
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
10206
10216
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
10207
10217
  let resolvedLabel = null;
@@ -10209,7 +10219,7 @@ const handleDataLinkWithTableKeys = _ref => {
10209
10219
  const parts = labelKey.split(' is ');
10210
10220
  if (parts.length === 2) {
10211
10221
  const [conditionKey, conditionValue] = parts;
10212
- if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
10222
+ if (item?.[conditionKey] === conditionValue) {
10213
10223
  resolvedLabel = formInputConfig.label[labelKey];
10214
10224
  break;
10215
10225
  }
@@ -10217,17 +10227,16 @@ const handleDataLinkWithTableKeys = _ref => {
10217
10227
  }
10218
10228
  inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
10219
10229
  }
10220
- 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[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$meta = formInputConfig.meta) === null || _formInputConfig$meta === void 0 ? void 0 : _formInputConfig$meta.onNewSetValueKey] || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl = formInputConfig.tableLabel) === null || _formInputConfig$tabl === void 0 ? void 0 : _formInputConfig$tabl.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[tableKey]);
10230
+ values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item[formInputConfig?.meta?.onNewSetValueKey] || item?.[formInputConfig?.tableLabel?.toLowerCase()] || item?.[tableKey];
10221
10231
  } else {
10222
- var _item$linking2;
10223
10232
  inputs[tableKey] = {
10224
10233
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
10225
- type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
10234
+ type: inputConfig?.type
10226
10235
  };
10227
- values[tableKey] = (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[tableKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[tableKey]);
10236
+ values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
10228
10237
  }
10229
10238
  });
10230
- if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
10239
+ if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
10231
10240
  Object.keys(dataLinkForm.identification).filter(fieldKey => {
10232
10241
  if (uploadTypeFields.includes(fieldKey)) {
10233
10242
  return !isUploadFieldEmpty(fieldKey, item);
@@ -10237,11 +10246,11 @@ const handleDataLinkWithTableKeys = _ref => {
10237
10246
  const formInputConfig = dataLinkForm.identification[fieldKey];
10238
10247
  return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
10239
10248
  }).forEach(fieldKey => {
10240
- var _item$linking3, _formInputConfig$tabl2;
10241
10249
  const formInputConfig = dataLinkForm.identification[fieldKey];
10242
- inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10250
+ inputs[fieldKey] = {
10251
+ ...formInputConfig,
10243
10252
  label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
10244
- });
10253
+ };
10245
10254
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
10246
10255
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
10247
10256
  let resolvedLabel = null;
@@ -10249,7 +10258,7 @@ const handleDataLinkWithTableKeys = _ref => {
10249
10258
  const parts = labelKey.split(' is ');
10250
10259
  if (parts.length === 2) {
10251
10260
  const [conditionKey, conditionValue] = parts;
10252
- if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
10261
+ if (item?.[conditionKey] === conditionValue) {
10253
10262
  resolvedLabel = formInputConfig.label[labelKey];
10254
10263
  break;
10255
10264
  }
@@ -10257,7 +10266,7 @@ const handleDataLinkWithTableKeys = _ref => {
10257
10266
  }
10258
10267
  inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
10259
10268
  }
10260
- values[fieldKey] = (item === null || item === void 0 || (_item$linking3 = item.linking) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3.SCL) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3[item === null || item === void 0 ? void 0 : item[fieldKey]]) === null || _item$linking3 === void 0 ? void 0 : _item$linking3.name) || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl2 = formInputConfig.tableLabel) === null || _formInputConfig$tabl2 === void 0 ? void 0 : _formInputConfig$tabl2.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
10269
+ values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[formInputConfig?.tableLabel?.toLowerCase()] || item?.[fieldKey];
10261
10270
  });
10262
10271
  }
10263
10272
  return {
@@ -10267,7 +10276,7 @@ const handleDataLinkWithTableKeys = _ref => {
10267
10276
  };
10268
10277
  if (Array.isArray(value)) {
10269
10278
  return value.map((item, itemIndex) => {
10270
- const datastakeIdValue = item === null || item === void 0 ? void 0 : item.datastakeId;
10279
+ const datastakeIdValue = item?.datastakeId;
10271
10280
  const {
10272
10281
  inputs,
10273
10282
  values
@@ -10276,9 +10285,9 @@ const handleDataLinkWithTableKeys = _ref => {
10276
10285
  return null;
10277
10286
  }
10278
10287
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10279
- nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10288
+ nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10280
10289
  config: {
10281
- label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10290
+ label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10282
10291
  type: 'custom-datalink',
10283
10292
  inputs: inputs
10284
10293
  },
@@ -10292,10 +10301,10 @@ const handleDataLinkWithTableKeys = _ref => {
10292
10301
  getApiBaseUrl: getApiBaseUrl,
10293
10302
  getAppHeader: getAppHeader,
10294
10303
  app: app
10295
- }, "".concat(inputKey, "-").concat(itemIndex));
10304
+ }, `${inputKey}-${itemIndex}`);
10296
10305
  });
10297
10306
  } else {
10298
- const datastakeIdValue = value === null || value === void 0 ? void 0 : value.datastakeId;
10307
+ const datastakeIdValue = value?.datastakeId;
10299
10308
  const {
10300
10309
  inputs,
10301
10310
  values
@@ -10320,7 +10329,7 @@ const handleDataLinkWithTableKeys = _ref => {
10320
10329
  getApiBaseUrl: getApiBaseUrl,
10321
10330
  getAppHeader: getAppHeader,
10322
10331
  app: app
10323
- }, "".concat(inputKey, "-single"));
10332
+ }, `${inputKey}-single`);
10324
10333
  }
10325
10334
  };
10326
10335
 
@@ -13730,12 +13739,6 @@ function LocationIcon({
13730
13739
  }).addTo(mapRef);
13731
13740
  const div = document.getElementById(markerId);
13732
13741
  root.current = client.createRoot(div);
13733
- console.log({
13734
- locationID: data.datastakeId,
13735
- stakeholder,
13736
- index,
13737
- parentId: data.datastakeId
13738
- });
13739
13742
  root.current.render( /*#__PURE__*/jsxRuntime.jsx(StakeholderIcon$1, {
13740
13743
  data: stakeholder,
13741
13744
  zoom: zoom,
@@ -46297,7 +46300,7 @@ const Container$1 = styled__default["default"].div`
46297
46300
  width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
46298
46301
  `;
46299
46302
 
46300
- 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"];
46301
46304
  const {
46302
46305
  useToken: useToken$g
46303
46306
  } = antd.theme;
@@ -46384,7 +46387,8 @@ function BarChart(_ref) {
46384
46387
  t = s => s,
46385
46388
  isPdf = false,
46386
46389
  legendConfig = {},
46387
- width
46390
+ width,
46391
+ xAxisConfig = {}
46388
46392
  } = _ref;
46389
46393
  _objectWithoutProperties(_ref, _excluded$7);
46390
46394
  const containerRef = React__default["default"].useRef(null);
@@ -46411,14 +46415,14 @@ function BarChart(_ref) {
46411
46415
  data,
46412
46416
  xField: xFieldKey,
46413
46417
  yField: yFieldKey,
46414
- xAxis: _objectSpread2(_objectSpread2({}, isPercentage ? {
46418
+ xAxis: _objectSpread2(_objectSpread2(_objectSpread2({}, isPercentage ? {
46415
46419
  tickMethod: () => {
46416
46420
  return Array.from(new Array(11), (v, i) => i * 10);
46417
46421
  }
46418
- } : {}), {}, {
46419
- label: {
46422
+ } : {}), xAxisConfig), {}, {
46423
+ label: _objectSpread2({
46420
46424
  formatter: isPercentage ? v => "".concat(v).replace(/\d{1,3}(?=(\d{3})+$)/g, s => "".concat(s, ",")) + " %" : formattedXAxis
46421
- }
46425
+ }, xAxisConfig === null || xAxisConfig === void 0 ? void 0 : xAxisConfig.label)
46422
46426
  }),
46423
46427
  yAxis: {
46424
46428
  label: {
@@ -46442,7 +46446,7 @@ function BarChart(_ref) {
46442
46446
  } else {
46443
46447
  chartRef.current.update(config);
46444
46448
  }
46445
- }, [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]);
46446
46450
  React__default["default"].useEffect(() => {
46447
46451
  return () => {
46448
46452
  if (chartRef.current) {
@@ -49155,7 +49159,6 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
49155
49159
  withDuration = true,
49156
49160
  onFilterChange,
49157
49161
  isPdf,
49158
- zoomOutTransition = false,
49159
49162
  ...props
49160
49163
  }, ref) {
49161
49164
  const {
@@ -49178,8 +49181,8 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
49178
49181
  fitView({
49179
49182
  padding: 0.4,
49180
49183
  nodes: [...nodesToFit],
49181
- duration: withDuration ? 300 : undefined,
49182
- maxZoom: 0.8
49184
+ // duration: withDuration ? 300 : undefined,
49185
+ maxZoom: 0.9
49183
49186
  });
49184
49187
  });
49185
49188
  }, [JSON.stringify(nodesToFit), withDuration]);
@@ -49211,11 +49214,8 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
49211
49214
  fitView: true // zoom out on default
49212
49215
  ,
49213
49216
  fitViewOptions: {
49214
- padding: 0.2,
49215
- //zoom out on default
49216
- ...(zoomOutTransition ? {
49217
- duration: withDuration ? 300 : undefined
49218
- } : {})
49217
+ padding: 0.2 //zoom out on default
49218
+ // ...(zoomOutTransition ? { duration: withDuration ? 300 : undefined } : {}),
49219
49219
  },
49220
49220
  ...props,
49221
49221
  children: !isPdf && /*#__PURE__*/jsxRuntime.jsxs(react.Controls, {
@@ -49812,8 +49812,7 @@ function StakeholderMappings(_ref3) {
49812
49812
  iconOffsetY = 250,
49813
49813
  t = s => s,
49814
49814
  emptyString = undefined,
49815
- isPdf = false,
49816
- zoomOutTransition = false
49815
+ isPdf = false
49817
49816
  } = _ref3;
49818
49817
  const reactFlowWrapper = React.useRef(null);
49819
49818
  const [nodes, setNodes] = react.useNodesState([]);
@@ -50078,7 +50077,6 @@ function StakeholderMappings(_ref3) {
50078
50077
  });
50079
50078
  }, [reactFlowWrapper.current, JSON.stringify(data), JSON.stringify(selectedIconNodes), isAllOpenDefault, isSelectable, isChanged, emptyString]);
50080
50079
  return /*#__PURE__*/jsxRuntime.jsx(BaseGraph, {
50081
- zoomOutTransition: zoomOutTransition,
50082
50080
  nodes: nodes,
50083
50081
  mandatoryNodesToFit: mandatoryNodesToFit,
50084
50082
  edges: edges,
@@ -50273,7 +50271,7 @@ function getConfig(data, goTo, t) {
50273
50271
  className: "flex",
50274
50272
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50275
50273
  className: "flex-1",
50276
- children: t(`admin::${item.title}`)
50274
+ children: t(`${item.title}`)
50277
50275
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
50278
50276
  className: "cursor-pointer",
50279
50277
  onClick: () => goTo(item.goToPath),
@@ -50344,6 +50342,8 @@ const getColor = (users, items) => {
50344
50342
  };
50345
50343
  function useConfig(data) {
50346
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 : [];
50347
50347
  const start = moment__default["default"]().add(-1, "years").format("MMM YY");
50348
50348
  let now = moment__default["default"](start, "MMM YY");
50349
50349
  const _config = [];
@@ -50356,7 +50356,7 @@ function useConfig(data) {
50356
50356
  while (true) {
50357
50357
  DAYS$1.forEach(d => {
50358
50358
  if (d === nowMonth.format("dd") && now.format("MMM YY") === nowMonth.format("MMM YY")) {
50359
- const users = data.find(d => d._id === nowMonth.format("YYYY-MM-DD"))?.count || 0;
50359
+ const users = safeData.find(d => d._id === nowMonth.format("YYYY-MM-DD"))?.count || 0;
50360
50360
  conf.push({
50361
50361
  date: nowMonth.format("DD MMM YY"),
50362
50362
  active: true,
@@ -50407,6 +50407,9 @@ function UserActivity({
50407
50407
  const {
50408
50408
  isCollapsed
50409
50409
  } = useResizeContext();
50410
+
50411
+ // console.log("userActivityyyyy",data);
50412
+
50410
50413
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
50411
50414
  title: t(`admin::user-activity`),
50412
50415
  loading: loading,
@@ -50850,6 +50853,13 @@ function UserStatistics({
50850
50853
  t,
50851
50854
  translationKeys
50852
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
+
50853
50863
  return /*#__PURE__*/jsxRuntime.jsx(Widget, {
50854
50864
  title: t(`${translationKeys}-admin::usage-statistics`),
50855
50865
  className: "with-border-header",
@@ -50857,18 +50867,18 @@ function UserStatistics({
50857
50867
  className: "flex flex-column gap-6",
50858
50868
  children: [/*#__PURE__*/jsxRuntime.jsx(UserActivity, {
50859
50869
  loading: loading,
50860
- data: data.userActivityData,
50870
+ data: data.userActivityData || [],
50861
50871
  t: t
50862
50872
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
50863
50873
  className: "flex flex-row flex-col-mobile gap-6",
50864
50874
  children: [/*#__PURE__*/jsxRuntime.jsx(TopContributors, {
50865
- data: data.topContributorsData,
50875
+ data: data.topContributorsData || [],
50866
50876
  loading: loading,
50867
50877
  t: t
50868
50878
  }), /*#__PURE__*/jsxRuntime.jsx(UserGrowth, {
50869
50879
  t: t,
50870
50880
  loading: loadingUserGrowth,
50871
- data: data.userGrowthData,
50881
+ data: data.userGrowthData || [],
50872
50882
  fetchUserGrowth: fetchUserGrowth,
50873
50883
  translationKeys: translationKeys
50874
50884
  })]
@@ -50886,11 +50896,11 @@ function AdminDashboard(_ref) {
50886
50896
  adminTranslationIdentifier,
50887
50897
  t,
50888
50898
  loadingUserGrowth,
50889
- fetchUserGrowth = () => {}
50899
+ fetchUserGrowth = () => {},
50900
+ userGrowthData
50890
50901
  } = _ref;
50891
- const {
50892
- keyIndicatorsData
50893
- } = data;
50902
+ const keyIndicatorsCards = Array.isArray(data === null || data === void 0 ? void 0 : data.keyIndicatorsData) ? data.keyIndicatorsData : [];
50903
+ console.log("AdminDashboard:data", data);
50894
50904
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
50895
50905
  className: "daf-analysis admin-dashboard",
50896
50906
  children: [/*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
@@ -50904,22 +50914,21 @@ function AdminDashboard(_ref) {
50904
50914
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
50905
50915
  className: "sections-cont w-pt",
50906
50916
  children: [/*#__PURE__*/jsxRuntime.jsx("section", {
50907
- children: actionWidgetConfig.map(widgetConfig => {
50908
- return /*#__PURE__*/jsxRuntime.jsx(ActionWidget, _objectSpread2(_objectSpread2({}, widgetConfig), {}, {
50909
- onClick: () => goTo(widgetConfig.goToPath),
50910
- title: t("admin::".concat(widgetConfig.title))
50911
- }), widgetConfig.title);
50912
- })
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))
50913
50921
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
50914
50922
  children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
50915
- data: keyIndicatorsData,
50923
+ data: keyIndicatorsCards,
50916
50924
  loading: loading,
50917
50925
  goTo: goTo,
50918
50926
  t: t
50919
50927
  })
50920
50928
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
50921
50929
  children: /*#__PURE__*/jsxRuntime.jsx(UserStatistics, {
50922
- data: data,
50930
+ data: _objectSpread2({}, data),
50931
+ userGrowthData: userGrowthData,
50923
50932
  loading: loading,
50924
50933
  t: t,
50925
50934
  loadingUserGrowth: loadingUserGrowth,
@@ -55045,45 +55054,34 @@ function AdminDashboardScreen({
55045
55054
  fetchUserGrowth,
55046
55055
  userGrowthDataLoading
55047
55056
  } = useWidgetFetch();
55057
+ console.log({
55058
+ userGrowthData
55059
+ });
55048
55060
  const actionsWidgetsConfig = React.useMemo(() => getActionWidgetsConfig({
55049
55061
  getRedirectLink
55050
- }), [getRedirectLink]);
55062
+ }), [getRedirectLink, getActionWidgetsConfig]);
55051
55063
  const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsConfig({
55052
55064
  getRedirectLink,
55053
- keyIndicatorsData: data?.keyInformation
55054
- }), [data?.keyInformation, getRedirectLink]);
55055
-
55056
- // Dummy data for top contributors if not provided
55057
- const TOTAL_DUMMY = [{
55058
- label: "Contributor 1",
55059
- Score: 0
55060
- }, {
55061
- label: "Contributor 2",
55062
- Score: 0
55063
- }, {
55064
- label: "Contributor 3",
55065
- Score: 0
55066
- }, {
55067
- label: "Contributor 4",
55068
- Score: 0
55069
- }, {
55070
- label: "Contributor 5",
55071
- Score: 0
55072
- }];
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 : [];
55073
55070
  return /*#__PURE__*/jsxRuntime.jsx(AdminDashboard, {
55074
55071
  t: t,
55075
- loading: loading,
55076
55072
  goTo: goTo,
55073
+ loading: loading,
55077
55074
  actionWidgetConfig: actionsWidgetsConfig,
55078
55075
  loadingUserGrowth: userGrowthDataLoading,
55079
55076
  fetchUserGrowth: fetchUserGrowth,
55077
+ adminTranslationIdentifier: appName,
55080
55078
  data: {
55081
55079
  keyIndicatorsData: keyIndicatorsConfig,
55082
- userActivityData: data?.userActivity,
55083
- topContributorsData: data?.topContributors || TOTAL_DUMMY,
55084
- userGrowthData: userGrowthData
55085
- },
55086
- adminTranslationIdentifier: appName
55080
+ userActivityData: safeUserActivity,
55081
+ topContributorsData: safeTopContributors,
55082
+ userGrowthData: safeUserGrowth,
55083
+ data: data
55084
+ }
55087
55085
  });
55088
55086
  }
55089
55087
 
@@ -55300,6 +55298,136 @@ function AdminAccountsViewScreen({
55300
55298
  });
55301
55299
  }
55302
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
+
55303
55431
  function getAdminRoutes(config) {
55304
55432
  const {
55305
55433
  appName,
@@ -55307,11 +55435,11 @@ function getAdminRoutes(config) {
55307
55435
  useAdminUsersConfig,
55308
55436
  useAdminAccountsConfig,
55309
55437
  useAdminAccountsViewConfig,
55438
+ useAdminSubjectsConfig,
55439
+ useAdminLocationConfig,
55310
55440
  userIsAdmin
55311
55441
  } = config;
55312
55442
  const APP_PREFIX = "APP_".concat(appName.toUpperCase());
55313
-
55314
- // Wrapper components that use the configuration hooks
55315
55443
  function DashboardWrapper() {
55316
55444
  const dashboardConfig = useAdminDashboardConfig();
55317
55445
  return /*#__PURE__*/jsxRuntime.jsx(AdminDashboardScreen, {
@@ -55336,11 +55464,24 @@ function getAdminRoutes(config) {
55336
55464
  config: accountsViewConfig
55337
55465
  });
55338
55466
  }
55339
- return [{
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 = [{
55340
55481
  path: "",
55341
55482
  key: "".concat(APP_PREFIX, "_DASHBOARD"),
55342
55483
  exact: true,
55343
- visible: () => true,
55484
+ visible: user => userIsAdmin(user),
55344
55485
  component: /*#__PURE__*/jsxRuntime.jsx(DashboardWrapper, {})
55345
55486
  }, {
55346
55487
  path: "accounts",
@@ -55360,7 +55501,26 @@ function getAdminRoutes(config) {
55360
55501
  exact: true,
55361
55502
  visible: user => userIsAdmin(user),
55362
55503
  component: /*#__PURE__*/jsxRuntime.jsx(AccountsViewWrapper, {})
55363
- }];
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;
55364
55524
  }
55365
55525
 
55366
55526
  const isUnderDevelopmentType = backgroundType => {
@@ -61588,6 +61748,8 @@ exports.AdminAccountsScreen = AdminAccountsScreen;
61588
61748
  exports.AdminAccountsViewScreen = AdminAccountsViewScreen;
61589
61749
  exports.AdminDashboard = AdminDashboard;
61590
61750
  exports.AdminDashboardScreen = AdminDashboardScreen;
61751
+ exports.AdminLocationScreen = AdminLocationScreen;
61752
+ exports.AdminSubjectsScreen = AdminSubjectsScreen;
61591
61753
  exports.AdminUsersScreen = AdminUsersScreen;
61592
61754
  exports.AdminView = AdminView$1;
61593
61755
  exports.AjaxSelect = AjaxSelectMain;