datastake-daf 0.6.773 → 0.6.774

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.
@@ -7069,7 +7069,7 @@ const getRowConfig$1 = ({
7069
7069
  const MOBILE_W = 850;
7070
7070
  const MOBILE_WIDTH = `max-width: ${MOBILE_W}px`;
7071
7071
 
7072
- const Style$g = styled__default["default"].div`
7072
+ const Style$f = styled__default["default"].div`
7073
7073
  overflow-x: auto;
7074
7074
 
7075
7075
  @media (${MOBILE_WIDTH}) {
@@ -7467,7 +7467,7 @@ function KeyIndicatorsWidget({
7467
7467
  className: formatClassname(["flex-1 h-w-btn-header with-border-header", widgetClassName]),
7468
7468
  title: noTitle ? undefined : t(title),
7469
7469
  noTitle: noTitle,
7470
- children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$g, {
7470
+ children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$f, {
7471
7471
  className: formatClassname(["flex", className]),
7472
7472
  children: config.map((c, i) => /*#__PURE__*/jsxRuntime.jsxs("div", {
7473
7473
  className: "row-item",
@@ -7563,13 +7563,15 @@ KeyIndicators$1.propTypes = {
7563
7563
  goTo: PropTypes__default["default"].func
7564
7564
  };
7565
7565
 
7566
- const Style$f = styled__default["default"].div`
7566
+ const Style$e = styled__default["default"].div`
7567
7567
  display: flex;
7568
7568
  flex-direction: row;
7569
7569
  position: relative;
7570
7570
  width: 100%;
7571
7571
  height: 472px;
7572
7572
 
7573
+
7574
+
7573
7575
  .filter-cont {
7574
7576
  position: absolute;
7575
7577
  top: 24px;
@@ -7672,11 +7674,24 @@ const Style$f = styled__default["default"].div`
7672
7674
  align-items: center;
7673
7675
  }
7674
7676
 
7675
- .marker-chain {
7676
- display: flex;
7677
- align-items: center;
7678
- justify-content: center;
7679
- }
7677
+ .marker-chain {
7678
+ display: flex;
7679
+ align-items: center;
7680
+ justify-content: center;
7681
+ }
7682
+
7683
+ .animated-polyline {
7684
+ stroke-dasharray: 10 10;
7685
+ animation: dash-flow 1.5s linear infinite;
7686
+ stroke-linecap: round;
7687
+ }
7688
+
7689
+ @keyframes dash-flow {
7690
+ to {
7691
+ stroke-dashoffset: -20;
7692
+ }
7693
+ }
7694
+
7680
7695
 
7681
7696
  }
7682
7697
 
@@ -8200,18 +8215,15 @@ const VILLAGE = "village";
8200
8215
  const EXPORTER = "exporter";
8201
8216
  const PROCESSOR = "mineralProcessor";
8202
8217
  const DEPOT = "depot";
8218
+ const OPERATOR = "miningOperator";
8203
8219
  const MAX_EXTRA_SMALL_ZOOM_THRESHOLD = 2;
8204
8220
  const MAX_SMALL_ZOOM_THRESHOLD = 3;
8205
8221
  const MAX_MEDIUM_ZOOM_THRESHOLD = 6;
8206
8222
  const LOCATION_TYPES = [MINE_SITE, VILLAGE];
8207
- const STAKEHOLDER_TYPES = [EXPORTER, PROCESSOR, DEPOT];
8223
+ const STAKEHOLDER_TYPES = [EXPORTER, PROCESSOR, DEPOT, OPERATOR];
8208
8224
  const RADIUS_SMALL = 15;
8209
8225
  const RADIUS_MEDIUM = 35;
8210
8226
  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
8227
  function isLocation(type) {
8216
8228
  return LOCATION_TYPES.includes(type);
8217
8229
  }
@@ -8268,7 +8280,6 @@ function getStakeholderPosition({
8268
8280
  const isLarge = isLargeMarker(zoom);
8269
8281
  let radius;
8270
8282
  let center = {
8271
- // NOT BEING USED FOR NOW AND MAYBE NEVER
8272
8283
  left: 0,
8273
8284
  top: 0
8274
8285
  };
@@ -8292,6 +8303,25 @@ function getStakeholderPosition({
8292
8303
  angleDeg
8293
8304
  };
8294
8305
  }
8306
+ function applyAnimationDirect(el, isShortLink) {
8307
+ if (!(el instanceof SVGElement) || isShortLink) return;
8308
+ el.style.strokeDasharray = "10, 10";
8309
+ el.style.strokeDashoffset = "0";
8310
+ el.style.animation = "dash-flow 1.2s linear infinite";
8311
+ el.classList.add('animated-polyline');
8312
+ }
8313
+ function removeAnimationFromElement(element) {
8314
+ if (!element) return;
8315
+ element.classList.remove('animated-polyline');
8316
+ element.style.animation = '';
8317
+ element.style.strokeDasharray = '';
8318
+ }
8319
+ function applyAnimationToPolyline(polyline, isShortLink) {
8320
+ const element = polyline.getElement();
8321
+ if (element) {
8322
+ applyAnimationDirect(element, isShortLink);
8323
+ }
8324
+ }
8295
8325
  function createPolyline({
8296
8326
  L,
8297
8327
  startLatLng,
@@ -8301,109 +8331,47 @@ function createPolyline({
8301
8331
  zoom,
8302
8332
  listOfPolylines = [],
8303
8333
  isFromStakeholder = false,
8304
- isForceOpen = false
8334
+ isForceOpen = false,
8335
+ stakeholderType = null,
8336
+ animated = false,
8337
+ mapRef
8305
8338
  }) {
8306
- const width = isFromStakeholder && isExtraSmallMarker(zoom) && !isForceOpen ? 0 : 1.2;
8307
- const coordinates = [[startLatLng.lat, startLatLng.lng], [endLatLng.lat, endLatLng.lng]];
8308
- const style = {
8339
+ const lineWidth = isFromStakeholder && isExtraSmallMarker(zoom) && !isForceOpen ? 0 : 1.2;
8340
+ const isShortLink = stakeholderType === OPERATOR || isFromStakeholder;
8341
+ const shouldAnimate = animated;
8342
+ const lineCoordinates = [[startLatLng.lat, startLatLng.lng], [endLatLng.lat, endLatLng.lng]];
8343
+ const polylineStyle = {
8309
8344
  color: "var(--base-gray-70)",
8310
- weight: width,
8311
- opacity: 0.5,
8312
- smoothFactor: 1,
8345
+ weight: lineWidth,
8346
+ opacity: isSelected ? 1 : 0.5,
8347
+ smoothFactor: 0,
8313
8348
  id,
8314
- dashArray: !isSelected ? "5, 5" : "0, 0"
8349
+ dashArray: isShortLink ? "0, 0" : shouldAnimate ? "10, 10" : !isSelected ? "5, 5" : "10, 10",
8350
+ renderer: L.svg()
8315
8351
  };
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);
8352
+ const existingPolyline = listOfPolylines.find(p => p.options.id === id);
8353
+ if (existingPolyline) {
8354
+ removeAnimationFromElement(existingPolyline.getElement());
8355
+ existingPolyline.setLatLngs(lineCoordinates);
8356
+ existingPolyline.setStyle(polylineStyle);
8357
+ if (shouldAnimate && isSelected) {
8358
+ existingPolyline.once('add', () => {
8359
+ applyAnimationToPolyline(existingPolyline, isShortLink);
8360
+ });
8361
+ applyAnimationToPolyline(existingPolyline, isShortLink);
8362
+ }
8363
+ return existingPolyline;
8323
8364
  }
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;
8365
+ const newPolyline = L.polyline(lineCoordinates, polylineStyle);
8366
+ newPolyline.addTo(mapRef);
8367
+ listOfPolylines.push(newPolyline);
8368
+ if (shouldAnimate && isSelected) {
8369
+ newPolyline.once('add', () => {
8370
+ applyAnimationToPolyline(newPolyline, isShortLink);
8371
+ });
8372
+ applyAnimationToPolyline(newPolyline, isShortLink);
8352
8373
  }
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);
8374
+ return newPolyline;
8407
8375
  }
8408
8376
 
8409
8377
  const StakeholderMarker = styled__default["default"].div`
@@ -8705,6 +8673,9 @@ function StakeholderIcon$1({
8705
8673
  return null;
8706
8674
  }, [parentId, allData]);
8707
8675
  React.useEffect(() => {
8676
+ if (selectedMarkersId.length === 0 || !isSelected) {
8677
+ return;
8678
+ }
8708
8679
  linkNodesData.map(node => {
8709
8680
  const isConnectingToStakeholder = node.isStakeholder;
8710
8681
  const id = `${data.datastakeId}-${node.stakeholderId || node.datastakeId}`;
@@ -8716,8 +8687,6 @@ function StakeholderIcon$1({
8716
8687
  const stakeholderPoint = centerPoint.add(L__namespace.point(x, y));
8717
8688
  const stakeholderLatLng = mapRef.layerPointToLatLng(stakeholderPoint);
8718
8689
  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
8690
  if (isExtraSmallMarker(zoom) && !isForceOpen) {
8722
8691
  createPolyline({
8723
8692
  L: L__namespace,
@@ -8727,7 +8696,8 @@ function StakeholderIcon$1({
8727
8696
  zoom,
8728
8697
  isSelected,
8729
8698
  id,
8730
- listOfPolylines: polylinesRef.current
8699
+ listOfPolylines: polylinesRef.current,
8700
+ animated: true
8731
8701
  });
8732
8702
  return;
8733
8703
  }
@@ -8745,61 +8715,8 @@ function StakeholderIcon$1({
8745
8715
  const nodePoint = mapRef.latLngToLayerPoint(nodeLatLng);
8746
8716
  const endPoint = L__namespace.point(x + nodePoint.x + center.left, y + nodePoint.y + center.top);
8747
8717
  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
8718
  }
8719
+ // Always use straight lines
8803
8720
  createPolyline({
8804
8721
  L: L__namespace,
8805
8722
  mapRef,
@@ -8809,10 +8726,11 @@ function StakeholderIcon$1({
8809
8726
  isFromStakeholder: false,
8810
8727
  isSelected,
8811
8728
  id,
8812
- listOfPolylines: polylinesRef.current
8729
+ listOfPolylines: polylinesRef.current,
8730
+ animated: true
8813
8731
  });
8814
8732
  });
8815
- }, [mapRef, x, y, parentData, linkNodesData, isSelected, zoom, isForceOpen]);
8733
+ }, [mapRef, x, y, parentData, linkNodesData, isSelected, zoom, isForceOpen, selectedMarkersId]);
8816
8734
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
8817
8735
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
8818
8736
  content: renderTooltipJsx({
@@ -8879,6 +8797,8 @@ function LocationIcon({
8879
8797
  const linkedNodesData = React.useMemo(() => {
8880
8798
  const nodes = [];
8881
8799
  const links = data.links || [];
8800
+
8801
+ // Add links from the location itself
8882
8802
  links.forEach(link => {
8883
8803
  allData.forEach(d => {
8884
8804
  if (d.datastakeId === link) {
@@ -8898,8 +8818,45 @@ function LocationIcon({
8898
8818
  }
8899
8819
  });
8900
8820
  });
8821
+
8822
+ // ADD: Also include links from this location's stakeholders
8823
+ const stakeholders = data.stakeholders || [];
8824
+ stakeholders.forEach(stakeholder => {
8825
+ const stakeholderLinks = stakeholder.links || [];
8826
+ stakeholderLinks.forEach(link => {
8827
+ allData.forEach(d => {
8828
+ // Check if it's a direct location link
8829
+ if (d.datastakeId === link) {
8830
+ // Avoid duplicates
8831
+ if (!nodes.find(n => n.datastakeId === link && !n.isStakeholder)) {
8832
+ nodes.push({
8833
+ ...d,
8834
+ fromStakeholderId: stakeholder.datastakeId
8835
+ });
8836
+ }
8837
+ }
8838
+ // Check if it's a stakeholder link
8839
+ if (d.stakeholders && d.stakeholders.length > 0) {
8840
+ d.stakeholders.forEach(targetStakeholder => {
8841
+ if (targetStakeholder.datastakeId === link) {
8842
+ // Avoid duplicates
8843
+ if (!nodes.find(n => n.isStakeholder && n.datastakeId === d.datastakeId && n.stakeholdersIndex === d.stakeholders.indexOf(targetStakeholder))) {
8844
+ nodes.push({
8845
+ ...d,
8846
+ isStakeholder: true,
8847
+ totalStakeholders: d.stakeholders.length,
8848
+ stakeholdersIndex: d.stakeholders.indexOf(targetStakeholder),
8849
+ fromStakeholderId: stakeholder.datastakeId
8850
+ });
8851
+ }
8852
+ }
8853
+ });
8854
+ }
8855
+ });
8856
+ });
8857
+ });
8901
8858
  return nodes;
8902
- }, [JSON.stringify(allData), JSON.stringify(data.links), zoom]);
8859
+ }, [JSON.stringify(allData), JSON.stringify(data.links), JSON.stringify(data.stakeholders), zoom]);
8903
8860
  const stakeholdersOfLocation = React.useMemo(() => {
8904
8861
  return data?.stakeholders || [];
8905
8862
  }, [data.stakeholders, zoom]);
@@ -8917,7 +8874,13 @@ function LocationIcon({
8917
8874
  currentRoots.clear();
8918
8875
  markersRef.current = [];
8919
8876
 
8920
- // Create new markers
8877
+ // Only create stakeholder markers if this location or any of its stakeholders are selected
8878
+ const shouldShowStakeholders = isSelected || stakeholdersOfLocation.some(stk => selectedMarkersId.includes(stk.datastakeId));
8879
+ if (!shouldShowStakeholders || selectedMarkersId.length === 0) {
8880
+ return;
8881
+ }
8882
+
8883
+ // Create new markers only when selected
8921
8884
  stakeholdersOfLocation.forEach((stakeholder, index) => {
8922
8885
  const markerId = `${stakeholder.datastakeId}`;
8923
8886
  const {
@@ -9003,7 +8966,9 @@ function LocationIcon({
9003
8966
  zoom,
9004
8967
  isFromStakeholder: true,
9005
8968
  isForceOpen,
9006
- listOfPolylines: polylinesRef.current
8969
+ listOfPolylines: polylinesRef.current,
8970
+ stakeholderType: stakeholder.type,
8971
+ animated: true
9007
8972
  });
9008
8973
  });
9009
8974
  return () => {
@@ -9018,38 +8983,88 @@ function LocationIcon({
9018
8983
  rootsMapRef.current.clear();
9019
8984
  markersRef.current = [];
9020
8985
  };
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({
8986
+ }, [stakeholdersOfLocation, selectedMarkersId, activeMarker, zoom]);
8987
+
8988
+ // Only create polylines for linked nodes when something is selected
8989
+ React.useEffect(() => {
8990
+ if (selectedMarkersId.length === 0) {
8991
+ return;
8992
+ }
8993
+
8994
+ // IMPORTANT: Only draw links if this location is actually selected
8995
+ // Not just highlighted as part of the chain
8996
+ if (!isSelected) {
8997
+ return;
8998
+ }
8999
+
9000
+ // Filter linkedNodesData to only include nodes that are in the selected chain
9001
+ const relevantLinks = linkedNodesData.filter(node => {
9002
+ // Check if the target node (location) is in the selected markers
9003
+ const targetLocationInSelection = selectedMarkersId.includes(node.datastakeId);
9004
+
9005
+ // If connecting to a stakeholder, check if that stakeholder is selected
9006
+ if (node.isStakeholder) {
9007
+ const stakeholderInSelection = node.stakeholdersIndex !== undefined && selectedMarkersId.includes(node.datastakeId);
9008
+ return stakeholderInSelection;
9009
+ }
9010
+ return targetLocationInSelection;
9011
+ });
9012
+ relevantLinks.forEach(node => {
9013
+ const id = node.fromStakeholderId ? `${node.fromStakeholderId}-${node.datastakeId}` : `${data.datastakeId}-${node.datastakeId}`;
9014
+ const isConnectingToStakeholder = node.isStakeholder;
9015
+
9016
+ // If the link is from a stakeholder, start from the stakeholder position
9017
+ let startLatLng;
9018
+ if (node.fromStakeholderId) {
9019
+ // Find the stakeholder index in this location's stakeholders
9020
+ const stakeholderIndex = stakeholdersOfLocation.findIndex(s => s.datastakeId === node.fromStakeholderId);
9021
+ if (stakeholderIndex !== -1) {
9022
+ const {
9023
+ x,
9024
+ y
9025
+ } = getStakeholderPosition({
9026
+ zoom,
9027
+ totalMarkers: stakeholdersOfLocation.length,
9028
+ markerIndex: stakeholderIndex
9029
+ });
9030
+ const centerLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
9031
+ const centerPoint = mapRef.latLngToLayerPoint(centerLatLng);
9032
+ const stakeholderPoint = centerPoint.add(L__namespace.point(x, y));
9033
+ startLatLng = mapRef.layerPointToLatLng(stakeholderPoint);
9034
+ } else {
9035
+ startLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
9036
+ }
9037
+ } else {
9038
+ startLatLng = L__namespace.latLng(data.gps.latitude, data.gps.longitude);
9039
+ }
9040
+ let endLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
9041
+ const isConnectingToStakeholderSelected = selectedMarkersId.includes(node.datastakeId);
9042
+ if (isConnectingToStakeholder && !isExtraSmallMarker(zoom)) {
9043
+ const {
9044
+ x,
9045
+ y
9046
+ } = getStakeholderPosition({
9047
+ zoom,
9048
+ totalMarkers: node.totalStakeholders,
9049
+ markerIndex: node.stakeholdersIndex
9050
+ });
9051
+ const nodeLatLng = L__namespace.latLng(node.gps.latitude, node.gps.longitude);
9052
+ const nodePoint = mapRef.latLngToLayerPoint(nodeLatLng);
9053
+ const endPoint = L__namespace.point(x + nodePoint.x, y + nodePoint.y);
9054
+ endLatLng = mapRef.layerPointToLatLng(endPoint);
9055
+ }
9056
+ createPolyline({
9057
+ L: L__namespace,
9058
+ mapRef,
9059
+ startLatLng,
9060
+ endLatLng,
9061
+ isSelected: isConnectingToStakeholderSelected,
9062
+ id,
9033
9063
  zoom,
9034
- totalMarkers: node.totalStakeholders,
9035
- markerIndex: node.stakeholdersIndex
9064
+ listOfPolylines: polylinesRef.current
9036
9065
  });
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
9051
9066
  });
9052
- });
9067
+ }, [linkedNodesData, selectedMarkersId, zoom, stakeholdersOfLocation, isSelected]);
9053
9068
  return /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
9054
9069
  content: renderTooltipJsx({
9055
9070
  title: data.name,
@@ -9104,7 +9119,7 @@ function LocationIcon({
9104
9119
  });
9105
9120
  }
9106
9121
 
9107
- const Style$e = styled__default["default"].div`
9122
+ const Style$d = styled__default["default"].div`
9108
9123
  .main {
9109
9124
  width: 24px;
9110
9125
  height: 24px;
@@ -9249,7 +9264,7 @@ function StakeholderIcon({
9249
9264
  onClickLink: () => onClickLink(marker)
9250
9265
  }),
9251
9266
  getPopupContainer: () => document.getElementById("map"),
9252
- children: /*#__PURE__*/jsxRuntime.jsx(Style$e
9267
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$d
9253
9268
  // onClick={toggleOpen}
9254
9269
  , {
9255
9270
  className: `map-marker marker closed`,
@@ -9262,7 +9277,7 @@ function StakeholderIcon({
9262
9277
  })
9263
9278
  });
9264
9279
  }
9265
- return /*#__PURE__*/jsxRuntime.jsxs(Style$e, {
9280
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$d, {
9266
9281
  onClick: toggleOpen,
9267
9282
  className: `map-marker marker ${isActive ? "opened" : "closed"}`,
9268
9283
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -9565,7 +9580,8 @@ function useMapHelper$1({
9565
9580
  link: link,
9566
9581
  onClickLink: onClickLink,
9567
9582
  activeStakeholder: activeStakeholder,
9568
- setActiveStakeholder: setActiveStakeholder
9583
+ setActiveStakeholder: setActiveStakeholder,
9584
+ mapRef: mapRef
9569
9585
  }));
9570
9586
  roots.current.push(root);
9571
9587
  } else if (type === "location") {
@@ -9770,7 +9786,8 @@ const useMap = ({
9770
9786
  MAP_TOKEN
9771
9787
  } = useMapConfig({
9772
9788
  app,
9773
- isSatellite
9789
+ isSatellite,
9790
+ mapRef: container
9774
9791
  });
9775
9792
  const [initialMarkerSetIsDone, setInitialMarkerSetIsDone] = React.useState(false);
9776
9793
  const [mapCenter, setMapCenter] = React.useState([0, 0]);
@@ -9787,6 +9804,8 @@ const useMap = ({
9787
9804
  const graph = new Map();
9788
9805
  const stakeToLoc = new Map();
9789
9806
  const nodeTypes = new Map();
9807
+
9808
+ // Build the graph
9790
9809
  for (const loc of data) {
9791
9810
  const locId = loc.datastakeId;
9792
9811
  nodeTypes.set(locId, loc.type);
@@ -9811,26 +9830,45 @@ const useMap = ({
9811
9830
  }
9812
9831
  }
9813
9832
  const highlightTable = {};
9833
+
9834
+ // Perform BFS/DFS to find all connected nodes in the entire chain
9814
9835
  for (const [node] of graph) {
9815
9836
  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 {
9837
+ const queue = [node];
9838
+ const visited = new Set([node]);
9839
+ while (queue.length > 0) {
9840
+ const current = queue.shift();
9841
+ highlighted.add(current);
9842
+
9843
+ // Add parent location if current is stakeholder
9844
+ const currentIsStakeholder = !isLocation(nodeTypes.get(current));
9845
+ if (currentIsStakeholder && stakeToLoc.has(current)) {
9846
+ const parentLoc = stakeToLoc.get(current);
9847
+ if (!visited.has(parentLoc)) {
9848
+ highlighted.add(parentLoc);
9849
+ visited.add(parentLoc);
9850
+ queue.push(parentLoc);
9851
+ }
9852
+ }
9853
+
9854
+ // Traverse all neighbors
9855
+ for (const neighbor of graph.get(current) || []) {
9856
+ if (!visited.has(neighbor)) {
9857
+ visited.add(neighbor);
9858
+ queue.push(neighbor);
9829
9859
  highlighted.add(neighbor);
9830
- highlighted.add(neighborParent);
9860
+
9861
+ // If neighbor is stakeholder, add its parent location
9862
+ const neighborIsStakeholder = !isLocation(nodeTypes.get(neighbor));
9863
+ if (neighborIsStakeholder && stakeToLoc.has(neighbor)) {
9864
+ const neighborParent = stakeToLoc.get(neighbor);
9865
+ if (!visited.has(neighborParent)) {
9866
+ highlighted.add(neighborParent);
9867
+ visited.add(neighborParent);
9868
+ queue.push(neighborParent);
9869
+ }
9870
+ }
9831
9871
  }
9832
- } else {
9833
- highlighted.add(neighbor);
9834
9872
  }
9835
9873
  }
9836
9874
  highlightTable[node] = [...highlighted];
@@ -9895,19 +9933,29 @@ const useMap = ({
9895
9933
  });
9896
9934
  }
9897
9935
  }
9936
+ if (type === "chain" && selectedMarkersId.length === 0) {
9937
+ if (polylinesRef.current.length) {
9938
+ polylinesRef.current.forEach(polyline => {
9939
+ if (mapRef.hasLayer(polyline)) {
9940
+ mapRef.removeLayer(polyline);
9941
+ }
9942
+ });
9943
+ polylinesRef.current = [];
9944
+ }
9945
+ }
9898
9946
  clearMapMarkers();
9899
9947
  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)))));
9948
+ 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
9949
  const maxTotal = Math.max(...(data || []).map(d => d.total));
9904
9950
  const dataToRender = type === "chain" ? filteredData : data;
9905
9951
  dataToRender.forEach((d, i) => {
9906
9952
  addIconToMapInitialy([d?.marker?.lat, d?.marker?.lng], "location", d.category || "mineSite", d, maxTotal, i);
9907
9953
  });
9908
- polylinesRef.current.forEach(polyline => {
9909
- mapRef.addLayer(polyline);
9910
- });
9954
+ if (selectedMarkersId.length > 0) {
9955
+ polylinesRef.current.forEach(polyline => {
9956
+ mapRef.addLayer(polyline);
9957
+ });
9958
+ }
9911
9959
  mapRef.invalidateSize();
9912
9960
  mapRef.fire("moveend");
9913
9961
  }
@@ -10068,7 +10116,7 @@ const useMap = ({
10068
10116
  };
10069
10117
  };
10070
10118
 
10071
- const Style$d = styled__default["default"].div`
10119
+ const Style$c = styled__default["default"].div`
10072
10120
  position: relative;
10073
10121
  width: 100%;
10074
10122
  height: 100%;
@@ -10141,7 +10189,7 @@ function ComponentWithFocus({
10141
10189
  setClosed(false);
10142
10190
  }
10143
10191
  }, [closed]);
10144
- return /*#__PURE__*/jsxRuntime.jsxs(Style$d, {
10192
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$c, {
10145
10193
  className: className,
10146
10194
  ref: ref,
10147
10195
  style: style,
@@ -10153,7 +10201,7 @@ function ComponentWithFocus({
10153
10201
  });
10154
10202
  }
10155
10203
 
10156
- const Style$c = styled__default["default"].div`
10204
+ const Style$b = styled__default["default"].div`
10157
10205
  position: absolute;
10158
10206
  top: 24px;
10159
10207
  left: 24px;
@@ -10328,7 +10376,7 @@ function Filters({
10328
10376
  return null;
10329
10377
  }
10330
10378
  };
10331
- return /*#__PURE__*/jsxRuntime.jsxs(Style$c, {
10379
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$b, {
10332
10380
  children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
10333
10381
  onClick: () => setOpened(p => !p),
10334
10382
  children: [t("Filter"), /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
@@ -10409,7 +10457,7 @@ function Map$1({
10409
10457
  isSatellite
10410
10458
  });
10411
10459
  return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
10412
- children: /*#__PURE__*/jsxRuntime.jsxs(Style$f, {
10460
+ children: /*#__PURE__*/jsxRuntime.jsxs(Style$e, {
10413
10461
  className: formatClassname([showSider && activeMarker && "with-sider"]),
10414
10462
  children: [filtersConfig ? /*#__PURE__*/jsxRuntime.jsx(Filters, {
10415
10463
  t: t,
@@ -10618,7 +10666,7 @@ function PrimaryNode({
10618
10666
  style: {
10619
10667
  opacity: 0
10620
10668
  }
10621
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$b, {
10669
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$a, {
10622
10670
  $isPdf: isPdf,
10623
10671
  className: "flex",
10624
10672
  children: [" ", /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -10729,7 +10777,7 @@ function PrimaryNode({
10729
10777
  })]
10730
10778
  });
10731
10779
  }
10732
- const Style$b = styled__default["default"].div`
10780
+ const Style$a = styled__default["default"].div`
10733
10781
  width: ${MAIN_NODE_WIDTH}px;
10734
10782
  height: ${MAIN_NODE_HEIGHT}px; /* Explicitly set height */
10735
10783
  display: flex;
@@ -10865,7 +10913,7 @@ function IconNode({
10865
10913
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
10866
10914
  title: data?.name,
10867
10915
  defaultOpen: data?.ONLY_IN_STORYBOOK,
10868
- children: /*#__PURE__*/jsxRuntime.jsx(Style$a, {
10916
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$9, {
10869
10917
  hoverColor: data?.iconHoverColor,
10870
10918
  children: /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
10871
10919
  theme: {
@@ -10908,7 +10956,7 @@ function IconNode({
10908
10956
  })]
10909
10957
  });
10910
10958
  }
10911
- const Style$a = styled__default["default"].div`
10959
+ const Style$9 = styled__default["default"].div`
10912
10960
  height: 40px;
10913
10961
  width: 40px;
10914
10962
 
@@ -10986,7 +11034,7 @@ function NameNode({
10986
11034
  style: {
10987
11035
  opacity: 0
10988
11036
  }
10989
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$9, {
11037
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$8, {
10990
11038
  $isPdf: isPdf,
10991
11039
  style: {
10992
11040
  opacity: data.isEmpty ? 0.5 : 1
@@ -11074,7 +11122,7 @@ function NameNode({
11074
11122
  })]
11075
11123
  });
11076
11124
  }
11077
- const Style$9 = styled__default["default"].div`
11125
+ const Style$8 = styled__default["default"].div`
11078
11126
  width: ${NAME_CARD_WIDTH}px;
11079
11127
  height: 55px;
11080
11128
  display: flex;
@@ -11105,7 +11153,7 @@ const Style$9 = styled__default["default"].div`
11105
11153
  }
11106
11154
  `;
11107
11155
 
11108
- const Style$8 = styled__default["default"].div`
11156
+ const Style$7 = styled__default["default"].div`
11109
11157
  width: 405px;
11110
11158
  display: flex;
11111
11159
  height: 140px;
@@ -11216,7 +11264,7 @@ function ExpandedNode({
11216
11264
  style: {
11217
11265
  opacity: 0
11218
11266
  }
11219
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$8, {
11267
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$7, {
11220
11268
  style: {
11221
11269
  opacity
11222
11270
  },
@@ -12468,7 +12516,7 @@ Identification.propTypes = {
12468
12516
  theme: PropTypes__default["default"].object
12469
12517
  };
12470
12518
 
12471
- const Style$7 = styled__default["default"].div`
12519
+ const Style$6 = styled__default["default"].div`
12472
12520
  position: absolute;
12473
12521
  display: flex;
12474
12522
  gap: 12px;
@@ -12483,7 +12531,7 @@ function Tooltip({
12483
12531
  mouseY = 0,
12484
12532
  children = null
12485
12533
  }) {
12486
- return /*#__PURE__*/jsxRuntime.jsx(Style$7, {
12534
+ return /*#__PURE__*/jsxRuntime.jsx(Style$6, {
12487
12535
  style: {
12488
12536
  top: mouseY,
12489
12537
  left: mouseX
@@ -15176,7 +15224,7 @@ const renderStatusTag = ({
15176
15224
  }
15177
15225
  };
15178
15226
 
15179
- const getColumns$c = ({
15227
+ const getColumns$b = ({
15180
15228
  t,
15181
15229
  goTo,
15182
15230
  user,
@@ -20833,7 +20881,7 @@ function Comments({
20833
20881
  });
20834
20882
  }
20835
20883
 
20836
- var Style$6 = styled__default["default"].div`
20884
+ var Style$5 = styled__default["default"].div`
20837
20885
  border: 1px solid var(--base-gray-40);
20838
20886
  padding: 12px;
20839
20887
  background: var(--base-gray-20);
@@ -20979,7 +21027,7 @@ function GroupInfoHOC({
20979
21027
  meta,
20980
21028
  t
20981
21029
  });
20982
- return /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
21030
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$5, {
20983
21031
  className: formatClassname([!isExpanded && 'collapsed', className, isSuccess && 'success']),
20984
21032
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
20985
21033
  className: "cont-header",
@@ -21136,7 +21184,7 @@ function GroupInfo({
21136
21184
  });
21137
21185
  }
21138
21186
  };
21139
- return /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
21187
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$5, {
21140
21188
  className: formatClassname([!isExpanded && 'collapsed', className]),
21141
21189
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
21142
21190
  className: "cont-header",
@@ -21177,7 +21225,7 @@ function GroupInfos({
21177
21225
  }, key));
21178
21226
  }
21179
21227
 
21180
- const Style$5 = styled__default["default"].div`
21228
+ const Style$4 = styled__default["default"].div`
21181
21229
  gap: 16px;
21182
21230
  display: flex;
21183
21231
  max-width: 465px;
@@ -21199,7 +21247,7 @@ function EvaluationPopover({
21199
21247
  t = s => s,
21200
21248
  evaluationConfig = []
21201
21249
  }) {
21202
- return /*#__PURE__*/jsxRuntime.jsx(Style$5, {
21250
+ return /*#__PURE__*/jsxRuntime.jsx(Style$4, {
21203
21251
  children: evaluationConfig.map(c =>
21204
21252
  /*#__PURE__*/
21205
21253
  //? ASK REDI
@@ -23171,7 +23219,7 @@ const useMapHelper = ({
23171
23219
  };
23172
23220
  };
23173
23221
 
23174
- const Style$4 = styled__default["default"].div`
23222
+ const Style$3 = styled__default["default"].div`
23175
23223
  width: 100%;
23176
23224
  height: 20rem;
23177
23225
  flex: 1;
@@ -23298,7 +23346,7 @@ function PolygonSelector({
23298
23346
  searchForLocation(mapRef);
23299
23347
  }
23300
23348
  }, [searchValue, mapRef]);
23301
- return /*#__PURE__*/jsxRuntime.jsxs(Style$4, {
23349
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$3, {
23302
23350
  className: "polygon-selector",
23303
23351
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
23304
23352
  className: "map-container",
@@ -30056,7 +30104,7 @@ const NavigationAction = ({
30056
30104
  });
30057
30105
  };
30058
30106
 
30059
- const getColumns$b = ({
30107
+ const getColumns$a = ({
30060
30108
  t,
30061
30109
  goTo,
30062
30110
  user,
@@ -30628,7 +30676,7 @@ const viewConfig$6 = {
30628
30676
  createTitle: "Create Worker"
30629
30677
  };
30630
30678
 
30631
- const getColumns$a = ({
30679
+ const getColumns$9 = ({
30632
30680
  t,
30633
30681
  goTo,
30634
30682
  user,
@@ -31130,7 +31178,7 @@ MoreTags.propTypes = {
31130
31178
  limit: PropTypes__default["default"].number
31131
31179
  };
31132
31180
 
31133
- const getColumns$9 = ({
31181
+ const getColumns$8 = ({
31134
31182
  t,
31135
31183
  goTo,
31136
31184
  user,
@@ -31585,7 +31633,7 @@ const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = fa
31585
31633
  return eventCategoryObject[key] || null;
31586
31634
  };
31587
31635
 
31588
- const getColumns$8 = ({
31636
+ const getColumns$7 = ({
31589
31637
  t,
31590
31638
  goTo,
31591
31639
  user,
@@ -32010,7 +32058,7 @@ const viewConfig$3 = {
32010
32058
  createTitle: "Create Incident"
32011
32059
  };
32012
32060
 
32013
- const getColumns$7 = ({
32061
+ const getColumns$6 = ({
32014
32062
  t,
32015
32063
  goTo,
32016
32064
  user,
@@ -32268,7 +32316,7 @@ const viewConfig$2 = {
32268
32316
  createTitle: "Create Location"
32269
32317
  };
32270
32318
 
32271
- const getColumns$6 = ({
32319
+ const getColumns$5 = ({
32272
32320
  t,
32273
32321
  goTo,
32274
32322
  user,
@@ -32682,7 +32730,7 @@ MoreOptions.propTypes = {
32682
32730
  limit: PropTypes__default["default"].number
32683
32731
  };
32684
32732
 
32685
- const getColumns$5 = ({
32733
+ const getColumns$4 = ({
32686
32734
  t,
32687
32735
  goTo,
32688
32736
  user,
@@ -32918,7 +32966,7 @@ const viewConfig = {
32918
32966
  createTitle: "Create Document"
32919
32967
  };
32920
32968
 
32921
- const getColumns$4 = ({
32969
+ const getColumns$3 = ({
32922
32970
  t,
32923
32971
  goTo,
32924
32972
  user,
@@ -33043,63 +33091,63 @@ const FILTER_REGISTRY = {
33043
33091
  options: getFilterOptions$a,
33044
33092
  formConfig: formConfig$8,
33045
33093
  viewConfig: viewConfig$8,
33046
- columns: getColumns$b
33094
+ columns: getColumns$a
33047
33095
  },
33048
33096
  workers: {
33049
33097
  config: getFiltersConfig$8,
33050
33098
  options: getFilterOptions$8,
33051
33099
  formConfig: formConfig$6,
33052
33100
  viewConfig: viewConfig$6,
33053
- columns: getColumns$a
33101
+ columns: getColumns$9
33054
33102
  },
33055
33103
  operators: {
33056
33104
  config: getFiltersConfig$9,
33057
33105
  options: getFilterOptions$9,
33058
33106
  formConfig: formConfig$7,
33059
33107
  viewConfig: viewConfig$7,
33060
- columns: getColumns$c
33108
+ columns: getColumns$b
33061
33109
  },
33062
33110
  events: {
33063
33111
  config: getFiltersConfig$7,
33064
33112
  options: getFilterOptions$7,
33065
33113
  formConfig: formConfig$5,
33066
33114
  viewConfig: viewConfig$5,
33067
- columns: getColumns$9
33115
+ columns: getColumns$8
33068
33116
  },
33069
33117
  activities: {
33070
33118
  config: getFiltersConfig$6,
33071
33119
  options: getFilterOptions$6,
33072
33120
  formConfig: formConfig$4,
33073
33121
  viewConfig: viewConfig$4,
33074
- columns: getColumns$8
33122
+ columns: getColumns$7
33075
33123
  },
33076
33124
  incidents: {
33077
33125
  config: getFiltersConfig$5,
33078
33126
  options: getFilterOptions$5,
33079
33127
  formConfig: formConfig$3,
33080
33128
  viewConfig: viewConfig$3,
33081
- columns: getColumns$7
33129
+ columns: getColumns$6
33082
33130
  },
33083
33131
  locations: {
33084
33132
  config: getFiltersConfig$4,
33085
33133
  options: getFilterOptions$4,
33086
33134
  formConfig: formConfig$2,
33087
33135
  viewConfig: viewConfig$2,
33088
- columns: getColumns$6
33136
+ columns: getColumns$5
33089
33137
  },
33090
33138
  'production-sites': {
33091
33139
  config: getFiltersConfig$3,
33092
33140
  options: getFilterOptions$3,
33093
33141
  formConfig: formConfig$1,
33094
33142
  viewConfig: viewConfig$1,
33095
- columns: getColumns$5
33143
+ columns: getColumns$4
33096
33144
  },
33097
33145
  documents: {
33098
33146
  config: getFiltersConfig$2,
33099
33147
  options: getFilterOptions$2,
33100
33148
  formConfig: formConfig,
33101
33149
  viewConfig: viewConfig,
33102
- columns: getColumns$4
33150
+ columns: getColumns$3
33103
33151
  }
33104
33152
  };
33105
33153
  const DEFAULT_SUBJECT = 'stakeholders';
@@ -33150,7 +33198,7 @@ const getViewConfig = ({
33150
33198
  return registry?.viewConfig;
33151
33199
  };
33152
33200
 
33153
- const getColumns$3 = ({
33201
+ const getColumns$2 = ({
33154
33202
  t,
33155
33203
  goTo,
33156
33204
  user,
@@ -33237,7 +33285,7 @@ const useTablePage = ({
33237
33285
  extendingFilters: extendingFilters,
33238
33286
  subject
33239
33287
  });
33240
- const columns = React.useMemo(() => getColumns$3({
33288
+ const columns = React.useMemo(() => getColumns$2({
33241
33289
  t,
33242
33290
  goTo,
33243
33291
  user,
@@ -33248,7 +33296,7 @@ const useTablePage = ({
33248
33296
  subject,
33249
33297
  data,
33250
33298
  applications
33251
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns$3]);
33299
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns$2]);
33252
33300
  const selectFiltersConfig = React.useMemo(() => getFiltersConfig$1({
33253
33301
  t,
33254
33302
  subject
@@ -33813,7 +33861,7 @@ const WorkersTable = ({
33813
33861
  getData: getData,
33814
33862
  getApiBaseUrl: getApiBaseUrl,
33815
33863
  getAppHeader: getAppHeader,
33816
- getColumns: getColumns$a,
33864
+ getColumns: getColumns$9,
33817
33865
  breadcrumbs: breadcrumbs,
33818
33866
  extendingFilters: extendingFilters,
33819
33867
  formConfig: {
@@ -34038,7 +34086,7 @@ const ProductionSitesTable = ({
34038
34086
  });
34039
34087
  };
34040
34088
 
34041
- const getColumns$2 = ({
34089
+ const getColumns$1 = ({
34042
34090
  t,
34043
34091
  goTo,
34044
34092
  user,
@@ -34516,7 +34564,7 @@ const UsersTable = ({
34516
34564
  const params = new URLSearchParams(location?.search);
34517
34565
  const [openCreateModal, setOpenCreateModal] = React.useState(params.has("create"));
34518
34566
  const [userToEdit, setUserToEdit] = React.useState(null);
34519
- const columns = React.useMemo(() => getColumns$2({
34567
+ const columns = React.useMemo(() => getColumns$1({
34520
34568
  t,
34521
34569
  goTo,
34522
34570
  user,
@@ -34907,7 +34955,7 @@ const partnershipTypes = [{
34907
34955
  value: "exchange"
34908
34956
  }];
34909
34957
 
34910
- const getColumns$1 = ({
34958
+ const getColumns = ({
34911
34959
  t,
34912
34960
  accept,
34913
34961
  decline,
@@ -35417,7 +35465,7 @@ const Create = ({
35417
35465
  });
35418
35466
  };
35419
35467
 
35420
- const Style$3 = styled__default["default"].div`
35468
+ const Style$2 = styled__default["default"].div`
35421
35469
  display: flex;
35422
35470
  gap: 8px;
35423
35471
  justify-content: center;
@@ -35440,7 +35488,7 @@ function Footer({
35440
35488
  disabledFooterText,
35441
35489
  disabledFooter
35442
35490
  }) {
35443
- return /*#__PURE__*/jsxRuntime.jsxs(Style$3, {
35491
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$2, {
35444
35492
  className: className,
35445
35493
  children: [disabledFooterText ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
35446
35494
  title: t(disabledFooterText),
@@ -35652,7 +35700,7 @@ const PartnersTable = ({
35652
35700
  setTotalRequests,
35653
35701
  t
35654
35702
  });
35655
- const columns = React.useMemo(() => getColumns$1({
35703
+ const columns = React.useMemo(() => getColumns({
35656
35704
  t,
35657
35705
  accept,
35658
35706
  decline,
@@ -37819,63 +37867,7 @@ const OperatorSummary = ({
37819
37867
  });
37820
37868
  };
37821
37869
 
37822
- function StickyTable({
37823
- size = "small",
37824
- maxHeight = 300,
37825
- containerHeight = 525,
37826
- dataSource = [],
37827
- columns = {},
37828
- pagination = false,
37829
- doEmptyRows = true,
37830
- ...props
37831
- }) {
37832
- const data = React__default["default"].useMemo(() => {
37833
- if (!doEmptyRows) {
37834
- return dataSource;
37835
- }
37836
- const MIN_ROWS = 4;
37837
- if (dataSource.length < MIN_ROWS) {
37838
- const paddedData = [...dataSource];
37839
- while (paddedData.length < MIN_ROWS) {
37840
- paddedData.push({
37841
- empty: true
37842
- });
37843
- }
37844
- return paddedData;
37845
- }
37846
- return dataSource;
37847
- }, [dataSource, doEmptyRows]);
37848
- const Wrapper = React__default["default"].useMemo(() => {
37849
- return data.length > 5 ? ComponentWithFocus : "div";
37850
- }, [data.length]);
37851
- return /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
37852
- children: /*#__PURE__*/jsxRuntime.jsx(Style$2, {
37853
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
37854
- className: "daf-table-wrapper",
37855
- style: {
37856
- maxHeight: containerHeight,
37857
- overflowY: "auto"
37858
- },
37859
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
37860
- className: "daf-sticky-table",
37861
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Table, {
37862
- ...props,
37863
- size: size,
37864
- scroll: true,
37865
- sticky: true,
37866
- style: {
37867
- maxHeight
37868
- },
37869
- dataSource: data,
37870
- columns: columns,
37871
- pagination: pagination
37872
- })
37873
- })
37874
- })
37875
- })
37876
- });
37877
- }
37878
- const Style$2 = styled__default["default"].div`
37870
+ styled__default["default"].div`
37879
37871
  max-width: calc(100% - 48px);
37880
37872
  margin-left: var(--size-lg);
37881
37873
  overflow: hidden;
@@ -37899,13 +37891,13 @@ const Style$2 = styled__default["default"].div`
37899
37891
  padding-top: 16px;
37900
37892
  }
37901
37893
  `;
37902
- StickyTable.propTypes = {
37894
+ ({
37903
37895
  size: PropTypes__default["default"].any,
37904
37896
  maxHeight: PropTypes__default["default"].number,
37905
37897
  dataSource: PropTypes__default["default"].array,
37906
37898
  columns: PropTypes__default["default"].object,
37907
37899
  pagination: PropTypes__default["default"].any
37908
- };
37900
+ });
37909
37901
 
37910
37902
  ({
37911
37903
  content: PropTypes__default["default"].string,
@@ -41859,13 +41851,6 @@ styled__default["default"].div`
41859
41851
  }
41860
41852
  `;
41861
41853
 
41862
- const getRedirectLink = (link, APP) => {
41863
- if (window.location.pathname.includes(`/${APP}`)) {
41864
- return `${APP}${link}`;
41865
- }
41866
- return link;
41867
- };
41868
-
41869
41854
  styled__default["default"].div`
41870
41855
  display: flex;
41871
41856
  flex-direction: column;
@@ -43893,6 +43878,7 @@ const JobsTimeline = ({
43893
43878
  loading = false,
43894
43879
  t = s => s
43895
43880
  }) => {
43881
+ console.log('dayJobsTimeline', dayJobsTimeline);
43896
43882
  const jobsData = Array.isArray(dayJobsTimeline) ? dayJobsTimeline : dayJobsTimeline?.jobsTimeline || dayJobsTimeline?.jobs || dayJobsTimeline?.timeline || [];
43897
43883
  const formatDateAxis = React.useMemo(() => {
43898
43884
  return label => {
@@ -44252,739 +44238,37 @@ const CommunityParticipation = ({
44252
44238
  });
44253
44239
  };
44254
44240
 
44255
- const ACTIVITIES_TAB$1 = 'activities';
44256
- const PARTNERS_TAB$1 = 'partners';
44257
- const INCIDENTS_TAB$1 = 'incidents';
44258
- const getColumns = ({
44259
- projectId,
44260
- t,
44261
- show = 'show',
44262
- navigate,
44263
- selectOptions,
44264
- view,
44265
- getRedirectLink,
44266
- activeTab = ACTIVITIES_TAB$1
44267
- }) => {
44268
- if (activeTab === ACTIVITIES_TAB$1) {
44269
- return [{
44270
- title: "",
44271
- dataIndex: 'image',
44272
- key: 'image',
44273
- active: true,
44274
- width: 80,
44275
- pending: true,
44276
- suspended: true,
44277
- ellipsis: true,
44278
- render: (v, all) => {
44279
- if (all.empty) {
44280
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44281
- className: "daf-default-cell"
44282
- });
44283
- }
44284
- const firstGroupPhoto = all?.groupPhotos?.[0];
44285
- const pictures = firstGroupPhoto?.pictures;
44286
- const firstPicture = Array.isArray(pictures) && pictures.length > 0 ? pictures[0] : null;
44287
- let imageUrl = firstPicture?.url;
44288
- const normalizeUrl = url => url?.endsWith(':') ? url.slice(0, -1) : url;
44289
- let normalizedUrl = imageUrl ? normalizeUrl(imageUrl.trim()) : null;
44290
- if (normalizedUrl && !normalizedUrl.startsWith('http://') && !normalizedUrl.startsWith('https://') && !normalizedUrl.startsWith('//')) {
44291
- if (normalizedUrl.startsWith('cdn.') || normalizedUrl.includes('.') && !normalizedUrl.startsWith('/')) {
44292
- normalizedUrl = `https://${normalizedUrl}`;
44293
- }
44294
- }
44295
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44296
- className: "daf-default-cell",
44297
- style: {
44298
- display: 'flex',
44299
- alignItems: 'center',
44300
- justifyContent: 'center'
44301
- },
44302
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
44303
- style: {
44304
- width: 32,
44305
- height: 32,
44306
- borderWidth: '1px',
44307
- borderStyle: 'solid',
44308
- borderColor: '#E5E7EB',
44309
- borderRadius: '6px',
44310
- background: '#F9FAFB',
44311
- display: 'flex',
44312
- alignItems: 'center',
44313
- justifyContent: 'center',
44314
- overflow: 'hidden',
44315
- position: 'relative'
44316
- },
44317
- children: normalizedUrl && /*#__PURE__*/jsxRuntime.jsx("img", {
44318
- src: normalizedUrl,
44319
- alt: all.name || 'Activity image',
44320
- style: {
44321
- width: '100%',
44322
- height: '100%',
44323
- objectFit: 'cover',
44324
- borderRadius: '6px'
44325
- },
44326
- onError: e => {
44327
- e.target.style.display = 'none';
44328
- }
44329
- })
44330
- })
44331
- });
44332
- }
44333
- }, {
44334
- title: t('ID'),
44335
- dataIndex: 'datastakeId',
44336
- key: 'datastakeId',
44337
- active: true,
44338
- pending: true,
44339
- suspended: true,
44340
- ellipsis: true,
44341
- render: (v, all) => {
44342
- if (all.empty) {
44343
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44344
- className: "daf-default-cell"
44345
- });
44346
- }
44347
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44348
- className: "daf-default-cell",
44349
- children: all.datastakeId
44350
- });
44351
- }
44352
- }, {
44353
- title: t("Title"),
44354
- dataIndex: "name",
44355
- key: "name",
44356
- ellipsis: true,
44357
- active: true,
44358
- pending: true,
44359
- suspended: true,
44360
- render: value => /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44361
- title: value,
44362
- children: value
44363
- })
44364
- }, {
44365
- title: t("Type"),
44366
- dataIndex: "type",
44367
- key: "type",
44368
- ellipsis: true,
44369
- active: true,
44370
- pending: true,
44371
- suspended: true,
44372
- render: (value, all) => {
44373
- if (all.empty) {
44374
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44375
- className: "daf-default-cell"
44376
- });
44377
- }
44378
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44379
- title: value,
44380
- children: value?.toUpperCase().charAt(0) + value?.slice(1) || '-'
44381
- });
44382
- }
44383
- }, {
44384
- title: t("Location"),
44385
- dataIndex: "location",
44386
- key: "location",
44387
- ellipsis: true,
44388
- active: true,
44389
- pending: true,
44390
- width: 220,
44391
- suspended: true,
44392
- show: true,
44393
- render: (value, all) => {
44394
- if (all.empty) {
44395
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44396
- className: "daf-default-cell"
44397
- });
44398
- }
44399
- const location = all.location || value;
44400
- if (location && typeof location === 'object' && typeof location.latitude === 'number' && typeof location.longitude === 'number') {
44401
- const coordinates = convertDMS(location.latitude, location.longitude);
44402
- const iconColor = "#016C6E";
44403
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
44404
- style: {
44405
- display: 'flex',
44406
- alignItems: 'center',
44407
- gap: '8px',
44408
- flexWrap: 'nowrap'
44409
- },
44410
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
44411
- style: {
44412
- display: 'flex',
44413
- alignItems: 'center',
44414
- gap: '4px'
44415
- },
44416
- children: [/*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
44417
- name: "SpacingHeight",
44418
- width: 14,
44419
- height: 14,
44420
- fill: iconColor
44421
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
44422
- children: coordinates[0]
44423
- })]
44424
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
44425
- style: {
44426
- display: 'flex',
44427
- alignItems: 'center',
44428
- gap: '4px'
44429
- },
44430
- children: [/*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
44431
- name: "SpacingWidth",
44432
- width: 14,
44433
- height: 14,
44434
- fill: iconColor
44435
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
44436
- children: coordinates[1]
44437
- })]
44438
- })]
44439
- });
44440
- }
44441
- let locationDisplay = '-';
44442
- if (all.project?.name || all.project?.title) {
44443
- locationDisplay = all.project?.name || all.project?.title;
44444
- } else if (location?.name) {
44445
- locationDisplay = location.name;
44446
- } else if (value && typeof value === 'string') {
44447
- locationDisplay = value;
44448
- }
44449
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44450
- title: locationDisplay,
44451
- children: locationDisplay
44452
- });
44453
- }
44454
- }, {
44455
- title: t("Implementer"),
44456
- dataIndex: "technicalPartner",
44457
- key: "implementer",
44458
- ellipsis: true,
44459
- show: true,
44460
- render: (value, all) => {
44461
- if (all.empty) {
44462
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44463
- className: "daf-default-cell"
44464
- });
44465
- }
44466
- const implementerName = all.technicalPartner || all.implementer?.name || all.implementer?.title || value || '-';
44467
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44468
- title: implementerName,
44469
- children: implementerName
44470
- });
44471
- }
44472
- }, {
44473
- title: t("Status"),
44474
- dataIndex: "published",
44475
- key: "published",
44476
- ellipsis: false,
44477
- show: true,
44478
- render: (value, all) => {
44479
- if (all.empty) {
44480
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44481
- className: "daf-default-cell"
44482
- });
44483
- }
44484
- let statusDisplay = '-';
44485
- let color = 'default';
44486
- if (value !== undefined) {
44487
- statusDisplay = value ? t('Published') : t('Unpublished');
44488
- color = value ? 'green' : 'default';
44489
- }
44490
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
44491
- color: color,
44492
- style: {
44493
- width: 100
44494
- },
44495
- className: "text-center",
44496
- children: t(statusDisplay)
44497
- });
44498
- }
44499
- }, {
44500
- title: t("Date"),
44501
- dataIndex: "lastUpdated",
44502
- key: "lastUpdated",
44503
- ellipsis: true,
44504
- active: true,
44505
- pending: false,
44506
- suspended: true,
44507
- show: true,
44508
- render: (val, all) => {
44509
- if (all.empty) {
44510
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44511
- className: "daf-default-cell"
44512
- });
44513
- }
44514
- const title = renderDateFormatted(all.updatedAt || all.date, "DD MMM YYYY");
44515
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44516
- title: title,
44517
- children: title
44518
- });
44519
- }
44520
- }, {
44521
- title: "",
44522
- dataIndex: "actions",
44523
- key: "actions",
44524
- width: 60,
44525
- render: (_, val) => {
44526
- if (val.empty) {
44527
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44528
- className: "daf-default-cell"
44529
- });
44530
- }
44531
- const items = [{
44532
- key: "viewSummary",
44533
- label: t("Summary"),
44534
- onClick: () => {
44535
- const link = `/app/projects/${projectId}/restoration/summary/${val.datastakeId}`;
44536
- navigate(getRedirectLink(link));
44537
- }
44538
- }, {
44539
- key: "viewDetails",
44540
- label: t("Details"),
44541
- onClick: () => {
44542
- const link = `/app/projects/${projectId}/restoration/view/general/${val.datastakeId}/identification`;
44543
- navigate(getRedirectLink(link));
44544
- }
44545
- }];
44546
- return /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
44547
- items: items
44548
- });
44549
- },
44550
- ellipsis: true
44551
- }];
44552
- }
44553
- if (activeTab === PARTNERS_TAB$1) {
44554
- return [{
44555
- title: t('ID'),
44556
- dataIndex: 'datastakeId',
44557
- key: 'datastakeId',
44558
- ellipsis: true,
44559
- width: 160,
44560
- render: (v, all) => {
44561
- if (all.empty) {
44562
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44563
- className: "daf-default-cell"
44564
- });
44565
- }
44566
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44567
- title: v,
44568
- children: v || '-'
44569
- });
44570
- }
44571
- }, {
44572
- title: t("Name"),
44573
- dataIndex: "name",
44574
- key: "name",
44575
- ellipsis: true,
44576
- render: (value, all) => {
44577
- if (all.empty) {
44578
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44579
- className: "daf-default-cell"
44580
- });
44581
- }
44582
- const name = value || all.nickName || '-';
44583
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44584
- title: name,
44585
- children: name
44586
- });
44587
- }
44588
- }, {
44589
- title: t("Category"),
44590
- dataIndex: "category",
44591
- key: "category",
44592
- ellipsis: true,
44593
- render: (value, all) => {
44594
- if (all.empty) {
44595
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44596
- className: "daf-default-cell"
44597
- });
44598
- }
44599
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44600
- title: value,
44601
- children: value || '-'
44602
- });
44603
- }
44604
- }, {
44605
- title: t("Subcategory"),
44606
- dataIndex: "subcategory",
44607
- key: "subcategory",
44608
- ellipsis: true,
44609
- render: (value, all) => {
44610
- if (all.empty) {
44611
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44612
- className: "daf-default-cell"
44613
- });
44614
- }
44615
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44616
- title: value,
44617
- children: value || '-'
44618
- });
44619
- }
44620
- }, {
44621
- title: t("Country"),
44622
- dataIndex: "country",
44623
- key: "country",
44624
- ellipsis: true,
44625
- render: (value, all) => {
44626
- if (all.empty) {
44627
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44628
- className: "daf-default-cell"
44629
- });
44630
- }
44631
- let country = '-';
44632
- if (value) {
44633
- country = value;
44634
- } else if (all.country?.name) {
44635
- country = all.country.name;
44636
- } else if (all.location && typeof all.location === 'object' && all.location.country) {
44637
- country = all.location.country;
44638
- } else if (all.location && typeof all.location === 'object' && all.location.name) {
44639
- country = all.location.name;
44640
- }
44641
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44642
- title: country,
44643
- children: country
44644
- });
44645
- }
44646
- }, {
44647
- title: t("Last Update"),
44648
- dataIndex: "lastUpdated",
44649
- key: "lastUpdated",
44650
- ellipsis: true,
44651
- render: (val, all) => {
44652
- if (all.empty) {
44653
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44654
- className: "daf-default-cell"
44655
- });
44656
- }
44657
- const title = renderDateFormatted(all.updatedAt || all.lastUpdated, "DD MMM YYYY");
44658
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44659
- title: title,
44660
- children: title
44661
- });
44662
- }
44663
- }, {
44664
- title: t(''),
44665
- dataIndex: 'actions',
44666
- key: 'actions',
44667
- width: 60,
44668
- render: (_, record) => {
44669
- const onClick = () => {
44670
- record.id;
44671
- const link = `/app/projects/${projectId}/implementation-partners/view/general/${record?.datastakeId}/identification`;
44672
- navigate(getRedirectLink(link));
44673
- };
44674
- return !record.empty ? /*#__PURE__*/jsxRuntime.jsx("div", {
44675
- className: "cursor-pointer",
44676
- onClick: onClick,
44677
- children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
44678
- name: "Link",
44679
- width: 16,
44680
- height: 16,
44681
- color: "#6C737F"
44682
- })
44683
- }) : null;
44684
- },
44685
- active: true,
44686
- pending: true,
44687
- suspended: true
44688
- }];
44689
- }
44690
- if (activeTab === INCIDENTS_TAB$1) {
44691
- return [{
44692
- title: t('ID'),
44693
- dataIndex: 'datastakeId',
44694
- key: 'datastakeId',
44695
- ellipsis: true,
44696
- width: 160,
44697
- render: (v, all) => {
44698
- if (all.empty) {
44699
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44700
- className: "daf-default-cell"
44701
- });
44702
- }
44703
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44704
- title: v,
44705
- children: v
44706
- });
44707
- }
44708
- }, {
44709
- title: t("Title"),
44710
- dataIndex: "name",
44711
- key: "name",
44712
- ellipsis: true,
44713
- render: value => /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44714
- title: value,
44715
- children: value
44716
- })
44717
- }, {
44718
- title: t("Date"),
44719
- dataIndex: "date",
44720
- key: "date",
44721
- ellipsis: true,
44722
- render: (val, all) => {
44723
- if (all.empty) {
44724
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44725
- className: "daf-default-cell"
44726
- });
44727
- }
44728
- const title = renderDateFormatted(all.date || all.updatedAt, "DD MMM YYYY");
44729
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44730
- title: title,
44731
- children: title
44732
- });
44733
- }
44734
- }, {
44735
- title: t("Location"),
44736
- dataIndex: "location",
44737
- key: "location",
44738
- ellipsis: true,
44739
- render: (value, all) => {
44740
- if (all.empty) {
44741
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44742
- className: "daf-default-cell"
44743
- });
44744
- }
44745
- let locationDisplay = '-';
44746
- if (all.location?.name) {
44747
- locationDisplay = all.location.name;
44748
- } else if (all.mineSite?.name) {
44749
- locationDisplay = all.mineSite.name;
44750
- } else if (all.location && typeof all.location === 'object' && all.location.latitude && all.location.longitude) {
44751
- locationDisplay = `${all.location.latitude.toFixed(6)}, ${all.location.longitude.toFixed(6)}`;
44752
- } else if (value && typeof value === 'string') {
44753
- locationDisplay = value;
44754
- }
44755
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44756
- title: locationDisplay,
44757
- children: locationDisplay
44758
- });
44759
- }
44760
- }, {
44761
- title: t("Province"),
44762
- dataIndex: "province",
44763
- key: "province",
44764
- ellipsis: true,
44765
- render: (value, all) => {
44766
- if (all.empty) {
44767
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44768
- className: "daf-default-cell"
44769
- });
44770
- }
44771
- let province = '-';
44772
- if (all.province) {
44773
- province = all.province;
44774
- } else if (all.location && typeof all.location === 'object' && all.location.administrativeLevel1) {
44775
- province = all.location.administrativeLevel1;
44776
- }
44777
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44778
- title: province,
44779
- children: province
44780
- });
44781
- }
44782
- }, {
44783
- title: t("Territory"),
44784
- dataIndex: "territory",
44785
- key: "territory",
44786
- ellipsis: true,
44787
- render: (value, all) => {
44788
- if (all.empty) {
44789
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44790
- className: "daf-default-cell"
44791
- });
44792
- }
44793
- let territory = '-';
44794
- if (all.territory) {
44795
- territory = all.territory;
44796
- } else if (all.location && typeof all.location === 'object' && all.location.administrativeLevel2) {
44797
- territory = all.location.administrativeLevel2;
44798
- }
44799
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44800
- title: territory,
44801
- children: territory
44802
- });
44803
- }
44804
- }, {
44805
- title: t("Category"),
44806
- dataIndex: "category",
44807
- key: "category",
44808
- ellipsis: true,
44809
- render: (value, all) => {
44810
- if (all.empty) {
44811
- return /*#__PURE__*/jsxRuntime.jsx("div", {
44812
- className: "daf-default-cell"
44813
- });
44814
- }
44815
- const category = all.eventCategory || all.category || value || '-';
44816
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
44817
- title: category,
44818
- children: category
44819
- });
44820
- }
44821
- }, {
44822
- title: t(''),
44823
- dataIndex: 'actions',
44824
- key: 'actions',
44825
- width: 60,
44826
- render: (_, record) => {
44827
- const onClick = () => {
44828
- const link = `/app/projects/${projectId}/implementation-partners/view/general/${record.datastakeId}/identification`;
44829
- getRedirectLink(link);
44830
- };
44831
- return !record.empty ? /*#__PURE__*/jsxRuntime.jsx("div", {
44832
- className: "cursor-pointer",
44833
- onClick: onClick,
44834
- children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
44835
- name: "Link",
44836
- width: 16,
44837
- height: 16,
44838
- color: "#6C737F"
44839
- })
44840
- }) : null;
44841
- },
44842
- active: true,
44843
- pending: true,
44844
- suspended: true
44845
- }];
44846
- }
44847
- return [];
44848
- };
44849
-
44850
44241
  const ACTIVITIES_TAB = 'activities';
44851
44242
  const PARTNERS_TAB = 'partners';
44852
44243
  const INCIDENTS_TAB = 'incidents';
44853
- const DEFAULT_SEARCH_FIELDS = ["name", "datastakeId"];
44854
- const URL_PATTERN = /\/summary\/[^/]+\/(.+)/;
44855
-
44856
- // Configuration
44857
- const TABS_CONFIG = [{
44858
- label: "straatos::activities",
44859
- value: ACTIVITIES_TAB
44860
- }, {
44861
- label: "straatos::partners",
44862
- value: PARTNERS_TAB
44863
- }, {
44864
- label: "straatos::incidents",
44865
- value: INCIDENTS_TAB,
44866
- disabled: true
44867
- }];
44868
-
44869
- // Helper functions
44870
- const getSearchFields = activeTab => DEFAULT_SEARCH_FIELDS;
44871
- const buildSearchFilter = (search, fields) => search ? {
44872
- search: {
44873
- qs: search,
44874
- fields
44875
- }
44876
- } : {};
44877
- const extractTypeFromUrl = url => {
44878
- const match = url.match(URL_PATTERN);
44879
- if (!match) {
44880
- throw new Error(`Invalid URL format: ${url}`);
44881
- }
44882
- return match[1];
44883
- };
44884
- const ensureArray = data => Array.isArray(data) ? data : [];
44885
44244
  const AssociatedInformation = ({
44886
- id,
44887
- navigate,
44888
- getSummaryDetail,
44245
+ activityData,
44889
44246
  loading = false,
44890
- projectId,
44891
- basepath = "planting-cycle",
44892
- endpoint = "associated-information",
44893
- tabsConfig = TABS_CONFIG,
44894
- searchFieldsMap = getSearchFields,
44895
44247
  t = s => s
44896
44248
  }) => {
44897
44249
  const [activeTab, setActiveTab] = React.useState(ACTIVITIES_TAB);
44898
- const [search, setSearch] = React.useState('');
44899
- const searchFields = React.useMemo(() => searchFieldsMap(activeTab), [activeTab, searchFieldsMap]);
44900
- const filters = React.useMemo(() => ({
44901
- type: activeTab,
44902
- ...buildSearchFilter(search, searchFields)
44903
- }), [activeTab, search, searchFields]);
44904
- const defaultConfig = React.useMemo(() => ({
44905
- basepath,
44906
- url: `/summary/${id}/${endpoint}`,
44907
- filters,
44908
- stop: !id
44909
- }), [id, filters, basepath, endpoint]);
44910
- const customGetData = React.useMemo(() => {
44911
- if (!getSummaryDetail || !id) return undefined;
44912
- return rest => {
44913
- const {
44914
- url,
44915
- filters: restFilters
44916
- } = rest;
44917
- const type = extractTypeFromUrl(url);
44918
- const params = {
44919
- ...(restFilters || {}),
44920
- type: restFilters?.type || activeTab
44921
- };
44922
- return getSummaryDetail(id, type, params);
44923
- };
44924
- }, [getSummaryDetail, id, activeTab]);
44925
- const {
44926
- loading: associatedInformationLoading,
44927
- data: associatedInformationData,
44928
- setData
44929
- } = useWidgetFetch({
44930
- config: defaultConfig,
44931
- getData: customGetData
44932
- });
44933
-
44934
- // Reset data and search when tab changes
44935
- React.useEffect(() => {
44936
- setData([]);
44937
- setSearch('');
44938
- }, [activeTab, setData]);
44939
- const handleSearch = React.useCallback((activeFilter, searchValue) => {
44940
- setSearch(searchValue || '');
44941
- }, []);
44942
- const handleTabChange = React.useCallback(value => {
44943
- setActiveTab(value);
44944
- }, []);
44945
- const columns = React.useMemo(() => getColumns({
44946
- t,
44947
- activeTab,
44948
- view: activeTab,
44949
- projectId,
44950
- navigate,
44951
- getRedirectLink
44952
- }), [t, activeTab, projectId, navigate]);
44953
- const tableDataSource = React.useMemo(() => ensureArray(associatedInformationData), [associatedInformationData]);
44954
- const translatedTabs = React.useMemo(() => tabsConfig.map(tab => ({
44955
- ...tab,
44956
- label: t(tab.label)
44957
- })), [tabsConfig, t]);
44958
44250
  return /*#__PURE__*/jsxRuntime.jsx("section", {
44959
- children: /*#__PURE__*/jsxRuntime.jsxs(Widget, {
44960
- className: "v2-widget no-px no-p-body h-w-btn-header with-border-header",
44251
+ children: /*#__PURE__*/jsxRuntime.jsx(Widget, {
44252
+ className: "v2-widget no-px h-w-btn-header no-p-body",
44961
44253
  title: t("Associated Information"),
44962
44254
  tabsConfig: {
44963
- tabs: translatedTabs,
44255
+ tabs: [{
44256
+ label: t("straatos::activities"),
44257
+ value: ACTIVITIES_TAB
44258
+ }, {
44259
+ label: t("straatos::partners"),
44260
+ value: PARTNERS_TAB
44261
+ }, {
44262
+ label: t("straatos::incidents"),
44263
+ value: INCIDENTS_TAB
44264
+ }],
44964
44265
  value: activeTab,
44965
- onChange: handleTabChange
44266
+ onChange: value => {
44267
+ setActiveTab(value);
44268
+ // setData([]);
44269
+ }
44966
44270
  },
44967
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
44968
- className: "mt-6 ml-6 mr-6",
44969
- children: /*#__PURE__*/jsxRuntime.jsx(SearchFilters, {
44970
- t: t,
44971
- showFilter: false,
44972
- hasError: false,
44973
- canClear: true,
44974
- setHasError: () => {},
44975
- onSearch: handleSearch,
44976
- activeFilters: {
44977
- search
44978
- }
44979
- })
44980
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
44981
- className: "mb-6",
44982
- children: /*#__PURE__*/jsxRuntime.jsx(StickyTable, {
44983
- columns: columns,
44984
- dataSource: tableDataSource,
44985
- loading: associatedInformationLoading || loading
44986
- })
44987
- })]
44271
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {})
44988
44272
  })
44989
44273
  });
44990
44274
  };
@@ -45081,14 +44365,12 @@ const PlantingCycleSummary = ({
45081
44365
  activityData,
45082
44366
  loading = false,
45083
44367
  id,
45084
- projectId,
45085
44368
  t = () => {},
45086
- getSummaryDetail,
45087
- navigate
44369
+ getSummaryDetail
45088
44370
  }) => {
45089
44371
  return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
45090
44372
  header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
45091
- title: header?.title + ' Summary' || '',
44373
+ title: header?.title || '',
45092
44374
  supportText: header?.supportText || '',
45093
44375
  onDownload: header?.onDownload,
45094
44376
  downloadDisabled: header?.downloadDisabled,
@@ -45124,11 +44406,9 @@ const PlantingCycleSummary = ({
45124
44406
  t: t
45125
44407
  }), /*#__PURE__*/jsxRuntime.jsx(AssociatedInformation, {
45126
44408
  id: id,
45127
- projectId: projectId,
45128
44409
  getSummaryDetail: getSummaryDetail,
45129
44410
  loading: loading,
45130
- t: t,
45131
- navigate: navigate
44411
+ t: t
45132
44412
  })]
45133
44413
  });
45134
44414
  };