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