datastake-daf 0.6.797 → 0.6.799

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 (85) hide show
  1. package/dist/components/index.js +3164 -972
  2. package/dist/context/index.js +6 -6
  3. package/dist/pages/index.js +10674 -1442
  4. package/dist/services/index.js +112 -9
  5. package/dist/utils/index.js +71 -19
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/EditForm/sections.jsx +18 -8
  8. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +0 -1
  9. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
  10. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
  11. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
  12. package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +0 -1
  13. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/columns.js +79 -0
  14. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/helper.js +2 -2
  15. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +18 -8
  16. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -6
  17. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
  18. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +61 -38
  19. package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +1 -4
  20. package/src/@daf/core/components/Screens/Admin/AdminScreens/AccountsView.jsx +2 -0
  21. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  22. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +6 -7
  23. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -3
  24. package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +395 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +1 -0
  26. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +1 -0
  27. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +223 -0
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +65 -0
  29. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +73 -45
  30. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +37 -37
  31. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +48 -22
  32. package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +1 -0
  33. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/configTransformer.js +137 -0
  34. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.js +9 -0
  35. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +196 -0
  36. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/configTransformer.js +216 -0
  37. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.js +7 -0
  38. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +184 -0
  39. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +64 -0
  40. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +13 -0
  41. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +77 -0
  42. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +51 -0
  43. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
  44. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +75 -0
  45. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +7 -1
  46. package/src/@daf/core/components/Screens/Admin/AdminViews/components/SidebarMenu/index.jsx +5 -3
  47. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +13 -8
  48. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +16 -10
  49. package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/index.jsx +2 -1
  50. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +66 -26
  51. package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +193 -0
  52. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +81 -2
  53. package/src/@daf/layouts/AppLayout/index.jsx +0 -1
  54. package/src/@daf/pages/Edit/hooks/usePrepareForm.js +178 -0
  55. package/src/@daf/pages/Edit/index.jsx +356 -0
  56. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +180 -0
  57. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
  58. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +27 -0
  59. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +157 -0
  60. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +31 -0
  61. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +77 -0
  62. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +117 -0
  63. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +54 -0
  64. package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
  65. package/src/@daf/pages/View/hooks/usePrepareForm.js +11 -1
  66. package/src/@daf/pages/View/hooks/useViewUrlParams.js +23 -1
  67. package/src/@daf/pages/View/index.jsx +14 -2
  68. package/src/@daf/services/AdminService.js +111 -7
  69. package/src/@daf/services/AuthenticationService.js +1 -0
  70. package/src/@daf/services/DashboardService.js +2 -1
  71. package/src/@daf/utils/arrays.js +1 -0
  72. package/src/@daf/utils/filters.js +15 -13
  73. package/src/constants/locales/en/translation.js +7 -0
  74. package/src/constants/locales/fr/translation.js +1 -1
  75. package/src/constants/locales/sp/translation.js +1 -1
  76. package/src/helpers/Forms.js +60 -0
  77. package/src/index.js +1 -0
  78. package/src/pages.js +4 -1
  79. package/src/utils.js +4 -2
  80. package/build/favicon.ico +0 -0
  81. package/build/logo192.png +0 -0
  82. package/build/logo512.png +0 -0
  83. package/build/manifest.json +0 -25
  84. package/build/robots.txt +0 -3
  85. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -50,7 +50,7 @@ const assignParamsToUrl = (path, params) => {
50
50
  * @returns storage objects
51
51
  * @class StorageManager
52
52
  */
53
- class StorageManager$1 {
53
+ class StorageManager {
54
54
  /**
55
55
  * @description Set or update given value in localStorage
56
56
  * @static
@@ -185,11 +185,11 @@ class StorageManager$1 {
185
185
  const isProxy = () => {
186
186
  const pathname = window.location.pathname;
187
187
  if (pathname.includes('/proxy/pme') || pathname.includes('/proxy/cadd')) {
188
- return window.opener || !!StorageManager$1.get('proxy_token');
188
+ return window.opener || !!StorageManager.get('proxy_token');
189
189
  }
190
190
  return false;
191
191
  };
192
- const getToken = () => isProxy() ? StorageManager$1.get('proxy_token') : StorageManager$1.get('token');
192
+ const getToken = () => isProxy() ? StorageManager.get('proxy_token') : StorageManager.get('token');
193
193
 
194
194
  /**
195
195
  * Custom params serializer to maintain JSON format for nested objects
@@ -626,7 +626,7 @@ class ErrorService {
626
626
  class BaseService extends BaseHTTPService {
627
627
  constructor() {
628
628
  const errorHandler = createErrorHandler({
629
- getStorageManager: () => StorageManager$1,
629
+ getStorageManager: () => StorageManager,
630
630
  handleError: ({
631
631
  status,
632
632
  statusText,
@@ -646,7 +646,7 @@ class BaseService extends BaseHTTPService {
646
646
  onUnauthorized: () => {
647
647
  console.warn('[BaseService] 401 Unauthorized - Token cleared, redirecting to /');
648
648
  console.trace('[BaseService] Unauthorized call stack:');
649
- StorageManager$1.clearOne('token');
649
+ StorageManager.clearOne('token');
650
650
  if (typeof window !== 'undefined') {
651
651
  window.location.href = '/';
652
652
  }
@@ -663,7 +663,7 @@ class BaseService extends BaseHTTPService {
663
663
  getHeaders: () => {
664
664
  const config = getServicesConfig();
665
665
  return {
666
- Language: StorageManager$1.get('datastakeLng') || 'en',
666
+ Language: StorageManager.get('datastakeLng') || 'en',
667
667
  'ngrok-skip-browser-warning': true,
668
668
  Application: config.application
669
669
  };
@@ -697,6 +697,15 @@ class AdminService extends BaseService {
697
697
  url: `/accounts/${id}`
698
698
  });
699
699
  }
700
+ inviteCompanyAccount({
701
+ companyId,
702
+ data
703
+ }) {
704
+ return this.apiPost({
705
+ url: `/accounts/${companyId}/invite`,
706
+ data
707
+ });
708
+ }
700
709
  inviteAccount(data) {
701
710
  return this.apiPost({
702
711
  url: `/accounts/inviteAccount`,
@@ -765,19 +774,113 @@ class AdminService extends BaseService {
765
774
  params
766
775
  }) {
767
776
  return this.apiGet({
768
- url: `${subject}`,
777
+ url: `/management/subjects/${subject}`,
769
778
  params
770
779
  });
771
780
  }
781
+ mergeLocations({
782
+ ids,
783
+ data
784
+ }) {
785
+ const [id1, id2, ...remainingIds] = ids || [];
786
+ if (!id1 || !id2) {
787
+ throw new Error('At least two IDs are required for merging');
788
+ }
789
+ const url = `/management/merge/location/${id1}/${id2}`;
790
+ const payload = {
791
+ ...data
792
+ };
793
+ if (remainingIds.length > 0) {
794
+ payload.additionalIds = remainingIds;
795
+ }
796
+ return this.apiPost({
797
+ url,
798
+ data: payload
799
+ });
800
+ }
772
801
  mergeSubjects({
773
802
  subject,
774
- ...data
803
+ ids,
804
+ data
775
805
  }) {
806
+ const [id1, id2, ...remainingIds] = ids || [];
807
+ if (!id1 || !id2) {
808
+ throw new Error('At least two IDs are required for merging');
809
+ }
810
+ const url = `/management/merge/${subject}/${id1}/${id2}`;
811
+ const payload = {
812
+ ...data
813
+ };
814
+ if (remainingIds.length > 0) {
815
+ payload.additionalIds = remainingIds;
816
+ }
776
817
  return this.apiPost({
777
- url: `/merge/${subject}`,
818
+ url,
819
+ data: payload
820
+ });
821
+ }
822
+ getSubjectForm({
823
+ subject,
824
+ scope = 'global'
825
+ }) {
826
+ return this.apiGet({
827
+ url: `/forms/${subject}`,
828
+ params: {
829
+ scope
830
+ }
831
+ });
832
+ }
833
+ getSubjectData({
834
+ subject,
835
+ id
836
+ }) {
837
+ return this.apiGet({
838
+ url: `/management/subject/${subject}/${id}`
839
+ });
840
+ }
841
+ viewLocation({
842
+ id
843
+ }) {
844
+ return this.apiGet({
845
+ url: `/management/subject/location/${id}`
846
+ });
847
+ }
848
+ viewStakeholder({
849
+ id
850
+ }) {
851
+ return this.apiGet({
852
+ url: `/management/subject/stakeholder/${id}`
853
+ });
854
+ }
855
+ updateSubject({
856
+ subject,
857
+ id,
858
+ data
859
+ }) {
860
+ const type = subject === 'location' ? 'location' : 'stakeholder';
861
+ return this.apiPut({
862
+ url: `/management/subject/${type}/${id}`,
778
863
  data
779
864
  });
780
865
  }
866
+ deleteSubject({
867
+ subject,
868
+ id
869
+ }) {
870
+ const type = subject === 'location' ? 'location' : 'stakeholder';
871
+ return this.apiDelete({
872
+ url: `/management/subject/${type}/${id}`
873
+ });
874
+ }
875
+ getUserGrowth(activeFilter) {
876
+ return this.apiGet({
877
+ url: `/accounts/dashboard/user-growth`,
878
+ isUserManager: true,
879
+ params: {
880
+ activeFilter
881
+ }
882
+ });
883
+ }
781
884
  }
782
885
  var AdminService$1 = createLazyService(AdminService);
783
886
 
@@ -5762,7 +5762,7 @@ function filterOptions(options, filters, formsValue = {}, repeatValues = {}, fil
5762
5762
  * @param {Array} arr - The array to check.
5763
5763
  * @returns {boolean} - True if the array contains only objects, false otherwise.
5764
5764
  */
5765
- const isArrayOfObjects = arr => Array.isArray(arr) && arr.map(i => typeof i === "object").every(i => i);
5765
+ const isArrayOfObjects$1 = arr => Array.isArray(arr) && arr.map(i => typeof i === "object").every(i => i);
5766
5766
 
5767
5767
  /**
5768
5768
  * Determines if two sets of data have not changed. Used to show Save button disabled or not.
@@ -5793,7 +5793,7 @@ const hasNotChanged = (old, newData) => {
5793
5793
  return old[key] === newData[key].format("YYYY-MM-DD");
5794
5794
  }
5795
5795
  return old[key] === moment__default["default"](newData[key]._d).format("YYYY-MM-DD");
5796
- } else if (isArrayOfObjects(newData[key])) {
5796
+ } else if (isArrayOfObjects$1(newData[key])) {
5797
5797
  return newData[key].length === (old[key] || []).length && newData[key].map((oKey, i) => hasNotChanged((old[key] || [])[i] || {}, oKey || {})).every(i => i);
5798
5798
  }
5799
5799
  } catch (e) {
@@ -6052,6 +6052,54 @@ const sortForm = ({
6052
6052
  return _form;
6053
6053
  };
6054
6054
 
6055
+ // REQUIRED FOR EDIT FORM SUBMIT(SAVE)
6056
+ const extractFiles = (fileList = []) => {
6057
+ const processedFiles = fileList.map(file => file.response || file).filter(file => file?.status === "done");
6058
+
6059
+ // Remove duplicates
6060
+ return Array.isArray(processedFiles) ? [...new Set(processedFiles)] : processedFiles;
6061
+ };
6062
+ const hasFileList = value => {
6063
+ return value && typeof value === "object" && value !== null && "fileList" in value;
6064
+ };
6065
+ const hasContent = obj => {
6066
+ if (typeof obj !== "object" || obj === null) return true;
6067
+ return Object.keys(obj).some(key => propHasValue(obj[key]));
6068
+ };
6069
+ const transformPayload = payload => {
6070
+ if (!payload || typeof payload !== "object") return payload;
6071
+ const transformed = {
6072
+ ...payload
6073
+ };
6074
+ Object.keys(transformed).forEach(key => {
6075
+ const value = transformed[key];
6076
+
6077
+ // Skip null or non-object values
6078
+ if (!value || typeof value !== "object" || !propHasValue(value)) return;
6079
+
6080
+ // Handle arrays - filter out empty objects
6081
+ if (Array.isArray(value)) {
6082
+ transformed[key] = value.filter(hasContent);
6083
+ return;
6084
+ }
6085
+
6086
+ // Handle objects with fileLists
6087
+ if (hasFileList(value)) {
6088
+ transformed[key] = extractFiles(value.fileList);
6089
+ return;
6090
+ }
6091
+
6092
+ // Handle nested objects that might have fileLists
6093
+ Object.keys(value).forEach(nestedKey => {
6094
+ const nestedValue = value[nestedKey];
6095
+ if (hasFileList(nestedValue)) {
6096
+ transformed[key][nestedKey] = extractFiles(nestedValue.fileList);
6097
+ }
6098
+ });
6099
+ });
6100
+ return transformed;
6101
+ };
6102
+
6055
6103
  ({
6056
6104
  background: PropTypes__default["default"].string,
6057
6105
  style: PropTypes__default["default"].any
@@ -7506,15 +7554,14 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
7506
7554
  });
7507
7555
  return o;
7508
7556
  };
7509
- const NEW_PAGINATION_APPS = ["nashiriki"];
7510
7557
  const filterParams = (value, module) => {
7511
7558
  const {
7512
7559
  activeFilters,
7513
7560
  ...rest
7514
7561
  } = value;
7515
7562
  const {
7516
- page,
7517
- pageSize,
7563
+ page = 1,
7564
+ pageSize = 20,
7518
7565
  sortDir,
7519
7566
  sortBy,
7520
7567
  search,
@@ -7523,9 +7570,10 @@ const filterParams = (value, module) => {
7523
7570
  } = activeFilters || {};
7524
7571
  const params = {};
7525
7572
  params.pagination = JSON.stringify({
7526
- [NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
7527
- [NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
7573
+ page,
7574
+ pageSize
7528
7575
  });
7576
+ params.filters = JSON.stringify(filters);
7529
7577
  if (search && searchParams) {
7530
7578
  params.search = JSON.stringify({
7531
7579
  qs: search,
@@ -7538,16 +7586,6 @@ const filterParams = (value, module) => {
7538
7586
  by: sortBy
7539
7587
  });
7540
7588
  }
7541
- if (Object.keys(filters).length) {
7542
- if (value.sourceId && value.sourceId === "overview") {
7543
- params.filters = JSON.stringify(filters);
7544
- } else {
7545
- params.filters = JSON.stringify({
7546
- ...filters,
7547
- authorId: undefined
7548
- });
7549
- }
7550
- }
7551
7589
  return {
7552
7590
  ...rest,
7553
7591
  ...params
@@ -7753,6 +7791,13 @@ function getRedirectPath(user, fallback = '', app, isDatastake) {
7753
7791
 
7754
7792
  const en = {
7755
7793
  "All Data": "All Data",
7794
+ "sbg-admin::remove-user-title": "Remove User Title",
7795
+ "sbg-admin::remove-user-body": "Remove User Body",
7796
+ "Administrative-level-1": "Administrative Level 1",
7797
+ "Administrative-level-2": "Administrative Level 2",
7798
+ "merge-output": "Merge Output",
7799
+ "admin::current_subjects": "Current Subjects",
7800
+ "add-account": "Add Account",
7756
7801
  "Site": "Site",
7757
7802
  "Production Sites": "Production Sites",
7758
7803
  "Type of account": "Type of account",
@@ -9453,7 +9498,7 @@ const fr = {
9453
9498
  Documentation: "Documents",
9454
9499
  "Edit project": "Modifier le projet",
9455
9500
  Name: "Nom",
9456
- Type: "Tapez",
9501
+ Type: "Type",
9457
9502
  type: "Type",
9458
9503
  Province: "Province",
9459
9504
  Territory: "Territoire",
@@ -11265,7 +11310,7 @@ const sp = {
11265
11310
  "Documentation": "Documentos",
11266
11311
  "Edit project": "Modificar proyecto",
11267
11312
  "Name": "Nombre",
11268
- "Type": "Escribe",
11313
+ "Type": "Tipo",
11269
11314
  "type": "Tipo",
11270
11315
  "Province": "Provincia",
11271
11316
  "Territory": "Territorio",
@@ -14958,6 +15003,8 @@ const copyToClipboard = id => {
14958
15003
  }
14959
15004
  };
14960
15005
 
15006
+ const isArrayOfObjects = arr => Array.isArray(arr) && arr.map(i => typeof i === "object").every(i => i);
15007
+
14961
15008
  exports.ErrorFormat = ErrorFormat;
14962
15009
  exports.MessageTypes = MessageTypes;
14963
15010
  exports.StorageManager = StorageManager;
@@ -14988,6 +15035,7 @@ exports.defaultMapConfig = defaultMapConfig;
14988
15035
  exports.defaultTheme = mmtTheme;
14989
15036
  exports.displayMessage = displayMessage;
14990
15037
  exports.editErrorHandler = editErrorHandler;
15038
+ exports.extractFiles = extractFiles;
14991
15039
  exports.fetchImageAsBuffer = fetchImageAsBuffer;
14992
15040
  exports.filterCreateData = filterCreateData;
14993
15041
  exports.filterOptions = filterOptions;
@@ -15016,8 +15064,11 @@ exports.handleError = handleError;
15016
15064
  exports.handleInfo = handleInfo;
15017
15065
  exports.handleSuccess = handleSuccess;
15018
15066
  exports.handleWarning = handleWarning;
15067
+ exports.hasContent = hasContent;
15068
+ exports.hasFileList = hasFileList;
15019
15069
  exports.hasKeyInObject = hasKeyInObject;
15020
15070
  exports.hasNotChanged = hasNotChanged;
15071
+ exports.isArrayOfObjects = isArrayOfObjects;
15021
15072
  exports.isEmptyOrSpaces = isEmptyOrSpaces;
15022
15073
  exports.isModuleApproved = isModuleApproved;
15023
15074
  exports.isProxy = isProxy;
@@ -15050,6 +15101,7 @@ exports.splitStringInMultipleLines = splitStringInMultipleLines;
15050
15101
  exports.tazamaTheme = tazamaTheme;
15051
15102
  exports.tifTheme = tifTheme;
15052
15103
  exports.titleToCamelCase = titleToCamelCase;
15104
+ exports.transformPayload = transformPayload;
15053
15105
  exports.truncateString = truncateString;
15054
15106
  exports.userHasInterface = userHasInterface;
15055
15107
  exports.userIsAdmin = userIsAdmin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.797",
3
+ "version": "0.6.799",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -1,6 +1,6 @@
1
1
  import { Menu } from 'antd';
2
2
  import PropTypes from 'prop-types'
3
- import React, { useState, useEffect } from 'react';
3
+ import React, { useState, useEffect, useMemo } from 'react';
4
4
  import { formPaths } from '../../../../helpers/Forms';
5
5
  import { editErrorHandler, getInputLabel, showHideInput } from './helper';
6
6
 
@@ -92,9 +92,19 @@ export const Sections = ({
92
92
  const [formGroups, setFormGroups] = useState([]);
93
93
  const [selectedGroup, setSelectedGroup] = useState(null);
94
94
 
95
+ const formConfigToUse = useMemo(() => {
96
+ if(Array.isArray(formConf)) {
97
+ return formConf;
98
+ }
99
+ if(typeof formConf === 'object' && Object.keys(formConf)?.length) {
100
+ return formConf;
101
+ }
102
+ return [];
103
+ },[formConf])
104
+
95
105
  // Build form groups with highlight/disable state
96
106
  useEffect(() => {
97
- const _formGroups = formConf.map((c) => {
107
+ const _formGroups = formConfigToUse?.map((c) => {
98
108
  const _highlighted = getHighlighted({ ...c }, { ...data });
99
109
 
100
110
  const disabled = getDisabled({
@@ -113,7 +123,7 @@ export const Sections = ({
113
123
 
114
124
  setHasMissing(!!_formGroups.find(f => f.hasMissing));
115
125
  setFormGroups(_formGroups);
116
- }, [formConf, highlightMandatory]);
126
+ }, [formConfigToUse, highlightMandatory]);
117
127
 
118
128
  // Initial selection logic
119
129
  useEffect(() => {
@@ -121,11 +131,11 @@ export const Sections = ({
121
131
 
122
132
  if (match?.params?.formId) {
123
133
  // Special case: only group id
124
- sGroup = group || (formConf.length ? formConf[0].id : null);
134
+ sGroup = group || (formConf?.length ? formConf?.[0]?.id : null);
125
135
  } else {
126
136
  // General case: full path
127
137
  sGroup = `${group || ''}${subsection ? `/${subsection}` : ''}${subgroup ? `/${subgroup}` : ''}${formid ? `/${formid}` : ''}`;
128
- if (!group && formConf.length) {
138
+ if (!group && formConf?.length) {
129
139
  sGroup = formConf[0].id;
130
140
  }
131
141
  }
@@ -176,12 +186,12 @@ export const Sections = ({
176
186
  let sGroup;
177
187
  if (match?.params?.formId) {
178
188
  // Special case fallback
179
- sGroup = group || (formConf.length ? formConf[0].id : null);
189
+ sGroup = group || (formConf?.length ? formConf?.[0]?.id : null);
180
190
  } else {
181
191
  // General fallback
182
192
  sGroup = `${group || ''}${subsection ? `/${subsection}` : ''}${subgroup ? `/${subgroup}` : ''}${formid ? `/${formid}` : ''}`;
183
- if (!group && formConf.length) {
184
- sGroup = formConf[0].id;
193
+ if (!group && formConf?.length) {
194
+ sGroup = formConf?.[0]?.id;
185
195
  }
186
196
  }
187
197
  setSelectedGroup(sGroup);
@@ -10,7 +10,6 @@ const { useToken } = theme;
10
10
  export default function useTopContributors({ container, data = [], t }) {
11
11
  const [mainGraph, setMainGraph] = useState(null);
12
12
  const { token } = useToken();
13
-
14
13
  useEffect(() => {
15
14
  if (container.current) {
16
15
  if (mainGraph) {
@@ -8,7 +8,7 @@ export default function TopContributors({ data, loading, t }) {
8
8
  const container = useRef(null);
9
9
 
10
10
  useTopContributors({ container, data, t });
11
-
11
+ console.log("topcontributorshhhh", data);
12
12
  return (
13
13
  <Widget
14
14
  title={t(`admin::top-contributors`)}
@@ -12,7 +12,7 @@ export default function useUserGrowth({ container, data: mainData = {}, t, trans
12
12
  const [mainGraph, setMainGraph] = useState(null);
13
13
  const [data, setData] = useState([]);
14
14
  const { token } = useToken();
15
-
15
+ console.log("mainData", mainData);
16
16
  const fetchData = () => {
17
17
  const { dates = [] } = mainData;
18
18
  const _data = [];
@@ -9,7 +9,7 @@ export default function UserGrowth({ loading, data = [], t, translationKeys, fet
9
9
  const [selectValue, setSelectValue] = useState(selectOptions[0]?.value);
10
10
 
11
11
  useUserGrowth({ container, data, t, translationKeys });
12
-
12
+ console.log("usergrowthhhhh", data);
13
13
 
14
14
  useEffect(() => {
15
15
  if (typeof fetchUserGrowth === "function") {
@@ -24,7 +24,6 @@ export default function AddUserModal({ isOpen, defaultData = {}, userRoles = [],
24
24
  .catch(() => {});
25
25
  };
26
26
 
27
- console.log("hellooooooooooooooooooooooooo");
28
27
 
29
28
  return (
30
29
  <Modal
@@ -0,0 +1,79 @@
1
+ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
2
+ import { Tooltip } from "antd";
3
+ import { getNameByLevel } from "../../AdminTables/SubjectsTable/helper.js";
4
+
5
+ export const getColumns = ({ t, selectOptions, module, entity }) => {
6
+ return [
7
+ {
8
+ title: t("admin::organisation_id"),
9
+ dataIndex: "datastakeId",
10
+ key: "datastakeId",
11
+ show: true,
12
+ render: (value, all) => {
13
+ return <Tooltip title={value}>{value}</Tooltip>;
14
+ },
15
+ },
16
+ {
17
+ title: t("Name"),
18
+ dataIndex: "name",
19
+ key: "name",
20
+ show: true,
21
+ render: (value, all) => {
22
+ return <Tooltip title={value}>{value}</Tooltip>;
23
+ },
24
+ },
25
+ {
26
+ title: t("Category"),
27
+ dataIndex: "category",
28
+ key: "category",
29
+ show: true,
30
+ render: (value, all) => {
31
+ const label = findOptions(value, selectOptions?.category);
32
+ return <Tooltip title={label}>{label}</Tooltip>;
33
+ },
34
+ },
35
+ {
36
+ title: t("Country"),
37
+ dataIndex: "country",
38
+ key: "country",
39
+ show: true,
40
+ render: (value, all) => {
41
+ const label = findOptions(value, selectOptions?.country);
42
+ return <Tooltip title={label}>{label}</Tooltip>;
43
+ },
44
+ },
45
+ {
46
+ title: t("Province"),
47
+ dataIndex: "administrativeLevel1",
48
+ key: "administrativeLevel1",
49
+ ellipsis: true,
50
+ show: entity.includes("locations"),
51
+ render: (value, all) => {
52
+ let label;
53
+ if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
54
+ label = all?.linking?.SCL?.[value]?.name
55
+ } else {
56
+ label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
57
+ }
58
+
59
+ return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
60
+ },
61
+ },
62
+ {
63
+ title: t("Territory"),
64
+ dataIndex: "administrativeLevel2",
65
+ key: "administrativeLevel2",
66
+ show: entity.includes("locations"),
67
+ render: (value, all) => {
68
+ let label;
69
+ if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
70
+ label = all?.linking?.SCL?.[value]?.name
71
+ } else {
72
+ label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
73
+ }
74
+
75
+ return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
76
+ },
77
+ },
78
+ ].filter((c) => c?.show);
79
+ };
@@ -47,7 +47,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
47
47
  dataIndex: "administrativeLevel1",
48
48
  key: "administrativeLevel1",
49
49
  ellipsis: true,
50
- show: entity.includes("locations"),
50
+ show: entity?.includes("location"),
51
51
  render: (value, all) => {
52
52
  let label;
53
53
  if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
@@ -63,7 +63,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
63
63
  title: t("Territory"),
64
64
  dataIndex: "administrativeLevel2",
65
65
  key: "administrativeLevel2",
66
- show: entity.includes("locations"),
66
+ show: entity?.includes("location"),
67
67
  render: (value, all) => {
68
68
  let label;
69
69
  if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
@@ -1,11 +1,10 @@
1
1
  import Modal from "../../../../Modal/index.jsx";
2
2
  import { Form, Input, Select, theme } from "antd";
3
3
  import { Container } from "../CombineModalStyle.js";
4
- import { findOptions } from "../../../../../../../helpers/StringHelper.js";
5
4
  import DAFTable from "../../../../Table/index.jsx";
6
5
  import { useMemo, useState } from "react";
7
- import { getColumns } from "./helper.js";
8
6
  import { getNameByLevel } from "../../AdminTables/SubjectsTable/helper.js";
7
+ import { getColumns } from "./helper.js";
9
8
 
10
9
  const { useToken } = theme;
11
10
 
@@ -35,10 +34,22 @@ export default function CombineLocationModal({
35
34
 
36
35
  const onSubmit = () => {
37
36
  MainForm.validateFields().then((data) => {
38
- const ids = selectedLocations.map((location) => location._id);
37
+ const ids = selectedLocations.map((location) => location.id);
38
+ const allowedKeys = [
39
+ "id",
40
+ "name",
41
+ "country",
42
+ "category",
43
+ "administrativeLevel1",
44
+ "administrativeLevel2"
45
+ ];
46
+ const filteredData = Object.fromEntries(
47
+ Object.entries(data).filter(([key]) => allowedKeys.includes(key))
48
+ );
49
+
39
50
  onSuccess({
40
51
  ids,
41
- data,
52
+ data: filteredData,
42
53
  });
43
54
  });
44
55
  };
@@ -57,8 +68,7 @@ export default function CombineLocationModal({
57
68
  setIsDisabled(() => {
58
69
  const values = MainForm.getFieldsValue();
59
70
 
60
- const requiredFields =
61
- entity === "location"
71
+ const requiredFields = entity?.includes("location")
62
72
  ? ["id", "name", "category", "country", "administrativeLevel1", "administrativeLevel2"]
63
73
  : ["id", "name", "category", "country"];
64
74
 
@@ -114,7 +124,7 @@ export default function CombineLocationModal({
114
124
  options={selectedLocations.map((location) => {
115
125
  return {
116
126
  label: location?.datastakeId || "-",
117
- value: location?.datastakeId || "-",
127
+ value: location?.id || "-",
118
128
  };
119
129
  })}
120
130
  placeholder={t("ID")}
@@ -169,7 +179,7 @@ export default function CombineLocationModal({
169
179
  ></Select>
170
180
  </Form.Item>
171
181
 
172
- {entity.includes("locations") && (
182
+ {entity?.includes("location") && (
173
183
  <>
174
184
  <Form.Item className="flex-1" name="administrativeLevel1">
175
185
  <Select