datastake-daf 0.6.770 → 0.6.772

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/components/index.js +3362 -3143
  2. package/dist/pages/index.js +2279 -2142
  3. package/dist/services/index.js +10 -4
  4. package/dist/utils/index.js +4 -16
  5. package/package.json +1 -1
  6. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +1 -0
  7. package/src/@daf/core/components/Dashboard/Map/hook.js +14 -1
  8. package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +4 -0
  9. package/src/@daf/core/components/Screens/Admin/AdminDashboard/index.jsx +0 -2
  10. package/src/@daf/core/components/Screens/Settings/Edit/index.js +2 -0
  11. package/src/@daf/core/components/Screens/Settings/components/Header/index.js +1 -1
  12. package/src/@daf/core/components/ViewForm/components/Records/config.js +22 -0
  13. package/src/@daf/core/components/ViewForm/components/Records/index.jsx +155 -0
  14. package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +3 -3
  15. package/src/@daf/pages/Documents/config.js +12 -0
  16. package/src/@daf/pages/Documents/index.jsx +3 -13
  17. package/src/@daf/pages/Events/Activities/config.js +12 -0
  18. package/src/@daf/pages/Events/Activities/index.jsx +2 -13
  19. package/src/@daf/pages/Events/Incidents/config.js +12 -0
  20. package/src/@daf/pages/Events/Incidents/index.jsx +2 -12
  21. package/src/@daf/pages/Events/config.js +12 -0
  22. package/src/@daf/pages/Events/index.jsx +2 -12
  23. package/src/@daf/pages/Locations/MineSite/config.js +12 -0
  24. package/src/@daf/pages/Locations/MineSite/index.jsx +2 -12
  25. package/src/@daf/pages/Locations/config.js +12 -0
  26. package/src/@daf/pages/Locations/index.jsx +2 -17
  27. package/src/@daf/pages/Stakeholders/Operators/config.js +12 -0
  28. package/src/@daf/pages/Stakeholders/Operators/index.jsx +2 -12
  29. package/src/@daf/pages/Stakeholders/Workers/config.js +12 -0
  30. package/src/@daf/pages/Stakeholders/Workers/index.jsx +2 -10
  31. package/src/@daf/pages/Stakeholders/config.js +12 -0
  32. package/src/@daf/pages/Stakeholders/index.jsx +3 -18
  33. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +1 -0
  34. package/src/@daf/pages/Summary/hook.js +13 -3
  35. package/src/@daf/pages/TablePage/columns.js +29 -0
  36. package/src/@daf/pages/TablePage/config.js +19 -62
  37. package/src/@daf/pages/TablePage/helper.js +140 -0
  38. package/src/@daf/pages/TablePage/hook.js +20 -2
  39. package/src/@daf/pages/TablePage/index.jsx +12 -20
  40. package/src/@daf/services/LinkedSubjects.js +2 -2
  41. package/src/@daf/services/OperatorService.js +2 -2
  42. package/src/@daf/services/VersionService.js +13 -0
  43. package/src/@daf/utils/tooltip.js +3 -16
  44. package/src/index.js +1 -0
  45. package/src/pages.js +1 -0
  46. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -8065,7 +8065,8 @@ const renderTooltipJsx = ({
8065
8065
  className,
8066
8066
  link,
8067
8067
  onClickLink,
8068
- total
8068
+ total,
8069
+ isNewTab = false
8069
8070
  }) => {
8070
8071
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
8071
8072
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -8106,7 +8107,7 @@ const renderTooltipJsx = ({
8106
8107
  })]
8107
8108
  }) : null
8108
8109
  })]
8109
- }), link ? typeof onClickLink === "function" || typeof link !== "string" ? /*#__PURE__*/jsxRuntime.jsx("div", {
8110
+ }), link ? /*#__PURE__*/jsxRuntime.jsx("div", {
8110
8111
  className: "flex flex-column",
8111
8112
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
8112
8113
  className: "link-cont",
@@ -8114,20 +8115,7 @@ const renderTooltipJsx = ({
8114
8115
  children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
8115
8116
  width: 10,
8116
8117
  height: 10,
8117
- name: "Link"
8118
- })
8119
- })
8120
- }) : /*#__PURE__*/jsxRuntime.jsx("div", {
8121
- className: "flex flex-column",
8122
- children: /*#__PURE__*/jsxRuntime.jsx("a", {
8123
- href: link,
8124
- className: "link-cont",
8125
- target: "_blank",
8126
- rel: "noopener noreferrer",
8127
- children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
8128
- width: 10,
8129
- height: 10,
8130
- name: "LinkNewTab"
8118
+ name: isNewTab ? "LinkNewTab" : "Link"
8131
8119
  })
8132
8120
  })
8133
8121
  }) : null]
@@ -9070,7 +9058,8 @@ function LocationIcon({
9070
9058
  className: "pt-0 pb-0",
9071
9059
  items: renderTooltip(data),
9072
9060
  link,
9073
- onClickLink: () => onClickLink(data)
9061
+ onClickLink: () => onClickLink(data),
9062
+ isNewTab: true
9074
9063
  })
9075
9064
  // open={
9076
9065
  // (!openPopupIdRef.current || openPopupIdRef.current === data.datastakeId) &&
@@ -9908,8 +9897,12 @@ const useMap = ({
9908
9897
  }
9909
9898
  clearMapMarkers();
9910
9899
  if (data) {
9900
+ // Filters out locations that are not connected to any stakeholders
9901
+ const excludedType = ['village', 'town', 'area', 'territory'];
9902
+ const filteredData = data?.filter(obj => !excludedType.includes(obj?.type) && (obj?.stakeholders?.length > 0 || data.some(other => other.datastakeId !== obj.datastakeId && (other.stakeholders || []).some(stk => (stk.links || []).includes(obj.datastakeId)))));
9911
9903
  const maxTotal = Math.max(...(data || []).map(d => d.total));
9912
- data.forEach((d, i) => {
9904
+ const dataToRender = type === "chain" ? filteredData : data;
9905
+ dataToRender.forEach((d, i) => {
9913
9906
  addIconToMapInitialy([d?.marker?.lat, d?.marker?.lng], "location", d.category || "mineSite", d, maxTotal, i);
9914
9907
  });
9915
9908
  polylinesRef.current.forEach(polyline => {
@@ -10582,11 +10575,11 @@ function SupplyChainMap({
10582
10575
  onClickLink: data => {
10583
10576
  const locationTypes = ['village', 'town', 'area', 'territory'];
10584
10577
  if (data?.type === 'mineSite') {
10585
- goTo(getRedirectLink(`/app/mine-summary/${data.datastakeId}`));
10578
+ window.open(getRedirectLink(`/app/mine-summary/${data.datastakeId}`), '_blank');
10586
10579
  } else if (locationTypes.includes(data.type)) {
10587
- goTo(getRedirectLink(`/app/view/locations/${data.datastakeId}`));
10580
+ window.open(getRedirectLink(`/app/view/locations/${data.datastakeId}`), '_blank');
10588
10581
  } else {
10589
- goTo(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`));
10582
+ window.open(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`), '_blank');
10590
10583
  }
10591
10584
  }
10592
10585
  })
@@ -15183,7 +15176,7 @@ const renderStatusTag = ({
15183
15176
  }
15184
15177
  };
15185
15178
 
15186
- const getColumns$a = ({
15179
+ const getColumns$b = ({
15187
15180
  t,
15188
15181
  goTo,
15189
15182
  user,
@@ -30024,6 +30017,198 @@ const getFilterOptions$a = (options, t) => {
30024
30017
  category: categoriesOptions || category
30025
30018
  };
30026
30019
  };
30020
+ const formConfig$8 = {
30021
+ namespace: 'stakeholders',
30022
+ view: 'scoping',
30023
+ scope: 'create',
30024
+ formType: 'stakeholder'
30025
+ };
30026
+ const viewConfig$8 = {
30027
+ title: "Stakeholders",
30028
+ createTitle: "Create Stakeholder"
30029
+ };
30030
+
30031
+ const NavigationAction = ({
30032
+ onClick,
30033
+ theme
30034
+ }) => {
30035
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30036
+ style: {
30037
+ display: "flex",
30038
+ justifyContent: "center"
30039
+ },
30040
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
30041
+ onClick: onClick,
30042
+ style: {
30043
+ cursor: 'pointer',
30044
+ border: 'none',
30045
+ background: 'transparent',
30046
+ padding: 0,
30047
+ display: 'flex',
30048
+ alignItems: 'center'
30049
+ },
30050
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
30051
+ name: "Link",
30052
+ size: 15,
30053
+ color: theme.baseGray70
30054
+ })
30055
+ })
30056
+ });
30057
+ };
30058
+
30059
+ const getColumns$a = ({
30060
+ t,
30061
+ goTo,
30062
+ user,
30063
+ options,
30064
+ activeTab,
30065
+ getRedirectLink,
30066
+ theme,
30067
+ subject,
30068
+ applications
30069
+ }) => [{
30070
+ dataIndex: 'datastakeId',
30071
+ title: t('ID'),
30072
+ ellipsis: true,
30073
+ show: true,
30074
+ render: (v, all) => {
30075
+ if (all.empty) {
30076
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30077
+ className: "daf-default-cell"
30078
+ });
30079
+ }
30080
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30081
+ title: v,
30082
+ children: v
30083
+ });
30084
+ }
30085
+ }, {
30086
+ dataIndex: 'name',
30087
+ title: t('Name'),
30088
+ ellipsis: true,
30089
+ show: true,
30090
+ render: (v, all) => {
30091
+ if (all.empty) {
30092
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30093
+ className: "daf-default-cell"
30094
+ });
30095
+ }
30096
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30097
+ title: v,
30098
+ children: v
30099
+ });
30100
+ }
30101
+ }, {
30102
+ dataIndex: 'category',
30103
+ title: t('Category'),
30104
+ ellipsis: true,
30105
+ show: true,
30106
+ render: (v, all) => {
30107
+ if (all.empty) {
30108
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30109
+ className: "daf-default-cell"
30110
+ });
30111
+ }
30112
+ const category = findOptions(v, options?.categoriesOptions);
30113
+ return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30114
+ title: category,
30115
+ children: category
30116
+ }) : '-';
30117
+ }
30118
+ }, {
30119
+ dataIndex: 'subCategory',
30120
+ title: t('Sub Category'),
30121
+ ellipsis: true,
30122
+ show: true,
30123
+ render: (v, all) => {
30124
+ if (all.empty) {
30125
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30126
+ className: "daf-default-cell"
30127
+ });
30128
+ }
30129
+ const subCategory = findOptions(v, options?.subCategoriesOptions);
30130
+ return subCategory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30131
+ title: subCategory,
30132
+ children: subCategory
30133
+ }) : '-';
30134
+ }
30135
+ }, {
30136
+ dataIndex: 'country',
30137
+ title: t('Country'),
30138
+ ellipsis: true,
30139
+ show: true,
30140
+ render: (v, all) => {
30141
+ if (all.empty) {
30142
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30143
+ className: "daf-default-cell"
30144
+ });
30145
+ }
30146
+ const country = findOptions(v, options?.countries);
30147
+ return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30148
+ title: country,
30149
+ children: country
30150
+ }) : '-';
30151
+ }
30152
+ }, {
30153
+ title: t("Sources"),
30154
+ dataIndex: "sources",
30155
+ key: "sources",
30156
+ show: activeTab !== "own",
30157
+ render: (val, all) => {
30158
+ if (all.empty) {
30159
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30160
+ className: "daf-default-cell"
30161
+ });
30162
+ }
30163
+ if (!val || val?.length === 0) {
30164
+ return "--";
30165
+ }
30166
+ const sources = sourceAvatarConfig(val, user, applications);
30167
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
30168
+ items: sources
30169
+ });
30170
+ }
30171
+ }, {
30172
+ title: t("Last Update"),
30173
+ dataIndex: "updatedAt",
30174
+ key: "updatedAt",
30175
+ width: 125,
30176
+ render: (date, all) => {
30177
+ if (all.empty) {
30178
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30179
+ className: "daf-default-cell"
30180
+ });
30181
+ }
30182
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
30183
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30184
+ title: _date,
30185
+ children: _date
30186
+ });
30187
+ },
30188
+ ellipsis: true
30189
+ }, {
30190
+ id: 'actions',
30191
+ title: "",
30192
+ width: 60,
30193
+ render: (_, all) => {
30194
+ if (all.empty) {
30195
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30196
+ className: "daf-default-cell"
30197
+ });
30198
+ }
30199
+ const onClick = () => {
30200
+ let link = `/app/view/${subject}/${all.datastakeId}`;
30201
+ if (activeTab === "shared") {
30202
+ link += `?sourceId=${all?.authorId?.id}`;
30203
+ }
30204
+ goTo(getRedirectLink(link));
30205
+ };
30206
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
30207
+ onClick: onClick,
30208
+ theme: theme
30209
+ });
30210
+ }
30211
+ }].filter(column => column.show !== false);
30027
30212
 
30028
30213
  const getFiltersConfig$9 = ({
30029
30214
  t
@@ -30221,6 +30406,16 @@ const getFilterOptions$9 = (options, t) => {
30221
30406
  };
30222
30407
  return _default;
30223
30408
  };
30409
+ const formConfig$7 = {
30410
+ namespace: 'OPERATOR',
30411
+ view: ['scoping', 'new'],
30412
+ scope: 'global',
30413
+ formType: 'operator'
30414
+ };
30415
+ const viewConfig$7 = {
30416
+ title: "Operators",
30417
+ createTitle: "Create Operator"
30418
+ };
30224
30419
 
30225
30420
  const getFiltersConfig$8 = ({
30226
30421
  t
@@ -30422,6 +30617,184 @@ const getFilterOptions$8 = (options, t) => {
30422
30617
  };
30423
30618
  return _default;
30424
30619
  };
30620
+ const formConfig$6 = {
30621
+ namespace: 'WORKERS',
30622
+ view: ['scoping', 'new'],
30623
+ scope: 'global',
30624
+ formType: 'worker'
30625
+ };
30626
+ const viewConfig$6 = {
30627
+ title: "Workers",
30628
+ createTitle: "Create Worker"
30629
+ };
30630
+
30631
+ const getColumns$9 = ({
30632
+ t,
30633
+ goTo,
30634
+ user,
30635
+ options,
30636
+ activeTab,
30637
+ getRedirectLink,
30638
+ theme,
30639
+ subject,
30640
+ data,
30641
+ applications
30642
+ }) => [
30643
+ // {
30644
+ // dataIndex: 'datastakeId',
30645
+ // title: t('ID'),
30646
+ // ellipsis: true,
30647
+ // show: true,
30648
+ // render: (v, all) => {
30649
+ // if (all.empty) {
30650
+ // return <div className="daf-default-cell" />
30651
+ // }
30652
+
30653
+ // return <Tooltip title={v}>{v}</Tooltip>;
30654
+ // },
30655
+ // },
30656
+ {
30657
+ dataIndex: 'name',
30658
+ title: t('Name'),
30659
+ ellipsis: true,
30660
+ show: true,
30661
+ render: (v, all) => {
30662
+ if (all.empty) {
30663
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30664
+ className: "daf-default-cell"
30665
+ });
30666
+ }
30667
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30668
+ title: v,
30669
+ children: v
30670
+ });
30671
+ }
30672
+ }, {
30673
+ dataIndex: 'mineSite',
30674
+ title: t('Position'),
30675
+ ellipsis: true,
30676
+ show: true,
30677
+ render: (v, all) => {
30678
+ if (all.empty) {
30679
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30680
+ className: "daf-default-cell"
30681
+ });
30682
+ }
30683
+
30684
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
30685
+ const mineSite = all?.location?.name;
30686
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30687
+ title: mineSite,
30688
+ children: mineSite
30689
+ }) : '-';
30690
+ }
30691
+ }, {
30692
+ dataIndex: 'activity',
30693
+ title: t('Activity'),
30694
+ ellipsis: true,
30695
+ show: true,
30696
+ render: (v, all) => {
30697
+ if (all.empty) {
30698
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30699
+ className: "daf-default-cell"
30700
+ });
30701
+ }
30702
+ const activity = findOptions(v, data?.options?.activityAtSiteOptions);
30703
+ return activity ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30704
+ title: activity,
30705
+ children: activity
30706
+ }) : '-';
30707
+ }
30708
+ }, {
30709
+ dataIndex: 'origin',
30710
+ title: t('Origin'),
30711
+ ellipsis: true,
30712
+ show: true,
30713
+ render: (v, all) => {
30714
+ if (all.empty) {
30715
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30716
+ className: "daf-default-cell"
30717
+ });
30718
+ }
30719
+ const origin = all?.placeOfBirth?.name;
30720
+ return origin ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30721
+ title: origin,
30722
+ children: origin
30723
+ }) : '-';
30724
+ }
30725
+ }, {
30726
+ title: t("Census Update"),
30727
+ dataIndex: "createdAt",
30728
+ key: "createdAt",
30729
+ render: (date, all) => {
30730
+ if (all.empty) {
30731
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30732
+ className: "daf-default-cell"
30733
+ });
30734
+ }
30735
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
30736
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30737
+ title: _date,
30738
+ children: _date
30739
+ });
30740
+ },
30741
+ ellipsis: true
30742
+ }, {
30743
+ title: t("Sources"),
30744
+ dataIndex: "sources",
30745
+ key: "sources",
30746
+ show: activeTab !== "own",
30747
+ render: (val, all) => {
30748
+ if (all.empty) {
30749
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30750
+ className: "daf-default-cell"
30751
+ });
30752
+ }
30753
+ const sources = sourceAvatarConfig(val, user, applications);
30754
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
30755
+ items: sources
30756
+ });
30757
+ }
30758
+ }, {
30759
+ title: t("Status"),
30760
+ dataIndex: "status",
30761
+ key: "status",
30762
+ show: activeTab === "own",
30763
+ render: (val, all) => {
30764
+ if (all.empty) {
30765
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30766
+ className: "daf-default-cell"
30767
+ });
30768
+ }
30769
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
30770
+ return renderStatusTag({
30771
+ value: _val,
30772
+ t
30773
+ });
30774
+ }
30775
+ }, {
30776
+ id: 'actions',
30777
+ title: "",
30778
+ width: 60,
30779
+ render: (_, all) => {
30780
+ if (all.empty) {
30781
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30782
+ className: "daf-default-cell"
30783
+ });
30784
+ }
30785
+ const onClick = () => {
30786
+ let link = `/app/view/${subject}/${all.datastakeId}`;
30787
+ if (activeTab === "shared") {
30788
+ link += `?sourceId=${all?.authorId?.id}`;
30789
+ }
30790
+ goTo(getRedirectLink(link));
30791
+ };
30792
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
30793
+ onClick: onClick,
30794
+ theme: theme
30795
+ });
30796
+ }
30797
+ }].filter(column => column.show !== false);
30425
30798
 
30426
30799
  const getFiltersConfig$7 = ({
30427
30800
  t
@@ -30624,6 +30997,364 @@ const getFilterOptions$7 = (options, t) => {
30624
30997
  }]
30625
30998
  };
30626
30999
  };
