datastake-daf 0.6.770 → 0.6.771

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 (45) hide show
  1. package/dist/components/index.js +3366 -3147
  2. package/dist/pages/index.js +2278 -2142
  3. package/dist/services/index.js +6 -2
  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 +12 -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/VersionService.js +13 -0
  42. package/src/@daf/utils/tooltip.js +3 -16
  43. package/src/index.js +1 -0
  44. package/src/pages.js +1 -0
  45. 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,11 @@ 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
+ filteredData.forEach((d, i) => {
9913
9905
  addIconToMapInitialy([d?.marker?.lat, d?.marker?.lng], "location", d.category || "mineSite", d, maxTotal, i);
9914
9906
  });
9915
9907
  polylinesRef.current.forEach(polyline => {
@@ -10582,11 +10574,11 @@ function SupplyChainMap({
10582
10574
  onClickLink: data => {
10583
10575
  const locationTypes = ['village', 'town', 'area', 'territory'];
10584
10576
  if (data?.type === 'mineSite') {
10585
- goTo(getRedirectLink(`/app/mine-summary/${data.datastakeId}`));
10577
+ window.open(getRedirectLink(`/app/mine-summary/${data.datastakeId}`), '_blank');
10586
10578
  } else if (locationTypes.includes(data.type)) {
10587
- goTo(getRedirectLink(`/app/view/locations/${data.datastakeId}`));
10579
+ window.open(getRedirectLink(`/app/view/locations/${data.datastakeId}`), '_blank');
10588
10580
  } else {
10589
- goTo(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`));
10581
+ window.open(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`), '_blank');
10590
10582
  }
10591
10583
  }
10592
10584
  })
@@ -15183,7 +15175,7 @@ const renderStatusTag = ({
15183
15175
  }
15184
15176
  };
15185
15177
 
15186
- const getColumns$a = ({
15178
+ const getColumns$b = ({
15187
15179
  t,
15188
15180
  goTo,
15189
15181
  user,
@@ -30024,6 +30016,198 @@ const getFilterOptions$a = (options, t) => {
30024
30016
  category: categoriesOptions || category
30025
30017
  };
30026
30018
  };
30019
+ const formConfig$8 = {
30020
+ namespace: 'stakeholders',
30021
+ view: 'scoping',
30022
+ scope: 'create',
30023
+ formType: 'stakeholder'
30024
+ };
30025
+ const viewConfig$8 = {
30026
+ title: "Stakeholders",
30027
+ createTitle: "Create Stakeholder"
30028
+ };
30029
+
30030
+ const NavigationAction = ({
30031
+ onClick,
30032
+ theme
30033
+ }) => {
30034
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30035
+ style: {
30036
+ display: "flex",
30037
+ justifyContent: "center"
30038
+ },
30039
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
30040
+ onClick: onClick,
30041
+ style: {
30042
+ cursor: 'pointer',
30043
+ border: 'none',
30044
+ background: 'transparent',
30045
+ padding: 0,
30046
+ display: 'flex',
30047
+ alignItems: 'center'
30048
+ },
30049
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
30050
+ name: "Link",
30051
+ size: 15,
30052
+ color: theme.baseGray70
30053
+ })
30054
+ })
30055
+ });
30056
+ };
30057
+
30058
+ const getColumns$a = ({
30059
+ t,
30060
+ goTo,
30061
+ user,
30062
+ options,
30063
+ activeTab,
30064
+ getRedirectLink,
30065
+ theme,
30066
+ subject,
30067
+ applications
30068
+ }) => [{
30069
+ dataIndex: 'datastakeId',
30070
+ title: t('ID'),
30071
+ ellipsis: true,
30072
+ show: true,
30073
+ render: (v, all) => {
30074
+ if (all.empty) {
30075
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30076
+ className: "daf-default-cell"
30077
+ });
30078
+ }
30079
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30080
+ title: v,
30081
+ children: v
30082
+ });
30083
+ }
30084
+ }, {
30085
+ dataIndex: 'name',
30086
+ title: t('Name'),
30087
+ ellipsis: true,
30088
+ show: true,
30089
+ render: (v, all) => {
30090
+ if (all.empty) {
30091
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30092
+ className: "daf-default-cell"
30093
+ });
30094
+ }
30095
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30096
+ title: v,
30097
+ children: v
30098
+ });
30099
+ }
30100
+ }, {
30101
+ dataIndex: 'category',
30102
+ title: t('Category'),
30103
+ ellipsis: true,
30104
+ show: true,
30105
+ render: (v, all) => {
30106
+ if (all.empty) {
30107
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30108
+ className: "daf-default-cell"
30109
+ });
30110
+ }
30111
+ const category = findOptions(v, options?.categoriesOptions);
30112
+ return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30113
+ title: category,
30114
+ children: category
30115
+ }) : '-';
30116
+ }
30117
+ }, {
30118
+ dataIndex: 'subCategory',
30119
+ title: t('Sub Category'),
30120
+ ellipsis: true,
30121
+ show: true,
30122
+ render: (v, all) => {
30123
+ if (all.empty) {
30124
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30125
+ className: "daf-default-cell"
30126
+ });
30127
+ }
30128
+ const subCategory = findOptions(v, options?.subCategoriesOptions);
30129
+ return subCategory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30130
+ title: subCategory,
30131
+ children: subCategory
30132
+ }) : '-';
30133
+ }
30134
+ }, {
30135
+ dataIndex: 'country',
30136
+ title: t('Country'),
30137
+ ellipsis: true,
30138
+ show: true,
30139
+ render: (v, all) => {
30140
+ if (all.empty) {
30141
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30142
+ className: "daf-default-cell"
30143
+ });
30144
+ }
30145
+ const country = findOptions(v, options?.countries);
30146
+ return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30147
+ title: country,
30148
+ children: country
30149
+ }) : '-';
30150
+ }
30151
+ }, {
30152
+ title: t("Sources"),
30153
+ dataIndex: "sources",
30154
+ key: "sources",
30155
+ show: activeTab !== "own",
30156
+ render: (val, all) => {
30157
+ if (all.empty) {
30158
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30159
+ className: "daf-default-cell"
30160
+ });
30161
+ }
30162
+ if (!val || val?.length === 0) {
30163
+ return "--";
30164
+ }
30165
+ const sources = sourceAvatarConfig(val, user, applications);
30166
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
30167
+ items: sources
30168
+ });
30169
+ }
30170
+ }, {
30171
+ title: t("Last Update"),
30172
+ dataIndex: "updatedAt",
30173
+ key: "updatedAt",
30174
+ width: 125,
30175
+ render: (date, all) => {
30176
+ if (all.empty) {
30177
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30178
+ className: "daf-default-cell"
30179
+ });
30180
+ }
30181
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
30182
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30183
+ title: _date,
30184
+ children: _date
30185
+ });
30186
+ },
30187
+ ellipsis: true
30188
+ }, {
30189
+ id: 'actions',
30190
+ title: "",
30191
+ width: 60,
30192
+ render: (_, all) => {
30193
+ if (all.empty) {
30194
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30195
+ className: "daf-default-cell"
30196
+ });
30197
+ }
30198
+ const onClick = () => {
30199
+ let link = `/app/view/${subject}/${all.datastakeId}`;
30200
+ if (activeTab === "shared") {
30201
+ link += `?sourceId=${all?.authorId?.id}`;
30202
+ }
30203
+ goTo(getRedirectLink(link));
30204
+ };
30205
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
30206
+ onClick: onClick,
30207
+ theme: theme
30208
+ });
30209
+ }
30210
+ }].filter(column => column.show !== false);
30027
30211
 
30028
30212
  const getFiltersConfig$9 = ({
30029
30213
  t
@@ -30221,6 +30405,16 @@ const getFilterOptions$9 = (options, t) => {
30221
30405
  };
30222
30406
  return _default;
30223
30407
  };
30408
+ const formConfig$7 = {
30409
+ namespace: 'OPERATOR',
30410
+ view: ['scoping', 'new'],
30411
+ scope: 'global',
30412
+ formType: 'operator'
30413
+ };
30414
+ const viewConfig$7 = {
30415
+ title: "Operators",
30416
+ createTitle: "Create Operator"
30417
+ };
30224
30418
 
30225
30419
  const getFiltersConfig$8 = ({
30226
30420
  t
@@ -30422,6 +30616,184 @@ const getFilterOptions$8 = (options, t) => {
30422
30616
  };
30423
30617
  return _default;
30424
30618
  };
30619
+ const formConfig$6 = {
30620
+ namespace: 'WORKERS',
30621
+ view: ['scoping', 'new'],
30622
+ scope: 'global',
30623
+ formType: 'worker'
30624
+ };
30625
+ const viewConfig$6 = {
30626
+ title: "Workers",
30627
+ createTitle: "Create Worker"
30628
+ };
30629
+
30630
+ const getColumns$9 = ({
30631
+ t,
30632
+ goTo,
30633
+ user,
30634
+ options,
30635
+ activeTab,
30636
+ getRedirectLink,
30637
+ theme,
30638
+ subject,
30639
+ data,
30640
+ applications
30641
+ }) => [
30642
+ // {
30643
+ // dataIndex: 'datastakeId',
30644
+ // title: t('ID'),
30645
+ // ellipsis: true,
30646
+ // show: true,
30647
+ // render: (v, all) => {
30648
+ // if (all.empty) {
30649
+ // return <div className="daf-default-cell" />
30650
+ // }
30651
+
30652
+ // return <Tooltip title={v}>{v}</Tooltip>;
30653
+ // },
30654
+ // },
30655
+ {
30656
+ dataIndex: 'name',
30657
+ title: t('Name'),
30658
+ ellipsis: true,
30659
+ show: true,
30660
+ render: (v, all) => {
30661
+ if (all.empty) {
30662
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30663
+ className: "daf-default-cell"
30664
+ });
30665
+ }
30666
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30667
+ title: v,
30668
+ children: v
30669
+ });
30670
+ }
30671
+ }, {
30672
+ dataIndex: 'mineSite',
30673
+ title: t('Position'),
30674
+ ellipsis: true,
30675
+ show: true,
30676
+ render: (v, all) => {
30677
+ if (all.empty) {
30678
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30679
+ className: "daf-default-cell"
30680
+ });
30681
+ }
30682
+
30683
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
30684
+ const mineSite = all?.location?.name;
30685
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30686
+ title: mineSite,
30687
+ children: mineSite
30688
+ }) : '-';
30689
+ }
30690
+ }, {
30691
+ dataIndex: 'activity',
30692
+ title: t('Activity'),
30693
+ ellipsis: true,
30694
+ show: true,
30695
+ render: (v, all) => {
30696
+ if (all.empty) {
30697
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30698
+ className: "daf-default-cell"
30699
+ });
30700
+ }
30701
+ const activity = findOptions(v, data?.options?.activityAtSiteOptions);
30702
+ return activity ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30703
+ title: activity,
30704
+ children: activity
30705
+ }) : '-';
30706
+ }
30707
+ }, {
30708
+ dataIndex: 'origin',
30709
+ title: t('Origin'),
30710
+ ellipsis: true,
30711
+ show: true,
30712
+ render: (v, all) => {
30713
+ if (all.empty) {
30714
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30715
+ className: "daf-default-cell"
30716
+ });
30717
+ }
30718
+ const origin = all?.placeOfBirth?.name;
30719
+ return origin ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30720
+ title: origin,
30721
+ children: origin
30722
+ }) : '-';
30723
+ }
30724
+ }, {
30725
+ title: t("Census Update"),
30726
+ dataIndex: "createdAt",
30727
+ key: "createdAt",
30728
+ render: (date, all) => {
30729
+ if (all.empty) {
30730
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30731
+ className: "daf-default-cell"
30732
+ });
30733
+ }
30734
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
30735
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30736
+ title: _date,
30737
+ children: _date
30738
+ });
30739
+ },
30740
+ ellipsis: true
30741
+ }, {
30742
+ title: t("Sources"),
30743
+ dataIndex: "sources",
30744
+ key: "sources",
30745
+ show: activeTab !== "own",
30746
+ render: (val, all) => {
30747
+ if (all.empty) {
30748
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30749
+ className: "daf-default-cell"
30750
+ });
30751
+ }
30752
+ const sources = sourceAvatarConfig(val, user, applications);
30753
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
30754
+ items: sources
30755
+ });
30756
+ }
30757
+ }, {
30758
+ title: t("Status"),
30759
+ dataIndex: "status",
30760
+ key: "status",
30761
+ show: activeTab === "own",
30762
+ render: (val, all) => {
30763
+ if (all.empty) {
30764
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30765
+ className: "daf-default-cell"
30766
+ });
30767
+ }
30768
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
30769
+ return renderStatusTag({
30770
+ value: _val,
30771
+ t
30772
+ });
30773
+ }
30774
+ }, {
30775
+ id: 'actions',
30776
+ title: "",
30777
+ width: 60,
30778
+ render: (_, all) => {
30779
+ if (all.empty) {
30780
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
30781
+ className: "daf-default-cell"
30782
+ });
30783
+ }
30784
+ const onClick = () => {
30785
+ let link = `/app/view/${subject}/${all.datastakeId}`;
30786
+ if (activeTab === "shared") {
30787
+ link += `?sourceId=${all?.authorId?.id}`;
30788
+ }
30789
+ goTo(getRedirectLink(link));
30790
+ };
30791
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
30792
+ onClick: onClick,
30793
+ theme: theme
30794
+ });
30795
+ }
30796
+ }].filter(column => column.show !== false);
30425
30797
 
