datastake-daf 0.6.782 → 0.6.784

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 (58) hide show
  1. package/dist/components/index.js +400 -328
  2. package/dist/hooks/index.js +3 -1
  3. package/dist/pages/index.js +3035 -685
  4. package/dist/utils/index.js +22 -0
  5. package/package.json +1 -1
  6. package/src/@daf/core/components/Charts/BarChart/index.jsx +1 -1
  7. package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +9 -76
  8. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +116 -8
  9. package/src/@daf/core/components/Dashboard/Map/ChainIcon/utils.js +73 -17
  10. package/src/@daf/core/components/Dashboard/Map/helper.js +1 -0
  11. package/src/@daf/core/components/Dashboard/Map/hook.js +64 -29
  12. package/src/@daf/core/components/Dashboard/Map/style.js +20 -5
  13. package/src/@daf/core/components/Screens/BaseScreen/index.jsx +1 -0
  14. package/src/@daf/core/components/Select/MultiSelect/index.jsx +4 -2
  15. package/src/@daf/core/components/Select/MultiSelect/style.js +15 -0
  16. package/src/@daf/hooks/useGetQueryParams.js +3 -1
  17. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +6 -7
  18. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/index.jsx +1 -1
  19. package/src/@daf/pages/Documents/config.js +5 -5
  20. package/src/@daf/pages/Events/Activities/columns.js +5 -0
  21. package/src/@daf/pages/Events/Activities/config.js +21 -17
  22. package/src/@daf/pages/Events/Incidents/columns.js +5 -0
  23. package/src/@daf/pages/Events/Incidents/config.js +14 -11
  24. package/src/@daf/pages/Events/columns.js +6 -0
  25. package/src/@daf/pages/Events/config.js +0 -16
  26. package/src/@daf/pages/Locations/MineSite/columns.js +5 -1
  27. package/src/@daf/pages/Locations/MineSite/config.js +21 -24
  28. package/src/@daf/pages/Partners/columns.js +3 -1
  29. package/src/@daf/pages/Partners/config.js +13 -9
  30. package/src/@daf/pages/Partners/create.jsx +5 -2
  31. package/src/@daf/pages/Partners/edit.jsx +4 -2
  32. package/src/@daf/pages/Stakeholders/Operators/columns.js +6 -0
  33. package/src/@daf/pages/Stakeholders/Operators/config.js +8 -8
  34. package/src/@daf/pages/Stakeholders/Workers/columns.js +19 -13
  35. package/src/@daf/pages/Stakeholders/Workers/config.js +8 -23
  36. package/src/@daf/pages/Summary/Minesite/index.jsx +6 -4
  37. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +2 -0
  38. package/src/@daf/pages/Summary/Operator/index.jsx +6 -3
  39. package/src/@daf/pages/TablePage/index.jsx +8 -2
  40. package/src/@daf/pages/Template/components/LinkingTemplate/columns.js +95 -0
  41. package/src/@daf/pages/Template/components/LinkingTemplate/config.js +88 -0
  42. package/src/@daf/pages/Template/components/LinkingTemplate/index.jsx +121 -0
  43. package/src/@daf/pages/Template/index.jsx +10 -0
  44. package/src/@daf/pages/View/hooks/useCallToGetData.js +73 -0
  45. package/src/@daf/pages/View/hooks/usePrepareForm.js +86 -0
  46. package/src/@daf/pages/View/hooks/useSubmitSubject.js +40 -0
  47. package/src/@daf/pages/View/hooks/useViewActions.js +83 -0
  48. package/src/@daf/pages/View/hooks/useViewPermissions.js +74 -0
  49. package/src/@daf/pages/View/hooks/useViewUrlParams.js +93 -0
  50. package/src/@daf/pages/View/index.jsx +326 -0
  51. package/src/@daf/utils/object.js +3 -1
  52. package/src/constants/locales/en/translation.js +3 -0
  53. package/src/constants/locales/fr/translation.js +3 -0
  54. package/src/constants/locales/sp/translation.js +3 -0
  55. package/src/pages.js +4 -1
  56. package/src/utils.js +1 -1
  57. package/dist/style/datastake/mapbox-gl.css +0 -330
  58. package/src/@daf/hooks/useViewFormUrlParams.js +0 -84