31000
+ const formConfig$5 = {
31001
+ namespace: 'event',
31002
+ view: 'scoping',
31003
+ scope: 'create',
31004
+ formType: 'event'
31005
+ };
31006
+ const viewConfig$5 = {
31007
+ title: "Events",
31008
+ createTitle: "Create Event"
31009
+ };
31010
+
31011
+ const {
31012
+ Text
31013
+ } = antd.Typography;
31014
+ function MoreTags({
31015
+ values = [],
31016
+ maxWidthCont = 120,
31017
+ maxTextCont = 100,
31018
+ diff = 30,
31019
+ style = {},
31020
+ tagColor,
31021
+ limit
31022
+ }) {
31023
+ const ref = React.useRef();
31024
+ const [width, setWidth] = React.useState(0);
31025
+ const [indexToReturn, setIndexToReturn] = React.useState(0);
31026
+ const _maxWidthCont = values.length <= 1 ? maxWidthCont : maxWidthCont - 20;
31027
+ const _maxWidthTxt = values.length <= 1 ? maxTextCont : 80;
31028
+ React.useEffect(() => {
31029
+ const resizeObserver = new ResizeObserver(entries => {
31030
+ setWidth(entries[0].contentRect.width);
31031
+ });
31032
+ resizeObserver.observe(ref.current);
31033
+ return () => resizeObserver.disconnect();
31034
+ }, []);
31035
+ const _calculate = () => {
31036
+ // If limit prop is provided and valid, use it instead of calculating
31037
+ if (typeof limit === 'number' && limit > 0) {
31038
+ setIndexToReturn(Math.min(limit - 1, values.length - 1));
31039
+ return;
31040
+ }
31041
+ const tabs = ref.current.querySelectorAll(".check-tabs");
31042
+ let filled = 0;
31043
+ let indexToReturn;
31044
+ if (values.length === 1) {
31045
+ setIndexToReturn(1);
31046
+ return;
31047
+ }
31048
+ tabs.forEach((t, i) => {
31049
+ if (typeof indexToReturn === "number") {
31050
+ return;
31051
+ }
31052
+ filled = filled + t.clientWidth + 25;
31053
+ const dif = width - filled;
31054
+ if (dif < diff) {
31055
+ indexToReturn = dif < 0 ? i - 1 : i;
31056
+ setIndexToReturn(indexToReturn);
31057
+ return;
31058
+ }
31059
+ });
31060
+ setIndexToReturn(typeof indexToReturn === "number" ? indexToReturn : tabs.length - 1);
31061
+ };
31062
+ const hasMore = values.length && indexToReturn !== values.length - 1;
31063
+ const toShow = hasMore ? values.slice(0, indexToReturn + 1) : values;
31064
+ const other = hasMore ? values.slice(indexToReturn + 1, values.length + 1) : [];
31065
+ React.useEffect(() => {
31066
+ _calculate();
31067
+ }, [width, values, limit]);
31068
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
31069
+ className: "daf-more-tags",
31070
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
31071
+ className: "list",
31072
+ children: [toShow.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag() : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
31073
+ style: {
31074
+ maxWidth: _maxWidthCont,
31075
+ overflow: "hidden",
31076
+ textOverflow: "ellipsis",
31077
+ whiteSpace: "nowrap",
31078
+ ...style
31079
+ },
31080
+ color: tagColor || ac.color,
31081
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31082
+ title: typeof ac === "object" ? ac.label : ac,
31083
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
31084
+ style: {
31085
+ maxWidth: _maxWidthTxt,
31086
+ overflow: "hidden",
31087
+ textOverflow: "ellipsis",
31088
+ whiteSpace: "nowrap",
31089
+ ...style
31090
+ },
31091
+ children: typeof ac === "object" ? ac.label : ac
31092
+ })
31093
+ })
31094
+ }, `${typeof ac === "object" ? ac.value : ac}-${i}`)), other.length ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31095
+ title: other.map(ac => typeof ac === "object" ? ac.label : ac).join(", "),
31096
+ children: /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
31097
+ color: tagColor || 'default',
31098
+ style: style,
31099
+ children: ["+", other.length]
31100
+ })
31101
+ }) : null]
31102
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
31103
+ className: "list hidden",
31104
+ ref: ref,
31105
+ children: values.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag("check-tabs") : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
31106
+ color: tagColor || ac.color,
31107
+ className: "check-tabs",
31108
+ style: {
31109
+ maxWidth: _maxWidthCont,
31110
+ ...style
31111
+ },
31112
+ children: /*#__PURE__*/jsxRuntime.jsx(Text, {
31113
+ ellipsis: {
31114
+ tooltip: typeof ac === "object" ? ac.label : ac
31115
+ },
31116
+ style: {
31117
+ maxWidth: _maxWidthTxt
31118
+ },
31119
+ children: typeof ac === "object" ? ac.label : ac
31120
+ })
31121
+ }, `${ac}-${i}`))
31122
+ })]
31123
+ });
31124
+ }
31125
+ MoreTags.propTypes = {
31126
+ values: PropTypes__default["default"].array,
31127
+ maxWidthCont: PropTypes__default["default"].number,
31128
+ maxTextCont: PropTypes__default["default"].number,
31129
+ diff: PropTypes__default["default"].number,
31130
+ limit: PropTypes__default["default"].number
31131
+ };
31132
+
31133
+ const getColumns$8 = ({
31134
+ t,
31135
+ goTo,
31136
+ user,
31137
+ options,
31138
+ activeTab,
31139
+ getRedirectLink,
31140
+ theme,
31141
+ subject,
31142
+ data,
31143
+ applications
31144
+ }) => [{
31145
+ dataIndex: 'datastakeId',
31146
+ title: t('ID'),
31147
+ ellipsis: true,
31148
+ show: true,
31149
+ render: (v, all) => {
31150
+ if (all.empty) {
31151
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31152
+ className: "daf-default-cell"
31153
+ });
31154
+ }
31155
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31156
+ title: v,
31157
+ children: v
31158
+ });
31159
+ }
31160
+ }, {
31161
+ dataIndex: 'name',
31162
+ title: t('Title'),
31163
+ ellipsis: true,
31164
+ show: true,
31165
+ render: (v, all) => {
31166
+ if (all.empty) {
31167
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31168
+ className: "daf-default-cell"
31169
+ });
31170
+ }
31171
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31172
+ title: v,
31173
+ children: v
31174
+ });
31175
+ }
31176
+ }, {
31177
+ dataIndex: 'typeOfEvent',
31178
+ title: t('Type'),
31179
+ ellipsis: true,
31180
+ show: true,
31181
+ render: (v, all) => {
31182
+ if (all.empty) {
31183
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31184
+ className: "daf-default-cell"
31185
+ });
31186
+ }
31187
+ const type = findOptions(v, data?.options?.eventsType);
31188
+ return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31189
+ title: type,
31190
+ children: type
31191
+ }) : '-';
31192
+ }
31193
+ }, {
31194
+ dataIndex: 'keyStakeholder',
31195
+ title: t('Key Stakeholder'),
31196
+ ellipsis: true,
31197
+ show: true,
31198
+ render: (v, all) => {
31199
+ if (all.empty) {
31200
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31201
+ className: "daf-default-cell"
31202
+ });
31203
+ }
31204
+ const val = (all?.stakeholderKey || []).map(sk => {
31205
+ return sk?.name;
31206
+ });
31207
+ if (val?.length === 0) {
31208
+ return "-";
31209
+ }
31210
+ return /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
31211
+ values: val
31212
+ });
31213
+ }
31214
+ }, {
31215
+ title: t("Date"),
31216
+ dataIndex: "date",
31217
+ key: "date",
31218
+ // testimonials: true,
31219
+ // incident: true,
31220
+ // correctiveActions: true,
31221
+ show: true,
31222
+ // sorter: () => 0 + 0,
31223
+ // searchType: "date",
31224
+ // width: 125,
31225
+ render: (date, all) => {
31226
+ if (all.empty) {
31227
+ return null;
31228
+ }
31229
+ const title = date ? renderDateFormatted(date, "DD MMM YYYY") : "-";
31230
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31231
+ title: title,
31232
+ children: title
31233
+ });
31234
+ },
31235
+ ellipsis: true
31236
+ }, {
31237
+ dataIndex: 'scope',
31238
+ title: t('Scope'),
31239
+ ellipsis: true,
31240
+ show: true,
31241
+ render: (value, all) => {
31242
+ if (all.empty) {
31243
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31244
+ className: "daf-default-cell"
31245
+ });
31246
+ }
31247
+ if (!value) {
31248
+ return "-";
31249
+ }
31250
+
31251
+ // Form the moment the intend of the if block is to be executed only in event table
31252
+ if (typeof value === "string") {
31253
+ if (all.navigationEventType === "other") {
31254
+ return "-";
31255
+ }
31256
+ const categoryOptions = (data?.options?.categoryOptions || []).map(c => {
31257
+ const searchTerm = `typeOfEvent is ${all.navigationEventType}`;
31258
+ return {
31259
+ value: c.value,
31260
+ label: c.label[searchTerm]
31261
+ };
31262
+ });
31263
+ const relaxantOptions = [...categoryOptions, ...(data?.options?.eventsType || []), ...(data?.options?.testimonialsType || [])];
31264
+ const title = relaxantOptions.find(v => v.value === value)?.label || "-";
31265
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31266
+ title: title,
31267
+ children: title
31268
+ });
31269
+ }
31270
+ const val = value.map((v, i) => ({
31271
+ label: v.name,
31272
+ value: `${v.name}-${i}`
31273
+ }));
31274
+ return val.length ? /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
31275
+ values: val
31276
+ }) : "-";
31277
+ }
31278
+ }, {
31279
+ title: t("Sources"),
31280
+ dataIndex: "sources",
31281
+ key: "sources",
31282
+ show: activeTab !== "own",
31283
+ render: (val, all) => {
31284
+ if (all.empty) {
31285
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31286
+ className: "daf-default-cell"
31287
+ });
31288
+ }
31289
+ const sources = sourceAvatarConfig(val, user, applications);
31290
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
31291
+ items: sources
31292
+ });
31293
+ }
31294
+ }, {
31295
+ title: t("Status"),
31296
+ dataIndex: "status",
31297
+ key: "status",
31298
+ show: activeTab === "own",
31299
+ correctiveActions: activeTab === "own",
31300
+ testimonials: activeTab === "own",
31301
+ incident: activeTab === "own",
31302
+ render: (value, all) => {
31303
+ if (all.empty) {
31304
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31305
+ className: "daf-default-cell"
31306
+ });
31307
+ }
31308
+ if (activeTab !== "own") {
31309
+ return all?.authorId?.name;
31310
+ }
31311
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : value;
31312
+ return renderStatusTag({
31313
+ value: _val,
31314
+ t
31315
+ });
31316
+ },
31317
+ ellipsis: true
31318
+ }, {
31319
+ title: t("Last Update"),
31320
+ dataIndex: "updatedAt",
31321
+ key: "updatedAt",
31322
+ render: (date, all) => {
31323
+ if (all.empty) {
31324
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31325
+ className: "daf-default-cell"
31326
+ });
31327
+ }
31328
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31329
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31330
+ title: _date,
31331
+ children: _date
31332
+ });
31333
+ },
31334
+ ellipsis: true
31335
+ }, {
31336
+ id: 'actions',
31337
+ title: "",
31338
+ width: 60,
31339
+ render: (_, all) => {
31340
+ if (all.empty) {
31341
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31342
+ className: "daf-default-cell"
31343
+ });
31344
+ }
31345
+ const onClick = () => {
31346
+ let link = `/app/view/${subject}/${all.datastakeId}`;
31347
+ if (activeTab === "shared") {
31348
+ link += `?sourceId=${all?.authorId?.id}`;
31349
+ }
31350
+ goTo(getRedirectLink(link));
31351
+ };
31352
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
31353
+ onClick: onClick,
31354
+ theme: theme
31355
+ });
31356
+ }
31357
+ }].filter(column => column.show !== false);
30627
31358
 
30628
31359
  const getFiltersConfig$6 = ({
30629
31360
  t
@@ -30834,264 +31565,242 @@ const getFilterOptions$6 = (options, t) => {
30834
31565
  };
30835
31566
  return _default;
30836
31567
  };
31568
+ const formConfig$4 = {
31569
+ namespace: 'corrective-actions',
31570
+ view: 'corrective-actions',
31571
+ scope: 'createActivity',
31572
+ formType: 'activity'
31573
+ };
31574
+ const viewConfig$4 = {
31575
+ title: "Activities",
31576
+ createTitle: "Create Activity"
31577
+ };
30837
31578
 
30838
- const getFiltersConfig$5 = ({
30839
- t
30840
- }) => {
30841
- return {
30842
- timeframe: {
30843
- type: "timeframe",
30844
- label: "Timeframe",
30845
- style: {
30846
- flex: 1
30847
- }
30848
- },
30849
- country: {
30850
- type: 'select',
30851
- label: 'Country',
30852
- placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
30853
- style: {
30854
- flex: 1
30855
- },
30856
- labelStyle: {
30857
- flex: 1
30858
- },
30859
- getLabel: option => option.label,
30860
- getValue: option => option.value
30861
- },
30862
- administrativeLevel1: {
30863
- type: 'ajaxSelect',
30864
- label: ({
30865
- t = s => s,
30866
- options = {},
30867
- filters = {},
30868
- language = 'en'
30869
- }) => {
30870
- const {
30871
- administrativeLevel1
30872
- } = options;
30873
- if (administrativeLevel1) {
30874
- if (options.country) {
30875
- const _item = administrativeLevel1[filters.country];
30876
- if (_item) {
30877
- if (_item[language]) {
30878
- return _item[language];
30879
- }
30880
- }
30881
- }
30882
- }
30883
- return t('Province');
30884
- },
30885
- placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
30886
- filters: data => ({
30887
- country: data.country,
30888
- level: 'level_1'
30889
- }),
30890
- show: data => !data.country,
30891
- disabled: data => !data.country,
30892
- mapper: {
30893
- label: "name",
30894
- value: "id"
30895
- },
30896
- method: 'getOptions',
30897
- entity: 'AdministrativeLevel',
30898
- style: {
30899
- flex: 1
30900
- },
30901
- labelStyle: {
30902
- flex: 1
30903
- }
30904
- },
30905
- administrativeLevel2: {
30906
- type: 'ajaxSelect',
30907
- label: ({
30908
- t = s => s,
30909
- options = {},
30910
- filters = {},
30911
- language = 'en'
30912
- }) => {
30913
- const {
30914
- administrativeLevel2
30915
- } = options;
30916
- if (administrativeLevel2) {
30917
- if (options.country) {
30918
- const _item = administrativeLevel2[filters.country];
30919
- if (_item) {
30920
- if (_item[language]) {
30921
- return _item[language];
30922
- }
30923
- }
30924
- }
30925
- }
30926
- return t('Province');
30927
- },
30928
- show: data => !(data.country && data.administrativeLevel1),
30929
- placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
30930
- filters: data => ({
30931
- country: data.country,
30932
- level: 'level_2',
30933
- administrativeLevel1: data.administrativeLevel1
30934
- }),
30935
- disabled: data => !(data.country && data.administrativeLevel1),
30936
- mapper: {
30937
- label: "name",
30938
- value: "id"
30939
- },
30940
- method: 'getOptions',
30941
- entity: 'AdministrativeLevel',
30942
- style: {
30943
- flex: 1
30944
- },
30945
- labelStyle: {
30946
- flex: 1
30947
- }
30948
- },
30949
- category: {
30950
- type: 'select',
30951
- label: 'Category',
30952
- placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
30953
- style: {
30954
- flex: 1
30955
- },
30956
- labelStyle: {
30957
- flex: 1
30958
- },
30959
- getLabel: option => option.label,
30960
- getValue: option => option.value,
30961
- filterOptions: val => {
30962
- if (val) {
30963
- const {
30964
- option,
30965
- filters
30966
- } = val;
30967
- if (filters && option) {
30968
- const {
30969
- filters: optionFilters
30970
- } = option;
30971
- if (Array.isArray(optionFilters) && optionFilters.length) {
30972
- const {
30973
- value,
30974
- condition
30975
- } = optionFilters[0];
30976
- if (condition === 'includes') {
30977
- return value.includes('corporation');
30978
- }
30979
- }
30980
- }
30981
- }
30982
- return true;
30983
- }
30984
- },
30985
- positionInTheMineralSupplyChain: {
30986
- type: 'select',
30987
- label: 'Position',
30988
- placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
30989
- style: {
30990
- flex: 1
30991
- },
30992
- labelStyle: {
30993
- flex: 1
30994
- },
30995
- getLabel: option => option.label,
30996
- getValue: option => option.value
30997
- },
30998
- status: {
30999
- type: "select",
31000
- label: "Status",
31001
- placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
31002
- style: {
31003
- flex: 1
31004
- },
31005
- labelStyle: {
31006
- fley: 1
31007
- },
31008
- getLabel: option => option.label,
31009
- getValue: option => option.value
31010
- }
31011
- };
31012
- };
31013
- const getFilterOptions$5 = (options, t) => {
31014
- const {
31015
- timeframe = [],
31016
- statusOptions = [],
31017
- categoryOptions = [],
31018
- countries = [],
31019
- subCategory = [],
31020
- category = [],
31021
- stakeholderCategoryOptions,
31022
- stakeholderSubCategoriesOptions,
31023
- administrativeLevel1,
31024
- administrativeLevel2,
31025
- positionInMineralSupplyChainOptions,
31026
- subCategoriesOptions
31027
- } = options || {};
31028
- const _default = {
31029
- timeframe: timeframe,
31030
- status: [{
31031
- value: "submitted",
31032
- label: "Submitted"
31033
- }, {
31034
- value: "private",
31035
- label: "Private"
31036
- }],
31037
- category: stakeholderCategoryOptions || categoryOptions,
31038
- country: countries,
31039
- subCategory: subCategoriesOptions,
31040
- // category: category,
31041
- administrativeLevel1,
31042
- administrativeLevel2,
31043
- positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions
31044
- };
31045
- return _default;
31579
+ const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = false) => {
31580
+ if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
31581
+ return null;
31582
+ }
31583
+ const subjectSingular = isSingular ? subject : subject.endsWith('ies') ? subject.slice(0, -3) + 'y' : subject.endsWith('s') ? subject.slice(0, -1) : subject;
31584
+ const key = `typeOfEvent is ${subjectSingular}`;
31585
+ return eventCategoryObject[key] || null;
31046
31586
  };
31047
31587
 
