datastake-daf 0.6.771 → 0.6.773

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$f = styled__default["default"].div`
7072
+ const Style$g = 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$f, {
7470
+ children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$g, {
7471
7471
  className: formatClassname(["flex", className]),
7472
7472
  children: config.map((c, i) => /*#__PURE__*/jsxRuntime.jsxs("div", {
7473
7473
  className: "row-item",
@@ -7563,7 +7563,7 @@ KeyIndicators$1.propTypes = {
7563
7563
  goTo: PropTypes__default["default"].func
7564
7564
  };
7565
7565
 
7566
- const Style$e = styled__default["default"].div`
7566
+ const Style$f = styled__default["default"].div`
7567
7567
  display: flex;
7568
7568
  flex-direction: row;
7569
7569
  position: relative;
@@ -9104,7 +9104,7 @@ function LocationIcon({
9104
9104
  });
9105
9105
  }
9106
9106
 
9107
- const Style$d = styled__default["default"].div`
9107
+ const Style$e = styled__default["default"].div`
9108
9108
  .main {
9109
9109
  width: 24px;
9110
9110
  height: 24px;
@@ -9249,7 +9249,7 @@ function StakeholderIcon({
9249
9249
  onClickLink: () => onClickLink(marker)
9250
9250
  }),
9251
9251
  getPopupContainer: () => document.getElementById("map"),
9252
- children: /*#__PURE__*/jsxRuntime.jsx(Style$d
9252
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$e
9253
9253
  // onClick={toggleOpen}
9254
9254
  , {
9255
9255
  className: `map-marker marker closed`,
@@ -9262,7 +9262,7 @@ function StakeholderIcon({
9262
9262
  })
9263
9263
  });
9264
9264
  }
9265
- return /*#__PURE__*/jsxRuntime.jsxs(Style$d, {
9265
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$e, {
9266
9266
  onClick: toggleOpen,
9267
9267
  className: `map-marker marker ${isActive ? "opened" : "closed"}`,
9268
9268
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -9901,7 +9901,8 @@ const useMap = ({
9901
9901
  const excludedType = ['village', 'town', 'area', 'territory'];
9902
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)))));
9903
9903
  const maxTotal = Math.max(...(data || []).map(d => d.total));
9904
- filteredData.forEach((d, i) => {
9904
+ const dataToRender = type === "chain" ? filteredData : data;
9905
+ dataToRender.forEach((d, i) => {
9905
9906
  addIconToMapInitialy([d?.marker?.lat, d?.marker?.lng], "location", d.category || "mineSite", d, maxTotal, i);
9906
9907
  });
9907
9908
  polylinesRef.current.forEach(polyline => {
@@ -10067,7 +10068,7 @@ const useMap = ({
10067
10068
  };
10068
10069
  };
10069
10070
 
10070
- const Style$c = styled__default["default"].div`
10071
+ const Style$d = styled__default["default"].div`
10071
10072
  position: relative;
10072
10073
  width: 100%;
10073
10074
  height: 100%;
@@ -10140,7 +10141,7 @@ function ComponentWithFocus({
10140
10141
  setClosed(false);
10141
10142
  }
10142
10143
  }, [closed]);
10143
- return /*#__PURE__*/jsxRuntime.jsxs(Style$c, {
10144
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$d, {
10144
10145
  className: className,
10145
10146
  ref: ref,
10146
10147
  style: style,
@@ -10152,7 +10153,7 @@ function ComponentWithFocus({
10152
10153
  });
10153
10154
  }
10154
10155
 
10155
- const Style$b = styled__default["default"].div`
10156
+ const Style$c = styled__default["default"].div`
10156
10157
  position: absolute;
10157
10158
  top: 24px;
10158
10159
  left: 24px;
@@ -10327,7 +10328,7 @@ function Filters({
10327
10328
  return null;
10328
10329
  }
10329
10330
  };
10330
- return /*#__PURE__*/jsxRuntime.jsxs(Style$b, {
10331
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$c, {
10331
10332
  children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
10332
10333
  onClick: () => setOpened(p => !p),
10333
10334
  children: [t("Filter"), /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
@@ -10408,7 +10409,7 @@ function Map$1({
10408
10409
  isSatellite
10409
10410
  });
10410
10411
  return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
10411
- children: /*#__PURE__*/jsxRuntime.jsxs(Style$e, {
10412
+ children: /*#__PURE__*/jsxRuntime.jsxs(Style$f, {
10412
10413
  className: formatClassname([showSider && activeMarker && "with-sider"]),
10413
10414
  children: [filtersConfig ? /*#__PURE__*/jsxRuntime.jsx(Filters, {
10414
10415
  t: t,
@@ -10617,7 +10618,7 @@ function PrimaryNode({
10617
10618
  style: {
10618
10619
  opacity: 0
10619
10620
  }
10620
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$a, {
10621
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$b, {
10621
10622
  $isPdf: isPdf,
10622
10623
  className: "flex",
10623
10624
  children: [" ", /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -10728,7 +10729,7 @@ function PrimaryNode({
10728
10729
  })]
10729
10730
  });
10730
10731
  }
10731
- const Style$a = styled__default["default"].div`
10732
+ const Style$b = styled__default["default"].div`
10732
10733
  width: ${MAIN_NODE_WIDTH}px;
10733
10734
  height: ${MAIN_NODE_HEIGHT}px; /* Explicitly set height */
10734
10735
  display: flex;
@@ -10864,7 +10865,7 @@ function IconNode({
10864
10865
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
10865
10866
  title: data?.name,
10866
10867
  defaultOpen: data?.ONLY_IN_STORYBOOK,
10867
- children: /*#__PURE__*/jsxRuntime.jsx(Style$9, {
10868
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$a, {
10868
10869
  hoverColor: data?.iconHoverColor,
10869
10870
  children: /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
10870
10871
  theme: {
@@ -10907,7 +10908,7 @@ function IconNode({
10907
10908
  })]
10908
10909
  });
10909
10910
  }
10910
- const Style$9 = styled__default["default"].div`
10911
+ const Style$a = styled__default["default"].div`
10911
10912
  height: 40px;
10912
10913
  width: 40px;
10913
10914
 
@@ -10985,7 +10986,7 @@ function NameNode({
10985
10986
  style: {
10986
10987
  opacity: 0
10987
10988
  }
10988
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$8, {
10989
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$9, {
10989
10990
  $isPdf: isPdf,
10990
10991
  style: {
10991
10992
  opacity: data.isEmpty ? 0.5 : 1
@@ -11073,7 +11074,7 @@ function NameNode({
11073
11074
  })]
11074
11075
  });
11075
11076
  }
11076
- const Style$8 = styled__default["default"].div`
11077
+ const Style$9 = styled__default["default"].div`
11077
11078
  width: ${NAME_CARD_WIDTH}px;
11078
11079
  height: 55px;
11079
11080
  display: flex;
@@ -11104,7 +11105,7 @@ const Style$8 = styled__default["default"].div`
11104
11105
  }