30426
30798
  const getFiltersConfig$7 = ({
30427
30799
  t
@@ -30624,6 +30996,364 @@ const getFilterOptions$7 = (options, t) => {
30624
30996
  }]
30625
30997
  };
30626
30998
  };
30999
+ const formConfig$5 = {
31000
+ namespace: 'event',
31001
+ view: 'scoping',
31002
+ scope: 'create',
31003
+ formType: 'event'
31004
+ };
31005
+ const viewConfig$5 = {
31006
+ title: "Events",
31007
+ createTitle: "Create Event"
31008
+ };
31009
+
31010
+ const {
31011
+ Text
31012
+ } = antd.Typography;
31013
+ function MoreTags({
31014
+ values = [],
31015
+ maxWidthCont = 120,
31016
+ maxTextCont = 100,
31017
+ diff = 30,
31018
+ style = {},
31019
+ tagColor,
31020
+ limit
31021
+ }) {
31022
+ const ref = React.useRef();
31023
+ const [width, setWidth] = React.useState(0);
31024
+ const [indexToReturn, setIndexToReturn] = React.useState(0);
31025
+ const _maxWidthCont = values.length <= 1 ? maxWidthCont : maxWidthCont - 20;
31026
+ const _maxWidthTxt = values.length <= 1 ? maxTextCont : 80;
31027
+ React.useEffect(() => {
31028
+ const resizeObserver = new ResizeObserver(entries => {
31029
+ setWidth(entries[0].contentRect.width);
31030
+ });
31031
+ resizeObserver.observe(ref.current);
31032
+ return () => resizeObserver.disconnect();
31033
+ }, []);
31034
+ const _calculate = () => {
31035
+ // If limit prop is provided and valid, use it instead of calculating
31036
+ if (typeof limit === 'number' && limit > 0) {
31037
+ setIndexToReturn(Math.min(limit - 1, values.length - 1));
31038
+ return;
31039
+ }
31040
+ const tabs = ref.current.querySelectorAll(".check-tabs");
31041
+ let filled = 0;
31042
+ let indexToReturn;
31043
+ if (values.length === 1) {
31044
+ setIndexToReturn(1);
31045
+ return;
31046
+ }
31047
+ tabs.forEach((t, i) => {
31048
+ if (typeof indexToReturn === "number") {
31049
+ return;
31050
+ }
31051
+ filled = filled + t.clientWidth + 25;
31052
+ const dif = width - filled;
31053
+ if (dif < diff) {
31054
+ indexToReturn = dif < 0 ? i - 1 : i;
31055
+ setIndexToReturn(indexToReturn);
31056
+ return;
31057
+ }
31058
+ });
31059
+ setIndexToReturn(typeof indexToReturn === "number" ? indexToReturn : tabs.length - 1);
31060
+ };
31061
+ const hasMore = values.length && indexToReturn !== values.length - 1;
31062
+ const toShow = hasMore ? values.slice(0, indexToReturn + 1) : values;
31063
+ const other = hasMore ? values.slice(indexToReturn + 1, values.length + 1) : [];
31064
+ React.useEffect(() => {
31065
+ _calculate();
31066
+ }, [width, values, limit]);
31067
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
31068
+ className: "daf-more-tags",
31069
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
31070
+ className: "list",
31071
+ children: [toShow.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag() : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
31072
+ style: {
31073
+ maxWidth: _maxWidthCont,
31074
+ overflow: "hidden",
31075
+ textOverflow: "ellipsis",
31076
+ whiteSpace: "nowrap",
31077
+ ...style
31078
+ },
31079
+ color: tagColor || ac.color,
31080
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31081
+ title: typeof ac === "object" ? ac.label : ac,
31082
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
31083
+ style: {
31084
+ maxWidth: _maxWidthTxt,
31085
+ overflow: "hidden",
31086
+ textOverflow: "ellipsis",
31087
+ whiteSpace: "nowrap",
31088
+ ...style
31089
+ },
31090
+ children: typeof ac === "object" ? ac.label : ac
31091
+ })
31092
+ })
31093
+ }, `${typeof ac === "object" ? ac.value : ac}-${i}`)), other.length ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31094
+ title: other.map(ac => typeof ac === "object" ? ac.label : ac).join(", "),
31095
+ children: /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
31096
+ color: tagColor || 'default',
31097
+ style: style,
31098
+ children: ["+", other.length]
31099
+ })
31100
+ }) : null]
31101
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
31102
+ className: "list hidden",
31103
+ ref: ref,
31104
+ children: values.map((ac, i) => typeof ac.renderTag === "function" ? ac.renderTag("check-tabs") : /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
31105
+ color: tagColor || ac.color,
31106
+ className: "check-tabs",
31107
+ style: {
31108
+ maxWidth: _maxWidthCont,
31109
+ ...style
31110
+ },
31111
+ children: /*#__PURE__*/jsxRuntime.jsx(Text, {
31112
+ ellipsis: {
31113
+ tooltip: typeof ac === "object" ? ac.label : ac
31114
+ },
31115
+ style: {
31116
+ maxWidth: _maxWidthTxt
31117
+ },
31118
+ children: typeof ac === "object" ? ac.label : ac
31119
+ })
31120
+ }, `${ac}-${i}`))
31121
+ })]
31122
+ });
31123
+ }
31124
+ MoreTags.propTypes = {
31125
+ values: PropTypes__default["default"].array,
31126
+ maxWidthCont: PropTypes__default["default"].number,
31127
+ maxTextCont: PropTypes__default["default"].number,
31128
+ diff: PropTypes__default["default"].number,
31129
+ limit: PropTypes__default["default"].number
31130
+ };
31131
+
31132
+ const getColumns$8 = ({
31133
+ t,
31134
+ goTo,
31135
+ user,
31136
+ options,
31137
+ activeTab,
31138
+ getRedirectLink,
31139
+ theme,
31140
+ subject,
31141
+ data,
31142
+ applications
31143
+ }) => [{
31144
+ dataIndex: 'datastakeId',
31145
+ title: t('ID'),
31146
+ ellipsis: true,
31147
+ show: true,
31148
+ render: (v, all) => {
31149
+ if (all.empty) {
31150
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31151
+ className: "daf-default-cell"
31152
+ });
31153
+ }
31154
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31155
+ title: v,
31156
+ children: v
31157
+ });
31158
+ }
31159
+ }, {
31160
+ dataIndex: 'name',
31161
+ title: t('Title'),
31162
+ ellipsis: true,
31163
+ show: true,
31164
+ render: (v, all) => {
31165
+ if (all.empty) {
31166
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31167
+ className: "daf-default-cell"
31168
+ });
31169
+ }
31170
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31171
+ title: v,
31172
+ children: v
31173
+ });
31174
+ }
31175
+ }, {
31176
+ dataIndex: 'typeOfEvent',
31177
+ title: t('Type'),
31178
+ ellipsis: true,
31179
+ show: true,
31180
+ render: (v, all) => {
31181
+ if (all.empty) {
31182
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31183
+ className: "daf-default-cell"
31184
+ });
31185
+ }
31186
+ const type = findOptions(v, data?.options?.eventsType);
31187
+ return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31188
+ title: type,
31189
+ children: type
31190
+ }) : '-';
31191
+ }
31192
+ }, {
31193
+ dataIndex: 'keyStakeholder',
31194
+ title: t('Key Stakeholder'),
31195
+ ellipsis: true,
31196
+ show: true,
31197
+ render: (v, all) => {
31198
+ if (all.empty) {
31199
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31200
+ className: "daf-default-cell"
31201
+ });
31202
+ }
31203
+ const val = (all?.stakeholderKey || []).map(sk => {
31204
+ return sk?.name;
31205
+ });
31206
+ if (val?.length === 0) {
31207
+ return "-";
31208
+ }
31209
+ return /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
31210
+ values: val
31211
+ });
31212
+ }
31213
+ }, {
31214
+ title: t("Date"),
31215
+ dataIndex: "date",
31216
+ key: "date",
31217
+ // testimonials: true,
31218
+ // incident: true,
31219
+ // correctiveActions: true,
31220
+ show: true,
31221
+ // sorter: () => 0 + 0,
31222
+ // searchType: "date",
31223
+ // width: 125,
31224
+ render: (date, all) => {
31225
+ if (all.empty) {
31226
+ return null;
31227
+ }
31228
+ const title = date ? renderDateFormatted(date, "DD MMM YYYY") : "-";
31229
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31230
+ title: title,
31231
+ children: title
31232
+ });
31233
+ },
31234
+ ellipsis: true
31235
+ }, {
31236
+ dataIndex: 'scope',
31237
+ title: t('Scope'),
31238
+ ellipsis: true,
31239
+ show: true,
31240
+ render: (value, all) => {
31241
+ if (all.empty) {
31242
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31243
+ className: "daf-default-cell"
31244
+ });
31245
+ }
31246
+ if (!value) {
31247
+ return "-";
31248
+ }
31249
+
31250
+ // Form the moment the intend of the if block is to be executed only in event table
31251
+ if (typeof value === "string") {
31252
+ if (all.navigationEventType === "other") {
31253
+ return "-";
31254
+ }
31255
+ const categoryOptions = (data?.options?.categoryOptions || []).map(c => {
31256
+ const searchTerm = `typeOfEvent is ${all.navigationEventType}`;
31257
+ return {
31258
+ value: c.value,
31259
+ label: c.label[searchTerm]
31260
+ };
31261
+ });
31262
+ const relaxantOptions = [...categoryOptions, ...(data?.options?.eventsType || []), ...(data?.options?.testimonialsType || [])];
31263
+ const title = relaxantOptions.find(v => v.value === value)?.label || "-";
31264
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31265
+ title: title,
31266
+ children: title
31267
+ });
31268
+ }
31269
+ const val = value.map((v, i) => ({
31270
+ label: v.name,
31271
+ value: `${v.name}-${i}`
31272
+ }));
31273
+ return val.length ? /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
31274
+ values: val
31275
+ }) : "-";
31276
+ }
31277
+ }, {
31278
+ title: t("Sources"),
31279
+ dataIndex: "sources",
31280
+ key: "sources",
31281
+ show: activeTab !== "own",
31282
+ render: (val, all) => {
31283
+ if (all.empty) {
31284
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31285
+ className: "daf-default-cell"
31286
+ });
31287
+ }
31288
+ const sources = sourceAvatarConfig(val, user, applications);
31289
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
31290
+ items: sources
31291
+ });
31292
+ }
31293
+ }, {
31294
+ title: t("Status"),
31295
+ dataIndex: "status",
31296
+ key: "status",
31297
+ show: activeTab === "own",
31298
+ correctiveActions: activeTab === "own",
31299
+ testimonials: activeTab === "own",
31300
+ incident: activeTab === "own",
31301
+ render: (value, all) => {
31302
+ if (all.empty) {
31303
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31304
+ className: "daf-default-cell"
31305
+ });
31306
+ }
31307
+ if (activeTab !== "own") {
31308
+ return all?.authorId?.name;
31309
+ }
31310
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : value;
31311
+ return renderStatusTag({
31312
+ value: _val,
31313
+ t
31314
+ });
31315
+ },
31316
+ ellipsis: true
31317
+ }, {
31318
+ title: t("Last Update"),
31319
+ dataIndex: "updatedAt",
31320
+ key: "updatedAt",
31321
+ render: (date, all) => {
31322
+ if (all.empty) {
31323
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31324
+ className: "daf-default-cell"
31325
+ });
31326
+ }
31327
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31328
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31329
+ title: _date,
31330
+ children: _date
31331
+ });
31332
+ },
31333
+ ellipsis: true
31334
+ }, {
31335
+ id: 'actions',
31336
+ title: "",
31337
+ width: 60,
31338
+ render: (_, all) => {
31339
+ if (all.empty) {
31340
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31341
+ className: "daf-default-cell"
31342
+ });
31343
+ }
31344
+ const onClick = () => {
31345
+ let link = `/app/view/${subject}/${all.datastakeId}`;
31346
+ if (activeTab === "shared") {
31347
+ link += `?sourceId=${all?.authorId?.id}`;
31348
+ }
31349
+ goTo(getRedirectLink(link));
31350
+ };
31351
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
31352
+ onClick: onClick,
31353
+ theme: theme
31354
+ });
31355
+ }
31356
+ }].filter(column => column.show !== false);
30627
31357
 