31048
- const getFiltersConfig$4 = ({
31588
+ const getColumns$7 = ({
31589
+ t,
31590
+ goTo,
31591
+ user,
31592
+ options,
31593
+ activeTab,
31594
+ getRedirectLink,
31595
+ theme,
31596
+ subject,
31597
+ data,
31598
+ applications
31599
+ }) => [{
31600
+ dataIndex: 'datastakeId',
31601
+ title: t('ID'),
31602
+ ellipsis: true,
31603
+ show: true,
31604
+ render: (v, all) => {
31605
+ if (all.empty) {
31606
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31607
+ className: "daf-default-cell"
31608
+ });
31609
+ }
31610
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31611
+ title: v,
31612
+ children: v
31613
+ });
31614
+ }
31615
+ }, {
31616
+ dataIndex: 'name',
31617
+ title: t('Title'),
31618
+ ellipsis: true,
31619
+ show: true,
31620
+ render: (v, all) => {
31621
+ if (all.empty) {
31622
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31623
+ className: "daf-default-cell"
31624
+ });
31625
+ }
31626
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31627
+ title: v,
31628
+ children: v
31629
+ });
31630
+ }
31631
+ }, {
31632
+ title: t("Date"),
31633
+ dataIndex: "date",
31634
+ key: "date",
31635
+ render: (date, all) => {
31636
+ if (all.empty) {
31637
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31638
+ className: "daf-default-cell"
31639
+ });
31640
+ }
31641
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31642
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31643
+ title: _date,
31644
+ children: _date
31645
+ });
31646
+ },
31647
+ ellipsis: true
31648
+ }, {
31649
+ dataIndex: 'mineSite',
31650
+ title: t('Location'),
31651
+ ellipsis: true,
31652
+ show: true,
31653
+ render: (v, all) => {
31654
+ if (all.empty) {
31655
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31656
+ className: "daf-default-cell"
31657
+ });
31658
+ }
31659
+
31660
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
31661
+ const mineSite = all?.location?.name;
31662
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31663
+ title: mineSite,
31664
+ children: mineSite
31665
+ }) : '-';
31666
+ }
31667
+ }, {
31668
+ dataIndex: 'province',
31669
+ title: t('Province'),
31670
+ ellipsis: true,
31671
+ show: true,
31672
+ render: (v, all) => {
31673
+ if (all.empty) {
31674
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31675
+ className: "daf-default-cell"
31676
+ });
31677
+ }
31678
+ const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
31679
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31680
+ title: region,
31681
+ children: region
31682
+ }) : '-';
31683
+ }
31684
+ }, {
31685
+ dataIndex: 'territory',
31686
+ title: t('Territory'),
31687
+ ellipsis: true,
31688
+ show: true,
31689
+ render: (v, all) => {
31690
+ if (all.empty) {
31691
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31692
+ className: "daf-default-cell"
31693
+ });
31694
+ }
31695
+ const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
31696
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31697
+ title: district,
31698
+ children: district
31699
+ }) : '-';
31700
+ }
31701
+ }, {
31702
+ dataIndex: 'eventCategory',
31703
+ title: t('Category'),
31704
+ ellipsis: true,
31705
+ show: true,
31706
+ render: (v, all) => {
31707
+ if (all.empty) {
31708
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31709
+ className: "daf-default-cell"
31710
+ });
31711
+ }
31712
+ const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
31713
+ const categoryValue = getEventCategoryBySubject(eventCategory, "correctiveActions", true);
31714
+ return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31715
+ title: categoryValue,
31716
+ children: categoryValue
31717
+ }) : '-';
31718
+ }
31719
+ }, {
31720
+ title: t("Sources"),
31721
+ dataIndex: "sources",
31722
+ key: "sources",
31723
+ show: activeTab !== "own",
31724
+ render: (val, all) => {
31725
+ if (all.empty) {
31726
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31727
+ className: "daf-default-cell"
31728
+ });
31729
+ }
31730
+ const sources = sourceAvatarConfig(val, user, applications);
31731
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
31732
+ items: sources
31733
+ });
31734
+ }
31735
+ }, {
31736
+ title: t("Status"),
31737
+ dataIndex: "status",
31738
+ key: "status",
31739
+ show: activeTab === "own",
31740
+ render: (val, all) => {
31741
+ if (all.empty) {
31742
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31743
+ className: "daf-default-cell"
31744
+ });
31745
+ }
31746
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
31747
+ return renderStatusTag({
31748
+ value: _val,
31749
+ t
31750
+ });
31751
+ }
31752
+ }, {
31753
+ title: t("Last Update"),
31754
+ dataIndex: "updatedAt",
31755
+ key: "updatedAt",
31756
+ render: (date, all) => {
31757
+ if (all.empty) {
31758
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31759
+ className: "daf-default-cell"
31760
+ });
31761
+ }
31762
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31763
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31764
+ title: _date,
31765
+ children: _date
31766
+ });
31767
+ },
31768
+ ellipsis: true
31769
+ }, {
31770
+ id: 'actions',
31771
+ title: "",
31772
+ width: 60,
31773
+ render: (_, all) => {
31774
+ if (all.empty) {
31775
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31776
+ className: "daf-default-cell"
31777
+ });
31778
+ }
31779
+ const onClick = () => {
31780
+ let link = `/app/view/${subject}/${all.datastakeId}`;
31781
+ if (activeTab === "shared") {
31782
+ link += `?sourceId=${all?.authorId?.id}`;
31783
+ }
31784
+ goTo(getRedirectLink(link));
31785
+ };
31786
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
31787
+ onClick: onClick,
31788
+ theme: theme
31789
+ });
31790
+ }
31791
+ }].filter(column => column.show !== false);
31792
+
31793
+ const getFiltersConfig$5 = ({
31049
31794
  t
31050
31795
  }) => {
31051
31796
  return {
31052
- country: {
31053
- type: 'select',
31054
- placeholder: t('Country'),
31797
+ timeframe: {
31798
+ type: "timeframe",
31799
+ label: "Timeframe",
31055
31800
  style: {
31056
31801
  flex: 1
31057
- },
31058
- labelStyle: {
31059
- flex: 1
31060
- },
31061
- getLabel: option => option.label,
31062
- getValue: option => option.value
31802
+ }
31063
31803
  },
31064
- category: {
31065
- type: 'select',
31066
- label: 'Category',
31067
- placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
31068
- style: {
31069
- flex: 1
31070
- },
31071
- labelStyle: {
31072
- flex: 1
31073
- },
31074
- getLabel: option => option.label,
31075
- getValue: option => option.value
31076
- }
31077
- };
31078
- };
31079
- const getFilterOptions$4 = (options, t) => {
31080
- const {
31081
- countries = [],
31082
- category = [],
31083
- locationCategories = []
31084
- } = options || {};
31085
- return {
31086
- country: countries,
31087
- category: locationCategories || category
31088
- };
31089
- };
31090
-
31091
- const getFiltersConfig$3 = ({
31092
- t
31093
- }) => {
31094
- return {
31095
31804
  country: {
31096
31805
  type: 'select',
31097
31806
  label: 'Country',
@@ -31192,10 +31901,10 @@ const getFiltersConfig$3 = ({
31192
31901
  flex: 1
31193
31902
  }
31194
31903
  },
31195
- product: {
31904
+ category: {
31196
31905
  type: 'select',
31197
- label: 'Product',
31198
- placeholder: t => `${t('Filter by')} ${t('Product').toLowerCase()}`,
31906
+ label: 'Category',
31907
+ placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
31199
31908
  style: {
31200
31909
  flex: 1
31201
31910
  },
@@ -31256,488 +31965,60 @@ const getFiltersConfig$3 = ({
31256
31965
  }
31257
31966
  };
31258
31967
  };
31259
- const getFilterOptions$3 = (options, t) => {
31968
+ const getFilterOptions$5 = (options, t) => {
31260
31969
  const {
31970
+ timeframe = [],
31261
31971
  statusOptions = [],
31262
31972
  categoryOptions = [],
31263
31973
  countries = [],
31264
- product = [],
31265
31974
  subCategory = [],
31266
- subCategoriesOptions,
31975
+ category = [],
31267
31976
  stakeholderCategoryOptions,
31268
31977
  stakeholderSubCategoriesOptions,
31269
31978
  administrativeLevel1,
31270
- administrativeLevel2
31979
+ administrativeLevel2,
31980
+ positionInMineralSupplyChainOptions,
31981
+ subCategoriesOptions
31271
31982
  } = options || {};
31272
31983
  const _default = {
31273
- category: stakeholderCategoryOptions || categoryOptions,
31274
- country: countries,
31275
- product: product,
31276
- administrativeLevel1,
31277
- administrativeLevel2,
31278
- subCategory: subCategoriesOptions,
31984
+ timeframe: timeframe,
31279
31985
  status: [{
31280
31986
  value: "submitted",
31281
31987
  label: "Submitted"
31282
31988
  }, {
31283
31989
  value: "private",
31284
31990
  label: "Private"
31285
- }]
31286
- };
31287
- return _default;
31288
- };
31289
-
31290
- const getFiltersConfig$2 = ({
31291
- t
31292
- }) => {
31293
- return {
31294
- timeframe: {
31295
- type: "timeframe",
31296
- label: "Timeframe",
31297
- style: {
31298
- flex: 1
31299
- }
31300
- }
31301
- };
31302
- };
31303
- const getFilterOptions$2 = (options, t) => {
31304
- const {
31305
- timeframe = []
31306
- } = options || {};
31307
- const _default = {
31308
- timeframe: timeframe
31991
+ }],
31992
+ category: stakeholderCategoryOptions || categoryOptions,
31993
+ country: countries,
31994
+ subCategory: subCategoriesOptions,
31995
+ // category: category,
31996
+ administrativeLevel1,
31997
+ administrativeLevel2,
31998
+ positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions
31309
31999
  };
31310
32000
  return _default;
31311
32001
  };
31312
-
31313
- const getCheckboxConfig = ({
31314
- subject
31315
- }) => {
31316
- return {
31317
- name: 'Name',
31318
- datastakeId: 'ID'
31319
- };
31320
- };
31321
- const getSelectFiltersConfig = ({
31322
- subject
31323
- }) => {
31324
- return {
31325
- name: '',
31326
- datastakeId: ''
31327
- };
31328
- };
31329
- const FILTER_REGISTRY = {
31330
- stakeholders: {
31331
- config: getFiltersConfig$a,
31332
- options: getFilterOptions$a
31333
- },
31334
- workers: {
31335
- config: getFiltersConfig$8,
31336
- options: getFilterOptions$8
31337
- },
31338
- operators: {
31339
- config: getFiltersConfig$9,
31340
- options: getFilterOptions$9
31341
- },
31342
- events: {
31343
- config: getFiltersConfig$7,
31344
- options: getFilterOptions$7
31345
- },
31346
- activities: {
31347
- config: getFiltersConfig$6,
31348
- options: getFilterOptions$6
31349
- },
31350
- incidents: {
31351
- config: getFiltersConfig$5,
31352
- options: getFilterOptions$5
31353
- },
31354
- locations: {
31355
- config: getFiltersConfig$4,
31356
- options: getFilterOptions$4
31357
- },
31358
- 'production-sites': {
31359
- config: getFiltersConfig$3,
31360
- options: getFilterOptions$3
31361
- },
31362
- documents: {
31363
- config: getFiltersConfig$2,
31364
- options: getFilterOptions$2
31365
- }
31366
- };
31367
- const DEFAULT_SUBJECT = 'stakeholders';
31368
- const getFiltersConfig$1 = ({
31369
- t,
31370
- subject
31371
- }) => {
31372
- const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
31373
- return registry?.config({
31374
- t
31375
- });
32002
+ const formConfig$3 = {
32003
+ namespace: 'incident',
32004
+ view: 'incident',
32005
+ scope: 'createIncident',
32006
+ formType: 'incident'
31376
32007
  };
31377
- const getFilterOptions$1 = ({
31378
- t,
31379
- subject,
31380
- options
31381
- }) => {
31382
- const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
31383
- return registry.options(options, t);
32008
+ const viewConfig$3 = {
32009
+ title: "Incidents",
32010
+ createTitle: "Create Incident"
31384
32011
  };
31385
32012
 
31386
- const useFetchData = ({
31387
- location,
31388
- getData,
31389
- activeTab,
31390
- extendingFilters,
31391
- subject
31392
- }) => {
31393
- const {
31394
- paginationQuery,
31395
- searchParams,
31396
- otherParams,
31397
- sortBy,
31398
- sortDir
31399
- } = useGetQueryParams({
31400
- location
31401
- });
31402
- React.useEffect(() => {
31403
- const cleanSearchParams = Object.fromEntries(Object.entries(searchParams).filter(([_, value]) => value != null && value !== ''));
31404
- const hasPagination = paginationQuery.skip != null || paginationQuery.take != null;
31405
- if (!hasPagination) {
31406
- return;
31407
- }
31408
- getData({
31409
- ...extendingFilters,
31410
- pagination: paginationQuery,
31411
- ...(Object.keys(otherParams).length > 0 && otherParams),
31412
- ...(Object.keys(cleanSearchParams).length > 0 && {
31413
- search: cleanSearchParams
31414
- }),
31415
- tab: activeTab,
31416
- sortBy: {
31417
- [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
31418
- }
31419
- }, subject);
31420
- }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
31421
- };
31422
- const useTablePage = ({
31423
- subject,
31424
- location,
31425
- getData,
31426
- getColumns,
31427
- extendingFilters,
31428
- options,
32013
+ const getColumns$6 = ({
31429
32014
  t,
31430
32015
  goTo,
31431
32016
  user,
32017
+ options,
32018
+ activeTab,
31432
32019
  getRedirectLink,
31433
32020
  theme,
31434
- data,
31435
- applications,
31436
- subjectClear
31437
- }) => {
31438
- const [selectOptions, setSelectOptions] = React.useState();
31439
- const [activeTab, setActiveTab] = React.useState("own");
31440
- useFetchData({
31441
- location,
31442
- getData,
31443
- activeTab,
31444
- extendingFilters: extendingFilters,
31445
- subject
31446
- });
31447
- const columns = React.useMemo(() => getColumns({
31448
- t,
31449
- goTo,
31450
- user,
31451
- options,
31452
- activeTab,
31453
- getRedirectLink,
31454
- theme,
31455
- subject,
31456
- data,
31457
- applications
31458
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns]);
31459
- const selectFiltersConfig = React.useMemo(() => getFiltersConfig$1({
31460
- t,
31461
- subject
31462
- }), [t, subject, getFiltersConfig$1]);
31463
- React.useEffect(() => {
31464
- setSelectOptions(prev => ({
31465
- ...prev,
31466
- ...getFilterOptions$1({
31467
- t,
31468
- subject,
31469
- options
31470
- })
31471
- }));
31472
- }, [options, t, subject, getFilterOptions$1]);
31473
- const checkboxConfig = React.useMemo(() => getCheckboxConfig({
31474
- subject
31475
- }), [subject, getCheckboxConfig]);
31476
- const _filtersConfig = React.useMemo(() => {
31477
- return getSelectFiltersConfig({
31478
- subject
31479
- });
31480
- }, [subject, getSelectFiltersConfig]);
31481
- const handleActiveTabChange = React.useCallback(value => {
31482
- setActiveTab(value);
31483
- }, []);
31484
- React.useEffect(() => () => {
31485
- if (subjectClear && typeof subjectClear === 'function') {
31486
- subjectClear();
31487
- }
31488
- }, [subjectClear]);
31489
- return {
31490
- activeTab,
31491
- selectOptions,
31492
- columns,
31493
- selectFiltersConfig,
31494
- handleActiveTabChange,
31495
- checkboxConfig,
31496
- _filtersConfig
31497
- };
31498
- };
31499
-
31500
- const TablePage = ({
31501
- t = () => {},
31502
- goTo = () => {},
31503
- user = {},
31504
- options = {},
31505
- getRedirectLink = () => {},
31506
- theme = {},
31507
- loading = false,
31508
- data = {},
31509
- isMobile,
31510
- APP,
31511
- location,
31512
- formConfig = {
31513
- getFormData: () => {},
31514
- saveFormData: () => {},
31515
- formLoading: false,
31516
- query: {},
31517
- ajaxForms: {},
31518
- changeAjaxForms: () => {},
31519
- ajaxOptions: {},
31520
- changeAjaxOptions: () => {},
31521
- formData: {},
31522
- formValue: {},
31523
- form: {},
31524
- namespace: '',
31525
- view: '',
31526
- scope: '',
31527
- formType: '',
31528
- defaultValues: {}
31529
- },
31530
- extendingFilters = {},
31531
- getData = () => {},
31532
- getApiBaseUrl = () => {},
31533
- getAppHeader = () => {},
31534
- applications = [],
31535
- subjectClear,
31536
- subject,
31537
- getColumns = () => {},
31538
- viewConfig = {
31539
- title: '',
31540
- breadcrumbs: [],
31541
- createTitle: ''
31542
- },
31543
- onDownload
31544
- }) => {
31545
- const {
31546
- activeTab,
31547
- selectOptions,
31548
- columns,
31549
- selectFiltersConfig,
31550
- handleActiveTabChange,
31551
- checkboxConfig,
31552
- _filtersConfig
31553
- } = useTablePage({
31554
- subject,
31555
- location,
31556
- getData,
31557
- getColumns,
31558
- extendingFilters,
31559
- options,
31560
- t,
31561
- goTo,
31562
- user,
31563
- getRedirectLink,
31564
- theme,
31565
- data,
31566
- applications,
31567
- subjectClear
31568
- });
31569
- return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
31570
- t: t,
31571
- title: t(viewConfig.title || ""),
31572
- breadCrumbs: viewConfig.breadcrumbs,
31573
- location: location,
31574
- loading: loading,
31575
- goTo: goTo,
31576
- defaultActiveTab: "own",
31577
- columns: columns,
31578
- data: data,
31579
- checkboxConfig: checkboxConfig,
31580
- APP: APP,
31581
- getApiBaseUrl: getApiBaseUrl,
31582
- selectOptions: selectOptions,
31583
- selectFiltersConfig: selectFiltersConfig,
31584
- getRedirectLink: getRedirectLink,
31585
- filtersConfig: _filtersConfig,
31586
- isMobile: isMobile,
31587
- view: subject,
31588
- getActiveTab: handleActiveTabChange,
31589
- onDownload: onDownload && typeof onDownload === 'function' ? onDownload : undefined,
31590
- drawerTitle: t(viewConfig.createTitle || ""),
31591
- children: ({
31592
- onDrawerClose
31593
- }) => /*#__PURE__*/jsxRuntime.jsx(Create$1, {
31594
- t: t,
31595
- goTo: goTo,
31596
- user: user,
31597
- APP: APP,
31598
- getApiBaseUrl: getApiBaseUrl,
31599
- getAppHeader: getAppHeader,
31600
- getData: formConfig.getFormData,
31601
- saveData: formConfig.saveFormData,
31602
- loading: formConfig.formLoading,
31603
- onSubmitted: (type, m, data) => {
31604
- if (data.datastakeId) {
31605
- displayMessage(type, t("affirmations::subject-created-successfully") || m);
31606
- goTo(`/app/edit/${subject}/${data.datastakeId}`);
31607
- }
31608
- },
31609
- onCancel: onDrawerClose,
31610
- query: formConfig.query,
31611
- ajaxForms: formConfig.ajaxForms,
31612
- changeAjaxForms: formConfig.changeAjaxForms,
31613
- ajaxOptions: formConfig.ajaxOptions,
31614
- changeAjaxOptions: formConfig.changeAjaxOptions,
31615
- formData: formConfig.formData,
31616
- formValue: formConfig.formValue,
31617
- form: formConfig.form,
31618
- namespace: formConfig.namespace,
31619
- view: formConfig.view,
31620
- scope: formConfig.scope,
31621
- formType: formConfig.formType,
31622
- defaultData: formConfig.defaultValues
31623
- })
31624
- });
31625
- };
31626
-
31627
- const OperatorsTable = ({
31628
- t = () => {},
31629
- goTo = () => {},
31630
- user = {},
31631
- options = {},
31632
- getRedirectLink = () => {},
31633
- theme = {},
31634
- loading = false,
31635
- data = {},
31636
- isMobile,
31637
- APP,
31638
- location,
31639
- getData = () => {},
31640
- getApiBaseUrl = () => {},
31641
- getAppHeader = () => {},
31642
- getFormData = () => {},
31643
- saveFormData = () => {},
31644
- formLoading = false,
31645
- query = {},
31646
- ajaxForms = {},
31647
- changeAjaxForms = () => {},
31648
- ajaxOptions = {},
31649
- changeAjaxOptions = () => {},
31650
- formData = {},
31651
- formValue = {},
31652
- form = {},
31653
- extendingFilters = {},
31654
- createDefaultValues = {},
31655
- applications = [],
31656
- breadcrumbs = []
31657
- }) => {
31658
- return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
31659
- t: t,
31660
- goTo: goTo,
31661
- user: user,
31662
- options: options,
31663
- getRedirectLink: getRedirectLink,
31664
- theme: theme,
31665
- loading: loading,
31666
- data: data,
31667
- isMobile: isMobile,
31668
- APP: APP,
31669
- location: location,
31670
- applications: applications,
31671
- subject: "operators",
31672
- getData: getData,
31673
- getApiBaseUrl: getApiBaseUrl,
31674
- getAppHeader: getAppHeader,
31675
- getColumns: getColumns$a,
31676
- viewConfig: {
31677
- title: "Operators",
31678
- breadcrumbs: breadcrumbs,
31679
- createTitle: "Create Operator"
31680
- },
31681
- extendingFilters: extendingFilters,
31682
- formConfig: {
31683
- getFormData,
31684
- saveFormData,
31685
- formLoading,
31686
- query,
31687
- ajaxForms,
31688
- changeAjaxForms,
31689
- ajaxOptions,
31690
- changeAjaxOptions,
31691
- formData,
31692
- formValue,
31693
- form,
31694
- namespace: "OPERATOR",
31695
- view: ['scoping', 'new'],
31696
- scope: 'global',
31697
- formType: 'operator',
31698
- defaultValues: createDefaultValues
31699
- },
31700
- onDownload: () => console.log("download")
31701
- });
31702
- };
31703
-
31704
- const NavigationAction = ({
31705
- onClick,
31706
- theme
31707
- }) => {
31708
- return /*#__PURE__*/jsxRuntime.jsx("div", {
31709
- style: {
31710
- display: "flex",
31711
- justifyContent: "center"
31712
- },
31713
- children: /*#__PURE__*/jsxRuntime.jsx("button", {
31714
- onClick: onClick,
31715
- style: {
31716
- cursor: 'pointer',
31717
- border: 'none',
31718
- background: 'transparent',
31719
- padding: 0,
31720
- display: 'flex',
31721
- alignItems: 'center'
31722
- },
31723
- children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
31724
- name: "Link",
31725
- size: 15,
31726
- color: theme.baseGray70
31727
- })
31728
- })
31729
- });
31730
- };
31731
-
31732
- const getColumns$9 = ({
31733
- t,
31734
- goTo,
31735
- user,
31736
- options,
31737
- activeTab,
31738
- getRedirectLink,
31739
- theme,
31740
- subject,
32021
+ subject,
31741
32022
  data,
31742
32023
  applications
31743
32024
  }) => [{
@@ -31758,7 +32039,7 @@ const getColumns$9 = ({
31758
32039
  }
31759
32040
  }, {
31760
32041
  dataIndex: 'name',
31761
- title: t('Name'),
32042
+ title: t('Title'),
31762
32043
  ellipsis: true,
31763
32044
  show: true,
31764
32045
  render: (v, all) => {
@@ -31773,8 +32054,25 @@ const getColumns$9 = ({
31773
32054
  });
31774
32055
  }
31775
32056
  }, {
31776
- dataIndex: 'category',
31777
- title: t('Category'),
32057
+ title: t("Date"),
32058
+ dataIndex: "date",
32059
+ key: "date",
32060
+ render: (date, all) => {
32061
+ if (all.empty) {
32062
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32063
+ className: "daf-default-cell"
32064
+ });
32065
+ }
32066
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32067
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32068
+ title: _date,
32069
+ children: _date
32070
+ });
32071
+ },
32072
+ ellipsis: true
32073
+ }, {
32074
+ dataIndex: 'mineSite',
32075
+ title: t('Location'),
31778
32076
  ellipsis: true,
31779
32077
  show: true,
31780
32078
  render: (v, all) => {
@@ -31783,15 +32081,17 @@ const getColumns$9 = ({
31783
32081
  className: "daf-default-cell"
31784
32082
  });
31785
32083
  }
31786
- const category = findOptions(v, data?.options?.locationCategories);
31787
- return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31788
- title: category,
31789
- children: category
32084
+
32085
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
32086
+ const mineSite = all?.location?.name;
32087
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32088
+ title: mineSite,
32089
+ children: mineSite
31790
32090
  }) : '-';
31791
32091
  }