11105
11106
  `;
11106
11107
 
11107
- const Style$7 = styled__default["default"].div`
11108
+ const Style$8 = styled__default["default"].div`
11108
11109
  width: 405px;
11109
11110
  display: flex;
11110
11111
  height: 140px;
@@ -11215,7 +11216,7 @@ function ExpandedNode({
11215
11216
  style: {
11216
11217
  opacity: 0
11217
11218
  }
11218
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$7, {
11219
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$8, {
11219
11220
  style: {
11220
11221
  opacity
11221
11222
  },
@@ -12467,7 +12468,7 @@ Identification.propTypes = {
12467
12468
  theme: PropTypes__default["default"].object
12468
12469
  };
12469
12470
 
12470
- const Style$6 = styled__default["default"].div`
12471
+ const Style$7 = styled__default["default"].div`
12471
12472
  position: absolute;
12472
12473
  display: flex;
12473
12474
  gap: 12px;
@@ -12482,7 +12483,7 @@ function Tooltip({
12482
12483
  mouseY = 0,
12483
12484
  children = null
12484
12485
  }) {
12485
- return /*#__PURE__*/jsxRuntime.jsx(Style$6, {
12486
+ return /*#__PURE__*/jsxRuntime.jsx(Style$7, {
12486
12487
  style: {
12487
12488
  top: mouseY,
12488
12489
  left: mouseX
@@ -15175,7 +15176,7 @@ const renderStatusTag = ({
15175
15176
  }
15176
15177
  };
15177
15178
 
15178
- const getColumns$b = ({
15179
+ const getColumns$c = ({
15179
15180
  t,
15180
15181
  goTo,
15181
15182
  user,
@@ -20832,7 +20833,7 @@ function Comments({
20832
20833
  });
20833
20834
  }
20834
20835
 
20835
- var Style$5 = styled__default["default"].div`
20836
+ var Style$6 = styled__default["default"].div`
20836
20837
  border: 1px solid var(--base-gray-40);
20837
20838
  padding: 12px;
20838
20839
  background: var(--base-gray-20);
@@ -20978,7 +20979,7 @@ function GroupInfoHOC({
20978
20979
  meta,
20979
20980
  t
20980
20981
  });
20981
- return /*#__PURE__*/jsxRuntime.jsxs(Style$5, {
20982
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
20982
20983
  className: formatClassname([!isExpanded && 'collapsed', className, isSuccess && 'success']),
20983
20984
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
20984
20985
  className: "cont-header",
@@ -21135,7 +21136,7 @@ function GroupInfo({
21135
21136
  });
21136
21137
  }
21137
21138
  };
21138
- return /*#__PURE__*/jsxRuntime.jsxs(Style$5, {
21139
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
21139
21140
  className: formatClassname([!isExpanded && 'collapsed', className]),
21140
21141
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
21141
21142
  className: "cont-header",
@@ -21176,7 +21177,7 @@ function GroupInfos({
21176
21177
  }, key));
21177
21178
  }
21178
21179
 
21179
- const Style$4 = styled__default["default"].div`
21180
+ const Style$5 = styled__default["default"].div`
21180
21181
  gap: 16px;
21181
21182
  display: flex;
21182
21183
  max-width: 465px;
@@ -21198,7 +21199,7 @@ function EvaluationPopover({
21198
21199
  t = s => s,
21199
21200
  evaluationConfig = []
21200
21201
  }) {
21201
- return /*#__PURE__*/jsxRuntime.jsx(Style$4, {
21202
+ return /*#__PURE__*/jsxRuntime.jsx(Style$5, {
21202
21203
  children: evaluationConfig.map(c =>
21203
21204
  /*#__PURE__*/
21204
21205
  //? ASK REDI
@@ -23170,7 +23171,7 @@ const useMapHelper = ({
23170
23171
  };
23171
23172
  };
23172
23173
 
23173
- const Style$3 = styled__default["default"].div`
23174
+ const Style$4 = styled__default["default"].div`
23174
23175
  width: 100%;
23175
23176
  height: 20rem;
23176
23177
  flex: 1;
@@ -23297,7 +23298,7 @@ function PolygonSelector({
23297
23298
  searchForLocation(mapRef);
23298
23299
  }
23299
23300
  }, [searchValue, mapRef]);
23300
- return /*#__PURE__*/jsxRuntime.jsxs(Style$3, {
23301
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$4, {
23301
23302
  className: "polygon-selector",
23302
23303
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
23303
23304
  className: "map-container",
@@ -30055,7 +30056,7 @@ const NavigationAction = ({
30055
30056
  });
30056
30057
  };
30057
30058
 
30058
- const getColumns$a = ({
30059
+ const getColumns$b = ({
30059
30060
  t,
30060
30061
  goTo,
30061
30062
  user,
@@ -30627,7 +30628,7 @@ const viewConfig$6 = {
30627
30628
  createTitle: "Create Worker"
30628
30629
  };
30629
30630
 
30630
- const getColumns$9 = ({
30631
+ const getColumns$a = ({
30631
30632
  t,
30632
30633
  goTo,
30633
30634
  user,
@@ -31129,7 +31130,7 @@ MoreTags.propTypes = {
31129
31130
  limit: PropTypes__default["default"].number
31130
31131
  };
31131
31132
 
31132
- const getColumns$8 = ({
31133
+ const getColumns$9 = ({
31133
31134
  t,
31134
31135
  goTo,
31135
31136
  user,
@@ -31584,7 +31585,7 @@ const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = fa
31584
31585
  return eventCategoryObject[key] || null;
31585
31586
  };
31586
31587
 
31587
- const getColumns$7 = ({
31588
+ const getColumns$8 = ({
31588
31589
  t,
31589
31590
  goTo,
31590
31591
  user,
@@ -32009,7 +32010,7 @@ const viewConfig$3 = {
32009
32010
  createTitle: "Create Incident"
32010
32011
  };
32011
32012
 
32012
- const getColumns$6 = ({
32013
+ const getColumns$7 = ({
32013
32014
  t,
32014
32015
  goTo,
32015
32016
  user,
@@ -32267,7 +32268,7 @@ const viewConfig$2 = {
32267
32268
  createTitle: "Create Location"
32268
32269
  };
32269
32270
 
32270
- const getColumns$5 = ({
32271
+ const getColumns$6 = ({
32271
32272
  t,
32272
32273
  goTo,
32273
32274
  user,
@@ -32681,7 +32682,7 @@ MoreOptions.propTypes = {
32681
32682
  limit: PropTypes__default["default"].number
32682
32683
  };
32683
32684
 
32684
- const getColumns$4 = ({
32685
+ const getColumns$5 = ({
32685
32686
  t,
32686
32687
  goTo,
32687
32688
  user,
@@ -32917,7 +32918,7 @@ const viewConfig = {
32917
32918
  createTitle: "Create Document"
32918
32919
  };
32919
32920
 
32920
- const getColumns$3 = ({
32921
+ const getColumns$4 = ({
32921
32922
  t,
32922
32923
  goTo,
32923
32924
  user,
@@ -33042,63 +33043,63 @@ const FILTER_REGISTRY = {
33042
33043
  options: getFilterOptions$a,
33043
33044
  formConfig: formConfig$8,
33044
33045
  viewConfig: viewConfig$8,
33045
- columns: getColumns$a
33046
+ columns: getColumns$b
33046
33047
  },
33047
33048
  workers: {
33048
33049
  config: getFiltersConfig$8,
33049
33050
  options: getFilterOptions$8,
33050
33051
  formConfig: formConfig$6,
33051
33052
  viewConfig: viewConfig$6,
33052
- columns: getColumns$9
33053
+ columns: getColumns$a
33053
33054
  },
33054
33055
  operators: {
33055
33056
  config: getFiltersConfig$9,
33056
33057
  options: getFilterOptions$9,
33057
33058
  formConfig: formConfig$7,
33058
33059
  viewConfig: viewConfig$7,
33059
- columns: getColumns$b
33060
+ columns: getColumns$c
33060
33061
  },
33061
33062
  events: {
33062
33063
  config: getFiltersConfig$7,
33063
33064
  options: getFilterOptions$7,
33064
33065
  formConfig: formConfig$5,
33065
33066
  viewConfig: viewConfig$5,
33066
- columns: getColumns$8
33067
+ columns: getColumns$9
33067
33068
  },
33068
33069
  activities: {
33069
33070
  config: getFiltersConfig$6,
33070
33071
  options: getFilterOptions$6,
33071
33072
  formConfig: formConfig$4,
33072
33073
  viewConfig: viewConfig$4,
33073
- columns: getColumns$7
33074
+ columns: getColumns$8
33074
33075
  },
33075
33076
  incidents: {
33076
33077
  config: getFiltersConfig$5,
33077
33078
  options: getFilterOptions$5,
33078
33079
  formConfig: formConfig$3,
33079
33080
  viewConfig: viewConfig$3,
33080
- columns: getColumns$6
33081
+ columns: getColumns$7
33081
33082
  },
33082
33083
  locations: {
33083
33084
  config: getFiltersConfig$4,
33084
33085
  options: getFilterOptions$4,
33085
33086
  formConfig: formConfig$2,
33086
33087
  viewConfig: viewConfig$2,
33087
- columns: getColumns$5
33088
+ columns: getColumns$6
33088
33089
  },
33089
33090
  'production-sites': {
33090
33091
  config: getFiltersConfig$3,
33091
33092
  options: getFilterOptions$3,
33092
33093
  formConfig: formConfig$1,
33093
33094
  viewConfig: viewConfig$1,
33094
- columns: getColumns$4
33095
+ columns: getColumns$5
33095
33096
  },
33096
33097
  documents: {
33097
33098
  config: getFiltersConfig$2,
33098
33099
  options: getFilterOptions$2,
33099
33100
  formConfig: formConfig,
33100
33101
  viewConfig: viewConfig,
33101
- columns: getColumns$3
33102
+ columns: getColumns$4
33102
33103
  }
33103
33104
  };
33104
33105
  const DEFAULT_SUBJECT = 'stakeholders';
@@ -33149,7 +33150,7 @@ const getViewConfig = ({
33149
33150
  return registry?.viewConfig;
33150
33151
  };
33151
33152
 
33152
- const getColumns$2 = ({
33153
+ const getColumns$3 = ({
33153
33154
  t,
33154
33155
  goTo,
33155
33156
  user,
@@ -33236,7 +33237,7 @@ const useTablePage = ({
33236
33237
  extendingFilters: extendingFilters,
33237
33238
  subject
33238
33239
  });
33239
- const columns = React.useMemo(() => getColumns$2({
33240
+ const columns = React.useMemo(() => getColumns$3({
33240
33241
  t,
33241
33242
  goTo,
33242
33243
  user,
@@ -33247,7 +33248,7 @@ const useTablePage = ({
33247
33248
  subject,
33248
33249
  data,
33249
33250
  applications
33250
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns$2]);
33251
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns$3]);
33251
33252
  const selectFiltersConfig = React.useMemo(() => getFiltersConfig$1({
33252
33253
  t,
33253
33254
  subject
@@ -33812,7 +33813,7 @@ const WorkersTable = ({
33812
33813
  getData: getData,
33813
33814
  getApiBaseUrl: getApiBaseUrl,
33814
33815
  getAppHeader: getAppHeader,
33815
- getColumns: getColumns$9,
33816
+ getColumns: getColumns$a,
33816
33817
  breadcrumbs: breadcrumbs,
33817
33818
  extendingFilters: extendingFilters,
33818
33819
  formConfig: {
@@ -34037,7 +34038,7 @@ const ProductionSitesTable = ({
34037
34038
  });
34038
34039
  };
34039
34040
 
34040
- const getColumns$1 = ({
34041
+ const getColumns$2 = ({
34041
34042
  t,
34042
34043
  goTo,
34043
34044
  user,
@@ -34515,7 +34516,7 @@ const UsersTable = ({
34515
34516
  const params = new URLSearchParams(location?.search);
34516
34517
  const [openCreateModal, setOpenCreateModal] = React.useState(params.has("create"));
34517
34518
  const [userToEdit, setUserToEdit] = React.useState(null);
34518
- const columns = React.useMemo(() => getColumns$1({
34519
+ const columns = React.useMemo(() => getColumns$2({
34519
34520
  t,
34520
34521
  goTo,
34521
34522
  user,
@@ -34906,7 +34907,7 @@ const partnershipTypes = [{
34906
34907
  value: "exchange"
34907
34908
  }];
34908
34909
 
34909
- const getColumns = ({
34910
+ const getColumns$1 = ({
34910
34911
  t,
34911
34912
  accept,
34912
34913
  decline,
@@ -35416,7 +35417,7 @@ const Create = ({
35416
35417
  });
35417
35418
  };
35418
35419
 
35419
- const Style$2 = styled__default["default"].div`
35420
+ const Style$3 = styled__default["default"].div`
35420
35421
  display: flex;
35421
35422
  gap: 8px;
35422
35423
  justify-content: center;
@@ -35439,7 +35440,7 @@ function Footer({
35439
35440
  disabledFooterText,
35440
35441
  disabledFooter
35441
35442
  }) {
35442
- return /*#__PURE__*/jsxRuntime.jsxs(Style$2, {
35443
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$3, {
35443
35444
  className: className,
35444
35445
  children: [disabledFooterText ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
35445
35446
  title: t(disabledFooterText),
@@ -35651,7 +35652,7 @@ const PartnersTable = ({
35651
35652
  setTotalRequests,
35652
35653
  t
35653
35654
  });
35654
- const columns = React.useMemo(() => getColumns({
35655
+ const columns = React.useMemo(() => getColumns$1({
35655
35656
  t,
35656
35657
  accept,
35657
35658
  decline,
@@ -37818,7 +37819,63 @@ const OperatorSummary = ({
37818
37819
  });
37819
37820
  };
37820
37821
 
37821
- styled__default["default"].div`
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`
37822
37879
  max-width: calc(100% - 48px);
37823
37880
  margin-left: var(--size-lg);
37824
37881
  overflow: hidden;
@@ -37842,13 +37899,13 @@ styled__default["default"].div`
37842
37899
  padding-top: 16px;
