datastake-daf 0.6.742 → 0.6.743

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 (29) hide show
  1. package/build/favicon.ico +0 -0
  2. package/build/logo192.png +0 -0
  3. package/build/logo512.png +0 -0
  4. package/build/manifest.json +25 -0
  5. package/build/robots.txt +3 -0
  6. package/dist/hooks/index.js +4658 -19
  7. package/dist/pages/index.js +1525 -110
  8. package/package.json +1 -1
  9. package/src/@daf/pages/dashboards/AllInformation/Documents/columns.js +4 -3
  10. package/src/@daf/pages/dashboards/AllInformation/Documents/index.jsx +3 -1
  11. package/src/@daf/pages/dashboards/AllInformation/Events/columns.js +4 -3
  12. package/src/@daf/pages/dashboards/AllInformation/Events/index.jsx +3 -1
  13. package/src/@daf/pages/dashboards/AllInformation/Locations/columns.js +4 -3
  14. package/src/@daf/pages/dashboards/AllInformation/Locations/index.jsx +3 -1
  15. package/src/@daf/pages/dashboards/AllInformation/Stakeholders/columns.js +5 -2
  16. package/src/@daf/pages/dashboards/AllInformation/Stakeholders/index.jsx +4 -2
  17. package/src/@daf/pages/dashboards/DueDilligence/Activities/columns.js +221 -0
  18. package/src/@daf/pages/dashboards/DueDilligence/Activities/config.js +166 -0
  19. package/src/@daf/pages/dashboards/DueDilligence/Activities/create.jsx +104 -0
  20. package/src/@daf/pages/dashboards/DueDilligence/Activities/index.jsx +157 -0
  21. package/src/@daf/pages/dashboards/Operations/Operators/columns.js +4 -3
  22. package/src/@daf/pages/dashboards/Operations/Operators/config.js +0 -1
  23. package/src/@daf/pages/dashboards/Operations/Operators/index.jsx +3 -1
  24. package/src/@daf/pages/dashboards/Operations/Workers/columns.js +176 -0
  25. package/src/@daf/pages/dashboards/Operations/Workers/config.js +166 -0
  26. package/src/@daf/pages/dashboards/Operations/Workers/create.jsx +104 -0
  27. package/src/@daf/pages/dashboards/Operations/Workers/index.jsx +157 -0
  28. package/src/helpers/sourceAvatarConfig.js +37 -0
  29. package/src/pages.js +3 -0
@@ -13547,7 +13547,7 @@ const getTabs = t => {
13547
13547
  label: t("Events")
13548
13548
  }];
13549
13549
  };