30628
31358
  const getFiltersConfig$6 = ({
30629
31359
  t
@@ -30834,264 +31564,242 @@ const getFilterOptions$6 = (options, t) => {
30834
31564
  };
30835
31565
  return _default;
30836
31566
  };
31567
+ const formConfig$4 = {
31568
+ namespace: 'corrective-actions',
31569
+ view: 'corrective-actions',
31570
+ scope: 'createActivity',
31571
+ formType: 'activity'
31572
+ };
31573
+ const viewConfig$4 = {
31574
+ title: "Activities",
31575
+ createTitle: "Create Activity"
31576
+ };
30837
31577
 
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;
31578
+ const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = false) => {
31579
+ if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
31580
+ return null;
31581
+ }
31582
+ const subjectSingular = isSingular ? subject : subject.endsWith('ies') ? subject.slice(0, -3) + 'y' : subject.endsWith('s') ? subject.slice(0, -1) : subject;
31583
+ const key = `typeOfEvent is ${subjectSingular}`;
31584
+ return eventCategoryObject[key] || null;
31046
31585
  };
31047
31586
 
31048
- const getFiltersConfig$4 = ({
31587
+ const getColumns$7 = ({
31588
+ t,
31589
+ goTo,
31590
+ user,
31591
+ options,
31592
+ activeTab,
31593
+ getRedirectLink,
31594
+ theme,
31595
+ subject,
31596
+ data,
31597
+ applications
31598
+ }) => [{
31599
+ dataIndex: 'datastakeId',
31600
+ title: t('ID'),
31601
+ ellipsis: true,
31602
+ show: true,
31603
+ render: (v, all) => {
31604
+ if (all.empty) {
31605
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31606
+ className: "daf-default-cell"
31607
+ });
31608
+ }
31609
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31610
+ title: v,
31611
+ children: v
31612
+ });
31613
+ }
31614
+ }, {
31615
+ dataIndex: 'name',
31616
+ title: t('Title'),
31617
+ ellipsis: true,
31618
+ show: true,
31619
+ render: (v, all) => {
31620
+ if (all.empty) {
31621
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31622
+ className: "daf-default-cell"
31623
+ });
31624
+ }
31625
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31626
+ title: v,
31627
+ children: v
31628
+ });
31629
+ }
31630
+ }, {
31631
+ title: t("Date"),
31632
+ dataIndex: "date",
31633
+ key: "date",
31634
+ render: (date, all) => {
31635
+ if (all.empty) {
31636
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31637
+ className: "daf-default-cell"
31638
+ });
31639
+ }
31640
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31641
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31642
+ title: _date,
31643
+ children: _date
31644
+ });
31645
+ },
31646
+ ellipsis: true
31647
+ }, {
31648
+ dataIndex: 'mineSite',
31649
+ title: t('Location'),
31650
+ ellipsis: true,
31651
+ show: true,
31652
+ render: (v, all) => {
31653
+ if (all.empty) {
31654
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31655
+ className: "daf-default-cell"
31656
+ });
31657
+ }
31658
+
31659
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
31660
+ const mineSite = all?.location?.name;
31661
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31662
+ title: mineSite,
31663
+ children: mineSite
31664
+ }) : '-';
31665
+ }
31666
+ }, {
31667
+ dataIndex: 'province',
31668
+ title: t('Province'),
31669
+ ellipsis: true,
31670
+ show: true,
31671
+ render: (v, all) => {
31672
+ if (all.empty) {
31673
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31674
+ className: "daf-default-cell"
31675
+ });
31676
+ }
31677
+ const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
31678
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31679
+ title: region,
31680
+ children: region
31681
+ }) : '-';
31682
+ }
31683
+ }, {
31684
+ dataIndex: 'territory',
31685
+ title: t('Territory'),
31686
+ ellipsis: true,
31687
+ show: true,
31688
+ render: (v, all) => {
31689
+ if (all.empty) {
31690
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31691
+ className: "daf-default-cell"
31692
+ });
31693
+ }
31694
+ const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
31695
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31696
+ title: district,
31697
+ children: district
31698
+ }) : '-';
31699
+ }
31700
+ }, {
31701
+ dataIndex: 'eventCategory',
31702
+ title: t('Category'),
31703
+ ellipsis: true,
31704
+ show: true,
31705
+ render: (v, all) => {
31706
+ if (all.empty) {
31707
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31708
+ className: "daf-default-cell"
31709
+ });
31710
+ }
31711
+ const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
31712
+ const categoryValue = getEventCategoryBySubject(eventCategory, "correctiveActions", true);
31713
+ return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31714
+ title: categoryValue,
31715
+ children: categoryValue
31716
+ }) : '-';
31717
+ }
31718
+ }, {
31719
+ title: t("Sources"),
31720
+ dataIndex: "sources",
31721
+ key: "sources",
31722
+ show: activeTab !== "own",
31723
+ render: (val, all) => {
31724
+ if (all.empty) {
31725
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31726
+ className: "daf-default-cell"
31727
+ });
31728
+ }
31729
+ const sources = sourceAvatarConfig(val, user, applications);
31730
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
31731
+ items: sources
31732
+ });
31733
+ }
31734
+ }, {
31735
+ title: t("Status"),
31736
+ dataIndex: "status",
31737
+ key: "status",
31738
+ show: activeTab === "own",
31739
+ render: (val, all) => {
31740
+ if (all.empty) {
31741
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31742
+ className: "daf-default-cell"
31743
+ });
31744
+ }
31745
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
31746
+ return renderStatusTag({
31747
+ value: _val,
31748
+ t
31749
+ });
31750
+ }
31751
+ }, {
31752
+ title: t("Last Update"),
31753
+ dataIndex: "updatedAt",
31754
+ key: "updatedAt",
31755
+ render: (date, all) => {
31756
+ if (all.empty) {
31757
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31758
+ className: "daf-default-cell"
31759
+ });
31760
+ }
31761
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
31762
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31763
+ title: _date,
31764
+ children: _date
31765
+ });
31766
+ },
31767
+ ellipsis: true
31768
+ }, {
31769
+ id: 'actions',
31770
+ title: "",
31771
+ width: 60,
31772
+ render: (_, all) => {
31773
+ if (all.empty) {
31774
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
31775
+ className: "daf-default-cell"
31776
+ });
31777
+ }
31778
+ const onClick = () => {
31779
+ let link = `/app/view/${subject}/${all.datastakeId}`;
31780
+ if (activeTab === "shared") {
31781
+ link += `?sourceId=${all?.authorId?.id}`;
31782
+ }
31783
+ goTo(getRedirectLink(link));
31784
+ };
31785
+ return /*#__PURE__*/jsxRuntime.jsx(NavigationAction, {
31786
+ onClick: onClick,
31787
+ theme: theme
31788
+ });
31789
+ }
31790
+ }].filter(column => column.show !== false);
31791
+
31792
+ const getFiltersConfig$5 = ({
31049
31793
  t
31050
31794
  }) => {
31051
31795
  return {
31052
- country: {
31053
- type: 'select',
31054
- placeholder: t('Country'),
31796
+ timeframe: {
31797
+ type: "timeframe",
31798
+ label: "Timeframe",
31055
31799
  style: {
31056
31800
  flex: 1
31057
- },
31058
- labelStyle: {
31059
- flex: 1
31060
- },
31061
- getLabel: option => option.label,
31062
- getValue: option => option.value
31801
+ }
31063
31802
  },
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
31803
  country: {
31096
31804
  type: 'select',
31097
31805
  label: 'Country',
@@ -31192,10 +31900,10 @@ const getFiltersConfig$3 = ({
31192
31900
  flex: 1
31193
31901
  }
31194
31902
  },
31195
- product: {
31903
+ category: {
31196
31904
  type: 'select',
31197
- label: 'Product',
31198
- placeholder: t => `${t('Filter by')} ${t('Product').toLowerCase()}`,
31905
+ label: 'Category',
31906
+ placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
31199
31907
  style: {
31200
31908
  flex: 1
31201
31909
  },
@@ -31256,488 +31964,60 @@ const getFiltersConfig$3 = ({
31256
31964
  }
31257
31965
  };
31258
31966
  };
31259
- const getFilterOptions$3 = (options, t) => {
31967
+ const getFilterOptions$5 = (options, t) => {
31260
31968
  const {
31969
+ timeframe = [],
31261
31970
  statusOptions = [],
31262
31971
  categoryOptions = [],
31263
31972
  countries = [],
31264
- product = [],
31265
31973
  subCategory = [],
31266
- subCategoriesOptions,
31974
+ category = [],
31267
31975
  stakeholderCategoryOptions,
31268
31976
  stakeholderSubCategoriesOptions,
31269
31977
  administrativeLevel1,
31270
- administrativeLevel2
31978
+ administrativeLevel2,
31979
+ positionInMineralSupplyChainOptions,
31980
+ subCategoriesOptions
31271
31981
  } = options || {};
31272
31982
  const _default = {
31273
- category: stakeholderCategoryOptions || categoryOptions,
31274
- country: countries,
31275
- product: product,
31276
- administrativeLevel1,
31277
- administrativeLevel2,
31278
- subCategory: subCategoriesOptions,
31983
+ timeframe: timeframe,
31279
31984
  status: [{
31280
31985
  value: "submitted",
31281
31986
  label: "Submitted"
31282
31987
  }, {
31283
31988
  value: "private",
31284
31989
  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
31990
+ }],
31991
+ category: stakeholderCategoryOptions || categoryOptions,
31992
+ country: countries,
31993
+ subCategory: subCategoriesOptions,
31994
+ // category: category,
31995
+ administrativeLevel1,
31996
+ administrativeLevel2,
31997
+ positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions
31309
31998
  };
31310
31999
  return _default;
31311
32000
  };
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
- });
32001
+ const formConfig$3 = {
32002
+ namespace: 'incident',
32003
+ view: 'incident',
32004
+ scope: 'createIncident',
32005
+ formType: 'incident'
31376
32006
  };
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);
32007
+ const viewConfig$3 = {
32008
+ title: "Incidents",
32009
+ createTitle: "Create Incident"
31384
32010
  };
31385
32011
 
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,
32012
+ const getColumns$6 = ({
31429
32013
  t,
31430
32014
  goTo,
31431
32015
  user,
32016
+ options,
32017
+ activeTab,
31432
32018
  getRedirectLink,
31433
32019
  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,
32020
+ subject,
31741
32021
  data,
31742
32022
  applications
31743
32023
  }) => [{
@@ -31758,7 +32038,7 @@ const getColumns$9 = ({
31758
32038
  }
31759
32039
  }, {
31760
32040
  dataIndex: 'name',
31761
- title: t('Name'),
32041
+ title: t('Title'),
31762
32042
  ellipsis: true,
31763
32043
  show: true,
31764
32044
  render: (v, all) => {
@@ -31773,8 +32053,25 @@ const getColumns$9 = ({
31773
32053
  });
31774
32054
  }
31775
32055
  }, {
31776
- dataIndex: 'category',
31777
- title: t('Category'),
32056
+ title: t("Date"),
32057
+ dataIndex: "date",
32058
+ key: "date",
32059
+ render: (date, all) => {
32060
+ if (all.empty) {
32061
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32062
+ className: "daf-default-cell"
32063
+ });
32064
+ }
32065
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32066
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32067
+ title: _date,
32068
+ children: _date
32069
+ });
32070
+ },
32071
+ ellipsis: true
32072
+ }, {
32073
+ dataIndex: 'mineSite',
32074
+ title: t('Location'),
31778
32075
  ellipsis: true,
31779
32076
  show: true,
31780
32077
  render: (v, all) => {
@@ -31783,15 +32080,17 @@ const getColumns$9 = ({
31783
32080
  className: "daf-default-cell"
31784
32081
  });
31785
32082
  }
31786
- const category = findOptions(v, data?.options?.locationCategories);
31787
- return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31788
- title: category,
31789
- children: category
32083
+
32084
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
32085
+ const mineSite = all?.location?.name;
32086
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32087
+ title: mineSite,
32088
+ children: mineSite
31790
32089
  }) : '-';