31792
32092
  }, {
31793
- dataIndex: 'country',
31794
- title: t('Country'),
32093
+ dataIndex: 'province',
32094
+ title: t('Province'),
31795
32095
  ellipsis: true,
31796
32096
  show: true,
31797
32097
  render: (v, all) => {
@@ -31800,15 +32100,15 @@ const getColumns$9 = ({
31800
32100
  className: "daf-default-cell"
31801
32101
  });
31802
32102
  }
31803
- const country = findOptions(v, options?.countries);
31804
- return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31805
- title: country,
31806
- children: country
32103
+ const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
32104
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32105
+ title: region,
32106
+ children: region
31807
32107
  }) : '-';
31808
32108
  }
31809
32109
  }, {
31810
- dataIndex: 'province',
31811
- title: t('Province'),
32110
+ dataIndex: 'territory',
32111
+ title: t('Territory'),
31812
32112
  ellipsis: true,
31813
32113
  show: true,
31814
32114
  render: (v, all) => {
@@ -31817,15 +32117,15 @@ const getColumns$9 = ({
31817
32117
  className: "daf-default-cell"
31818
32118
  });
31819
32119
  }
31820
- const province = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
31821
- return province ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31822
- title: province,
31823
- children: province
32120
+ const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
32121
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32122
+ title: district,
32123
+ children: district
31824
32124
  }) : '-';
31825
32125
  }
31826
32126
  }, {
31827
- dataIndex: 'territory',
31828
- title: t('Territory'),
32127
+ dataIndex: 'eventCategory',
32128
+ title: t('Category'),
31829
32129
  ellipsis: true,
31830
32130
  show: true,
31831
32131
  render: (v, all) => {
@@ -31834,10 +32134,11 @@ const getColumns$9 = ({
31834
32134
  className: "daf-default-cell"
31835
32135
  });
31836
32136
  }
31837
- const territory = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
31838
- return territory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31839
- title: territory,
31840
- children: territory
32137
+ const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
32138
+ const categoryValue = getEventCategoryBySubject(eventCategory, subject);
32139
+ return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32140
+ title: categoryValue,
32141
+ children: categoryValue
31841
32142
  }) : '-';
31842
32143
  }
31843
32144
  }, {
@@ -31856,11 +32157,27 @@ const getColumns$9 = ({
31856
32157
  items: sources
31857
32158
  });
31858
32159
  }
32160
+ }, {
32161
+ title: t("Status"),
32162
+ dataIndex: "status",
32163
+ key: "status",
32164
+ show: activeTab === "own",
32165
+ render: (val, all) => {
32166
+ if (all.empty) {
32167
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32168
+ className: "daf-default-cell"
32169
+ });
32170
+ }
32171
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
32172
+ return renderStatusTag({
32173
+ value: _val,
32174
+ t
32175
+ });
32176
+ }
31859
32177
  }, {
31860
32178
  title: t("Last Update"),
31861
32179
  dataIndex: "updatedAt",
31862
32180
  key: "updatedAt",
31863
- width: 125,
31864
32181
  render: (date, all) => {
31865
32182
  if (all.empty) {
31866
32183
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31898,86 +32215,60 @@ const getColumns$9 = ({
31898
32215
  }
31899
32216
  }].filter(column => column.show !== false);
31900
32217
 
31901
- const LocationsTable = ({
31902
- t = () => {},
31903
- goTo = () => {},
31904
- user = {},
31905
- options = {},
31906
- getRedirectLink = () => {},
31907
- theme = {},
31908
- loading = false,
31909
- data = {},
31910
- isMobile,
31911
- APP,
31912
- location,
31913
- getData = () => {},
31914
- getApiBaseUrl = () => {},
31915
- getAppHeader = () => {},
31916
- getFormData = () => {},
31917
- saveFormData = () => {},
31918
- formLoading = false,
31919
- query = {},
31920
- ajaxForms = {},
31921
- changeAjaxForms = () => {},
31922
- ajaxOptions = {},
31923
- changeAjaxOptions = () => {},
31924
- formData = {},
31925
- formValue = {},
31926
- form = {},
31927
- applications = [],
31928
- subjectClear = () => {},
31929
- breadcrumbs = [],
31930
- extendingFilters = {},
31931
- createDefaultValues = {}
32218
+ const getFiltersConfig$4 = ({
32219
+ t
31932
32220
  }) => {
31933
- return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
31934
- t: t,
31935
- goTo: goTo,
31936
- user: user,
31937
- options: options,
31938
- getRedirectLink: getRedirectLink,
31939
- theme: theme,
31940
- loading: loading,
31941
- data: data,
31942
- isMobile: isMobile,
31943
- APP: APP,
31944
- location: location,
31945
- applications: applications,
31946
- subject: "locations",
31947
- getData: getData,
31948
- getApiBaseUrl: getApiBaseUrl,
31949
- getAppHeader: getAppHeader,
31950
- subjectClear: subjectClear,
31951
- getColumns: getColumns$9,
31952
- viewConfig: {
31953
- title: "Locations",
31954
- breadcrumbs: breadcrumbs,
31955
- createTitle: "Create Location"
31956
- },
31957
- extendingFilters: extendingFilters,
31958
- formConfig: {
31959
- getFormData,
31960
- saveFormData,
31961
- formLoading,
31962
- query,
31963
- ajaxForms,
31964
- changeAjaxForms,
31965
- ajaxOptions,
31966
- changeAjaxOptions,
31967
- formData,
31968
- formValue,
31969
- form,
31970
- namespace: 'locations',
31971
- view: 'scoping',
31972
- scope: 'create',
31973
- formType: 'location',
31974
- defaultValues: createDefaultValues
32221
+ return {
32222
+ country: {
32223
+ type: 'select',
32224
+ placeholder: t('Country'),
32225
+ style: {
32226
+ flex: 1
32227
+ },
32228
+ labelStyle: {
32229
+ flex: 1
32230
+ },
32231
+ getLabel: option => option.label,
32232
+ getValue: option => option.value
31975
32233
  },
31976
- onDownload: () => console.log("download")
31977
- });
32234
+ category: {
32235
+ type: 'select',
32236
+ label: 'Category',
32237
+ placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
32238
+ style: {
32239
+ flex: 1
32240
+ },
32241
+ labelStyle: {
32242
+ flex: 1
32243
+ },
32244
+ getLabel: option => option.label,
32245
+ getValue: option => option.value
32246
+ }
32247
+ };
32248
+ };
32249
+ const getFilterOptions$4 = (options, t) => {
32250
+ const {
32251
+ countries = [],
32252
+ category = [],
32253
+ locationCategories = []
32254
+ } = options || {};
32255
+ return {
32256
+ country: countries,
32257
+ category: locationCategories || category
32258
+ };
32259
+ };
32260
+ const formConfig$2 = {
32261
+ namespace: 'locations',
32262
+ view: 'scoping',
32263
+ scope: 'create',
32264
+ formType: 'location'
32265
+ };
32266
+ const viewConfig$2 = {
32267
+ title: "Locations",
32268
+ createTitle: "Create Location"
31978
32269
  };
31979
32270
 
31980
- const getColumns$8 = ({
32271
+ const getColumns$5 = ({
31981
32272
  t,
31982
32273
  goTo,
31983
32274
  user,
@@ -31986,6 +32277,7 @@ const getColumns$8 = ({
31986
32277
  getRedirectLink,
31987
32278
  theme,
31988
32279
  subject,
32280
+ data,
31989
32281
  applications
31990
32282
  }) => [{
31991
32283
  dataIndex: 'datastakeId',
@@ -32030,15 +32322,15 @@ const getColumns$8 = ({
32030
32322
  className: "daf-default-cell"
32031
32323
  });
32032
32324
  }
32033
- const category = findOptions(v, options?.categoriesOptions);
32325
+ const category = findOptions(v, data?.options?.locationCategories);
32034
32326
  return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32035
32327
  title: category,
32036
32328
  children: category
32037
32329
  }) : '-';
32038
32330
  }
32039
32331
  }, {
32040
- dataIndex: 'subCategory',
32041
- title: t('Sub Category'),
32332
+ dataIndex: 'country',
32333
+ title: t('Country'),
32042
32334
  ellipsis: true,
32043
32335
  show: true,
32044
32336
  render: (v, all) => {
@@ -32047,15 +32339,15 @@ const getColumns$8 = ({
32047
32339
  className: "daf-default-cell"
32048
32340
  });
32049
32341
  }
32050
- const subCategory = findOptions(v, options?.subCategoriesOptions);
32051
- return subCategory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32052
- title: subCategory,
32053
- children: subCategory
32342
+ const country = findOptions(v, options?.countries);
32343
+ return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32344
+ title: country,
32345
+ children: country
32054
32346
  }) : '-';
32055
32347
  }
32056
32348
  }, {
32057
- dataIndex: 'country',
32058
- title: t('Country'),
32349
+ dataIndex: 'province',
32350
+ title: t('Province'),
32059
32351
  ellipsis: true,
32060
32352
  show: true,
32061
32353
  render: (v, all) => {
@@ -32064,10 +32356,27 @@ const getColumns$8 = ({
32064
32356
  className: "daf-default-cell"
32065
32357
  });
32066
32358
  }
32067
- const country = findOptions(v, options?.countries);
32068
- return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32069
- title: country,
32070
- children: country
32359
+ const province = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
32360
+ return province ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32361
+ title: province,
32362
+ children: province
32363
+ }) : '-';
32364
+ }
32365
+ }, {
32366
+ dataIndex: 'territory',
32367
+ title: t('Territory'),
32368
+ ellipsis: true,
32369
+ show: true,
32370
+ render: (v, all) => {
32371
+ if (all.empty) {
32372
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32373
+ className: "daf-default-cell"
32374
+ });
32375
+ }
32376
+ const territory = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
32377
+ return territory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32378
+ title: territory,
32379
+ children: territory
32071
32380
  }) : '-';
32072
32381
  }
32073
32382
  }, {
@@ -32081,9 +32390,6 @@ const getColumns$8 = ({
32081
32390
  className: "daf-default-cell"
32082
32391
  });
32083
32392
  }
32084
- if (!val || val?.length === 0) {
32085
- return "--";
32086
- }
32087
32393
  const sources = sourceAvatarConfig(val, user, applications);
32088
32394
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32089
32395
  items: sources
@@ -32131,208 +32437,252 @@ const getColumns$8 = ({
32131
32437
  }
32132
32438
  }].filter(column => column.show !== false);
32133
32439
 