13550
- const getFiltersConfig$5 = (t, filters, locationCategories) => {
13550
+ const getFiltersConfig$7 = (t, filters, locationCategories) => {
13551
13551
  const value = filters.type ? {
13552
13552
  value: filters.type
13553
13553
  } : {};
@@ -13756,7 +13756,7 @@ function MineSites({
13756
13756
  config: dataFetchConfig
13757
13757
  });
13758
13758
  const tabs = React.useMemo(() => getTabs(t), [t]);
13759
- const filtersConfig = React.useMemo(() => getFiltersConfig$5(t, filters, locationCategories), [activeTab, filters, t, locationCategories]);
13759
+ const filtersConfig = React.useMemo(() => getFiltersConfig$7(t, filters, locationCategories), [activeTab, filters, t, locationCategories]);
13760
13760
  const onFilterChange = filters => {
13761
13761
  setFilters(p => ({
13762
13762
  ...p,
@@ -15992,13 +15992,46 @@ function AvatarGroup({
15992
15992
  });
15993
15993
  }
15994
15994
 
15995
- const getLinkValue$2 = (value, linkingObject) => {
15995
+ function sourceAvatarConfig(items, user, applications) {
15996
+ const userInterface = user?.company?.apps?.[0]?.interface;
15997
+ const icon = applications[0]?.interfaces?.find(i => i.value === userInterface)?.iconName;
15998
+ const sources = [];
15999
+ items?.length > 0 && items?.forEach(author => {
16000
+ if (author?.id) {
16001
+ if (author.id === user?.company?.id) {
16002
+ // it's own data
16003
+ sources.push({
16004
+ name: author.name,
16005
+ icon: 'OwnData',
16006
+ isOwn: true,
16007
+ sourceId: author.id
16008
+ });
16009
+ } else {
16010
+ sources.push({
16011
+ name: author.name,
16012
+ icon: icon,
16013
+ isOwn: false,
16014
+ sourceId: author.id
16015
+ });
16016
+ }
16017
+ }
16018
+ });
16019
+
16020
+ // sort to have own data first
16021
+ return sources.sort((a, b) => {
16022
+ if (a.isOwn && !b.isOwn) return -1;
16023
+ if (!a.isOwn && b.isOwn) return 1;
16024
+ return 0;
16025
+ });
16026
+ }
16027
+
16028
+ const getLinkValue$3 = (value, linkingObject) => {
15996
16029
  if (linkingObject && linkingObject?.[value]) {
15997
16030
  return linkingObject?.[value]?.name;
15998
16031
  }
15999
16032
  return null;
16000
16033
  };
16001
- const getColumns$4 = ({
16034
+ const getColumns$6 = ({
16002
16035
  t,
16003
16036
  goTo,
16004
16037
  user,
@@ -16007,7 +16040,8 @@ const getColumns$4 = ({
16007
16040
  getRedirectLink,
16008
16041
  theme,
16009
16042
  subject,
16010
- data
16043
+ data,
16044
+ applications
16011
16045
  }) => [{
16012
16046
  dataIndex: 'datastakeId',
16013
16047
  title: t('ID'),
@@ -16085,7 +16119,7 @@ const getColumns$4 = ({
16085
16119
  className: "daf-default-cell"
16086
16120
  });
16087
16121
  }
16088
- const region = getLinkValue$2(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
16122
+ const region = getLinkValue$3(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
16089
16123
  return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16090
16124
  title: region,
16091
16125
  children: region
@@ -16102,7 +16136,7 @@ const getColumns$4 = ({
16102
16136
  className: "daf-default-cell"
16103
16137
  });
16104
16138
  }
16105
- const district = getLinkValue$2(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
16139
+ const district = getLinkValue$3(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
16106
16140
  return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
16107
16141
  title: district,
16108
16142
  children: district
@@ -16119,12 +16153,9 @@ const getColumns$4 = ({
16119
16153
  className: "daf-default-cell"
16120
16154
  });
16121
16155
  }
16122
- console.log({
16123
- val,
16124
- all
16125
- });
16156
+ const sources = sourceAvatarConfig(val, user, applications);
16126
16157
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
16127
- items: val
16158
+ items: sources
16128
16159
  });
16129
16160
  }
16130
16161
  }, {
@@ -16173,11 +16204,11 @@ const getColumns$4 = ({
16173
16204
  }
16174
16205
  }].filter(column => column.show !== false);
16175
16206
 
16176
- const checkboxConfig$4 = {
16207
+ const checkboxConfig$6 = {
16177
16208
  name: 'Name',
16178
16209
  datastakeId: 'ID'
16179
16210
  };
16180
- const getFiltersConfig$4 = ({
16211
+ const getFiltersConfig$6 = ({
16181
16212
  t
16182
16213
  }) => {
16183
16214
  return {
@@ -16345,11 +16376,11 @@ const getFiltersConfig$4 = ({
16345
16376
  }
16346
16377
  };
16347
16378
  };
16348
- const filtersConfig$4 = {
16379
+ const filtersConfig$6 = {
16349
16380
  name: '',
16350
16381
  datastakeId: ''
16351
16382
  };
16352
- const getFilterOptions$4 = (options, t) => {
16383
+ const getFilterOptions$6 = (options, t) => {
16353
16384
  const {
16354
16385
  statusOptions = [],
16355
16386
  categoryOptions = [],
@@ -16361,9 +16392,6 @@ const getFilterOptions$4 = (options, t) => {
16361
16392
  administrativeLevel1,
16362
16393
  administrativeLevel2
16363
16394
  } = options || {};
16364
- console.log({
16365
- options
16366
- });
16367
16395
  const _default = {
16368
16396
  category: stakeholderCategoryOptions || categoryOptions,
16369
16397
  country: countries,
@@ -30082,7 +30110,7 @@ function DynamicForm({
30082
30110
  });
30083
30111
  }
30084
30112
 
30085
- const StakeholdersCreate$2 = ({
30113
+ const StakeholdersCreate$4 = ({
30086
30114
  namespace = "OPERATOR",
30087
30115
  view = ['scoping', 'new'],
30088
30116
  edit = false,
@@ -30212,11 +30240,12 @@ const OperatorsTable = ({
30212
30240
  formValue = {},
30213
30241
  form = {},
30214
30242
  extendingFilters = {},
30215
- createDefaultValues = {}
30243
+ createDefaultValues = {},
30244
+ applications = []
30216
30245
  }) => {
30217
30246
  const [selectOptions, setSelectOptions] = React.useState();
30218
30247
  const [activeTab, setActiveTab] = React.useState();
30219
- const columns = React.useMemo(() => getColumns$4({
30248
+ const columns = React.useMemo(() => getColumns$6({
30220
30249
  t,
30221
30250
  goTo,
30222
30251
  user,
@@ -30225,8 +30254,9 @@ const OperatorsTable = ({
30225
30254
  getRedirectLink,
30226
30255
  theme,
30227
30256
  subject: 'operators',
30228
- data
30229
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
30257
+ data,
30258
+ applications
30259
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
30230
30260
  const breadCrumbs = [];
30231
30261
  const {
30232
30262
  paginationQuery,
@@ -30258,14 +30288,14 @@ const OperatorsTable = ({
30258
30288
  }, 'operators');
30259
30289
  }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
30260
30290
  const selectFiltersConfig = React.useMemo(() => {
30261
- return getFiltersConfig$4({
30291
+ return getFiltersConfig$6({
30262
30292
  t
30263
30293
  });
30264
30294
  }, [t]);
30265
30295
  React.useEffect(() => {
30266
30296
  setSelectOptions(prev => ({
30267
30297
  ...prev,
30268
- ...getFilterOptions$4(options)
30298
+ ...getFilterOptions$6(options)
30269
30299
  }));
30270
30300
  }, [options, t]);
30271
30301
  const handleActiveTabChange = React.useCallback(value => {
@@ -30281,13 +30311,13 @@ const OperatorsTable = ({
30281
30311
  defaultActiveTab: "all",
30282
30312
  columns: columns,
30283
30313
  data: data,
30284
- checkboxConfig: checkboxConfig$4,
30314
+ checkboxConfig: checkboxConfig$6,
30285
30315
  APP: APP,
30286
30316
  getApiBaseUrl: getApiBaseUrl,
30287
30317
  selectOptions: selectOptions,
30288
30318
  selectFiltersConfig: selectFiltersConfig,
30289
30319
  getRedirectLink: getRedirectLink,
30290
- filtersConfig: filtersConfig$4,
30320
+ filtersConfig: filtersConfig$6,
30291
30321
  isMobile: isMobile,
30292
30322
  view: "operators",
30293
30323
  getActiveTab: handleActiveTabChange,
@@ -30297,7 +30327,7 @@ const OperatorsTable = ({
30297
30327
  drawerTitle: t("Create Operator"),
30298
30328
  children: ({
30299
30329
  onDrawerClose
30300
- }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$2, {
30330
+ }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$4, {
30301
30331
  defaultData: createDefaultValues,
30302
30332
  t: t,
30303
30333
  goTo: goTo,
@@ -30328,13 +30358,13 @@ const OperatorsTable = ({
30328
30358
  });
30329
30359
  };
30330
30360
 
30331
- const getLinkValue$1 = (value, linkingObject) => {
30361
+ const getLinkValue$2 = (value, linkingObject) => {
30332
30362
  if (linkingObject && linkingObject?.[value]) {
30333
30363
  return linkingObject?.[value]?.name;
30334
30364
  }
30335
30365
  return null;
30336
30366
  };
30337
- const getColumns$3 = ({
30367
+ const getColumns$5 = ({
30338
30368
  t,
30339
30369
  goTo,
30340
30370
  user,
@@ -30343,7 +30373,8 @@ const getColumns$3 = ({
30343
30373
  getRedirectLink,
30344
30374
  theme,
30345
30375
  subject,
30346
- data
30376
+ data,
30377
+ applications
30347
30378
  }) => [{
30348
30379
  dataIndex: 'datastakeId',
30349
30380
  title: t('ID'),
@@ -30421,7 +30452,7 @@ const getColumns$3 = ({
30421
30452
  className: "daf-default-cell"
30422
30453
  });
30423
30454
  }
30424
- const region = getLinkValue$1(v, all?.linking?.SCL);
30455
+ const region = getLinkValue$2(v, all?.linking?.SCL);
30425
30456
  return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30426
30457
  title: region,
30427
30458
  children: region
@@ -30438,7 +30469,7 @@ const getColumns$3 = ({
30438
30469
  className: "daf-default-cell"
30439
30470
  });
30440
30471
  }
30441
- const district = getLinkValue$1(v, all?.linking?.SCL);
30472
+ const district = getLinkValue$2(v, all?.linking?.SCL);
30442
30473
  return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
30443
30474
  title: district,
30444
30475
  children: district
@@ -30473,12 +30504,9 @@ const getColumns$3 = ({
30473
30504
  className: "daf-default-cell"
30474
30505
  });
30475
30506
  }
30476
- console.log({
30477
- val,
30478
- all
30479
- });
30507
+ const sources = sourceAvatarConfig(val, user, applications);
30480
30508
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
30481
- items: val
30509
+ items: sources
30482
30510
  });
30483
30511
  }
30484
30512
  }, {
@@ -30509,11 +30537,11 @@ const getColumns$3 = ({
30509
30537
  }
30510
30538
  }].filter(column => column.show !== false);
30511
30539
 
30512
- const checkboxConfig$3 = {
30540
+ const checkboxConfig$5 = {
30513
30541
  name: 'Name',
30514
30542
  datastakeId: 'ID'
30515
30543
  };
30516
- const getFiltersConfig$3 = ({
30544
+ const getFiltersConfig$5 = ({
30517
30545
  t
30518
30546
  }) => {
30519
30547
  return {
@@ -30531,11 +30559,11 @@ const getFiltersConfig$3 = ({
30531
30559
  }
30532
30560
  };
30533
30561
  };
30534
- const filtersConfig$3 = {
30562
+ const filtersConfig$5 = {
30535
30563
  name: '',
30536
30564
  datastakeId: ''
30537
30565
  };
30538
- const getFilterOptions$3 = (options, t) => {
30566
+ const getFilterOptions$5 = (options, t) => {
30539
30567
  const {
30540
30568
  countries
30541
30569
  } = options || {};
@@ -30545,7 +30573,7 @@ const getFilterOptions$3 = (options, t) => {
30545
30573
  return _default;
30546
30574
  };
30547
30575
 
30548
- const StakeholdersCreate$1 = ({
30576
+ const StakeholdersCreate$3 = ({
30549
30577
  namespace = 'locations',
30550
30578
  view = 'scoping',
30551
30579
  edit = false,
@@ -30670,11 +30698,12 @@ const LocationsTable = ({
30670
30698
  changeAjaxOptions = () => {},
30671
30699
  formData = {},
30672
30700
  formValue = {},
30673
- form = {}
30701
+ form = {},
30702
+ applications = []
30674
30703
  }) => {
30675
30704
  const [selectOptions, setSelectOptions] = React.useState();
30676
30705
  const [activeTab, setActiveTab] = React.useState();
30677
- const columns = React.useMemo(() => getColumns$3({
30706
+ const columns = React.useMemo(() => getColumns$5({
30678
30707
  t,
30679
30708
  goTo,
30680
30709
  user,
@@ -30683,8 +30712,9 @@ const LocationsTable = ({
30683
30712
  getRedirectLink,
30684
30713
  theme,
30685
30714
  subject: 'locations',
30686
- data
30687
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
30715
+ data,
30716
+ applications
30717
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
30688
30718
  const breadCrumbs = [];
30689
30719
  const {
30690
30720
  paginationQuery,
@@ -30709,14 +30739,14 @@ const LocationsTable = ({
30709
30739
  data
30710
30740
  });
30711
30741
  const selectFiltersConfig = React.useMemo(() => {
30712
- return getFiltersConfig$3({
30742
+ return getFiltersConfig$5({
30713
30743
  t
30714
30744
  });
30715
30745
  }, [t]);
30716
30746
  React.useEffect(() => {
30717
30747
  setSelectOptions(prev => ({
30718
30748
  ...prev,
30719
- ...getFilterOptions$3(options)
30749
+ ...getFilterOptions$5(options)
30720
30750
  }));
30721
30751
  }, [options, t]);
30722
30752
  const handleActiveTabChange = React.useCallback(value => {
@@ -30732,13 +30762,13 @@ const LocationsTable = ({
30732
30762
  defaultActiveTab: "all",
30733
30763
  columns: columns,
30734
30764
  data: data,
30735
- checkboxConfig: checkboxConfig$3,
30765
+ checkboxConfig: checkboxConfig$5,
30736
30766
  APP: APP,
30737
30767
  getApiBaseUrl: getApiBaseUrl,
30738
30768
  selectOptions: selectOptions,
30739
30769
  selectFiltersConfig: selectFiltersConfig,
30740
30770
  getRedirectLink: getRedirectLink,
30741
- filtersConfig: filtersConfig$3,
30771
+ filtersConfig: filtersConfig$5,
30742
30772
  isMobile: isMobile,
30743
30773
  view: "locations",
30744
30774
  getActiveTab: handleActiveTabChange,
@@ -30748,7 +30778,7 @@ const LocationsTable = ({
30748
30778
  drawerTitle: t("Create Location"),
30749
30779
  children: ({
30750
30780
  onDrawerClose
30751
- }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$1, {
30781
+ }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$3, {
30752
30782
  t: t,
30753
30783
  goTo: goTo,
30754
30784
  user: user,
@@ -30777,7 +30807,7 @@ const LocationsTable = ({
30777
30807
  });
30778
30808
  };
30779
30809
 
30780
- const getColumns$2 = ({
30810
+ const getColumns$4 = ({
30781
30811
  t,
30782
30812
  goTo,
30783
30813
  user,
@@ -30785,7 +30815,8 @@ const getColumns$2 = ({
30785
30815
  activeTab,
30786
30816
  getRedirectLink,
30787
30817
  theme,
30788
- subject
30818
+ subject,
30819
+ applications
30789
30820
  }) => [{
30790
30821
  dataIndex: 'datastakeId',
30791
30822
  title: t('ID'),
@@ -30901,8 +30932,9 @@ const getColumns$2 = ({
30901
30932
  if (!val || val?.length === 0) {
30902
30933
  return "--";
30903
30934
  }
30935
+ const sources = sourceAvatarConfig(val, user, applications);
30904
30936
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
30905
- items: val
30937
+ items: sources
30906
30938
  });
30907
30939
  }
30908
30940
  }, {
@@ -30933,11 +30965,11 @@ const getColumns$2 = ({
30933
30965
  }
30934
30966
  }].filter(column => column.show !== false);
30935
30967
 
30936
- const checkboxConfig$2 = {
30968
+ const checkboxConfig$4 = {
30937
30969
  name: 'Name',
30938
30970
  datastakeId: 'ID'
30939
30971
  };
30940
- const getFiltersConfig$2 = ({
30972
+ const getFiltersConfig$4 = ({
30941
30973
  t
30942
30974
  }) => {
30943
30975
  return {
@@ -30955,11 +30987,11 @@ const getFiltersConfig$2 = ({
30955
30987
  }
30956
30988
  };
30957
30989
  };
30958
- const filtersConfig$2 = {
30990
+ const filtersConfig$4 = {
30959
30991
  name: '',
30960
30992
  datastakeId: ''
30961
30993
  };
30962
- const getFilterOptions$2 = (options, t) => {
30994
+ const getFilterOptions$4 = (options, t) => {
30963
30995
  const {
30964
30996
  countries
30965
30997
  } = options || {};
@@ -30969,7 +31001,7 @@ const getFilterOptions$2 = (options, t) => {
30969
31001
  return _default;
30970
31002
  };
30971
31003
 
30972
- const StakeholdersCreate = ({
31004
+ const StakeholdersCreate$2 = ({
30973
31005
  namespace = 'stakeholders',
30974
31006
  view = 'scoping',
30975
31007
  edit = false,
@@ -31094,11 +31126,12 @@ const StakeholdersTable = ({
31094
31126
  changeAjaxOptions = () => {},
31095
31127
  formData = {},
31096
31128
  formValue = {},
31097
- form = {}
31129
+ form = {},
31130
+ applications = []
31098
31131
  }) => {
31099
31132
  const [selectOptions, setSelectOptions] = React.useState();
31100
31133
  const [activeTab, setActiveTab] = React.useState();
31101
- const columns = React.useMemo(() => getColumns$2({
31134
+ const columns = React.useMemo(() => getColumns$4({
31102
31135
  t,
31103
31136
  goTo,
31104
31137
  user,
@@ -31106,8 +31139,9 @@ const StakeholdersTable = ({
31106
31139
  activeTab,
31107
31140
  getRedirectLink,
31108
31141
  theme,
31109
- subject: 'stakeholders'
31110
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme]);
31142
+ subject: 'stakeholders',
31143
+ applications
31144
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
31111
31145
  const breadCrumbs = [];
31112
31146
  const {
31113
31147
  paginationQuery,
@@ -31129,14 +31163,14 @@ const StakeholdersTable = ({
31129
31163
  }, 'stakeholders');
31130
31164
  }, [paginationQuery, otherParams, searchParams, activeTab]);
31131
31165
  const selectFiltersConfig = React.useMemo(() => {
31132
- return getFiltersConfig$2({
31166
+ return getFiltersConfig$4({
31133
31167
  t
31134
31168
  });
31135
31169
  }, [t]);
31136
31170
  React.useEffect(() => {
31137
31171
  setSelectOptions(prev => ({
31138
31172
  ...prev,
31139
- ...getFilterOptions$2(options)
31173
+ ...getFilterOptions$4(options)
31140
31174
  }));
31141
31175
  }, [options, t]);
31142
31176
  const handleActiveTabChange = React.useCallback(value => {
@@ -31152,13 +31186,13 @@ const StakeholdersTable = ({
31152
31186
  defaultActiveTab: "all",
31153
31187
  columns: columns,
31154
31188
  data: data,
31155
- checkboxConfig: checkboxConfig$2,
31189
+ checkboxConfig: checkboxConfig$4,
31156
31190
  APP: APP,
31157
31191
  getApiBaseUrl: getApiBaseUrl,
31158
31192
  selectOptions: selectOptions,
31159
31193
  selectFiltersConfig: selectFiltersConfig,
31160
31194
  getRedirectLink: getRedirectLink,
31161
- filtersConfig: filtersConfig$2,
31195
+ filtersConfig: filtersConfig$4,
31162
31196
  isMobile: isMobile,
31163
31197
  view: "stakeholders",
31164
31198
  getActiveTab: handleActiveTabChange,
@@ -31168,7 +31202,7 @@ const StakeholdersTable = ({
31168
31202
  drawerTitle: t("Create Stakeholder"),
31169
31203
  children: ({
31170
31204
  onDrawerClose
31171
- }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate, {
31205
+ }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$2, {
31172
31206
  t: t,
31173
31207
  goTo: goTo,
31174
31208
  user: user,
@@ -31197,13 +31231,13 @@ const StakeholdersTable = ({
31197
31231
  });
31198
31232
  };
31199
31233
 
31200
- const getLinkValue = (value, linkingObject) => {
31234
+ const getLinkValue$1 = (value, linkingObject) => {
31201
31235
  if (linkingObject && linkingObject?.[value]) {
31202
31236
  return linkingObject?.[value]?.name;
31203
31237
  }
31204
31238
  return null;
31205
31239
  };
31206
- const getColumns$1 = ({
31240
+ const getColumns$3 = ({
31207
31241
  t,
31208
31242
  goTo,
31209
31243
  user,
@@ -31212,7 +31246,8 @@ const getColumns$1 = ({
31212
31246
  getRedirectLink,
31213
31247
  theme,
31214
31248
  subject,
31215
- data
31249
+ data,
31250
+ applications
31216
31251
  }) => [{
31217
31252
  dataIndex: 'datastakeId',
31218
31253
  title: t('ID'),
@@ -31290,7 +31325,7 @@ const getColumns$1 = ({
31290
31325
  className: "daf-default-cell"
31291
31326
  });
31292
31327
  }
31293
- const scope = getLinkValue(v, all?.linking?.SCL);
31328
+ const scope = getLinkValue$1(v, all?.linking?.SCL);
31294
31329
  return scope ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31295
31330
  title: scope,
31296
31331
  children: scope
@@ -31343,12 +31378,9 @@ const getColumns$1 = ({
31343
31378
  className: "daf-default-cell"
31344
31379
  });
31345
31380
  }
31346
- console.log({
31347
- val,
31348
- all
31349
- });
31381
+ const sources = sourceAvatarConfig(val, user, applications);
31350
31382
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
31351
- items: val
31383
+ items: sources
31352
31384
  });
31353
31385
  }
31354
31386
  }, {
@@ -31379,11 +31411,11 @@ const getColumns$1 = ({
31379
31411
  }
31380
31412
  }].filter(column => column.show !== false);
31381
31413
 
31382
- const checkboxConfig$1 = {
31414
+ const checkboxConfig$3 = {
31383
31415
  name: 'Name',
31384
31416
  datastakeId: 'ID'
31385
31417
  };
31386
- const getFiltersConfig$1 = ({
31418
+ const getFiltersConfig$3 = ({
31387
31419
  t
31388
31420
  }) => {
31389
31421
  return {
@@ -31401,11 +31433,11 @@ const getFiltersConfig$1 = ({
31401
31433
  }
31402
31434
  };
31403
31435
  };
31404
- const filtersConfig$1 = {
31436
+ const filtersConfig$3 = {
31405
31437
  name: '',
31406
31438
  datastakeId: ''
31407
31439
  };
31408
- const getFilterOptions$1 = (options, t) => {
31440
+ const getFilterOptions$3 = (options, t) => {
31409
31441
  const {
31410
31442
  countries
31411
31443
  } = options || {};
@@ -31541,11 +31573,12 @@ const EventsTable = ({
31541
31573
  formData = {},
31542
31574
  formValue = {},
31543
31575
  form = {},
31544
- extendingFilters = {}
31576
+ extendingFilters = {},
31577
+ applications = []
31545
31578
  }) => {
31546
31579
  const [selectOptions, setSelectOptions] = React.useState();
31547
31580
  const [activeTab, setActiveTab] = React.useState();
31548
- const columns = React.useMemo(() => getColumns$1({
31581
+ const columns = React.useMemo(() => getColumns$3({
31549
31582
  t,
31550
31583
  goTo,
31551
31584
  user,
@@ -31554,8 +31587,9 @@ const EventsTable = ({
31554
31587
  getRedirectLink,
31555
31588
  theme,
31556
31589
  subject: 'events',
31557
- data
31558
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
31590
+ data,
31591
+ applications
31592
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
31559
31593
  const breadCrumbs = [];
31560
31594
  const {
31561
31595
  paginationQuery,
@@ -31593,14 +31627,14 @@ const EventsTable = ({
31593
31627
  data
31594
31628
  });
31595
31629
  const selectFiltersConfig = React.useMemo(() => {
31596
- return getFiltersConfig$1({
31630
+ return getFiltersConfig$3({
31597
31631
  t
31598
31632
  });
31599
31633
  }, [t]);
31600
31634
  React.useEffect(() => {
31601
31635
  setSelectOptions(prev => ({
31602
31636
  ...prev,
31603
- ...getFilterOptions$1(options)
31637
+ ...getFilterOptions$3(options)
31604
31638
  }));
31605
31639
  }, [options, t]);
31606
31640
  const handleActiveTabChange = React.useCallback(value => {
@@ -31616,13 +31650,13 @@ const EventsTable = ({
31616
31650
  defaultActiveTab: "all",
31617
31651
  columns: columns,
31618
31652
  data: data,
31619
- checkboxConfig: checkboxConfig$1,
31653
+ checkboxConfig: checkboxConfig$3,
31620
31654
  APP: APP,
31621
31655
  getApiBaseUrl: getApiBaseUrl,
31622
31656
  selectOptions: selectOptions,
31623
31657
  selectFiltersConfig: selectFiltersConfig,
31624
31658
  getRedirectLink: getRedirectLink,
31625
- filtersConfig: filtersConfig$1,
31659
+ filtersConfig: filtersConfig$3,
31626
31660
  isMobile: isMobile,
31627
31661
  view: "events",
31628
31662
  getActiveTab: handleActiveTabChange,
@@ -31662,7 +31696,7 @@ const EventsTable = ({
31662
31696
  });
31663
31697
  };
31664
31698
 
31665
- const getColumns = ({
31699
+ const getColumns$2 = ({
31666
31700
  t,
31667
31701
  goTo,
31668
31702
  user,
@@ -31671,7 +31705,8 @@ const getColumns = ({
31671
31705
  getRedirectLink,
31672
31706
  theme,
31673
31707
  subject,
31674
- data
31708
+ data,
31709
+ applications
31675
31710
  }) => [{
31676
31711
  dataIndex: 'datastakeId',
31677
31712
  title: t('ID'),
@@ -31750,12 +31785,9 @@ const getColumns = ({
31750
31785
  className: "daf-default-cell"
31751
31786
  });
31752
31787
  }
31753
- console.log({
31754
- val,
31755
- all
31756
- });
31788
+ const sources = sourceAvatarConfig(val, user, applications);
31757
31789
  return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
31758
- items: val
31790
+ items: sources
31759
31791
  });
31760
31792
  }
31761
31793
  }, {
@@ -31786,11 +31818,11 @@ const getColumns = ({
31786
31818
  }
31787
31819
  }].filter(column => column.show !== false);
31788
31820
 
31789
- const checkboxConfig = {
31821
+ const checkboxConfig$2 = {
31790
31822
  name: 'Name',
31791
31823
  datastakeId: 'ID'
31792
31824
  };
31793
- const getFiltersConfig = ({
31825
+ const getFiltersConfig$2 = ({
31794
31826
  t
31795
31827
  }) => {
31796
31828
  return {
@@ -31808,11 +31840,11 @@ const getFiltersConfig = ({
31808
31840
  }
31809
31841
  };
31810
31842
  };
31811
- const filtersConfig = {
31843
+ const filtersConfig$2 = {
31812
31844
  name: '',
31813
31845
  datastakeId: ''
31814
31846
  };
31815
- const getFilterOptions = (options, t) => {
31847
+ const getFilterOptions$2 = (options, t) => {
31816
31848
  const {
31817
31849
  countries
31818
31850
  } = options || {};
@@ -31948,11 +31980,12 @@ const DocumentsTable = ({
31948
31980
  formData = {},
31949
31981
  formValue = {},
31950
31982
  form = {},
31951
- extendingFilters = {}
31983
+ extendingFilters = {},
31984
+ applications = []
31952
31985
  }) => {
31953
31986
  const [selectOptions, setSelectOptions] = React.useState();
31954
31987
  const [activeTab, setActiveTab] = React.useState();
31955
- const columns = React.useMemo(() => getColumns({
31988
+ const columns = React.useMemo(() => getColumns$2({
31956
31989
  t,
31957
31990
  goTo,
31958
31991
  user,
@@ -31961,8 +31994,9 @@ const DocumentsTable = ({
31961
31994
  getRedirectLink,
31962
31995
  theme,
31963
31996
  subject: 'documents',
31964
- data
31965
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
31997
+ data,
31998
+ applications
31999
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
31966
32000
  const breadCrumbs = [];
31967
32001
  const {
31968
32002
  paginationQuery,
@@ -32000,14 +32034,14 @@ const DocumentsTable = ({
32000
32034
  data
32001
32035
  });
32002
32036
  const selectFiltersConfig = React.useMemo(() => {
32003
- return getFiltersConfig({
32037
+ return getFiltersConfig$2({
32004
32038
  t
32005
32039
  });
32006
32040
  }, [t]);
32007
32041
  React.useEffect(() => {
32008
32042
  setSelectOptions(prev => ({
32009
32043
  ...prev,
32010
- ...getFilterOptions(options)
32044
+ ...getFilterOptions$2(options)
32011
32045
  }));
32012
32046
  }, [options, t]);
32013
32047
  const handleActiveTabChange = React.useCallback(value => {
@@ -32023,13 +32057,13 @@ const DocumentsTable = ({
32023
32057
  defaultActiveTab: "all",
32024
32058
  columns: columns,
32025
32059
  data: data,
32026
- checkboxConfig: checkboxConfig,
32060
+ checkboxConfig: checkboxConfig$2,
32027
32061
  APP: APP,
32028
32062
  getApiBaseUrl: getApiBaseUrl,
32029
32063
  selectOptions: selectOptions,
32030
32064
  selectFiltersConfig: selectFiltersConfig,
32031
32065
  getRedirectLink: getRedirectLink,
32032
- filtersConfig: filtersConfig,
32066
+ filtersConfig: filtersConfig$2,
32033
32067
  isMobile: isMobile,
32034
32068
  view: "documents",
32035
32069
  getActiveTab: handleActiveTabChange,
@@ -32069,6 +32103,1386 @@ const DocumentsTable = ({
32069
32103
  });
32070
32104
  };
32071
32105
 
32106
+ const renderStatusTag$1 = ({
32107
+ value,
32108
+ t = s => s
32109
+ }) => {
32110
+ const width = 87;
32111
+ switch (value) {
32112
+ case "edited":
32113
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
32114
+ color: "yellow",
32115
+ style: {
32116
+ width
32117
+ },
32118
+ className: "text-center",
32119
+ children: t("Edited")
32120
+ });
32121
+ case "submitted":
32122
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
32123
+ color: "green",
32124
+ style: {
32125
+ width
32126
+ },
32127
+ className: "text-center",
32128
+ children: t("Submitted")
32129
+ });
32130
+ default:
32131
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
32132
+ color: "blue",
32133
+ style: {
32134
+ width
32135
+ },
32136
+ className: "text-center",
32137
+ children: t("Private")
32138
+ });
32139
+ }
32140
+ };
32141
+ const getColumns$1 = ({
32142
+ t,
32143
+ goTo,
32144
+ user,
32145
+ options,
32146
+ activeTab,
32147
+ getRedirectLink,
32148
+ theme,
32149
+ subject,
32150
+ data,
32151
+ applications
32152
+ }) => [
32153
+ // {
32154
+ // dataIndex: 'datastakeId',
32155
+ // title: t('ID'),
32156
+ // ellipsis: true,
32157
+ // show: true,
32158
+ // render: (v, all) => {
32159
+ // if (all.empty) {
32160
+ // return <div className="daf-default-cell" />
32161
+ // }
32162
+
32163
+ // return <Tooltip title={v}>{v}</Tooltip>;
32164
+ // },
32165
+ // },
32166
+ {
32167
+ dataIndex: 'name',
32168
+ title: t('Name'),
32169
+ ellipsis: true,
32170
+ show: true,
32171
+ render: (v, all) => {
32172
+ if (all.empty) {
32173
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32174
+ className: "daf-default-cell"
32175
+ });
32176
+ }
32177
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32178
+ title: v,
32179
+ children: v
32180
+ });
32181
+ }
32182
+ }, {
32183
+ dataIndex: 'mineSite',
32184
+ title: t('Position'),
32185
+ ellipsis: true,
32186
+ show: true,
32187
+ render: (v, all) => {
32188
+ if (all.empty) {
32189
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32190
+ className: "daf-default-cell"
32191
+ });
32192
+ }
32193
+
32194
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
32195
+ const mineSite = all?.location?.name;
32196
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32197
+ title: mineSite,
32198
+ children: mineSite
32199
+ }) : '-';
32200
+ }
32201
+ }, {
32202
+ dataIndex: 'activity',
32203
+ title: t('Activity'),
32204
+ ellipsis: true,
32205
+ show: true,
32206
+ render: (v, all) => {
32207
+ if (all.empty) {
32208
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32209
+ className: "daf-default-cell"
32210
+ });
32211
+ }
32212
+ const activity = findOptions(v, data?.options?.activityAtSiteOptions);
32213
+ return activity ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32214
+ title: activity,
32215
+ children: activity
32216
+ }) : '-';
32217
+ }
32218
+ }, {
32219
+ dataIndex: 'origin',
32220
+ title: t('Origin'),
32221
+ ellipsis: true,
32222
+ show: true,
32223
+ render: (v, all) => {
32224
+ if (all.empty) {
32225
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32226
+ className: "daf-default-cell"
32227
+ });
32228
+ }
32229
+ const origin = all?.placeOfBirth?.name;
32230
+ return origin ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32231
+ title: origin,
32232
+ children: origin
32233
+ }) : '-';
32234
+ }
32235
+ }, {
32236
+ title: t("Census Update"),
32237
+ dataIndex: "createdAt",
32238
+ key: "createdAt",
32239
+ render: (date, all) => {
32240
+ if (all.empty) {
32241
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32242
+ className: "daf-default-cell"
32243
+ });
32244
+ }
32245
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32246
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32247
+ title: _date,
32248
+ children: _date
32249
+ });
32250
+ },
32251
+ ellipsis: true
32252
+ }, {
32253
+ title: t("Sources"),
32254
+ dataIndex: "sources",
32255
+ key: "sources",
32256
+ show: activeTab !== "own",
32257
+ render: (val, all) => {
32258
+ if (all.empty) {
32259
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32260
+ className: "daf-default-cell"
32261
+ });
32262
+ }
32263
+ sourceAvatarConfig(val, user, applications);
32264
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32265
+ items: val
32266
+ });
32267
+ }
32268
+ }, {
32269
+ title: t("Status"),
32270
+ dataIndex: "status",
32271
+ key: "status",
32272
+ show: activeTab === "own",
32273
+ render: (val, all) => {
32274
+ if (all.empty) {
32275
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32276
+ className: "daf-default-cell"
32277
+ });
32278
+ }
32279
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
32280
+ return renderStatusTag$1({
32281
+ value: _val,
32282
+ t
32283
+ });
32284
+ }
32285
+ }, {
32286
+ id: 'actions',
32287
+ title: "",
32288
+ width: 60,
32289
+ render: (_, all) => {
32290
+ if (all.empty) {
32291
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32292
+ className: "daf-default-cell"
32293
+ });
32294
+ }
32295
+ const link = `/app/view/${subject}/${all.datastakeId}`;
32296
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32297
+ style: {
32298
+ display: "flex",
32299
+ justifyContent: "center"
32300
+ },
32301
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
32302
+ href: getRedirectLink(link),
32303
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
32304
+ name: "Link",
32305
+ size: 15,
32306
+ color: theme.baseGray70
32307
+ })
32308
+ })
32309
+ });
32310
+ }
32311
+ }].filter(column => column.show !== false);
32312
+
32313
+ const checkboxConfig$1 = {
32314
+ name: 'Name',
32315
+ datastakeId: 'ID'
32316
+ };
32317
+ const getFiltersConfig$1 = ({
32318
+ t
32319
+ }) => {
32320
+ return {
32321
+ country: {
32322
+ type: 'select',
32323
+ label: 'Country',
32324
+ placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
32325
+ style: {
32326
+ flex: 1
32327
+ },
32328
+ labelStyle: {
32329
+ flex: 1
32330
+ },
32331
+ getLabel: option => option.label,
32332
+ getValue: option => option.value
32333
+ },
32334
+ administrativeLevel1: {
32335
+ type: 'ajaxSelect',
32336
+ label: ({
32337
+ t = s => s,
32338
+ options = {},
32339
+ filters = {},
32340
+ language = 'en'
32341
+ }) => {
32342
+ const {
32343
+ administrativeLevel1
32344
+ } = options;
32345
+ if (administrativeLevel1) {
32346
+ if (options.country) {
32347
+ const _item = administrativeLevel1[filters.country];
32348
+ if (_item) {
32349
+ if (_item[language]) {
32350
+ return _item[language];
32351
+ }
32352
+ }
32353
+ }
32354
+ }
32355
+ return t('Province');
32356
+ },
32357
+ placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
32358
+ filters: data => ({
32359
+ country: data.country,
32360
+ level: 'level_1'
32361
+ }),
32362
+ show: data => !data.country,
32363
+ disabled: data => !data.country,
32364
+ mapper: {
32365
+ label: "name",
32366
+ value: "id"
32367
+ },
32368
+ method: 'getOptions',
32369
+ entity: 'AdministrativeLevel',
32370
+ style: {
32371
+ flex: 1
32372
+ },
32373
+ labelStyle: {
32374
+ flex: 1
32375
+ }
32376
+ },
32377
+ administrativeLevel2: {
32378
+ type: 'ajaxSelect',
32379
+ label: ({
32380
+ t = s => s,
32381
+ options = {},
32382
+ filters = {},
32383
+ language = 'en'
32384
+ }) => {
32385
+ const {
32386
+ administrativeLevel2
32387
+ } = options;
32388
+ if (administrativeLevel2) {
32389
+ if (options.country) {
32390
+ const _item = administrativeLevel2[filters.country];
32391
+ if (_item) {
32392
+ if (_item[language]) {
32393
+ return _item[language];
32394
+ }
32395
+ }
32396
+ }
32397
+ }
32398
+ return t('Province');
32399
+ },
32400
+ show: data => !(data.country && data.administrativeLevel1),
32401
+ placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
32402
+ filters: data => ({
32403
+ country: data.country,
32404
+ level: 'level_2',
32405
+ administrativeLevel1: data.administrativeLevel1
32406
+ }),
32407
+ disabled: data => !(data.country && data.administrativeLevel1),
32408
+ mapper: {
32409
+ label: "name",
32410
+ value: "id"
32411
+ },
32412
+ method: 'getOptions',
32413
+ entity: 'AdministrativeLevel',
32414
+ style: {
32415
+ flex: 1
32416
+ },
32417
+ labelStyle: {
32418
+ flex: 1
32419
+ }
32420
+ },
32421
+ activity: {
32422
+ type: 'select',
32423
+ label: 'Activity',
32424
+ placeholder: t => `${t('Filter by')} ${t('Activity').toLowerCase()}`,
32425
+ style: {
32426
+ flex: 1
32427
+ },
32428
+ labelStyle: {
32429
+ flex: 1
32430
+ },
32431
+ getLabel: option => option.label,
32432
+ getValue: option => option.value,
32433
+ filterOptions: val => {
32434
+ if (val) {
32435
+ const {
32436
+ option,
32437
+ filters
32438
+ } = val;
32439
+ if (filters && option) {
32440
+ const {
32441
+ filters: optionFilters
32442
+ } = option;
32443
+ if (Array.isArray(optionFilters) && optionFilters.length) {
32444
+ const {
32445
+ value,
32446
+ condition
32447
+ } = optionFilters[0];
32448
+ if (condition === 'includes') {
32449
+ return value.includes('corporation');
32450
+ }
32451
+ }
32452
+ }
32453
+ }
32454
+ return true;
32455
+ }
32456
+ },
32457
+ positionInTheMineralSupplyChain: {
32458
+ type: 'select',
32459
+ label: 'Position',
32460
+ placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
32461
+ style: {
32462
+ flex: 1
32463
+ },
32464
+ labelStyle: {
32465
+ flex: 1
32466
+ },
32467
+ getLabel: option => option.label,
32468
+ getValue: option => option.value
32469
+ },
32470
+ status: {
32471
+ type: "select",
32472
+ label: "Status",
32473
+ placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
32474
+ style: {
32475
+ flex: 1
32476
+ },
32477
+ labelStyle: {
32478
+ fley: 1
32479
+ },
32480
+ getLabel: option => option.label,
32481
+ getValue: option => option.value
32482
+ }
32483
+ };
32484
+ };
32485
+ const filtersConfig$1 = {
32486
+ name: '',
32487
+ datastakeId: ''
32488
+ };
32489
+ const getFilterOptions$1 = (options, t) => {
32490
+ const {
32491
+ statusOptions = [],
32492
+ categoryOptions = [],
32493
+ countries = [],
32494
+ subCategory = [],
32495
+ activityAtSiteOptions = [],
32496
+ stakeholderCategoryOptions,
32497
+ stakeholderSubCategoriesOptions,
32498
+ administrativeLevel1,
32499
+ administrativeLevel2,
32500
+ positionInMineralSupplyChainOptions,
32501
+ subCategoriesOptions
32502
+ } = options || {};
32503
+ const _default = {
32504
+ status: [{
32505
+ value: "submitted",
32506
+ label: "Submitted"
32507
+ }, {
32508
+ value: "private",
32509
+ label: "Private"
32510
+ }],
32511
+ category: stakeholderCategoryOptions || categoryOptions,
32512
+ country: countries,
32513
+ subCategory: subCategoriesOptions,
32514
+ activity: activityAtSiteOptions,
32515
+ administrativeLevel1,
32516
+ administrativeLevel2,
32517
+ positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions
32518
+ };
32519
+ return _default;
32520
+ };
32521
+
32522
+ const StakeholdersCreate$1 = ({
32523
+ namespace = "WORKERS",
32524
+ view = ['scoping', 'new'],
32525
+ edit = false,
32526
+ formData = {},
32527
+ loading = false,
32528
+ onSubmitted = () => {},
32529
+ onCancel = () => {},
32530
+ getData = () => {},
32531
+ saveData = () => {},
32532
+ form: formConfig = {},
32533
+ formValue = {},
32534
+ defaultData = {},
32535
+ user = {},
32536
+ APP,
32537
+ query,
32538
+ goTo = () => {},
32539
+ t = () => {},
32540
+ ajaxForms = {},
32541
+ changeAjaxForms = () => {},
32542
+ ajaxOptions = {},
32543
+ changeAjaxOptions = () => {},
32544
+ getAppHeader = () => {},
32545
+ getApiBaseUrl = () => {}
32546
+ }) => {
32547
+ let {
32548
+ form = {},
32549
+ data = defaultData || {}
32550
+ } = !edit ? formData[`${APP}-${view}`] || {} : {
32551
+ form: formConfig,
32552
+ data: formValue
32553
+ };
32554
+ React.useEffect(() => {
32555
+ if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
32556
+ if (!edit) {
32557
+ getData({
32558
+ namespace,
32559
+ module: APP,
32560
+ view,
32561
+ scope: 'global'
32562
+ });
32563
+ } else {
32564
+ form = formConfig;
32565
+ data = formValue;
32566
+ }
32567
+ }
32568
+ }, [edit, user?.language]);
32569
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32570
+ className: "daf-create-form",
32571
+ children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
32572
+ form: form,
32573
+ data: {
32574
+ ...defaultData,
32575
+ ...data
32576
+ },
32577
+ showSaveAndNext: false,
32578
+ module: APP,
32579
+ onCancel: onCancel,
32580
+ isCreate: true,
32581
+ t: t,
32582
+ excludedKeys: ["title"],
32583
+ user: user,
32584
+ ajaxForms: ajaxForms,
32585
+ ajaxOptions: ajaxOptions,
32586
+ getAppHeader: getAppHeader,
32587
+ getApiBaseUrl: getApiBaseUrl,
32588
+ changeAjaxOptions: changeAjaxOptions,
32589
+ app: APP,
32590
+ query: query,
32591
+ goTo: goTo,
32592
+ changeAjaxForms: changeAjaxForms,
32593
+ submit: (payload, setSelectedFormNext) => {
32594
+ const payloadData = {
32595
+ ...payload,
32596
+ module: APP,
32597
+ namespace
32598
+ };
32599
+ const newPayload = {
32600
+ ...defaultData,
32601
+ ...payloadData,
32602
+ form: 'worker'
32603
+ };
32604
+ const callback = (type, m, data) => {
32605
+ if (setSelectedFormNext) {
32606
+ setSelectedFormNext();
32607
+ }
32608
+ if (type === MessageTypes.SUCCESS) {
32609
+ if (onSubmitted) onSubmitted(type, m, data);
32610
+ } else {
32611
+ antd.message.error(m);
32612
+ }
32613
+ };
32614
+ saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
32615
+ id: data.id
32616
+ }), callback);
32617
+ },
32618
+ isFormDisabled: () => {
32619
+ return !data || !data.typeOfEvent;
32620
+ }
32621
+ })
32622
+ });
32623
+ };
32624
+
32625
+ const WorkersTable = ({
32626
+ t = () => {},
32627
+ goTo = () => {},
32628
+ user = {},
32629
+ options = {},
32630
+ getRedirectLink = () => {},
32631
+ theme = {},
32632
+ loading = false,
32633
+ data = {},
32634
+ isMobile,
32635
+ APP,
32636
+ location,
32637
+ getData = () => {},
32638
+ getApiBaseUrl = () => {},
32639
+ getAppHeader = () => {},
32640
+ getFormData = () => {},
32641
+ saveFormData = () => {},
32642
+ formLoading = false,
32643
+ query = {},
32644
+ ajaxForms = {},
32645
+ changeAjaxForms = () => {},
32646
+ ajaxOptions = {},
32647
+ changeAjaxOptions = () => {},
32648
+ formData = {},
32649
+ formValue = {},
32650
+ form = {},
32651
+ extendingFilters = {},
32652
+ createDefaultValues = {},
32653
+ applications = []
32654
+ }) => {
32655
+ const [selectOptions, setSelectOptions] = React.useState();
32656
+ const [activeTab, setActiveTab] = React.useState();
32657
+ const columns = React.useMemo(() => getColumns$1({
32658
+ t,
32659
+ goTo,
32660
+ user,
32661
+ options,
32662
+ activeTab,
32663
+ getRedirectLink,
32664
+ theme,
32665
+ subject: 'workers',
32666
+ data,
32667
+ applications
32668
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
32669
+ const breadCrumbs = [];
32670
+ const {
32671
+ paginationQuery,
32672
+ searchParams,
32673
+ otherParams,
32674
+ sortBy,
32675
+ sortDir
32676
+ } = useGetQueryParams({
32677
+ location
32678
+ });
32679
+ React.useMemo(() => {
32680
+ return {
32681
+ ...otherParams,
32682
+ ...extendingFilters
32683
+ };
32684
+ }, [otherParams, extendingFilters]);
32685
+ React.useEffect(() => {
32686
+ getData({
32687
+ pagination: paginationQuery,
32688
+ ...(Object.keys(searchParams).length > 0 && {
32689
+ search: searchParams
32690
+ }),
32691
+ ...otherParams,
32692
+ tab: activeTab,
32693
+ sortBy: {
32694
+ [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
32695
+ },
32696
+ ...extendingFilters
32697
+ }, 'workers');
32698
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
32699
+ const selectFiltersConfig = React.useMemo(() => {
32700
+ return getFiltersConfig$1({
32701
+ t
32702
+ });
32703
+ }, [t]);
32704
+ React.useEffect(() => {
32705
+ setSelectOptions(prev => ({
32706
+ ...prev,
32707
+ ...getFilterOptions$1(options)
32708
+ }));
32709
+ }, [options, t]);
32710
+ const handleActiveTabChange = React.useCallback(value => {
32711
+ setActiveTab(value);
32712
+ }, []);
32713
+ return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
32714
+ t: t,
32715
+ title: t("Workers"),
32716
+ breadCrumbs: breadCrumbs,
32717
+ location: location,
32718
+ loading: loading,
32719
+ goTo: goTo,
32720
+ defaultActiveTab: "all",
32721
+ columns: columns,
32722
+ data: data,
32723
+ checkboxConfig: checkboxConfig$1,
32724
+ APP: APP,
32725
+ getApiBaseUrl: getApiBaseUrl,
32726
+ selectOptions: selectOptions,
32727
+ selectFiltersConfig: selectFiltersConfig,
32728
+ getRedirectLink: getRedirectLink,
32729
+ filtersConfig: filtersConfig$1,
32730
+ isMobile: isMobile,
32731
+ view: "workers",
32732
+ getActiveTab: handleActiveTabChange,
32733
+ onDownload: () => {
32734
+ console.log("download");
32735
+ },
32736
+ drawerTitle: t("Create Worker"),
32737
+ children: ({
32738
+ onDrawerClose
32739
+ }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate$1, {
32740
+ defaultData: createDefaultValues,
32741
+ t: t,
32742
+ goTo: goTo,
32743
+ user: user,
32744
+ APP: APP,
32745
+ getApiBaseUrl: getApiBaseUrl,
32746
+ getAppHeader: getAppHeader,
32747
+ getData: getFormData,
32748
+ saveData: saveFormData,
32749
+ loading: formLoading,
32750
+ onSubmitted: (type, m, data) => {
32751
+ if (data.datastakeId) {
32752
+ displayMessage(type, t("affirmations::subject-created-successfully") || m);
32753
+ // goTo(`/app/edit/stakeholders/${data.datastakeId}`);
32754
+ goTo(`/app/edit/workers/${data.datastakeId}`);
32755
+ }
32756
+ },
32757
+ onCancel: onDrawerClose,
32758
+ query: query,
32759
+ ajaxForms: ajaxForms,
32760
+ changeAjaxForms: changeAjaxForms,
32761
+ ajaxOptions: ajaxOptions,
32762
+ changeAjaxOptions: changeAjaxOptions,
32763
+ formData: formData,
32764
+ formValue: formValue,
32765
+ form: form
32766
+ })
32767
+ });
32768
+ };
32769
+
32770
+ const getLinkValue = (value, linkingObject) => {
32771
+ if (linkingObject && linkingObject?.[value]) {
32772
+ return linkingObject?.[value]?.name;
32773
+ }
32774
+ return null;
32775
+ };
32776
+ const getEventCategoryBySubject = (eventCategoryObject, subject) => {
32777
+ if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
32778
+ return null;
32779
+ }
32780
+ const subjectSingular = subject.endsWith('ies') ? subject.slice(0, -3) + 'y' : subject.endsWith('s') ? subject.slice(0, -1) : subject;
32781
+ const key = `typeOfEvent is ${subjectSingular}`;
32782
+ return eventCategoryObject[key] || null;
32783
+ };
32784
+ const renderStatusTag = ({
32785
+ value,
32786
+ t = s => s
32787
+ }) => {
32788
+ const width = 87;
32789
+ switch (value) {
32790
+ case "edited":
32791
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
32792
+ color: "yellow",
32793
+ style: {
32794
+ width
32795
+ },
32796
+ className: "text-center",
32797
+ children: t("Edited")
32798
+ });
32799
+ case "submitted":
32800
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
32801
+ color: "green",
32802
+ style: {
32803
+ width
32804
+ },
32805
+ className: "text-center",
32806
+ children: t("Submitted")
32807
+ });
32808
+ default:
32809
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
32810
+ color: "blue",
32811
+ style: {
32812
+ width
32813
+ },
32814
+ className: "text-center",
32815
+ children: t("Private")
32816
+ });
32817
+ }
32818
+ };
32819
+ const getColumns = ({
32820
+ t,
32821
+ goTo,
32822
+ user,
32823
+ options,
32824
+ activeTab,
32825
+ getRedirectLink,
32826
+ theme,
32827
+ subject,
32828
+ data,
32829
+ applications
32830
+ }) => [{
32831
+ dataIndex: 'datastakeId',
32832
+ title: t('ID'),
32833
+ ellipsis: true,
32834
+ show: true,
32835
+ render: (v, all) => {
32836
+ if (all.empty) {
32837
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32838
+ className: "daf-default-cell"
32839
+ });
32840
+ }
32841
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32842
+ title: v,
32843
+ children: v
32844
+ });
32845
+ }
32846
+ }, {
32847
+ dataIndex: 'name',
32848
+ title: t('Title'),
32849
+ ellipsis: true,
32850
+ show: true,
32851
+ render: (v, all) => {
32852
+ if (all.empty) {
32853
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32854
+ className: "daf-default-cell"
32855
+ });
32856
+ }
32857
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32858
+ title: v,
32859
+ children: v
32860
+ });
32861
+ }
32862
+ }, {
32863
+ title: t("Date"),
32864
+ dataIndex: "date",
32865
+ key: "date",
32866
+ render: (date, all) => {
32867
+ if (all.empty) {
32868
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32869
+ className: "daf-default-cell"
32870
+ });
32871
+ }
32872
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32873
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32874
+ title: _date,
32875
+ children: _date
32876
+ });
32877
+ },
32878
+ ellipsis: true
32879
+ }, {
32880
+ dataIndex: 'mineSite',
32881
+ title: t('Location'),
32882
+ ellipsis: true,
32883
+ show: true,
32884
+ render: (v, all) => {
32885
+ if (all.empty) {
32886
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32887
+ className: "daf-default-cell"
32888
+ });
32889
+ }
32890
+
32891
+ // const country = findOptions(v, data?.options?.positionSupplyChainOptions);
32892
+ const mineSite = all?.location?.name;
32893
+ return mineSite ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32894
+ title: mineSite,
32895
+ children: mineSite
32896
+ }) : '-';
32897
+ }
32898
+ }, {
32899
+ dataIndex: 'province',
32900
+ title: t('Province'),
32901
+ ellipsis: true,
32902
+ show: true,
32903
+ render: (v, all) => {
32904
+ if (all.empty) {
32905
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32906
+ className: "daf-default-cell"
32907
+ });
32908
+ }
32909
+ const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
32910
+ return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32911
+ title: region,
32912
+ children: region
32913
+ }) : '-';
32914
+ }
32915
+ }, {
32916
+ dataIndex: 'territory',
32917
+ title: t('Territory'),
32918
+ ellipsis: true,
32919
+ show: true,
32920
+ render: (v, all) => {
32921
+ if (all.empty) {
32922
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32923
+ className: "daf-default-cell"
32924
+ });
32925
+ }
32926
+ const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
32927
+ return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32928
+ title: district,
32929
+ children: district
32930
+ }) : '-';
32931
+ }
32932
+ }, {
32933
+ dataIndex: 'eventCategory',
32934
+ title: t('Category'),
32935
+ ellipsis: true,
32936
+ show: true,
32937
+ render: (v, all) => {
32938
+ if (all.empty) {
32939
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32940
+ className: "daf-default-cell"
32941
+ });
32942
+ }
32943
+ const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
32944
+ const categoryValue = getEventCategoryBySubject(eventCategory, subject);
32945
+ return categoryValue ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32946
+ title: categoryValue,
32947
+ children: categoryValue
32948
+ }) : '-';
32949
+ }
32950
+ }, {
32951
+ title: t("Sources"),
32952
+ dataIndex: "sources",
32953
+ key: "sources",
32954
+ show: activeTab !== "own",
32955
+ render: (val, all) => {
32956
+ if (all.empty) {
32957
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32958
+ className: "daf-default-cell"
32959
+ });
32960
+ }
32961
+ const sources = sourceAvatarConfig(val, user, applications);
32962
+ return /*#__PURE__*/jsxRuntime.jsx(AvatarGroup, {
32963
+ items: sources
32964
+ });
32965
+ }
32966
+ }, {
32967
+ title: t("Status"),
32968
+ dataIndex: "status",
32969
+ key: "status",
32970
+ show: activeTab === "own",
32971
+ render: (val, all) => {
32972
+ if (all.empty) {
32973
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32974
+ className: "daf-default-cell"
32975
+ });
32976
+ }
32977
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
32978
+ return renderStatusTag({
32979
+ value: _val,
32980
+ t
32981
+ });
32982
+ }
32983
+ }, {
32984
+ title: t("Last Update"),
32985
+ dataIndex: "updatedAt",
32986
+ key: "updatedAt",
32987
+ render: (date, all) => {
32988
+ if (all.empty) {
32989
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
32990
+ className: "daf-default-cell"
32991
+ });
32992
+ }
32993
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
32994
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
32995
+ title: _date,
32996
+ children: _date
32997
+ });
32998
+ },
32999
+ ellipsis: true
33000
+ }, {
33001
+ id: 'actions',
33002
+ title: "",
33003
+ width: 60,
33004
+ render: (_, all) => {
33005
+ if (all.empty) {
33006
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
33007
+ className: "daf-default-cell"
33008
+ });
33009
+ }
33010
+ const link = `/app/view/${subject}/${all.datastakeId}`;
33011
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
33012
+ style: {
33013
+ display: "flex",
33014
+ justifyContent: "center"
33015
+ },
33016
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
33017
+ href: getRedirectLink(link),
33018
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
33019
+ name: "Link",
33020
+ size: 15,
33021
+ color: theme.baseGray70
33022
+ })
33023
+ })
33024
+ });
33025
+ }
33026
+ }].filter(column => column.show !== false);
33027
+
33028
+ const checkboxConfig = {
33029
+ name: 'Name',
33030
+ datastakeId: 'ID'
33031
+ };
33032
+ const getFiltersConfig = ({
33033
+ t
33034
+ }) => {
33035
+ return {
33036
+ country: {
33037
+ type: 'select',
33038
+ label: 'Country',
33039
+ placeholder: t => `${t('Filter by')} ${t('Country').toLowerCase()}`,
33040
+ style: {
33041
+ flex: 1
33042
+ },
33043
+ labelStyle: {
33044
+ flex: 1
33045
+ },
33046
+ getLabel: option => option.label,
33047
+ getValue: option => option.value
33048
+ },
33049
+ administrativeLevel1: {
33050
+ type: 'ajaxSelect',
33051
+ label: ({
33052
+ t = s => s,
33053
+ options = {},
33054
+ filters = {},
33055
+ language = 'en'
33056
+ }) => {
33057
+ const {
33058
+ administrativeLevel1
33059
+ } = options;
33060
+ if (administrativeLevel1) {
33061
+ if (options.country) {
33062
+ const _item = administrativeLevel1[filters.country];
33063
+ if (_item) {
33064
+ if (_item[language]) {
33065
+ return _item[language];
33066
+ }
33067
+ }
33068
+ }
33069
+ }
33070
+ return t('Province');
33071
+ },
33072
+ placeholder: t => `${t('Filter by')} ${t('Province').toLowerCase()}`,
33073
+ filters: data => ({
33074
+ country: data.country,
33075
+ level: 'level_1'
33076
+ }),
33077
+ show: data => !data.country,
33078
+ disabled: data => !data.country,
33079
+ mapper: {
33080
+ label: "name",
33081
+ value: "id"
33082
+ },
33083
+ method: 'getOptions',
33084
+ entity: 'AdministrativeLevel',
33085
+ style: {
33086
+ flex: 1
33087
+ },
33088
+ labelStyle: {
33089
+ flex: 1
33090
+ }
33091
+ },
33092
+ administrativeLevel2: {
33093
+ type: 'ajaxSelect',
33094
+ label: ({
33095
+ t = s => s,
33096
+ options = {},
33097
+ filters = {},
33098
+ language = 'en'
33099
+ }) => {
33100
+ const {
33101
+ administrativeLevel2
33102
+ } = options;
33103
+ if (administrativeLevel2) {
33104
+ if (options.country) {
33105
+ const _item = administrativeLevel2[filters.country];
33106
+ if (_item) {
33107
+ if (_item[language]) {
33108
+ return _item[language];
33109
+ }
33110
+ }
33111
+ }
33112
+ }
33113
+ return t('Province');
33114
+ },
33115
+ show: data => !(data.country && data.administrativeLevel1),
33116
+ placeholder: t => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
33117
+ filters: data => ({
33118
+ country: data.country,
33119
+ level: 'level_2',
33120
+ administrativeLevel1: data.administrativeLevel1
33121
+ }),
33122
+ disabled: data => !(data.country && data.administrativeLevel1),
33123
+ mapper: {
33124
+ label: "name",
33125
+ value: "id"
33126
+ },
33127
+ method: 'getOptions',
33128
+ entity: 'AdministrativeLevel',
33129
+ style: {
33130
+ flex: 1
33131
+ },
33132
+ labelStyle: {
33133
+ flex: 1
33134
+ }
33135
+ },
33136
+ activity: {
33137
+ type: 'select',
33138
+ label: 'Activity',
33139
+ placeholder: t => `${t('Filter by')} ${t('Activity').toLowerCase()}`,
33140
+ style: {
33141
+ flex: 1
33142
+ },
33143
+ labelStyle: {
33144
+ flex: 1
33145
+ },
33146
+ getLabel: option => option.label,
33147
+ getValue: option => option.value,
33148
+ filterOptions: val => {
33149
+ if (val) {
33150
+ const {
33151
+ option,
33152
+ filters
33153
+ } = val;
33154
+ if (filters && option) {
33155
+ const {
33156
+ filters: optionFilters
33157
+ } = option;
33158
+ if (Array.isArray(optionFilters) && optionFilters.length) {
33159
+ const {
33160
+ value,
33161
+ condition
33162
+ } = optionFilters[0];
33163
+ if (condition === 'includes') {
33164
+ return value.includes('corporation');
33165
+ }
33166
+ }
33167
+ }
33168
+ }
33169
+ return true;
33170
+ }
33171
+ },
33172
+ positionInTheMineralSupplyChain: {
33173
+ type: 'select',
33174
+ label: 'Position',
33175
+ placeholder: t => `${t('Filter by')} ${t('Position').toLowerCase()}`,
33176
+ style: {
33177
+ flex: 1
33178
+ },
33179
+ labelStyle: {
33180
+ flex: 1
33181
+ },
33182
+ getLabel: option => option.label,
33183
+ getValue: option => option.value
33184
+ },
33185
+ status: {
33186
+ type: "select",
33187
+ label: "Status",
33188
+ placeholder: t => `${t("Filter by")} ${t("Status").toLowerCase()}`,
33189
+ style: {
33190
+ flex: 1
33191
+ },
33192
+ labelStyle: {
33193
+ fley: 1
33194
+ },
33195
+ getLabel: option => option.label,
33196
+ getValue: option => option.value
33197
+ }
33198
+ };
33199
+ };
33200
+ const filtersConfig = {
33201
+ name: '',
33202
+ datastakeId: ''
33203
+ };
33204
+ const getFilterOptions = (options, t) => {
33205
+ const {
33206
+ statusOptions = [],
33207
+ categoryOptions = [],
33208
+ countries = [],
33209
+ subCategory = [],
33210
+ activityAtSiteOptions = [],
33211
+ stakeholderCategoryOptions,
33212
+ stakeholderSubCategoriesOptions,
33213
+ administrativeLevel1,
33214
+ administrativeLevel2,
33215
+ positionInMineralSupplyChainOptions,
33216
+ subCategoriesOptions
33217
+ } = options || {};
33218
+ const _default = {
33219
+ status: [{
33220
+ value: "submitted",
33221
+ label: "Submitted"
33222
+ }, {
33223
+ value: "private",
33224
+ label: "Private"
33225
+ }],
33226
+ category: stakeholderCategoryOptions || categoryOptions,
33227
+ country: countries,
33228
+ subCategory: subCategoriesOptions,
33229
+ activity: activityAtSiteOptions,
33230
+ administrativeLevel1,
33231
+ administrativeLevel2,
33232
+ positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions
33233
+ };
33234
+ return _default;
33235
+ };
33236
+
33237
+ const StakeholdersCreate = ({
33238
+ namespace = "corrective-actions",
33239
+ view = "corrective-actions",
33240
+ edit = false,
33241
+ formData = {},
33242
+ loading = false,
33243
+ onSubmitted = () => {},
33244
+ onCancel = () => {},
33245
+ getData = () => {},
33246
+ saveData = () => {},
33247
+ form: formConfig = {},
33248
+ formValue = {},
33249
+ defaultData = {},
33250
+ user = {},
33251
+ APP,
33252
+ query,
33253
+ goTo = () => {},
33254
+ t = () => {},
33255
+ ajaxForms = {},
33256
+ changeAjaxForms = () => {},
33257
+ ajaxOptions = {},
33258
+ changeAjaxOptions = () => {},
33259
+ getAppHeader = () => {},
33260
+ getApiBaseUrl = () => {}
33261
+ }) => {
33262
+ let {
33263
+ form = {},
33264
+ data = defaultData || {}
33265
+ } = !edit ? formData[`${APP}-${view}`] || {} : {
33266
+ form: formConfig,
33267
+ data: formValue
33268
+ };
33269
+ React.useEffect(() => {
33270
+ if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
33271
+ if (!edit) {
33272
+ getData({
33273
+ namespace,
33274
+ module: APP,
33275
+ view,
33276
+ scope: 'createActivity'
33277
+ });
33278
+ } else {
33279
+ form = formConfig;
33280
+ data = formValue;
33281
+ }
33282
+ }
33283
+ }, [edit, user?.language]);
33284
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
33285
+ className: "daf-create-form",
33286
+ children: /*#__PURE__*/jsxRuntime.jsx(DynamicForm, {
33287
+ form: form,
33288
+ data: {
33289
+ ...defaultData,
33290
+ ...data
33291
+ },
33292
+ showSaveAndNext: false,
33293
+ module: APP,
33294
+ onCancel: onCancel,
33295
+ isCreate: true,
33296
+ t: t,
33297
+ excludedKeys: ["title"],
33298
+ user: user,
33299
+ ajaxForms: ajaxForms,
33300
+ ajaxOptions: ajaxOptions,
33301
+ getAppHeader: getAppHeader,
33302
+ getApiBaseUrl: getApiBaseUrl,
33303
+ changeAjaxOptions: changeAjaxOptions,
33304
+ app: APP,
33305
+ query: query,
33306
+ goTo: goTo,
33307
+ changeAjaxForms: changeAjaxForms,
33308
+ submit: (payload, setSelectedFormNext) => {
33309
+ const payloadData = {
33310
+ ...payload,
33311
+ module: APP,
33312
+ namespace
33313
+ };
33314
+ const newPayload = {
33315
+ ...defaultData,
33316
+ ...payloadData,
33317
+ form: 'worker'
33318
+ };
33319
+ const callback = (type, m, data) => {
33320
+ if (setSelectedFormNext) {
33321
+ setSelectedFormNext();
33322
+ }
33323
+ if (type === MessageTypes.SUCCESS) {
33324
+ if (onSubmitted) onSubmitted(type, m, data);
33325
+ } else {
33326
+ antd.message.error(m);
33327
+ }
33328
+ };
33329
+ saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
33330
+ id: data.id
33331
+ }), callback);
33332
+ },
33333
+ isFormDisabled: () => {
33334
+ return !data || !data.typeOfEvent;
33335
+ }
33336
+ })
33337
+ });
33338
+ };
33339
+
33340
+ const ActivitiesTable = ({
33341
+ t = () => {},
33342
+ goTo = () => {},
33343
+ user = {},
33344
+ options = {},
33345
+ getRedirectLink = () => {},
33346
+ theme = {},
33347
+ loading = false,
33348
+ data = {},
33349
+ isMobile,
33350
+ APP,
33351
+ location,
33352
+ getData = () => {},
33353
+ getApiBaseUrl = () => {},
33354
+ getAppHeader = () => {},
33355
+ getFormData = () => {},
33356
+ saveFormData = () => {},
33357
+ formLoading = false,
33358
+ query = {},
33359
+ ajaxForms = {},
33360
+ changeAjaxForms = () => {},
33361
+ ajaxOptions = {},
33362
+ changeAjaxOptions = () => {},
33363
+ formData = {},
33364
+ formValue = {},
33365
+ form = {},
33366
+ extendingFilters = {},
33367
+ createDefaultValues = {},
33368
+ applications = []
33369
+ }) => {
33370
+ const [selectOptions, setSelectOptions] = React.useState();
33371
+ const [activeTab, setActiveTab] = React.useState();
33372
+ const columns = React.useMemo(() => getColumns({
33373
+ t,
33374
+ goTo,
33375
+ user,
33376
+ options,
33377
+ activeTab,
33378
+ getRedirectLink,
33379
+ theme,
33380
+ subject: 'activities',
33381
+ data,
33382
+ applications
33383
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
33384
+ const breadCrumbs = [];
33385
+ const {
33386
+ paginationQuery,
33387
+ searchParams,
33388
+ otherParams,
33389
+ sortBy,
33390
+ sortDir
33391
+ } = useGetQueryParams({
33392
+ location
33393
+ });
33394
+ React.useMemo(() => {
33395
+ return {
33396
+ ...otherParams,
33397
+ ...extendingFilters
33398
+ };
33399
+ }, [otherParams, extendingFilters]);
33400
+ React.useEffect(() => {
33401
+ getData({
33402
+ pagination: paginationQuery,
33403
+ ...(Object.keys(searchParams).length > 0 && {
33404
+ search: searchParams
33405
+ }),
33406
+ ...otherParams,
33407
+ tab: activeTab,
33408
+ sortBy: {
33409
+ [sortBy || "updatedAt"]: sortDir ? sortDir === "ascend" ? 1 : -1 : -1
33410
+ },
33411
+ ...extendingFilters
33412
+ }, 'activities');
33413
+ }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
33414
+ const selectFiltersConfig = React.useMemo(() => {
33415
+ return getFiltersConfig({
33416
+ t
33417
+ });
33418
+ }, [t]);
33419
+ React.useEffect(() => {
33420
+ setSelectOptions(prev => ({
33421
+ ...prev,
33422
+ ...getFilterOptions(options)
33423
+ }));
33424
+ }, [options, t]);
33425
+ const handleActiveTabChange = React.useCallback(value => {
33426
+ setActiveTab(value);
33427
+ }, []);
33428
+ return /*#__PURE__*/jsxRuntime.jsx(TablePageWithTabs, {
33429
+ t: t,
33430
+ title: t("Activities"),
33431
+ breadCrumbs: breadCrumbs,
33432
+ location: location,
33433
+ loading: loading,
33434
+ goTo: goTo,
33435
+ defaultActiveTab: "all",
33436
+ columns: columns,
33437
+ data: data,
33438
+ checkboxConfig: checkboxConfig,
33439
+ APP: APP,
33440
+ getApiBaseUrl: getApiBaseUrl,
33441
+ selectOptions: selectOptions,
33442
+ selectFiltersConfig: selectFiltersConfig,
33443
+ getRedirectLink: getRedirectLink,
33444
+ filtersConfig: filtersConfig,
33445
+ isMobile: isMobile,
33446
+ view: "activities",
33447
+ getActiveTab: handleActiveTabChange,
33448
+ onDownload: () => {
33449
+ console.log("download");
33450
+ },
33451
+ drawerTitle: t("Create Activity"),
33452
+ children: ({
33453
+ onDrawerClose
33454
+ }) => /*#__PURE__*/jsxRuntime.jsx(StakeholdersCreate, {
33455
+ defaultData: createDefaultValues,
33456
+ t: t,
33457
+ goTo: goTo,
33458
+ user: user,
33459
+ APP: APP,
33460
+ getApiBaseUrl: getApiBaseUrl,
33461
+ getAppHeader: getAppHeader,
33462
+ getData: getFormData,
33463
+ saveData: saveFormData,
33464
+ loading: formLoading,
33465
+ onSubmitted: (type, m, data) => {
33466
+ if (data.datastakeId) {
33467
+ displayMessage(type, t("affirmations::subject-created-successfully") || m);
33468
+ // goTo(`/app/edit/stakeholders/${data.datastakeId}`);
33469
+ goTo(`/app/edit/activities/${data.datastakeId}`);
33470
+ }
33471
+ },
33472
+ onCancel: onDrawerClose,
33473
+ query: query,
33474
+ ajaxForms: ajaxForms,
33475
+ changeAjaxForms: changeAjaxForms,
33476
+ ajaxOptions: ajaxOptions,
33477
+ changeAjaxOptions: changeAjaxOptions,
33478
+ formData: formData,
33479
+ formValue: formValue,
33480
+ form: form
33481
+ })
33482
+ });
33483
+ };
33484
+
33485
+ exports.ActivitiesTable = ActivitiesTable;
32072
33486
  exports.DocumentsTable = DocumentsTable;
32073
33487
  exports.EventsTable = EventsTable;
32074
33488
  exports.LocationsTable = LocationsTable;
@@ -32077,3 +33491,4 @@ exports.StakeholdersTable = StakeholdersTable;
32077
33491
  exports.SupplyChainDashboard = SupplyChain;
32078
33492
  exports.TablePageWithTabs = TablePageWithTabs;
32079
33493
  exports.UserDashboard = UserDashboard;
33494
+ exports.WorkersTable = WorkersTable;