37843
37900
  }
37844
37901
  `;
37845
- ({
37902
+ StickyTable.propTypes = {
37846
37903
  size: PropTypes__default["default"].any,
37847
37904
  maxHeight: PropTypes__default["default"].number,
37848
37905
  dataSource: PropTypes__default["default"].array,
37849
37906
  columns: PropTypes__default["default"].object,
37850
37907
  pagination: PropTypes__default["default"].any
37851
- });
37908
+ };
37852
37909
 
37853
37910
  ({
37854
37911
  content: PropTypes__default["default"].string,
@@ -41802,6 +41859,13 @@ styled__default["default"].div`
41802
41859
  }
41803
41860
  `;
41804
41861
 
41862
+ const getRedirectLink = (link, APP) => {
41863
+ if (window.location.pathname.includes(`/${APP}`)) {
41864
+ return `${APP}${link}`;
41865
+ }
41866
+ return link;
41867
+ };
41868
+
41805
41869
  styled__default["default"].div`
41806
41870
  display: flex;
41807
41871
  flex-direction: column;
@@ -43829,7 +43893,6 @@ const JobsTimeline = ({
43829
43893
  loading = false,
43830
43894
  t = s => s
43831
43895
  }) => {
43832
- console.log('dayJobsTimeline', dayJobsTimeline);
43833
43896
  const jobsData = Array.isArray(dayJobsTimeline) ? dayJobsTimeline : dayJobsTimeline?.jobsTimeline || dayJobsTimeline?.jobs || dayJobsTimeline?.timeline || [];
43834
43897
  const formatDateAxis = React.useMemo(() => {
43835
43898
  return label => {
@@ -44189,37 +44252,739 @@ const CommunityParticipation = ({
44189
44252
  });
44190
44253
  };
44191
44254
 
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
+
44192
44850
  const ACTIVITIES_TAB = 'activities';
44193
44851
  const PARTNERS_TAB = 'partners';
44194
44852
  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 : [];
44195
44885
  const AssociatedInformation = ({
44196
- activityData,
44886
+ id,
44887
+ navigate,
44888
+ getSummaryDetail,
44197
44889
  loading = false,
44890
+ projectId,
44891
+ basepath = "planting-cycle",
44892
+ endpoint = "associated-information",
44893
+ tabsConfig = TABS_CONFIG,
44894
+ searchFieldsMap = getSearchFields,
44198
44895
  t = s => s
44199
44896
  }) => {
44200
44897
  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]);
44201
44958
  return /*#__PURE__*/jsxRuntime.jsx("section", {
44202
- children: /*#__PURE__*/jsxRuntime.jsx(Widget, {
44203
- className: "v2-widget no-px h-w-btn-header no-p-body",
44959
+ children: /*#__PURE__*/jsxRuntime.jsxs(Widget, {
44960
+ className: "v2-widget no-px no-p-body h-w-btn-header with-border-header",
44204
44961
  title: t("Associated Information"),
44205
44962
  tabsConfig: {
44206
- tabs: [{
44207
- label: t("straatos::activities"),
44208
- value: ACTIVITIES_TAB
44209
- }, {
44210
- label: t("straatos::partners"),
44211
- value: PARTNERS_TAB
44212
- }, {
44213
- label: t("straatos::incidents"),
44214
- value: INCIDENTS_TAB
44215
- }],
44963
+ tabs: translatedTabs,
44216
44964
  value: activeTab,
44217
- onChange: value => {
44218
- setActiveTab(value);
44219
- // setData([]);
44220
- }
44965
+ onChange: handleTabChange
44221
44966
  },
44222
- children: /*#__PURE__*/jsxRuntime.jsx("div", {})
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
+ })]
44223
44988
  })
44224
44989
  });
44225
44990
  };
@@ -44316,12 +45081,14 @@ const PlantingCycleSummary = ({
44316
45081
  activityData,
44317
45082
  loading = false,
44318
45083
  id,
45084
+ projectId,
44319
45085
  t = () => {},
44320
- getSummaryDetail
45086
+ getSummaryDetail,
45087
+ navigate
44321
45088
  }) => {
44322
45089
  return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
44323
45090
  header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
44324
- title: header?.title || '',
45091
+ title: header?.title + ' Summary' || '',
44325
45092
  supportText: header?.supportText || '',
44326
45093
  onDownload: header?.onDownload,
44327
45094
  downloadDisabled: header?.downloadDisabled,
@@ -44357,9 +45124,11 @@ const PlantingCycleSummary = ({
44357
45124
  t: t
44358
45125
  }), /*#__PURE__*/jsxRuntime.jsx(AssociatedInformation, {
44359
45126
  id: id,
45127
+ projectId: projectId,
44360
45128
  getSummaryDetail: getSummaryDetail,
44361
45129
  loading: loading,
44362
- t: t
45130
+ t: t,
45131
+ navigate: navigate
44363
45132
  })]
44364
45133
  });
44365
45134
  };