32134
- const StakeholdersTable = ({
32135
- t = () => {},
32136
- goTo = () => {},
32137
- user = {},
32138
- options = {},
32139
- getRedirectLink = () => {},
32140
- theme = {},
32141
- loading = false,
32142
- data = {},
32143
- isMobile,
32144
- APP,
32145
- location,
32146
- getData = () => {},
32147
- getApiBaseUrl = () => {},
32148
- getAppHeader = () => {},
32149
- getFormData = () => {},
32150
- saveFormData = () => {},
32151
- formLoading = false,
32152
- query = {},
32153
- ajaxForms = {},
32154
- changeAjaxForms = () => {},
32155
- ajaxOptions = {},
32156
- changeAjaxOptions = () => {},
32157
- formData = {},
32158
- formValue = {},
32159
- form = {},
32160
- applications = [],
32161
- subjectClear = () => {},
32162
- breadcrumbs = [],
32163
- extendingFilters = {},
32164
- createDefaultValues = {}
32440
+ const getFiltersConfig$3 = ({
32441
+ t
32165
32442
  }) => {
32166
- return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
32167
- t: t,
32168
- goTo: goTo,
32169
- user: user,
32170
- options: options,
32171
- getRedirectLink: getRedirectLink,
32172
- theme: theme,
32173
- loading: loading,
32174
- data: data,
32175
- isMobile: isMobile,
32176
- APP: APP,
32177
- location: location,
32178
- applications: applications,
32179
- subject: "stakeholders",
32180
- getData: getData,
32181
- getApiBaseUrl: getApiBaseUrl,
32182
- getAppHeader: getAppHeader,
32183
- subjectClear: subjectClear,
32184
- getColumns: getColumns$8,
32185
- viewConfig: {
32186
- title: "Stakeholders",
32187
- breadcrumbs: breadcrumbs,
32188
- createTitle: "Create Stakeholder"
32443
+ return {
32444
+ country: {
32445
+ type: 'select',
32446
+ label: 'Country',
32447
+ placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
32448
+ style: {
32449
+ flex: 1
32450
+ },
32451
+ labelStyle: {
32452
+ flex: 1
32453
+ },
32454
+ getLabel: option => option.label,
32455
+ getValue: option => option.value
32189
32456
  },
32190
- extendingFilters: extendingFilters,
32191
- formConfig: {
32192
- getFormData,
32193
- saveFormData,
32194
- formLoading,
32195
- query,
32196
- ajaxForms,
32197
- changeAjaxForms,
32198
- ajaxOptions,
32199
- changeAjaxOptions,
32200
- formData,
32201
- formValue,
32202
- form,
32203
- namespace: 'stakeholders',
32204
- view: 'scoping',
32205
- scope: 'create',
32206
- formType: 'stakeholder',
32207
- defaultValues: createDefaultValues
32457
+ administrativeLevel1: {
32458
+ type: 'ajaxSelect',
32459
+ label: ({
32460
+ t = s => s,
32461
+ options = {},
32462
+ filters = {},
32463
+ language = 'en'
32464
+ }) => {
32465
+ const {
32466
+ administrativeLevel1
32467
+ } = options;
32468
+ if (administrativeLevel1) {
32469
+ if (options.country) {
32470
+ const _item = administrativeLevel1[filters.country];
32471
+ if (_item) {
32472
+ if (_item[language]) {
32473
+ return _item[language];
32474
+ }
32475
+ }
32476
+ }
32477
+ }
32478
+ return t('Province');
32479
+ },
32480
+ placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
32481
+ filters: data => ({
32482
+ country: data.country,
32483
+ level: 'level_1'
32484
+ }),
32485
+ show: data => !data.country,
32486
+ disabled: data => !data.country,
32487
+ mapper: {
32488
+ label: "name",
32489
+ value: "id"
32490
+ },
32491
+ method: 'getOptions',
32492
+ entity: 'AdministrativeLevel',
32493
+ style: {
32494
+ flex: 1
32495
+ },
32496
+ labelStyle: {
32497
+ flex: 1
32498
+ }
32208
32499
  },
32209
- onDownload: () => console.log("download")
32210
- });
32211
- };
32212
-
32213
- const {
32214
- Text
32215
- } = antd.Typography;
32216
- function MoreTags({
32217
- values = [],
32218
- maxWidthCont = 120,
32219
- maxTextCont = 100,
32220
- diff = 30,
32221
- style = {},
32222
- tagColor,
32223
- limit
32224
- }) {
32225
- const ref = React.useRef();
32226
- const [width, setWidth] = React.useState(0);
32227
- const [indexToReturn, setIndexToReturn] = React.useState(0);
32228
- const _maxWidthCont = values.length <= 1 ? maxWidthCont : maxWidthCont - 20;
32229
- const _maxWidthTxt = values.length <= 1 ? maxTextCont : 80;
32230
- React.useEffect(() => {
32231
- const resizeObserver = new ResizeObserver(entries => {
32232
- setWidth(entries[0].contentRect.width);
32233
- });
32234
- resizeObserver.observe(ref.current);
32235
- return () => resizeObserver.disconnect();
32236
- }, []);
32237
- const _calculate = () => {
32238
- // If limit prop is provided and valid, use it instead of calculating
32239
- if (typeof limit === 'number' && limit > 0) {
32240
- setIndexToReturn(Math.min(limit - 1, values.length - 1));
32241
- return;
32242
- }
32243
- const tabs = ref.current.querySelectorAll(".check-tabs");
32244
- let filled = 0;
32245
- let indexToReturn;
32246
- if (values.length === 1) {
32247
- setIndexToReturn(1);
32248
- return;
32249
- }
32250
- tabs.forEach((t, i) => {
32251
- if (typeof indexToReturn === "number") {
32252
- return;
32500
+ administrativeLevel2: {
32501
+ type: 'ajaxSelect',
32502
+ label: ({
32503
+ t = s => s,
32504
+ options = {},
32505
+ filters = {},
32506
+ language = 'en'
32507
+ }) => {
32508
+ const {
32509
+ administrativeLevel2
32510
+ } = options;
32511
+ if (administrativeLevel2) {
32512
+ if (options.country) {
32513
+ const _item = administrativeLevel2[filters.country];
32514
+ if (_item) {
32515
+ if (_item[language]) {
32516
+ return _item[language];
32517
+ }
32518
+ }
32519
+ }
32520
+ }
32521
+ return t('Province');
32522
+ },
32523
+ show: data => !(data.country && data.administrativeLevel1),
32524
+ placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
32525
+ filters: data => ({
32526
+ country: data.country,
32527
+ level: 'level_2',
32528
+ administrativeLevel1: data.administrativeLevel1
32529
+ }),
32530
+ disabled: data => !(data.country && data.administrativeLevel1),
32531
+ mapper: {
32532
+ label: "name",
32533
+ value: "id"
32534
+ },
32535
+ method: 'getOptions',
32536
+ entity: 'AdministrativeLevel',
32537
+ style: {
32538
+ flex: 1
32539
+ },
32540
+ labelStyle: {
32541
+ flex: 1
32253
32542
  }
32254
- filled = filled + t.clientWidth + 25;
32255
- const dif = width - filled;
32256
- if (dif < diff) {
32257
- indexToReturn = dif < 0 ? i - 1 : i;
32258
- setIndexToReturn(indexToReturn);
32259
- return;
32543
+ },
32544
+ product: {
32545
+ type: 'select',
32546
+ label: 'Product',
32547
+ placeholder: t => `${t('Filter by')} ${t('Product').toLowerCase()}`,
32548
+ style: {
32549
+ flex: 1
32550
+ },
32551
+ labelStyle: {
32552
+ flex: 1
32553
+ },
32554
+ getLabel: option => option.label,
32555
+ getValue: option => option.value,
32556
+ filterOptions: val => {
32557
+ if (val) {
32558
+ const {
32559
+ option,
32560
+ filters
32561
+ } = val;
32562
+ if (filters && option) {
32563
+ const {
32564
+ filters: optionFilters
32565
+ } = option;
32566
+ if (Array.isArray(optionFilters) && optionFilters.length) {
32567
+ const {
32568
+ value,
32569
+ condition
32570
+ } = optionFilters[0];
32571
+ if (condition === 'includes') {
32572
+ return value.includes('corporation');
32573
+ }
32574
+ }
32575
+ }
32576
+ }
32577
+ return true;
32260
32578
  }
32261
- });
32262
- setIndexToReturn(typeof indexToReturn === "number" ? indexToReturn : tabs.length - 1);
32579
+ },
32580
+ positionInTheMineralSupplyChain: {
32581
+ type: 'select',
32582
+ label: 'Position',
32583
+ placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
32584
+ style: {
32585
+ flex: 1
32586
+ },
32587
+ labelStyle: {
32588
+ flex: 1
32589
+ },
32590
+ getLabel: option => option.label,
32591
+ getValue: option => option.value
32592
+ },
32593
+ status: {
32594
+ type: "select",
32595
+ label: "Status",
32596
+ placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
32597
+ style: {
32598
+ flex: 1
32599
+ },
32600
+ labelStyle: {
32601
+ fley: 1
32602
+ },
32603
+ getLabel: option => option.label,
32604
+ getValue: option => option.value
32605
+ }
32263
32606
  };
32264
- const hasMore = values.length && indexToReturn !== values.length - 1;
32265
- const toShow = hasMore ? values.slice(0, indexToReturn + 1) : values;
32266
- const other = hasMore ? values.slice(indexToReturn + 1, values.length + 1) : [];
32267
- React.useEffect(() => {
32268
- _calculate();
32269
- }, [width, values, limit]);
32270
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
32271
- className: "daf-more-tags",
32272
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
32273
- className: "list",
32274
- children: [toShow.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag() : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
32275
- style: {
32276
- maxWidth: _maxWidthCont,
32277
- overflow: "hidden",
32278
- textOverflow: "ellipsis",
32279
- whiteSpace: "nowrap",
32280
- ...style
32281
- },
32282
- color: tagColor || ac.color,
32283
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32284
- title: typeof ac === "object" ? ac.label : ac,
32285
- children: /*#__PURE__*/jsxRuntime.jsx("span", {
32286
- style: {
32287
- maxWidth: _maxWidthTxt,
32288
- overflow: "hidden",
32289
- textOverflow: "ellipsis",
32290
- whiteSpace: "nowrap",
32291
- ...style
32292
- },
32293
- children: typeof ac === "object" ? ac.label : ac
32294
- })
32295
- })
32296
- }, `${typeof ac === "object" ? ac.value : ac}-${i}`)), other.length ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32297
- title: other.map(ac => typeof ac === "object" ? ac.label : ac).join(", "),
32298
- children: /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
32299
- color: tagColor || 'default',
32300
- style: style,
32301
- children: ["+", other.length]
32302
- })
32303
- }) : null]
32304
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
32305
- className: "list hidden",
32306
- ref: ref,
32307
- children: values.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag("check-tabs") : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
32308
- color: tagColor || ac.color,
32309
- className: "check-tabs",
32310
- style: {
32311
- maxWidth: _maxWidthCont,
32312
- ...style
32313
- },
32314
- children: /*#__PURE__*/jsxRuntime.jsx(Text, {
32315
- ellipsis: {
32316
- tooltip: typeof ac === "object" ? ac.label : ac
32317
- },
32318
- style: {
32319
- maxWidth: _maxWidthTxt
32320
- },
32321
- children: typeof ac === "object" ? ac.label : ac
32322
- })
32323
- }, `${ac}-${i}`))
32324
- })]
32607
+ };
32608
+ const getFilterOptions$3 = (options, t) => {
32609
+ const {
32610
+ statusOptions = [],
32611
+ categoryOptions = [],
32612
+ countries = [],
32613
+ product = [],
32614
+ subCategory = [],
32615
+ subCategoriesOptions,
32616
+ stakeholderCategoryOptions,
32617
+ stakeholderSubCategoriesOptions,
32618
+ administrativeLevel1,
32619
+ administrativeLevel2
32620
+ } = options || {};
32621
+ const _default = {
32622
+ category: stakeholderCategoryOptions || categoryOptions,
32623
+ country: countries,
32624
+ product: product,
32625
+ administrativeLevel1,
32626
+ administrativeLevel2,
32627
+ subCategory: subCategoriesOptions,
32628
+ status: [{
32629
+ value: "submitted",
32630
+ label: "Submitted"
32631
+ }, {
32632
+ value: "private",
32633
+ label: "Private"
32634
+ }]
32635
+ };
32636
+ return _default;
32637
+ };
32638
+ const formConfig$1 = {
32639
+ namespace: 'PRODUCTION SITES',
32640
+ view: ['scoping', 'new'],
32641
+ scope: 'global',
32642
+ formType: 'production-sites'
32643
+ };
32644
+ const viewConfig$1 = {
32645
+ title: "Production Sites",
32646
+ createTitle: "Create Production Site"
32647
+ };
32648
+
32649
+ const MoreOptions = ({
32650
+ data,
32651
+ limit = 2,
32652
+ toolTipPlacement = 'top'
32653
+ }) => {
32654
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32655
+ style: {
32656
+ overflow: 'hidden',
32657
+ textOverflow: 'ellipsis',
32658
+ whiteSpace: 'nowrap',
32659
+ display: 'inline-block'
32660
+ },
32661
+ placement: toolTipPlacement,
32662
+ title: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
32663
+ children: [data?.slice(0, 10).map((value, index) => /*#__PURE__*/jsxRuntime.jsxs("span", {
32664
+ children: [typeof value === 'string' ? value : value?.name, /*#__PURE__*/jsxRuntime.jsx("br", {})]
32665
+ }, index)), data?.length > 10 && /*#__PURE__*/jsxRuntime.jsxs("span", {
32666
+ children: ["+", data?.length - 10]
32667
+ })]
32668
+ }),
32669
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
32670
+ style: {
32671
+ overflow: 'hidden',
32672
+ textOverflow: 'ellipsis',
32673
+ whiteSpace: 'nowrap',
32674
+ maxWidth: '95%'
32675
+ },
32676
+ children: data?.length > limit ? `${data.slice(0, limit).map(value => typeof value === 'string' ? value : value?.name).join(', ')}, +${data?.length - limit}` : data.map(value => typeof value === 'string' ? value : value?.name).join(', ')
32677
+ })
32325
32678
  });
32326
- }
32327
- MoreTags.propTypes = {
32328
- values: PropTypes__default["default"].array,
32329
- maxWidthCont: PropTypes__default["default"].number,
32330
- maxTextCont: PropTypes__default["default"].number,
32331
- diff: PropTypes__default["default"].number,
32679
+ };
32680
+ MoreOptions.propTypes = {
32681
+ data: PropTypes__default["default"].array.isRequired,
32332
32682
  limit: PropTypes__default["default"].number
32333
32683
  };
32334
32684
 
32335
- const getColumns$7 = ({
32685
+ const getColumns$4 = ({
32336
32686
  t,
32337
32687
  goTo,
32338
32688
  user,
@@ -32361,7 +32711,7 @@ const getColumns$7 = ({
32361
32711
  }
32362
32712
  }, {
32363
32713
  dataIndex: 'name',
32364
- title: t('Title'),
32714
+ title: t('Name'),
32365
32715
  ellipsis: true,
32366
32716
  show: true,
32367
32717
  render: (v, all) => {
@@ -32376,8 +32726,8 @@ const getColumns$7 = ({
32376
32726
  });
32377
32727
  }
32378
32728
  }, {
32379
- dataIndex: 'typeOfEvent',
32380
- title: t('Type'),
32729
+ dataIndex: 'region',
32730
+ title: t('Region'),
32381
32731
  ellipsis: true,
32382
32732
  show: true,
32383
32733
  render: (v, all) => {
@@ -32386,15 +32736,15 @@ const getColumns$7 = ({
32386
32736
  className: "daf-default-cell"
32387
32737
  });
32388
32738
  }
32389
- const type = findOptions(v, data?.options?.eventsType);
32390
- return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32391
- title: type,
32392
- children: type
32739
+ const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
32740
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32741
+ title: region,
32742
+ children: region
32393
32743
  }) : '-';
32394
32744
  }
32395
32745
  }, {
32396
- dataIndex: 'keyStakeholder',
32397
- title: t('Key Stakeholder'),
32746
+ dataIndex: 'territory',
32747
+ title: t('Territory'),
32398
32748
  ellipsis: true,
32399
32749
  show: true,
32400
32750
  render: (v, all) => {
@@ -32403,120 +32753,249 @@ const getColumns$7 = ({
32403
32753
  className: "daf-default-cell"
32404
32754
  });
32405
32755
  }
32406
- const val = (all?.stakeholderKey || []).map(sk => {
32407
- return sk?.name;
32408
- });
32409
- if (val?.length === 0) {
32410
- return "-";
32756
+ const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
32757
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32758
+ title: district,
32759
+ children: district
32760
+ }) : '-';
32761
+ }
32762
+ }, {
32763
+ dataIndex: 'category',
32764
+ title: t('Type'),
32765
+ ellipsis: true,
32766
+ show: true,
32767
+ render: (v, all) => {
32768
+ if (all.empty) {
32769
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32770
+ className: "daf-default-cell"
32771
+ });
32411
32772
  }
32412
- return /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
32413
- values: val
32773
+ const category = findOptions(v, options?.locationCategories);
32774
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32775
+ title: category,
32776
+ children: category
32414
32777
  });
32415
32778
  }
32416
32779
  }, {
32417
- title: t("Date"),
32418
- dataIndex: "date",
32419
- key: "date",
32420
- // testimonials: true,
32421
- // incident: true,
32422
- // correctiveActions: true,
32780
+ dataIndex: 'operator',
32781
+ title: t('Operator'),
32782
+ ellipsis: true,
32423
32783
  show: true,
32424
- // sorter: () => 0 + 0,
32425
- // searchType: "date",
32426
- // width: 125,
32784
+ render: (v, all) => {
32785
+ if (all.empty) {
32786
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32787
+ className: "daf-default-cell"
32788
+ });
32789
+ }
32790
+ const operators = all?.operator?.map(operator => operator?.locationClient?.name)?.filter(Boolean);
32791
+ return operators && operators.length > 0 ? /*#__PURE__*/jsxRuntime.jsx(MoreOptions, {
32792
+ data: operators || [],
32793
+ toolTipPlacement: operators?.length < 2 ? "topLeft" : "top"
32794
+ }) : '-';
32795
+ }
32796
+ }, {
32797
+ title: t("Last Update"),
32798
+ dataIndex: "updatedAt",
32799
+ key: "updatedAt",
32800
+ width: 125,
32427
32801
  render: (date, all) => {
32428
32802
  if (all.empty) {
32429
- return null;
32803
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32804
+ className: "daf-default-cell"
32805
+ });
32430
32806
  }
32431
- const title = date ? renderDateFormatted(date, "DD MMM YYYY") : "-";
32807
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32432
32808
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32433
- title: title,
32434
- children: title
32809
+ title: _date,
32810
+ children: _date
32435
32811
  });
32436
32812
  },
32437
32813
  ellipsis: true
32438
32814
  }, {
32439
- dataIndex: 'scope',
32440
- title: t('Scope'),
32815
+ title: t("Status"),
32816
+ dataIndex: 'status',
32441
32817
  ellipsis: true,
32442
- show: true,
32443
- render: (value, all) => {
32818
+ show: activeTab == "own",
32819
+ render: (v, all) => {
32444
32820
  if (all.empty) {
32445
32821
  return /*#__PURE__*/jsxRuntime.jsx("div", {
32446
32822
  className: "daf-default-cell"
32447
32823
  });
32448
32824
  }
32449
- if (!value) {
32450
- return "-";
32451
- }
32452
-
32453
- // Form the moment the intend of the if block is to be executed only in event table
32454
- if (typeof value === "string") {
32455
- if (all.navigationEventType === "other") {
32456
- return "-";
32457
- }
32458
- const categoryOptions = (data?.options?.categoryOptions || []).map(c => {
32459
- const searchTerm = `typeOfEvent is ${all.navigationEventType}`;
32460
- return {
32461
- value: c.value,
32462
- label: c.label[searchTerm]
32463
- };
32464
- });
32465
- const relaxantOptions = [...categoryOptions, ...(data?.options?.eventsType || []), ...(data?.options?.testimonialsType || [])];
32466
- const title = relaxantOptions.find(v => v.value === value)?.label || "-";
32467
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32468
- title: title,
32469
- children: title
32470
- });
32471
- }
32472
- const val = value.map((v, i) => ({
32473
- label: v.name,
32474
- value: `${v.name}-${i}`
32475
- }));
32476
- return val.length ? /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
32477
- values: val
32478
- }) : "-";
32825
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
32826
+ return renderStatusTag({
32827
+ value: _val,
32828
+ t
32829
+ });
32479
32830
  }
32480
32831
  }, {
32481
32832
  title: t("Sources"),
32482
- dataIndex: "sources",
32483
- key: "sources",
32833
+ dataIndex: 'sources',
32834
+ ellipsis: true,
32484
32835
  show: activeTab !== "own",
32485
- render: (val, all) => {
32836
+ render: (v, all) => {
32486
32837
  if (all.empty) {
32487
32838
  return /*#__PURE__*/jsxRuntime.jsx("div", {
32488
32839
  className: "daf-default-cell"
32489
32840
  });
32490
32841
  }
32491
- const sources = sourceAvatarConfig(val, user, applications);
32842
+ const sources = sourceAvatarConfig(v, user, applications);
32492
32843
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32493
32844
  items: sources
32494
32845
  });
32495
32846
  }
32496
32847
  }, {
32497
- title: t("Status"),
32498
- dataIndex: "status",
32499
- key: "status",
32500
- show: activeTab === "own",
32501
- correctiveActions: activeTab === "own",
32502
- testimonials: activeTab === "own",
32503
- incident: activeTab === "own",
32504
- render: (value, all) => {
32848
+ id: 'actions',
32849
+ title: "",
32850
+ width: 60,
32851
+ render: (_, all) => {
32505
32852
  if (all.empty) {
32506
32853
  return /*#__PURE__*/jsxRuntime.jsx("div", {
32507
32854
  className: "daf-default-cell"
32508
32855
  });
32509
32856
  }
32510
- if (activeTab !== "own") {
32511
- return all?.authorId?.name;
32857
+ const onClick = () => {
32858
+ let link = `/app/view/${subject}/${all.datastakeId}`;
32859
+ if (activeTab === "shared") {
32860
+ link += `?sourceId=${all?.authorId?.id}`;
32861
+ }
32862
+ goTo(getRedirectLink(link));
32863
+ };
32864
+ const moreMenuItems = [{
32865
+ label: t("Details"),
32866
+ value: "details",
32867
+ onClick: onClick
32868
+ }, {
32869
+ label: t("Summary"),
32870
+ value: "Summary",
32871
+ onClick: () => {
32872
+ let link = `/app/mine-summary/${all.datastakeId}`;
32873
+ if (activeTab === "shared") {
32874
+ link += `?sourceId=${all?.authorId?.id}`;
32875
+ }
32876
+ goTo(getRedirectLink(link));
32877
+ }
32878
+ // disabled: true,
32879
+ }];
32880
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32881
+ children: /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
32882
+ items: moreMenuItems
32883
+ })
32884
+ });
32885
+ }
32886
+ }].filter(column => column.show !== false);
32887
+
32888
+ const getFiltersConfig$2 = ({
32889
+ t
32890
+ }) => {
32891
+ return {
32892
+ timeframe: {
32893
+ type: "timeframe",
32894
+ label: "Timeframe",
32895
+ style: {
32896
+ flex: 1
32897
+ }
32512
32898
  }
32513
- const _val = all?.published || all?.status === "submitted" ? "submitted" : value;
32514
- return renderStatusTag({
32515
- value: _val,
32516
- t
32899
+ };
32900
+ };
32901
+ const getFilterOptions$2 = (options, t) => {
32902
+ const {
32903
+ timeframe = []
32904
+ } = options || {};
32905
+ const _default = {
32906
+ timeframe: timeframe
32907
+ };
32908
+ return _default;
32909
+ };
32910
+ const formConfig = {
32911
+ namespace: 'document',
32912
+ view: 'scoping',
32913
+ scope: 'create',
32914
+ formType: 'document'
32915
+ };
32916
+ const viewConfig = {
32917
+ title: "Documents",
32918
+ createTitle: "Create Document"
32919
+ };
32920
+
32921
+ const getColumns$3 = ({
32922
+ t,
32923
+ goTo,
32924
+ user,
32925
+ options,
32926
+ activeTab,
32927
+ getRedirectLink,
32928
+ theme,
32929
+ subject,
32930
+ applications
32931
+ }) => [{
32932
+ dataIndex: 'datastakeId',
32933
+ title: t('ID'),
32934
+ ellipsis: true,
32935
+ show: true,
32936
+ render: (v, all) => {
32937
+ if (all.empty) {
32938
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32939
+ className: "daf-default-cell"
32940
+ });
32941
+ }
32942
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32943
+ title: v,
32944
+ children: v
32945
+ });
32946
+ }
32947
+ }, {
32948
+ dataIndex: 'name',
32949
+ title: t('Title'),
32950
+ ellipsis: true,
32951
+ show: true,
32952
+ render: (v, all) => {
32953
+ if (all.empty) {
32954
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32955
+ className: "daf-default-cell"
32956
+ });
32957
+ }
32958
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32959
+ title: v,
32960
+ children: v
32961
+ });
32962
+ }
32963
+ }, {
32964
+ title: t("Date"),
32965
+ dataIndex: "date",
32966
+ key: "date",
32967
+ render: (date, all) => {
32968
+ if (all.empty) {
32969
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32970
+ className: "daf-default-cell"
32971
+ });
32972
+ }
32973
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32974
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32975
+ title: _date,
32976
+ children: _date
32517
32977
  });