31791
32090
  }
31792
32091
  }, {
31793
- dataIndex: 'country',
31794
- title: t('Country'),
32092
+ dataIndex: 'province',
32093
+ title: t('Province'),
31795
32094
  ellipsis: true,
31796
32095
  show: true,
31797
32096
  render: (v, all) => {
@@ -31800,15 +32099,15 @@ const getColumns$9 = ({
31800
32099
  className: "daf-default-cell"
31801
32100
  });
31802
32101
  }
31803
- const country = findOptions(v, options?.countries);
31804
- return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31805
- title: country,
31806
- children: country
32102
+ const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
32103
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32104
+ title: region,
32105
+ children: region
31807
32106
  }) : '-';
31808
32107
  }
31809
32108
  }, {
31810
- dataIndex: 'province',
31811
- title: t('Province'),
32109
+ dataIndex: 'territory',
32110
+ title: t('Territory'),
31812
32111
  ellipsis: true,
31813
32112
  show: true,
31814
32113
  render: (v, all) => {
@@ -31817,15 +32116,15 @@ const getColumns$9 = ({
31817
32116
  className: "daf-default-cell"
31818
32117
  });
31819
32118
  }
31820
- const province = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
31821
- return province ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31822
- title: province,
31823
- children: province
32119
+ const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
32120
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32121
+ title: district,
32122
+ children: district
31824
32123
  }) : '-';
31825
32124
  }
31826
32125
  }, {
31827
- dataIndex: 'territory',
31828
- title: t('Territory'),
32126
+ dataIndex: 'eventCategory',
32127
+ title: t('Category'),
31829
32128
  ellipsis: true,
31830
32129
  show: true,
31831
32130
  render: (v, all) => {
@@ -31834,10 +32133,11 @@ const getColumns$9 = ({
31834
32133
  className: "daf-default-cell"
31835
32134
  });
31836
32135
  }
31837
- const territory = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
31838
- return territory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31839
- title: territory,
31840
- children: territory
32136
+ const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
32137
+ const categoryValue = getEventCategoryBySubject(eventCategory, subject);
32138
+ return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32139
+ title: categoryValue,
32140
+ children: categoryValue
31841
32141
  }) : '-';
31842
32142
  }
31843
32143
  }, {
@@ -31856,11 +32156,27 @@ const getColumns$9 = ({
31856
32156
  items: sources
31857
32157
  });
31858
32158
  }
32159
+ }, {
32160
+ title: t("Status"),
32161
+ dataIndex: "status",
32162
+ key: "status",
32163
+ show: activeTab === "own",
32164
+ render: (val, all) => {
32165
+ if (all.empty) {
32166
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32167
+ className: "daf-default-cell"
32168
+ });
32169
+ }
32170
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
32171
+ return renderStatusTag({
32172
+ value: _val,
32173
+ t
32174
+ });
32175
+ }
31859
32176
  }, {
31860
32177
  title: t("Last Update"),
31861
32178
  dataIndex: "updatedAt",
31862
32179
  key: "updatedAt",
31863
- width: 125,
31864
32180
  render: (date, all) => {
31865
32181
  if (all.empty) {
31866
32182
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31898,86 +32214,60 @@ const getColumns$9 = ({
31898
32214
  }
31899
32215
  }].filter(column => column.show !== false);
31900
32216
 
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 = {}
32217
+ const getFiltersConfig$4 = ({
32218
+ t
31932
32219
  }) => {
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
32220
+ return {
32221
+ country: {
32222
+ type: 'select',
32223
+ placeholder: t('Country'),
32224
+ style: {
32225
+ flex: 1
32226
+ },
32227
+ labelStyle: {
32228
+ flex: 1
32229
+ },
32230
+ getLabel: option => option.label,
32231
+ getValue: option => option.value
31975
32232
  },
31976
- onDownload: () => console.log("download")
31977
- });
32233
+ category: {
32234
+ type: 'select',
32235
+ label: 'Category',
32236
+ placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
32237
+ style: {
32238
+ flex: 1
32239
+ },
32240
+ labelStyle: {
32241
+ flex: 1
32242
+ },
32243
+ getLabel: option => option.label,
32244
+ getValue: option => option.value
32245
+ }
32246
+ };
32247
+ };
32248
+ const getFilterOptions$4 = (options, t) => {
32249
+ const {
32250
+ countries = [],
32251
+ category = [],
32252
+ locationCategories = []
32253
+ } = options || {};
32254
+ return {
32255
+ country: countries,
32256
+ category: locationCategories || category
32257
+ };
32258
+ };
32259
+ const formConfig$2 = {
32260
+ namespace: 'locations',
32261
+ view: 'scoping',
32262
+ scope: 'create',
32263
+ formType: 'location'
32264
+ };
32265
+ const viewConfig$2 = {
32266
+ title: "Locations",
32267
+ createTitle: "Create Location"
31978
32268
  };
31979
32269
 
31980
- const getColumns$8 = ({
32270
+ const getColumns$5 = ({
31981
32271
  t,
31982
32272
  goTo,
31983
32273
  user,
@@ -31986,6 +32276,7 @@ const getColumns$8 = ({
31986
32276
  getRedirectLink,
31987
32277
  theme,
31988
32278
  subject,
32279
+ data,
31989
32280
  applications
31990
32281
  }) => [{
31991
32282
  dataIndex: 'datastakeId',
@@ -32030,15 +32321,15 @@ const getColumns$8 = ({
32030
32321
  className: "daf-default-cell"
32031
32322
  });
32032
32323
  }
32033
- const category = findOptions(v, options?.categoriesOptions);
32324
+ const category = findOptions(v, data?.options?.locationCategories);
32034
32325
  return category ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32035
32326
  title: category,
32036
32327
  children: category
32037
32328
  }) : '-';
32038
32329
  }
32039
32330
  }, {
32040
- dataIndex: 'subCategory',
32041
- title: t('Sub Category'),
32331
+ dataIndex: 'country',
32332
+ title: t('Country'),
32042
32333
  ellipsis: true,
32043
32334
  show: true,
32044
32335
  render: (v, all) => {
@@ -32047,15 +32338,15 @@ const getColumns$8 = ({
32047
32338
  className: "daf-default-cell"
32048
32339
  });
32049
32340
  }
32050
- const subCategory = findOptions(v, options?.subCategoriesOptions);
32051
- return subCategory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32052
- title: subCategory,
32053
- children: subCategory
32341
+ const country = findOptions(v, options?.countries);
32342
+ return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32343
+ title: country,
32344
+ children: country
32054
32345
  }) : '-';
32055
32346
  }
32056
32347
  }, {
32057
- dataIndex: 'country',
32058
- title: t('Country'),
32348
+ dataIndex: 'province',
32349
+ title: t('Province'),
32059
32350
  ellipsis: true,
32060
32351
  show: true,
32061
32352
  render: (v, all) => {
@@ -32064,10 +32355,27 @@ const getColumns$8 = ({
32064
32355
  className: "daf-default-cell"
32065
32356
  });
32066
32357
  }
32067
- const country = findOptions(v, options?.countries);
32068
- return country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32069
- title: country,
32070
- children: country
32358
+ const province = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
32359
+ return province ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32360
+ title: province,
32361
+ children: province
32362
+ }) : '-';
32363
+ }
32364
+ }, {
32365
+ dataIndex: 'territory',
32366
+ title: t('Territory'),
32367
+ ellipsis: true,
32368
+ show: true,
32369
+ render: (v, all) => {
32370
+ if (all.empty) {
32371
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32372
+ className: "daf-default-cell"
32373
+ });
32374
+ }
32375
+ const territory = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
32376
+ return territory ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32377
+ title: territory,
32378
+ children: territory
32071
32379
  }) : '-';
32072
32380
  }
32073
32381
  }, {
@@ -32081,9 +32389,6 @@ const getColumns$8 = ({
32081
32389
  className: "daf-default-cell"
32082
32390
  });
32083
32391
  }
32084
- if (!val || val?.length === 0) {
32085
- return "--";
32086
- }
32087
32392
  const sources = sourceAvatarConfig(val, user, applications);
32088
32393
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32089
32394
  items: sources
@@ -32131,208 +32436,252 @@ const getColumns$8 = ({
32131
32436
  }
32132
32437
  }].filter(column => column.show !== false);
