datastake-daf 0.6.791 → 0.6.793

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.
@@ -7126,7 +7126,7 @@ const getRowConfig$1 = ({
7126
7126
  const MOBILE_W = 850;
7127
7127
  const MOBILE_WIDTH = `max-width: ${MOBILE_W}px`;
7128
7128
 
7129
- const Style$g = styled__default["default"].div`
7129
+ const Style$k = styled__default["default"].div`
7130
7130
  overflow-x: auto;
7131
7131
 
7132
7132
  @media (${MOBILE_WIDTH}) {
@@ -7601,7 +7601,7 @@ function KeyIndicatorsWidget({
7601
7601
  className: formatClassname(["flex-1 h-w-btn-header with-border-header", widgetClassName]),
7602
7602
  title: noTitle ? undefined : t(title),
7603
7603
  noTitle: noTitle,
7604
- children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$g, {
7604
+ children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$k, {
7605
7605
  className: formatClassname(["flex", className]),
7606
7606
  children: config.map((c, i) => /*#__PURE__*/jsxRuntime.jsxs("div", {
7607
7607
  className: `row-item ${c.icon ? 'row-item-with-icon' : ''}`,
@@ -7720,7 +7720,7 @@ KeyIndicators$1.propTypes = {
7720
7720
  goTo: PropTypes__default["default"].func
7721
7721
  };
7722
7722
 
7723
- const Style$f = styled__default["default"].div`
7723
+ const Style$j = styled__default["default"].div`
7724
7724
  display: flex;
7725
7725
  flex-direction: row;
7726
7726
  position: relative;
@@ -9277,7 +9277,7 @@ function LocationIcon({
9277
9277
  });
9278
9278
  }
9279
9279
 
9280
- const Style$e = styled__default["default"].div`
9280
+ const Style$i = styled__default["default"].div`
9281
9281
  .main {
9282
9282
  width: 24px;
9283
9283
  height: 24px;
@@ -9422,7 +9422,7 @@ function StakeholderIcon({
9422
9422
  onClickLink: () => onClickLink(marker)
9423
9423
  }),
9424
9424
  getPopupContainer: () => document.getElementById("map"),
9425
- children: /*#__PURE__*/jsxRuntime.jsx(Style$e
9425
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$i
9426
9426
  // onClick={toggleOpen}
9427
9427
  , {
9428
9428
  className: `map-marker marker closed`,
@@ -9435,7 +9435,7 @@ function StakeholderIcon({
9435
9435
  })
9436
9436
  });
9437
9437
  }
9438
- return /*#__PURE__*/jsxRuntime.jsxs(Style$e, {
9438
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$i, {
9439
9439
  onClick: toggleOpen,
9440
9440
  className: `map-marker marker ${isActive ? "opened" : "closed"}`,
9441
9441
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -10284,7 +10284,7 @@ const useMap = ({
10284
10284
  };
10285
10285
  };
10286
10286
 
10287
- const Style$d = styled__default["default"].div`
10287
+ const Style$h = styled__default["default"].div`
10288
10288
  position: relative;
10289
10289
  width: 100%;
10290
10290
  height: 100%;
@@ -10357,7 +10357,7 @@ function ComponentWithFocus({
10357
10357
  setClosed(false);
10358
10358
  }
10359
10359
  }, [closed]);
10360
- return /*#__PURE__*/jsxRuntime.jsxs(Style$d, {
10360
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$h, {
10361
10361
  className: className,
10362
10362
  ref: ref,
10363
10363
  style: style,
@@ -10369,7 +10369,7 @@ function ComponentWithFocus({
10369
10369
  });
10370
10370
  }
10371
10371
 
10372
- const Style$c = styled__default["default"].div`
10372
+ const Style$g = styled__default["default"].div`
10373
10373
  position: absolute;
10374
10374
  top: 24px;
10375
10375
  left: 24px;
@@ -10544,7 +10544,7 @@ function Filters({
10544
10544
  return null;
10545
10545
  }
10546
10546
  };
10547
- return /*#__PURE__*/jsxRuntime.jsxs(Style$c, {
10547
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$g, {
10548
10548
  children: [/*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
10549
10549
  onClick: () => setOpened(p => !p),
10550
10550
  children: [t("Filter"), /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
@@ -10625,7 +10625,7 @@ function Map$1({
10625
10625
  isSatellite
10626
10626
  });
10627
10627
  return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
10628
- children: /*#__PURE__*/jsxRuntime.jsxs(Style$f, {
10628
+ children: /*#__PURE__*/jsxRuntime.jsxs(Style$j, {
10629
10629
  className: formatClassname([showSider && activeMarker && "with-sider"]),
10630
10630
  children: [filtersConfig ? /*#__PURE__*/jsxRuntime.jsx(Filters, {
10631
10631
  t: t,
@@ -10834,7 +10834,7 @@ function PrimaryNode({
10834
10834
  style: {
10835
10835
  opacity: 0
10836
10836
  }
10837
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$b, {
10837
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$f, {
10838
10838
  $isPdf: isPdf,
10839
10839
  className: "flex",
10840
10840
  children: [" ", /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -10945,7 +10945,7 @@ function PrimaryNode({
10945
10945
  })]
10946
10946
  });
10947
10947
  }
10948
- const Style$b = styled__default["default"].div`
10948
+ const Style$f = styled__default["default"].div`
10949
10949
  width: ${MAIN_NODE_WIDTH}px;
10950
10950
  height: ${MAIN_NODE_HEIGHT}px; /* Explicitly set height */
10951
10951
  display: flex;
@@ -11081,7 +11081,7 @@ function IconNode({
11081
11081
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
11082
11082
  title: data?.name,
11083
11083
  defaultOpen: data?.ONLY_IN_STORYBOOK,
11084
- children: /*#__PURE__*/jsxRuntime.jsx(Style$a, {
11084
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$e, {
11085
11085
  hoverColor: data?.iconHoverColor,
11086
11086
  children: /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
11087
11087
  theme: {
@@ -11124,7 +11124,7 @@ function IconNode({
11124
11124
  })]
11125
11125
  });
11126
11126
  }
11127
- const Style$a = styled__default["default"].div`
11127
+ const Style$e = styled__default["default"].div`
11128
11128
  height: 40px;
11129
11129
  width: 40px;
11130
11130
 
@@ -11202,7 +11202,7 @@ function NameNode({
11202
11202
  style: {
11203
11203
  opacity: 0
11204
11204
  }
11205
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$9, {
11205
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$d, {
11206
11206
  $isPdf: isPdf,
11207
11207
  style: {
11208
11208
  opacity: data.isEmpty ? 0.5 : 1
@@ -11290,7 +11290,7 @@ function NameNode({
11290
11290
  })]
11291
11291
  });
11292
11292
  }
11293
- const Style$9 = styled__default["default"].div`
11293
+ const Style$d = styled__default["default"].div`
11294
11294
  width: ${NAME_CARD_WIDTH}px;
11295
11295
  height: 55px;
11296
11296
  display: flex;
@@ -11321,7 +11321,7 @@ const Style$9 = styled__default["default"].div`
11321
11321
  }
11322
11322
  `;
11323
11323
 
11324
- const Style$8 = styled__default["default"].div`
11324
+ const Style$c = styled__default["default"].div`
11325
11325
  width: 405px;
11326
11326
  display: flex;
11327
11327
  height: 140px;
@@ -11432,7 +11432,7 @@ function ExpandedNode({
11432
11432
  style: {
11433
11433
  opacity: 0
11434
11434
  }
11435
- }), /*#__PURE__*/jsxRuntime.jsxs(Style$8, {
11435
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$c, {
11436
11436
  style: {
11437
11437
  opacity
11438
11438
  },
@@ -12684,7 +12684,7 @@ Identification.propTypes = {
12684
12684
  theme: PropTypes__default["default"].object
12685
12685
  };
12686
12686
 
12687
- const Style$7 = styled__default["default"].div`
12687
+ const Style$b = styled__default["default"].div`
12688
12688
  position: absolute;
12689
12689
  display: flex;
12690
12690
  gap: 12px;
@@ -12699,7 +12699,7 @@ function Tooltip({
12699
12699
  mouseY = 0,
12700
12700
  children = null
12701
12701
  }) {
12702
- return /*#__PURE__*/jsxRuntime.jsx(Style$7, {
12702
+ return /*#__PURE__*/jsxRuntime.jsx(Style$b, {
12703
12703
  style: {
12704
12704
  top: mouseY,
12705
12705
  left: mouseX
@@ -14998,85 +14998,271 @@ function UserDashboard({
14998
14998
  });
14999
14999
  }
15000
15000
 
15001
- const {
15002
- useToken: useToken$4
15003
- } = antd.theme;
15004
- const MAX_LENGTH = 3;
15005
- function AvatarGroup({
15006
- items = [],
15007
- maxLength = MAX_LENGTH,
15008
- size = "small"
15001
+ const SCROLL = {
15002
+ y: 550,
15003
+ x: 1000
15004
+ };
15005
+ const getLocales = t => ({
15006
+ triggerDesc: t('Click to sort descending'),
15007
+ triggerAsc: t('Click to sort ascending')
15008
+ });
15009
+
15010
+ function DAFTable({
15011
+ columns = [],
15012
+ data = [],
15013
+ defaultFilters = {},
15014
+ style = {},
15015
+ pagination = null,
15016
+ loading = false,
15017
+ onChange = () => {},
15018
+ onFilterChange = () => {},
15019
+ selectOptions,
15020
+ filtersConfig,
15021
+ rowSelection = false,
15022
+ setShowFilters = () => {},
15023
+ rowKey = 'id',
15024
+ showFilters = false,
15025
+ hideOnLoading = true,
15026
+ sourcesKey,
15027
+ className,
15028
+ projects = [],
15029
+ t = s => s,
15030
+ selectedProject,
15031
+ sourceId = '',
15032
+ projectSources = [],
15033
+ language = 'en',
15034
+ scrollX = true,
15035
+ apiUrl,
15036
+ app,
15037
+ doEmptyRows,
15038
+ ...rest
15009
15039
  }) {
15010
- const count = items.length === maxLength + 1 ? items.length : maxLength;
15011
- const {
15012
- token
15013
- } = useToken$4();
15014
- return /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
15015
- max: {
15016
- count: count,
15017
- style: {
15018
- color: token.baseGray90,
15019
- backgroundColor: token.baseGray20,
15020
- border: `1px solid ${token.baseGray40}`
15040
+ const [source, setSource] = React.useState([]);
15041
+ const projectData = (projects || []).find(p => p.id === selectedProject);
15042
+ const [filtersInit, setFiltersInit] = React.useState(!loading);
15043
+ React.useEffect(() => {
15044
+ if (!filtersInit && !loading) {
15045
+ setFiltersInit(true);
15046
+ }
15047
+ }, [loading, filtersInit]);
15048
+ const sources = React.useMemo(() => {
15049
+ if (projectData) {
15050
+ if (sourceId === 'overview') {
15051
+ return projectSources.map(val => {
15052
+ return {
15053
+ label: val.company?.name || '',
15054
+ value: val.authorId
15055
+ };
15056
+ });
15021
15057
  }
15022
- },
15023
- size: "small",
15024
- children: items.map((v, i) => /*#__PURE__*/jsxRuntime.jsx(antd.Avatar, {
15025
- size: size,
15026
- style: {
15027
- backgroundColor: v.isOwn ? token.colorPrimary : token.baseGray20,
15028
- color: v.isOwn ? "white" : token.baseGray90,
15029
- border: `1px solid ${v.isOwn ? "white" : token.baseGray40}`,
15030
- display: "flex",
15031
- alignItems: "center",
15032
- justifyContent: "center"
15058
+ }
15059
+ return undefined;
15060
+ }, [projectData, sourceId, projectSources]);
15061
+ const _selectOptions = React.useMemo(() => {
15062
+ return typeof sourcesKey === 'string' && sources ? {
15063
+ ...selectOptions,
15064
+ [sourcesKey]: sources
15065
+ } : selectOptions;
15066
+ }, [sourcesKey, sources, selectOptions]);
15067
+ const _filtersConfig = React.useMemo(() => {
15068
+ return typeof sourcesKey === 'string' && sources ? {
15069
+ ...filtersConfig,
15070
+ [sourcesKey]: {
15071
+ type: "select",
15072
+ label: t("Source"),
15073
+ placeholder: t => `${t("Filter By")} ${t('Source')}`,
15074
+ labelStyle: {
15075
+ flex: 1
15076
+ },
15077
+ style: {
15078
+ flex: 1
15079
+ },
15080
+ getLabel: opt => opt.label,
15081
+ getValue: opt => opt.value
15082
+ }
15083
+ } : filtersConfig;
15084
+ }, [sourcesKey, sources, filtersConfig, t]);
15085
+ React.useEffect(() => {
15086
+ if (data && Array.isArray(data)) {
15087
+ setSource(data);
15088
+ }
15089
+ }, [data, data.length]);
15090
+ const paginationPageSize = pagination?.pageSize;
15091
+ const dataSource = React.useMemo(() => {
15092
+ const pageSize = paginationPageSize ? paginationPageSize : source.length > 10 ? source.length : 10;
15093
+ if (doEmptyRows && pageSize) {
15094
+ const emptyDataSource = [];
15095
+ for (let i = 0; i < pageSize; i++) {
15096
+ emptyDataSource.push({
15097
+ id: i,
15098
+ empty: true,
15099
+ key: i
15100
+ });
15101
+ }
15102
+ return emptyDataSource.map((empty, i) => source[i] || empty);
15103
+ }
15104
+ return source;
15105
+ }, [source, paginationPageSize, doEmptyRows]);
15106
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
15107
+ children: [showFilters && filtersConfig && onFilterChange && filtersInit && /*#__PURE__*/jsxRuntime.jsx(SelectFilters, {
15108
+ app: app,
15109
+ language: language,
15110
+ t: t,
15111
+ apiUrl: apiUrl,
15112
+ className: className,
15113
+ options: _selectOptions,
15114
+ filtersConfig: _filtersConfig,
15115
+ onApply: filters => {
15116
+ onFilterChange(filters);
15033
15117
  },
15034
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15035
- title: v.name || "",
15036
- placement: "top",
15037
- children: v.isOwn ? /*#__PURE__*/jsxRuntime.jsx("span", {
15038
- children: "OWN"
15039
- }) : [v.icon ? /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
15040
- name: v.icon,
15041
- width: v.size || 18,
15042
- height: v.size || 18,
15043
- color: token.baseGray90
15044
- }) : v.name ? v.name.charAt(0).toUpperCase() : "U"]
15118
+ showFilters: showFilters,
15119
+ setShowFilters: setShowFilters,
15120
+ selectedFilters: defaultFilters
15121
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
15122
+ style: style,
15123
+ className: formatClassname(['daf-table', className]),
15124
+ children: (!loading || !hideOnLoading) && /*#__PURE__*/jsxRuntime.jsx(antd.Table, {
15125
+ size: "small",
15126
+ sort: true,
15127
+ rowKey: rowKey,
15128
+ scroll: scrollX ? {
15129
+ x: SCROLL.x
15130
+ } : undefined,
15131
+ rowSelection: rowSelection,
15132
+ columns: columns,
15133
+ loading: !hideOnLoading ? loading : false,
15134
+ dataSource: dataSource,
15135
+ pagination: pagination,
15136
+ onChange: onChange,
15137
+ ...rest
15045
15138
  })
15046
- }, i))
15139
+ })]
15047
15140
  });
15048
15141
  }
15142
+ DAFTable.propTypes = {
15143
+ columns: PropTypes__default["default"].any,
15144
+ data: PropTypes__default["default"].any,
15145
+ defaultFilters: PropTypes__default["default"].object,
15146
+ style: PropTypes__default["default"].object,
15147
+ pagination: PropTypes__default["default"].any,
15148
+ loading: PropTypes__default["default"].bool,
15149
+ onChange: PropTypes__default["default"].func,
15150
+ onFilterChange: PropTypes__default["default"].func,
15151
+ selectOptions: PropTypes__default["default"].object,
15152
+ filtersConfig: PropTypes__default["default"].any,
15153
+ rowSelection: PropTypes__default["default"].bool,
15154
+ rowKey: PropTypes__default["default"].any,
15155
+ showFilters: PropTypes__default["default"].bool,
15156
+ hideOnLoading: PropTypes__default["default"].bool,
15157
+ sourcesKey: PropTypes__default["default"].any,
15158
+ className: PropTypes__default["default"].any,
15159
+ projects: PropTypes__default["default"].any,
15160
+ t: PropTypes__default["default"].func,
15161
+ selectedProject: PropTypes__default["default"].any,
15162
+ sourceId: PropTypes__default["default"].any,
15163
+ projectSources: PropTypes__default["default"].any,
15164
+ language: PropTypes__default["default"].string,
15165
+ setShowFilters: PropTypes__default["default"].func,
15166
+ scrollX: PropTypes__default["default"].any
15167
+ };
15049
15168
 
15050
- function sourceAvatarConfig(items, user, applications) {
15051
- const userInterface = user?.company?.apps?.[0]?.interface;
15052
- const icon = applications[0]?.interfaces?.find(i => i.value === userInterface)?.iconName;
15053
- const sources = [];
15054
- items?.length > 0 && items?.forEach(author => {
15055
- if (author?.id) {
15056
- if (author.id === user?.company?.id) {
15057
- // it's own data
15058
- sources.push({
15059
- name: author.name,
15060
- icon: 'OwnData',
15061
- isOwn: true,
15062
- sourceId: author.id
15063
- });
15064
- } else {
15065
- sources.push({
15066
- name: author.name,
15067
- icon: icon,
15068
- isOwn: false,
15069
- sourceId: author.id
15070
- });
15071
- }
15169
+ const Style$a = styled__default["default"].div`
15170
+ width: 99px;
15171
+ height: 10px;
15172
+ border-radius: 8px;
15173
+ background: var(--base-gray-40);
15174
+ overflow: hidden;
15175
+
15176
+ .bar {
15177
+ height: 100%;
15178
+ background: var(--color-primary-70);
15179
+ }
15180
+ `;
15181
+ function ProgressBar({
15182
+ style,
15183
+ tooltipTitle,
15184
+ percentage = 0,
15185
+ onClick = () => {},
15186
+ isSubmitted = false
15187
+ }) {
15188
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15189
+ title: tooltipTitle || `${parseInt(percentage)}%`,
15190
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$a, {
15191
+ onClick: onClick,
15192
+ style: style,
15193
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
15194
+ className: "bar",
15195
+ style: {
15196
+ width: `${percentage}%`,
15197
+ background: isSubmitted ? '#69d99e' : 'var(--color-primary-70)'
15198
+ }
15199
+ })
15200
+ })
15201
+ });
15202
+ }
15203
+ ProgressBar.propTypes = {
15204
+ tooltipTitle: PropTypes__default["default"].string,
15205
+ percentage: PropTypes__default["default"].number,
15206
+ onClick: PropTypes__default["default"].any,
15207
+ style: PropTypes__default["default"].any
15208
+ };
15209
+
15210
+ const Style$9 = styled__default["default"].div`
15211
+ .icon-background {
15212
+ width: ${({
15213
+ size
15214
+ }) => size}px;
15215
+ height: ${({
15216
+ size
15217
+ }) => size}px;
15218
+ background-color: #69d99e;
15219
+ border-radius: 50%;
15220
+ display: flex;
15221
+ align-items: center;
15222
+ justify-content: center;
15072
15223
  }
15224
+ `;
15225
+ const SideIcon = ({
15226
+ size = 20,
15227
+ iconSize = 12
15228
+ }) => {
15229
+ return /*#__PURE__*/jsxRuntime.jsx(Style$9, {
15230
+ size: size,
15231
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
15232
+ className: "icon-background",
15233
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
15234
+ name: "Check",
15235
+ color: "white",
15236
+ size: iconSize
15237
+ })
15238
+ })
15073
15239
  });
15240
+ };
15074
15241
 
15075
- // sort to have own data first
15076
- return sources.sort((a, b) => {
15077
- if (a.isOwn && !b.isOwn) return -1;
15078
- if (!a.isOwn && b.isOwn) return 1;
15079
- return 0;
15242
+ function ProgressBarWithIcon({
15243
+ published,
15244
+ data,
15245
+ t
15246
+ }) {
15247
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
15248
+ style: {
15249
+ display: "flex",
15250
+ alignItems: "center",
15251
+ gap: "5px"
15252
+ },
15253
+ children: [/*#__PURE__*/jsxRuntime.jsx(ProgressBar, {
15254
+ style: {
15255
+ width: "100%"
15256
+ },
15257
+ tooltipTitle: published && t("Submitted"),
15258
+ percentage: parseInt(data?.completion || 0),
15259
+ isSubmitted: published
15260
+ }), published ? /*#__PURE__*/jsxRuntime.jsx(SideIcon, {
15261
+ size: 16,
15262
+ iconSize: 10
15263
+ }) : /*#__PURE__*/jsxRuntime.jsxs("span", {
15264
+ children: [parseInt(data?.completion || 0), "%"]
15265
+ })]
15080
15266
  });
15081
15267
  }
15082
15268
 
@@ -15359,6 +15545,1121 @@ MoreMenu.propTypes = {
15359
15545
  trigger: PropTypes__default["default"].oneOf(["click", "hover", "contextMenu"])
15360
15546
  };
15361
15547
 
15548
+ const NavigationAction = ({
15549
+ onClick,
15550
+ theme,
15551
+ disabled = false
15552
+ }) => {
15553
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15554
+ style: {
15555
+ display: "flex",
15556
+ justifyContent: "center"
15557
+ },
15558
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
15559
+ onClick: onClick,
15560
+ disabled: disabled,
15561
+ style: {
15562
+ border: 'none',
15563
+ background: 'transparent',
15564
+ padding: 0,
15565
+ display: 'flex',
15566
+ alignItems: 'center',
15567
+ opacity: disabled ? 0.5 : 1,
15568
+ cursor: disabled ? 'not-allowed' : 'pointer'
15569
+ },
15570
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
15571
+ name: "Link",
15572
+ size: 15,
15573
+ color: theme.baseGray70
15574
+ })
15575
+ })
15576
+ });
15577
+ };
15578
+
15579
+ const getColumns$g = ({
15580
+ t,
15581
+ data,
15582
+ user,
15583
+ goTo,
15584
+ getRedirectLink,
15585
+ theme
15586
+ }) => [{
15587
+ dataIndex: 'name',
15588
+ title: t('Name'),
15589
+ ellipsis: true,
15590
+ show: true,
15591
+ render: (v, all) => {
15592
+ if (all.empty) {
15593
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15594
+ className: "daf-default-cell"
15595
+ });
15596
+ }
15597
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15598
+ title: v,
15599
+ children: v
15600
+ });
15601
+ }
15602
+ }, {
15603
+ dataIndex: 'completion',
15604
+ title: t('Completion'),
15605
+ ellipsis: true,
15606
+ show: true,
15607
+ render: (v, all) => {
15608
+ if (all.empty) {
15609
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15610
+ className: "daf-default-cell"
15611
+ });
15612
+ }
15613
+ const published = false;
15614
+ return /*#__PURE__*/jsxRuntime.jsx(ProgressBarWithIcon, {
15615
+ published: published,
15616
+ data: v,
15617
+ t: t
15618
+ });
15619
+ }
15620
+ }, {
15621
+ dataIndex: 'lastUpdate',
15622
+ title: t('Last Update'),
15623
+ ellipsis: true,
15624
+ show: true,
15625
+ render: (v, all) => {
15626
+ if (all.empty) {
15627
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15628
+ className: "daf-default-cell"
15629
+ });
15630
+ }
15631
+ const date = v ? renderDateFormatted(v, "DD MMM YYYY", user?.language || 'en') : "-";
15632
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15633
+ title: date,
15634
+ children: date
15635
+ });
15636
+ }
15637
+ }, {
15638
+ id: 'actions',
15639
+ title: "",
15640
+ width: 60,
15641
+ render: (_, all) => {
15642
+ if (all.empty) {
15643
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15644
+ className: "daf-default-cell"
15645
+ });
15646
+ }
15647
+ const moreMenuItems = [{
15648
+ label: t("Summary"),
15649
+ value: "Summary",
15650
+ onClick: () => {
15651
+ let link = `/app/operator-summary/${all.datastakeId}`;
15652
+ goTo(getRedirectLink(link));
15653
+ },
15654
+ disabled: true
15655
+ }, {
15656
+ label: t("Details"),
15657
+ value: "details",
15658
+ onClick: () => {
15659
+ let link = `/app/view/kyc/user`;
15660
+ goTo(getRedirectLink(link));
15661
+ },
15662
+ disabled: true
15663
+ }];
15664
+ const managementSystemsOnClick = () => {
15665
+ let link = `/app/view/management-systems/user`;
15666
+ goTo(getRedirectLink(link));
15667
+ };
15668
+ return all?.key === 'kyc' ? /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
15669
+ items: moreMenuItems
15670
+ }) : /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
15671
+ onClick: managementSystemsOnClick,
15672
+ theme: theme,
15673
+ disabled: true
15674
+ });
15675
+ }
15676
+ }];
15677
+
15678
+ function OrganisationInformation({
15679
+ t = () => {},
15680
+ user = {},
15681
+ goTo = () => {},
15682
+ getRedirectLink = () => {},
15683
+ theme = {}
15684
+ }) {
15685
+ const organistionInfo = [{
15686
+ key: 'kyc',
15687
+ label: t("My KYC")
15688
+ }, {
15689
+ key: 'management-systems',
15690
+ label: t("Management Systems")
15691
+ }];
15692
+ const tableData = React.useMemo(() => {
15693
+ return organistionInfo.map(item => {
15694
+ return {
15695
+ key: item.key,
15696
+ name: item.label,
15697
+ completion: 0,
15698
+ lastUpdate: ""
15699
+ };
15700
+ });
15701
+ }, [organistionInfo]);
15702
+ const columns = React.useMemo(() => {
15703
+ return getColumns$g({
15704
+ t,
15705
+ data: tableData,
15706
+ user,
15707
+ goTo,
15708
+ getRedirectLink,
15709
+ theme
15710
+ });
15711
+ }, [tableData, user, goTo, getRedirectLink, theme]);
15712
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
15713
+ title: t("Organisation Information"),
15714
+ className: "with-border-header daf-table-wrapper no-pagination no-px-body",
15715
+ children: /*#__PURE__*/jsxRuntime.jsx(DAFTable, {
15716
+ columns: columns,
15717
+ data: tableData
15718
+ })
15719
+ });
15720
+ }
15721
+
15722
+ function StickyTable({
15723
+ size = "small",
15724
+ maxHeight = 300,
15725
+ containerHeight = 525,
15726
+ dataSource = [],
15727
+ columns = {},
15728
+ pagination = false,
15729
+ doEmptyRows = true,
15730
+ ...props
15731
+ }) {
15732
+ const data = React__default["default"].useMemo(() => {
15733
+ if (!doEmptyRows) {
15734
+ return dataSource;
15735
+ }
15736
+ const MIN_ROWS = 4;
15737
+ if (dataSource.length < MIN_ROWS) {
15738
+ const paddedData = [...dataSource];
15739
+ while (paddedData.length < MIN_ROWS) {
15740
+ paddedData.push({
15741
+ empty: true
15742
+ });
15743
+ }
15744
+ return paddedData;
15745
+ }
15746
+ return dataSource;
15747
+ }, [dataSource, doEmptyRows]);
15748
+ const Wrapper = React__default["default"].useMemo(() => {
15749
+ return data.length > 5 ? ComponentWithFocus : "div";
15750
+ }, [data.length]);
15751
+ return /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
15752
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$8, {
15753
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
15754
+ className: "daf-table-wrapper",
15755
+ style: {
15756
+ maxHeight: containerHeight,
15757
+ overflowY: "auto"
15758
+ },
15759
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
15760
+ className: "daf-sticky-table",
15761
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Table, {
15762
+ ...props,
15763
+ size: size,
15764
+ scroll: true,
15765
+ sticky: true,
15766
+ style: {
15767
+ maxHeight
15768
+ },
15769
+ dataSource: data,
15770
+ columns: columns,
15771
+ pagination: pagination
15772
+ })
15773
+ })
15774
+ })
15775
+ })
15776
+ });
15777
+ }
15778
+ const Style$8 = styled__default["default"].div`
15779
+ max-width: calc(100% - 48px);
15780
+ margin-left: var(--size-lg);
15781
+ overflow: hidden;
15782
+
15783
+ .daf-table {
15784
+ padding: 0px;
15785
+ margin-top: 0px;
15786
+
15787
+ .ant-tag {
15788
+ text-align: center;
15789
+ }
15790
+ }
15791
+
15792
+ .daf-select-filters .filters {
15793
+ padding-top: 16px;
15794
+ padding-left: 0;
15795
+ padding-right: 0;
15796
+ }
15797
+
15798
+ .daf-table {
15799
+ padding-top: 16px;
15800
+ }
15801
+ `;
15802
+ StickyTable.propTypes = {
15803
+ size: PropTypes__default["default"].any,
15804
+ maxHeight: PropTypes__default["default"].number,
15805
+ dataSource: PropTypes__default["default"].array,
15806
+ columns: PropTypes__default["default"].object,
15807
+ pagination: PropTypes__default["default"].any
15808
+ };
15809
+
15810
+ const Style$7 = styled__default["default"].div`
15811
+ overflow: hidden;
15812
+
15813
+ .daf-table {
15814
+ padding: 0px;
15815
+ margin-top: 0px;
15816
+
15817
+ .ant-tag {
15818
+ text-align: center;
15819
+ }
15820
+ }
15821
+
15822
+ .daf-select-filters .filters {
15823
+ padding-top: 16px;
15824
+ padding-left: 0;
15825
+ padding-right: 0;
15826
+ }
15827
+
15828
+ .daf-table {
15829
+ padding-top: 16px;
15830
+ }
15831
+ `;
15832
+
15833
+ const getColumns$f = ({
15834
+ t = () => {},
15835
+ options = {},
15836
+ user = {},
15837
+ goTo = () => {},
15838
+ getRedirectLink = () => {}
15839
+ }) => [{
15840
+ title: t("ID"),
15841
+ dataIndex: "datastakeId",
15842
+ key: "datastakeId",
15843
+ render: (v, all) => {
15844
+ if (all.empty) {
15845
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15846
+ className: "daf-default-cell"
15847
+ });
15848
+ }
15849
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15850
+ title: v,
15851
+ children: v
15852
+ });
15853
+ }
15854
+ }, {
15855
+ title: t("Name"),
15856
+ dataIndex: "name",
15857
+ key: "name",
15858
+ render: (v, all) => {
15859
+ if (all.empty) {
15860
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15861
+ className: "daf-default-cell"
15862
+ });
15863
+ }
15864
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15865
+ title: v,
15866
+ children: v
15867
+ });
15868
+ }
15869
+ }, {
15870
+ dataIndex: 'category',
15871
+ title: t('type'),
15872
+ ellipsis: true,
15873
+ show: true,
15874
+ render: (v, all) => {
15875
+ if (all.empty) {
15876
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15877
+ className: "daf-default-cell"
15878
+ });
15879
+ }
15880
+ const locationCategories = [...(options?.locationCategories || []), ...(options?.productionSiteCategories || [])];
15881
+ const category = findOptions(v, locationCategories);
15882
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15883
+ title: category,
15884
+ children: category
15885
+ });
15886
+ }
15887
+ }, {
15888
+ dataIndex: 'region',
15889
+ title: findOptions(user?.company?.country, options?.administrativeLevel1)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel1) : t("Province"),
15890
+ ellipsis: true,
15891
+ show: true,
15892
+ render: (v, all) => {
15893
+ if (all.empty) {
15894
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15895
+ className: "daf-default-cell"
15896
+ });
15897
+ }
15898
+ const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
15899
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15900
+ title: region,
15901
+ children: region
15902
+ }) : '-';
15903
+ }
15904
+ }, {
15905
+ dataIndex: 'territory',
15906
+ title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2) : t("Territory"),
15907
+ ellipsis: true,
15908
+ show: true,
15909
+ render: (v, all) => {
15910
+ if (all.empty) {
15911
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15912
+ className: "daf-default-cell"
15913
+ });
15914
+ }
15915
+ const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
15916
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15917
+ title: district,
15918
+ children: district
15919
+ }) : '-';
15920
+ }
15921
+ }, {
15922
+ dataIndex: 'lastUpdate',
15923
+ title: t('Last Update'),
15924
+ ellipsis: true,
15925
+ show: true,
15926
+ render: (v, all) => {
15927
+ if (all.empty) {
15928
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15929
+ className: "daf-default-cell"
15930
+ });
15931
+ }
15932
+ const date = v ? renderDateFormatted(v, "DD MMM YYYY", user?.language || 'en') : "-";
15933
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
15934
+ title: date,
15935
+ children: date
15936
+ });
15937
+ }
15938
+ }, {
15939
+ id: 'actions',
15940
+ title: "",
15941
+ width: 60,
15942
+ render: (_, all) => {
15943
+ if (all.empty) {
15944
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
15945
+ className: "daf-default-cell"
15946
+ });
15947
+ }
15948
+ const moreMenuItems = [{
15949
+ label: t("Summary"),
15950
+ value: "Summary",
15951
+ onClick: () => {
15952
+ let link = `/app/mine-summary/${all.datastakeId}`;
15953
+ goTo(getRedirectLink(link));
15954
+ }
15955
+ }, {
15956
+ label: t("Details"),
15957
+ value: "details",
15958
+ onClick: () => {
15959
+ let link = `/app/view/production-sites/${all.datastakeId}`;
15960
+ goTo(getRedirectLink(link));
15961
+ }
15962
+ }];
15963
+ return /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
15964
+ items: moreMenuItems
15965
+ });
15966
+ }
15967
+ }];
15968
+
15969
+ function ProductionSites({
15970
+ t = () => {},
15971
+ options = {},
15972
+ user = {},
15973
+ goTo = () => {},
15974
+ getRedirectLink = () => {}
15975
+ }) {
15976
+ const data = [];
15977
+ const Wrapper = React.useMemo(() => {
15978
+ return data.length > 5 ? ComponentWithFocus : "div";
15979
+ }, [data.length]);
15980
+ const columns = React.useMemo(() => {
15981
+ return getColumns$f({
15982
+ t,
15983
+ options,
15984
+ user,
15985
+ goTo,
15986
+ getRedirectLink
15987
+ });
15988
+ }, [t, options, user, goTo, getRedirectLink]);
15989
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
15990
+ title: t("Production Sites"),
15991
+ className: "with-border-header no-px-body",
15992
+ children: /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
15993
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$7, {
15994
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
15995
+ className: "daf-table-wrapper",
15996
+ style: {
15997
+ maxHeight: "526px",
15998
+ overflowY: "auto"
15999
+ },
16000
+ children: /*#__PURE__*/jsxRuntime.jsx(StickyTable, {
16001
+ columns: columns,
16002
+ dataSource: data,
16003
+ hideOnLoading: false,
16004
+ doEmptyRows: true
16005
+ })
16006
+ })
16007
+ })
16008
+ })
16009
+ });
16010
+ }
16011
+
16012
+ const Style$6 = styled__default["default"].div`
16013
+ max-width: 98%;
16014
+ margin-left: var(--size-lg);
16015
+ overflow: hidden;
16016
+ padding-right: 24px;
16017
+
16018
+ .daf-table {
16019
+ padding: 0px;
16020
+ margin-top: 0px;
16021
+
16022
+ .ant-tag {
16023
+ text-align: center;
16024
+ }
16025
+ }
16026
+
16027
+ .daf-select-filters .filters {
16028
+ padding-top: 16px;
16029
+ padding-left: 0;
16030
+ padding-right: 0;
16031
+ }
16032
+
16033
+ .daf-table {
16034
+ padding-top: 16px;
16035
+ }
16036
+ `;
16037
+
16038
+ /**
16039
+ * Checks if an activeFilters object contains any custom filters.
16040
+ * @param {Object} [activeFilters={}] - An object with active filters.
16041
+ * @returns {boolean} Whether the object contains any custom filters.
16042
+ */
16043
+ const hasFilter = (activeFilters = {}) => Object.keys(activeFilters || {}).find(k => !['page', 'pageSize', 'sortBy', 'sortDir', 'search', 'searchParams', 'activeTab'].includes(k));
16044
+
16045
+ const isNotEmpty = myString => /\S/.test(myString);
16046
+ const useOutsideAlerter = (ref, optionalRef, handler, dontCloseOnClickAway) => {
16047
+ React.useEffect(() => {
16048
+ function handleClickOutside(event) {
16049
+ if (!dontCloseOnClickAway) {
16050
+ // First if with optional ref, the second with only one
16051
+ if (optionalRef) {
16052
+ if (ref.current && optionalRef.current && !ref.current.contains(event.target) && !optionalRef.current.contains(event.target)) {
16053
+ handler();
16054
+ }
16055
+ } else if (ref.current && !ref.current.contains(event.target)) {
16056
+ handler();
16057
+ }
16058
+ }
16059
+ }
16060
+
16061
+ // Bind the event listener
16062
+ document.addEventListener('mousedown', handleClickOutside);
16063
+ return () => {
16064
+ // Unbind the event listener on clean up
16065
+ document.removeEventListener('mousedown', handleClickOutside);
16066
+ };
16067
+ }, [ref, dontCloseOnClickAway]);
16068
+ };
16069
+ const SearchFilters = ({
16070
+ filtersConfig = {},
16071
+ onSearch = () => {},
16072
+ setHasError = () => {},
16073
+ hasError = false,
16074
+ setShowFilters = () => {},
16075
+ // showFilters = false,
16076
+ activeFilters = {},
16077
+ canClear = false,
16078
+ showFilter = true,
16079
+ // clearFilters = () => { },
16080
+ className,
16081
+ t = s => s
16082
+ }) => {
16083
+ const ref = React.useRef();
16084
+ const optRef = React.useRef();
16085
+ const [typeIsOpen, setTypeIsOpen] = React.useState(false);
16086
+ const [lastInputValue, setLastInputValue] = React.useState('');
16087
+ const [activeFilter] = React.useState(activeFilters.searchParams || Object.keys(filtersConfig));
16088
+ const [isTyping, setIsTyping] = React.useState(false);
16089
+ const [inputValue, setInputValue] = React.useState('');
16090
+ useOutsideAlerter(ref, optRef, () => setTypeIsOpen(false), !typeIsOpen);
16091
+ React.useEffect(() => {
16092
+ if (activeFilters.search) {
16093
+ setInputValue(activeFilters.search);
16094
+ setLastInputValue(activeFilters.search);
16095
+ }
16096
+ }, []);
16097
+ React.useEffect(() => {
16098
+ if (hasFilter(activeFilters || {})) {
16099
+ setShowFilters(true);
16100
+ }
16101
+ }, []);
16102
+ React.useEffect(() => {
16103
+ if (hasError) {
16104
+ setHasError(false);
16105
+ }
16106
+ if (isNotEmpty(inputValue)) {
16107
+ setIsTyping(true);
16108
+ } else if (isTyping) {
16109
+ setIsTyping(false);
16110
+ }
16111
+ }, [activeFilter, inputValue]);
16112
+ const closeClicked = () => {
16113
+ setInputValue('');
16114
+ setLastInputValue('');
16115
+ onSearch(null, null);
16116
+ };
16117
+ const onSubmit = (isClose = false) => {
16118
+ if (lastInputValue === inputValue) {
16119
+ return;
16120
+ }
16121
+ setLastInputValue(inputValue);
16122
+ if (isNotEmpty(inputValue) && !isClose) {
16123
+ onSearch(activeFilter, inputValue);
16124
+ } else {
16125
+ onSearch(null, null);
16126
+ }
16127
+ };
16128
+ const openIfClosed = () => {
16129
+ };
16130
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
16131
+ className: formatClassname(['daf-search-filters', hasError && 'error', className]),
16132
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
16133
+ className: "input-container",
16134
+ ref: ref,
16135
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
16136
+ className: `input ${typeIsOpen && 'type-is-open'}`,
16137
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
16138
+ onClick: openIfClosed,
16139
+ className: "flex-1",
16140
+ children: /*#__PURE__*/jsxRuntime.jsx("input", {
16141
+ placeholder: t('Search'),
16142
+ value: inputValue,
16143
+ onKeyUp: e => {
16144
+ if (e.key === 'Enter') {
16145
+ onSubmit();
16146
+ // setTypeIsOpen(false);
16147
+ }
16148
+ },
16149
+ onBlur: () => {
16150
+ onSubmit();
16151
+ },
16152
+ onChange: e => {
16153
+ e.persist();
16154
+ setInputValue(e.target.value);
16155
+ },
16156
+ style: {
16157
+ paddingRight: isTyping && 30
16158
+ }
16159
+ })
16160
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
16161
+ className: "search-icon",
16162
+ onClick: openIfClosed,
16163
+ children: /*#__PURE__*/jsxRuntime.jsx(Icons.SearchOutlined, {})
16164
+ }), (isTyping || canClear) && lastInputValue.length ? /*#__PURE__*/jsxRuntime.jsx("div", {
16165
+ className: "mr",
16166
+ onClick: closeClicked,
16167
+ children: /*#__PURE__*/jsxRuntime.jsx(Icons.CloseOutlined, {})
16168
+ }) : null]
16169
+ }), hasError && /*#__PURE__*/jsxRuntime.jsxs("div", {
16170
+ className: "error-container",
16171
+ children: [/*#__PURE__*/jsxRuntime.jsx(Icons.ExclamationCircleFilled, {}), /*#__PURE__*/jsxRuntime.jsx("label", {
16172
+ style: {
16173
+ fontSize: 12
16174
+ },
16175
+ children: t('Oops, looks like there are no search matches. Please try again!')
16176
+ })]
16177
+ })]
16178
+ }), showFilter ? /*#__PURE__*/jsxRuntime.jsx("div", {
16179
+ className: "flex flex-column",
16180
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
16181
+ className: "ml-3 flex-1 squareIconButton no-min-width",
16182
+ onClick: () => {
16183
+ setShowFilters(p => !p);
16184
+ },
16185
+ icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
16186
+ name: "Filter",
16187
+ width: 16,
16188
+ height: 16
16189
+ })
16190
+ })
16191
+ }) : null]
16192
+ });
16193
+ };
16194
+ SearchFilters.propTypes = {
16195
+ filtersConfig: PropTypes__default["default"].any,
16196
+ onSearch: PropTypes__default["default"].func,
16197
+ setHasError: PropTypes__default["default"].func,
16198
+ hasError: PropTypes__default["default"].bool,
16199
+ setShowFilters: PropTypes__default["default"].func,
16200
+ showFilters: PropTypes__default["default"].bool,
16201
+ activeFilters: PropTypes__default["default"].object,
16202
+ canClear: PropTypes__default["default"].bool,
16203
+ showFilter: PropTypes__default["default"].any,
16204
+ clearFilters: PropTypes__default["default"].func,
16205
+ className: PropTypes__default["default"].string,
16206
+ t: PropTypes__default["default"].func
16207
+ };
16208
+
16209
+ const getColumns$e = ({
16210
+ t,
16211
+ activeTab,
16212
+ options,
16213
+ user,
16214
+ goTo,
16215
+ getRedirectLink,
16216
+ theme
16217
+ }) => [{
16218
+ dataIndex: "datastakeId",
16219
+ title: t("ID"),
16220
+ ellipsis: true,
16221
+ show: true,
16222
+ render: (v, all) => {
16223
+ if (all.empty) {
16224
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16225
+ className: "daf-default-cell"
16226
+ });
16227
+ }
16228
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16229
+ title: v,
16230
+ children: v || "-"
16231
+ });
16232
+ }
16233
+ }, {
16234
+ dataIndex: "name",
16235
+ title: activeTab === "documents" || activeTab === "events" ? t("Title") : t("Name"),
16236
+ ellipsis: true,
16237
+ show: true,
16238
+ render: (v, all) => {
16239
+ if (all.empty) {
16240
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16241
+ className: "daf-default-cell"
16242
+ });
16243
+ }
16244
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16245
+ title: v,
16246
+ children: v || "-"
16247
+ });
16248
+ }
16249
+ }, {
16250
+ dataIndex: "keyStakeholders",
16251
+ title: t("Key Stakeholders"),
16252
+ ellipsis: true,
16253
+ show: activeTab === "events",
16254
+ render: (v, all) => {
16255
+ if (all.empty) {
16256
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16257
+ className: "daf-default-cell"
16258
+ });
16259
+ }
16260
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16261
+ title: v,
16262
+ children: v || "-"
16263
+ });
16264
+ }
16265
+ }, {
16266
+ dataIndex: "category",
16267
+ title: t("Category"),
16268
+ ellipsis: true,
16269
+ show: activeTab === "stakeholders" || activeTab === "locations",
16270
+ render: (v, all) => {
16271
+ if (all.empty) {
16272
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16273
+ className: "daf-default-cell"
16274
+ });
16275
+ }
16276
+ const label = findOptions(v, options?.categoriesOptions) || "-";
16277
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16278
+ title: label,
16279
+ children: label || "-"
16280
+ });
16281
+ }
16282
+ }, {
16283
+ dataIndex: "subCategory",
16284
+ title: t("Legal Form"),
16285
+ ellipsis: true,
16286
+ show: activeTab === "stakeholders",
16287
+ render: (v, all) => {
16288
+ if (all.empty) {
16289
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16290
+ className: "daf-default-cell"
16291
+ });
16292
+ }
16293
+ const label = findOptions(v, options?.subCategoriesOptionsSbgi) || "-";
16294
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16295
+ title: label,
16296
+ children: label || "-"
16297
+ });
16298
+ }
16299
+ }, {
16300
+ dataIndex: "country",
16301
+ title: t("Country"),
16302
+ ellipsis: true,
16303
+ show: activeTab === "stakeholders" || activeTab === "locations",
16304
+ render: (v, all) => {
16305
+ if (all.empty) {
16306
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16307
+ className: "daf-default-cell"
16308
+ });
16309
+ }
16310
+ const label = findOptions(v, options?.countries) || "-";
16311
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16312
+ title: label,
16313
+ children: label || "-"
16314
+ });
16315
+ }
16316
+ }, {
16317
+ dataIndex: 'region',
16318
+ title: findOptions(user?.company?.country, options?.administrativeLevel1)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel1) : t("Province"),
16319
+ ellipsis: true,
16320
+ show: activeTab === "locations",
16321
+ render: (v, all) => {
16322
+ if (all.empty) {
16323
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16324
+ className: "daf-default-cell"
16325
+ });
16326
+ }
16327
+ const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
16328
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16329
+ title: region,
16330
+ children: region
16331
+ }) : '-';
16332
+ }
16333
+ }, {
16334
+ dataIndex: 'territory',
16335
+ title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2) : t("Territory"),
16336
+ ellipsis: true,
16337
+ show: activeTab === "locations",
16338
+ render: (v, all) => {
16339
+ if (all.empty) {
16340
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16341
+ className: "daf-default-cell"
16342
+ });
16343
+ }
16344
+ const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
16345
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16346
+ title: district,
16347
+ children: district
16348
+ }) : '-';
16349
+ }
16350
+ }, {
16351
+ dataIndex: "type",
16352
+ show: activeTab === "documents",
16353
+ title: t("Type"),
16354
+ ellipsis: true,
16355
+ render: (v, all) => {
16356
+ if (all.empty) {
16357
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16358
+ className: "daf-default-cell"
16359
+ });
16360
+ }
16361
+ const label = findOptions(v, options?.documentationTypesOptions) || "-";
16362
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16363
+ title: label,
16364
+ children: label || "-"
16365
+ });
16366
+ }
16367
+ }, {
16368
+ dataIndex: "date",
16369
+ title: t("Date"),
16370
+ ellipsis: true,
16371
+ show: activeTab === "events",
16372
+ render: (v, all) => {
16373
+ if (all.empty) {
16374
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16375
+ className: "daf-default-cell"
16376
+ });
16377
+ }
16378
+ const language = user?.language === 'sp' ? 'es' : user?.language;
16379
+ const date = v ? renderDateFormatted(v, 'DD MMM YYYY', language || 'en') : '-';
16380
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16381
+ title: date,
16382
+ children: date
16383
+ });
16384
+ }
16385
+ }, {
16386
+ dataIndex: "lastUpdated",
16387
+ title: t("Last Update"),
16388
+ ellipsis: true,
16389
+ show: true,
16390
+ render: (v, all) => {
16391
+ if (all.empty) {
16392
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16393
+ className: "daf-default-cell"
16394
+ });
16395
+ }
16396
+ const language = user?.language === 'sp' ? 'es' : user?.language;
16397
+ const date = v ? renderDateFormatted(v, 'DD MMM YYYY', language || 'en') : '-';
16398
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16399
+ title: date,
16400
+ children: date
16401
+ });
16402
+ }
16403
+ }, {
16404
+ dataIndex: "scope",
16405
+ title: t("Scope"),
16406
+ ellipsis: true,
16407
+ show: activeTab === "events",
16408
+ render: (v, all) => {
16409
+ if (all.empty) {
16410
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16411
+ className: "daf-default-cell"
16412
+ });
16413
+ }
16414
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16415
+ title: v,
16416
+ children: v || "-"
16417
+ });
16418
+ }
16419
+ }, {
16420
+ dataIndex: "content",
16421
+ title: t("Content"),
16422
+ ellipsis: true,
16423
+ show: activeTab === "documents",
16424
+ render: (_, all) => {
16425
+ if (all.empty) {
16426
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16427
+ className: "daf-default-cell"
16428
+ });
16429
+ }
16430
+ const content = {
16431
+ name: all?.content?.[0]?.name,
16432
+ link: all?.content?.[0]?.url
16433
+ };
16434
+ return /*#__PURE__*/jsxRuntime.jsx("a", {
16435
+ href: content.link,
16436
+ target: "_blank",
16437
+ rel: "noopener noreferrer",
16438
+ style: {
16439
+ // maxWidth: "100px",
16440
+ whiteSpace: "nowrap",
16441
+ overflow: "hidden",
16442
+ textOverflow: "ellipsis"
16443
+ },
16444
+ children: content.name
16445
+ });
16446
+ }
16447
+ }, {
16448
+ title: t(""),
16449
+ dataIndex: "actions",
16450
+ key: "actions",
16451
+ width: 60,
16452
+ show: true,
16453
+ render: (v, all) => {
16454
+ if (all.empty) {
16455
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
16456
+ className: "daf-default-cell"
16457
+ });
16458
+ }
16459
+ const link = `/app/view/${activeTab}/${all.datastakeId}`;
16460
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
16461
+ onClick: () => goTo(getRedirectLink(link)),
16462
+ theme: theme
16463
+ });
16464
+ }
16465
+ }].filter(column => column.show);
16466
+
16467
+ function AssociatedInformation$1({
16468
+ t = () => {},
16469
+ user = {},
16470
+ goTo = () => {},
16471
+ getRedirectLink = () => {},
16472
+ options = {}
16473
+ }) {
16474
+ const tabs = [{
16475
+ value: "stakeholders",
16476
+ label: t("Stakeholders")
16477
+ }, {
16478
+ value: "locations",
16479
+ label: t("Locations")
16480
+ }, {
16481
+ value: "documents",
16482
+ label: t("Documents")
16483
+ }, {
16484
+ value: "events",
16485
+ label: t("Events")
16486
+ }];
16487
+ const [activeTab, setActiveTab] = React.useState("stakeholders");
16488
+ const data = [];
16489
+ const columns = React.useMemo(() => getColumns$e({
16490
+ t,
16491
+ isMonitoring: false,
16492
+ activeTab,
16493
+ options,
16494
+ getRedirectLink,
16495
+ user
16496
+ }), [t, activeTab, options, getRedirectLink, user]);
16497
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
16498
+ title: t("Associated Information"),
16499
+ expandable: true,
16500
+ className: "with-border-header no-px-body overflow-hidden",
16501
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
16502
+ style: {
16503
+ display: "flex",
16504
+ flexDirection: "column",
16505
+ gap: "24px",
16506
+ marginLeft: "12px"
16507
+ },
16508
+ children: [/*#__PURE__*/jsxRuntime.jsx(TabsHeader, {
16509
+ tabs: tabs,
16510
+ onChange: setActiveTab,
16511
+ value: activeTab,
16512
+ className: "mt-0"
16513
+ }), /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
16514
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
16515
+ children: /*#__PURE__*/jsxRuntime.jsx(SearchFilters, {
16516
+ t: t
16517
+ })
16518
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
16519
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
16520
+ className: "daf-table-wrapper",
16521
+ children: /*#__PURE__*/jsxRuntime.jsx(DAFTable, {
16522
+ columns: columns,
16523
+ data: data[activeTab],
16524
+ className: "pr-0",
16525
+ doEmptyRows: true,
16526
+ rowKey: "datas",
16527
+ hideOnLoading: false,
16528
+ scroll: {
16529
+ x: false,
16530
+ y: 55 * 5
16531
+ }
16532
+ }, activeTab)
16533
+ })
16534
+ })]
16535
+ })]
16536
+ })
16537
+ });
16538
+ }
16539
+
16540
+ function SelfAssesment({
16541
+ t = () => {},
16542
+ breadcrumbs = [],
16543
+ user = {},
16544
+ goTo = () => {},
16545
+ getRedirectLink = () => {},
16546
+ theme = {},
16547
+ options = {}
16548
+ }) {
16549
+ return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
16550
+ header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
16551
+ title: t("Self Assesment"),
16552
+ breadcrumbs: breadcrumbs
16553
+ }),
16554
+ children: [/*#__PURE__*/jsxRuntime.jsx("section", {
16555
+ children: /*#__PURE__*/jsxRuntime.jsx(OrganisationInformation, {
16556
+ t: t,
16557
+ user: user,
16558
+ goTo: goTo,
16559
+ getRedirectLink: getRedirectLink,
16560
+ theme: theme
16561
+ })
16562
+ }), /*#__PURE__*/jsxRuntime.jsx("section", {
16563
+ children: /*#__PURE__*/jsxRuntime.jsx(ProductionSites, {
16564
+ t: t,
16565
+ options: options,
16566
+ user: user,
16567
+ goTo: goTo,
16568
+ getRedirectLink: getRedirectLink
16569
+ })
16570
+ }), /*#__PURE__*/jsxRuntime.jsx("section", {
16571
+ children: /*#__PURE__*/jsxRuntime.jsx(AssociatedInformation$1, {
16572
+ t: t,
16573
+ user: user,
16574
+ goTo: goTo,
16575
+ getRedirectLink: getRedirectLink
16576
+ })
16577
+ })]
16578
+ });
16579
+ }
16580
+
16581
+ const {
16582
+ useToken: useToken$4
16583
+ } = antd.theme;
16584
+ const MAX_LENGTH = 3;
16585
+ function AvatarGroup({
16586
+ items = [],
16587
+ maxLength = MAX_LENGTH,
16588
+ size = "small"
16589
+ }) {
16590
+ const count = items.length === maxLength + 1 ? items.length : maxLength;
16591
+ const {
16592
+ token
16593
+ } = useToken$4();
16594
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
16595
+ max: {
16596
+ count: count,
16597
+ style: {
16598
+ color: token.baseGray90,
16599
+ backgroundColor: token.baseGray20,
16600
+ border: `1px solid ${token.baseGray40}`
16601
+ }
16602
+ },
16603
+ size: "small",
16604
+ children: items.map((v, i) => /*#__PURE__*/jsxRuntime.jsx(antd.Avatar, {
16605
+ size: size,
16606
+ style: {
16607
+ backgroundColor: v.isOwn ? token.colorPrimary : token.baseGray20,
16608
+ color: v.isOwn ? "white" : token.baseGray90,
16609
+ border: `1px solid ${v.isOwn ? "white" : token.baseGray40}`,
16610
+ display: "flex",
16611
+ alignItems: "center",
16612
+ justifyContent: "center"
16613
+ },
16614
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16615
+ title: v.name || "",
16616
+ placement: "top",
16617
+ children: v.isOwn ? /*#__PURE__*/jsxRuntime.jsx("span", {
16618
+ children: "OWN"
16619
+ }) : [v.icon ? /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
16620
+ name: v.icon,
16621
+ width: v.size || 18,
16622
+ height: v.size || 18,
16623
+ color: token.baseGray90
16624
+ }) : v.name ? v.name.charAt(0).toUpperCase() : "U"]
16625
+ })
16626
+ }, i))
16627
+ });
16628
+ }
16629
+
16630
+ function sourceAvatarConfig(items, user, applications) {
16631
+ const userInterface = user?.company?.apps?.[0]?.interface;
16632
+ const icon = applications[0]?.interfaces?.find(i => i.value === userInterface)?.iconName;
16633
+ const sources = [];
16634
+ items?.length > 0 && items?.forEach(author => {
16635
+ if (author?.id) {
16636
+ if (author.id === user?.company?.id) {
16637
+ // it's own data
16638
+ sources.push({
16639
+ name: author.name,
16640
+ icon: 'OwnData',
16641
+ isOwn: true,
16642
+ sourceId: author.id
16643
+ });
16644
+ } else {
16645
+ sources.push({
16646
+ name: author.name,
16647
+ icon: icon,
16648
+ isOwn: false,
16649
+ sourceId: author.id
16650
+ });
16651
+ }
16652
+ }
16653
+ });
16654
+
16655
+ // sort to have own data first
16656
+ return sources.sort((a, b) => {
16657
+ if (a.isOwn && !b.isOwn) return -1;
16658
+ if (!a.isOwn && b.isOwn) return 1;
16659
+ return 0;
16660
+ });
16661
+ }
16662
+
15362
16663
  const renderStatusTag = ({
15363
16664
  value,
15364
16665
  t = s => s
@@ -15604,345 +16905,6 @@ const getColumns$d = ({
15604
16905
  }
15605
16906
  }].filter(column => column.show !== false);
15606
16907
 
15607
- /**
15608
- * Checks if an activeFilters object contains any custom filters.
15609
- * @param {Object} [activeFilters={}] - An object with active filters.
15610
- * @returns {boolean} Whether the object contains any custom filters.
15611
- */
15612
- const hasFilter = (activeFilters = {}) => Object.keys(activeFilters || {}).find(k => !['page', 'pageSize', 'sortBy', 'sortDir', 'search', 'searchParams', 'activeTab'].includes(k));
15613
-
15614
- const isNotEmpty = myString => /\S/.test(myString);
15615
- const useOutsideAlerter = (ref, optionalRef, handler, dontCloseOnClickAway) => {
15616
- React.useEffect(() => {
15617
- function handleClickOutside(event) {
15618
- if (!dontCloseOnClickAway) {
15619
- // First if with optional ref, the second with only one
15620
- if (optionalRef) {
15621
- if (ref.current && optionalRef.current && !ref.current.contains(event.target) && !optionalRef.current.contains(event.target)) {
15622
- handler();
15623
- }
15624
- } else if (ref.current && !ref.current.contains(event.target)) {
15625
- handler();
15626
- }
15627
- }
15628
- }
15629
-
15630
- // Bind the event listener
15631
- document.addEventListener('mousedown', handleClickOutside);
15632
- return () => {
15633
- // Unbind the event listener on clean up
15634
- document.removeEventListener('mousedown', handleClickOutside);
15635
- };
15636
- }, [ref, dontCloseOnClickAway]);
15637
- };
15638
- const SearchFilters = ({
15639
- filtersConfig = {},
15640
- onSearch = () => {},
15641
- setHasError = () => {},
15642
- hasError = false,
15643
- setShowFilters = () => {},
15644
- // showFilters = false,
15645
- activeFilters = {},
15646
- canClear = false,
15647
- showFilter = true,
15648
- // clearFilters = () => { },
15649
- className,
15650
- t = s => s
15651
- }) => {
15652
- const ref = React.useRef();
15653
- const optRef = React.useRef();
15654
- const [typeIsOpen, setTypeIsOpen] = React.useState(false);
15655
- const [lastInputValue, setLastInputValue] = React.useState('');
15656
- const [activeFilter] = React.useState(activeFilters.searchParams || Object.keys(filtersConfig));
15657
- const [isTyping, setIsTyping] = React.useState(false);
15658
- const [inputValue, setInputValue] = React.useState('');
15659
- useOutsideAlerter(ref, optRef, () => setTypeIsOpen(false), !typeIsOpen);
15660
- React.useEffect(() => {
15661
- if (activeFilters.search) {
15662
- setInputValue(activeFilters.search);
15663
- setLastInputValue(activeFilters.search);
15664
- }
15665
- }, []);
15666
- React.useEffect(() => {
15667
- if (hasFilter(activeFilters || {})) {
15668
- setShowFilters(true);
15669
- }
15670
- }, []);
15671
- React.useEffect(() => {
15672
- if (hasError) {
15673
- setHasError(false);
15674
- }
15675
- if (isNotEmpty(inputValue)) {
15676
- setIsTyping(true);
15677
- } else if (isTyping) {
15678
- setIsTyping(false);
15679
- }
15680
- }, [activeFilter, inputValue]);
15681
- const closeClicked = () => {
15682
- setInputValue('');
15683
- setLastInputValue('');
15684
- onSearch(null, null);
15685
- };
15686
- const onSubmit = (isClose = false) => {
15687
- if (lastInputValue === inputValue) {
15688
- return;
15689
- }
15690
- setLastInputValue(inputValue);
15691
- if (isNotEmpty(inputValue) && !isClose) {
15692
- onSearch(activeFilter, inputValue);
15693
- } else {
15694
- onSearch(null, null);
15695
- }
15696
- };
15697
- const openIfClosed = () => {
15698
- };
15699
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
15700
- className: formatClassname(['daf-search-filters', hasError && 'error', className]),
15701
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
15702
- className: "input-container",
15703
- ref: ref,
15704
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
15705
- className: `input ${typeIsOpen && 'type-is-open'}`,
15706
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
15707
- onClick: openIfClosed,
15708
- className: "flex-1",
15709
- children: /*#__PURE__*/jsxRuntime.jsx("input", {
15710
- placeholder: t('Search'),
15711
- value: inputValue,
15712
- onKeyUp: e => {
15713
- if (e.key === 'Enter') {
15714
- onSubmit();
15715
- // setTypeIsOpen(false);
15716
- }
15717
- },
15718
- onBlur: () => {
15719
- onSubmit();
15720
- },
15721
- onChange: e => {
15722
- e.persist();
15723
- setInputValue(e.target.value);
15724
- },
15725
- style: {
15726
- paddingRight: isTyping && 30
15727
- }
15728
- })
15729
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
15730
- className: "search-icon",
15731
- onClick: openIfClosed,
15732
- children: /*#__PURE__*/jsxRuntime.jsx(Icons.SearchOutlined, {})
15733
- }), (isTyping || canClear) && lastInputValue.length ? /*#__PURE__*/jsxRuntime.jsx("div", {
15734
- className: "mr",
15735
- onClick: closeClicked,
15736
- children: /*#__PURE__*/jsxRuntime.jsx(Icons.CloseOutlined, {})
15737
- }) : null]
15738
- }), hasError && /*#__PURE__*/jsxRuntime.jsxs("div", {
15739
- className: "error-container",
15740
- children: [/*#__PURE__*/jsxRuntime.jsx(Icons.ExclamationCircleFilled, {}), /*#__PURE__*/jsxRuntime.jsx("label", {
15741
- style: {
15742
- fontSize: 12
15743
- },
15744
- children: t('Oops, looks like there are no search matches. Please try again!')
15745
- })]
15746
- })]
15747
- }), showFilter ? /*#__PURE__*/jsxRuntime.jsx("div", {
15748
- className: "flex flex-column",
15749
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
15750
- className: "ml-3 flex-1 squareIconButton no-min-width",
15751
- onClick: () => {
15752
- setShowFilters(p => !p);
15753
- },
15754
- icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
15755
- name: "Filter",
15756
- width: 16,
15757
- height: 16
15758
- })
15759
- })
15760
- }) : null]
15761
- });
15762
- };
15763
- SearchFilters.propTypes = {
15764
- filtersConfig: PropTypes__default["default"].any,
15765
- onSearch: PropTypes__default["default"].func,
15766
- setHasError: PropTypes__default["default"].func,
15767
- hasError: PropTypes__default["default"].bool,
15768
- setShowFilters: PropTypes__default["default"].func,
15769
- showFilters: PropTypes__default["default"].bool,
15770
- activeFilters: PropTypes__default["default"].object,
15771
- canClear: PropTypes__default["default"].bool,
15772
- showFilter: PropTypes__default["default"].any,
15773
- clearFilters: PropTypes__default["default"].func,
15774
- className: PropTypes__default["default"].string,
15775
- t: PropTypes__default["default"].func
15776
- };
15777
-
15778
- const SCROLL = {
15779
- y: 550,
15780
- x: 1000
15781
- };
15782
- const getLocales = t => ({
15783
- triggerDesc: t('Click to sort descending'),
15784
- triggerAsc: t('Click to sort ascending')
15785
- });
15786
-
15787
- function DAFTable({
15788
- columns = [],
15789
- data = [],
15790
- defaultFilters = {},
15791
- style = {},
15792
- pagination = null,
15793
- loading = false,
15794
- onChange = () => {},
15795
- onFilterChange = () => {},
15796
- selectOptions,
15797
- filtersConfig,
15798
- rowSelection = false,
15799
- setShowFilters = () => {},
15800
- rowKey = 'id',
15801
- showFilters = false,
15802
- hideOnLoading = true,
15803
- sourcesKey,
15804
- className,
15805
- projects = [],
15806
- t = s => s,
15807
- selectedProject,
15808
- sourceId = '',
15809
- projectSources = [],
15810
- language = 'en',
15811
- scrollX = true,
15812
- apiUrl,
15813
- app,
15814
- doEmptyRows,
15815
- ...rest
15816
- }) {
15817
- const [source, setSource] = React.useState([]);
15818
- const projectData = (projects || []).find(p => p.id === selectedProject);
15819
- const [filtersInit, setFiltersInit] = React.useState(!loading);
15820
- React.useEffect(() => {
15821
- if (!filtersInit && !loading) {
15822
- setFiltersInit(true);
15823
- }
15824
- }, [loading, filtersInit]);
15825
- const sources = React.useMemo(() => {
15826
- if (projectData) {
15827
- if (sourceId === 'overview') {
15828
- return projectSources.map(val => {
15829
- return {
15830
- label: val.company?.name || '',
15831
- value: val.authorId
15832
- };
15833
- });
15834
- }
15835
- }
15836
- return undefined;
15837
- }, [projectData, sourceId, projectSources]);
15838
- const _selectOptions = React.useMemo(() => {
15839
- return typeof sourcesKey === 'string' && sources ? {
15840
- ...selectOptions,
15841
- [sourcesKey]: sources
15842
- } : selectOptions;
15843
- }, [sourcesKey, sources, selectOptions]);
15844
- const _filtersConfig = React.useMemo(() => {
15845
- return typeof sourcesKey === 'string' && sources ? {
15846
- ...filtersConfig,
15847
- [sourcesKey]: {
15848
- type: "select",
15849
- label: t("Source"),
15850
- placeholder: t => `${t("Filter By")} ${t('Source')}`,
15851
- labelStyle: {
15852
- flex: 1
15853
- },
15854
- style: {
15855
- flex: 1
15856
- },
15857
- getLabel: opt => opt.label,
15858
- getValue: opt => opt.value
15859
- }
15860
- } : filtersConfig;
15861
- }, [sourcesKey, sources, filtersConfig, t]);
15862
- React.useEffect(() => {
15863
- if (data && Array.isArray(data)) {
15864
- setSource(data);
15865
- }
15866
- }, [data, data.length]);
15867
- const paginationPageSize = pagination?.pageSize;
15868
- const dataSource = React.useMemo(() => {
15869
- const pageSize = paginationPageSize ? paginationPageSize : source.length > 10 ? source.length : 10;
15870
- if (doEmptyRows && pageSize) {
15871
- const emptyDataSource = [];
15872
- for (let i = 0; i < pageSize; i++) {
15873
- emptyDataSource.push({
15874
- id: i,
15875
- empty: true,
15876
- key: i
15877
- });
15878
- }
15879
- return emptyDataSource.map((empty, i) => source[i] || empty);
15880
- }
15881
- return source;
15882
- }, [source, paginationPageSize, doEmptyRows]);
15883
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
15884
- children: [showFilters && filtersConfig && onFilterChange && filtersInit && /*#__PURE__*/jsxRuntime.jsx(SelectFilters, {
15885
- app: app,
15886
- language: language,
15887
- t: t,
15888
- apiUrl: apiUrl,
15889
- className: className,
15890
- options: _selectOptions,
15891
- filtersConfig: _filtersConfig,
15892
- onApply: filters => {
15893
- onFilterChange(filters);
15894
- },
15895
- showFilters: showFilters,
15896
- setShowFilters: setShowFilters,
15897
- selectedFilters: defaultFilters
15898
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
15899
- style: style,
15900
- className: formatClassname(['daf-table', className]),
15901
- children: (!loading || !hideOnLoading) && /*#__PURE__*/jsxRuntime.jsx(antd.Table, {
15902
- size: "small",
15903
- sort: true,
15904
- rowKey: rowKey,
15905
- scroll: scrollX ? {
15906
- x: SCROLL.x
15907
- } : undefined,
15908
- rowSelection: rowSelection,
15909
- columns: columns,
15910
- loading: !hideOnLoading ? loading : false,
15911
- dataSource: dataSource,
15912
- pagination: pagination,
15913
- onChange: onChange,
15914
- ...rest
15915
- })
15916
- })]
15917
- });
15918
- }
15919
- DAFTable.propTypes = {
15920
- columns: PropTypes__default["default"].any,
15921
- data: PropTypes__default["default"].any,
15922
- defaultFilters: PropTypes__default["default"].object,
15923
- style: PropTypes__default["default"].object,
15924
- pagination: PropTypes__default["default"].any,
15925
- loading: PropTypes__default["default"].bool,
15926
- onChange: PropTypes__default["default"].func,
15927
- onFilterChange: PropTypes__default["default"].func,
15928
- selectOptions: PropTypes__default["default"].object,
15929
- filtersConfig: PropTypes__default["default"].any,
15930
- rowSelection: PropTypes__default["default"].bool,
15931
- rowKey: PropTypes__default["default"].any,
15932
- showFilters: PropTypes__default["default"].bool,
15933
- hideOnLoading: PropTypes__default["default"].bool,
15934
- sourcesKey: PropTypes__default["default"].any,
15935
- className: PropTypes__default["default"].any,
15936
- projects: PropTypes__default["default"].any,
15937
- t: PropTypes__default["default"].func,
15938
- selectedProject: PropTypes__default["default"].any,
15939
- sourceId: PropTypes__default["default"].any,
15940
- projectSources: PropTypes__default["default"].any,
15941
- language: PropTypes__default["default"].string,
15942
- setShowFilters: PropTypes__default["default"].func,
15943
- scrollX: PropTypes__default["default"].any
15944
- };
15945
-
15946
16908
  const pageValues = [10, 20, 50, 100];