32518
32978
  },
32519
32979
  ellipsis: true
32980
+ }, {
32981
+ title: t("Sources"),
32982
+ dataIndex: "sources",
32983
+ key: "sources",
32984
+ show: activeTab !== "own",
32985
+ render: (val, all) => {
32986
+ if (all.empty) {
32987
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32988
+ className: "daf-default-cell"
32989
+ });
32990
+ }
32991
+ if (!val || val?.length === 0) {
32992
+ return "-";
32993
+ }
32994
+ const sources = sourceAvatarConfig(val, user, applications);
32995
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32996
+ items: sources
32997
+ });
32998
+ }
32520
32999
  }, {
32521
33000
  title: t("Last Update"),
32522
33001
  dataIndex: "updatedAt",
@@ -32558,7 +33037,387 @@ const getColumns$7 = ({
32558
33037
  }
32559
33038
  }].filter(column => column.show !== false);
32560
33039
 
32561
- const EventsTable = ({
33040
+ const FILTER_REGISTRY = {
33041
+ stakeholders: {
33042
+ config: getFiltersConfig$a,
33043
+ options: getFilterOptions$a,
33044
+ formConfig: formConfig$8,
33045
+ viewConfig: viewConfig$8,
33046
+ columns: getColumns$a
33047
+ },
33048
+ workers: {
33049
+ config: getFiltersConfig$8,
33050
+ options: getFilterOptions$8,
33051
+ formConfig: formConfig$6,
33052
+ viewConfig: viewConfig$6,
33053
+ columns: getColumns$9
33054
+ },
33055
+ operators: {
33056
+ config: getFiltersConfig$9,
33057
+ options: getFilterOptions$9,
33058
+ formConfig: formConfig$7,
33059
+ viewConfig: viewConfig$7,
33060
+ columns: getColumns$b
33061
+ },
33062
+ events: {
33063
+ config: getFiltersConfig$7,
33064
+ options: getFilterOptions$7,
33065
+ formConfig: formConfig$5,
33066
+ viewConfig: viewConfig$5,
33067
+ columns: getColumns$8
33068
+ },
33069
+ activities: {
33070
+ config: getFiltersConfig$6,
33071
+ options: getFilterOptions$6,
33072
+ formConfig: formConfig$4,
33073
+ viewConfig: viewConfig$4,
33074
+ columns: getColumns$7
33075
+ },
33076
+ incidents: {
33077
+ config: getFiltersConfig$5,
33078
+ options: getFilterOptions$5,
33079
+ formConfig: formConfig$3,
33080
+ viewConfig: viewConfig$3,
33081
+ columns: getColumns$6
33082
+ },
33083
+ locations: {
33084
+ config: getFiltersConfig$4,
33085
+ options: getFilterOptions$4,
33086
+ formConfig: formConfig$2,
33087
+ viewConfig: viewConfig$2,
33088
+ columns: getColumns$5
33089
+ },
33090
+ 'production-sites': {
33091
+ config: getFiltersConfig$3,
33092
+ options: getFilterOptions$3,
33093
+ formConfig: formConfig$1,
33094
+ viewConfig: viewConfig$1,
33095
+ columns: getColumns$4
33096
+ },
33097
+ documents: {
33098
+ config: getFiltersConfig$2,
33099
+ options: getFilterOptions$2,
33100
+ formConfig: formConfig,
33101
+ viewConfig: viewConfig,
33102
+ columns: getColumns$3
33103
+ }
33104
+ };
33105
+ const DEFAULT_SUBJECT = 'stakeholders';
33106
+
33107
+ const getCheckboxConfig = ({
33108
+ subject
33109
+ }) => {
33110
+ return {
33111
+ name: 'Name',
33112
+ datastakeId: 'ID'
33113
+ };
33114
+ };
33115
+ const getSelectFiltersConfig = ({
33116
+ subject
33117
+ }) => {
33118
+ return {
33119
+ name: '',
33120
+ datastakeId: ''
33121
+ };
33122
+ };
33123
+ const getFiltersConfig$1 = ({
33124
+ t,
33125
+ subject
33126
+ }) => {
33127
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33128
+ return registry?.config({
33129
+ t
33130
+ });
33131
+ };
33132
+ const getFilterOptions$1 = ({
33133
+ t,
33134
+ subject,
33135
+ options
33136
+ }) => {
33137
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33138
+ return registry.options(options, t);
33139
+ };
33140
+ const getFormConfig = ({
33141
+ subject
33142
+ }) => {
33143
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33144
+ return registry?.formConfig;
33145
+ };
33146
+ const getViewConfig = ({
33147
+ subject
33148
+ }) => {
33149
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33150
+ return registry?.viewConfig;
33151
+ };
33152
+
33153
+ const getColumns$2 = ({
33154
+ t,
33155
+ goTo,
33156
+ user,
33157
+ options,
33158
+ activeTab,
33159
+ getRedirectLink,
33160
+ theme,
33161
+ subject,
33162
+ data,
33163
+ applications
33164
+ }) => {
33165
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33166
+ return registry?.columns({
33167
+ t,
33168
+ goTo,
33169
+ user,
33170
+ options,
33171
+ activeTab,
33172
+ getRedirectLink,
33173
+ theme,
33174
+ subject,
33175
+ data,
33176
+ applications
33177
+ });
33178
+ };
33179
+
33180
+ const useFetchData = ({
33181
+ location,
33182
+ getData,
33183
+ activeTab,
33184
+ extendingFilters,
33185
+ subject
33186
+ }) => {
33187
+ const {
33188
+ paginationQuery,
33189
+ searchParams,
33190
+ otherParams,
33191
+ sortBy,
33192
+ sortDir
33193
+ } = useGetQueryParams({
33194
+ location
33195
+ });
33196
+ React.useEffect(() => {
33197
+ const cleanSearchParams = Object.fromEntries(Object.entries(searchParams).filter(([_, value]) => value != null && value !== ''));
33198
+ const hasPagination = paginationQuery.skip != null || paginationQuery.take != null;
33199
+ if (!hasPagination) {
33200
+ return;
33201
+ }
33202
+ getData({
33203
+ ...extendingFilters,
33204
+ pagination: paginationQuery,
33205
+ ...(Object.keys(otherParams).length > 0 && otherParams),
33206
+ ...(Object.keys(cleanSearchParams).length > 0 && {
33207
+ search: cleanSearchParams
33208
+ }),
33209
+ tab: activeTab,
33210
+ sortBy: {
33211
+ [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
33212
+ }
33213
+ }, subject);
33214
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
33215
+ };
33216
+ const useTablePage = ({
33217
+ subject,
33218
+ location,
33219
+ getData,
33220
+ extendingFilters,
33221
+ options,
33222
+ t,
33223
+ goTo,
33224
+ user,
33225
+ getRedirectLink,
33226
+ theme,
33227
+ data,
33228
+ applications,
33229
+ subjectClear
33230
+ }) => {
33231
+ const [selectOptions, setSelectOptions] = React.useState();
33232
+ const [activeTab, setActiveTab] = React.useState("own");
33233
+ useFetchData({
33234
+ location,
33235
+ getData,
33236
+ activeTab,
33237
+ extendingFilters: extendingFilters,
33238
+ subject
33239
+ });
33240
+ const columns = React.useMemo(() => getColumns$2({
33241
+ t,
33242
+ goTo,
33243
+ user,
33244
+ options,
33245
+ activeTab,
33246
+ getRedirectLink,
33247
+ theme,
33248
+ subject,
33249
+ data,
33250
+ applications
33251
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns$2]);
33252
+ const selectFiltersConfig = React.useMemo(() => getFiltersConfig$1({
33253
+ t,
33254
+ subject
33255
+ }), [t, subject, getFiltersConfig$1]);
33256
+ React.useEffect(() => {
33257
+ setSelectOptions(prev => ({
33258
+ ...prev,
33259
+ ...getFilterOptions$1({
33260
+ t,
33261
+ subject,
33262
+ options
33263
+ })
33264
+ }));
33265
+ }, [options, t, subject, getFilterOptions$1]);
33266
+ const checkboxConfig = React.useMemo(() => getCheckboxConfig({
33267
+ subject
33268
+ }), [subject, getCheckboxConfig]);
33269
+ const _filtersConfig = React.useMemo(() => {
33270
+ return getSelectFiltersConfig({
33271
+ subject
33272
+ });
33273
+ }, [subject, getSelectFiltersConfig]);
33274
+ const formInfo = React.useMemo(() => getFormConfig({
33275
+ subject
33276
+ }), [subject, getFormConfig]);
33277
+ const viewConfig = React.useMemo(() => getViewConfig({
33278
+ subject
33279
+ }), [subject, getViewConfig]);
33280
+ const handleActiveTabChange = React.useCallback(value => {
33281
+ setActiveTab(value);
33282
+ }, []);
33283
+ React.useEffect(() => () => {
33284
+ if (subjectClear && typeof subjectClear === 'function') {
33285
+ subjectClear();
33286
+ }
33287
+ }, [subjectClear]);
33288
+ return {
33289
+ activeTab,
33290
+ selectOptions,
33291
+ columns,
33292
+ selectFiltersConfig,
33293
+ handleActiveTabChange,
33294
+ checkboxConfig,
33295
+ _filtersConfig,
33296
+ formInfo,
33297
+ viewConfig
33298
+ };
33299
+ };
33300
+
33301
+ const TablePage = ({
33302
+ t = () => {},
33303
+ goTo = () => {},
33304
+ user = {},
33305
+ options = {},
33306
+ getRedirectLink = () => {},
33307
+ theme = {},
33308
+ loading = false,
33309
+ data = {},
33310
+ isMobile,
33311
+ APP,
33312
+ location,
33313
+ formConfig = {
33314
+ getFormData: () => {},
33315
+ saveFormData: () => {},
33316
+ formLoading: false,
33317
+ query: {},
33318
+ ajaxForms: {},
33319
+ changeAjaxForms: () => {},
33320
+ ajaxOptions: {},
33321
+ changeAjaxOptions: () => {},
33322
+ formData: {},
33323
+ formValue: {},
33324
+ form: {}
33325
+ },
33326
+ defaultValues = {},
33327
+ extendingFilters = {},
33328
+ getData = () => {},
33329
+ getApiBaseUrl = () => {},
33330
+ getAppHeader = () => {},
33331
+ applications = [],
33332
+ subjectClear,
33333
+ subject,
33334
+ breadcrumbs = [],
33335
+ onDownload
33336
+ }) => {
33337
+ const {
33338
+ activeTab,
33339
+ selectOptions,
33340
+ columns,
33341
+ selectFiltersConfig,
33342
+ handleActiveTabChange,
33343
+ checkboxConfig,
33344
+ _filtersConfig,
33345
+ formInfo,
33346
+ viewConfig
33347
+ } = useTablePage({
33348
+ subject,
33349
+ location,
33350
+ getData,
33351
+ extendingFilters,
33352
+ options,
33353
+ t,
33354
+ goTo,
33355
+ user,
33356
+ getRedirectLink,
33357
+ theme,
33358
+ data,
33359
+ applications,
33360
+ subjectClear
33361
+ });
33362
+ return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
33363
+ t: t,
33364
+ title: t(viewConfig?.title || ""),
33365
+ breadCrumbs: breadcrumbs,
33366
+ location: location,
33367
+ loading: loading,
33368
+ goTo: goTo,
33369
+ defaultActiveTab: "own",
33370
+ columns: columns,
33371
+ data: data,
33372
+ checkboxConfig: checkboxConfig,
33373
+ APP: APP,
33374
+ getApiBaseUrl: getApiBaseUrl,
33375
+ selectOptions: selectOptions,
33376
+ selectFiltersConfig: selectFiltersConfig,
33377
+ getRedirectLink: getRedirectLink,
33378
+ filtersConfig: _filtersConfig,
33379
+ isMobile: isMobile,
33380
+ view: subject,
33381
+ getActiveTab: handleActiveTabChange,
33382
+ onDownload: onDownload && typeof onDownload === 'function' ? onDownload : undefined,
33383
+ drawerTitle: t(viewConfig?.createTitle || ""),
33384
+ children: ({
33385
+ onDrawerClose
33386
+ }) => /*#__PURE__*/jsxRuntime.jsx(Create$1, {
33387
+ t: t,
33388
+ goTo: goTo,
33389
+ user: user,
33390
+ APP: APP,
33391
+ getApiBaseUrl: getApiBaseUrl,
33392
+ getAppHeader: getAppHeader,
33393
+ getData: formConfig.getFormData,
33394
+ saveData: formConfig.saveFormData,
33395
+ loading: formConfig.formLoading,
33396
+ onSubmitted: (type, m, data) => {
33397
+ if (data.datastakeId) {
33398
+ displayMessage(type, t("affirmations::subject-created-successfully") || m);
33399
+ goTo(`/app/edit/${subject}/${data.datastakeId}`);
33400
+ }
33401
+ },
33402
+ onCancel: onDrawerClose,
33403
+ query: formConfig.query,
33404
+ ajaxForms: formConfig.ajaxForms,
33405
+ changeAjaxForms: formConfig.changeAjaxForms,
33406
+ ajaxOptions: formConfig.ajaxOptions,
33407
+ changeAjaxOptions: formConfig.changeAjaxOptions,
33408
+ formData: formConfig.formData,
33409
+ formValue: formConfig.formValue,
33410
+ form: formConfig.form,
33411
+ namespace: formInfo.namespace,
33412
+ view: formInfo.view,
33413
+ scope: formInfo.scope,
33414
+ formType: formInfo.formType,
33415
+ defaultData: defaultValues
33416
+ })
33417
+ });
33418
+ };
33419
+
33420
+ const OperatorsTable = ({
32562
33421
  t = () => {},
32563
33422
  goTo = () => {},
32564
33423
  user = {},
@@ -32585,9 +33444,77 @@ const EventsTable = ({
32585
33444
  formValue = {},
32586
33445
  form = {},
32587
33446
  extendingFilters = {},
33447
+ createDefaultValues = {},
33448
+ applications = [],
33449
+ breadcrumbs = []
33450
+ }) => {
33451
+ return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
33452
+ t: t,
33453
+ goTo: goTo,
33454
+ user: user,
33455
+ options: options,
33456
+ getRedirectLink: getRedirectLink,
33457
+ theme: theme,
33458
+ loading: loading,
33459
+ data: data,
33460
+ isMobile: isMobile,
33461
+ APP: APP,
33462
+ location: location,
33463
+ applications: applications,
33464
+ subject: "operators",
33465
+ getData: getData,
33466
+ getApiBaseUrl: getApiBaseUrl,
33467
+ getAppHeader: getAppHeader,
33468
+ breadcrumbs: breadcrumbs,
33469
+ extendingFilters: extendingFilters,
33470
+ formConfig: {
33471
+ getFormData,
33472
+ saveFormData,
33473
+ formLoading,
33474
+ query,
33475
+ ajaxForms,
33476
+ changeAjaxForms,
33477
+ ajaxOptions,
33478
+ changeAjaxOptions,
33479
+ formData,
33480
+ formValue,
33481
+ form
33482
+ },
33483
+ defaultValues: createDefaultValues,
33484
+ onDownload: () => console.log("download")
33485
+ });
33486
+ };
33487
+
33488
+ const LocationsTable = ({
33489
+ t = () => {},
33490
+ goTo = () => {},
33491
+ user = {},
33492
+ options = {},
33493
+ getRedirectLink = () => {},
33494
+ theme = {},
33495
+ loading = false,
33496
+ data = {},
33497
+ isMobile,
33498
+ APP,
33499
+ location,
33500
+ getData = () => {},
33501
+ getApiBaseUrl = () => {},
33502
+ getAppHeader = () => {},
33503
+ getFormData = () => {},
33504
+ saveFormData = () => {},
33505
+ formLoading = false,
33506
+ query = {},
33507
+ ajaxForms = {},
33508
+ changeAjaxForms = () => {},
33509
+ ajaxOptions = {},
33510
+ changeAjaxOptions = () => {},
33511
+ formData = {},
33512
+ formValue = {},
33513
+ form = {},
32588
33514
  applications = [],
32589
33515
  subjectClear = () => {},
32590
33516
  breadcrumbs = [],
33517
+ extendingFilters = {},
32591
33518
  createDefaultValues = {}
32592
33519
  }) => {
32593
33520
  return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
@@ -32603,17 +33530,12 @@ const EventsTable = ({
32603
33530
  APP: APP,
32604
33531
  location: location,
32605
33532
  applications: applications,
32606
- subject: "events",
33533
+ subject: "locations",
32607
33534
  getData: getData,
32608
33535
  getApiBaseUrl: getApiBaseUrl,
32609
33536
  getAppHeader: getAppHeader,
32610
33537
  subjectClear: subjectClear,
32611
- getColumns: getColumns$7,
32612
- viewConfig: {
32613
- title: "Events",
32614
- breadcrumbs: breadcrumbs,
32615
- createTitle: "Create Event"
32616
- },
33538
+ breadcrumbs: breadcrumbs,
32617
33539
  extendingFilters: extendingFilters,
32618
33540
  formConfig: {
32619
33541
  getFormData,
@@ -32626,137 +33548,14 @@ const EventsTable = ({
32626
33548
  changeAjaxOptions,
32627
33549
  formData,
32628
33550
  formValue,
32629
- form,
32630
- namespace: "event",
32631
- view: 'scoping',
32632
- scope: 'create',
32633
- formType: 'event',
32634
- defaultValues: createDefaultValues
33551
+ form
32635
33552
  },
33553
+ defaultValues: createDefaultValues,
32636
33554
  onDownload: () => console.log("download")
32637
33555
  });
32638
33556
  };
32639
33557
 
32640
- const getColumns$6 = ({
32641
- t,
32642
- goTo,
32643
- user,
32644
- options,
32645
- activeTab,
32646
- getRedirectLink,
32647
- theme,
32648
- subject,
32649
- applications
32650
- }) => [{
32651
- dataIndex: 'datastakeId',
32652
- title: t('ID'),
32653
- ellipsis: true,
32654
- show: true,
32655
- render: (v, all) => {
32656
- if (all.empty) {
32657
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32658
- className: "daf-default-cell"
32659
- });
32660
- }
32661
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32662
- title: v,
32663
- children: v
32664
- });
32665
- }
32666
- }, {
32667
- dataIndex: 'name',
32668
- title: t('Title'),
32669
- ellipsis: true,
32670
- show: true,
32671
- render: (v, all) => {
32672
- if (all.empty) {
32673
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32674
- className: "daf-default-cell"
32675
- });
32676
- }
32677
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32678
- title: v,
32679
- children: v
32680
- });
32681
- }
32682
- }, {
32683
- title: t("Date"),
32684
- dataIndex: "date",
32685
- key: "date",
32686
- render: (date, all) => {
32687
- if (all.empty) {
32688
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32689
- className: "daf-default-cell"
32690
- });
32691
- }
32692
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32693
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32694
- title: _date,
32695
- children: _date
32696
- });
32697
- },
32698
- ellipsis: true
32699
- }, {
32700
- title: t("Sources"),
32701
- dataIndex: "sources",
32702
- key: "sources",
32703
- show: activeTab !== "own",
32704
- render: (val, all) => {
32705
- if (all.empty) {
32706
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32707
- className: "daf-default-cell"
32708
- });
32709
- }
32710
- if (!val || val?.length === 0) {
32711
- return "-";
32712
- }
32713
- const sources = sourceAvatarConfig(val, user, applications);
32714
- return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32715
- items: sources
32716
- });
32717
- }
32718
- }, {
32719
- title: t("Last Update"),
32720
- dataIndex: "updatedAt",
32721
- key: "updatedAt",
32722
- render: (date, all) => {
32723
- if (all.empty) {
32724
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32725
- className: "daf-default-cell"
32726
- });
32727
- }
32728
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32729
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32730
- title: _date,
32731
- children: _date
32732
- });
32733
- },
32734
- ellipsis: true
32735
- }, {
32736
- id: 'actions',
32737
- title: "",
32738
- width: 60,
32739
- render: (_, all) => {
32740
- if (all.empty) {
32741
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32742
- className: "daf-default-cell"
32743
- });
32744
- }
32745
- const onClick = () => {
32746
- let link = `/app/view/${subject}/${all.datastakeId}`;
32747
- if (activeTab === "shared") {
32748
- link += `?sourceId=${all?.authorId?.id}`;
32749
- }
32750
- goTo(getRedirectLink(link));
32751
- };
32752
- return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
32753
- onClick: onClick,
32754
- theme: theme
32755
- });
32756
- }
32757
- }].filter(column => column.show !== false);
32758
-
32759
- const DocumentsTable = ({
33558
+ const StakeholdersTable = ({
32760
33559
  t = () => {},
32761
33560
  goTo = () => {},
32762
33561
  user = {},
@@ -32801,17 +33600,13 @@ const DocumentsTable = ({
32801
33600
  APP: APP,
32802
33601
  location: location,
32803
33602
  applications: applications,
32804
- subject: "documents",
33603
+ subject: "stakeholders",
32805
33604
  getData: getData,
32806
33605
  getApiBaseUrl: getApiBaseUrl,
32807
33606
  getAppHeader: getAppHeader,
32808
33607
  subjectClear: subjectClear,
32809
- getColumns: getColumns$6,
32810
- viewConfig: {
32811
- title: "Documents",
32812
- breadcrumbs: breadcrumbs,
32813
- createTitle: "Create Document"
32814
- },
33608
+ breadcrumbs: breadcrumbs,
33609
+ extendingFilters: extendingFilters,
32815
33610
  formConfig: {
32816
33611
  getFormData,
32817
33612
  saveFormData,
@@ -32823,184 +33618,152 @@ const DocumentsTable = ({
32823
33618
  changeAjaxOptions,
32824
33619
  formData,
32825
33620
  formValue,
32826
- form,
32827
- namespace: 'document',
32828
- view: 'scoping',
32829
- scope: 'create',
32830
- formType: 'document',
32831
- defaultValues: createDefaultValues
33621
+ form
32832
33622
  },
33623
+ defaultValues: createDefaultValues,
32833
33624
  onDownload: () => console.log("download")
32834
33625
  });
32835
33626
  };
32836
33627
 
32837
- const getColumns$5 = ({
32838
- t,
32839
- goTo,
32840
- user,
32841
- options,
32842
- activeTab,
32843
- getRedirectLink,
32844
- theme,
32845
- subject,
32846
- data,
32847
- applications
32848
- }) => [
32849
- // {
32850
- // dataIndex: 'datastakeId',
32851
- // title: t('ID'),
32852
- // ellipsis: true,
32853
- // show: true,
32854
- // render: (v, all) => {
32855
- // if (all.empty) {
32856
- // return <div className="daf-default-cell" />
32857
- // }
32858
-
32859
- // return <Tooltip title={v}>{v}</Tooltip>;
32860
- // },
32861
- // },
32862
- {
32863
- dataIndex: 'name',
32864
- title: t('Name'),
32865
- ellipsis: true,
32866
- show: true,
32867
- render: (v, all) => {
32868
- if (all.empty) {
32869
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32870
- className: "daf-default-cell"
32871
- });
32872
- }
32873
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32874
- title: v,
32875
- children: v
32876
- });
32877
- }
32878
- }, {
32879
- dataIndex: 'mineSite',
32880
- title: t('Position'),
32881
- ellipsis: true,
32882
- show: true,
32883
- render: (v, all) => {
32884
- if (all.empty) {
32885
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32886
- className: "daf-default-cell"
32887
- });
32888
- }
32889
-
32890
- // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
32891
- const mineSite = all?.location?.name;
32892
- return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32893
- title: mineSite,
32894
- children: mineSite
32895
- }) : '-';
32896
- }
32897
- }, {
32898
- dataIndex: 'activity',
32899
- title: t('Activity'),
32900
- ellipsis: true,
32901
- show: true,
32902
- render: (v, all) => {
32903
- if (all.empty) {
32904
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32905
- className: "daf-default-cell"
32906
- });
32907
- }
32908
- const activity = findOptions(v, data?.options?.activityAtSiteOptions);
32909
- return activity ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32910
- title: activity,
32911
- children: activity
32912
- }) : '-';
32913
- }
32914
- }, {
32915
- dataIndex: 'origin',
32916
- title: t('Origin'),
32917
- ellipsis: true,
32918
- show: true,
32919
- render: (v, all) => {
32920
- if (all.empty) {
32921
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32922
- className: "daf-default-cell"
32923
- });
32924
- }
32925
- const origin = all?.placeOfBirth?.name;
32926
- return origin ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32927
- title: origin,
32928
- children: origin
32929
- }) : '-';
32930
- }
32931
- }, {
32932
- title: t("Census Update"),
32933
- dataIndex: "createdAt",
32934
- key: "createdAt",
32935
- render: (date, all) => {
32936
- if (all.empty) {
32937
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32938
- className: "daf-default-cell"
32939
- });
32940
- }
32941
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32942
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32943
- title: _date,
32944
- children: _date
32945
- });
32946
- },
32947
- ellipsis: true
32948
- }, {
32949
- title: t("Sources"),
32950
- dataIndex: "sources",
32951
- key: "sources",
32952
- show: activeTab !== "own",
32953
- render: (val, all) => {
32954
- if (all.empty) {
32955
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32956
- className: "daf-default-cell"
32957
- });
32958
- }
32959
- const sources = sourceAvatarConfig(val, user, applications);
32960
- return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32961
- items: sources
32962
- });
32963
- }
32964
- }, {
32965
- title: t("Status"),
32966
- dataIndex: "status",
32967
- key: "status",
32968
- show: activeTab === "own",
32969
- render: (val, all) => {
32970
- if (all.empty) {
32971
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32972
- className: "daf-default-cell"
32973
- });
32974
- }
32975
- const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
32976
- return renderStatusTag({
32977
- value: _val,
32978
- t
32979
- });
32980
- }
32981
- }, {
32982
- id: 'actions',
32983
- title: "",
32984
- width: 60,
32985
- render: (_, all) => {
32986
- if (all.empty) {
32987
- return /*#__PURE__*/jsxRuntime.jsx("div", {
32988
- className: "daf-default-cell"
32989
- });
32990
- }
32991
- const onClick = () => {
32992
- let link = `/app/view/${subject}/${all.datastakeId}`;
32993
- if (activeTab === "shared") {
32994
- link += `?sourceId=${all?.authorId?.id}`;
32995
- }
32996
- goTo(getRedirectLink(link));
32997
- };
32998
- return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
32999
- onClick: onClick,
33000
- theme: theme
33001
- });
33002
- }
33003
- }].filter(column => column.show !== false);
33628
+ const EventsTable = ({
33629
+ t = () => {},
33630
+ goTo = () => {},
33631
+ user = {},
33632
+ options = {},
33633
+ getRedirectLink = () => {},
33634
+ theme = {},
33635
+ loading = false,
33636
+ data = {},
33637
+ isMobile,
33638
+ APP,
33639
+ location,
33640
+ getData = () => {},
33641
+ getApiBaseUrl = () => {},
33642
+ getAppHeader = () => {},
33643
+ getFormData = () => {},
33644
+ saveFormData = () => {},
33645
+ formLoading = false,
33646
+ query = {},
33647
+ ajaxForms = {},
33648
+ changeAjaxForms = () => {},
33649
+ ajaxOptions = {},
33650
+ changeAjaxOptions = () => {},
33651
+ formData = {},
33652
+ formValue = {},
33653
+ form = {},
33654
+ extendingFilters = {},
33655
+ applications = [],
33656
+ subjectClear = () => {},
33657
+ breadcrumbs = [],
33658
+ createDefaultValues = {}
33659
+ }) => {
33660
+ return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
33661
+ t: t,
33662
+ goTo: goTo,
33663
+ user: user,
33664
+ options: options,
33665
+ getRedirectLink: getRedirectLink,
33666
+ theme: theme,
33667
+ loading: loading,
33668
+ data: data,
33669
+ isMobile: isMobile,
33670
+ APP: APP,
33671
+ location: location,
33672
+ applications: applications,
33673
+ subject: "events",
33674
+ getData: getData,
33675
+ getApiBaseUrl: getApiBaseUrl,
33676
+ getAppHeader: getAppHeader,
33677
+ subjectClear: subjectClear,
33678
+ breadcrumbs: breadcrumbs,
33679
+ extendingFilters: extendingFilters,
33680
+ formConfig: {
33681
+ getFormData,
33682
+ saveFormData,
33683
+ formLoading,
33684
+ query,
33685
+ ajaxForms,
33686
+ changeAjaxForms,
33687
+ ajaxOptions,
33688
+ changeAjaxOptions,
33689
+ formData,
33690
+ formValue,
33691
+ form
33692
+ },
33693
+ defaultValues: createDefaultValues,
33694
+ onDownload: () => console.log("download")
33695
+ });
33696
+ };
33697
+
33698
+ const DocumentsTable = ({
33699
+ t = () => {},
33700
+ goTo = () => {},
33701
+ user = {},
33702
+ options = {},
33703
+ getRedirectLink = () => {},
33704
+ theme = {},
33705
+ loading = false,
33706
+ data = {},
33707
+ isMobile,
33708
+ APP,
33709
+ location,
33710
+ getData = () => {},
33711
+ getApiBaseUrl = () => {},
33712
+ getAppHeader = () => {},
33713
+ getFormData = () => {},
33714
+ saveFormData = () => {},
33715
+ formLoading = false,
33716
+ query = {},
33717
+ ajaxForms = {},
33718
+ changeAjaxForms = () => {},
33719
+ ajaxOptions = {},
33720
+ changeAjaxOptions = () => {},
33721
+ formData = {},
33722
+ formValue = {},
33723
+ form = {},
33724
+ applications = [],
33725
+ subjectClear = () => {},
33726
+ breadcrumbs = [],
33727
+ extendingFilters = {},
33728
+ createDefaultValues = {}
33729
+ }) => {
33730
+ return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
33731
+ t: t,
33732
+ goTo: goTo,
33733
+ user: user,
33734
+ options: options,
33735
+ getRedirectLink: getRedirectLink,
33736
+ theme: theme,
33737
+ loading: loading,
33738
+ data: data,
33739
+ isMobile: isMobile,
33740
+ APP: APP,
33741
+ location: location,
33742
+ applications: applications,
33743
+ subject: "documents",
33744
+ getData: getData,
33745
+ getApiBaseUrl: getApiBaseUrl,
33746
+ getAppHeader: getAppHeader,
33747
+ subjectClear: subjectClear,
33748
+ extendingFilters: extendingFilters,
33749
+ breadcrumbs: breadcrumbs,
33750
+ formConfig: {
33751
+ getFormData,
33752
+ saveFormData,
33753
+ formLoading,
33754
+ query,
33755
+ ajaxForms,
33756
+ changeAjaxForms,
33757
+ ajaxOptions,
33758
+ changeAjaxOptions,
33759
+ formData,
33760
+ formValue,
33761
+ form
33762
+ },
33763
+ defaultValues: createDefaultValues,
33764
+ onDownload: () => console.log("download")
33765
+ });
33766
+ };
33004
33767
 