32133
32438
 
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 = {}
32439
+ const getFiltersConfig$3 = ({
32440
+ t
32165
32441
  }) => {
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"
32442
+ return {
32443
+ country: {
32444
+ type: 'select',
32445
+ label: 'Country',
32446
+ placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
32447
+ style: {
32448
+ flex: 1
32449
+ },
32450
+ labelStyle: {
32451
+ flex: 1
32452
+ },
32453
+ getLabel: option => option.label,
32454
+ getValue: option => option.value
32189
32455
  },
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
32456
+ administrativeLevel1: {
32457
+ type: 'ajaxSelect',
32458
+ label: ({
32459
+ t = s => s,
32460
+ options = {},
32461
+ filters = {},
32462
+ language = 'en'
32463
+ }) => {
32464
+ const {
32465
+ administrativeLevel1
32466
+ } = options;
32467
+ if (administrativeLevel1) {
32468
+ if (options.country) {
32469
+ const _item = administrativeLevel1[filters.country];
32470
+ if (_item) {
32471
+ if (_item[language]) {
32472
+ return _item[language];
32473
+ }
32474
+ }
32475
+ }
32476
+ }
32477
+ return t('Province');
32478
+ },
32479
+ placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
32480
+ filters: data => ({
32481
+ country: data.country,
32482
+ level: 'level_1'
32483
+ }),
32484
+ show: data => !data.country,
32485
+ disabled: data => !data.country,
32486
+ mapper: {
32487
+ label: "name",
32488
+ value: "id"
32489
+ },
32490
+ method: 'getOptions',
32491
+ entity: 'AdministrativeLevel',
32492
+ style: {
32493
+ flex: 1
32494
+ },
32495
+ labelStyle: {
32496
+ flex: 1
32497
+ }
32208
32498
  },
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;
32499
+ administrativeLevel2: {
32500
+ type: 'ajaxSelect',
32501
+ label: ({
32502
+ t = s => s,
32503
+ options = {},
32504
+ filters = {},
32505
+ language = 'en'
32506
+ }) => {
32507
+ const {
32508
+ administrativeLevel2
32509
+ } = options;
32510
+ if (administrativeLevel2) {
32511
+ if (options.country) {
32512
+ const _item = administrativeLevel2[filters.country];
32513
+ if (_item) {
32514
+ if (_item[language]) {
32515
+ return _item[language];
32516
+ }
32517
+ }
32518
+ }
32519
+ }
32520
+ return t('Province');
32521
+ },
32522
+ show: data => !(data.country && data.administrativeLevel1),
32523
+ placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
32524
+ filters: data => ({
32525
+ country: data.country,
32526
+ level: 'level_2',
32527
+ administrativeLevel1: data.administrativeLevel1
32528
+ }),
32529
+ disabled: data => !(data.country && data.administrativeLevel1),
32530
+ mapper: {
32531
+ label: "name",
32532
+ value: "id"
32533
+ },
32534
+ method: 'getOptions',
32535
+ entity: 'AdministrativeLevel',
32536
+ style: {
32537
+ flex: 1
32538
+ },
32539
+ labelStyle: {
32540
+ flex: 1
32253
32541
  }
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;
32542
+ },
32543
+ product: {
32544
+ type: 'select',
32545
+ label: 'Product',
32546
+ placeholder: t => `${t('Filter by')} ${t('Product').toLowerCase()}`,
32547
+ style: {
32548
+ flex: 1
32549
+ },
32550
+ labelStyle: {
32551
+ flex: 1
32552
+ },
32553
+ getLabel: option => option.label,
32554
+ getValue: option => option.value,
32555
+ filterOptions: val => {
32556
+ if (val) {
32557
+ const {
32558
+ option,
32559
+ filters
32560
+ } = val;
32561
+ if (filters && option) {
32562
+ const {
32563
+ filters: optionFilters
32564
+ } = option;
32565
+ if (Array.isArray(optionFilters) && optionFilters.length) {
32566
+ const {
32567
+ value,
32568
+ condition
32569
+ } = optionFilters[0];
32570
+ if (condition === 'includes') {
32571
+ return value.includes('corporation');
32572
+ }
32573
+ }
32574
+ }
32575
+ }
32576
+ return true;
32260
32577
  }
32261
- });
32262
- setIndexToReturn(typeof indexToReturn === "number" ? indexToReturn : tabs.length - 1);
32578
+ },
32579
+ positionInTheMineralSupplyChain: {
32580
+ type: 'select',
32581
+ label: 'Position',
32582
+ placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
32583
+ style: {
32584
+ flex: 1
32585
+ },
32586
+ labelStyle: {
32587
+ flex: 1
32588
+ },
32589
+ getLabel: option => option.label,
32590
+ getValue: option => option.value
32591
+ },
32592
+ status: {
32593
+ type: "select",
32594
+ label: "Status",
32595
+ placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
32596
+ style: {
32597
+ flex: 1
32598
+ },
32599
+ labelStyle: {
32600
+ fley: 1
32601
+ },
32602
+ getLabel: option => option.label,
32603
+ getValue: option => option.value
32604
+ }
32263
32605
  };
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
- })]
32606
+ };
32607
+ const getFilterOptions$3 = (options, t) => {
32608
+ const {
32609
+ statusOptions = [],
32610
+ categoryOptions = [],
32611
+ countries = [],
32612
+ product = [],
32613
+ subCategory = [],
32614
+ subCategoriesOptions,
32615
+ stakeholderCategoryOptions,
32616
+ stakeholderSubCategoriesOptions,
32617
+ administrativeLevel1,
32618
+ administrativeLevel2
32619
+ } = options || {};
32620
+ const _default = {
32621
+ category: stakeholderCategoryOptions || categoryOptions,
32622
+ country: countries,
32623
+ product: product,
32624
+ administrativeLevel1,
32625
+ administrativeLevel2,
32626
+ subCategory: subCategoriesOptions,
32627
+ status: [{
32628
+ value: "submitted",
32629
+ label: "Submitted"
32630
+ }, {
32631
+ value: "private",
32632
+ label: "Private"
32633
+ }]
32634
+ };
32635
+ return _default;
32636
+ };
32637
+ const formConfig$1 = {
32638
+ namespace: 'PRODUCTION SITES',
32639
+ view: ['scoping', 'new'],
32640
+ scope: 'global',
32641
+ formType: 'production-sites'
32642
+ };
32643
+ const viewConfig$1 = {
32644
+ title: "Production Sites",
32645
+ createTitle: "Create Production Site"
32646
+ };
32647
+
32648
+ const MoreOptions = ({
32649
+ data,
32650
+ limit = 2,
32651
+ toolTipPlacement = 'top'
32652
+ }) => {
32653
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32654
+ style: {
32655
+ overflow: 'hidden',
32656
+ textOverflow: 'ellipsis',
32657
+ whiteSpace: 'nowrap',
32658
+ display: 'inline-block'
32659
+ },
32660
+ placement: toolTipPlacement,
32661
+ title: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
32662
+ children: [data?.slice(0, 10).map((value, index) => /*#__PURE__*/jsxRuntime.jsxs("span", {
32663
+ children: [typeof value === 'string' ? value : value?.name, /*#__PURE__*/jsxRuntime.jsx("br", {})]
32664
+ }, index)), data?.length > 10 && /*#__PURE__*/jsxRuntime.jsxs("span", {
32665
+ children: ["+", data?.length - 10]
32666
+ })]
32667
+ }),
32668
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
32669
+ style: {
32670
+ overflow: 'hidden',
32671
+ textOverflow: 'ellipsis',
32672
+ whiteSpace: 'nowrap',
32673
+ maxWidth: '95%'
32674
+ },
32675
+ 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(', ')
32676
+ })
32325
32677
  });
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,
32678
+ };
32679
+ MoreOptions.propTypes = {
32680
+ data: PropTypes__default["default"].array.isRequired,
32332
32681
  limit: PropTypes__default["default"].number
32333
32682
  };
32334
32683
 
32335
- const getColumns$7 = ({
32684
+ const getColumns$4 = ({
32336
32685
  t,
32337
32686
  goTo,
32338
32687
  user,
@@ -32361,7 +32710,7 @@ const getColumns$7 = ({
32361
32710
  }
32362
32711
  }, {
32363
32712
  dataIndex: 'name',
32364
- title: t('Title'),
32713
+ title: t('Name'),
32365
32714
  ellipsis: true,
32366
32715
  show: true,
32367
32716
  render: (v, all) => {
@@ -32376,8 +32725,8 @@ const getColumns$7 = ({
32376
32725
  });
32377
32726
  }
32378
32727
  }, {
32379
- dataIndex: 'typeOfEvent',
32380
- title: t('Type'),
32728
+ dataIndex: 'region',
32729
+ title: t('Region'),
32381
32730
  ellipsis: true,
32382
32731
  show: true,
32383
32732
  render: (v, all) => {
@@ -32386,15 +32735,15 @@ const getColumns$7 = ({
32386
32735
  className: "daf-default-cell"
32387
32736
  });
32388
32737
  }
32389
- const type = findOptions(v, data?.options?.eventsType);
32390
- return type ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32391
- title: type,
32392
- children: type
32738
+ const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
32739
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32740
+ title: region,
32741
+ children: region
32393
32742
  }) : '-';
32394
32743
  }
32395
32744
  }, {
32396
- dataIndex: 'keyStakeholder',
32397
- title: t('Key Stakeholder'),
32745
+ dataIndex: 'territory',
32746
+ title: t('Territory'),
32398
32747
  ellipsis: true,
32399
32748
  show: true,
32400
32749
  render: (v, all) => {
@@ -32403,120 +32752,249 @@ const getColumns$7 = ({
32403
32752
  className: "daf-default-cell"
32404
32753
  });
32405
32754
  }
32406
- const val = (all?.stakeholderKey || []).map(sk => {
32407
- return sk?.name;
32408
- });
32409
- if (val?.length === 0) {
32410
- return "-";
32755
+ const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
32756
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32757
+ title: district,
32758
+ children: district
32759
+ }) : '-';
32760
+ }
32761
+ }, {
32762
+ dataIndex: 'category',
32763
+ title: t('Type'),
32764
+ ellipsis: true,
32765
+ show: true,
32766
+ render: (v, all) => {
32767
+ if (all.empty) {
32768
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32769
+ className: "daf-default-cell"
32770
+ });
32411
32771
  }
32412
- return /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
32413
- values: val
32772
+ const category = findOptions(v, options?.locationCategories);
32773
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32774
+ title: category,
32775
+ children: category
32414
32776
  });
32415
32777
  }
32416
32778
  }, {
32417
- title: t("Date"),
32418
- dataIndex: "date",
32419
- key: "date",
32420
- // testimonials: true,
32421
- // incident: true,
32422
- // correctiveActions: true,
32779
+ dataIndex: 'operator',
32780
+ title: t('Operator'),
32781
+ ellipsis: true,
32423
32782
  show: true,
32424
- // sorter: () => 0 + 0,
32425
- // searchType: "date",
32426
- // width: 125,
32783
+ render: (v, all) => {
32784
+ if (all.empty) {
32785
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32786
+ className: "daf-default-cell"
32787
+ });
32788
+ }
32789
+ const operators = all?.operator?.map(operator => operator?.locationClient?.name)?.filter(Boolean);
32790
+ return operators && operators.length > 0 ? /*#__PURE__*/jsxRuntime.jsx(MoreOptions, {
32791
+ data: operators || [],
32792
+ toolTipPlacement: operators?.length < 2 ? "topLeft" : "top"
32793
+ }) : '-';
32794
+ }
32795
+ }, {
32796
+ title: t("Last Update"),
32797
+ dataIndex: "updatedAt",
32798
+ key: "updatedAt",
32799
+ width: 125,
32427
32800
  render: (date, all) => {
32428
32801
  if (all.empty) {
32429
- return null;
32802
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32803
+ className: "daf-default-cell"
32804
+ });
32430
32805
  }
32431
- const title = date ? renderDateFormatted(date, "DD MMM YYYY") : "-";
32806
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32432
32807
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32433
- title: title,
32434
- children: title
32808
+ title: _date,
32809
+ children: _date
32435
32810
  });
32436
32811
  },
32437
32812
  ellipsis: true
32438
32813
  }, {
32439
- dataIndex: 'scope',
32440
- title: t('Scope'),
32814
+ title: t("Status"),
32815
+ dataIndex: 'status',
32441
32816
  ellipsis: true,
32442
- show: true,
32443
- render: (value, all) => {
32817
+ show: activeTab == "own",
32818
+ render: (v, all) => {
32444
32819
  if (all.empty) {
32445
32820
  return /*#__PURE__*/jsxRuntime.jsx("div", {
32446
32821
  className: "daf-default-cell"
32447
32822
  });
32448
32823
  }
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
- }) : "-";
32824
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
32825
+ return renderStatusTag({
32826
+ value: _val,
32827
+ t
32828
+ });
32479
32829
  }
32480
32830
  }, {
32481
32831
  title: t("Sources"),
32482
- dataIndex: "sources",
32483
- key: "sources",
32832
+ dataIndex: 'sources',
32833
+ ellipsis: true,
32484
32834
  show: activeTab !== "own",
32485
- render: (val, all) => {
32835
+ render: (v, all) => {
32486
32836
  if (all.empty) {
32487
32837
  return /*#__PURE__*/jsxRuntime.jsx("div", {
32488
32838
  className: "daf-default-cell"
32489
32839
  });
32490
32840
  }
32491
- const sources = sourceAvatarConfig(val, user, applications);
32841
+ const sources = sourceAvatarConfig(v, user, applications);
32492
32842
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32493
32843
  items: sources
32494
32844
  });
32495
32845
  }