@@ -4794,6 +4794,7 @@ function Loading({
4794
4794
  }
4795
4795
 
4796
4796
  const capitalize = string => string && string.charAt(0).toUpperCase() + string.slice(1);
4797
+ const capitalizeAll = string => string && string.split(" ").map(word => word.length > 1 ? capitalize(word) : word).join(" ");
4797
4798
  const camelCaseToTitle = string => string && typeof string === 'string' ? string.split(/(?=[A-Z])/).map(word => capitalize(word)).join(' ') : string;
4798
4799
  const findOptions = (value, options) => {
4799
4800
  if (value instanceof Array) {
@@ -5295,6 +5296,12 @@ const createNumberArray = i => {
5295
5296
  return numbers;
5296
5297
  };
5297
5298
  const tooltipInputs = ["text", "phoneNumber", "textarea", "percentage", "number", "select", "ajaxSelect", "switch", "multiselect", "radioGroup", "date", "year"];
5299
+ const formPaths = {
5300
+ edit: (mod, getRedirectLink) => typeof getRedirectLink === "function" ? getRedirectLink(`/app/edit/:namespace/:id/:group?/:subsection?/:subgroup?/:formid?`) : `/app/${mod}/edit/:namespace/:id/:group?/:subsection?/:subgroup?/:formid?`,
5301
+ view: (mod, getRedirectLink) => typeof getRedirectLink === "function" ? getRedirectLink(`/app/view/:namespace/:id/:group?/:subsection?/:subgroup?/:formid?`) : `/app/${mod}/view/:namespace/:id/:group?/:subsection?/:subgroup?/:formid?`,
5302
+ viewDD: mod => `/app/${mod}/viewdd/:namespace/:id/:group?/:subsection?/:subgroup?/:formid?`,
5303
+ editDD: mod => `/app/${mod}/editdd/:namespace/:id/:group?/:subsection?/:subgroup?/:formid?`
5304
+ };
5298
5305
  const CREATE_DRAWER_WIDTH = 480;
5299
5306
  const MAX_COMMENTS_LENGTH = 1200;
5300
5307
  const MAX_TEXT_AREA_LENGTH = 1200;
@@ -5401,6 +5408,44 @@ const getImageUploadEditValue = value => {
5401
5408
  return (Array.isArray(value) ? value : value && typeof value === "object" && value.fileList && Array.isArray(value.fileList) ? value.fileList.map(f => f.response).filter(f => f) : []) || [];
5402
5409
  };
5403
5410
  const noActionsInputs = ["groupExpandable", "groupCheckbox", "smartHelp"];
5411
+ const isObjectEmpty = obj => {
5412
+ if (obj === null || typeof obj !== "object") {
5413
+ return false;
5414
+ }
5415
+ if (Object.keys(obj).length === 0) {
5416
+ return true;
5417
+ }
5418
+ return Object.values(obj).every(value => isObjectEmpty(value));
5419
+ };
5420
+
5421
+ /**
5422
+ * Filters and processes the input data by extracting specific properties.
5423
+ * It checks if the 'meta' property is empty and sets it to undefined if so,
5424
+ * then returns the rest of the data merged with the processed 'meta'. Used to clear data
5425
+ * when they are sent to backend.
5426
+ *
5427
+ * @param {Object} data - The input data object containing various properties.
5428
+ * @returns {Object} - The processed data object with filtered properties.
5429
+ */
5430
+
5431
+ const filterCreateData = data => {
5432
+ // eslint-disable-next-line no-unused-vars
5433
+ const {
5434
+ view,
5435
+ module,
5436
+ scope,
5437
+ form,
5438
+ meta,
5439
+ createdAt,
5440
+ updatedAt,
5441
+ ...rest
5442
+ } = data;
5443
+ const _meta = isObjectEmpty(meta) ? undefined : meta;
5444
+ return {
5445
+ ...rest,
5446
+ meta: _meta
5447
+ };
5448
+ };
5404
5449
 
5405
5450
  /**
5406
5451
  * Formats a date string into a specified format. This function should
@@ -6147,6 +6192,17 @@ DAFHeader.propTypes = {
6147
6192
  filtersConfig: PropTypes__default["default"].any
6148
6193
  };
6149
6194
 
6195
+ const MultiSelectStyled = styled__default["default"](antd.Select)`
6196
+ &.ant-select-single {
6197
+ .ant-select-selector {
6198
+ padding-inline-end: 24px !important;
6199
+ padding: 0 !important;
6200
+ max-width: 56px !important;
6201
+ width: 56px !important;
6202
+ }
6203
+ }
6204
+ `;
6205
+
6150
6206
  const {
6151
6207
  useToken: useToken$8
6152
6208
  } = antd.theme;
@@ -6285,7 +6341,7 @@ function Multiselect({
6285
6341
  });
6286
6342
  }
6287
6343
  };
6288
- return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
6344
+ return /*#__PURE__*/jsxRuntime.jsx(MultiSelectStyled, {
6289
6345
  mode: isSingle ? undefined : "multiple",
6290
6346
  value: selectValue,
6291
6347
  onChange: onSelectChange,
@@ -6342,7 +6398,8 @@ function Multiselect({
6342
6398
  border: `1px solid ${token.baseGray40}`,
6343
6399
  display: "flex",
6344
6400
  alignItems: "center",
6345
- justifyContent: "center"
6401
+ justifyContent: "center",
6402
+ padding: 0
6346
6403
  },
6347
6404
  children: option?.avatar || getFirstChar(option?.label)
6348
6405
  }, value);
@@ -7570,6 +7627,8 @@ const Style$f = styled__default["default"].div`
7570
7627
  width: 100%;
7571
7628
  height: 472px;
7572
7629
 
7630
+
7631
+
7573
7632
  .filter-cont {
7574
7633
  position: absolute;
7575
7634
  top: 24px;
@@ -7672,11 +7731,24 @@ const Style$f = styled__default["default"].div`
7672
7731
  align-items: center;
7673
7732
  }
7674
7733
 
7675
- .marker-chain {
7676
- display: flex;
7677
- align-items: center;
7678
- justify-content: center;
7679
- }
7734
+ .marker-chain {
7735
+ display: flex;
7736
+ align-items: center;
7737
+ justify-content: center;
7738
+ }
7739
+
7740
+ .animated-polyline {
7741
+ stroke-dasharray: 10 10;
7742
+ animation: dash-flow 1.5s linear infinite;
7743
+ stroke-linecap: round;
7744
+ }
7745
+
7746
+ @keyframes dash-flow {
7747
+ to {
7748
+ stroke-dashoffset: -20;
7749
+ }
7750
+ }
7751
+
7680
7752
 
7681
7753
  }
7682
7754
 
@@ -8200,18 +8272,15 @@ const VILLAGE = "village";
8200
8272
  const EXPORTER = "exporter";
8201
8273
  const PROCESSOR = "mineralProcessor";
8202
8274
  const DEPOT = "depot";
8275
+ const OPERATOR = "miningOperator";
8203
8276
  const MAX_EXTRA_SMALL_ZOOM_THRESHOLD = 2;
8204
8277
  const MAX_SMALL_ZOOM_THRESHOLD = 3;
8205
8278
  const MAX_MEDIUM_ZOOM_THRESHOLD = 6;
8206
8279
  const LOCATION_TYPES = [MINE_SITE, VILLAGE];
8207
- const STAKEHOLDER_TYPES = [EXPORTER, PROCESSOR, DEPOT];
8280
+ const STAKEHOLDER_TYPES = [EXPORTER, PROCESSOR, DEPOT, OPERATOR];
8208
8281
  const RADIUS_SMALL = 15;
8209
8282
  const RADIUS_MEDIUM = 35;
8210
8283
  const RADIUS_LARGE = 60;
8211
- const RADIUS_CURVE_SMALL = 10;
8212
- const RADIUS_CURVE_MEDIUM = 15;
8213
- const RADIUS_CURVE_LARGE = 20;
8214
- const TENSION = 0.2;
8215
8284
  function isLocation(type) {
8216
8285
  return LOCATION_TYPES.includes(type);
8217
8286
  }
@@ -8268,7 +8337,6 @@ function getStakeholderPosition({
8268
8337
  const isLarge = isLargeMarker(zoom);
8269
8338
  let radius;
8270
8339
  let center = {
8271
- // NOT BEING USED FOR NOW AND MAYBE NEVER
8272
8340
  left: 0,
8273
8341
  top: 0
8274
8342
  };
@@ -8292,6 +8360,25 @@ function getStakeholderPosition({
8292
8360
  angleDeg
8293
8361
  };
8294
8362
  }
8363
+ function applyAnimationDirect(el, isShortLink, lineFlow = "downstream") {
8364
+ if (!(el instanceof SVGElement) || isShortLink) return;
8365
+ el.style.strokeDasharray = "10, 10";
8366
+ el.style.strokeDashoffset = "0";
8367
+ el.style.animation = `dash-flow 1.2s linear infinite ${lineFlow === "upstream" && "reverse"}`;
8368
+ el.classList.add('animated-polyline');
8369
+ }
8370
+ function removeAnimationFromElement(element) {
8371
+ if (!element) return;
8372
+ element.classList.remove('animated-polyline');
8373
+ element.style.animation = '';
8374
+ element.style.strokeDasharray = '';
8375
+ }
8376
+ function applyAnimationToPolyline(polyline, isShortLink) {
8377
+ const element = polyline.getElement();
8378
+ if (element) {
8379
+ applyAnimationDirect(element, isShortLink);
8380
+ }
8381
+ }
8295
8382
  function createPolyline({
8296
8383
  L,
8297
8384
  startLatLng,
@@ -8301,109 +8388,47 @@ function createPolyline({
8301
8388
  zoom,
8302
8389
  listOfPolylines = [],
8303
8390
  isFromStakeholder = false,
8304
- isForceOpen = false
8391
+ isForceOpen = false,
8392
+ stakeholderType = null,
8393
+ animated = false,
8394
+ mapRef
8305
8395
  }) {
8306
- const width = isFromStakeholder && isExtraSmallMarker(zoom) && !isForceOpen ? 0 : 1.2;
8307
- const coordinates = [[startLatLng.lat, startLatLng.lng], [endLatLng.lat, endLatLng.lng]];
8308
- const style = {
8396
+ const lineWidth = isFromStakeholder && isExtraSmallMarker(zoom) && !isForceOpen ? 0 : 1.2;
8397
+ const isShortLink = stakeholderType === OPERATOR || isFromStakeholder;
8398
+ const shouldAnimate = animated;
8399
+ const lineCoordinates = [[startLatLng.lat, startLatLng.lng], [endLatLng.lat, endLatLng.lng]];
8400
+ const polylineStyle = {
8309
8401
  color: "var(--base-gray-70)",
8310
- weight: width,
8311
- opacity: 0.5,
8312
- smoothFactor: 1,
8402
+ weight: lineWidth,
8403
+ opacity: isSelected ? 1 : 0.5,
8404
+ smoothFactor: 0,
8313
8405
  id,
8314
- dashArray: !isSelected ? "5, 5" : "0, 0"
8406
+ dashArray: isShortLink ? "0, 0" : shouldAnimate ? "10, 10" : !isSelected ? "5, 5" : "10, 10",
8407
+ renderer: L.svg()
8315
8408
  };
8316
- const newPolyline = L.polyline(coordinates, style);
8317
- if (listOfPolylines.find(p => p.options.id === id)) {
8318
- const polylineToUpdateCoordinates = listOfPolylines.find(p => p.options.id === id);
8319
- polylineToUpdateCoordinates.setLatLngs(coordinates);
8320
- polylineToUpdateCoordinates.setStyle(style);
8321
- } else {
8322
- listOfPolylines.push(newPolyline);
8409
+ const existingPolyline = listOfPolylines.find(p => p.options.id === id);
8410
+ if (existingPolyline) {
8411
+ removeAnimationFromElement(existingPolyline.getElement());
8412
+ existingPolyline.setLatLngs(lineCoordinates);
8413
+ existingPolyline.setStyle(polylineStyle);
8414
+ if (shouldAnimate && isSelected) {
8415
+ existingPolyline.once('add', () => {
8416
+ applyAnimationToPolyline(existingPolyline, isShortLink);
8417
+ });
8418
+ applyAnimationToPolyline(existingPolyline, isShortLink);
8419
+ }
8420
+ return existingPolyline;
8323
8421
  }
8324
- return newPolyline;
8325
- }
8326
- function createCurvePath({
8327
- zoom,
8328
- totalMarkers,
8329
- markerIndex
8330
- }) {
8331
- const radius = getCurvePointRadius(zoom);
8332
- const {
8333
- x,
8334
- y,
8335
- angleDeg
8336
- } = getAngleDeg(totalMarkers, markerIndex, radius);
8337
- return {
8338
- x,
8339
- y,
8340
- angleDeg
8341
- };
8342
- }
8343
- function getCurvePointRadius(zoom) {
8344
- const isSmall = isSmallMarker(zoom) || isExtraSmallMarker(zoom);
8345
- const isMedium = isMediumMarker(zoom);
8346
- if (isSmall) {
8347
- return RADIUS_SMALL + RADIUS_CURVE_SMALL;
8348
- } else if (isMedium) {
8349
- return RADIUS_MEDIUM + RADIUS_CURVE_MEDIUM;
8350
- } else {
8351
- return RADIUS_LARGE + RADIUS_CURVE_LARGE;
8422
+ const newPolyline = L.polyline(lineCoordinates, polylineStyle);
8423
+ newPolyline.addTo(mapRef);
8424
+ listOfPolylines.push(newPolyline);
8425
+ if (shouldAnimate && isSelected) {
8426
+ newPolyline.once('add', () => {
8427
+ applyAnimationToPolyline(newPolyline, isShortLink);
8428
+ });
8429
+ applyAnimationToPolyline(newPolyline, isShortLink);
8352
8430
  }
8353
- }
8354
- function buildSmoothCurve(layerPoints, mapRef) {
8355
- const path = [];
8356
- for (let i = 0; i < layerPoints.length - 1; i++) {
8357
- const p0 = layerPoints[i];
8358
- const p1 = layerPoints[i + 1];
8359
- const pPrev = layerPoints[i - 1] || p0;
8360
- const pNext = layerPoints[i + 2] || p1;
8361
- const cp1 = L__namespace.point(p0.x + (p1.x - pPrev.x) * TENSION, p0.y + (p1.y - pPrev.y) * TENSION);
8362
- const cp2 = L__namespace.point(p1.x - (pNext.x - p0.x) * TENSION, p1.y - (pNext.y - p0.y) * TENSION);
8363
- if (i === 0) {
8364
- path.push("M", [mapRef.layerPointToLatLng(p0).lat, mapRef.layerPointToLatLng(p0).lng]);
8365
- }
8366
- path.push("C", [mapRef.layerPointToLatLng(cp1).lat, mapRef.layerPointToLatLng(cp1).lng], [mapRef.layerPointToLatLng(cp2).lat, mapRef.layerPointToLatLng(cp2).lng], [mapRef.layerPointToLatLng(p1).lat, mapRef.layerPointToLatLng(p1).lng]);
8367
- }
8368
- return path;
8369
- }
8370
- function getSiblingCurveStrength(zoom) {
8371
- if (isExtraSmallMarker(zoom)) return RADIUS_CURVE_SMALL / 2;
8372
- if (isSmallMarker(zoom)) return RADIUS_CURVE_MEDIUM;
8373
- if (isMediumMarker(zoom)) return RADIUS_CURVE_LARGE;
8374
- return RADIUS_CURVE_LARGE;
8375
- }
8376
- function buildCurveWIthTwoSiblings({
8377
- mapRef,
8378
- startLatLng,
8379
- endLatLng,
8380
- zoom,
8381
- isSelected,
8382
- id
8383
- }) {
8384
- const fromPoint = mapRef.latLngToLayerPoint(startLatLng);
8385
- const toPoint = mapRef.latLngToLayerPoint(endLatLng);
8386
- const midX = (fromPoint.x + toPoint.x) / 2;
8387
- const midY = (fromPoint.y + toPoint.y) / 2 + (isSmallMarker(zoom) ? RADIUS_CURVE_SMALL / 2 : 0);
8388
- const dx = toPoint.x - fromPoint.x;
8389
- const dy = toPoint.y - fromPoint.y;
8390
- const normal = L__namespace.point(-dy, dx);
8391
- const length = Math.sqrt(normal.x ** 2 + normal.y ** 2) || 1;
8392
- const normalized = normal.multiplyBy(1 / length);
8393
- const curveStrength = getSiblingCurveStrength(zoom);
8394
- const controlPoint = L__namespace.point(midX, midY).add(normalized.multiplyBy(curveStrength));
8395
- const latlngs = [startLatLng, mapRef.layerPointToLatLng(controlPoint), endLatLng];
8396
- const layerPoints = latlngs.map(latlng => mapRef.latLngToLayerPoint(latlng));
8397
- const path = buildSmoothCurve(layerPoints, mapRef);
8398
- const curve = L__namespace.curve(path, {
8399
- color: "var(--base-gray-70)",
8400
- weight: isExtraSmallMarker(zoom) ? 0 : 1.2,
8401
- opacity: 0.5,
8402
- smoothFactor: 1,
8403
- id,
8404
- dashArray: !isSelected ? "5, 5" : "0, 0"
8405
- });
8406
- mapRef.addLayer(curve);
8431
+ return newPolyline;
8407
8432
  }
8408
8433
 
8409
8434
  const StakeholderMarker = styled__default["default"].div`
@@ -8705,6 +8730,9 @@ function StakeholderIcon$1({
8705
8730
  return null;
8706
8731
  }, [parentId, allData]);
8707
8732
  React.useEffect(() => {
8733
+ if (selectedMarkersId.length === 0 || !isSelected) {
8734
+ return;
8735
+ }
8708
8736
  linkNodesData.map(node => {
8709
8737
  const isConnectingToStakeholder = node.isStakeholder;
8710
8738
  const id = `${data.datastakeId}-${node.stakeholderId || node.datastakeId}`;
@@ -8716,8 +8744,6 @@ function StakeholderIcon$1({
8716
8744
  const stakeholderPoint = centerPoint.add(L__namespace.point(x, y));
8717
8745
  const stakeholderLatLng = mapRef.layerPointToLatLng(stakeholderPoint);
8718
8746
  let endLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
8719
- const areNextToEachOther = targetMarkerIndex === index + 1 || targetMarkerIndex === index - 1 || index === 0 && targetMarkerIndex === node.totalStakeholders - 1 || targetMarkerIndex === 0 && index === node.totalStakeholders - 1;
8720
- const areOnlyTwoSiblings = node.totalStakeholders === 2;
8721
8747
  if (isExtraSmallMarker(zoom) && !isForceOpen) {
8722
8748
  createPolyline({
8723
8749
  L: L__namespace,
@@ -8727,7 +8753,8 @@ function StakeholderIcon$1({
8727
8753
  zoom,
8728
8754
  isSelected,
8729
8755
  id,
8730
- listOfPolylines: polylinesRef.current
8756
+ listOfPolylines: polylinesRef.current,
8757
+ animated: true
8731
8758
  });
8732
8759
  return;
8733
8760
  }
@@ -8745,61 +8772,8 @@ function StakeholderIcon$1({
8745
8772
  const nodePoint = mapRef.latLngToLayerPoint(nodeLatLng);
8746
8773
  const endPoint = L__namespace.point(x + nodePoint.x + center.left, y + nodePoint.y + center.top);
8747
8774
  endLatLng = mapRef.layerPointToLatLng(endPoint);
8748
- if (isSibling && (!areNextToEachOther || areOnlyTwoSiblings)) {
8749
- if (areOnlyTwoSiblings) {
8750
- buildCurveWIthTwoSiblings({
8751
- mapRef,
8752
- startLatLng: stakeholderLatLng,
8753
- endLatLng,
8754
- zoom,
8755
- isSelected,
8756
- id
8757
- });
8758
- return;
8759
- }
8760
- const total = node.totalStakeholders;
8761
- let from = index;
8762
- let to = targetMarkerIndex;
8763
- let flip = false;
8764
- const forwardDistance = (to - from + total) % total;
8765
- const backwardDistance = (from - to + total) % total;
8766
- if (backwardDistance < forwardDistance) {
8767
- [from, to] = [to, from];
8768
- flip = true;
8769
- }
8770
- const intermediateIndices = [];
8771
- for (let i = 1; i < (to - from + total) % total; i++) {
8772
- intermediateIndices.push((from + i) % total);
8773
- }
8774
- const indices = [from, ...intermediateIndices, to];
8775
- const intermediatePoints = [];
8776
- for (const i of indices) {
8777
- const {
8778
- x,
8779
- y
8780
- } = createCurvePath({
8781
- zoom,
8782
- totalMarkers: node.totalStakeholders,
8783
- markerIndex: i
8784
- });
8785
- const point = centerPoint.add(L__namespace.point(x, y));
8786
- const latlng = mapRef.layerPointToLatLng(point);
8787
- intermediatePoints.push(latlng);
8788
- }
8789
- const latlngs = flip ? [endLatLng, ...intermediatePoints, stakeholderLatLng] : [stakeholderLatLng, ...intermediatePoints, endLatLng];
8790
- const layerPoints = latlngs.map(latlng => mapRef.latLngToLayerPoint(latlng));
8791
- const path = buildSmoothCurve(layerPoints, mapRef);
8792
- const curve = L__namespace?.curve?.(path, {
8793
- color: "var(--base-gray-70)",
8794
- weight: isExtraSmallMarker(zoom) ? 0 : 1,
8795
- opacity: isSelected ? 1 : 0.5,
8796
- smoothFactor: 1,
8797
- id
8798
- });
8799
- mapRef.addLayer(curve);
8800
- return;
8801
- }
8802
8775
  }
8776
+ // Always use straight lines
8803
8777
  createPolyline({
8804
8778
  L: L__namespace,
8805
8779
  mapRef,
@@ -8809,10 +8783,11 @@ function StakeholderIcon$1({
8809
8783
  isFromStakeholder: false,
8810
8784
  isSelected,
8811
8785
  id,
8812
- listOfPolylines: polylinesRef.current
8786
+ listOfPolylines: polylinesRef.current,
8787
+ animated: true
8813
8788
  });
8814
8789
  });
8815
- }, [mapRef, x, y, parentData, linkNodesData, isSelected, zoom, isForceOpen]);
8790
+ }, [mapRef, x, y, parentData, linkNodesData, isSelected, zoom, isForceOpen, selectedMarkersId]);
8816
8791
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
8817
8792
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
8818
8793
  content: renderTooltipJsx({
@@ -8824,7 +8799,8 @@ function StakeholderIcon$1({
8824
8799
  link,
8825
8800
  onClickLink: () => {
8826
8801
  onClickLink(data);
8827
- }
8802
+ },
8803
+ isNewTab: true
8828
8804
  }),
8829
8805
  getPopupContainer: triggerNode => {
8830
8806
  const mapElement = document.getElementById("map");
@@ -8879,6 +8855,8 @@ function LocationIcon({
8879
8855
  const linkedNodesData = React.useMemo(() => {
8880
8856
  const nodes = [];
8881
8857
  const links = data.links || [];
8858
+
8859
+ // Add links from the location itself
8882
8860
  links.forEach(link => {
8883
8861
  allData.forEach(d => {
8884
8862
  if (d.datastakeId === link) {
@@ -8898,8 +8876,45 @@ function LocationIcon({
8898
8876
  }
8899
8877
  });
8900
8878
  });
8879
+
8880
+ // ADD: Also include links from this location's stakeholders
8881
+ const stakeholders = data.stakeholders || [];
8882
+ stakeholders.forEach(stakeholder => {
8883
+ const stakeholderLinks = stakeholder.links || [];
8884
+ stakeholderLinks.forEach(link => {
8885
+ allData.forEach(d => {
8886
+ // Check if it's a direct location link
8887
+ if (d.datastakeId === link) {
8888
+ // Avoid duplicates
8889
+ if (!nodes.find(n => n.datastakeId === link && !n.isStakeholder)) {
8890
+ nodes.push({
8891
+ ...d,
8892
+ fromStakeholderId: stakeholder.datastakeId
8893
+ });
8894
+ }
8895
+ }
8896
+ // Check if it's a stakeholder link
8897
+ if (d.stakeholders && d.stakeholders.length > 0) {
8898
+ d.stakeholders.forEach(targetStakeholder => {
8899
+ if (targetStakeholder.datastakeId === link) {
8900
+ // Avoid duplicates
8901
+ if (!nodes.find(n => n.isStakeholder && n.datastakeId === d.datastakeId && n.stakeholdersIndex === d.stakeholders.indexOf(targetStakeholder))) {
8902
+ nodes.push({
8903
+ ...d,
8904
+ isStakeholder: true,
8905
+ totalStakeholders: d.stakeholders.length,
8906
+ stakeholdersIndex: d.stakeholders.indexOf(targetStakeholder),
8907
+ fromStakeholderId: stakeholder.datastakeId
8908
+ });
8909
+ }
8910
+ }
8911
+ });
8912
+ }
8913
+ });
8914
+ });
8915
+ });
8901
8916
  return nodes;
8902
- }, [JSON.stringify(allData), JSON.stringify(data.links), zoom]);
8917
+ }, [JSON.stringify(allData), JSON.stringify(data.links), JSON.stringify(data.stakeholders), zoom]);
8903
8918
  const stakeholdersOfLocation = React.useMemo(() => {
8904
8919
  return data?.stakeholders || [];
8905
8920
  }, [data.stakeholders, zoom]);
@@ -8917,7 +8932,13 @@ function LocationIcon({
8917
8932
  currentRoots.clear();
8918
8933
  markersRef.current = [];
8919
8934
 
8920
- // Create new markers
8935
+ // Only create stakeholder markers if this location or any of its stakeholders are selected
8936
+ const shouldShowStakeholders = isSelected || stakeholdersOfLocation.some(stk => selectedMarkersId.includes(stk.datastakeId));
8937
+ if (!shouldShowStakeholders || selectedMarkersId.length === 0) {
8938
+ return;
8939
+ }
8940
+
8941
+ // Create new markers only when selected
8921
8942
  stakeholdersOfLocation.forEach((stakeholder, index) => {
8922
8943
  const markerId = `${stakeholder.datastakeId}`;
8923
8944
  const {
@@ -9003,7 +9024,9 @@ function LocationIcon({
9003
9024
  zoom,
9004
9025
  isFromStakeholder: true,
9005
9026
  isForceOpen,
9006
- listOfPolylines: polylinesRef.current
9027
+ listOfPolylines: polylinesRef.current,
9028
+ stakeholderType: stakeholder.type,
9029
+ animated: true
9007
9030
  });
9008
9031
  });
9009
9032
  return () => {
@@ -9018,38 +9041,88 @@ function LocationIcon({
9018
9041
  rootsMapRef.current.clear();
9019
9042
  markersRef.current = [];
9020
9043
  };
9021
- }, [stakeholdersOfLocation, selectedMarkersId, activeMarker]);
9022
- linkedNodesData.map(node => {
9023
- const id = `${data.datastakeId}-${node.datastakeId}`;
9024
- const isConnectingToStakeholder = node.isStakeholder;
9025
- const centerLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
9026
- let endLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
9027
- const isConnectingToStakeholderSelected = selectedMarkersId.includes(node.datastakeId);
9028
- if (isConnectingToStakeholder && !isExtraSmallMarker(zoom)) {
9029
- const {
9030
- x,
9031
- y
9032
- } = getStakeholderPosition({
9044
+ }, [stakeholdersOfLocation, selectedMarkersId, activeMarker, zoom]);
9045
+
9046
+ // Only create polylines for linked nodes when something is selected
9047
+ React.useEffect(() => {
9048
+ if (selectedMarkersId.length === 0) {
9049
+ return;
9050
+ }
9051
+
9052
+ // IMPORTANT: Only draw links if this location is actually selected
9053
+ // Not just highlighted as part of the chain
9054
+ if (!isSelected) {
9055
+ return;
9056
+ }
9057
+
9058
+ // Filter linkedNodesData to only include nodes that are in the selected chain
9059
+ const relevantLinks = linkedNodesData.filter(node => {
9060
+ // Check if the target node (location) is in the selected markers
9061
+ const targetLocationInSelection = selectedMarkersId.includes(node.datastakeId);
9062
+
9063
+ // If connecting to a stakeholder, check if that stakeholder is selected
9064
+ if (node.isStakeholder) {
9065
+ const stakeholderInSelection = node.stakeholdersIndex !== undefined && selectedMarkersId.includes(node.datastakeId);
9066
+ return stakeholderInSelection;
9067
+ }
9068
+ return targetLocationInSelection;
9069
+ });
9070
+ relevantLinks.forEach(node => {
9071
+ const id = node.fromStakeholderId ? `${node.fromStakeholderId}-${node.datastakeId}` : `${data.datastakeId}-${node.datastakeId}`;
9072
+ const isConnectingToStakeholder = node.isStakeholder;
9073
+
9074
+ // If the link is from a stakeholder, start from the stakeholder position
9075
+ let startLatLng;
9076
+ if (node.fromStakeholderId) {
9077
+ // Find the stakeholder index in this location's stakeholders
9078
+ const stakeholderIndex = stakeholdersOfLocation.findIndex(s => s.datastakeId === node.fromStakeholderId);
9079
+ if (stakeholderIndex !== -1) {
9080
+ const {
9081
+ x,
9082
+ y
9083
+ } = getStakeholderPosition({
9084
+ zoom,
9085
+ totalMarkers: stakeholdersOfLocation.length,
9086
+ markerIndex: stakeholderIndex
9087
+ });
9088
+ const centerLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
9089
+ const centerPoint = mapRef.latLngToLayerPoint(centerLatLng);
9090
+ const stakeholderPoint = centerPoint.add(L__namespace.point(x, y));
9091
+ startLatLng = mapRef.layerPointToLatLng(stakeholderPoint);
9092
+ } else {
9093
+ startLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
9094
+ }
9095
+ } else {
9096
+ startLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
9097
+ }
9098
+ let endLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
9099
+ const isConnectingToStakeholderSelected = selectedMarkersId.includes(node.datastakeId);
9100
+ if (isConnectingToStakeholder && !isExtraSmallMarker(zoom)) {
9101
+ const {
9102
+ x,
9103
+ y
9104
+ } = getStakeholderPosition({
9105
+ zoom,
9106
+ totalMarkers: node.totalStakeholders,
9107
+ markerIndex: node.stakeholdersIndex
9108
+ });
9109
+ const nodeLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
9110
+ const nodePoint = mapRef.latLngToLayerPoint(nodeLatLng);
9111
+ const endPoint = L__namespace.point(x + nodePoint.x, y + nodePoint.y);
9112
+ endLatLng = mapRef.layerPointToLatLng(endPoint);
9113
+ }
9114
+ createPolyline({
9115
+ L: L__namespace,
9116
+ mapRef,
9117
+ startLatLng,
9118
+ endLatLng,
9119
+ isSelected: isConnectingToStakeholderSelected,
9120
+ id,
9033
9121
  zoom,
9034
- totalMarkers: node.totalStakeholders,
9035
- markerIndex: node.stakeholdersIndex
9036
- });
9037
- const nodeLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
9038
- const nodePoint = mapRef.latLngToLayerPoint(nodeLatLng);
9039
- const endPoint = L__namespace.point(x + nodePoint.x, y + nodePoint.y);
9040
- endLatLng = mapRef.layerPointToLatLng(endPoint);
9041
- }
9042
- createPolyline({
9043
- L: L__namespace,
9044
- mapRef,
9045
- startLatLng: centerLatLng,
9046
- endLatLng,
9047
- isSelected: isConnectingToStakeholderSelected,
9048
- id,
9049
- zoom,
9050
- listOfPolylines: polylinesRef.current
9122
+ listOfPolylines: polylinesRef.current
9123
+ });
9051
9124
  });
9052
- });
9125
+ }, [linkedNodesData, selectedMarkersId, zoom, stakeholdersOfLocation, isSelected]);
9053
9126
  return /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
9054
9127
  content: renderTooltipJsx({
9055
9128
  title: data.name,
@@ -9565,7 +9638,8 @@ function useMapHelper$1({
9565
9638
  link: link,
9566
9639
  onClickLink: onClickLink,
9567
9640
  activeStakeholder: activeStakeholder,
9568
- setActiveStakeholder: setActiveStakeholder
9641
+ setActiveStakeholder: setActiveStakeholder,
9642
+ mapRef: mapRef
9569
9643
  }));
9570
9644
  roots.current.push(root);
9571
9645
  } else if (type === "location") {
@@ -9770,7 +9844,8 @@ const useMap = ({
9770
9844
  MAP_TOKEN
9771
9845
  } = useMapConfig({
9772
9846
  app,
9773
- isSatellite
9847
+ isSatellite,
9848
+ mapRef: container
9774
9849
  });
9775
9850
  const [initialMarkerSetIsDone, setInitialMarkerSetIsDone] = React.useState(false);
9776
9851
  const [mapCenter, setMapCenter] = React.useState([0, 0]);
@@ -9787,6 +9862,8 @@ const useMap = ({
9787
9862
  const graph = new Map();
9788
9863
  const stakeToLoc = new Map();
9789
9864
  const nodeTypes = new Map();
9865
+
9866
+ // Build the graph
9790
9867
  for (const loc of data) {
9791
9868
  const locId = loc.datastakeId;
9792
9869
  nodeTypes.set(locId, loc.type);
@@ -9811,26 +9888,45 @@ const useMap = ({
9811
9888
  }
9812
9889
  }
9813
9890
  const highlightTable = {};
9891
+
9892
+ // Perform BFS/DFS to find all connected nodes in the entire chain
9814
9893
  for (const [node] of graph) {
9815
9894
  const highlighted = new Set();
9816
- highlighted.add(node);
9817
- const nodeIsStakeholder = !isLocation(nodeTypes.get(node));
9818
- if (nodeIsStakeholder && stakeToLoc.has(node)) {
9819
- const parentLoc = stakeToLoc.get(node);
9820
- highlighted.add(parentLoc);
9821
- }
9822
- for (const neighbor of graph.get(node) || []) {
9823
- const neighborIsStakeholder = !isLocation(nodeTypes.get(neighbor));
9824
- if (neighborIsStakeholder && stakeToLoc.has(neighbor)) {
9825
- const neighborParent = stakeToLoc.get(neighbor);
9826
- if (isLocation(nodeTypes.get(node)) && neighborParent === node || nodeIsStakeholder && stakeToLoc.get(node) === neighborParent) {
9827
- highlighted.add(neighbor);
9828
- } else {
9895
+ const queue = [node];
9896
+ const visited = new Set([node]);
9897
+ while (queue.length > 0) {
9898
+ const current = queue.shift();
9899
+ highlighted.add(current);
9900
+
9901
+ // Add parent location if current is stakeholder
9902
+ const currentIsStakeholder = !isLocation(nodeTypes.get(current));
9903
+ if (currentIsStakeholder && stakeToLoc.has(current)) {
9904
+ const parentLoc = stakeToLoc.get(current);
9905
+ if (!visited.has(parentLoc)) {
9906
+ highlighted.add(parentLoc);
9907
+ visited.add(parentLoc);
9908
+ queue.push(parentLoc);
9909
+ }
9910
+ }
9911
+
9912
+ // Traverse all neighbors
9913
+ for (const neighbor of graph.get(current) || []) {
9914
+ if (!visited.has(neighbor)) {
9915
+ visited.add(neighbor);
9916
+ queue.push(neighbor);
9829
9917
  highlighted.add(neighbor);
9830
- highlighted.add(neighborParent);
9918
+
9919
+ // If neighbor is stakeholder, add its parent location
9920
+ const neighborIsStakeholder = !isLocation(nodeTypes.get(neighbor));
9921
+ if (neighborIsStakeholder && stakeToLoc.has(neighbor)) {
9922
+ const neighborParent = stakeToLoc.get(neighbor);
9923
+ if (!visited.has(neighborParent)) {
9924
+ highlighted.add(neighborParent);
9925
+ visited.add(neighborParent);
9926
+ queue.push(neighborParent);
9927
+ }
9928
+ }
9831
9929
  }
9832
- } else {
9833
- highlighted.add(neighbor);
9834
9930
  }
9835
9931
  }
9836
9932
  highlightTable[node] = [...highlighted];
@@ -9868,10 +9964,20 @@ const useMap = ({
9868
9964
  function handleSelectMarker(clickedMarker) {
9869
9965
  setSelectedMarkersId(prev => {
9870
9966
  if (prev.includes(clickedMarker.datastakeId)) {
9967
+ // Deselecting - clear polylines
9871
9968
  openPopupIdRef.current = null;
9872
9969
  setMarkerWithPopup(null);
9873
9970
  return [];
9874
9971
  } else {
9972
+ // CLEAR OLD POLYLINES BEFORE SELECTING NEW MARKER
9973
+ if (polylinesRef.current.length > 0) {
9974
+ polylinesRef.current.forEach(polyline => {
9975
+ if (mapRef.hasLayer(polyline)) {
9976
+ mapRef.removeLayer(polyline);
9977
+ }
9978
+ });
9979
+ polylinesRef.current = [];
9980
+ }
9875
9981
  setMarkerWithPopup(isStakeholder(clickedMarker.type) ? clickedMarker : null);
9876
9982
  const newSelectedMarkersId = highlightTable[clickedMarker.datastakeId];
9877
9983
  openPopupIdRef.current = clickedMarker.datastakeId;
@@ -9895,19 +10001,29 @@ const useMap = ({
9895
10001
  });
9896
10002
  }
9897
10003
  }
10004
+ if (type === "chain" && selectedMarkersId.length === 0) {
10005
+ if (polylinesRef.current.length) {
10006
+ polylinesRef.current.forEach(polyline => {
10007
+ if (mapRef.hasLayer(polyline)) {
10008
+ mapRef.removeLayer(polyline);
10009
+ }
10010
+ });
10011
+ polylinesRef.current = [];
10012
+ }
10013
+ }
9898
10014
  clearMapMarkers();
9899
10015
  if (data) {
9900
- // Filters out locations that are not connected to any stakeholders
9901
- const excludedType = ['village', 'town', 'area', 'territory'];
9902
- const filteredData = data?.filter(obj => !excludedType.includes(obj?.type) && (obj?.stakeholders?.length > 0 || data.some(other => other.datastakeId !== obj.datastakeId && (other.stakeholders || []).some(stk => (stk.links || []).includes(obj.datastakeId)))));
10016
+ const filteredData = data?.filter(obj => obj.type === 'mineSite' || obj?.stakeholders?.length > 0 || data.some(other => other.datastakeId !== obj.datastakeId && (other.stakeholders || []).some(stk => (stk.links || []).includes(obj.datastakeId))));
9903
10017
  const maxTotal = Math.max(...(data || []).map(d => d.total));
9904
10018
  const dataToRender = type === "chain" ? filteredData : data;
9905
10019
  dataToRender.forEach((d, i) => {
9906
10020
  addIconToMapInitialy([d?.marker?.lat, d?.marker?.lng], "location", d.category || "mineSite", d, maxTotal, i);
9907
10021
  });
9908
- polylinesRef.current.forEach(polyline => {
9909
- mapRef.addLayer(polyline);
9910
- });
10022
+ if (selectedMarkersId.length > 0) {
10023
+ polylinesRef.current.forEach(polyline => {
10024
+ mapRef.addLayer(polyline);
10025
+ });
10026
+ }
9911
10027
  mapRef.invalidateSize();
9912
10028
  mapRef.fire("moveend");
9913
10029
  }
@@ -14202,7 +14318,7 @@ function BarChart({
14202
14318
  return Array.from(new Array(11), (v, i) => i * 10);
14203
14319
  }
14204
14320
  } : {}),
14205
- ...xAxisConfig,
14321
+ ...(Object.keys(xAxisConfig).length > 0 ? xAxisConfig : {}),
14206
14322
  label: {
14207
14323
  formatter: isPercentage ? v => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, s => `${s},`) + " %" : formattedXAxis,
14208
14324
  ...xAxisConfig?.label
@@ -14332,6 +14448,10 @@ const useContributionsGraph = ({
14332
14448
  });
14333
14449
  }, [data, t]);
14334
14450
  const isEmpty = React.useMemo(() => _data?.length === 0, [_data]);
14451
+ console.log({
14452
+ _data,
14453
+ isEmpty
14454
+ });
14335
14455
  const chartConfig = React.useMemo(() => {
14336
14456
  return {
14337
14457
  data: _data,
@@ -14339,13 +14459,11 @@ const useContributionsGraph = ({
14339
14459
  yFieldKey: "category",
14340
14460
  seriesField: "type",
14341
14461
  isGroup: true,
14342
- ...(isEmpty && {
14343
- xAxisConfig: {
14344
- min: 0,
14345
- max: 10,
14346
- tickCount: 5
14347
- }
14348
- }),
14462
+ xAxisConfig: isEmpty ? {
14463
+ min: 0,
14464
+ max: 10,
14465
+ tickCount: 5
14466
+ } : {},
14349
14467
  renderTooltipContent: (title, items) => {
14350
14468
  const tooltipItems = items.map(item => ({
14351
14469
  label: item.name,
@@ -14401,10 +14519,11 @@ function ContributionsGraph({
14401
14519
  loading: loading,
14402
14520
  title: t("Contributions"),
14403
14521
  className: "with-border-header h-w-btn-header no-px-body",
14404
- children: /*#__PURE__*/jsxRuntime.jsx(BarChart, {
14522
+ children: /*#__PURE__*/React.createElement(BarChart, {
14405
14523
  ...chartConfig,
14406
14524
  height: "400px",
14407
- t: t
14525
+ t: t,
14526
+ key: data?.length
14408
14527
  })
14409
14528
  });
14410
14529
  }
@@ -15176,7 +15295,7 @@ const renderStatusTag = ({
15176
15295
  }
15177
15296
  };
15178
15297
 
15179
- const getColumns$c = ({
15298
+ const getColumns$d = ({
15180
15299
  t,
15181
15300
  goTo,
15182
15301
  user,
@@ -15192,6 +15311,8 @@ const getColumns$c = ({
15192
15311
  title: t('ID'),
15193
15312
  ellipsis: true,
15194
15313
  show: true,
15314
+ key: "datastakeId",
15315
+ sorter: () => 0 + 0,
15195
15316
  render: (v, all) => {
15196
15317
  if (all.empty) {
15197
15318
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -15208,6 +15329,8 @@ const getColumns$c = ({
15208
15329
  title: t('Name'),
15209
15330
  ellipsis: true,
15210
15331
  show: true,
15332
+ key: "name",
15333
+ sorter: () => 0 + 0,
15211
15334
  render: (v, all) => {
15212
15335
  if (all.empty) {
15213
15336
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -15241,6 +15364,8 @@ const getColumns$c = ({
15241
15364
  title: t('Legal Form'),
15242
15365
  ellipsis: true,
15243
15366
  show: true,
15367
+ key: "subCategory",
15368
+ sorter: () => 0 + 0,
15244
15369
  render: (v, all) => {
15245
15370
  if (all.empty) {
15246
15371
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -16242,6 +16367,7 @@ const BaseScreen = ({
16242
16367
  showFilters: showFilters,
16243
16368
  defaultFilters: defaultFilters,
16244
16369
  onChange: onTableChange,
16370
+ t: t,
16245
16371
  ...rest
16246
16372
  }), /*#__PURE__*/jsxRuntime.jsx(Pagination, {
16247
16373
  t: t,
@@ -17087,6 +17213,9 @@ function showHideForm(form, formsValue) {
17087
17213
  }
17088
17214
  return true;
17089
17215
  }
17216
+ const filterForm = (f, d) => {
17217
+ return f && (f.showFormIf ? showHideForm(f, d) : true);
17218
+ };
17090
17219
  const getSgbEvaluationIcons = (width, height) => ({
17091
17220
  0: /*#__PURE__*/jsxRuntime.jsxs("svg", {
17092
17221
  width: width,
@@ -17424,8 +17553,28 @@ function AjaxModal$1({
17424
17553
  const types = {
17425
17554
  MODAL: 'modal'
17426
17555
  };
17556
+ const isGroupInput = (group, repeatable = false, data) => {
17557
+ let resp = group.inputs && Object.keys(group.inputs).length && group.repeatable === repeatable && group.type !== 'groupInputs' && group.type !== 'group' && group.type !== 'dataLinkGroup' && group.display !== 'group' && !group.viewGroup && !group.component;
17558
+ if (group.showIf || group?.meta?.excludeFromView) {
17559
+ resp = resp && showHideInput$3(group, data);
17560
+ }
17561
+ return resp;
17562
+ };
17427
17563
  const repeatObjects = (obj, fn = () => {}, filter = null, sort = null) => filter ? Object.keys(obj).filter(key => filter(obj[key])).map(fn) : sort ? Object.keys(obj).sort(sort).map(fn) : Object.keys(obj).map(fn);
17428
17564
  const conditions = new RegExp(/( is | and | not | notEmpty | includes )/gm);
17565
+ const getLastRow = (arr, cols) => {
17566
+ let currentInd = -1;
17567
+ const newArr = [];
17568
+ arr.forEach(nr => {
17569
+ if (nr % cols === 0) {
17570
+ newArr[currentInd + 1] = [nr];
17571
+ currentInd++;
17572
+ } else {
17573
+ newArr[currentInd].push(nr);
17574
+ }
17575
+ });
17576
+ return newArr[newArr.length - 1];
17577
+ };
17429
17578
  const _verifyCondition = (condition, data, allData) => {
17430
17579
  let [path, match, needed] = condition.split(conditions);
17431
17580
  const isRepeatable = path.split('./').length > 1;
@@ -17498,6 +17647,49 @@ const showHideInput$3 = (input, formsValue, repeatValues) => {
17498
17647
  }
17499
17648
  return true;
17500
17649
  };
17650
+ const getNkey = namespace => {
17651
+ if (['location', 'scl', 'village', 'event', 'incidents', 'corrective-actions', 'testimonials', 'initiatives', 'victims', 'pictures', 'documents', 'lir', 'sp', 'im', 'sci', 'bpe', 'gm'].includes(namespace)) {
17652
+ return 'scoping';
17653
+ }
17654
+ return namespace;
17655
+ };
17656
+ const groupSubsections = (form, onlyConf = false) => {
17657
+ return Object.keys(form).reduce((f, fKey) => {
17658
+ if (form[fKey].subSection) {
17659
+ let subName = form[fKey].subSection;
17660
+ if (typeof form[fKey].subSection === "object") {
17661
+ subName = form[fKey].subSection.name;
17662
+ }
17663
+ if (!f[subName]) {
17664
+ f[subName] = {
17665
+ label: '',
17666
+ icon: '',
17667
+ position: 0
17668
+ };
17669
+ if (typeof form[fKey].subSection === "object") {
17670
+ const {
17671
+ label = '',
17672
+ icon = '',
17673
+ position = 0,
17674
+ showFormIf = ''
17675
+ } = form[fKey].subSection;
17676
+ f[subName] = {
17677
+ label,
17678
+ icon,
17679
+ position,
17680
+ showFormIf
17681
+ };
17682
+ }
17683
+ }
17684
+ if (!onlyConf) {
17685
+ Object.assign(f[subName], {
17686
+ [fKey]: form[fKey]
17687
+ });
17688
+ }
17689
+ }
17690
+ return f;
17691
+ }, {});
17692
+ };
17501
17693
  const renderPlaceholder = ({
17502
17694
  data,
17503
17695
  config,
@@ -24479,6 +24671,19 @@ const Input = ({
24479
24671
  return getComponent();
24480
24672
  };
24481
24673
 
24674
+ const getDisabled = ({
24675
+ disabled,
24676
+ groupCheckboxDisableKey,
24677
+ data
24678
+ }) => {
24679
+ if (disabled) {
24680
+ return true;
24681
+ }
24682
+ if (typeof groupCheckboxDisableKey === 'string') {
24683
+ return !Object.values(data?.[groupCheckboxDisableKey] || {}).find(c => typeof c === 'number');
24684
+ }
24685
+ return false;
24686
+ };
24482
24687
  ({
24483
24688
  t: PropTypes__default["default"].func,
24484
24689
  data: PropTypes__default["default"].any,
@@ -24541,6 +24746,17 @@ function convertUndefinedToNull(obj) {
24541
24746
  }
24542
24747
  return obj;
24543
24748
  }
24749
+ const removeKeysFromObject = (obj = {}, keys = []) => {
24750
+ if (typeof obj !== 'object' || obj === null) return obj;
24751
+ const result = {};
24752
+ for (const key of Object.keys(obj)) {
24753
+ if (!keys.includes(key)) {
24754
+ result[key] = obj[key];
24755
+ }
24756
+ }
24757
+ return result;
24758
+ };
24759
+ const hasKeyInObject = (obj, key) => Object.keys(obj || {}).includes(key);
24544
24760
 
24545
24761
  const packageApps = ["kota", "sbg", "nashiriki", "straatos", "wazi", "hatua"]; //PACKAGE_CHANGE_LATER (add sbg)
24546
24762
 
@@ -29969,7 +30185,9 @@ const useGetQueryParams = ({
29969
30185
  },
29970
30186
  otherParams: {
29971
30187
  ...rest
29972
- }
30188
+ },
30189
+ sortBy,
30190
+ sortDir
29973
30191
  };
29974
30192
  }, [queryParams]);
29975
30193
  return params;
@@ -30056,7 +30274,7 @@ const NavigationAction = ({
30056
30274
  });
30057
30275
  };
30058
30276
 
30059
- const getColumns$b = ({
30277
+ const getColumns$c = ({
30060
30278
  t,
30061
30279
  goTo,
30062
30280
  user,
@@ -30217,7 +30435,7 @@ const getFiltersConfig$9 = ({
30217
30435
  country: {
30218
30436
  type: 'select',
30219
30437
  label: 'Country',
30220
- placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
30438
+ placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
30221
30439
  style: {
30222
30440
  flex: 1
30223
30441
  },
@@ -30250,7 +30468,7 @@ const getFiltersConfig$9 = ({
30250
30468
  }
30251
30469
  return t('Province');
30252
30470
  },
30253
- placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
30471
+ placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
30254
30472
  filters: data => ({
30255
30473
  country: data.country,
30256
30474
  level: 'level_1'
@@ -30294,7 +30512,7 @@ const getFiltersConfig$9 = ({
30294
30512
  return t('Province');
30295
30513
  },
30296
30514
  show: data => !(data.country && data.administrativeLevel1),
30297
- placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
30515
+ placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
30298
30516
  filters: data => ({
30299
30517
  country: data.country,
30300
30518
  level: 'level_2',
@@ -30317,7 +30535,7 @@ const getFiltersConfig$9 = ({
30317
30535
  subCategory: {
30318
30536
  type: 'select',
30319
30537
  label: 'Sub Category',
30320
- placeholder: t => `${t('Filter by')} ${t('Sub Category').toLowerCase()}`,
30538
+ placeholder: () => `${t('Filter by')} ${t('Sub Category').toLowerCase()}`,
30321
30539
  style: {
30322
30540
  flex: 1
30323
30541
  },
@@ -30353,7 +30571,7 @@ const getFiltersConfig$9 = ({
30353
30571
  positionInTheMineralSupplyChain: {
30354
30572
  type: 'select',
30355
30573
  label: 'Position',
30356
- placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
30574
+ placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
30357
30575
  style: {
30358
30576
  flex: 1
30359
30577
  },
@@ -30366,7 +30584,7 @@ const getFiltersConfig$9 = ({
30366
30584
  status: {
30367
30585
  type: "select",
30368
30586
  label: "Status",
30369
- placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
30587
+ placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
30370
30588
  style: {
30371
30589
  flex: 1
30372
30590
  },
@@ -30398,10 +30616,10 @@ const getFilterOptions$9 = (options, t) => {
30398
30616
  subCategory: subCategoriesOptions,
30399
30617
  status: [{
30400
30618
  value: "submitted",
30401
- label: "Submitted"
30619
+ label: t("Submitted")
30402
30620
  }, {
30403
30621
  value: "private",
30404
- label: "Private"
30622
+ label: t("Private")
30405
30623
  }]
30406
30624
  };
30407
30625
  return _default;
@@ -30424,7 +30642,7 @@ const getFiltersConfig$8 = ({
30424
30642
  country: {
30425
30643
  type: 'select',
30426
30644
  label: 'Country',
30427
- placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
30645
+ placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
30428
30646
  style: {
30429
30647
  flex: 1
30430
30648
  },
@@ -30457,7 +30675,7 @@ const getFiltersConfig$8 = ({
30457
30675
  }
30458
30676
  return t('Province');
30459
30677
  },
30460
- placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
30678
+ placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
30461
30679
  filters: data => ({
30462
30680
  country: data.country,
30463
30681
  level: 'level_1'
@@ -30501,7 +30719,7 @@ const getFiltersConfig$8 = ({
30501
30719
  return t('Province');
30502
30720
  },
30503
30721
  show: data => !(data.country && data.administrativeLevel1),
30504
- placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
30722
+ placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
30505
30723
  filters: data => ({
30506
30724
  country: data.country,
30507
30725
  level: 'level_2',
@@ -30524,7 +30742,7 @@ const getFiltersConfig$8 = ({
30524
30742
  activity: {
30525
30743
  type: 'select',
30526
30744
  label: 'Activity',
30527
- placeholder: t => `${t('Filter by')} ${t('Activity').toLowerCase()}`,
30745
+ placeholder: () => `${t('Filter by')} ${t('Activity').toLowerCase()}`,
30528
30746
  style: {
30529
30747
  flex: 1
30530
30748
  },
@@ -30532,35 +30750,12 @@ const getFiltersConfig$8 = ({
30532
30750
  flex: 1
30533
30751
  },
30534
30752
  getLabel: option => option.label,
30535
- getValue: option => option.value,
30536
- filterOptions: val => {
30537
- if (val) {
30538
- const {
30539
- option,
30540
- filters
30541
- } = val;
30542
- if (filters && option) {
30543
- const {
30544
- filters: optionFilters
30545
- } = option;
30546
- if (Array.isArray(optionFilters) && optionFilters.length) {
30547
- const {
30548
- value,
30549
- condition
30550
- } = optionFilters[0];
30551
- if (condition === 'includes') {
30552
- return value.includes('corporation');
30553
- }
30554
- }
30555
- }
30556
- }
30557
- return true;
30558
- }
30753
+ getValue: option => option.value
30559
30754
  },
30560
30755
  positionInTheMineralSupplyChain: {
30561
30756
  type: 'select',
30562
30757
  label: 'Position',
30563
- placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
30758
+ placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
30564
30759
  style: {
30565
30760
  flex: 1
30566
30761
  },
@@ -30573,7 +30768,7 @@ const getFiltersConfig$8 = ({
30573
30768
  status: {
30574
30769
  type: "select",
30575
30770
  label: "Status",
30576
- placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
30771
+ placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
30577
30772
  style: {
30578
30773
  flex: 1
30579
30774
  },
@@ -30602,10 +30797,10 @@ const getFilterOptions$8 = (options, t) => {
30602
30797
  const _default = {
30603
30798
  status: [{
30604
30799
  value: "submitted",
30605
- label: "Submitted"
30800
+ label: t("Submitted")
30606
30801
  }, {
30607
30802
  value: "private",
30608
- label: "Private"
30803
+ label: t("Private")
30609
30804
  }],
30610
30805
  category: stakeholderCategoryOptions || categoryOptions,
30611
30806
  country: countries,
@@ -30628,7 +30823,7 @@ const viewConfig$6 = {
30628
30823
  createTitle: "Create Worker"
30629
30824
  };
30630
30825
 
30631
- const getColumns$a = ({
30826
+ const getColumns$b = ({
30632
30827
  t,
30633
30828
  goTo,
30634
30829
  user,
@@ -30639,25 +30834,31 @@ const getColumns$a = ({
30639
30834
  subject,
30640
30835
  data,
30641
30836
  applications
30642
- }) => [
30643
- // {
30644
- // dataIndex: 'datastakeId',
30645
- // title: t('ID'),
30646
- // ellipsis: true,
30647
- // show: true,
30648
- // render: (v, all) => {
30649
- // if (all.empty) {
30650
- // return <div className="daf-default-cell" />
30651
- // }
30652
-
30653
- // return <Tooltip title={v}>{v}</Tooltip>;
30654
- // },
30655
- // },
30656
- {
30837
+ }) => [{
30838
+ dataIndex: 'datastakeId',
30839
+ title: t('Title'),
30840
+ ellipsis: true,
30841
+ show: true,
30842
+ key: "datastakeId",
30843
+ sorter: () => 0 + 0,
30844
+ render: (v, all) => {
30845
+ if (all.empty) {
30846
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30847
+ className: "daf-default-cell"
30848
+ });
30849
+ }
30850
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30851
+ title: v,
30852
+ children: v
30853
+ });
30854
+ }
30855
+ }, {
30657
30856
  dataIndex: 'name',
30658
30857
  title: t('Name'),
30659
30858
  ellipsis: true,
30660
30859
  show: true,
30860
+ key: "name",
30861
+ sorter: () => 0 + 0,
30661
30862
  render: (v, all) => {
30662
30863
  if (all.empty) {
30663
30864
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -30671,9 +30872,11 @@ const getColumns$a = ({
30671
30872
  }
30672
30873
  }, {
30673
30874
  dataIndex: 'mineSite',
30674
- title: t('Position'),
30875
+ title: t('Site'),
30675
30876
  ellipsis: true,
30676
30877
  show: true,
30878
+ key: "mineSite",
30879
+ sorter: () => 0 + 0,
30677
30880
  render: (v, all) => {
30678
30881
  if (all.empty) {
30679
30882
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -30918,30 +31121,7 @@ const getFiltersConfig$7 = ({
30918
31121
  flex: 1
30919
31122
  },
30920
31123
  getLabel: option => option.label,
30921
- getValue: option => option.value,
30922
- filterOptions: val => {
30923
- if (val) {
30924
- const {
30925
- option,
30926
- filters
30927
- } = val;
30928
- if (filters && option) {
30929
- const {
30930
- filters: optionFilters
30931
- } = option;
30932
- if (Array.isArray(optionFilters) && optionFilters.length) {
30933
- const {
30934
- value,
30935
- condition
30936
- } = optionFilters[0];
30937
- if (condition === 'includes') {
30938
- return value.includes('corporation');
30939
- }
30940
- }
30941
- }
30942
- }
30943
- return true;
30944
- }
31124
+ getValue: option => option.value
30945
31125
  },
30946
31126
  category: {
30947
31127
  type: 'select',
@@ -31130,7 +31310,7 @@ MoreTags.propTypes = {
31130
31310
  limit: PropTypes__default["default"].number
31131
31311
  };
31132
31312
 
31133
- const getColumns$9 = ({
31313
+ const getColumns$a = ({
31134
31314
  t,
31135
31315
  goTo,
31136
31316
  user,
@@ -31146,6 +31326,8 @@ const getColumns$9 = ({
31146
31326
  title: t('ID'),
31147
31327
  ellipsis: true,
31148
31328
  show: true,
31329
+ key: "datastakeId",
31330
+ sorter: () => 0 + 0,
31149
31331
  render: (v, all) => {
31150
31332
  if (all.empty) {
31151
31333
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31162,6 +31344,8 @@ const getColumns$9 = ({
31162
31344
  title: t('Title'),
31163
31345
  ellipsis: true,
31164
31346
  show: true,
31347
+ key: "name",
31348
+ sorter: () => 0 + 0,
31165
31349
  render: (v, all) => {
31166
31350
  if (all.empty) {
31167
31351
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31178,6 +31362,8 @@ const getColumns$9 = ({
31178
31362
  title: t('Type'),
31179
31363
  ellipsis: true,
31180
31364
  show: true,
31365
+ key: "typeOfEvent",
31366
+ sorter: () => 0 + 0,
31181
31367
  render: (v, all) => {
31182
31368
  if (all.empty) {
31183
31369
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31365,12 +31551,13 @@ const getFiltersConfig$6 = ({
31365
31551
  label: "Timeframe",
31366
31552
  style: {
31367
31553
  flex: 1
31368
- }
31554
+ },
31555
+ t: t
31369
31556
  },
31370
31557
  country: {
31371
31558
  type: 'select',
31372
31559
  label: 'Country',
31373
- placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
31560
+ placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
31374
31561
  style: {
31375
31562
  flex: 1
31376
31563
  },
@@ -31403,7 +31590,7 @@ const getFiltersConfig$6 = ({
31403
31590
  }
31404
31591
  return t('Province');
31405
31592
  },
31406
- placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
31593
+ placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
31407
31594
  filters: data => ({
31408
31595
  country: data.country,
31409
31596
  level: 'level_1'
@@ -31447,7 +31634,7 @@ const getFiltersConfig$6 = ({
31447
31634
  return t('Province');
31448
31635
  },
31449
31636
  show: data => !(data.country && data.administrativeLevel1),
31450
- placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
31637
+ placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
31451
31638
  filters: data => ({
31452
31639
  country: data.country,
31453
31640
  level: 'level_2',
@@ -31470,7 +31657,7 @@ const getFiltersConfig$6 = ({
31470
31657
  category: {
31471
31658
  type: 'select',
31472
31659
  label: 'Category',
31473
- placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
31660
+ placeholder: () => `${t('Filter by')} ${t('Category').toLowerCase()}`,
31474
31661
  style: {
31475
31662
  flex: 1
31476
31663
  },
@@ -31506,7 +31693,7 @@ const getFiltersConfig$6 = ({
31506
31693
  positionInTheMineralSupplyChain: {
31507
31694
  type: 'select',
31508
31695
  label: 'Position',
31509
- placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
31696
+ placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
31510
31697
  style: {
31511
31698
  flex: 1
31512
31699
  },
@@ -31519,7 +31706,7 @@ const getFiltersConfig$6 = ({
31519
31706
  status: {
31520
31707
  type: "select",
31521
31708
  label: "Status",
31522
- placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
31709
+ placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
31523
31710
  style: {
31524
31711
  flex: 1
31525
31712
  },
@@ -31544,18 +31731,23 @@ const getFilterOptions$6 = (options, t) => {
31544
31731
  administrativeLevel1,
31545
31732
  administrativeLevel2,
31546
31733
  positionInMineralSupplyChainOptions,
31547
- subCategoriesOptions
31734
+ subCategoriesOptions,
31735
+ eventCategoryOptions = []
31548
31736
  } = options || {};
31737
+ const _categoryOptions = eventCategoryOptions?.map(item => ({
31738
+ value: item.value,
31739
+ label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
31740
+ }));
31549
31741
  const _default = {
31550
31742
  timeframe: timeframe,
31551
31743
  status: [{
31552
31744
  value: "submitted",
31553
- label: "Submitted"
31745
+ label: t("Submitted")
31554
31746
  }, {
31555
31747
  value: "private",
31556
- label: "Private"
31748
+ label: t("Private")
31557
31749
  }],
31558
- category: stakeholderCategoryOptions || categoryOptions,
31750
+ category: _categoryOptions,
31559
31751
  country: countries,
31560
31752
  subCategory: subCategoriesOptions,
31561
31753
  // category: category,
@@ -31585,7 +31777,7 @@ const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = fa
31585
31777
  return eventCategoryObject[key] || null;
31586
31778
  };
31587
31779
 
31588
- const getColumns$8 = ({
31780
+ const getColumns$9 = ({
31589
31781
  t,
31590
31782
  goTo,
31591
31783
  user,
@@ -31601,6 +31793,8 @@ const getColumns$8 = ({
31601
31793
  title: t('ID'),
31602
31794
  ellipsis: true,
31603
31795
  show: true,
31796
+ key: "datastakeId",
31797
+ sorter: () => 0 + 0,
31604
31798
  render: (v, all) => {
31605
31799
  if (all.empty) {
31606
31800
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31617,6 +31811,8 @@ const getColumns$8 = ({
31617
31811
  title: t('Title'),
31618
31812
  ellipsis: true,
31619
31813
  show: true,
31814
+ key: "name",
31815
+ sorter: () => 0 + 0,
31620
31816
  render: (v, all) => {
31621
31817
  if (all.empty) {
31622
31818
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31632,6 +31828,7 @@ const getColumns$8 = ({
31632
31828
  title: t("Date"),
31633
31829
  dataIndex: "date",
31634
31830
  key: "date",
31831
+ sorter: () => 0 + 0,
31635
31832
  render: (date, all) => {
31636
31833
  if (all.empty) {
31637
31834
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31978,18 +32175,23 @@ const getFilterOptions$5 = (options, t) => {
31978
32175
  administrativeLevel1,
31979
32176
  administrativeLevel2,
31980
32177
  positionInMineralSupplyChainOptions,
31981
- subCategoriesOptions
32178
+ subCategoriesOptions,
32179
+ eventCategoryOptions = []
31982
32180
  } = options || {};
32181
+ const _categoryOptions = eventCategoryOptions?.map(item => ({
32182
+ value: item.value,
32183
+ label: typeof item.label === 'object' ? Object.values(item.label)[0] : item.label
32184
+ }));
31983
32185
  const _default = {
31984
32186
  timeframe: timeframe,
31985
32187
  status: [{
31986
32188
  value: "submitted",
31987
- label: "Submitted"
32189
+ label: t("Submitted")
31988
32190
  }, {
31989
32191
  value: "private",
31990
- label: "Private"
32192
+ label: t("Private")
31991
32193
  }],
31992
- category: stakeholderCategoryOptions || categoryOptions,
32194
+ category: _categoryOptions,
31993
32195
  country: countries,
31994
32196
  subCategory: subCategoriesOptions,
31995
32197
  // category: category,
@@ -32010,6 +32212,269 @@ const viewConfig$3 = {
32010
32212
  createTitle: "Create Incident"
32011
32213
  };
32012
32214
 
32215
+ const getColumns$8 = ({
32216
+ t,
32217
+ goTo,
32218
+ user,
32219
+ options,
32220
+ activeTab,
32221
+ getRedirectLink,
32222
+ theme,
32223
+ subject,
32224
+ data,
32225
+ applications
32226
+ }) => [{
32227
+ dataIndex: 'datastakeId',
32228
+ title: t('ID'),
32229
+ ellipsis: true,
32230
+ show: true,
32231
+ key: "datastakeId",
32232
+ sorter: () => 0 + 0,
32233
+ render: (v, all) => {
32234
+ if (all.empty) {
32235
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32236
+ className: "daf-default-cell"
32237
+ });
32238
+ }
32239
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32240
+ title: v,
32241
+ children: v
32242
+ });
32243
+ }
32244
+ }, {
32245
+ dataIndex: 'name',
32246
+ title: t('Title'),
32247
+ ellipsis: true,
32248
+ show: true,
32249
+ key: "name",
32250
+ sorter: () => 0 + 0,
32251
+ render: (v, all) => {
32252
+ if (all.empty) {
32253
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32254
+ className: "daf-default-cell"
32255
+ });
32256
+ }
32257
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32258
+ title: v,
32259
+ children: v
32260
+ });
32261
+ }
32262
+ }, {
32263
+ title: t("Date"),
32264
+ dataIndex: "date",
32265
+ key: "date",
32266
+ sorter: () => 0 + 0,
32267
+ render: (date, all) => {
32268
+ if (all.empty) {
32269
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32270
+ className: "daf-default-cell"
32271
+ });
32272
+ }
32273
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32274
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32275
+ title: _date,
32276
+ children: _date
32277
+ });
32278
+ },
32279
+ ellipsis: true
32280
+ }, {
32281
+ dataIndex: 'mineSite',
32282
+ title: t('Location'),
32283
+ ellipsis: true,
32284
+ show: true,
32285
+ render: (v, all) => {
32286
+ if (all.empty) {
32287
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32288
+ className: "daf-default-cell"
32289
+ });
32290
+ }
32291
+
32292
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
32293
+ const mineSite = all?.location?.name;
32294
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32295
+ title: mineSite,
32296
+ children: mineSite
32297
+ }) : '-';
32298
+ }
32299
+ }, {
32300
+ dataIndex: 'province',
32301
+ title: t('Province'),
32302
+ ellipsis: true,
32303
+ show: true,
32304
+ render: (v, all) => {
32305
+ if (all.empty) {
32306
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32307
+ className: "daf-default-cell"
32308
+ });
32309
+ }
32310
+ const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
32311
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32312
+ title: region,
32313
+ children: region
32314
+ }) : '-';
32315
+ }
32316
+ }, {
32317
+ dataIndex: 'territory',
32318
+ title: t('Territory'),
32319
+ ellipsis: true,
32320
+ show: true,
32321
+ render: (v, all) => {
32322
+ if (all.empty) {
32323
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32324
+ className: "daf-default-cell"
32325
+ });
32326
+ }
32327
+ const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
32328
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32329
+ title: district,
32330
+ children: district
32331
+ }) : '-';
32332
+ }
32333
+ }, {
32334
+ dataIndex: 'eventCategory',
32335
+ title: t('Category'),
32336
+ ellipsis: true,
32337
+ show: true,
32338
+ render: (v, all) => {
32339
+ if (all.empty) {
32340
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32341
+ className: "daf-default-cell"
32342
+ });
32343
+ }
32344
+ const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
32345
+ const categoryValue = getEventCategoryBySubject(eventCategory, subject);
32346
+ return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32347
+ title: categoryValue,
32348
+ children: categoryValue
32349
+ }) : '-';
32350
+ }
32351
+ }, {
32352
+ title: t("Sources"),
32353
+ dataIndex: "sources",
32354
+ key: "sources",
32355
+ show: activeTab !== "own",
32356
+ render: (val, all) => {
32357
+ if (all.empty) {
32358
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32359
+ className: "daf-default-cell"
32360
+ });
32361
+ }
32362
+ const sources = sourceAvatarConfig(val, user, applications);
32363
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32364
+ items: sources
32365
+ });
32366
+ }
32367
+ }, {
32368
+ title: t("Status"),
32369
+ dataIndex: "status",
32370
+ key: "status",
32371
+ show: activeTab === "own",
32372
+ render: (val, all) => {
32373
+ if (all.empty) {
32374
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32375
+ className: "daf-default-cell"
32376
+ });
32377
+ }
32378
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
32379
+ return renderStatusTag({
32380
+ value: _val,
32381
+ t
32382
+ });
32383
+ }
32384
+ }, {
32385
+ title: t("Last Update"),
32386
+ dataIndex: "updatedAt",
32387
+ key: "updatedAt",
32388
+ render: (date, all) => {
32389
+ if (all.empty) {
32390
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32391
+ className: "daf-default-cell"
32392
+ });
32393
+ }
32394
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32395
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32396
+ title: _date,
32397
+ children: _date
32398
+ });
32399
+ },
32400
+ ellipsis: true
32401
+ }, {
32402
+ id: 'actions',
32403
+ title: "",
32404
+ width: 60,
32405
+ render: (_, all) => {
32406
+ if (all.empty) {
32407
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32408
+ className: "daf-default-cell"
32409
+ });
32410
+ }
32411
+ const onClick = () => {
32412
+ let link = `/app/view/${subject}/${all.datastakeId}`;
32413
+ if (activeTab === "shared") {
32414
+ link += `?sourceId=${all?.authorId?.id}`;
32415
+ }
32416
+ goTo(getRedirectLink(link));
32417
+ };
32418
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
32419
+ onClick: onClick,
32420
+ theme: theme
32421
+ });
32422
+ }
32423
+ }].filter(column => column.show !== false);
32424
+
32425
+ const getFiltersConfig$4 = ({
32426
+ t
32427
+ }) => {
32428
+ return {
32429
+ country: {
32430
+ type: 'select',
32431
+ placeholder: t('Country'),
32432
+ style: {
32433
+ flex: 1
32434
+ },
32435
+ labelStyle: {
32436
+ flex: 1
32437
+ },
32438
+ getLabel: option => option.label,
32439
+ getValue: option => option.value
32440
+ },
32441
+ category: {
32442
+ type: 'select',
32443
+ label: 'Category',
32444
+ placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
32445
+ style: {
32446
+ flex: 1
32447
+ },
32448
+ labelStyle: {
32449
+ flex: 1
32450
+ },
32451
+ getLabel: option => option.label,
32452
+ getValue: option => option.value
32453
+ }
32454
+ };
32455
+ };
32456
+ const getFilterOptions$4 = (options, t) => {
32457
+ const {
32458
+ countries = [],
32459
+ category = [],
32460
+ locationCategories = []
32461
+ } = options || {};
32462
+ return {
32463
+ country: countries,
32464
+ category: locationCategories || category
32465
+ };
32466
+ };
32467
+ const formConfig$2 = {
32468
+ namespace: 'locations',
32469
+ view: 'scoping',
32470
+ scope: 'create',
32471
+ formType: 'location'
32472
+ };
32473
+ const viewConfig$2 = {
32474
+ title: "Locations",
32475
+ createTitle: "Create Location"
32476
+ };
32477
+
32013
32478
  const getColumns$7 = ({
32014
32479
  t,
32015
32480
  goTo,
@@ -32037,264 +32502,6 @@ const getColumns$7 = ({
32037
32502
  children: v
32038
32503
  });
32039
32504
  }
32040
- }, {
32041
- dataIndex: 'name',
32042
- title: t('Title'),
32043
- ellipsis: true,
32044
- show: true,
32045
- render: (v, all) => {
32046
- if (all.empty) {
32047
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32048
- className: "daf-default-cell"
32049
- });
32050
- }
32051
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32052
- title: v,
32053
- children: v
32054
- });
32055
- }
32056
- }, {
32057
- title: t("Date"),
32058
- dataIndex: "date",
32059
- key: "date",
32060
- render: (date, all) => {
32061
- if (all.empty) {
32062
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32063
- className: "daf-default-cell"
32064
- });
32065
- }
32066
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32067
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32068
- title: _date,
32069
- children: _date
32070
- });
32071
- },
32072
- ellipsis: true
32073
- }, {
32074
- dataIndex: 'mineSite',
32075
- title: t('Location'),
32076
- ellipsis: true,
32077
- show: true,
32078
- render: (v, all) => {
32079
- if (all.empty) {
32080
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32081
- className: "daf-default-cell"
32082
- });
32083
- }
32084
-
32085
- // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
32086
- const mineSite = all?.location?.name;
32087
- return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32088
- title: mineSite,
32089
- children: mineSite
32090
- }) : '-';
32091
- }
32092
- }, {
32093
- dataIndex: 'province',
32094
- title: t('Province'),
32095
- ellipsis: true,
32096
- show: true,
32097
- render: (v, all) => {
32098
- if (all.empty) {
32099
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32100
- className: "daf-default-cell"
32101
- });
32102
- }
32103
- const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
32104
- return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32105
- title: region,
32106
- children: region
32107
- }) : '-';
32108
- }
32109
- }, {
32110
- dataIndex: 'territory',
32111
- title: t('Territory'),
32112
- ellipsis: true,
32113
- show: true,
32114
- render: (v, all) => {
32115
- if (all.empty) {
32116
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32117
- className: "daf-default-cell"
32118
- });
32119
- }
32120
- const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
32121
- return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32122
- title: district,
32123
- children: district
32124
- }) : '-';
32125
- }
32126
- }, {
32127
- dataIndex: 'eventCategory',
32128
- title: t('Category'),
32129
- ellipsis: true,
32130
- show: true,
32131
- render: (v, all) => {
32132
- if (all.empty) {
32133
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32134
- className: "daf-default-cell"
32135
- });
32136
- }
32137
- const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
32138
- const categoryValue = getEventCategoryBySubject(eventCategory, subject);
32139
- return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32140
- title: categoryValue,
32141
- children: categoryValue
32142
- }) : '-';
32143
- }
32144
- }, {
32145
- title: t("Sources"),
32146
- dataIndex: "sources",
32147
- key: "sources",
32148
- show: activeTab !== "own",
32149
- render: (val, all) => {
32150
- if (all.empty) {
32151
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32152
- className: "daf-default-cell"
32153
- });
32154
- }
32155
- const sources = sourceAvatarConfig(val, user, applications);
32156
- return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32157
- items: sources
32158
- });
32159
- }
32160
- }, {
32161
- title: t("Status"),
32162
- dataIndex: "status",
32163
- key: "status",
32164
- show: activeTab === "own",
32165
- render: (val, all) => {
32166
- if (all.empty) {
32167
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32168
- className: "daf-default-cell"
32169
- });
32170
- }
32171
- const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
32172
- return renderStatusTag({
32173
- value: _val,
32174
- t
32175
- });
32176
- }
32177
- }, {
32178
- title: t("Last Update"),
32179
- dataIndex: "updatedAt",
32180
- key: "updatedAt",
32181
- render: (date, all) => {
32182
- if (all.empty) {
32183
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32184
- className: "daf-default-cell"
32185
- });
32186
- }
32187
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32188
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32189
- title: _date,
32190
- children: _date
32191
- });
32192
- },
32193
- ellipsis: true
32194
- }, {
32195
- id: 'actions',
32196
- title: "",
32197
- width: 60,
32198
- render: (_, all) => {
32199
- if (all.empty) {
32200
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32201
- className: "daf-default-cell"
32202
- });
32203
- }
32204
- const onClick = () => {
32205
- let link = `/app/view/${subject}/${all.datastakeId}`;
32206
- if (activeTab === "shared") {
32207
- link += `?sourceId=${all?.authorId?.id}`;
32208
- }
32209
- goTo(getRedirectLink(link));
32210
- };
32211
- return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
32212
- onClick: onClick,
32213
- theme: theme
32214
- });
32215
- }
32216
- }].filter(column => column.show !== false);
32217
-
32218
- const getFiltersConfig$4 = ({
32219
- t
32220
- }) => {
32221
- return {
32222
- country: {
32223
- type: 'select',
32224
- placeholder: t('Country'),
32225
- style: {
32226
- flex: 1
32227
- },
32228
- labelStyle: {
32229
- flex: 1
32230
- },
32231
- getLabel: option => option.label,
32232
- getValue: option => option.value
32233
- },
32234
- category: {
32235
- type: 'select',
32236
- label: 'Category',
32237
- placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
32238
- style: {
32239
- flex: 1
32240
- },
32241
- labelStyle: {
32242
- flex: 1
32243
- },
32244
- getLabel: option => option.label,
32245
- getValue: option => option.value
32246
- }
32247
- };
32248
- };
32249
- const getFilterOptions$4 = (options, t) => {
32250
- const {
32251
- countries = [],
32252
- category = [],
32253
- locationCategories = []
32254
- } = options || {};
32255
- return {
32256
- country: countries,
32257
- category: locationCategories || category
32258
- };
32259
- };
32260
- const formConfig$2 = {
32261
- namespace: 'locations',
32262
- view: 'scoping',
32263
- scope: 'create',
32264
- formType: 'location'
32265
- };
32266
- const viewConfig$2 = {
32267
- title: "Locations",
32268
- createTitle: "Create Location"
32269
- };
32270
-
32271
- const getColumns$6 = ({
32272
- t,
32273
- goTo,
32274
- user,
32275
- options,
32276
- activeTab,
32277
- getRedirectLink,
32278
- theme,
32279
- subject,
32280
- data,
32281
- applications
32282
- }) => [{
32283
- dataIndex: 'datastakeId',
32284
- title: t('ID'),
32285
- ellipsis: true,
32286
- show: true,
32287
- render: (v, all) => {
32288
- if (all.empty) {
32289
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32290
- className: "daf-default-cell"
32291
- });
32292
- }
32293
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32294
- title: v,
32295
- children: v
32296
- });
32297
- }
32298
32505
  }, {
32299
32506
  dataIndex: 'name',
32300
32507
  title: t('Name'),
@@ -32444,7 +32651,7 @@ const getFiltersConfig$3 = ({
32444
32651
  country: {
32445
32652
  type: 'select',
32446
32653
  label: 'Country',
32447
- placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
32654
+ placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
32448
32655
  style: {
32449
32656
  flex: 1
32450
32657
  },
@@ -32477,7 +32684,7 @@ const getFiltersConfig$3 = ({
32477
32684
  }
32478
32685
  return t('Province');
32479
32686
  },
32480
- placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
32687
+ placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
32481
32688
  filters: data => ({
32482
32689
  country: data.country,
32483
32690
  level: 'level_1'
@@ -32521,7 +32728,7 @@ const getFiltersConfig$3 = ({
32521
32728
  return t('Province');
32522
32729
  },
32523
32730
  show: data => !(data.country && data.administrativeLevel1),
32524
- placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
32731
+ placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
32525
32732
  filters: data => ({
32526
32733
  country: data.country,
32527
32734
  level: 'level_2',
@@ -32544,7 +32751,7 @@ const getFiltersConfig$3 = ({
32544
32751
  product: {
32545
32752
  type: 'select',
32546
32753
  label: 'Product',
32547
- placeholder: t => `${t('Filter by')} ${t('Product').toLowerCase()}`,
32754
+ placeholder: () => `${t('Filter by')} ${t('Product').toLowerCase()}`,
32548
32755
  style: {
32549
32756
  flex: 1
32550
32757
  },
@@ -32552,35 +32759,25 @@ const getFiltersConfig$3 = ({
32552
32759
  flex: 1
32553
32760
  },
32554
32761
  getLabel: option => option.label,
32555
- getValue: option => option.value,
32556
- filterOptions: val => {
32557
- if (val) {
32558
- const {
32559
- option,
32560
- filters
32561
- } = val;
32562
- if (filters && option) {
32563
- const {
32564
- filters: optionFilters
32565
- } = option;
32566
- if (Array.isArray(optionFilters) && optionFilters.length) {
32567
- const {
32568
- value,
32569
- condition
32570
- } = optionFilters[0];
32571
- if (condition === 'includes') {
32572
- return value.includes('corporation');
32573
- }
32574
- }
32575
- }
32576
- }
32577
- return true;
32578
- }
32762
+ getValue: option => option.value
32763
+ },
32764
+ type: {
32765
+ type: 'select',
32766
+ label: 'Type',
32767
+ placeholder: () => `${t('Filter by')} ${t('Type').toLowerCase()}`,
32768
+ style: {
32769
+ flex: 1
32770
+ },
32771
+ labelStyle: {
32772
+ flex: 1
32773
+ },
32774
+ getLabel: option => option.label,
32775
+ getValue: option => option.value
32579
32776
  },
32580
32777
  positionInTheMineralSupplyChain: {
32581
32778
  type: 'select',
32582
32779
  label: 'Position',
32583
- placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
32780
+ placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
32584
32781
  style: {
32585
32782
  flex: 1
32586
32783
  },
@@ -32593,7 +32790,7 @@ const getFiltersConfig$3 = ({
32593
32790
  status: {
32594
32791
  type: "select",
32595
32792
  label: "Status",
32596
- placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
32793
+ placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
32597
32794
  style: {
32598
32795
  flex: 1
32599
32796
  },
@@ -32616,21 +32813,24 @@ const getFilterOptions$3 = (options, t) => {
32616
32813
  stakeholderCategoryOptions,
32617
32814
  stakeholderSubCategoriesOptions,
32618
32815
  administrativeLevel1,
32619
- administrativeLevel2
32816
+ administrativeLevel2,
32817
+ mineralOptions,
32818
+ locationCategories = []
32620
32819
  } = options || {};
32621
32820
  const _default = {
32622
32821
  category: stakeholderCategoryOptions || categoryOptions,
32623
32822
  country: countries,
32624
- product: product,
32823
+ product: mineralOptions,
32824
+ type: locationCategories,
32625
32825
  administrativeLevel1,
32626
32826
  administrativeLevel2,
32627
32827
  subCategory: subCategoriesOptions,
32628
32828
  status: [{
32629
32829
  value: "submitted",
32630
- label: "Submitted"
32830
+ label: t("Submitted")
32631
32831
  }, {
32632
32832
  value: "private",
32633
- label: "Private"
32833
+ label: t("Private")
32634
32834
  }]
32635
32835
  };
32636
32836
  return _default;
@@ -32682,7 +32882,7 @@ MoreOptions.propTypes = {
32682
32882
  limit: PropTypes__default["default"].number
32683
32883
  };
32684
32884
 
32685
- const getColumns$5 = ({
32885
+ const getColumns$6 = ({
32686
32886
  t,
32687
32887
  goTo,
32688
32888
  user,
@@ -32698,6 +32898,8 @@ const getColumns$5 = ({
32698
32898
  title: t('ID'),
32699
32899
  ellipsis: true,
32700
32900
  show: true,
32901
+ key: "datastakeId",
32902
+ sorter: () => 0 + 0,
32701
32903
  render: (v, all) => {
32702
32904
  if (all.empty) {
32703
32905
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -32714,6 +32916,8 @@ const getColumns$5 = ({
32714
32916
  title: t('Name'),
32715
32917
  ellipsis: true,
32716
32918
  show: true,
32919
+ key: "name",
32920
+ sorter: () => 0 + 0,
32717
32921
  render: (v, all) => {
32718
32922
  if (all.empty) {
32719
32923
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -32761,7 +32965,7 @@ const getColumns$5 = ({
32761
32965
  }
32762
32966
  }, {
32763
32967
  dataIndex: 'category',
32764
- title: t('Type'),
32968
+ title: t('type'),
32765
32969
  ellipsis: true,
32766
32970
  show: true,
32767
32971
  render: (v, all) => {
@@ -32918,7 +33122,7 @@ const viewConfig = {
32918
33122
  createTitle: "Create Document"
32919
33123
  };
32920
33124
 
32921
- const getColumns$4 = ({
33125
+ const getColumns$5 = ({
32922
33126
  t,
32923
33127
  goTo,
32924
33128
  user,
@@ -33043,63 +33247,63 @@ const FILTER_REGISTRY = {
33043
33247
  options: getFilterOptions$a,
33044
33248
  formConfig: formConfig$8,
33045
33249
  viewConfig: viewConfig$8,
33046
- columns: getColumns$b
33250
+ columns: getColumns$c
33047
33251
  },
33048
33252
  workers: {
33049
33253
  config: getFiltersConfig$8,
33050
33254
  options: getFilterOptions$8,
33051
33255
  formConfig: formConfig$6,
33052
33256
  viewConfig: viewConfig$6,
33053
- columns: getColumns$a
33257
+ columns: getColumns$b
33054
33258
  },
33055
33259
  operators: {
33056
33260
  config: getFiltersConfig$9,
33057
33261
  options: getFilterOptions$9,
33058
33262
  formConfig: formConfig$7,
33059
33263
  viewConfig: viewConfig$7,
33060
- columns: getColumns$c
33264
+ columns: getColumns$d
33061
33265
  },
33062
33266
  events: {
33063
33267
  config: getFiltersConfig$7,
33064
33268
  options: getFilterOptions$7,
33065
33269
  formConfig: formConfig$5,
33066
33270
  viewConfig: viewConfig$5,
33067
- columns: getColumns$9
33271
+ columns: getColumns$a
33068
33272
  },
33069
33273
  activities: {
33070
33274
  config: getFiltersConfig$6,
33071
33275
  options: getFilterOptions$6,
33072
33276
  formConfig: formConfig$4,
33073
33277
  viewConfig: viewConfig$4,
33074
- columns: getColumns$8
33278
+ columns: getColumns$9
33075
33279
  },
33076
33280
  incidents: {
33077
33281
  config: getFiltersConfig$5,
33078
33282
  options: getFilterOptions$5,
33079
33283
  formConfig: formConfig$3,
33080
33284
  viewConfig: viewConfig$3,
33081
- columns: getColumns$7
33285
+ columns: getColumns$8
33082
33286
  },
33083
33287
  locations: {
33084
33288
  config: getFiltersConfig$4,
33085
33289
  options: getFilterOptions$4,
33086
33290
  formConfig: formConfig$2,
33087
33291
  viewConfig: viewConfig$2,
33088
- columns: getColumns$6
33292
+ columns: getColumns$7
33089
33293
  },
33090
33294
  'production-sites': {
33091
33295
  config: getFiltersConfig$3,
33092
33296
  options: getFilterOptions$3,
33093
33297
  formConfig: formConfig$1,
33094
33298
  viewConfig: viewConfig$1,
33095
- columns: getColumns$5
33299
+ columns: getColumns$6
33096
33300
  },
33097
33301
  documents: {
33098
33302
  config: getFiltersConfig$2,
33099
33303
  options: getFilterOptions$2,
33100
33304
  formConfig: formConfig,
33101
33305
  viewConfig: viewConfig,
33102
- columns: getColumns$4
33306
+ columns: getColumns$5
33103
33307
  }
33104
33308
  };
33105
33309
  const DEFAULT_SUBJECT = 'stakeholders';
@@ -33150,7 +33354,7 @@ const getViewConfig = ({
33150
33354
  return registry?.viewConfig;
33151
33355
  };
33152
33356
 
33153
- const getColumns$3 = ({
33357
+ const getColumns$4 = ({
33154
33358
  t,
33155
33359
  goTo,
33156
33360
  user,
@@ -33237,7 +33441,7 @@ const useTablePage = ({
33237
33441
  extendingFilters: extendingFilters,
33238
33442
  subject
33239
33443
  });
33240
- const columns = React.useMemo(() => getColumns$3({
33444
+ const columns = React.useMemo(() => getColumns$4({
33241
33445
  t,
33242
33446
  goTo,
33243
33447
  user,
@@ -33248,7 +33452,7 @@ const useTablePage = ({
33248
33452
  subject,
33249
33453
  data,
33250
33454
  applications
33251
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns$3]);
33455
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns$4]);
33252
33456
  const selectFiltersConfig = React.useMemo(() => getFiltersConfig$1({
33253
33457
  t,
33254
33458
  subject
@@ -33334,6 +33538,12 @@ const TablePage = ({
33334
33538
  breadcrumbs = [],
33335
33539
  onDownload
33336
33540
  }) => {
33541
+ const _options = React.useMemo(() => {
33542
+ return {
33543
+ ...options,
33544
+ ...data?.options
33545
+ };
33546
+ }, [options, data?.options]);
33337
33547
  const {
33338
33548
  activeTab,
33339
33549
  selectOptions,
@@ -33349,7 +33559,7 @@ const TablePage = ({
33349
33559
  location,
33350
33560
  getData,
33351
33561
  extendingFilters,
33352
- options,
33562
+ options: _options,
33353
33563
  t,
33354
33564
  goTo,
33355
33565
  user,
@@ -33813,7 +34023,7 @@ const WorkersTable = ({
33813
34023
  getData: getData,
33814
34024
  getApiBaseUrl: getApiBaseUrl,
33815
34025
  getAppHeader: getAppHeader,
33816
- getColumns: getColumns$a,
34026
+ getColumns: getColumns$b,
33817
34027
  breadcrumbs: breadcrumbs,
33818
34028
  extendingFilters: extendingFilters,
33819
34029
  formConfig: {
@@ -34038,7 +34248,7 @@ const ProductionSitesTable = ({
34038
34248
  });
34039
34249
  };
34040
34250
 
34041
- const getColumns$2 = ({
34251
+ const getColumns$3 = ({
34042
34252
  t,
34043
34253
  goTo,
34044
34254
  user,
@@ -34516,7 +34726,7 @@ const UsersTable = ({
34516
34726
  const params = new URLSearchParams(location?.search);
34517
34727
  const [openCreateModal, setOpenCreateModal] = React.useState(params.has("create"));
34518
34728
  const [userToEdit, setUserToEdit] = React.useState(null);
34519
- const columns = React.useMemo(() => getColumns$2({
34729
+ const columns = React.useMemo(() => getColumns$3({
34520
34730
  t,
34521
34731
  goTo,
34522
34732
  user,
@@ -34889,25 +35099,29 @@ const checkboxConfig = {
34889
35099
  name: "Name",
34890
35100
  datastakeId: "ID"
34891
35101
  };
34892
- const partnerTypes = [{
34893
- label: "Individual",
34894
- value: "individual"
34895
- }, {
34896
- label: "Organisation",
34897
- value: "organisation"
34898
- }];
34899
- const partnershipTypes = [{
34900
- label: "Source",
34901
- value: "source"
34902
- }, {
34903
- label: "Client",
34904
- value: "client"
34905
- }, {
34906
- label: "Exchange",
34907
- value: "exchange"
34908
- }];
35102
+ const getPartnerTypes = t => {
35103
+ return [{
35104
+ label: t("Individual"),
35105
+ value: "individual"
35106
+ }, {
35107
+ label: t("Organisation"),
35108
+ value: "organisation"
35109
+ }];
35110
+ };
35111
+ const getPartnershipTypes = t => {
35112
+ return [{
35113
+ label: t("Source"),
35114
+ value: "source"
35115
+ }, {
35116
+ label: t("Client"),
35117
+ value: "client"
35118
+ }, {
35119
+ label: t("Exchange"),
35120
+ value: "exchange"
35121
+ }];
35122
+ };
34909
35123
 
34910
- const getColumns$1 = ({
35124
+ const getColumns$2 = ({
34911
35125
  t,
34912
35126
  accept,
34913
35127
  decline,
@@ -34958,6 +35172,7 @@ const getColumns$1 = ({
34958
35172
  className: "daf-default-cell"
34959
35173
  });
34960
35174
  }
35175
+ const partnershipTypes = getPartnershipTypes(t);
34961
35176
  return partnershipTypes.find(v => v.value === val)?.label || val || "-";
34962
35177
  }
34963
35178
  }, {
@@ -34974,6 +35189,7 @@ const getColumns$1 = ({
34974
35189
  className: "daf-default-cell"
34975
35190
  });
34976
35191
  }
35192
+ const partnerTypes = getPartnerTypes(t);
34977
35193
  return partnerTypes.find(v => v.value === val)?.label || val || "-";
34978
35194
  }
34979
35195
  }, {
@@ -35279,6 +35495,8 @@ const Create = ({
35279
35495
  getAppHeader = () => {},
35280
35496
  getApiBaseUrl = () => {}
35281
35497
  }) => {
35498
+ const partnerTypes = React.useMemo(() => getPartnerTypes(t), [t]);
35499
+ const partnershipTypes = React.useMemo(() => getPartnershipTypes(t), [t]);
35282
35500
  const form = React.useMemo(() => ({
35283
35501
  identification: {
35284
35502
  partnershipType: {
@@ -35485,6 +35703,8 @@ const Edit = ({
35485
35703
  }) => {
35486
35704
  const [MainForm] = antd.Form.useForm();
35487
35705
  const [loading, setLoading] = React.useState(false);
35706
+ React.useMemo(() => getPartnerTypes(t), [t]);
35707
+ const partnershipTypes = React.useMemo(() => getPartnershipTypes(t), [t]);
35488
35708
  React.useEffect(() => {
35489
35709
  MainForm.setFieldsValue({
35490
35710
  ...partner,
@@ -35652,7 +35872,7 @@ const PartnersTable = ({
35652
35872
  setTotalRequests,
35653
35873
  t
35654
35874
  });
35655
- const columns = React.useMemo(() => getColumns$1({
35875
+ const columns = React.useMemo(() => getColumns$2({
35656
35876
  t,
35657
35877
  accept,
35658
35878
  decline,
@@ -37041,6 +37261,9 @@ const TradeRelationships = ({
37041
37261
  operatorData,
37042
37262
  APP
37043
37263
  });
37264
+ console.log({
37265
+ graphData
37266
+ });
37044
37267
  React.useEffect(() => {
37045
37268
  const defaultProduct = filterConfig?.[0]?.options?.[0]?.value;
37046
37269
  if (!filters.products && defaultProduct) {
@@ -37720,12 +37943,12 @@ const OperatorSummary = ({
37720
37943
  });
37721
37944
  return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
37722
37945
  header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
37723
- title: hasSelect ? t("Operator Review") : (singleItemData?.name || "") + " " + t("Summary"),
37946
+ title: hasSelect ? t("Operator Review") : `${singleItemData?.name || ""} ${singleItemData?.name ? t("Summary") : ""}`,
37724
37947
  className: "with-border-header h-w-btn-header no-px-body",
37725
37948
  goBackTo: !hasSelect && goBack,
37726
37949
  breadcrumbs: breadcrumbs,
37727
37950
  addedHeaderFirst: true,
37728
- actionButtons: [{
37951
+ actionButtons: hasSelect ? [] : [{
37729
37952
  tooltip: t("Details"),
37730
37953
  icon: "FileEdit",
37731
37954
  onClick: () => {
@@ -37739,9 +37962,6 @@ const OperatorSummary = ({
37739
37962
  }],
37740
37963
  addedHeader: /*#__PURE__*/jsxRuntime.jsx("div", {
37741
37964
  className: "flex flex-row gap-4",
37742
- style: {
37743
- marginRight: 8
37744
- },
37745
37965
  children: /*#__PURE__*/jsxRuntime.jsx(Multiselect, {
37746
37966
  options: [...sourceOptions],
37747
37967
  isAvatarGroup: true,
@@ -37757,7 +37977,10 @@ const OperatorSummary = ({
37757
37977
  dropDownWidth: 200,
37758
37978
  defaultSelected: (partners || []).map(p => p.id) || []
37759
37979
  }, partners?.length)
37760
- })
37980
+ }),
37981
+ onDownload: () => {
37982
+ console.log("onDownload");
37983
+ }
37761
37984
  }),
37762
37985
  children: [hasSelect && /*#__PURE__*/jsxRuntime.jsx("section", {
37763
37986
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
@@ -39900,6 +40123,710 @@ const StatCard = ({
39900
40123
  });
39901
40124
  };
39902
40125
 
40126
+ const RepeatableGroup = ({
40127
+ name = null,
40128
+ config = {},
40129
+ allData = {},
40130
+ linkingData = {},
40131
+ ajaxOptions,
40132
+ t,
40133
+ ajaxForms,
40134
+ changeAjaxForms,
40135
+ getApiBaseUrl,
40136
+ getAppHeader,
40137
+ user,
40138
+ getToken,
40139
+ app
40140
+ }) => {
40141
+ const {
40142
+ automaticallyLink,
40143
+ dataLink,
40144
+ call
40145
+ } = React.useMemo(() => config, [config]);
40146
+ const entity = React.useMemo(() => automaticallyLink?.entity || config?.meta?.dataLinkEntity, [automaticallyLink, config]);
40147
+ const isAjaxModal = React.useMemo(() => automaticallyLink && dataLink && call, [automaticallyLink, dataLink, call]);
40148
+ const [modalRow, setModalRow] = React.useState(null);
40149
+ const dataSource = React.useMemo(() => allData[name] || [], [allData, name]);
40150
+ const notAvailable = (allData?.meta?.inputs || {})[name]?.notAvailable;
40151
+ const notApplicable = (allData?.meta?.inputs || {})[name]?.notApplicable;
40152
+ const noBody = notApplicable || notAvailable;
40153
+ const _data = React.useMemo(() => dataSource.length ? dataSource.map((f, i) => {
40154
+ if (isAjaxModal && typeof f === 'string' && linkingData && linkingData[entity] && linkingData[entity][f]) {
40155
+ const value = linkingData[entity][f];
40156
+ return {
40157
+ ...value,
40158
+ key: i
40159
+ };
40160
+ }
40161
+ if (config?.meta?.ajaxOptionsKey) {
40162
+ if (linkingData && linkingData[entity] && linkingData[entity][f[config?.meta?.ajaxOptionsKey]]) {
40163
+ const value = linkingData[entity][f[config?.meta?.ajaxOptionsKey]];
40164
+ return {
40165
+ ...value,
40166
+ key: i
40167
+ };
40168
+ }
40169
+ const options = ajaxOptions[config?.meta?.ajaxOptionsKey];
40170
+ if (Array.isArray(options)) {
40171
+ const value = options.find(v => v.value === f[config?.meta?.ajaxOptionsKey]);
40172
+ if (value) {
40173
+ return {
40174
+ ...f,
40175
+ ...value,
40176
+ key: i
40177
+ };
40178
+ }
40179
+ }
40180
+ }
40181
+ return {
40182
+ ...f,
40183
+ key: i
40184
+ };
40185
+ }) : [{
40186
+ key: 1,
40187
+ isEmpty: true
40188
+ }, {
40189
+ key: 2,
40190
+ isEmpty: true
40191
+ }], [isAjaxModal, dataSource, entity, config, ajaxOptions, linkingData]);
40192
+ const mapKey = key => ({
40193
+ title: config?.inputs[key]?.label,
40194
+ key: key,
40195
+ dataIndex: key,
40196
+ ellipsis: true,
40197
+ render: (v, all) => {
40198
+ if (all.isEmpty) {
40199
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
40200
+ className: "daf-default-cell md"
40201
+ });
40202
+ }
40203
+ if (v) {
40204
+ return /*#__PURE__*/jsxRuntime.jsx(BasicInput, {
40205
+ t: t,
40206
+ app: app,
40207
+ ajaxForms: ajaxForms,
40208
+ changeAjaxForms: changeAjaxForms,
40209
+ getApiBaseUrl: getApiBaseUrl,
40210
+ getAppHeader: getAppHeader,
40211
+ user: user,
40212
+ getToken: getToken,
40213
+ name: key,
40214
+ config: config.inputs[key],
40215
+ valueOnlyString: true,
40216
+ data: all
40217
+ }, key);
40218
+ }
40219
+ return '--';
40220
+ }
40221
+ });
40222
+ const columns = [...(Array.isArray(config?.meta?.tableKeys) ? config.meta.tableKeys.map(mapKey) : Object.keys(config?.inputs).map(mapKey)), {
40223
+ key: 'actions',
40224
+ dataIndex: 'actions',
40225
+ label: '',
40226
+ width: 50,
40227
+ render: (_, all) => {
40228
+ if (all.isEmpty) {
40229
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
40230
+ className: "daf-default-cell md"
40231
+ });
40232
+ }
40233
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
40234
+ onClick: () => setModalRow(all),
40235
+ className: "cursor-pointer flex justify-content-center",
40236
+ children: /*#__PURE__*/jsxRuntime.jsx(Icons.EyeOutlined, {})
40237
+ });
40238
+ }
40239
+ }];
40240
+ const _subTitle = config.viewSubTitle || config.subTitle;
40241
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
40242
+ className: formatClassname(["group repeatable", noBody && 'no-body']),
40243
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
40244
+ className: "daf-title with-subtitle",
40245
+ children: [/*#__PURE__*/jsxRuntime.jsx("h1", {
40246
+ children: ReactHtmlParser__default["default"](config?.label)
40247
+ }), _subTitle && typeof _subTitle === 'string' ? /*#__PURE__*/jsxRuntime.jsx("p", {
40248
+ children: ReactHtmlParser__default["default"](_subTitle)
40249
+ }) : null]
40250
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
40251
+ className: "flex",
40252
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
40253
+ className: "daf-table-wrapper no-padding repeatable-form-table input no-pagination",
40254
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
40255
+ renderEmpty: () => notApplicable ? t('Not applicable') : t('No information available'),
40256
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Table, {
40257
+ locale: getLocales(t),
40258
+ pagination: false,
40259
+ columns: columns,
40260
+ rowKey: "key",
40261
+ dataSource: noBody ? [] : _data
40262
+ })
40263
+ })
40264
+ }), !noActionsInputs.includes(config?.type) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
40265
+ className: "ml-4 input-actions flex",
40266
+ children: [/*#__PURE__*/jsxRuntime.jsx(Review, {
40267
+ t: t,
40268
+ config: config,
40269
+ inputMeta: (allData?.meta?.inputs || {})[name] || {},
40270
+ name: name
40271
+ }), /*#__PURE__*/jsxRuntime.jsx(Versions, {
40272
+ t: t,
40273
+ versionsDatapoints: [],
40274
+ config: config,
40275
+ allData: allData,
40276
+ name: name,
40277
+ getValue: () => null
40278
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
40279
+ title: t("Sources"),
40280
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40281
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
40282
+ className: "default p-0 flex flex-column justify-content-center",
40283
+ type: "link",
40284
+ disabled: true,
40285
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
40286
+ name: "Sources",
40287
+ width: 16,
40288
+ height: 16
40289
+ })
40290
+ })
40291
+ })
40292
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
40293
+ title: t("Comments"),
40294
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40295
+ children: /*#__PURE__*/jsxRuntime.jsx(Comments, {
40296
+ t: t,
40297
+ config: config,
40298
+ allData: allData,
40299
+ name: name
40300
+ })
40301
+ })
40302
+ })]
40303
+ }) : null]
40304
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Modal, {
40305
+ open: !!modalRow,
40306
+ title: /*#__PURE__*/jsxRuntime.jsx(ModalHeader, {
40307
+ title: config?.label
40308
+ }),
40309
+ footer: null,
40310
+ width: 650,
40311
+ className: "max-h-50",
40312
+ onCancel: () => setModalRow(null),
40313
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40314
+ className: "daf-view-form",
40315
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40316
+ className: "view-content",
40317
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40318
+ className: "content no-padding",
40319
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40320
+ className: "wrapper",
40321
+ style: {
40322
+ maxWidth: 600 // FUTURE ILVI
40323
+ },
40324
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40325
+ className: "group",
40326
+ children: /*#__PURE__*/jsxRuntime.jsx(Input, {
40327
+ app: app,
40328
+ t: t,
40329
+ ajaxForms: ajaxForms,
40330
+ changeAjaxForms: changeAjaxForms,
40331
+ getApiBaseUrl: getApiBaseUrl,
40332
+ getAppHeader: getAppHeader,
40333
+ user: user,
40334
+ getToken: getToken,
40335
+ config: Object.keys(config.inputs || {}).filter(k => {
40336
+ return !(config?.meta?.excludedKeysView || []).includes(k);
40337
+ }).reduce((all, key) => {
40338
+ all[key] = config.inputs[key];
40339
+ return all;
40340
+ }, {}),
40341
+ data: {
40342
+ ...modalRow
40343
+ }
40344
+ })
40345
+ })
40346
+ })
40347
+ })
40348
+ })
40349
+ })
40350
+ })]
40351
+ });
40352
+ };
40353
+
40354
+ /* eslint-disable no-case-declarations */
40355
+ const RepeatableModals = ({
40356
+ name = null,
40357
+ config = {},
40358
+ data = {},
40359
+ linkingData = {},
40360
+ linkingForms = {},
40361
+ ajaxOptions = [],
40362
+ t,
40363
+ ajaxForms,
40364
+ changeAjaxForms,
40365
+ getApiBaseUrl,
40366
+ getAppHeader,
40367
+ user,
40368
+ getToken,
40369
+ app
40370
+ }) => {
40371
+ const label = (prop = null) => {
40372
+ function getLabel(label) {
40373
+ switch (typeof label) {
40374
+ case 'string':
40375
+ return label;
40376
+ case 'object':
40377
+ const labelKey = Object.keys(label).find(cond => verifyConditional(cond, data));
40378
+ return label[labelKey];
40379
+ default:
40380
+ return label;
40381
+ }
40382
+ }
40383
+ if (config[prop]) {
40384
+ return getLabel(config[prop]);
40385
+ }
40386
+ if (config.sectionLabel) {
40387
+ return getLabel(config.sectionLabel);
40388
+ }
40389
+ if (config.outputLabel) {
40390
+ return getLabel(config.outputLabel);
40391
+ }
40392
+ return getLabel(config.label);
40393
+ };
40394
+ return verifyConditional(config.showIf ? config.showIf : null, data) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
40395
+ className: "group",
40396
+ children: [label('outputLabel') ? /*#__PURE__*/jsxRuntime.jsx("div", {
40397
+ className: "title",
40398
+ children: /*#__PURE__*/jsxRuntime.jsx("h1", {
40399
+ children: label('outputLabel')
40400
+ })
40401
+ }) : null, data[name] && data[name].length ? data[name].map((item, index) => /*#__PURE__*/jsxRuntime.jsxs("div", {
40402
+ className: "group display",
40403
+ style: {
40404
+ border: '1px dotted var(--mmt-primary-70)'
40405
+ },
40406
+ children: [label() ? /*#__PURE__*/jsxRuntime.jsx("div", {
40407
+ className: "title",
40408
+ children: /*#__PURE__*/jsxRuntime.jsxs("h1", {
40409
+ children: [label(), " #", index + 1]
40410
+ })
40411
+ }) : null, repeatObjects(config.inputs, key => {
40412
+ const modalData = {
40413
+ [name]: {
40414
+ [key]: data[name][index][key] || null
40415
+ }
40416
+ };
40417
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
40418
+ className: "group",
40419
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
40420
+ className: "title",
40421
+ children: /*#__PURE__*/jsxRuntime.jsx("h1", {
40422
+ children: config.inputs[key].outputLabel || getInputLabel$2(config.inputs[key], item)
40423
+ })
40424
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
40425
+ app: app,
40426
+ ajaxForms: ajaxForms,
40427
+ changeAjaxForms: changeAjaxForms,
40428
+ getApiBaseUrl: getApiBaseUrl,
40429
+ getAppHeader: getAppHeader,
40430
+ user: user,
40431
+ getToken: getToken,
40432
+ t: t,
40433
+ parent: name,
40434
+ name: config.inputs[key].dataId || key,
40435
+ config: config.inputs[key],
40436
+ data: modalData,
40437
+ linkingData: linkingData,
40438
+ linkingForms: linkingForms,
40439
+ ajaxOptions: ajaxOptions,
40440
+ cols: 2
40441
+ }, key)]
40442
+ }, key);
40443
+ })]
40444
+ }, index)) : /*#__PURE__*/jsxRuntime.jsx("span", {
40445
+ className: "text-muted",
40446
+ children: t('Not answered')
40447
+ })]
40448
+ }) : null;
40449
+ };
40450
+
40451
+ /* eslint-disable no-unused-vars */
40452
+ const Content = ({
40453
+ style = {},
40454
+ form = {},
40455
+ data = {},
40456
+ groupConfig = {},
40457
+ versionsDatapoints,
40458
+ linkingData = {},
40459
+ linkingForms = {},
40460
+ ajaxOptions = [],
40461
+ // ADDED
40462
+ t,
40463
+ app,
40464
+ ajaxForms,
40465
+ language,
40466
+ changeAjaxForms,
40467
+ getApiBaseUrl,
40468
+ getAppHeader,
40469
+ user,
40470
+ evaluationConfig = [],
40471
+ fullWidth = false
40472
+ }) => {
40473
+ const groupSingle = grps => {
40474
+ const form = Object.keys(grps).reduce((f, gKey) => {
40475
+ if (grps[gKey].type !== "modal" && !isGroupInput(grps[gKey], false, data) && !isGroupInput(grps[gKey], true, data) && grps[gKey].display !== "group" && !grps[gKey].viewGroup && !grps[gKey].component) {
40476
+ if (grps[gKey].group && !f[grps[gKey].group]) {
40477
+ f[grps[gKey].group] = {};
40478
+ Object.assign(f[grps[gKey].group], {
40479
+ [gKey]: grps[gKey]
40480
+ });
40481
+ } else if (grps[gKey].group && f[grps[gKey].group]) {
40482
+ Object.assign(f[grps[gKey].group], {
40483
+ [gKey]: grps[gKey]
40484
+ });
40485
+ }
40486
+ if (grps[gKey]?.meta?.group && !f[grps[gKey]?.meta?.group]) {
40487
+ f[grps[gKey]?.meta?.group] = {};
40488
+ Object.assign(f[grps[gKey].meta.group], {
40489
+ [gKey]: grps[gKey]
40490
+ });
40491
+ } else if (grps[gKey]?.meta?.group && f[grps[gKey]?.meta?.group]) {
40492
+ Object.assign(f[grps[gKey].meta.group], {
40493
+ [gKey]: grps[gKey]
40494
+ });
40495
+ }
40496
+ if (grps[gKey].section && !f[grps[gKey].section]) {
40497
+ f[grps[gKey].section] = {};
40498
+ Object.assign(f[grps[gKey].section], {
40499
+ [gKey]: grps[gKey]
40500
+ });
40501
+ } else if (grps[gKey].section && f[grps[gKey].section]) {
40502
+ Object.assign(f[grps[gKey].section], {
40503
+ [gKey]: grps[gKey]
40504
+ });
40505
+ }
40506
+ }
40507
+ return f;
40508
+ }, {});
40509
+ return form;
40510
+ };
40511
+ const getDisplayGroupConfig = (groups, key) => {
40512
+ return Object.keys(groups).reduce((items, gKey) => {
40513
+ if (groups[gKey].viewGroup === key) {
40514
+ // eslint-disable-next-line no-unused-vars
40515
+ const {
40516
+ viewGroup,
40517
+ ...gCfg
40518
+ } = groups[gKey];
40519
+ items[gKey] = gCfg;
40520
+ }
40521
+ return items;
40522
+ }, {});
40523
+ };
40524
+ const getComponent = (component, key, config) => {
40525
+ switch (component) {
40526
+ case "repeatableModals":
40527
+ return /*#__PURE__*/jsxRuntime.jsx(RepeatableModals, {
40528
+ app: app,
40529
+ t: t,
40530
+ ajaxForms: ajaxForms,
40531
+ changeAjaxForms: changeAjaxForms,
40532
+ getApiBaseUrl: getApiBaseUrl,
40533
+ getAppHeader: getAppHeader,
40534
+ user: user,
40535
+ getToken: getToken,
40536
+ name: key,
40537
+ data: data,
40538
+ config: config,
40539
+ linkingData: linkingData,
40540
+ linkingForms: linkingForms,
40541
+ ajaxOptions: ajaxOptions
40542
+ }, key);
40543
+ default:
40544
+ return /*#__PURE__*/jsxRuntime.jsx("p", {
40545
+ children: "Component"
40546
+ });
40547
+ }
40548
+ };
40549
+ const isDisplayGroup = input => input.display && input.display === "group";
40550
+ const isSingleModal = input => input.type && input.type === "modal";
40551
+ const hasComponent = input => input.component && typeof input.component === "string";
40552
+ const typeRender = (groups, singleGroupsKeys, addedContent) => {
40553
+ const _length = Object.keys(groups || {}).length;
40554
+ const isEven = _length % 2 === 0;
40555
+ const groupped = Object.keys(groups).reduce((all, key) => {
40556
+ const _val = groups[key];
40557
+ const group = _val.group || _val?.meta?.group || _val.section;
40558
+ if (all[group]) {
40559
+ all[group][key] = _val;
40560
+ } else {
40561
+ all[group] = {
40562
+ [key]: _val
40563
+ };
40564
+ }
40565
+ return all;
40566
+ }, {});
40567
+ return Object.keys(groupped).map(key => {
40568
+ const groups = groupped[key];
40569
+ return /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
40570
+ children: repeatObjects(groups, (key, ind) => {
40571
+ // normal group
40572
+ return hasComponent(groups[key]) ? getComponent(groups[key].component, key, groups[key]) : isGroupInput(groups[key], false, data) ? /*#__PURE__*/jsxRuntime.jsx(Group, {
40573
+ t: t,
40574
+ name: key,
40575
+ linkingData: linkingData,
40576
+ config: groups[key],
40577
+ data: data,
40578
+ allData: data,
40579
+ linkingForms: linkingForms,
40580
+ cols: 2,
40581
+ ajaxForms: ajaxForms,
40582
+ changeAjaxForms: changeAjaxForms,
40583
+ getApiBaseUrl: getApiBaseUrl,
40584
+ getAppHeader: getAppHeader,
40585
+ user: user,
40586
+ getToken: getToken,
40587
+ evaluationConfig: evaluationConfig,
40588
+ ajaxOptions: ajaxOptions
40589
+ }, key) :
40590
+ // repeatable group
40591
+ isGroupInput(groups[key], true, data) ? /*#__PURE__*/jsxRuntime.jsx(RepeatableGroup, {
40592
+ app: app,
40593
+ t: t,
40594
+ ajaxForms: ajaxForms,
40595
+ changeAjaxForms: changeAjaxForms,
40596
+ getApiBaseUrl: getApiBaseUrl,
40597
+ getAppHeader: getAppHeader,
40598
+ user: user,
40599
+ getToken: getToken,
40600
+ name: key,
40601
+ config: groups[key],
40602
+ data: data,
40603
+ allData: data,
40604
+ linkingData: linkingData,
40605
+ linkingForms: linkingForms,
40606
+ ajaxOptions: ajaxOptions
40607
+ }, key) :
40608
+ // single inputs grouped
40609
+ singleGroupsKeys.includes(key) ? (() => {
40610
+ if (!addedContent.includes(key)) {
40611
+ const currentGroup = Object.keys(groupSingle(groups)).find(k => Object.keys(groupSingle(groups)[k]).includes(key));
40612
+ addedContent.push(...Object.keys(groupSingle(groups)[currentGroup]));
40613
+ const config = groupSingle(groups)[currentGroup];
40614
+ if (groups[key].viewShowIf || groups[key]?.meta?.excludeFromView) {
40615
+ if (!showHideInput$3(groups[key], data)) {
40616
+ return null;
40617
+ }
40618
+ }
40619
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
40620
+ className: "group",
40621
+ id: currentGroup,
40622
+ children: [groupConfig[currentGroup] ? /*#__PURE__*/jsxRuntime.jsx("div", {
40623
+ className: "title",
40624
+ children: /*#__PURE__*/jsxRuntime.jsx("h1", {
40625
+ children: groupConfig[currentGroup][language]
40626
+ })
40627
+ }) : null, /*#__PURE__*/jsxRuntime.jsx(Input, {
40628
+ app: app,
40629
+ t: t,
40630
+ ajaxForms: ajaxForms,
40631
+ changeAjaxForms: changeAjaxForms,
40632
+ getApiBaseUrl: getApiBaseUrl,
40633
+ getAppHeader: getAppHeader,
40634
+ user: user,
40635
+ getToken: getToken,
40636
+ versionsDatapoints: versionsDatapoints,
40637
+ name: config.dataId || key,
40638
+ config: config,
40639
+ data: data,
40640
+ allData: data,
40641
+ linkingData: linkingData,
40642
+ className: isEven ? ind === _length - 1 || ind === _length - 2 ? "last" : undefined : ind === _length - 1 ? "last" : undefined,
40643
+ linkingForms: linkingForms,
40644
+ ajaxOptions: ajaxOptions,
40645
+ evaluationConfig: evaluationConfig,
40646
+ cols: 2
40647
+ }, key)]
40648
+ }, `${currentGroup}-${Date.now()}`);
40649
+ }
40650
+ })() :
40651
+ // display group
40652
+ isDisplayGroup(groups[key]) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
40653
+ className: "group display",
40654
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
40655
+ className: "title",
40656
+ children: /*#__PURE__*/jsxRuntime.jsx("h1", {
40657
+ children: groups[key].label
40658
+ })
40659
+ }), typeRender(getDisplayGroupConfig(groups, key), singleGroupsKeys, addedContent)]
40660
+ }, key) :
40661
+ // single modal
40662
+ isSingleModal(groups[key]) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
40663
+ className: "group",
40664
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
40665
+ className: "title",
40666
+ children: /*#__PURE__*/jsxRuntime.jsx("h1", {
40667
+ children: groups[key].outputLabel || getInputLabel$2(groups[key], data)
40668
+ })
40669
+ }), /*#__PURE__*/jsxRuntime.jsx(Input, {
40670
+ app: app,
40671
+ t: t,
40672
+ ajaxForms: ajaxForms,
40673
+ changeAjaxForms: changeAjaxForms,
40674
+ getApiBaseUrl: getApiBaseUrl,
40675
+ getAppHeader: getAppHeader,
40676
+ user: user,
40677
+ getToken: getToken,
40678
+ versionsDatapoints: versionsDatapoints,
40679
+ parent: key,
40680
+ name: groups[key].dataId || key,
40681
+ config: groups[key],
40682
+ className: "last",
40683
+ data: data,
40684
+ allData: data,
40685
+ linkingData: linkingData,
40686
+ linkingForms: linkingForms,
40687
+ ajaxOptions: ajaxOptions,
40688
+ evaluationConfig: evaluationConfig,
40689
+ cols: 2
40690
+ }, key)]
40691
+ }, key) : null;
40692
+ })
40693
+ }, key);
40694
+ });
40695
+ };
40696
+ React.useEffect(() => {
40697
+ setTimeout(() => {
40698
+ const groups = Array.from(document.getElementsByClassName("group"));
40699
+ const rows = Array.from(document.querySelectorAll(".repetable-row-extra"));
40700
+ rows.forEach(row => {
40701
+ const inputs = Array.from(row.querySelectorAll(".input"));
40702
+ const lasts = getLastRow(inputs.map((i, ind) => ind), 4);
40703
+ if (lasts) {
40704
+ lasts.forEach(index => inputs[index].classList.add("last"));
40705
+ }
40706
+ });
40707
+ groups.forEach(group => {
40708
+ // const isRepeatable = Array.from(group.classList).includes('repeatable');
40709
+ const inputs = Array.from(group.querySelectorAll(".input"));
40710
+ // if (inputs.length && !isRepeatable) {
40711
+ // if (inputs.length % 2 === 0) {
40712
+ // inputs[inputs.length - 1].classList.add('last');
40713
+ // inputs[inputs.length - 2].classList.add('last');
40714
+ // } else {
40715
+ // inputs[inputs.length - 1].classList.add('last');
40716
+ // }
40717
+ // }
40718
+ // remove groups without inputs
40719
+ if (!inputs.length) {
40720
+ group.remove();
40721
+ }
40722
+ });
40723
+ }, 200);
40724
+ }, [form, data]);
40725
+ React.useState({});
40726
+ React.useState({});
40727
+ React.useState({});
40728
+ const renderContent = (f, showTitle = true) => {
40729
+ if (f) {
40730
+ const alertType = ["error", "warning", "info", "success"];
40731
+ if (f.alertConf && f.alertConf.type === "warning") {
40732
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
40733
+ message: f.alertConf.text,
40734
+ type: f.alertConf.type,
40735
+ showIcon: true
40736
+ });
40737
+ }
40738
+ let {
40739
+ label,
40740
+ icon,
40741
+ position,
40742
+ ...groups
40743
+ } = f;
40744
+ groups = Object.keys(groups).reduce((items, key) => {
40745
+ if (!groups[key]?.meta?.excludeFromView) {
40746
+ items[key] = groups[key];
40747
+ }
40748
+ return items;
40749
+ }, {});
40750
+ const addedContent = [];
40751
+ const singleGroupsKeys = [].concat(...Object.keys(groupSingle(groups)).map(key => Object.keys(groupSingle(groups)[key])));
40752
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
40753
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
40754
+ className: "wrapper",
40755
+ style: {
40756
+ width: fullWidth ? "100%" : 700
40757
+ },
40758
+ children: [f.alertConf ? /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
40759
+ className: "w-100",
40760
+ style: {
40761
+ marginBottom: "20px"
40762
+ },
40763
+ message: f.alertConf.text,
40764
+ type: alertType.includes(f.alertConf.type) ? f.alertConf.type : "info",
40765
+ showIcon: true
40766
+ }) : null, typeRender(groups, singleGroupsKeys, addedContent)]
40767
+ }, Date.now())
40768
+ });
40769
+ }
40770
+ };
40771
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
40772
+ className: "content",
40773
+ style: style,
40774
+ children: renderContent(form)
40775
+ });
40776
+ };
40777
+
40778
+ function Modal({
40779
+ t = text => text,
40780
+ open,
40781
+ title,
40782
+ children,
40783
+ onClose,
40784
+ onSuccess,
40785
+ cancelBtnText = "Cancel",
40786
+ saveBtnText = "Save",
40787
+ className,
40788
+ loading = false,
40789
+ disabled = false,
40790
+ withModalFormWrapper = true,
40791
+ ...props
40792
+ }) {
40793
+ return /*#__PURE__*/jsxRuntime.jsxs(antd.Modal, {
40794
+ width: 650,
40795
+ footer: null,
40796
+ open: open,
40797
+ onCancel: onClose,
40798
+ title: /*#__PURE__*/jsxRuntime.jsx(ModalHeader, {
40799
+ title: t(title)
40800
+ }),
40801
+ className: `${className}`,
40802
+ ...props,
40803
+ children: [withModalFormWrapper ? /*#__PURE__*/jsxRuntime.jsx("div", {
40804
+ className: "repeatable-modal-form",
40805
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40806
+ className: "daf-dynamic-form-form",
40807
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40808
+ className: "form",
40809
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
40810
+ className: "daf-dynamic-form dynamic-form",
40811
+ children: children
40812
+ })
40813
+ })
40814
+ })
40815
+ }) : children, onSuccess && onClose ? /*#__PURE__*/jsxRuntime.jsxs("div", {
40816
+ className: "daf-form-bottom",
40817
+ children: [onClose && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
40818
+ onClick: onClose,
40819
+ children: t(cancelBtnText)
40820
+ }), onSuccess && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
40821
+ type: "primary",
40822
+ onClick: onSuccess,
40823
+ disabled: loading || disabled,
40824
+ children: t(saveBtnText)
40825
+ })]
40826
+ }) : null]
40827
+ });
40828
+ }
40829
+
39903
40830
  class SourceService extends BaseService {
39904
40831
  get(tab, filters) {
39905
40832
  const {
@@ -39937,7 +40864,7 @@ class SourceService extends BaseService {
39937
40864
  });
39938
40865
  }
39939
40866
  }
39940
- createLazyService(SourceService);
40867
+ var SourceService$1 = createLazyService(SourceService);
39941
40868
 
39942
40869
  class VersionService extends BaseService {
39943
40870
  getSources({
@@ -39951,7 +40878,344 @@ class VersionService extends BaseService {
39951
40878
  });
39952
40879
  }
39953
40880
  }
39954
- createLazyService(VersionService);
40881
+ var VersionService$1 = createLazyService(VersionService);
40882
+
40883
+ const getSourcesType = subject => {
40884
+ const typeMapping = {
40885
+ locations: "location",
40886
+ location: "location",
40887
+ "production-sites": "location",
40888
+ stakeholders: "stakeholder",
40889
+ stakeholder: "stakeholder",
40890
+ workers: "stakeholder",
40891
+ operators: "stakeholder",
40892
+ documents: "document",
40893
+ document: "document",
40894
+ events: "event",
40895
+ event: "event",
40896
+ activities: "event",
40897
+ incidents: "event"
40898
+ };
40899
+ return typeMapping[subject] ?? null;
40900
+ };
40901
+
40902
+ const Records = ({
40903
+ onSubmit,
40904
+ modalTitle = "Records",
40905
+ t = () => {},
40906
+ onClose = () => {},
40907
+ open = false,
40908
+ subject = "",
40909
+ id = ""
40910
+ }) => {
40911
+ const [form] = antd.Form.useForm();
40912
+ const [sources, setSources] = React.useState([]);
40913
+ const [versions, setVersions] = React.useState([]);
40914
+ const [selectedSource, setSelectedSource] = React.useState(null);
40915
+ const handleCancel = () => {
40916
+ onClose();
40917
+ form.resetFields();
40918
+ };
40919
+ const type = React.useMemo(() => getSourcesType(subject), [subject]);
40920
+ const getSources = async () => {
40921
+ try {
40922
+ const {
40923
+ data
40924
+ } = await SourceService$1.getSources({
40925
+ type,
40926
+ id
40927
+ });
40928
+ setSources(data);
40929
+ } catch (error) {
40930
+ console.error('Error fetching sources:', error);
40931
+ }
40932
+ };
40933
+ const getVersions = async () => {
40934
+ try {
40935
+ const {
40936
+ data
40937
+ } = await VersionService$1.getSources({
40938
+ type,
40939
+ id,
40940
+ params: {
40941
+ source: selectedSource
40942
+ }
40943
+ });
40944
+ console.log({
40945
+ data
40946
+ });
40947
+ setVersions(data);
40948
+ } catch (error) {
40949
+ console.error('Error fetching versions:', error);
40950
+ }
40951
+ };
40952
+ const sourceOptions = React.useMemo(() => {
40953
+ return sources.map(source => ({
40954
+ label: source?.name,
40955
+ value: source?.id
40956
+ }));
40957
+ }, [sources]);
40958
+ React.useEffect(() => {
40959
+ if (type && id) {
40960
+ getSources();
40961
+ }
40962
+ }, [type, id]);
40963
+ React.useEffect(() => {
40964
+ if (selectedSource) {
40965
+ getVersions();
40966
+ }
40967
+ }, [selectedSource]);
40968
+ const versionOptions = React.useMemo(() => {
40969
+ if (!versions?.numberOfVersions) return [];
40970
+ return Array.from({
40971
+ length: versions.numberOfVersions
40972
+ }, (_, index) => ({
40973
+ label: `Version ${index + 1}`,
40974
+ value: index + 1
40975
+ }));
40976
+ }, [versions]);
40977
+ const handleOk = async () => {
40978
+ try {
40979
+ const values = await form.validateFields();
40980
+ if (onSubmit) {
40981
+ onSubmit(values);
40982
+ }
40983
+ onClose();
40984
+ form.resetFields();
40985
+ } catch (error) {
40986
+ console.error('Validation failed:', error);
40987
+ }
40988
+ };
40989
+ return /*#__PURE__*/jsxRuntime.jsxs(Modal, {
40990
+ open: open,
40991
+ t: t,
40992
+ title: t(modalTitle),
40993
+ onSuccess: handleOk,
40994
+ onClose: handleCancel,
40995
+ withModalFormWrapper: false,
40996
+ children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Form, {
40997
+ form: form,
40998
+ layout: "vertical",
40999
+ name: "recordsForm",
41000
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
41001
+ name: "source",
41002
+ label: t("Source"),
41003
+ rules: [{
41004
+ required: true,
41005
+ message: t('Please select an option')
41006
+ }],
41007
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
41008
+ placeholder: t("Select"),
41009
+ showSearch: true,
41010
+ optionFilterProp: "children",
41011
+ onChange: value => {
41012
+ console.log('Selected source ID:', value);
41013
+ setSelectedSource(value);
41014
+ },
41015
+ children: sourceOptions.map(option => /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
41016
+ value: option.value,
41017
+ children: option.label
41018
+ }, option.value))
41019
+ })
41020
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
41021
+ name: "version",
41022
+ label: t("Version"),
41023
+ rules: [{
41024
+ required: true,
41025
+ message: t('Please select an option')
41026
+ }],
41027
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
41028
+ placeholder: t("Select"),
41029
+ showSearch: true,
41030
+ optionFilterProp: "children",
41031
+ children: versionOptions.map(option => /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
41032
+ value: option.value,
41033
+ children: option.label
41034
+ }, option.value))
41035
+ })
41036
+ })]
41037
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
41038
+ style: {
41039
+ height: 60
41040
+ }
41041
+ })]
41042
+ });
41043
+ };
41044
+
41045
+ const Navigation = ({
41046
+ form = {},
41047
+ data = {},
41048
+ group = null,
41049
+ subsection = null,
41050
+ search = null,
41051
+ onGroupChange = () => {},
41052
+ mod,
41053
+ // TODO: ADD this
41054
+ goTo,
41055
+ params,
41056
+ generatePath,
41057
+ getRedirectLink
41058
+ }) => {
41059
+ const [selectedGroup, setSelectedGroup] = React.useState(null);
41060
+ const [formGroups, setFormGroups] = React.useState([]);
41061
+ const [openKeys, setOpenKeys] = React.useState([]);
41062
+ const hasSubSections = f => Object.keys(f).map(key => propHasValue$1(f[key].subSection)).includes(true);
41063
+ const mapFormGroup = f => Object.keys(f).map(key => {
41064
+ const {
41065
+ label,
41066
+ showFormIf,
41067
+ position
41068
+ } = f[key];
41069
+ const disabled = getDisabled({
41070
+ disabled: f[key]?.title?.meta?.disabled || false,
41071
+ groupCheckboxDisableKey: f[key]?.title?.meta?.groupCheckboxDisableKey,
41072
+ data
41073
+ });
41074
+ const fConf = {
41075
+ key,
41076
+ label,
41077
+ showFormIf,
41078
+ show: filterForm(f[key], data),
41079
+ items: [],
41080
+ disabled: disabled || false,
41081
+ position
41082
+ };
41083
+ if (hasSubSections(f[key])) {
41084
+ fConf.items = {};
41085
+ const items = groupSubsections(f[key], true);
41086
+ Object.keys(items).forEach(i => {
41087
+ items[i].show = filterForm(items[i], data);
41088
+ fConf.items[i] = items[i];
41089
+ });
41090
+ }
41091
+ return fConf;
41092
+ });
41093
+ React.useEffect(() => {
41094
+ const formG = mapFormGroup(form).sort((a, b) => (a.position || 0) - (b.position || 0));
41095
+ const keys = [];
41096
+ formG.forEach(f => {
41097
+ if (!keys.includes(f.key)) {
41098
+ keys.push(f.key);
41099
+ }
41100
+ if (f.items) {
41101
+ Object.keys(f.items).forEach(item => {
41102
+ if (!keys.includes(`${f.key}/${item}`)) {
41103
+ keys.push(`${f.key}/${item}`);
41104
+ }
41105
+ });
41106
+ }
41107
+ });
41108
+ let sGroup = group;
41109
+ if (!group && formG.length) {
41110
+ sGroup = formG[0].key;
41111
+ }
41112
+ if (subsection && keys.includes(`${sGroup}/${subsection}`)) {
41113
+ sGroup = `${sGroup}/${subsection}`;
41114
+ }
41115
+ if (sGroup === selectedGroup) {
41116
+ groupChanged();
41117
+ }
41118
+ setFormGroups(formG);
41119
+ if (!keys.includes(sGroup)) {
41120
+ sGroup = keys[0];
41121
+ }
41122
+ setSelectedGroup(sGroup);
41123
+ }, [form, group, subsection]);
41124
+ React.useEffect(() => {
41125
+ groupChanged();
41126
+ }, [selectedGroup]);
41127
+
41128
+ // useEffect(() => {
41129
+ // if (!selectedGroup && !formGroups.map(f => f.key).includes(selectedGroup)) {
41130
+ // setSelectedGroup(formGroups.map(f => f.key)[0]);
41131
+ // }
41132
+ // }, [formGroups])
41133
+
41134
+ const groupChanged = () => {
41135
+ if (selectedGroup) {
41136
+ onGroupChange(selectedGroup);
41137
+ if (selectedGroup !== group) {
41138
+ // const path = formPaths.view(mod, getRedirectLink);
41139
+ const [section, subSection, subgroup] = selectedGroup.split('/');
41140
+ let url;
41141
+ if (params.formId) {
41142
+ // Dynamic context (within a project : monitoring, restoration, engagement, etc.)
41143
+ url = `/app/${params.namespace}/${params.id}/${params.subsection}/view/general/${params.formId}/${section}`;
41144
+ } else {
41145
+ // Default: organisation context
41146
+ const path = formPaths.view(mod, getRedirectLink);
41147
+ url = `${generatePath(path, {
41148
+ ...params,
41149
+ group: section,
41150
+ subsection: subSection,
41151
+ subgroup: subgroup || undefined
41152
+ })}${search || ''}`;
41153
+ }
41154
+ goTo(url);
41155
+ }
41156
+ }
41157
+ setTimeout(() => {
41158
+ const groups = Array.from(document.getElementsByClassName('group'));
41159
+ const rows = Array.from(document.querySelectorAll('.repetable-row-extra'));
41160
+ rows.forEach(row => {
41161
+ const inputs = Array.from(row.querySelectorAll('.input'));
41162
+ const lasts = getLastRow(inputs.map((i, ind) => ind), 4);
41163
+ if (lasts) {
41164
+ lasts.forEach(index => inputs[index].classList.add('last'));
41165
+ }
41166
+ });
41167
+ groups.forEach(group => {
41168
+ // const isRepeatable = Array.from(group.classList).includes('repeatable');
41169
+ const inputs = Array.from(group.querySelectorAll('.input'));
41170
+ // if (inputs.length && !isRepeatable) {
41171
+ // if (inputs.length % 2 === 0) {
41172
+ // inputs[inputs.length - 1].classList.add('last');
41173
+ // inputs[inputs.length - 2].classList.add('last');
41174
+ // } else {
41175
+ // inputs[inputs.length - 1].classList.add('last');
41176
+ // }
41177
+ // }
41178
+ // remove groups without inputs
41179
+ if (!inputs.length) {
41180
+ group.remove();
41181
+ }
41182
+ });
41183
+ }, 200);
41184
+ };
41185
+ return selectedGroup ? /*#__PURE__*/jsxRuntime.jsx(antd.Menu, {
41186
+ mode: "inline",
41187
+ defaultSelectedKeys: [selectedGroup],
41188
+ selectedKeys: [selectedGroup],
41189
+ defaultOpenKeys: selectedGroup ? [selectedGroup.split('/')[0]] : [],
41190
+ openKeys: openKeys,
41191
+ onOpenChange: oKeys => {
41192
+ setOpenKeys(oKeys);
41193
+ },
41194
+ style: {
41195
+ overflowY: 'auto',
41196
+ overflowX: 'hidden'
41197
+ },
41198
+ onSelect: g => {
41199
+ setSelectedGroup(g.key);
41200
+ },
41201
+ children: formGroups.filter(key => key.show).map(key => key.items && typeof key.items === 'object' && Object.keys(key.items).length > 0 ? /*#__PURE__*/jsxRuntime.jsx(antd.Menu.SubMenu, {
41202
+ title: getInputLabel$2(key, data),
41203
+ children: Object.keys(key.items).filter(item => key.items[item].show).map(item => /*#__PURE__*/jsxRuntime.jsx(antd.Menu.Item, {
41204
+ level: 2,
41205
+ children: getInputLabel$2(key.items[item], data)
41206
+ }, `${key.key}/${item}`))
41207
+ }, key.key) : /*#__PURE__*/jsxRuntime.jsx(antd.Menu.Item, {
41208
+ disabled: key.disabled,
41209
+ onClick: props => {
41210
+ if (params.subgroup && params.group === props.key) {
41211
+ const path = formPaths.view(mod, getRedirectLink);
41212
+ goTo(`${generatePath(path, params)}${search || ''}`);
41213
+ }
41214
+ },
41215
+ children: getInputLabel$2(key, data)
41216
+ }, key.key))
41217
+ }) : null;
41218
+ };
39955
41219
 
39956
41220
  styled__default["default"](antd.Select)`
39957
41221
  width: 100%;
@@ -44564,7 +45828,7 @@ const CommunityParticipation = ({
44564
45828
  const ACTIVITIES_TAB$1 = 'activities';
44565
45829
  const PARTNERS_TAB$1 = 'partners';
44566
45830
  const INCIDENTS_TAB$1 = 'incidents';
44567
- const getColumns = ({
45831
+ const getColumns$1 = ({
44568
45832
  projectId,
44569
45833
  t,
44570
45834
  show = 'show',
@@ -45245,7 +46509,7 @@ const AssociatedInformation = ({
45245
46509
  const handleTabChange = React.useCallback(value => {
45246
46510
  setActiveTab(value);
45247
46511
  }, []);
45248
- const columns = React.useMemo(() => getColumns({
46512
+ const columns = React.useMemo(() => getColumns$1({
45249
46513
  t,
45250
46514
  activeTab,
45251
46515
  view: activeTab,
@@ -45828,13 +47092,12 @@ const MineSummary = ({
45828
47092
  });
45829
47093
  return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
45830
47094
  header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
45831
- title: hasSelect ? t("Mine Review") : (singleItemData?.name || "") + " " + t("Summary"),
47095
+ title: hasSelect ? t("Mine Review") : `${singleItemData?.name || ""} ${singleItemData?.name ? t("Summary") : ""}`,
45832
47096
  className: "with-border-header h-w-btn-header no-px-body",
45833
47097
  goBackTo: !hasSelect && goBack,
45834
- loading: loading,
45835
47098
  breadcrumbs: breadcrumbs,
45836
47099
  addedHeaderFirst: true,
45837
- actionButtons: [{
47100
+ actionButtons: hasSelect ? [] : [{
45838
47101
  tooltip: t("Details"),
45839
47102
  icon: "FileEdit",
45840
47103
  onClick: () => {
@@ -45848,9 +47111,6 @@ const MineSummary = ({
45848
47111
  }],
45849
47112
  addedHeader: /*#__PURE__*/jsxRuntime.jsx("div", {
45850
47113
  className: "flex flex-row gap-4",
45851
- style: {
45852
- marginRight: 8
45853
- },
45854
47114
  children: /*#__PURE__*/jsxRuntime.jsx(Multiselect, {
45855
47115
  options: [...sourceOptions],
45856
47116
  isAvatarGroup: true,
@@ -45866,7 +47126,10 @@ const MineSummary = ({
45866
47126
  dropDownWidth: 200,
45867
47127
  defaultSelected: (partners || []).map(p => p.id) || []
45868
47128
  }, partners?.length)
45869
- })
47129
+ }),
47130
+ onDownload: () => {
47131
+ console.log("onDownload");
47132
+ }
45870
47133
  }),
45871
47134
  children: [hasSelect && /*#__PURE__*/jsxRuntime.jsx("section", {
45872
47135
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
@@ -45915,6 +47178,1092 @@ const MineSummary = ({
45915
47178
  });
45916
47179
  };
45917
47180
 
47181
+ const useViewUrlParams = ({
47182
+ params,
47183
+ push,
47184
+ pathname,
47185
+ search,
47186
+ searchParams,
47187
+ setSearchParams
47188
+ }) => {
47189
+ const [namespace, setNamespace] = React.useState(params?.namespace);
47190
+ const [id, setId] = React.useState(params?.id);
47191
+ const [group, setGroup] = React.useState(params?.group);
47192
+ const [subsection, setSubSection] = React.useState(params?.subsection);
47193
+ const sourceUrl = searchParams.get("source");
47194
+ const versionUrl = searchParams.get("version");
47195
+ const [source, setSource] = React.useState(sourceUrl || null);
47196
+ const [version, setVersion] = React.useState(versionUrl || null);
47197
+ React.useEffect(() => {
47198
+ if (id && params.id !== id || namespace && namespace !== params.namespace) {
47199
+ setGroup(undefined);
47200
+ setSubSection(undefined);
47201
+ // setSubGroup(undefined);
47202
+ } else {
47203
+ setGroup(params.group);
47204
+ setSubSection(params.subsection);
47205
+ // setSubGroup(params.subgroup);
47206
+ }
47207
+ setNamespace(params.namespace);
47208
+ setId(params.id);
47209
+ }, [params]);
47210
+ React.useEffect(() => {
47211
+ if (source && version) {
47212
+ const newParams = new URLSearchParams(searchParams);
47213
+ newParams.set("source", source);
47214
+ newParams.set("version", version);
47215
+ setSearchParams(newParams);
47216
+ }
47217
+ }, [source, version]);
47218
+ const goBackFromSource = React.useCallback(() => {
47219
+ const params = new URLSearchParams(searchParams);
47220
+ params.delete("source");
47221
+ params.delete("version");
47222
+ setSearchParams(params);
47223
+ setVersion(null);
47224
+ setSource(null);
47225
+ }, [searchParams, setSearchParams]);
47226
+ const getEditLink = React.useCallback(srcId => {
47227
+ const r = new RegExp(`\/view\/`);
47228
+ const [previous, extra] = pathname.split(r);
47229
+ if (srcId) {
47230
+ push(`${previous}/edit/${extra}?sourceId=${srcId}`);
47231
+ return;
47232
+ }
47233
+ if (search) {
47234
+ push(`${previous}/edit/${extra}${search}`);
47235
+ } else {
47236
+ push(`${previous}/edit/${extra}`);
47237
+ }
47238
+ }, [pathname, search, push]);
47239
+ const match = React.useMemo(() => ({
47240
+ params,
47241
+ path: pathname
47242
+ }), [params, pathname]);
47243
+ return {
47244
+ namespace,
47245
+ id,
47246
+ group,
47247
+ subsection,
47248
+ params,
47249
+ source,
47250
+ setSource,
47251
+ sourceUrl,
47252
+ version,
47253
+ setVersion,
47254
+ versionUrl,
47255
+ goBackFromSource,
47256
+ getEditLink,
47257
+ match,
47258
+ search
47259
+ };
47260
+ };
47261
+
47262
+ const usePrepareForm = ({
47263
+ namespaceConfig,
47264
+ allData,
47265
+ id,
47266
+ namespace,
47267
+ t,
47268
+ mode,
47269
+ APP,
47270
+ viewConfig
47271
+ }) => {
47272
+ const [form, setForm] = React.useState({});
47273
+ const [data, setData] = React.useState({});
47274
+ const [groups, setGroups] = React.useState({});
47275
+ const [linkingForms, setLinkingForms] = React.useState({});
47276
+ const [loading, setLoading] = React.useState(true);
47277
+ const [notFound, setNotFound] = React.useState(false);
47278
+ const prepareForm = currentView => {
47279
+ const dKey = namespaceConfig?.dataKey;
47280
+ const nKey = `${APP}-${currentView}`;
47281
+ if (hasKeyInObject(allData, dKey) && hasKeyInObject(allData[dKey], nKey)) {
47282
+ const {
47283
+ form = {},
47284
+ data = {},
47285
+ config = {},
47286
+ linkingForms = {}
47287
+ } = JSON.parse(JSON.stringify(allData[dKey][nKey] || {}));
47288
+ if (data.datastakeId === id || id === "user") {
47289
+ // if (viewConfig.linkingSubjects.includes(namespace)) {
47290
+ setForm({
47291
+ ...form,
47292
+ linking: {
47293
+ position: 100,
47294
+ excludeFromEdit: true,
47295
+ label: t("Linked Subjects"),
47296
+ template: "linkingSubjects"
47297
+ }
47298
+ });
47299
+ // } else {
47300
+ // setForm(form);
47301
+ // }
47302
+ setData(data);
47303
+ setGroups(config.groups || {});
47304
+ setLinkingForms(linkingForms);
47305
+ setLoading(false);
47306
+ setNotFound(false);
47307
+ } else if (!data.id) {
47308
+ if (mode === "proxy") {
47309
+ window.location.reload();
47310
+ } else {
47311
+ setLoading(false);
47312
+ setNotFound(true);
47313
+ }
47314
+ }
47315
+ }
47316
+ };
47317
+ const getCertainData = allData?.[namespaceConfig?.dataKey];
47318
+ React.useEffect(() => {
47319
+ if (namespace && namespaceConfig) {
47320
+ prepareForm(namespaceConfig?.view);
47321
+ }
47322
+ }, [getCertainData, namespaceConfig]);
47323
+ return {
47324
+ form,
47325
+ setForm,
47326
+ data,
47327
+ setData,
47328
+ groups,
47329
+ setGroups,
47330
+ linkingForms,
47331
+ setLinkingForms,
47332
+ loading,
47333
+ setLoading,
47334
+ notFound,
47335
+ setNotFound,
47336
+ prepareForm
47337
+ };
47338
+ };
47339
+
47340
+ const useViewPermissions = ({
47341
+ data,
47342
+ id,
47343
+ namespaceOverrides = {
47344
+ supportedNamespaces: {},
47345
+ canEdit: {}
47346
+ },
47347
+ namespace,
47348
+ user,
47349
+ push,
47350
+ getRedirectLink,
47351
+ namespaceConfig,
47352
+ APP,
47353
+ viewConfig
47354
+ }) => {
47355
+ const baseNamespaceKeys = Object.keys(namespaceConfig || {});
47356
+ const baseSupportedNamespaces = baseNamespaceKeys?.reduce((acc, key) => {
47357
+ acc[key] = () => true;
47358
+ return acc;
47359
+ }, {});
47360
+ const isSupportedNamespaces = React.useMemo(() => ({
47361
+ ...baseSupportedNamespaces,
47362
+ ...namespaceOverrides?.supportedNamespaces
47363
+ }), [data, id]);
47364
+ const isSupported = typeof isSupportedNamespaces[namespace] === "function" ? isSupportedNamespaces[namespace]() && viewConfig?.supportedNamespaces[APP] && viewConfig?.supportedNamespaces[APP]?.includes(namespace) : viewConfig?.supportedNamespaces[APP] && viewConfig?.supportedNamespaces[APP].includes(namespace);
47365
+ const isUserData = () => {
47366
+ return data && data.authorId && user?.company?.id === data.authorId;
47367
+ };
47368
+ const canEdit = React.useMemo(() => {
47369
+ const baseCanEditAction = baseNamespaceKeys.reduce((acc, key) => {
47370
+ acc[key] = () => isUserData();
47371
+ return acc;
47372
+ }, {});
47373
+ const canEditAction = {
47374
+ ...baseCanEditAction,
47375
+ ...namespaceOverrides.canEdit
47376
+ };
47377
+ return canEditAction[namespace] ? canEditAction[namespace]() : false;
47378
+ }, [namespace, data, user]);
47379
+ React.useEffect(() => {
47380
+ if (data) {
47381
+ if (typeof isSupportedNamespaces[namespace] === "function") {
47382
+ if (!isSupportedNamespaces[namespace]()) {
47383
+ push(getRedirectLink(`/app`));
47384
+ }
47385
+ }
47386
+ }
47387
+ }, [data, namespace]);
47388
+ return {
47389
+ isSupportedNamespaces,
47390
+ canEdit,
47391
+ isSupported
47392
+ };
47393
+ };
47394
+
47395
+ const submitSubjectData = async (namespace, data, serviceMap) => {
47396
+ const service = serviceMap[namespace];
47397
+ if (!service) {
47398
+ throw new Error(`No service found for namespace: ${namespace}`);
47399
+ }
47400
+ const response = await service.submitStep(data, data.datastakeId || data.id);
47401
+ return response.data;
47402
+ };
47403
+ const useSubmitSubject = ({
47404
+ namespace,
47405
+ data,
47406
+ serviceMap
47407
+ }) => {
47408
+ const [isDisabled, setIsDisabled] = React.useState(false);
47409
+ const [loading, setLoading] = React.useState(false);
47410
+ const [isPublished, setIsPublished] = React.useState(false);
47411
+ const submitSubject = React.useCallback(async () => {
47412
+ try {
47413
+ setLoading(true);
47414
+ const response = await submitSubjectData(namespace, data, serviceMap);
47415
+ setIsDisabled(response.published);
47416
+ setIsPublished(response.published);
47417
+ } catch (error) {
47418
+ console.error("Submit error:", error);
47419
+ } finally {
47420
+ setLoading(false);
47421
+ }
47422
+ }, [namespace, data]);
47423
+ return {
47424
+ submitSubject,
47425
+ isDisabled,
47426
+ submitLoading: loading,
47427
+ isPublished
47428
+ };
47429
+ };
47430
+
47431
+ const useCallToGetData = ({
47432
+ namespaceConfig,
47433
+ namespace,
47434
+ allData,
47435
+ id,
47436
+ isSupported,
47437
+ namespaceGet,
47438
+ source,
47439
+ version,
47440
+ user,
47441
+ setLoading,
47442
+ APP
47443
+ }) => {
47444
+ const isFirstRender = React.useRef(true);
47445
+ const callToGetData = (_doCall = false) => {
47446
+ const dKey = namespaceConfig?.dataKey;
47447
+ const nKey = `${APP}-${getNkey(namespace || "")}`;
47448
+ const doCall = _doCall ? true : hasKeyInObject(allData, dKey) && hasKeyInObject(allData[dKey], nKey) ? allData[dKey][nKey]?.data?.datastakeId !== id : true;
47449
+ if (doCall) {
47450
+ if (isSupported) {
47451
+ namespaceGet[namespace]();
47452
+ }
47453
+ }
47454
+ };
47455
+ React.useEffect(() => {
47456
+ if (isFirstRender.current) {
47457
+ isFirstRender.current = false;
47458
+ return;
47459
+ }
47460
+ callToGetData(true);
47461
+ }, [source, version]);
47462
+ React.useEffect(() => {
47463
+ callToGetData(true);
47464
+ }, [id, namespace, user.language]);
47465
+ const onStorageUpdate = e => {
47466
+ const {
47467
+ key,
47468
+ newValue
47469
+ } = e;
47470
+ if (key === `${id}-loading` && newValue) {
47471
+ setLoading(newValue);
47472
+ }
47473
+ if (key === `${id}-updated` && newValue) {
47474
+ setLoading(true);
47475
+ callToGetData();
47476
+ }
47477
+ };
47478
+ React.useEffect(() => {
47479
+ window.addEventListener("storage", onStorageUpdate);
47480
+ return () => {
47481
+ window.removeEventListener("storage", onStorageUpdate);
47482
+ };
47483
+ }, []);
47484
+
47485
+ // useEffect(() => {
47486
+ // setLoading(true);
47487
+ // }, [namespace]);
47488
+
47489
+ return {
47490
+ callToGetData
47491
+ };
47492
+ };
47493
+
47494
+ const useViewActions = ({
47495
+ namespace,
47496
+ data,
47497
+ isSupported,
47498
+ canEdit,
47499
+ versionUrl,
47500
+ sourceUrl,
47501
+ getEditLink,
47502
+ submitSubject,
47503
+ isDisabled,
47504
+ setOpenRecordsModal,
47505
+ goBackFromSource,
47506
+ push,
47507
+ getRedirectLink,
47508
+ t,
47509
+ viewConfig,
47510
+ buttonActions
47511
+ }) => {
47512
+ const [pageActions, setPageActions] = React.useState([]);
47513
+ const [extraPageActions, setExtraPageActions] = React.useState([]);
47514
+ React.useEffect(() => {
47515
+ const actions = [];
47516
+ const extraActions = [];
47517
+ if (!isSupported) {
47518
+ setPageActions([]);
47519
+ setExtraPageActions([]);
47520
+ return;
47521
+ }
47522
+ if (canEdit) {
47523
+ if (viewConfig.namespacesWithoutActionButtons.includes(namespace)) {
47524
+ if (viewConfig.editOnlyButton.includes(namespace)) {
47525
+ if (versionUrl && sourceUrl) {
47526
+ actions.push(buttonActions.createBackButton(t, goBackFromSource));
47527
+ } else {
47528
+ actions.push(buttonActions.createEditButton(t, getEditLink));
47529
+ }
47530
+ }
47531
+ } else {
47532
+ if (versionUrl && sourceUrl) {
47533
+ actions.push(buttonActions.createBackButton(t, goBackFromSource));
47534
+ } else {
47535
+ actions.push(buttonActions.createSubmitButton(t, submitSubject, isDisabled, data));
47536
+ actions.push(buttonActions.createEditButton(t, getEditLink));
47537
+ // actions.push(createRecordsButton(t, setOpenRecordsModal));
47538
+ }
47539
+ }
47540
+ }
47541
+ if (viewConfig.summaryNamespaces.includes(namespace)) {
47542
+ extraActions.push(buttonActions.createSummaryButton(t, namespace, data, push, getRedirectLink));
47543
+ extraActions.push(buttonActions.createRecordsButton(t, setOpenRecordsModal));
47544
+ }
47545
+ setPageActions(actions);
47546
+ setExtraPageActions(extraActions);
47547
+ }, [namespace, data, isSupported, canEdit, versionUrl, sourceUrl, isDisabled, t, getEditLink, submitSubject, goBackFromSource, setOpenRecordsModal, push, getRedirectLink]);
47548
+ return {
47549
+ pageActions,
47550
+ extraPageActions
47551
+ };
47552
+ };
47553
+
47554
+ const decapitalize = string => string && string.charAt(0).toLowerCase() + string.slice(1);
47555
+ const formatRedirectString = stringItem => {
47556
+ let string;
47557
+ if (stringItem.includes("nashiriki")) {
47558
+ string = decapitalize(stringItem?.replaceAll("nashiriki", ""));
47559
+ } else {
47560
+ string = stringItem;
47561
+ }
47562
+ return string;
47563
+ };
47564
+ const redirect = ({
47565
+ id,
47566
+ item
47567
+ }) => {
47568
+ const viewMode = "view";
47569
+ let type = "testimonials";
47570
+ if (item.category === "mineSite") {
47571
+ type = "scl";
47572
+ }
47573
+ if (item.stakeholderType === "operator") {
47574
+ type = "operators";
47575
+ }
47576
+ if (item.stakeholderType === "worker") {
47577
+ type = "workers";
47578
+ }
47579
+ if (item.form) {
47580
+ type = `${formatRedirectString(item.form)}s`;
47581
+ }
47582
+ let url = `/${viewMode}/${type}/${id}`;
47583
+ return `/app${url}`;
47584
+ };
47585
+ const renderType = ({
47586
+ item = {},
47587
+ t = s => s
47588
+ }) => {
47589
+ if (item.empty) {
47590
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
47591
+ className: "daf-default-cell"
47592
+ });
47593
+ }
47594
+ if (item.category === "mineSite") {
47595
+ return t("Mine Site");
47596
+ }
47597
+ if (item.stakeholderType === "operator") {
47598
+ return t("Operator");
47599
+ }
47600
+ if (item.stakeholderType === "worker") {
47601
+ return t("Worker");
47602
+ }
47603
+ if (item.form) {
47604
+ return t(capitalizeAll(item.form));
47605
+ }
47606
+ return "--";
47607
+ };
47608
+ const namespaceMap = {
47609
+ locations: "location",
47610
+ documents: "document",
47611
+ stakeholders: "stakeholder",
47612
+ events: "event",
47613
+ incidents: "event",
47614
+ correctiveActions: "event",
47615
+ "production-sites": "location",
47616
+ operators: "stakeholder",
47617
+ workers: "stakeholder",
47618
+ activities: "event"
47619
+ };
47620
+
47621
+ const getColumns = ({
47622
+ t,
47623
+ redirect = () => "",
47624
+ mod,
47625
+ mode = "app",
47626
+ options
47627
+ }) => [{
47628
+ title: "ID",
47629
+ dataIndex: "datastakeId",
47630
+ key: "datastakeId"
47631
+ }, {
47632
+ title: t("Type"),
47633
+ dataIndex: "type",
47634
+ key: "type",
47635
+ render: (type, all) => renderType({
47636
+ item: all,
47637
+ t,
47638
+ type
47639
+ })
47640
+ }, {
47641
+ title: t("Name"),
47642
+ dataIndex: "name",
47643
+ key: "name",
47644
+ render: (name, all) => {
47645
+ if (all.empty) {
47646
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
47647
+ className: "daf-default-cell"
47648
+ });
47649
+ }
47650
+ if (all?.form === "products") {
47651
+ const {
47652
+ minerals
47653
+ } = options;
47654
+ const mineral = minerals.find(mineral => mineral.value === all?.typeOfProduct)?.label;
47655
+ return mineral || "--";
47656
+ }
47657
+ return name || "--";
47658
+ }
47659
+ }, {
47660
+ title: t("Last Update"),
47661
+ dataIndex: "updatedAt",
47662
+ key: "updateAt",
47663
+ render: (updatedAt, all) => {
47664
+ if (all.empty) {
47665
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
47666
+ className: "daf-default-cell"
47667
+ });
47668
+ }
47669
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
47670
+ className: "daf-default-cell",
47671
+ children: renderDateFormatted(updatedAt, "DD MMM YYYY")
47672
+ });
47673
+ }
47674
+ }, {
47675
+ title: "",
47676
+ dataIndex: "actions",
47677
+ width: 50,
47678
+ key: "actions",
47679
+ render: (_, all) => {
47680
+ if (all.empty) {
47681
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
47682
+ className: "daf-default-cell"
47683
+ });
47684
+ }
47685
+ return mode === "proxy" ? /*#__PURE__*/jsxRuntime.jsx("a", {
47686
+ onClick: () => redirect({
47687
+ id: all.datastakeId,
47688
+ type: all.type,
47689
+ mod,
47690
+ mode,
47691
+ item: all
47692
+ }),
47693
+ href: "#",
47694
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
47695
+ name: "LinkNewTab",
47696
+ width: 14,
47697
+ height: 14,
47698
+ color: "#6C737F"
47699
+ })
47700
+ }) : /*#__PURE__*/jsxRuntime.jsx("a", {
47701
+ href: redirect({
47702
+ id: all.datastakeId,
47703
+ type: all.type,
47704
+ mod,
47705
+ mode,
47706
+ item: all
47707
+ }),
47708
+ target: "_blank",
47709
+ rel: "noreferrer",
47710
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
47711
+ name: "LinkNewTab",
47712
+ width: 14,
47713
+ height: 14,
47714
+ color: "#6C737F"
47715
+ })
47716
+ });
47717
+ }
47718
+ }];
47719
+
47720
+ const getNamespace = namespace => {
47721
+ let _namespace = namespace;
47722
+ switch (namespace) {
47723
+ case "locations":
47724
+ _namespace = "location";
47725
+ break;
47726
+ case "stakeholders":
47727
+ _namespace = "stakeholder";
47728
+ break;
47729
+ case "documents":
47730
+ _namespace = "document";
47731
+ break;
47732
+ case "nashirikiEvent":
47733
+ case "events":
47734
+ _namespace = "event";
47735
+ break;
47736
+ }
47737
+ return _namespace;
47738
+ };
47739
+ class LinkedSubjectsService extends BaseService {
47740
+ getForm({
47741
+ namespace
47742
+ }, language = "en", scope) {
47743
+ return this.apiGet({
47744
+ url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
47745
+ isApp: true,
47746
+ params: {
47747
+ scope: scope || "create",
47748
+ language
47749
+ }
47750
+ });
47751
+ }
47752
+ getWithModule({
47753
+ query,
47754
+ signal,
47755
+ namespace
47756
+ }) {
47757
+ const _namespace = getNamespace(namespace);
47758
+ return this.apiGet({
47759
+ url: `/${_namespace}`,
47760
+ isApp: true,
47761
+ params: query,
47762
+ signal
47763
+ });
47764
+ }
47765
+ getOne({
47766
+ id,
47767
+ signal,
47768
+ namespace,
47769
+ sourceId,
47770
+ source,
47771
+ version
47772
+ }) {
47773
+ return this.apiGet({
47774
+ url: `/${namespace === "nashirikiEvent" ? "event" : namespace}/${id}`,
47775
+ isApp: true,
47776
+ signal,
47777
+ params: {
47778
+ authorId: sourceId,
47779
+ source,
47780
+ version
47781
+ }
47782
+ });
47783
+ }
47784
+ getData(query, namespace) {
47785
+ return this.apiGet({
47786
+ url: `/${namespace}/data`,
47787
+ isApp: true,
47788
+ params: query
47789
+ });
47790
+ }
47791
+ save(payload, namespace) {
47792
+ if (payload.datastakeId) {
47793
+ let _namespace = getNamespace(namespace);
47794
+ const keysToRemove = ['associatedSubjects', 'authorId', 'channels', 'form', 'createdAt', 'meta', 'module', 'updatedAt', 'published', 'version', 'sbgi'];
47795
+ const filteredData = removeKeysFromObject(payload, keysToRemove);
47796
+ return this.apiPut({
47797
+ url: `/${_namespace}/${filteredData.id}`,
47798
+ isApp: true,
47799
+ data: filterCreateData(filteredData)
47800
+ });
47801
+ }
47802
+ return this.apiPost({
47803
+ url: `/${getNamespace(namespace)}`,
47804
+ isApp: true,
47805
+ data: payload
47806
+ });
47807
+ }
47808
+ remove(id, data, namespace, mod) {
47809
+ if (mod) {
47810
+ return this.apiDelete({
47811
+ url: `/${namespace}/${id}`,
47812
+ isApp: true,
47813
+ data: data
47814
+ });
47815
+ }
47816
+ return this.apiDelete({
47817
+ url: `/${namespace}/${id}/remove`,
47818
+ data: data
47819
+ });
47820
+ }
47821
+ getLinkedSubjects({
47822
+ namespace,
47823
+ id
47824
+ }) {
47825
+ const _namespace = getNamespace(namespace);
47826
+ return this.apiGet({
47827
+ url: `/${namespace === "events" ? "event" : _namespace}/${id}/linkedSubjects`,
47828
+ isApp: true
47829
+ });
47830
+ }
47831
+ getOptions() {
47832
+ return this.apiGet({
47833
+ url: `/forms/options`,
47834
+ isApp: true,
47835
+ params: {
47836
+ id: "categoryOptions,eventsType,locationCategories,countries,category,subCategory,optionPositionSupplyChain"
47837
+ }
47838
+ });
47839
+ }
47840
+ }
47841
+ var LinkedSubjectsService$1 = createLazyService(LinkedSubjectsService);
47842
+
47843
+ const emptyObject = {};
47844
+ const LinkingTemplate = ({
47845
+ conf,
47846
+ namespace
47847
+ }) => {
47848
+ const view = React.useMemo(() => conf?.location?.pathname?.split(`/app/${conf.mod}/`)[1], [conf]);
47849
+ const {
47850
+ pagination,
47851
+ onTableChange,
47852
+ totalPages,
47853
+ canGoNext,
47854
+ canGoPrev,
47855
+ setPagination,
47856
+ goPrev,
47857
+ goNext
47858
+ } = useFilters({
47859
+ module: conf.mod,
47860
+ view,
47861
+ selectFiltersConfig: emptyObject,
47862
+ filtersConfig: emptyObject
47863
+ });
47864
+ const columns = React.useMemo(() => getColumns({
47865
+ t: conf.t,
47866
+ redirect,
47867
+ mod: conf.mod,
47868
+ language: conf.user?.language,
47869
+ mode: conf.mode,
47870
+ options: conf.options
47871
+ }), [conf]);
47872
+ const id = conf.allData.id;
47873
+ const dataSource = conf?.linkingTemplateContextData?.[id];
47874
+ const _namespace = namespaceMap[namespace];
47875
+ const changeData = async () => {
47876
+ try {
47877
+ const _data = await LinkedSubjectsService$1.getLinkedSubjects({
47878
+ namespace: _namespace,
47879
+ id,
47880
+ mod: conf.mod
47881
+ });
47882
+ const data = (_data?.data || []).map((d, i) => ({
47883
+ ...d,
47884
+ key: `${d.id}-${i}`
47885
+ }));
47886
+ conf?.addData(id, data);
47887
+ setPagination(prev => ({
47888
+ ...prev,
47889
+ current: 1,
47890
+ total: data.length ? data.length : 1
47891
+ }));
47892
+ } catch (err) {
47893
+ console.log(err);
47894
+ }
47895
+ };
47896
+ const _dataSource = React.useMemo(() => {
47897
+ const startIndex = pagination.pageSize * (pagination.current - 1);
47898
+ const endIndex = Math.min(startIndex + pagination.pageSize, dataSource?.length || 0);
47899
+ return [...(dataSource || [])].slice(startIndex, endIndex);
47900
+ }, [pagination, dataSource]);
47901
+ React.useEffect(() => {
47902
+ if (!dataSource) {
47903
+ changeData();
47904
+ } else {
47905
+ setPagination(prev => ({
47906
+ ...prev,
47907
+ current: 1,
47908
+ total: dataSource.length ? dataSource.length : 1
47909
+ }));
47910
+ }
47911
+ }, []);
47912
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
47913
+ className: formatClassname(["content", "documents-layout"]),
47914
+ style: {},
47915
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
47916
+ className: "view-header",
47917
+ style: {
47918
+ flexDirection: "column",
47919
+ paddingTop: 0
47920
+ },
47921
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
47922
+ className: "daf-table-wrapper pagination-no-padding",
47923
+ children: [/*#__PURE__*/jsxRuntime.jsx(DAFTable, {
47924
+ className: "mt-0 p-0",
47925
+ columns: columns,
47926
+ hideOnLoading: false,
47927
+ data: _dataSource,
47928
+ doEmptyRows: true,
47929
+ loading: !dataSource,
47930
+ rowKey: "key",
47931
+ pagination: pagination,
47932
+ size: "small"
47933
+ }), /*#__PURE__*/jsxRuntime.jsx(Pagination, {
47934
+ t: conf?.t,
47935
+ isMobile: conf?.isMobile,
47936
+ page: pagination.current,
47937
+ totalPages: totalPages,
47938
+ goPrev: goPrev,
47939
+ goNext: goNext,
47940
+ canGoNext: canGoNext,
47941
+ canGoPrev: canGoPrev,
47942
+ totalItems: pagination.total,
47943
+ doTotalItems: true,
47944
+ onChangePagination: val => {
47945
+ onTableChange({
47946
+ ...pagination,
47947
+ current: 1,
47948
+ pageSize: val
47949
+ });
47950
+ },
47951
+ perPage: pagination.pageSize,
47952
+ arrowIcons: true
47953
+ })]
47954
+ })
47955
+ })
47956
+ });
47957
+ };
47958
+
47959
+ /* eslint-disable react/prop-types */
47960
+ function Template({
47961
+ conf,
47962
+ namespace
47963
+ }) {
47964
+ return /*#__PURE__*/jsxRuntime.jsx(LinkingTemplate, {
47965
+ conf: conf,
47966
+ namespace: namespace
47967
+ });
47968
+ }
47969
+
47970
+ const View = ({
47971
+ push,
47972
+ getRedirectLink,
47973
+ allData,
47974
+ ajaxForms,
47975
+ changeAjaxForms,
47976
+ t,
47977
+ namespaceConfiguration,
47978
+ params,
47979
+ pathname,
47980
+ search,
47981
+ searchParams,
47982
+ setSearchParams,
47983
+ mode = "app",
47984
+ APP,
47985
+ viewConfig,
47986
+ partners,
47987
+ setSelectedPartners,
47988
+ user,
47989
+ serviceMap,
47990
+ actionMap,
47991
+ goBack,
47992
+ breadcrumbs,
47993
+ theme,
47994
+ buttonActions,
47995
+ generatePath,
47996
+ getApiBaseUrl,
47997
+ getAppHeader,
47998
+ location,
47999
+ isMobile,
48000
+ linkingTemplateContextData,
48001
+ addData,
48002
+ options,
48003
+ getSubjectsDetails
48004
+ // ADD CALLBACK TO GET THE CURRENT NAMESPACE CONFIG
48005
+ }) => {
48006
+ const getNamespaceConfig = namespace => namespaceConfiguration?.[namespace] || {};
48007
+ const [openRecordsModal, setOpenRecordsModal] = React.useState(false);
48008
+
48009
+ // HANDLES THE URL PARAMS FOR THE VIEW PAGE
48010
+ const {
48011
+ namespace,
48012
+ id,
48013
+ group,
48014
+ subsection,
48015
+ source,
48016
+ setSource,
48017
+ sourceUrl,
48018
+ version,
48019
+ setVersion,
48020
+ versionUrl,
48021
+ goBackFromSource,
48022
+ getEditLink,
48023
+ match
48024
+ } = useViewUrlParams({
48025
+ params,
48026
+ push,
48027
+ pathname,
48028
+ search,
48029
+ searchParams,
48030
+ setSearchParams
48031
+ });
48032
+ const namespaceConfig = React.useMemo(() => getNamespaceConfig(namespace), [namespace]);
48033
+
48034
+ // PREPARES THE FORM FOR THE VIEW PAGE
48035
+ const {
48036
+ form,
48037
+ data,
48038
+ groups,
48039
+ linkingForms,
48040
+ loading,
48041
+ setLoading,
48042
+ notFound
48043
+ } = usePrepareForm({
48044
+ namespaceConfig,
48045
+ allData,
48046
+ id,
48047
+ namespace,
48048
+ t,
48049
+ mode,
48050
+ APP,
48051
+ viewConfig
48052
+ });
48053
+ const {
48054
+ canEdit,
48055
+ isSupported
48056
+ } = useViewPermissions({
48057
+ data,
48058
+ id,
48059
+ namespace,
48060
+ user,
48061
+ push,
48062
+ getRedirectLink,
48063
+ namespaceConfig: namespaceConfiguration,
48064
+ APP,
48065
+ viewConfig
48066
+ });
48067
+ const groupForm = React.useMemo(() => {
48068
+ const gF = form[group] || {};
48069
+ if (subsection) {
48070
+ const sectionForms = groupSubsections(gF);
48071
+ if (sectionForms[subsection]) {
48072
+ return sectionForms[subsection];
48073
+ }
48074
+ }
48075
+ return gF;
48076
+ }, [form, group, subsection]);
48077
+ const {
48078
+ submitSubject,
48079
+ isDisabled,
48080
+ submitLoading,
48081
+ isPublished
48082
+ } = useSubmitSubject({
48083
+ namespace,
48084
+ data,
48085
+ serviceMap
48086
+ });
48087
+ const {
48088
+ pageActions,
48089
+ extraPageActions
48090
+ } = useViewActions({
48091
+ namespace,
48092
+ data,
48093
+ isSupported,
48094
+ canEdit,
48095
+ versionUrl,
48096
+ sourceUrl,
48097
+ getEditLink,
48098
+ submitSubject,
48099
+ isDisabled,
48100
+ setOpenRecordsModal,
48101
+ goBackFromSource,
48102
+ push,
48103
+ getRedirectLink,
48104
+ t,
48105
+ viewConfig,
48106
+ buttonActions
48107
+ });
48108
+ React.useEffect(() => {
48109
+ if (namespace && id && namespaceConfig && typeof getSubjectsDetails === 'function') {
48110
+ getSubjectsDetails({
48111
+ namespace,
48112
+ id,
48113
+ namespaceConfig
48114
+ });
48115
+ }
48116
+ }, [namespace, id, namespaceConfig]);
48117
+ const action = React.useMemo(() => actionMap?.[namespaceConfig?.action], [namespaceConfig?.action, actionMap]);
48118
+ const namespaceGet = {
48119
+ [namespace]: () => {
48120
+ return action?.({
48121
+ namespace: namespaceConfig?.namespace,
48122
+ module: APP,
48123
+ view: namespaceConfig?.view,
48124
+ ...(namespaceConfig?.scope && {
48125
+ scope: namespaceConfig.scope
48126
+ }),
48127
+ datastakeId: id,
48128
+ version,
48129
+ source
48130
+ });
48131
+ }
48132
+ };
48133
+ useCallToGetData({
48134
+ namespaceConfig,
48135
+ namespace,
48136
+ allData,
48137
+ id,
48138
+ isSupported,
48139
+ namespaceGet,
48140
+ source,
48141
+ version,
48142
+ user,
48143
+ setLoading,
48144
+ APP
48145
+ });
48146
+ const extraLinking = React.useMemo(() => {
48147
+ return null;
48148
+ }, [namespace, match, data]);
48149
+ const sourceOptions = React.useMemo(() => {
48150
+ return partners.map(partner => {
48151
+ const isOwnData = partner.id === user?.company?.id;
48152
+ return {
48153
+ label: partner.nickName,
48154
+ value: partner.id,
48155
+ avatar: isOwnData ? /*#__PURE__*/jsxRuntime.jsx("span", {
48156
+ children: "OWN"
48157
+ }) : undefined,
48158
+ background: isOwnData ? theme.colorPrimary7 : undefined,
48159
+ color: isOwnData ? "white" : undefined
48160
+ };
48161
+ });
48162
+ }, [partners, user]);
48163
+ const actionButtons = React.useMemo(() => {
48164
+ return groupForm?.template === "linkingSubjects" ? pageActions.filter(v => v.key !== "edit") : pageActions;
48165
+ }, [groupForm, pageActions]);
48166
+ if (!isSupported || notFound) {
48167
+ return /*#__PURE__*/jsxRuntime.jsx(Loading, {});
48168
+ }
48169
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
48170
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
48171
+ className: "daf-view-form",
48172
+ children: [/*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
48173
+ title: data?.name || "",
48174
+ breadcrumbs: breadcrumbs,
48175
+ goBackTo: goBack,
48176
+ actionButtons: actionButtons,
48177
+ extraButtons: extraPageActions,
48178
+ addedHeaderFirst: true,
48179
+ addedHeader: /*#__PURE__*/jsxRuntime.jsx("div", {
48180
+ className: "flex flex-row gap-4",
48181
+ children: /*#__PURE__*/jsxRuntime.jsx(Multiselect, {
48182
+ options: [...sourceOptions],
48183
+ isAvatarGroup: true,
48184
+ selectionType: "checkbox",
48185
+ canUnselectLast: false,
48186
+ isSingle: true,
48187
+ onChange: selected => {
48188
+ setSelectedPartners(prev => ({
48189
+ ...prev,
48190
+ partners: selected,
48191
+ loading: false
48192
+ }));
48193
+ },
48194
+ dropDownWidth: 200,
48195
+ defaultSelected: (partners || []).map(p => p.id) || []
48196
+ }, partners?.length)
48197
+ })
48198
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
48199
+ className: "view-content",
48200
+ children: [/*#__PURE__*/jsxRuntime.jsx(Navigation, {
48201
+ mod: APP,
48202
+ data: data,
48203
+ match: match,
48204
+ form: form,
48205
+ group: group,
48206
+ subsection: subsection,
48207
+ search: search,
48208
+ goTo: push,
48209
+ getRedirectLink: getRedirectLink,
48210
+ generatePath: generatePath,
48211
+ params: params
48212
+ }), groupForm.template ? /*#__PURE__*/jsxRuntime.jsx(Template, {
48213
+ namespace: namespace,
48214
+ conf: {
48215
+ mod: APP,
48216
+ group: group,
48217
+ form: groupForm,
48218
+ data: data[group] ? data[group] : data || {},
48219
+ allData: data,
48220
+ linkingForms: linkingForms || {},
48221
+ linkingData: data.linking || {},
48222
+ match,
48223
+ canEdit: isSupported && canEdit,
48224
+ mode,
48225
+ user: user,
48226
+ t: t,
48227
+ location: location,
48228
+ isMobile: isMobile,
48229
+ linkingTemplateContextData: linkingTemplateContextData,
48230
+ addData: addData,
48231
+ options: options
48232
+ }
48233
+ }) : /*#__PURE__*/jsxRuntime.jsx(Content, {
48234
+ form: groupForm,
48235
+ data: data || {},
48236
+ groupConfig: groups || {},
48237
+ linkingData: (data || {}).linking || {},
48238
+ linkingForms: linkingForms || {},
48239
+ ajaxOptions: [],
48240
+ extraLinking: extraLinking,
48241
+ t: t,
48242
+ app: APP,
48243
+ ajaxForms: ajaxForms,
48244
+ language: user?.language,
48245
+ changeAjaxForms: changeAjaxForms,
48246
+ getApiBaseUrl: getApiBaseUrl,
48247
+ getAppHeader: getAppHeader,
48248
+ user: user
48249
+ })]
48250
+ })]
48251
+ }), openRecordsModal && /*#__PURE__*/jsxRuntime.jsx(Records, {
48252
+ open: openRecordsModal,
48253
+ onClose: () => setOpenRecordsModal(false),
48254
+ t: t,
48255
+ sourceOptions: [],
48256
+ versionOptions: [],
48257
+ id: params?.id,
48258
+ subject: namespace,
48259
+ onSubmit: values => {
48260
+ setSource(values?.source);
48261
+ setVersion(values?.version);
48262
+ }
48263
+ })]
48264
+ });
48265
+ };
48266
+
45918
48267
  exports.ActivitiesTable = ActivitiesTable;
45919
48268
  exports.DocumentsTable = DocumentsTable;
45920
48269
  exports.EventsTable = EventsTable;
@@ -45932,4 +48281,5 @@ exports.SupplyChainDashboard = SupplyChain;
45932
48281
  exports.TablePage = TablePage;
45933
48282
  exports.UserDashboard = UserDashboard;
45934
48283
  exports.UsersTable = UsersTable;
48284
+ exports.View = View;
45935
48285
  exports.WorkersTable = WorkersTable;