33005
33768
  const WorkersTable = ({
33006
33769
  t = () => {},
@@ -33050,12 +33813,8 @@ const WorkersTable = ({
33050
33813
  getData: getData,
33051
33814
  getApiBaseUrl: getApiBaseUrl,
33052
33815
  getAppHeader: getAppHeader,
33053
- getColumns: getColumns$5,
33054
- viewConfig: {
33055
- title: "Workers",
33056
- breadcrumbs: breadcrumbs,
33057
- createTitle: "Create Worker"
33058
- },
33816
+ getColumns: getColumns$9,
33817
+ breadcrumbs: breadcrumbs,
33059
33818
  extendingFilters: extendingFilters,
33060
33819
  formConfig: {
33061
33820
  getFormData,
@@ -33068,231 +33827,13 @@ const WorkersTable = ({
33068
33827
  changeAjaxOptions,
33069
33828
  formData,
33070
33829
  formValue,
33071
- form,
33072
- namespace: "WORKERS",
33073
- view: ['scoping', 'new'],
33074
- scope: 'global',
33075
- formType: 'worker',
33076
- defaultValues: createDefaultValues
33830
+ form
33077
33831
  },
33832
+ defaultValues: createDefaultValues,
33078
33833
  onDownload: () => console.log("download")
33079
33834
  });
33080
33835
  };
33081
33836
 
33082
- const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = false) => {
33083
- if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
33084
- return null;
33085
- }
33086
- const subjectSingular = isSingular ? subject : subject.endsWith('ies') ? subject.slice(0, -3) + 'y' : subject.endsWith('s') ? subject.slice(0, -1) : subject;
33087
- const key = `typeOfEvent is ${subjectSingular}`;
33088
- return eventCategoryObject[key] || null;
33089
- };
33090
-
33091
- const getColumns$4 = ({
33092
- t,
33093
- goTo,
33094
- user,
33095
- options,
33096
- activeTab,
33097
- getRedirectLink,
33098
- theme,
33099
- subject,
33100
- data,
33101
- applications
33102
- }) => [{
33103
- dataIndex: 'datastakeId',
33104
- title: t('ID'),
33105
- ellipsis: true,
33106
- show: true,
33107
- render: (v, all) => {
33108
- if (all.empty) {
33109
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33110
- className: "daf-default-cell"
33111
- });
33112
- }
33113
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33114
- title: v,
33115
- children: v
33116
- });
33117
- }
33118
- }, {
33119
- dataIndex: 'name',
33120
- title: t('Title'),
33121
- ellipsis: true,
33122
- show: true,
33123
- render: (v, all) => {
33124
- if (all.empty) {
33125
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33126
- className: "daf-default-cell"
33127
- });
33128
- }
33129
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33130
- title: v,
33131
- children: v
33132
- });
33133
- }
33134
- }, {
33135
- title: t("Date"),
33136
- dataIndex: "date",
33137
- key: "date",
33138
- render: (date, all) => {
33139
- if (all.empty) {
33140
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33141
- className: "daf-default-cell"
33142
- });
33143
- }
33144
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
33145
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33146
- title: _date,
33147
- children: _date
33148
- });
33149
- },
33150
- ellipsis: true
33151
- }, {
33152
- dataIndex: 'mineSite',
33153
- title: t('Location'),
33154
- ellipsis: true,
33155
- show: true,
33156
- render: (v, all) => {
33157
- if (all.empty) {
33158
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33159
- className: "daf-default-cell"
33160
- });
33161
- }
33162
-
33163
- // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
33164
- const mineSite = all?.location?.name;
33165
- return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33166
- title: mineSite,
33167
- children: mineSite
33168
- }) : '-';
33169
- }
33170
- }, {
33171
- dataIndex: 'province',
33172
- title: t('Province'),
33173
- ellipsis: true,
33174
- show: true,
33175
- render: (v, all) => {
33176
- if (all.empty) {
33177
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33178
- className: "daf-default-cell"
33179
- });
33180
- }
33181
- const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
33182
- return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33183
- title: region,
33184
- children: region
33185
- }) : '-';
33186
- }
33187
- }, {
33188
- dataIndex: 'territory',
33189
- title: t('Territory'),
33190
- ellipsis: true,
33191
- show: true,
33192
- render: (v, all) => {
33193
- if (all.empty) {
33194
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33195
- className: "daf-default-cell"
33196
- });
33197
- }
33198
- const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
33199
- return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33200
- title: district,
33201
- children: district
33202
- }) : '-';
33203
- }
33204
- }, {
33205
- dataIndex: 'eventCategory',
33206
- title: t('Category'),
33207
- ellipsis: true,
33208
- show: true,
33209
- render: (v, all) => {
33210
- if (all.empty) {
33211
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33212
- className: "daf-default-cell"
33213
- });
33214
- }
33215
- const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
33216
- const categoryValue = getEventCategoryBySubject(eventCategory, "correctiveActions", true);
33217
- return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33218
- title: categoryValue,
33219
- children: categoryValue
33220
- }) : '-';
33221
- }
33222
- }, {
33223
- title: t("Sources"),
33224
- dataIndex: "sources",
33225
- key: "sources",
33226
- show: activeTab !== "own",
33227
- render: (val, all) => {
33228
- if (all.empty) {
33229
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33230
- className: "daf-default-cell"
33231
- });
33232
- }
33233
- const sources = sourceAvatarConfig(val, user, applications);
33234
- return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
33235
- items: sources
33236
- });
33237
- }
33238
- }, {
33239
- title: t("Status"),
33240
- dataIndex: "status",
33241
- key: "status",
33242
- show: activeTab === "own",
33243
- render: (val, all) => {
33244
- if (all.empty) {
33245
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33246
- className: "daf-default-cell"
33247
- });
33248
- }
33249
- const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
33250
- return renderStatusTag({
33251
- value: _val,
33252
- t
33253
- });
33254
- }
33255
- }, {
33256
- title: t("Last Update"),
33257
- dataIndex: "updatedAt",
33258
- key: "updatedAt",
33259
- render: (date, all) => {
33260
- if (all.empty) {
33261
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33262
- className: "daf-default-cell"
33263
- });
33264
- }
33265
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
33266
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33267
- title: _date,
33268
- children: _date
33269
- });
33270
- },
33271
- ellipsis: true
33272
- }, {
33273
- id: 'actions',
33274
- title: "",
33275
- width: 60,
33276
- render: (_, all) => {
33277
- if (all.empty) {
33278
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33279
- className: "daf-default-cell"
33280
- });
33281
- }
33282
- const onClick = () => {
33283
- let link = `/app/view/${subject}/${all.datastakeId}`;
33284
- if (activeTab === "shared") {
33285
- link += `?sourceId=${all?.authorId?.id}`;
33286
- }
33287
- goTo(getRedirectLink(link));
33288
- };
33289
- return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
33290
- onClick: onClick,
33291
- theme: theme
33292
- });
33293
- }
33294
- }].filter(column => column.show !== false);
33295
-
33296
33837
  const ActivitiesTable = ({
33297
33838
  t = () => {},
33298
33839
  goTo = () => {},
@@ -33341,12 +33882,7 @@ const ActivitiesTable = ({
33341
33882
  getData: getData,
33342
33883
  getApiBaseUrl: getApiBaseUrl,
33343
33884
  getAppHeader: getAppHeader,
33344
- getColumns: getColumns$4,
33345
- viewConfig: {
33346
- title: "Activities",
33347
- breadcrumbs: breadcrumbs,
33348
- createTitle: "Create Activity"
33349
- },
33885
+ breadcrumbs: breadcrumbs,
33350
33886
  extendingFilters: extendingFilters,
33351
33887
  formConfig: {
33352
33888
  getFormData,
@@ -33359,222 +33895,13 @@ const ActivitiesTable = ({
33359
33895
  changeAjaxOptions,
33360
33896
  formData,
33361
33897
  formValue,
33362
- form,
33363
- namespace: "corrective-actions",
33364
- view: 'corrective-actions',
33365
- scope: 'createActivity',
33366
- formType: 'activity',
33367
- defaultValues: createDefaultValues
33898
+ form
33368
33899
  },
33900
+ defaultValues: createDefaultValues,
33369
33901
  onDownload: () => console.log("download")
33370
33902
  });
33371
33903
  };
33372
33904
 
33373
- const getColumns$3 = ({
33374
- t,
33375
- goTo,
33376
- user,
33377
- options,
33378
- activeTab,
33379
- getRedirectLink,
33380
- theme,
33381
- subject,
33382
- data,
33383
- applications
33384
- }) => [{
33385
- dataIndex: 'datastakeId',
33386
- title: t('ID'),
33387
- ellipsis: true,
33388
- show: true,
33389
- render: (v, all) => {
33390
- if (all.empty) {
33391
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33392
- className: "daf-default-cell"
33393
- });
33394
- }
33395
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33396
- title: v,
33397
- children: v
33398
- });
33399
- }
33400
- }, {
33401
- dataIndex: 'name',
33402
- title: t('Title'),
33403
- ellipsis: true,
33404
- show: true,
33405
- render: (v, all) => {
33406
- if (all.empty) {
33407
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33408
- className: "daf-default-cell"
33409
- });
33410
- }
33411
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33412
- title: v,
33413
- children: v
33414
- });
33415
- }
33416
- }, {
33417
- title: t("Date"),
33418
- dataIndex: "date",
33419
- key: "date",
33420
- render: (date, all) => {
33421
- if (all.empty) {
33422
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33423
- className: "daf-default-cell"
33424
- });
33425
- }
33426
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
33427
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33428
- title: _date,
33429
- children: _date
33430
- });
33431
- },
33432
- ellipsis: true
33433
- }, {
33434
- dataIndex: 'mineSite',
33435
- title: t('Location'),
33436
- ellipsis: true,
33437
- show: true,
33438
- render: (v, all) => {
33439
- if (all.empty) {
33440
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33441
- className: "daf-default-cell"
33442
- });
33443
- }
33444
-
33445
- // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
33446
- const mineSite = all?.location?.name;
33447
- return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33448
- title: mineSite,
33449
- children: mineSite
33450
- }) : '-';
33451
- }
33452
- }, {
33453
- dataIndex: 'province',
33454
- title: t('Province'),
33455
- ellipsis: true,
33456
- show: true,
33457
- render: (v, all) => {
33458
- if (all.empty) {
33459
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33460
- className: "daf-default-cell"
33461
- });
33462
- }
33463
- const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
33464
- return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33465
- title: region,
33466
- children: region
33467
- }) : '-';
33468
- }
33469
- }, {
33470
- dataIndex: 'territory',
33471
- title: t('Territory'),
33472
- ellipsis: true,
33473
- show: true,
33474
- render: (v, all) => {
33475
- if (all.empty) {
33476
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33477
- className: "daf-default-cell"
33478
- });
33479
- }
33480
- const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
33481
- return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33482
- title: district,
33483
- children: district
33484
- }) : '-';
33485
- }
33486
- }, {
33487
- dataIndex: 'eventCategory',
33488
- title: t('Category'),
33489
- ellipsis: true,
33490
- show: true,
33491
- render: (v, all) => {
33492
- if (all.empty) {
33493
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33494
- className: "daf-default-cell"
33495
- });
33496
- }
33497
- const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
33498
- const categoryValue = getEventCategoryBySubject(eventCategory, subject);
33499
- return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33500
- title: categoryValue,
33501
- children: categoryValue
33502
- }) : '-';
33503
- }
33504
- }, {
33505
- title: t("Sources"),
33506
- dataIndex: "sources",
33507
- key: "sources",
33508
- show: activeTab !== "own",
33509
- render: (val, all) => {
33510
- if (all.empty) {
33511
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33512
- className: "daf-default-cell"
33513
- });
33514
- }
33515
- const sources = sourceAvatarConfig(val, user, applications);
33516
- return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
33517
- items: sources
33518
- });
33519
- }
33520
- }, {
33521
- title: t("Status"),
33522
- dataIndex: "status",
33523
- key: "status",
33524
- show: activeTab === "own",
33525
- render: (val, all) => {
33526
- if (all.empty) {
33527
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33528
- className: "daf-default-cell"
33529
- });
33530
- }
33531
- const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
33532
- return renderStatusTag({
33533
- value: _val,
33534
- t
33535
- });
33536
- }
33537
- }, {
33538
- title: t("Last Update"),
33539
- dataIndex: "updatedAt",
33540
- key: "updatedAt",
33541
- render: (date, all) => {
33542
- if (all.empty) {
33543
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33544
- className: "daf-default-cell"
33545
- });
33546
- }
33547
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
33548
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33549
- title: _date,
33550
- children: _date
33551
- });
33552
- },
33553
- ellipsis: true
33554
- }, {
33555
- id: 'actions',
33556
- title: "",
33557
- width: 60,
33558
- render: (_, all) => {
33559
- if (all.empty) {
33560
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33561
- className: "daf-default-cell"
33562
- });
33563
- }
33564
- const onClick = () => {
33565
- let link = `/app/view/${subject}/${all.datastakeId}`;
33566
- if (activeTab === "shared") {
33567
- link += `?sourceId=${all?.authorId?.id}`;
33568
- }
33569
- goTo(getRedirectLink(link));
33570
- };
33571
- return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
33572
- onClick: onClick,
33573
- theme: theme
33574
- });
33575
- }
33576
- }].filter(column => column.show !== false);
33577
-
33578
33905
  const IncidentsTable = ({
33579
33906
  t = () => {},
33580
33907
  goTo = () => {},
@@ -33623,12 +33950,7 @@ const IncidentsTable = ({
33623
33950
  getData: getData,
33624
33951
  getApiBaseUrl: getApiBaseUrl,
33625
33952
  getAppHeader: getAppHeader,
33626
- getColumns: getColumns$3,
33627
- viewConfig: {
33628
- title: "Incidents",
33629
- breadcrumbs: breadcrumbs,
33630
- createTitle: "Create Incident"
33631
- },
33953
+ breadcrumbs: breadcrumbs,
33632
33954
  extendingFilters: extendingFilters,
33633
33955
  formConfig: {
33634
33956
  getFormData,
@@ -33641,256 +33963,13 @@ const IncidentsTable = ({
33641
33963
  changeAjaxOptions,
33642
33964
  formData,
33643
33965
  formValue,
33644
- form,
33645
- namespace: "incident",
33646
- view: 'incident',
33647
- scope: 'createIncident',
33648
- formType: 'incident',
33649
- defaultValues: createDefaultValues
33966
+ form
33650
33967
  },
33968
+ defaultValues: createDefaultValues,
33651
33969
  onDownload: () => console.log("download")
33652
33970
  });
33653
33971
  };
33654
33972
 
33655
- const MoreOptions = ({
33656
- data,
33657
- limit = 2,
33658
- toolTipPlacement = 'top'
33659
- }) => {
33660
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33661
- style: {
33662
- overflow: 'hidden',
33663
- textOverflow: 'ellipsis',
33664
- whiteSpace: 'nowrap',
33665
- display: 'inline-block'
33666
- },
33667
- placement: toolTipPlacement,
33668
- title: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
33669
- children: [data?.slice(0, 10).map((value, index) => /*#__PURE__*/jsxRuntime.jsxs("span", {
33670
- children: [typeof value === 'string' ? value : value?.name, /*#__PURE__*/jsxRuntime.jsx("br", {})]
33671
- }, index)), data?.length > 10 && /*#__PURE__*/jsxRuntime.jsxs("span", {
33672
- children: ["+", data?.length - 10]
33673
- })]
33674
- }),
33675
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
33676
- style: {
33677
- overflow: 'hidden',
33678
- textOverflow: 'ellipsis',
33679
- whiteSpace: 'nowrap',
33680
- maxWidth: '95%'
33681
- },
33682
- children: data?.length > limit ? `${data.slice(0, limit).map(value => typeof value === 'string' ? value : value?.name).join(', ')}, +${data?.length - limit}` : data.map(value => typeof value === 'string' ? value : value?.name).join(', ')
33683
- })
33684
- });
33685
- };
33686
- MoreOptions.propTypes = {
33687
- data: PropTypes__default["default"].array.isRequired,
33688
- limit: PropTypes__default["default"].number
33689
- };
33690
-
33691
- const getColumns$2 = ({
33692
- t,
33693
- goTo,
33694
- user,
33695
- options,
33696
- activeTab,
33697
- getRedirectLink,
33698
- theme,
33699
- subject,
33700
- data,
33701
- applications
33702
- }) => [{
33703
- dataIndex: 'datastakeId',
33704
- title: t('ID'),
33705
- ellipsis: true,
33706
- show: true,
33707
- render: (v, all) => {
33708
- if (all.empty) {
33709
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33710
- className: "daf-default-cell"
33711
- });
33712
- }
33713
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33714
- title: v,
33715
- children: v
33716
- });
33717
- }
33718
- }, {
33719
- dataIndex: 'name',
33720
- title: t('Name'),
33721
- ellipsis: true,
33722
- show: true,
33723
- render: (v, all) => {
33724
- if (all.empty) {
33725
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33726
- className: "daf-default-cell"
33727
- });
33728
- }
33729
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33730
- title: v,
33731
- children: v
33732
- });
33733
- }
33734
- }, {
33735
- dataIndex: 'region',
33736
- title: t('Region'),
33737
- ellipsis: true,
33738
- show: true,
33739
- render: (v, all) => {
33740
- if (all.empty) {
33741
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33742
- className: "daf-default-cell"
33743
- });
33744
- }
33745
- const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
33746
- return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33747
- title: region,
33748
- children: region
33749
- }) : '-';
33750
- }
33751
- }, {
33752
- dataIndex: 'territory',
33753
- title: t('Territory'),
33754
- ellipsis: true,
33755
- show: true,
33756
- render: (v, all) => {
33757
- if (all.empty) {
33758
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33759
- className: "daf-default-cell"
33760
- });
33761
- }
33762
- const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
33763
- return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33764
- title: district,
33765
- children: district
33766
- }) : '-';
33767
- }
33768
- }, {
33769
- dataIndex: 'category',
33770
- title: t('Type'),
33771
- ellipsis: true,
33772
- show: true,
33773
- render: (v, all) => {
33774
- if (all.empty) {
33775
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33776
- className: "daf-default-cell"
33777
- });
33778
- }
33779
- const category = findOptions(v, options?.locationCategories);
33780
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33781
- title: category,
33782
- children: category
33783
- });
33784
- }
33785
- }, {
33786
- dataIndex: 'operator',
33787
- title: t('Operator'),
33788
- ellipsis: true,
33789
- show: true,
33790
- render: (v, all) => {
33791
- if (all.empty) {
33792
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33793
- className: "daf-default-cell"
33794
- });
33795
- }
33796
- const operators = all?.operator?.map(operator => operator?.locationClient?.name)?.filter(Boolean);
33797
- return operators && operators.length > 0 ? /*#__PURE__*/jsxRuntime.jsx(MoreOptions, {
33798
- data: operators || [],
33799
- toolTipPlacement: operators?.length < 2 ? "topLeft" : "top"
33800
- }) : '-';
33801
- }
33802
- }, {
33803
- title: t("Last Update"),
33804
- dataIndex: "updatedAt",
33805
- key: "updatedAt",
33806
- width: 125,
33807
- render: (date, all) => {
33808
- if (all.empty) {
33809
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33810
- className: "daf-default-cell"
33811
- });
33812
- }
33813
- const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
33814
- return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
33815
- title: _date,
33816
- children: _date
33817
- });
33818
- },
33819
- ellipsis: true
33820
- }, {
33821
- title: t("Status"),
33822
- dataIndex: 'status',
33823
- ellipsis: true,
33824
- show: activeTab == "own",
33825
- render: (v, all) => {
33826
- if (all.empty) {
33827
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33828
- className: "daf-default-cell"
33829
- });
33830
- }
33831
- const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
33832
- return renderStatusTag({
33833
- value: _val,
33834
- t
33835
- });
33836
- }
33837
- }, {
33838
- title: t("Sources"),
33839
- dataIndex: 'sources',
33840
- ellipsis: true,
33841
- show: activeTab !== "own",
33842
- render: (v, all) => {
33843
- if (all.empty) {
33844
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33845
- className: "daf-default-cell"
33846
- });
33847
- }
33848
- const sources = sourceAvatarConfig(v, user, applications);
33849
- return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
33850
- items: sources
33851
- });
33852
- }
33853
- }, {
33854
- id: 'actions',
33855
- title: "",
33856
- width: 60,
33857
- render: (_, all) => {
33858
- if (all.empty) {
33859
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33860
- className: "daf-default-cell"
33861
- });
33862
- }
33863
- const onClick = () => {
33864
- let link = `/app/view/${subject}/${all.datastakeId}`;
33865
- if (activeTab === "shared") {
33866
- link += `?sourceId=${all?.authorId?.id}`;
33867
- }
33868
- goTo(getRedirectLink(link));
33869
- };
33870
- const moreMenuItems = [{
33871
- label: t("Details"),
33872
- value: "details",
33873
- onClick: onClick
33874
- }, {
33875
- label: t("Summary"),
33876
- value: "Summary",
33877
- onClick: () => {
33878
- let link = `/app/mine-summary/${all.datastakeId}`;
33879
- if (activeTab === "shared") {
33880
- link += `?sourceId=${all?.authorId?.id}`;
33881
- }
33882
- goTo(getRedirectLink(link));
33883
- }
33884
- // disabled: true,
33885
- }];
33886
- return /*#__PURE__*/jsxRuntime.jsx("div", {
33887
- children: /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
33888
- items: moreMenuItems
33889
- })
33890
- });
33891
- }
33892
- }].filter(column => column.show !== false);
33893
-
33894
33973
  const ProductionSitesTable = ({
33895
33974
  t = () => {},
33896
33975
  goTo = () => {},
@@ -33939,12 +34018,7 @@ const ProductionSitesTable = ({
33939
34018
  getData: getData,
33940
34019
  getApiBaseUrl: getApiBaseUrl,
33941
34020
  getAppHeader: getAppHeader,
33942
- getColumns: getColumns$2,
33943
- viewConfig: {
33944
- title: "Production Sites",
33945
- breadcrumbs: breadcrumbs,
33946
- createTitle: "Create Production Site"
33947
- },
34021
+ breadcrumbs: breadcrumbs,
33948
34022
  extendingFilters: extendingFilters,
33949
34023
  formConfig: {
33950
34024
  getFormData,
@@ -33957,13 +34031,9 @@ const ProductionSitesTable = ({
33957
34031
  changeAjaxOptions,
33958
34032
  formData,
33959
34033
  formValue,
33960
- form,
33961
- namespace: "PRODUCTION SITES",
33962
- view: ['scoping', 'new'],
33963
- scope: 'global',
33964
- formType: 'production-sites',
33965
- defaultValues: createDefaultValues
34034
+ form
33966
34035
  },
34036
+ defaultValues: createDefaultValues,
33967
34037
  onDownload: () => console.log("download")
33968
34038
  });
33969
34039
  };
@@ -35725,6 +35795,9 @@ const useSummary = ({
35725
35795
  const mappedData = Array.isArray(data) ? data.map(item => ({
35726
35796
  label: item?.name,
35727
35797
  value: item?.datastakeId
35798
+ })) : Array.isArray(data?.data) ? data?.data.map(item => ({
35799
+ label: item?.name,
35800
+ value: item?.datastakeId
35728
35801
  })) : [];
35729
35802
  const storedData = StorageManager$1.get(storageKey);
35730
35803
  if (storedData) {
@@ -35766,8 +35839,13 @@ const useSummary = ({
35766
35839
  }
35767
35840
  }, [hasSelect, storageKey, isPdf, id, debouncedSearch, hasInitialized, dataOptions]);
35768
35841
  React.useEffect(() => {
35769
- if (selectedItem && Array.isArray(data)) {
35770
- const selectedData = data.find(item => item?.datastakeId === selectedItem);
35842
+ if (selectedItem) {
35843
+ let selectedData;
35844
+ if (Array.isArray(data)) {
35845
+ selectedData = data.find(item => item?.datastakeId === selectedItem);
35846
+ } else if (Array.isArray(data?.data)) {
35847
+ selectedData = data.data.find(item => item?.datastakeId === selectedItem);
35848
+ }
35771
35849
  if (selectedData) {
35772
35850
  const saved = {
35773
35851
  label: selectedData.name,
@@ -36661,6 +36739,10 @@ function TradeRelationship({
36661
36739
  }, 200);
36662
36740
  return () => clearTimeout(timeoutId);
36663
36741
  }
36742
+ if (nodes.length === 0 || edges.length === 0) {
36743
+ setIsFullyRendered(true);
36744
+ onRenderComplete(true);
36745
+ }
36664
36746
  }, [nodes.length, edges.length, associatedNodes]);
36665
36747
  React.useEffect(() => {
36666
36748
  setActiveNode(null);
@@ -37002,6 +37084,7 @@ const TradeRelationships = ({
37002
37084
  filtersConfig: filterConfig,
37003
37085
  onFilterChange: onFilterChange,
37004
37086
  onRenderComplete: data => {
37087
+ console.log("onRenderComplete");
37005
37088
  setIsFullyRendered(!data);
37006
37089
  }
37007
37090
  })
@@ -39761,6 +39844,59 @@ const StatCard = ({
39761
39844
  });
39762
39845
  };
39763
39846
 
39847
+ class SourceService extends BaseService {
39848
+ get(tab, filters) {
39849
+ const {
39850
+ page,
39851
+ pageSize,
39852
+ search,
39853
+ searchParams,
39854
+ ...rest
39855
+ } = filters;
39856
+ const params = {
39857
+ filters: rest,
39858
+ pagination: {
39859
+ skip: page,
39860
+ take: pageSize
39861
+ }
39862
+ };
39863
+ if (search && searchParams.length > 0) {
39864
+ params.search = {
39865
+ qs: search,
39866
+ fields: searchParams
39867
+ };
39868
+ }
39869
+ return this.apiGet({
39870
+ url: "/partner",
39871
+ isApp: true,
39872
+ params
39873
+ });
39874
+ }
39875
+ getSources({
39876
+ type,
39877
+ id
39878
+ }) {
39879
+ return this.apiGet({
39880
+ url: `/${type}/sources/${id}`
39881
+ });
39882
+ }
39883
+ }
39884
+ createLazyService(SourceService);
39885
+
39886
+ class VersionService extends BaseService {
39887
+ getSources({
39888
+ type,
39889
+ id,
39890
+ params
39891
+ }) {
39892
+ return this.apiGet({
39893
+ url: `/${type}/versions/${id}`,
39894
+ params
39895
+ });
39896
+ }
39897
+ }
39898
+ createLazyService(VersionService);
39899
+
39764
39900
  styled__default["default"](antd.Select)`
39765
39901
  width: 100%;
39766
39902
 
@@ -44719,6 +44855,7 @@ exports.ProductionSitesTable = ProductionSitesTable;
44719
44855
  exports.RestorationActivitySummary = RestorationActivitySummary;
44720
44856
  exports.StakeholdersTable = StakeholdersTable;
44721
44857
  exports.SupplyChainDashboard = SupplyChain;
44858
+ exports.TablePage = TablePage;
44722
44859
  exports.UserDashboard = UserDashboard;
44723
44860
  exports.UsersTable = UsersTable;
44724
44861
  exports.WorkersTable = WorkersTable;