32496
32846
  }, {
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) => {
32847
+ id: 'actions',
32848
+ title: "",
32849
+ width: 60,
32850
+ render: (_, all) => {
32505
32851
  if (all.empty) {
32506
32852
  return /*#__PURE__*/jsxRuntime.jsx("div", {
32507
32853
  className: "daf-default-cell"
32508
32854
  });
32509
32855
  }
32510
- if (activeTab !== "own") {
32511
- return all?.authorId?.name;
32856
+ const onClick = () => {
32857
+ let link = `/app/view/${subject}/${all.datastakeId}`;
32858
+ if (activeTab === "shared") {
32859
+ link += `?sourceId=${all?.authorId?.id}`;
32860
+ }
32861
+ goTo(getRedirectLink(link));
32862
+ };
32863
+ const moreMenuItems = [{
32864
+ label: t("Details"),
32865
+ value: "details",
32866
+ onClick: onClick
32867
+ }, {
32868
+ label: t("Summary"),
32869
+ value: "Summary",
32870
+ onClick: () => {
32871
+ let link = `/app/mine-summary/${all.datastakeId}`;
32872
+ if (activeTab === "shared") {
32873
+ link += `?sourceId=${all?.authorId?.id}`;
32874
+ }
32875
+ goTo(getRedirectLink(link));
32876
+ }
32877
+ // disabled: true,
32878
+ }];
32879
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32880
+ children: /*#__PURE__*/jsxRuntime.jsx(MoreMenu, {
32881
+ items: moreMenuItems
32882
+ })
32883
+ });
32884
+ }
32885
+ }].filter(column => column.show !== false);
32886
+
32887
+ const getFiltersConfig$2 = ({
32888
+ t
32889
+ }) => {
32890
+ return {
32891
+ timeframe: {
32892
+ type: "timeframe",
32893
+ label: "Timeframe",
32894
+ style: {
32895
+ flex: 1
32896
+ }
32512
32897
  }
32513
- const _val = all?.published || all?.status === "submitted" ? "submitted" : value;
32514
- return renderStatusTag({
32515
- value: _val,
32516
- t
32898
+ };
32899
+ };
32900
+ const getFilterOptions$2 = (options, t) => {
32901
+ const {
32902
+ timeframe = []
32903
+ } = options || {};
32904
+ const _default = {
32905
+ timeframe: timeframe
32906
+ };
32907
+ return _default;
32908
+ };
32909
+ const formConfig = {
32910
+ namespace: 'document',
32911
+ view: 'scoping',
32912
+ scope: 'create',
32913
+ formType: 'document'
32914
+ };
32915
+ const viewConfig = {
32916
+ title: "Documents",
32917
+ createTitle: "Create Document"
32918
+ };
32919
+
32920
+ const getColumns$3 = ({
32921
+ t,
32922
+ goTo,
32923
+ user,
32924
+ options,
32925
+ activeTab,
32926
+ getRedirectLink,
32927
+ theme,
32928
+ subject,
32929
+ applications
32930
+ }) => [{
32931
+ dataIndex: 'datastakeId',
32932
+ title: t('ID'),
32933
+ ellipsis: true,
32934
+ show: true,
32935
+ render: (v, all) => {
32936
+ if (all.empty) {
32937
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32938
+ className: "daf-default-cell"
32939
+ });
32940
+ }
32941
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32942
+ title: v,
32943
+ children: v
32944
+ });
32945
+ }
32946
+ }, {
32947
+ dataIndex: 'name',
32948
+ title: t('Title'),
32949
+ ellipsis: true,
32950
+ show: true,
32951
+ render: (v, all) => {
32952
+ if (all.empty) {
32953
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32954
+ className: "daf-default-cell"
32955
+ });
32956
+ }
32957
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32958
+ title: v,
32959
+ children: v
32960
+ });
32961
+ }
32962
+ }, {
32963
+ title: t("Date"),
32964
+ dataIndex: "date",
32965
+ key: "date",
32966
+ render: (date, all) => {
32967
+ if (all.empty) {
32968
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32969
+ className: "daf-default-cell"
32970
+ });
32971
+ }
32972
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32973
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32974
+ title: _date,
32975
+ children: _date
32517
32976
  });
32518
32977
  },
32519
32978
  ellipsis: true
32979
+ }, {
32980
+ title: t("Sources"),
32981
+ dataIndex: "sources",
32982
+ key: "sources",
32983
+ show: activeTab !== "own",
32984
+ render: (val, all) => {
32985
+ if (all.empty) {
32986
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32987
+ className: "daf-default-cell"
32988
+ });
32989
+ }
32990
+ if (!val || val?.length === 0) {
32991
+ return "-";
32992
+ }
32993
+ const sources = sourceAvatarConfig(val, user, applications);
32994
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32995
+ items: sources
32996
+ });
32997
+ }
32520
32998
  }, {
32521
32999
  title: t("Last Update"),
32522
33000
  dataIndex: "updatedAt",
@@ -32558,7 +33036,387 @@ const getColumns$7 = ({
32558
33036
  }
32559
33037
  }].filter(column => column.show !== false);
32560
33038
 