15947
16909
  function Pagination({
15948
16910
  page = 0,
@@ -21125,7 +22087,7 @@ function Comments({
21125
22087
  });
21126
22088
  }
21127
22089
 
21128
- var Style$6 = styled__default["default"].div`
22090
+ var Style$5 = styled__default["default"].div`
21129
22091
  border: 1px solid var(--base-gray-40);
21130
22092
  padding: 12px;
21131
22093
  background: var(--base-gray-20);
@@ -21271,7 +22233,7 @@ function GroupInfoHOC({
21271
22233
  meta,
21272
22234
  t
21273
22235
  });
21274
- return /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
22236
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$5, {
21275
22237
  className: formatClassname([!isExpanded && 'collapsed', className, isSuccess && 'success']),
21276
22238
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
21277
22239
  className: "cont-header",
@@ -21428,7 +22390,7 @@ function GroupInfo({
21428
22390
  });
21429
22391
  }
21430
22392
  };
21431
- return /*#__PURE__*/jsxRuntime.jsxs(Style$6, {
22393
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$5, {
21432
22394
  className: formatClassname([!isExpanded && 'collapsed', className]),
21433
22395
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
21434
22396
  className: "cont-header",
@@ -21469,7 +22431,7 @@ function GroupInfos({
21469
22431
  }, key));
21470
22432
  }
21471
22433
 
21472
- const Style$5 = styled__default["default"].div`
22434
+ const Style$4 = styled__default["default"].div`
21473
22435
  gap: 16px;
21474
22436
  display: flex;
21475
22437
  max-width: 465px;
@@ -21491,7 +22453,7 @@ function EvaluationPopover({
21491
22453
  t = s => s,
21492
22454
  evaluationConfig = []
21493
22455
  }) {
21494
- return /*#__PURE__*/jsxRuntime.jsx(Style$5, {
22456
+ return /*#__PURE__*/jsxRuntime.jsx(Style$4, {
21495
22457
  children: evaluationConfig.map(c =>
21496
22458
  /*#__PURE__*/
21497
22459
  //? ASK REDI
@@ -23463,7 +24425,7 @@ const useMapHelper = ({
23463
24425
  };
23464
24426
  };
23465
24427
 
23466
- const Style$4 = styled__default["default"].div`
24428
+ const Style$3 = styled__default["default"].div`
23467
24429
  width: 100%;
23468
24430
  height: 20rem;
23469
24431
  flex: 1;
@@ -23590,7 +24552,7 @@ function PolygonSelector({
23590
24552
  searchForLocation(mapRef);
23591
24553
  }
23592
24554
  }, [searchValue, mapRef]);
23593
- return /*#__PURE__*/jsxRuntime.jsxs(Style$4, {
24555
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$3, {
23594
24556
  className: "polygon-selector",
23595
24557
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
23596
24558
  className: "map-container",
@@ -30354,34 +31316,6 @@ const viewConfig$8 = {
30354
31316
  createTitle: "Create Stakeholder"
30355
31317
  };
30356
31318
 
30357
- const NavigationAction = ({
30358
- onClick,
30359
- theme
30360
- }) => {
30361
- return /*#__PURE__*/jsxRuntime.jsx("div", {
30362
- style: {
30363
- display: "flex",
30364
- justifyContent: "center"
30365
- },
30366
- children: /*#__PURE__*/jsxRuntime.jsx("button", {
30367
- onClick: onClick,
30368
- style: {
30369
- cursor: 'pointer',
30370
- border: 'none',
30371
- background: 'transparent',
30372
- padding: 0,
30373
- display: 'flex',
30374
- alignItems: 'center'
30375
- },
30376
- children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
30377
- name: "Link",
30378
- size: 15,
30379
- color: theme.baseGray70
30380
- })
30381
- })
30382
- });
30383
- };
30384
-
30385
31319
  const getColumns$c = ({
30386
31320
  t,
30387
31321
  goTo,
@@ -32870,7 +33804,7 @@ const getFiltersConfig$3 = ({
32870
33804
  getLabel: option => option.label,
32871
33805
  getValue: option => option.value
32872
33806
  },
32873
- type: {
33807
+ category: {
32874
33808
  type: 'select',
32875
33809
  label: 'Type',
32876
33810
  placeholder: () => `${t('Filter by')} ${t('Type').toLowerCase()}`,
@@ -32924,13 +33858,14 @@ const getFilterOptions$3 = (options, t) => {
32924
33858
  administrativeLevel1,
32925
33859
  administrativeLevel2,
32926
33860
  mineralOptions,
33861
+ productionSiteCategories,
32927
33862
  locationCategories = []
32928
33863
  } = options || {};
32929
33864
  const _default = {
32930
- category: stakeholderCategoryOptions || categoryOptions,
33865
+ // category: stakeholderCategoryOptions || categoryOptions,
32931
33866
  country: countries,
32932
33867
  product: mineralOptions,
32933
- type: locationCategories,
33868
+ category: productionSiteCategories || locationCategories,
32934
33869
  administrativeLevel1,
32935
33870
  administrativeLevel2,
32936
33871
  subCategory: subCategoriesOptions,
@@ -35745,7 +36680,7 @@ const Create = ({
35745
36680
  });
35746
36681
  };
35747
36682
 
35748
- const Style$3 = styled__default["default"].div`
36683
+ const Style$2 = styled__default["default"].div`
35749
36684
  display: flex;
35750
36685
  gap: 8px;
35751
36686
  justify-content: center;
@@ -35768,7 +36703,7 @@ function Footer({
35768
36703
  disabledFooterText,
35769
36704
  disabledFooter
35770
36705
  }) {
35771
- return /*#__PURE__*/jsxRuntime.jsxs(Style$3, {
36706
+ return /*#__PURE__*/jsxRuntime.jsxs(Style$2, {
35772
36707
  className: className,
35773
36708
  children: [disabledFooterText ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
35774
36709
  title: t(disabledFooterText),
@@ -38152,94 +39087,6 @@ const OperatorSummary = ({
38152
39087
  });
38153
39088
  };
38154
39089
 
38155
- function StickyTable({
38156
- size = "small",
38157
- maxHeight = 300,
38158
- containerHeight = 525,
38159
- dataSource = [],
38160
- columns = {},
38161
- pagination = false,
38162
- doEmptyRows = true,
38163
- ...props
38164
- }) {
38165
- const data = React__default["default"].useMemo(() => {
38166
- if (!doEmptyRows) {
38167
- return dataSource;
38168
- }
38169
- const MIN_ROWS = 4;
38170
- if (dataSource.length < MIN_ROWS) {
38171
- const paddedData = [...dataSource];
38172
- while (paddedData.length < MIN_ROWS) {
38173
- paddedData.push({
38174
- empty: true
38175
- });
38176
- }
38177
- return paddedData;
38178
- }
38179
- return dataSource;
38180
- }, [dataSource, doEmptyRows]);
38181
- const Wrapper = React__default["default"].useMemo(() => {
38182
- return data.length > 5 ? ComponentWithFocus : "div";
38183
- }, [data.length]);
38184
- return /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
38185
- children: /*#__PURE__*/jsxRuntime.jsx(Style$2, {
38186
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
38187
- className: "daf-table-wrapper",
38188
- style: {
38189
- maxHeight: containerHeight,
38190
- overflowY: "auto"
38191
- },
38192
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
38193
- className: "daf-sticky-table",
38194
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Table, {
38195
- ...props,
38196
- size: size,
38197
- scroll: true,
38198
- sticky: true,
38199
- style: {
38200
- maxHeight
38201
- },
38202
- dataSource: data,
38203
- columns: columns,
38204
- pagination: pagination
38205
- })
38206
- })
38207
- })
38208
- })
38209
- });
38210
- }
38211
- const Style$2 = styled__default["default"].div`
38212
- max-width: calc(100% - 48px);
38213
- margin-left: var(--size-lg);
38214
- overflow: hidden;
38215
-
38216
- .daf-table {
38217
- padding: 0px;
38218
- margin-top: 0px;
38219
-
38220
- .ant-tag {
38221
- text-align: center;
38222
- }
38223
- }
38224
-
38225
- .daf-select-filters .filters {
38226
- padding-top: 16px;
38227
- padding-left: 0;
38228
- padding-right: 0;
38229
- }
38230
-
38231
- .daf-table {
38232
- padding-top: 16px;
38233
- }
38234
- `;
38235
- StickyTable.propTypes = {
38236
- size: PropTypes__default["default"].any,
38237
- maxHeight: PropTypes__default["default"].number,
38238
- dataSource: PropTypes__default["default"].array,
38239
- columns: PropTypes__default["default"].object,
38240
- pagination: PropTypes__default["default"].any
38241
- };
38242
-
38243
39090
  ({
38244
39091
  content: PropTypes__default["default"].string,
38245
39092
  size: PropTypes__default["default"].oneOf(['large', 'middle', 'small']),
@@ -41369,25 +42216,6 @@ styled__default["default"](antd.Select)`
41369
42216
  }
41370
42217
  `;
41371
42218
 
41372
- styled__default["default"].div`
41373
- width: 99px;
41374
- height: 10px;
41375
- border-radius: 8px;
41376
- background: var(--base-gray-40);
41377
- overflow: hidden;
41378
-
41379
- .bar {
41380
- height: 100%;
41381
- background: var(--color-primary-70);
41382
- }
41383
- `;
41384
- ({
41385
- tooltipTitle: PropTypes__default["default"].string,
41386
- percentage: PropTypes__default["default"].number,
41387
- onClick: PropTypes__default["default"].any,
41388
- style: PropTypes__default["default"].any
41389
- });
41390
-
41391
42219
  styled__default["default"].div`
41392
42220
  height: 6px;
41393
42221
  width: 100%;
@@ -41407,22 +42235,6 @@ styled__default["default"].div`
41407
42235
  showInfo: PropTypes__default["default"].bool
41408
42236
  });
41409
42237
 
41410
- styled__default["default"].div`
41411
- .icon-background {
41412
- width: ${({
41413
- size
41414
- }) => size}px;
41415
- height: ${({
41416
- size
41417
- }) => size}px;
41418
- background-color: #69d99e;
41419
- border-radius: 50%;
41420
- display: flex;
41421
- align-items: center;
41422
- justify-content: center;
41423
- }
41424
- `;
41425
-
41426
42238
  ({
41427
42239
  value: PropTypes__default["default"].string,
41428
42240
  options: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
@@ -49808,6 +50620,7 @@ exports.PartnersTable = PartnersTable;
49808
50620
  exports.PlantingCycleSummary = PlantingCycleSummary;
49809
50621
  exports.ProductionSitesTable = ProductionSitesTable;
49810
50622
  exports.RestorationActivitySummary = RestorationActivitySummary;
50623
+ exports.SelfAssesment = SelfAssesment;
49811
50624
  exports.StakeholdersTable = StakeholdersTable;
49812
50625
  exports.SupplyChainDashboard = SupplyChain;
49813
50626
  exports.TablePage = TablePage;