32561
- const EventsTable = ({
33039
+ const FILTER_REGISTRY = {
33040
+ stakeholders: {
33041
+ config: getFiltersConfig$a,
33042
+ options: getFilterOptions$a,
33043
+ formConfig: formConfig$8,
33044
+ viewConfig: viewConfig$8,
33045
+ columns: getColumns$a
33046
+ },
33047
+ workers: {
33048
+ config: getFiltersConfig$8,
33049
+ options: getFilterOptions$8,
33050
+ formConfig: formConfig$6,
33051
+ viewConfig: viewConfig$6,
33052
+ columns: getColumns$9
33053
+ },
33054
+ operators: {
33055
+ config: getFiltersConfig$9,
33056
+ options: getFilterOptions$9,
33057
+ formConfig: formConfig$7,
33058
+ viewConfig: viewConfig$7,
33059
+ columns: getColumns$b
33060
+ },
33061
+ events: {
33062
+ config: getFiltersConfig$7,
33063
+ options: getFilterOptions$7,
33064
+ formConfig: formConfig$5,
33065
+ viewConfig: viewConfig$5,
33066
+ columns: getColumns$8
33067
+ },
33068
+ activities: {
33069
+ config: getFiltersConfig$6,
33070
+ options: getFilterOptions$6,
33071
+ formConfig: formConfig$4,
33072
+ viewConfig: viewConfig$4,
33073
+ columns: getColumns$7
33074
+ },
33075
+ incidents: {
33076
+ config: getFiltersConfig$5,
33077
+ options: getFilterOptions$5,
33078
+ formConfig: formConfig$3,
33079
+ viewConfig: viewConfig$3,
33080
+ columns: getColumns$6
33081
+ },
33082
+ locations: {
33083
+ config: getFiltersConfig$4,
33084
+ options: getFilterOptions$4,
33085
+ formConfig: formConfig$2,
33086
+ viewConfig: viewConfig$2,
33087
+ columns: getColumns$5
33088
+ },
33089
+ 'production-sites': {
33090
+ config: getFiltersConfig$3,
33091
+ options: getFilterOptions$3,
33092
+ formConfig: formConfig$1,
33093
+ viewConfig: viewConfig$1,
33094
+ columns: getColumns$4
33095
+ },
33096
+ documents: {
33097
+ config: getFiltersConfig$2,
33098
+ options: getFilterOptions$2,
33099
+ formConfig: formConfig,
33100
+ viewConfig: viewConfig,
33101
+ columns: getColumns$3
33102
+ }
33103
+ };
33104
+ const DEFAULT_SUBJECT = 'stakeholders';
33105
+
33106
+ const getCheckboxConfig = ({
33107
+ subject
33108
+ }) => {
33109
+ return {
33110
+ name: 'Name',
33111
+ datastakeId: 'ID'
33112
+ };
33113
+ };
33114
+ const getSelectFiltersConfig = ({
33115
+ subject
33116
+ }) => {
33117
+ return {
33118
+ name: '',
33119
+ datastakeId: ''
33120
+ };
33121
+ };
33122
+ const getFiltersConfig$1 = ({
33123
+ t,
33124
+ subject
33125
+ }) => {
33126
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33127
+ return registry?.config({
33128
+ t
33129
+ });
33130
+ };
33131
+ const getFilterOptions$1 = ({
33132
+ t,
33133
+ subject,
33134
+ options
33135
+ }) => {
33136
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33137
+ return registry.options(options, t);
33138
+ };
33139
+ const getFormConfig = ({
33140
+ subject
33141
+ }) => {
33142
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33143
+ return registry?.formConfig;
33144
+ };
33145
+ const getViewConfig = ({
33146
+ subject
33147
+ }) => {
33148
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33149
+ return registry?.viewConfig;
33150
+ };
33151
+
33152
+ const getColumns$2 = ({
33153
+ t,
33154
+ goTo,
33155
+ user,
33156
+ options,
33157
+ activeTab,
33158
+ getRedirectLink,
33159
+ theme,
33160
+ subject,
33161
+ data,
33162
+ applications
33163
+ }) => {
33164
+ const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
33165
+ return registry?.columns({
33166
+ t,
33167
+ goTo,
33168
+ user,
33169
+ options,
33170
+ activeTab,
33171
+ getRedirectLink,
33172
+ theme,
33173
+ subject,
33174
+ data,
33175
+ applications
33176
+ });
33177
+ };
33178
+
33179
+ const useFetchData = ({
33180
+ location,
33181
+ getData,
33182
+ activeTab,
33183
+ extendingFilters,
33184
+ subject
33185
+ }) => {
33186
+ const {
33187
+ paginationQuery,
33188
+ searchParams,
33189
+ otherParams,
33190
+ sortBy,
33191
+ sortDir
33192
+ } = useGetQueryParams({
33193
+ location
33194
+ });
33195
+ React.useEffect(() => {
33196
+ const cleanSearchParams = Object.fromEntries(Object.entries(searchParams).filter(([_, value]) => value != null && value !== ''));
33197
+ const hasPagination = paginationQuery.skip != null || paginationQuery.take != null;
33198
+ if (!hasPagination) {
33199
+ return;
33200
+ }
33201
+ getData({
33202
+ ...extendingFilters,
33203
+ pagination: paginationQuery,
33204
+ ...(Object.keys(otherParams).length > 0 && otherParams),
33205
+ ...(Object.keys(cleanSearchParams).length > 0 && {
33206
+ search: cleanSearchParams
33207
+ }),
33208
+ tab: activeTab,
33209
+ sortBy: {
33210
+ [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
33211
+ }
33212
+ }, subject);
33213
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
33214
+ };
33215
+ const useTablePage = ({
33216
+ subject,
33217
+ location,
33218
+ getData,
33219
+ extendingFilters,
33220
+ options,
33221
+ t,
33222
+ goTo,
33223
+ user,
33224
+ getRedirectLink,
33225
+ theme,
33226
+ data,
33227
+ applications,
33228
+ subjectClear
33229
+ }) => {
33230
+ const [selectOptions, setSelectOptions] = React.useState();
33231
+ const [activeTab, setActiveTab] = React.useState("own");
33232
+ useFetchData({
33233
+ location,
33234
+ getData,
33235
+ activeTab,
33236
+ extendingFilters: extendingFilters,
33237
+ subject
33238
+ });
33239
+ const columns = React.useMemo(() => getColumns$2({
33240
+ t,
33241
+ goTo,
33242
+ user,
33243
+ options,
33244
+ activeTab,
33245
+ getRedirectLink,
33246
+ theme,
33247
+ subject,
33248
+ data,
33249
+ applications
33250
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications, subject, getColumns$2]);
33251
+ const selectFiltersConfig = React.useMemo(() => getFiltersConfig$1({
33252
+ t,
33253
+ subject
33254
+ }), [t, subject, getFiltersConfig$1]);
33255
+ React.useEffect(() => {
33256
+ setSelectOptions(prev => ({
33257
+ ...prev,
33258
+ ...getFilterOptions$1({
33259
+ t,
33260
+ subject,
33261
+ options
33262
+ })
33263
+ }));
33264
+ }, [options, t, subject, getFilterOptions$1]);
33265
+ const checkboxConfig = React.useMemo(() => getCheckboxConfig({
33266
+ subject
33267
+ }), [subject, getCheckboxConfig]);
33268
+ const _filtersConfig = React.useMemo(() => {
33269
+ return getSelectFiltersConfig({
33270
+ subject
33271
+ });
33272
+ }, [subject, getSelectFiltersConfig]);
33273
+ const formInfo = React.useMemo(() => getFormConfig({
33274
+ subject
33275
+ }), [subject, getFormConfig]);
33276
+ const viewConfig = React.useMemo(() => getViewConfig({
33277
+ subject
33278
+ }), [subject, getViewConfig]);
33279
+ const handleActiveTabChange = React.useCallback(value => {
33280
+ setActiveTab(value);
33281
+ }, []);
33282
+ React.useEffect(() => () => {
33283
+ if (subjectClear && typeof subjectClear === 'function') {
33284
+ subjectClear();
33285
+ }
33286
+ }, [subjectClear]);
33287
+ return {
33288
+ activeTab,
33289
+ selectOptions,
33290
+ columns,
33291
+ selectFiltersConfig,
33292
+ handleActiveTabChange,
33293
+ checkboxConfig,
33294
+ _filtersConfig,
33295
+ formInfo,
33296
+ viewConfig
33297
+ };
33298
+ };
33299
+
33300
+ const TablePage = ({
33301
+ t = () => {},
33302
+ goTo = () => {},
33303
+ user = {},
33304
+ options = {},
33305
+ getRedirectLink = () => {},
33306
+ theme = {},
33307
+ loading = false,
33308
+ data = {},
33309
+ isMobile,
33310
+ APP,
33311
+ location,
33312
+ formConfig = {
33313
+ getFormData: () => {},
33314
+ saveFormData: () => {},
33315
+ formLoading: false,
33316
+ query: {},
33317
+ ajaxForms: {},
33318
+ changeAjaxForms: () => {},
33319
+ ajaxOptions: {},
33320
+ changeAjaxOptions: () => {},
33321
+ formData: {},
33322
+ formValue: {},
33323
+ form: {}
33324
+ },
33325
+ defaultValues = {},
33326
+ extendingFilters = {},
33327
+ getData = () => {},
33328
+ getApiBaseUrl = () => {},
33329
+ getAppHeader = () => {},
33330
+ applications = [],
33331
+ subjectClear,
33332
+ subject,
33333
+ breadcrumbs = [],
33334
+ onDownload
33335
+ }) => {
33336
+ const {
33337
+ activeTab,
33338
+ selectOptions,
33339
+ columns,
33340
+ selectFiltersConfig,
33341
+ handleActiveTabChange,
33342
+ checkboxConfig,
33343
+ _filtersConfig,
33344
+ formInfo,
33345
+ viewConfig
33346
+ } = useTablePage({
33347
+ subject,
33348
+ location,
33349
+ getData,
33350
+ extendingFilters,
33351
+ options,
33352
+ t,
33353
+ goTo,
33354
+ user,
33355
+ getRedirectLink,
33356
+ theme,
33357
+ data,
33358
+ applications,
33359
+ subjectClear
33360
+ });
33361
+ return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
33362
+ t: t,
33363
+ title: t(viewConfig?.title || ""),
33364
+ breadCrumbs: breadcrumbs,
33365
+ location: location,
33366
+ loading: loading,
33367
+ goTo: goTo,
33368
+ defaultActiveTab: "own",
33369
+ columns: columns,
33370
+ data: data,
33371
+ checkboxConfig: checkboxConfig,
33372
+ APP: APP,
33373
+ getApiBaseUrl: getApiBaseUrl,
33374
+ selectOptions: selectOptions,
33375
+ selectFiltersConfig: selectFiltersConfig,
33376
+ getRedirectLink: getRedirectLink,
33377
+ filtersConfig: _filtersConfig,
33378
+ isMobile: isMobile,
33379
+ view: subject,
33380
+ getActiveTab: handleActiveTabChange,
33381
+ onDownload: onDownload && typeof onDownload === 'function' ? onDownload : undefined,
33382
+ drawerTitle: t(viewConfig?.createTitle || ""),
33383
+ children: ({
33384
+ onDrawerClose
33385
+ }) => /*#__PURE__*/jsxRuntime.jsx(Create$1, {
33386
+ t: t,
33387
+ goTo: goTo,
33388
+ user: user,
33389
+ APP: APP,
33390
+ getApiBaseUrl: getApiBaseUrl,
33391
+ getAppHeader: getAppHeader,
33392
+ getData: formConfig.getFormData,
33393
+ saveData: formConfig.saveFormData,
33394
+ loading: formConfig.formLoading,
33395
+ onSubmitted: (type, m, data) => {
33396
+ if (data.datastakeId) {
33397
+ displayMessage(type, t("affirmations::subject-created-successfully") || m);
33398
+ goTo(`/app/edit/${subject}/${data.datastakeId}`);
33399
+ }
33400
+ },
33401
+ onCancel: onDrawerClose,
33402
+ query: formConfig.query,
33403
+ ajaxForms: formConfig.ajaxForms,
33404
+ changeAjaxForms: formConfig.changeAjaxForms,
33405
+ ajaxOptions: formConfig.ajaxOptions,
33406
+ changeAjaxOptions: formConfig.changeAjaxOptions,
33407
+ formData: formConfig.formData,
33408
+ formValue: formConfig.formValue,
33409
+ form: formConfig.form,
33410
+ namespace: formInfo.namespace,
33411
+ view: formInfo.view,
33412
+ scope: formInfo.scope,
33413
+ formType: formInfo.formType,
33414
+ defaultData: defaultValues
33415
+ })
33416
+ });
33417
+ };
33418
+
33419
+ const OperatorsTable = ({
32562
33420
  t = () => {},
32563
33421
  goTo = () => {},
32564
33422
  user = {},
@@ -32585,9 +33443,77 @@ const EventsTable = ({
32585
33443
  formValue = {},
32586
33444
  form = {},
32587
33445
  extendingFilters = {},
33446
+ createDefaultValues = {},
33447
+ applications = [],
33448
+ breadcrumbs = []
33449
+ }) => {
33450
+ return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
33451
+ t: t,
33452
+ goTo: goTo,
33453
+ user: user,
33454
+ options: options,
33455
+ getRedirectLink: getRedirectLink,
33456
+ theme: theme,
33457
+ loading: loading,
33458
+ data: data,
33459
+ isMobile: isMobile,
33460
+ APP: APP,
33461
+ location: location,
33462
+ applications: applications,
33463
+ subject: "operators",
33464
+ getData: getData,
33465
+ getApiBaseUrl: getApiBaseUrl,
33466
+ getAppHeader: getAppHeader,
33467
+ breadcrumbs: breadcrumbs,
33468
+ extendingFilters: extendingFilters,
33469
+ formConfig: {
33470
+ getFormData,
33471
+ saveFormData,
33472
+ formLoading,
33473
+ query,
33474
+ ajaxForms,
33475
+ changeAjaxForms,
33476
+ ajaxOptions,
33477
+ changeAjaxOptions,
33478
+ formData,
33479
+ formValue,
33480
+ form
33481
+ },
33482
+ defaultValues: createDefaultValues,
33483
+ onDownload: () => console.log("download")
33484
+ });
33485
+ };
33486
+
33487
+ const LocationsTable = ({
33488
+ t = () => {},
33489
+ goTo = () => {},
33490
+ user = {},
33491
+ options = {},
33492
+ getRedirectLink = () => {},
33493
+ theme = {},
33494
+ loading = false,
33495
+ data = {},
33496
+ isMobile,
33497
+ APP,
33498
+ location,
33499
+ getData = () => {},
33500
+ getApiBaseUrl = () => {},
33501
+ getAppHeader = () => {},
33502
+ getFormData = () => {},
33503
+ saveFormData = () => {},
33504
+ formLoading = false,
33505
+ query = {},
33506
+ ajaxForms = {},
33507
+ changeAjaxForms = () => {},
33508
+ ajaxOptions = {},
33509
+ changeAjaxOptions = () => {},
33510
+ formData = {},
33511
+ formValue = {},
33512
+ form = {},
32588
33513
  applications = [],
32589
33514
  subjectClear = () => {},
32590
33515
  breadcrumbs = [],
33516
+ extendingFilters = {},
32591
33517
  createDefaultValues = {}
32592
33518
  }) => {
32593
33519
  return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
@@ -32603,17 +33529,12 @@ const EventsTable = ({
32603
33529
  APP: APP,
32604
33530
  location: location,
32605
33531
  applications: applications,
32606
- subject: "events",
33532
+ subject: "locations",
32607
33533
  getData: getData,
32608
33534
  getApiBaseUrl: getApiBaseUrl,
32609
33535
  getAppHeader: getAppHeader,
32610
33536
  subjectClear: subjectClear,
32611
- getColumns: getColumns$7,
32612
- viewConfig: {
32613
- title: "Events",
32614
- breadcrumbs: breadcrumbs,
32615
- createTitle: "Create Event"
32616
- },
33537
+ breadcrumbs: breadcrumbs,
32617
33538
  extendingFilters: extendingFilters,
32618
33539
  formConfig: {
32619
33540
  getFormData,
@@ -32626,137 +33547,14 @@ const EventsTable = ({
32626
33547
  changeAjaxOptions,
32627
33548
  formData,
32628
33549
  formValue,
32629
- form,
32630
- namespace: "event",
32631
- view: 'scoping',
32632
- scope: 'create',
32633
- formType: 'event',
32634
- defaultValues: createDefaultValues
33550
+ form
32635
33551
  },
33552
+ defaultValues: createDefaultValues,
32636
33553
  onDownload: () => console.log("download")
32637
33554
  });
32638
33555
  };
32639
33556
 
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 = ({
33557
+ const StakeholdersTable = ({
32760
33558
  t = () => {},
32761
33559
  goTo = () => {},
32762
33560
  user = {},
@@ -32801,17 +33599,13 @@ const DocumentsTable = ({
32801
33599
  APP: APP,
32802
33600
  location: location,
32803
33601
  applications: applications,
32804
- subject: "documents",
33602
+ subject: "stakeholders",
32805
33603
  getData: getData,
32806
33604
  getApiBaseUrl: getApiBaseUrl,
32807
33605
  getAppHeader: getAppHeader,
32808
33606
  subjectClear: subjectClear,
32809
- getColumns: getColumns$6,
32810
- viewConfig: {
32811
- title: "Documents",
32812
- breadcrumbs: breadcrumbs,
32813
- createTitle: "Create Document"
32814
- },
33607
+ breadcrumbs: breadcrumbs,
33608
+ extendingFilters: extendingFilters,
32815
33609
  formConfig: {
32816
33610
  getFormData,
32817
33611
  saveFormData,
@@ -32823,184 +33617,152 @@ const DocumentsTable = ({
32823
33617
  changeAjaxOptions,
32824
33618
  formData,
32825
33619
  formValue,
32826
- form,
32827
- namespace: 'document',
32828
- view: 'scoping',
32829
- scope: 'create',
32830
- formType: 'document',
32831
- defaultValues: createDefaultValues
33620
+ form
32832
33621
  },
33622
+ defaultValues: createDefaultValues,
32833
33623
  onDownload: () => console.log("download")
32834
33624
  });
32835
33625
  };
32836
33626
 
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);
33627
+ const EventsTable = ({
33628
+ t = () => {},
33629
+ goTo = () => {},
33630
+ user = {},
33631
+ options = {},
33632
+ getRedirectLink = () => {},
33633
+ theme = {},
33634
+ loading = false,
33635
+ data = {},
33636
+ isMobile,
33637
+ APP,
33638
+ location,
33639
+ getData = () => {},
33640
+ getApiBaseUrl = () => {},
33641
+ getAppHeader = () => {},
33642
+ getFormData = () => {},
33643
+ saveFormData = () => {},
33644
+ formLoading = false,
33645
+ query = {},
33646
+ ajaxForms = {},
33647
+ changeAjaxForms = () => {},
33648
+ ajaxOptions = {},
33649
+ changeAjaxOptions = () => {},
33650
+ formData = {},
33651
+ formValue = {},
33652
+ form = {},
33653
+ extendingFilters = {},
33654
+ applications = [],
33655
+ subjectClear = () => {},
33656
+ breadcrumbs = [],
33657
+ createDefaultValues = {}
33658
+ }) => {
33659
+ return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
33660
+ t: t,
33661
+ goTo: goTo,
33662
+ user: user,
33663
+ options: options,
33664
+ getRedirectLink: getRedirectLink,
33665
+ theme: theme,
33666
+ loading: loading,
33667
+ data: data,
33668
+ isMobile: isMobile,
33669
+ APP: APP,
33670
+ location: location,
33671
+ applications: applications,
33672
+ subject: "events",
33673
+ getData: getData,
33674
+ getApiBaseUrl: getApiBaseUrl,
33675
+ getAppHeader: getAppHeader,
33676
+ subjectClear: subjectClear,
33677
+ breadcrumbs: breadcrumbs,
33678
+ extendingFilters: extendingFilters,
33679
+ formConfig: {
33680
+ getFormData,
33681
+ saveFormData,
33682
+ formLoading,
33683
+ query,
33684
+ ajaxForms,
33685
+ changeAjaxForms,
33686
+ ajaxOptions,
33687
+ changeAjaxOptions,
33688
+ formData,
33689
+ formValue,
33690
+ form
33691
+ },
33692
+ defaultValues: createDefaultValues,
33693
+ onDownload: () => console.log("download")
33694
+ });
33695
+ };
33696
+
33697
+ const DocumentsTable = ({
33698
+ t = () => {},
33699
+ goTo = () => {},
33700
+ user = {},
33701
+ options = {},
33702
+ getRedirectLink = () => {},
33703
+ theme = {},
33704
+ loading = false,
33705
+ data = {},
33706
+ isMobile,
33707
+ APP,
33708
+ location,
33709
+ getData = () => {},
33710
+ getApiBaseUrl = () => {},
33711
+ getAppHeader = () => {},
33712
+ getFormData = () => {},
33713
+ saveFormData = () => {},
33714
+ formLoading = false,
33715
+ query = {},
33716
+ ajaxForms = {},
33717
+ changeAjaxForms = () => {},
33718
+ ajaxOptions = {},
33719
+ changeAjaxOptions = () => {},
33720
+ formData = {},
33721
+ formValue = {},
33722
+ form = {},
33723
+ applications = [],
33724
+ subjectClear = () => {},
33725
+ breadcrumbs = [],
33726
+ extendingFilters = {},
33727
+ createDefaultValues = {}
33728
+ }) => {
33729
+ return /*#__PURE__*/jsxRuntime.jsx(TablePage, {
33730
+ t: t,
33731
+ goTo: goTo,
33732
+ user: user,
33733
+ options: options,
33734
+ getRedirectLink: getRedirectLink,
33735
+ theme: theme,
33736
+ loading: loading,
33737
+ data: data,
33738
+ isMobile: isMobile,
33739
+ APP: APP,
33740
+ location: location,
33741
+ applications: applications,
33742
+ subject: "documents",
33743
+ getData: getData,
33744
+ getApiBaseUrl: getApiBaseUrl,
33745
+ getAppHeader: getAppHeader,
33746
+ subjectClear: subjectClear,
33747
+ extendingFilters: extendingFilters,
33748
+ breadcrumbs: breadcrumbs,
33749
+ formConfig: {
33750
+ getFormData,
33751
+ saveFormData,
33752
+ formLoading,
33753
+ query,
33754
+ ajaxForms,
33755
+ changeAjaxForms,
33756
+ ajaxOptions,
33757
+ changeAjaxOptions,
33758
+ formData,
33759
+ formValue,
33760
+ form
33761
+ },
33762
+ defaultValues: createDefaultValues,
33763
+ onDownload: () => console.log("download")
33764
+ });
33765
+ };
33004
33766
 
33005
33767
  const WorkersTable = ({
33006
33768
  t = () => {},
@@ -33050,12 +33812,8 @@ const WorkersTable = ({
33050
33812
  getData: getData,
33051
33813
  getApiBaseUrl: getApiBaseUrl,
33052
33814
  getAppHeader: getAppHeader,
33053
- getColumns: getColumns$5,
33054
- viewConfig: {
33055
- title: "Workers",
33056
- breadcrumbs: breadcrumbs,
33057
- createTitle: "Create Worker"
33058
- },
33815
+ getColumns: getColumns$9,
33816
+ breadcrumbs: breadcrumbs,
33059
33817
  extendingFilters: extendingFilters,
33060
33818
  formConfig: {
33061
33819
  getFormData,
@@ -33068,231 +33826,13 @@ const WorkersTable = ({
33068
33826
  changeAjaxOptions,
33069
33827
  formData,
33070
33828
  formValue,
33071
- form,
33072
- namespace: "WORKERS",
33073
- view: ['scoping', 'new'],
33074
- scope: 'global',
33075
- formType: 'worker',
33076
- defaultValues: createDefaultValues
33829
+ form
33077
33830
  },
33831
+ defaultValues: createDefaultValues,
33078
33832
  onDownload: () => console.log("download")
33079
33833
  });
33080
33834
  };
33081
33835
 
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
33836
  const ActivitiesTable = ({
33297
33837
  t = () => {},
33298
33838
  goTo = () => {},
@@ -33341,12 +33881,7 @@ const ActivitiesTable = ({
33341
33881
  getData: getData,
33342
33882
  getApiBaseUrl: getApiBaseUrl,
33343
33883
  getAppHeader: getAppHeader,
33344
- getColumns: getColumns$4,
33345
- viewConfig: {
33346
- title: "Activities",
33347
- breadcrumbs: breadcrumbs,
33348
- createTitle: "Create Activity"
33349
- },
33884
+ breadcrumbs: breadcrumbs,
33350
33885
  extendingFilters: extendingFilters,
33351
33886
  formConfig: {
33352
33887
  getFormData,
@@ -33359,222 +33894,13 @@ const ActivitiesTable = ({
33359
33894
  changeAjaxOptions,
33360
33895
  formData,
33361
33896
  formValue,
33362
- form,
33363
- namespace: "corrective-actions",
33364
- view: 'corrective-actions',
33365
- scope: 'createActivity',
33366
- formType: 'activity',
33367
- defaultValues: createDefaultValues
33897
+ form
33368
33898
  },
33899
+ defaultValues: createDefaultValues,
33369
33900
  onDownload: () => console.log("download")
33370
33901
  });
33371
33902
  };
33372
33903
 
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
33904
  const IncidentsTable = ({
33579
33905
  t = () => {},
33580
33906
  goTo = () => {},
@@ -33623,12 +33949,7 @@ const IncidentsTable = ({
33623
33949
  getData: getData,
33624
33950
  getApiBaseUrl: getApiBaseUrl,
33625
33951
  getAppHeader: getAppHeader,
33626
- getColumns: getColumns$3,
33627
- viewConfig: {
33628
- title: "Incidents",
33629
- breadcrumbs: breadcrumbs,
33630
- createTitle: "Create Incident"
33631
- },
33952
+ breadcrumbs: breadcrumbs,
33632
33953
  extendingFilters: extendingFilters,
33633
33954
  formConfig: {
33634
33955
  getFormData,
@@ -33641,256 +33962,13 @@ const IncidentsTable = ({
33641
33962
  changeAjaxOptions,
33642
33963
  formData,
33643
33964
  formValue,
33644
- form,
33645
- namespace: "incident",
33646
- view: 'incident',
33647
- scope: 'createIncident',
33648
- formType: 'incident',
33649
- defaultValues: createDefaultValues
33965
+ form
33650
33966
  },
33967
+ defaultValues: createDefaultValues,
33651
33968
  onDownload: () => console.log("download")
33652
33969
  });
33653
33970
  };
33654
33971
 
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
33972
  const ProductionSitesTable = ({
33895
33973
  t = () => {},
33896
33974
  goTo = () => {},
@@ -33939,12 +34017,7 @@ const ProductionSitesTable = ({
33939
34017
  getData: getData,
33940
34018
  getApiBaseUrl: getApiBaseUrl,
33941
34019
  getAppHeader: getAppHeader,
33942
- getColumns: getColumns$2,
33943
- viewConfig: {
33944
- title: "Production Sites",
33945
- breadcrumbs: breadcrumbs,
33946
- createTitle: "Create Production Site"
33947
- },
34020
+ breadcrumbs: breadcrumbs,
33948
34021
  extendingFilters: extendingFilters,
33949
34022
  formConfig: {
33950
34023
  getFormData,
@@ -33957,13 +34030,9 @@ const ProductionSitesTable = ({
33957
34030
  changeAjaxOptions,
33958
34031
  formData,
33959
34032
  formValue,
33960
- form,
33961
- namespace: "PRODUCTION SITES",
33962
- view: ['scoping', 'new'],
33963
- scope: 'global',
33964
- formType: 'production-sites',
33965
- defaultValues: createDefaultValues
34033
+ form
33966
34034
  },
34035
+ defaultValues: createDefaultValues,
33967
34036
  onDownload: () => console.log("download")
33968
34037
  });
33969
34038
  };
@@ -35725,6 +35794,9 @@ const useSummary = ({
35725
35794
  const mappedData = Array.isArray(data) ? data.map(item => ({
35726
35795
  label: item?.name,
35727
35796
  value: item?.datastakeId
35797
+ })) : Array.isArray(data?.data) ? data?.data.map(item => ({
35798
+ label: item?.name,
35799
+ value: item?.datastakeId
35728
35800
  })) : [];
35729
35801
  const storedData = StorageManager$1.get(storageKey);
35730
35802
  if (storedData) {
@@ -35766,8 +35838,13 @@ const useSummary = ({
35766
35838
  }
35767
35839
  }, [hasSelect, storageKey, isPdf, id, debouncedSearch, hasInitialized, dataOptions]);
35768
35840
  React.useEffect(() => {
35769
- if (selectedItem && Array.isArray(data)) {
35770
- const selectedData = data.find(item => item?.datastakeId === selectedItem);
35841
+ if (selectedItem) {
35842
+ let selectedData;
35843
+ if (Array.isArray(data)) {
35844
+ selectedData = data.find(item => item?.datastakeId === selectedItem);
35845
+ } else if (Array.isArray(data?.data)) {
35846
+ selectedData = data.data.find(item => item?.datastakeId === selectedItem);
35847
+ }
35771
35848
  if (selectedData) {
35772
35849
  const saved = {
35773
35850
  label: selectedData.name,
@@ -36661,6 +36738,10 @@ function TradeRelationship({
36661
36738
  }, 200);
36662
36739
  return () => clearTimeout(timeoutId);
36663
36740
  }
36741
+ if (nodes.length === 0 || edges.length === 0) {
36742
+ setIsFullyRendered(true);
36743
+ onRenderComplete(true);
36744
+ }
36664
36745
  }, [nodes.length, edges.length, associatedNodes]);
36665
36746
  React.useEffect(() => {
36666
36747
  setActiveNode(null);
@@ -37002,6 +37083,7 @@ const TradeRelationships = ({
37002
37083
  filtersConfig: filterConfig,
37003
37084
  onFilterChange: onFilterChange,
37004
37085
  onRenderComplete: data => {
37086
+ console.log("onRenderComplete");
37005
37087
  setIsFullyRendered(!data);
37006
37088
  }
37007
37089
  })
@@ -39761,6 +39843,59 @@ const StatCard = ({
39761
39843
  });
39762
39844
  };
39763
39845
 
39846
+ class SourceService extends BaseService {
39847
+ get(tab, filters) {
39848
+ const {
39849
+ page,
39850
+ pageSize,
39851
+ search,
39852
+ searchParams,
39853
+ ...rest
39854
+ } = filters;
39855
+ const params = {
39856
+ filters: rest,
39857
+ pagination: {
39858
+ skip: page,
39859
+ take: pageSize
39860
+ }
39861
+ };
39862
+ if (search && searchParams.length > 0) {
39863
+ params.search = {
39864
+ qs: search,
39865
+ fields: searchParams
39866
+ };
39867
+ }
39868
+ return this.apiGet({
39869
+ url: "/partner",
39870
+ isApp: true,
39871
+ params
39872
+ });
39873
+ }
39874
+ getSources({
39875
+ type,
39876
+ id
39877
+ }) {
39878
+ return this.apiGet({
39879
+ url: `/${type}/sources/${id}`
39880
+ });
39881
+ }
39882
+ }
39883
+ createLazyService(SourceService);
39884
+
39885
+ class VersionService extends BaseService {
39886
+ getSources({
39887
+ type,
39888
+ id,
39889
+ params
39890
+ }) {
39891
+ return this.apiGet({
39892
+ url: `/${type}/versions/${id}`,
39893
+ params
39894
+ });
39895
+ }
39896
+ }
39897
+ createLazyService(VersionService);
39898
+
39764
39899
  styled__default["default"](antd.Select)`
39765
39900
  width: 100%;
39766
39901
 
@@ -44719,6 +44854,7 @@ exports.ProductionSitesTable = ProductionSitesTable;
44719
44854
  exports.RestorationActivitySummary = RestorationActivitySummary;
44720
44855
  exports.StakeholdersTable = StakeholdersTable;
44721
44856
  exports.SupplyChainDashboard = SupplyChain;
44857
+ exports.TablePage = TablePage;
44722
44858
  exports.UserDashboard = UserDashboard;
44723
44859
  exports.UsersTable = UsersTable;
44724
44860
  exports.WorkersTable = WorkersTable;