datastake-daf 0.6.819 → 0.6.821

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 (76) hide show
  1. package/dist/components/index.js +2264 -1099
  2. package/dist/hooks/index.js +16 -5
  3. package/dist/pages/index.js +251 -65
  4. package/dist/services/index.js +104 -9
  5. package/dist/utils/index.js +75 -8
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/AuthForm/index.jsx +12 -3
  8. package/src/@daf/core/components/DynamicForm/_index.scss +1 -3
  9. package/src/@daf/core/components/EditForm/_index.scss +0 -4
  10. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +27 -1
  11. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +2 -3
  12. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +0 -1
  13. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -3
  14. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +1 -1
  15. package/src/@daf/core/components/Screens/Admin/AdminModals/AddAccount/index.jsx +82 -10
  16. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +51 -51
  17. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -1
  18. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +53 -31
  19. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +36 -10
  20. package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +2 -2
  21. package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +37 -10
  22. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  23. package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +81 -0
  24. package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +77 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
  26. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +22 -30
  27. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +28 -16
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +93 -0
  29. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +43 -0
  30. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +201 -0
  31. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +113 -0
  32. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +58 -0
  33. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +176 -0
  34. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +3 -6
  35. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +17 -2
  36. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/helper.js +3 -6
  37. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +27 -13
  38. package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +0 -1
  39. package/src/@daf/core/components/Screens/Admin/AdminTables/components/index.jsx +4 -2
  40. package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +3 -0
  41. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +21 -9
  42. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +16 -11
  43. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +16 -4
  44. package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +9 -17
  45. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +12 -16
  46. package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +124 -99
  47. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +44 -28
  48. package/src/@daf/hooks/useAdminDashboard.js +7 -4
  49. package/src/@daf/hooks/useSources.js +2 -1
  50. package/src/@daf/pages/Events/columns.js +15 -3
  51. package/src/@daf/pages/Locations/MineSite/columns.js +18 -1
  52. package/src/@daf/pages/TablePage/columns.js +2 -0
  53. package/src/@daf/pages/TablePage/hook.js +0 -2
  54. package/src/@daf/pages/View/hooks/useViewActions.js +13 -0
  55. package/src/@daf/pages/View/hooks/useViewPermissions.js +16 -0
  56. package/src/@daf/pages/View/index.jsx +32 -4
  57. package/src/@daf/services/AdminService.js +80 -8
  58. package/src/@daf/services/DashboardService.js +3 -3
  59. package/src/@daf/utils/filters.js +13 -15
  60. package/src/constants/locales/en/translation.js +24 -4
  61. package/src/constants/locales/fr/translation.js +17 -0
  62. package/src/constants/locales/sp/translation.js +28 -7
  63. package/src/helpers/copyToClipboard.js +60 -0
  64. package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +0 -395
  65. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/configTransformer.js +0 -137
  66. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.js +0 -9
  67. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +0 -196
  68. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/configTransformer.js +0 -216
  69. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.js +0 -7
  70. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +0 -184
  71. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +0 -64
  72. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +0 -10
  73. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +0 -77
  74. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +0 -51
  75. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
  76. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +0 -76
@@ -1783,9 +1783,13 @@ const useSources = ({
1783
1783
  type,
1784
1784
  id,
1785
1785
  user,
1786
- t = () => {}
1786
+ t = () => {},
1787
+ stop
1787
1788
  }) => {
1788
1789
  function getData(params) {
1790
+ if (stop) return Promise.resolve({
1791
+ data: []
1792
+ });
1789
1793
  if (id !== undefined && id !== null) {
1790
1794
  return SourceService$1.getSources({
1791
1795
  type,
@@ -2229,14 +2233,17 @@ class DashboardService extends BaseService {
2229
2233
  isApp: true
2230
2234
  });
2231
2235
  }
2232
- getUserGrowth(activeFilter) {
2233
- return this.apiGet({
2236
+ async getUserGrowth(activeFilter) {
2237
+ const {
2238
+ data
2239
+ } = await this.apiGet({
2234
2240
  url: `/accounts/dashboard/user-growth`,
2235
2241
  isUserManager: true,
2236
2242
  params: {
2237
2243
  activeFilter
2238
2244
  }
2239
2245
  });
2246
+ return data;
2240
2247
  }
2241
2248
  getAdminDashboard() {
2242
2249
  return this.apiGet({
@@ -2338,14 +2345,18 @@ function useAdminDashboard({
2338
2345
  setLoading(false);
2339
2346
  }
2340
2347
  }, [dashboardService, onError]);
2341
- const fetchUserGrowth = React.useCallback(async params => {
2348
+ const fetchUserGrowth = React.useCallback(async activeFilter => {
2342
2349
  if (!dashboardService?.getUserGrowth) {
2343
2350
  console.warn("dashboardService.getUserGrowth not provided");
2344
2351
  return;
2345
2352
  }
2353
+ if (activeFilter === undefined || activeFilter === null) {
2354
+ console.warn("activeFilter not provided to fetchUserGrowth");
2355
+ return;
2356
+ }
2346
2357
  setUserGrowthDataLoading(true);
2347
2358
  try {
2348
- const response = await dashboardService.getUserGrowth(params);
2359
+ const response = await dashboardService.getUserGrowth(activeFilter);
2349
2360
  setUserGrowthData(response || []);
2350
2361
  } catch (err) {
2351
2362
  if (onError) {
@@ -7312,6 +7312,9 @@ class ErrorService {
7312
7312
  return e.join('\n');
7313
7313
  }
7314
7314
  }
7315
+ const handleError = err => {
7316
+ antd.message.error(err?.response?.data?.message);
7317
+ };
7315
7318
 
7316
7319
  // In datastake-daf - src/services/BaseService.js
7317
7320
  class BaseService extends BaseHTTPService {
@@ -7429,14 +7432,17 @@ class DashboardService extends BaseService {
7429
7432
  isApp: true
7430
7433
  });
7431
7434
  }
7432
- getUserGrowth(activeFilter) {
7433
- return this.apiGet({
7435
+ async getUserGrowth(activeFilter) {
7436
+ const {
7437
+ data
7438
+ } = await this.apiGet({
7434
7439
  url: `/accounts/dashboard/user-growth`,
7435
7440
  isUserManager: true,
7436
7441
  params: {
7437
7442
  activeFilter
7438
7443
  }
7439
7444
  });
7445
+ return data;
7440
7446
  }
7441
7447
  getAdminDashboard() {
7442
7448
  return this.apiGet({
@@ -42822,14 +42828,29 @@ const getColumns$b = ({
42822
42828
  items: sources
42823
42829
  });
42824
42830
  }
42831
+ }, {
42832
+ title: t("Author"),
42833
+ dataIndex: "author",
42834
+ key: "author",
42835
+ show: activeTab === "own",
42836
+ render: (value, all) => {
42837
+ if (all.empty) {
42838
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
42839
+ className: "daf-default-cell"
42840
+ });
42841
+ }
42842
+ const author = value?.name;
42843
+ return author ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
42844
+ title: author,
42845
+ children: author
42846
+ }) : '-';
42847
+ },
42848
+ ellipsis: true
42825
42849
  }, {
42826
42850
  title: t("Status"),
42827
42851
  dataIndex: "status",
42828
42852
  key: "status",
42829
42853
  show: activeTab === "own",
42830
- correctiveActions: activeTab === "own",
42831
- testimonials: activeTab === "own",
42832
- incident: activeTab === "own",
42833
42854
  render: (value, all) => {
42834
42855
  if (all.empty) {
42835
42856
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -44757,6 +44778,29 @@ const getColumns$6 = ({
44757
44778
  children: category
44758
44779
  });
44759
44780
  }
44781
+ }, {
44782
+ dataIndex: 'products',
44783
+ title: t('Products'),
44784
+ ellipsis: true,
44785
+ show: APP === 'nashiriki',
44786
+ render: (v, all) => {
44787
+ if (all.empty) {
44788
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
44789
+ className: "daf-default-cell"
44790
+ });
44791
+ }
44792
+ const products = v?.map(product => product?.typeOfProduct);
44793
+ const productOptions = findOptions(products, options?.minerals || options?.mineralOptions);
44794
+ return productOptions?.length > 0 ? /*#__PURE__*/jsxRuntime.jsx(MoreTags, {
44795
+ values: productOptions,
44796
+ limit: 1,
44797
+ tagColor: "processing",
44798
+ style: {
44799
+ fontWeight: "normal",
44800
+ fontSize: 14
44801
+ }
44802
+ }) : '-';
44803
+ }
44760
44804
  }, {
44761
44805
  dataIndex: 'operator',
44762
44806
  title: t('Operator'),
@@ -45382,7 +45426,8 @@ const getColumns$3 = ({
45382
45426
  theme,
45383
45427
  subject,
45384
45428
  data,
45385
- applications
45429
+ applications,
45430
+ APP
45386
45431
  }) => {
45387
45432
  const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
45388
45433
  return registry?.columns({
@@ -45395,7 +45440,8 @@ const getColumns$3 = ({
45395
45440
  theme,
45396
45441
  subject,
45397
45442
  data,
45398
- applications
45443
+ applications,
45444
+ APP
45399
45445
  });
45400
45446
  };
45401
45447
 
@@ -45479,9 +45525,6 @@ const useTablePage = ({
45479
45525
  t,
45480
45526
  subject
45481
45527
  }), [t, subject, getFiltersConfig$1]);
45482
- console.log({
45483
- options
45484
- });
45485
45528
  React.useEffect(() => {
45486
45529
  setSelectOptions(prev => ({
45487
45530
  ...prev,
@@ -52559,48 +52602,6 @@ styled__default["default"].div`
52559
52602
  width: calc(100% - 48px);
52560
52603
  `;
52561
52604
 
52562
- styled__default["default"].div`
52563
- display: flex;
52564
- flex-direction: column;
52565
- gap: 10px;
52566
- height: fit-content;
52567
- margin-top: 24px;
52568
-
52569
- .daf-table {
52570
- margin-top: 12px;
52571
- }
52572
-
52573
- .merge-modal-section-text {
52574
- font-family: SF UI Display;
52575
- font-weight: 500;
52576
- font-style: Medium;
52577
- font-size: 14px;
52578
- leading-trim: NONE;
52579
- line-height: 20px;
52580
- margin-left: 30px;
52581
- letter-spacing: 0%;
52582
- }
52583
-
52584
- .select-container {
52585
- padding: 12px 24px;
52586
- border: 1px solid;
52587
- border-radius: 8px;
52588
- margin: 2px 30px 48px 30px;
52589
- display: flex;
52590
- flex-wrap: wrap;
52591
- gap: 10px;
52592
-
52593
- .ant-form-item {
52594
- margin-bottom: 0;
52595
- }
52596
-
52597
- @media (max-width: 868px) {
52598
- flex-direction: column;
52599
- gap: 10px;
52600
- }
52601
- }
52602
- `;
52603
-
52604
52605
  class AdminService extends BaseService {
52605
52606
  updateCompany(id, data) {
52606
52607
  return this.apiPut({
@@ -52624,6 +52625,20 @@ class AdminService extends BaseService {
52624
52625
  data
52625
52626
  });
52626
52627
  }
52628
+ resendInvitation({
52629
+ invitationToken
52630
+ }) {
52631
+ return this.apiPost({
52632
+ url: `/accounts/resendInvitation/${invitationToken}`
52633
+ });
52634
+ }
52635
+ copyInvitation({
52636
+ invitationToken
52637
+ }) {
52638
+ return this.apiPost({
52639
+ url: `/accounts/copyInvitation/${invitationToken}`
52640
+ });
52641
+ }
52627
52642
  inviteAccount(data) {
52628
52643
  return this.apiPost({
52629
52644
  url: `/accounts/inviteAccount`,
@@ -52640,8 +52655,15 @@ class AdminService extends BaseService {
52640
52655
  }
52641
52656
  updateAccount({
52642
52657
  data,
52643
- id
52658
+ id,
52659
+ isPending = false
52644
52660
  }) {
52661
+ if (isPending) {
52662
+ return this.apiPut({
52663
+ data,
52664
+ url: `/accounts/invitation/${id}`
52665
+ });
52666
+ }
52645
52667
  return this.apiPut({
52646
52668
  data,
52647
52669
  url: `/accounts/${id}`
@@ -52655,11 +52677,11 @@ class AdminService extends BaseService {
52655
52677
  });
52656
52678
  }
52657
52679
  transferAdmin({
52658
- userId,
52659
- id
52680
+ companyId,
52681
+ userId
52660
52682
  }) {
52661
52683
  return this.apiPut({
52662
- url: `/accounts/transfer-rights/${id}`,
52684
+ url: `/companies/${companyId}/transfer-rights`,
52663
52685
  data: {
52664
52686
  userId
52665
52687
  }
@@ -52756,6 +52778,58 @@ class AdminService extends BaseService {
52756
52778
  url: `/management/subject/${subject}/${id}`
52757
52779
  });
52758
52780
  }
52781
+ getItems({
52782
+ item
52783
+ }) {
52784
+ return this.apiGet({
52785
+ url: `/management/items/${item}`
52786
+ });
52787
+ }
52788
+ getItemForm({
52789
+ item,
52790
+ scope = "create"
52791
+ }) {
52792
+ return this.apiGet({
52793
+ url: `/forms/${item}`,
52794
+ params: {
52795
+ scope
52796
+ }
52797
+ });
52798
+ }
52799
+ getItemData({
52800
+ item,
52801
+ id
52802
+ }) {
52803
+ return this.apiGet({
52804
+ url: `/management/item/${item}/${id}`
52805
+ });
52806
+ }
52807
+ deleteItem({
52808
+ item,
52809
+ id
52810
+ }) {
52811
+ return this.apiDelete({
52812
+ url: `/management/item/${item}/${id}`
52813
+ });
52814
+ }
52815
+ updateItem({
52816
+ item,
52817
+ id,
52818
+ data
52819
+ }) {
52820
+ return this.apiPut({
52821
+ url: `/management/item/${item}/${id}`,
52822
+ data
52823
+ });
52824
+ }
52825
+ viewItem({
52826
+ item,
52827
+ id
52828
+ }) {
52829
+ return this.apiGet({
52830
+ url: `/management/item/${item}/${id}`
52831
+ });
52832
+ }
52759
52833
  viewLocation({
52760
52834
  id
52761
52835
  }) {
@@ -52778,7 +52852,7 @@ class AdminService extends BaseService {
52778
52852
  const type = subject === 'location' ? 'location' : 'stakeholder';
52779
52853
  return this.apiPut({
52780
52854
  url: `/management/subject/${type}/${id}`,
52781
- data: filterCreateData(data)
52855
+ data: data
52782
52856
  });
52783
52857
  }
52784
52858
  deleteSubject({
@@ -52790,17 +52864,78 @@ class AdminService extends BaseService {
52790
52864
  url: `/management/subject/${type}/${id}`
52791
52865
  });
52792
52866
  }
52793
- getUserGrowth(activeFilter) {
52794
- return this.apiGet({
52867
+ async getUserGrowth(activeFilter) {
52868
+ const {
52869
+ data
52870
+ } = await this.apiGet({
52795
52871
  url: `/accounts/dashboard/user-growth`,
52796
52872
  isUserManager: true,
52797
52873
  params: {
52798
52874
  activeFilter
52799
52875
  }
52800
52876
  });
52877
+ return data;
52878
+ }
52879
+ removeUserFromAccount({
52880
+ accountId,
52881
+ userId
52882
+ }) {
52883
+ return this.apiPut({
52884
+ url: `/companies/${accountId}/remove-user/${userId}`
52885
+ });
52886
+ }
52887
+ getTopContributors({
52888
+ params
52889
+ }) {
52890
+ return this.apiGet({
52891
+ url: `/accounts/dashboard/top-contributors`,
52892
+ params
52893
+ });
52801
52894
  }
52802
52895
  }
52803
- createLazyService(AdminService);
52896
+ var AdminService$1 = createLazyService(AdminService);
52897
+
52898
+ styled__default["default"].div`
52899
+ display: flex;
52900
+ flex-direction: column;
52901
+ gap: 10px;
52902
+ height: fit-content;
52903
+ margin-top: 24px;
52904
+
52905
+ .daf-table {
52906
+ margin-top: 12px;
52907
+ }
52908
+
52909
+ .merge-modal-section-text {
52910
+ font-family: SF UI Display;
52911
+ font-weight: 500;
52912
+ font-style: Medium;
52913
+ font-size: 14px;
52914
+ leading-trim: NONE;
52915
+ line-height: 20px;
52916
+ margin-left: 30px;
52917
+ letter-spacing: 0%;
52918
+ }
52919
+
52920
+ .select-container {
52921
+ padding: 12px 24px;
52922
+ border: 1px solid;
52923
+ border-radius: 8px;
52924
+ margin: 2px 30px 48px 30px;
52925
+ display: flex;
52926
+ flex-wrap: wrap;
52927
+ gap: 10px;
52928
+
52929
+ .ant-form-item {
52930
+ margin-bottom: 0;
52931
+ }
52932
+
52933
+ @media (max-width: 868px) {
52934
+ flex-direction: column;
52935
+ gap: 10px;
52936
+ }
52937
+ }
52938
+ `;
52804
52939
 
52805
52940
  const Styles = styled__default["default"].div`
52806
52941
  width: 100%;
@@ -61147,7 +61282,8 @@ const useViewPermissions = ({
61147
61282
  id,
61148
61283
  namespaceOverrides = {
61149
61284
  supportedNamespaces: {},
61150
- canEdit: {}
61285
+ canEdit: {},
61286
+ canDelete: {}
61151
61287
  },
61152
61288
  namespace,
61153
61289
  user,
@@ -61158,6 +61294,9 @@ const useViewPermissions = ({
61158
61294
  viewConfig
61159
61295
  }) => {
61160
61296
  const baseNamespaceKeys = Object.keys(namespaceConfig || {});
61297
+ console.log({
61298
+ namespaceConfig
61299
+ });
61161
61300
  const baseSupportedNamespaces = baseNamespaceKeys?.reduce((acc, key) => {
61162
61301
  acc[key] = () => true;
61163
61302
  return acc;
@@ -61181,6 +61320,16 @@ const useViewPermissions = ({
61181
61320
  };
61182
61321
  return canEditAction[namespace] ? canEditAction[namespace]() : false;
61183
61322
  }, [namespace, data, user]);
61323
+ const canDelete = React.useMemo(() => {
61324
+ baseNamespaceKeys.reduce((acc, key) => {
61325
+ acc[key] = () => isUserData();
61326
+ return acc;
61327
+ }, {});
61328
+ const canDeleteAction = {
61329
+ ...namespaceOverrides.canDelete
61330
+ };
61331
+ return canDeleteAction[namespace] ? canDeleteAction[namespace]() : false;
61332
+ }, [namespace, data, user, namespaceOverrides]);
61184
61333
  React.useEffect(() => {
61185
61334
  if (data) {
61186
61335
  if (typeof isSupportedNamespaces[namespace] === "function") {
@@ -61193,7 +61342,8 @@ const useViewPermissions = ({
61193
61342
  return {
61194
61343
  isSupportedNamespaces,
61195
61344
  canEdit,
61196
- isSupported
61345
+ isSupported,
61346
+ canDelete
61197
61347
  };
61198
61348
  };
61199
61349
 
@@ -61312,7 +61462,9 @@ const useViewActions = ({
61312
61462
  getRedirectLink,
61313
61463
  t,
61314
61464
  viewConfig,
61315
- buttonActions
61465
+ buttonActions,
61466
+ canDelete,
61467
+ deleteSubject
61316
61468
  }) => {
61317
61469
  const [pageActions, setPageActions] = React.useState([]);
61318
61470
  const [extraPageActions, setExtraPageActions] = React.useState([]);
@@ -61343,9 +61495,19 @@ const useViewActions = ({
61343
61495
  }
61344
61496
  }
61345
61497
  }
61498
+ if (canDelete) {
61499
+ if (viewConfig.deleteNamespaces.includes(namespace)) {
61500
+ actions.push(buttonActions.createDeleteButton(t, deleteSubject));
61501
+ }
61502
+ }
61346
61503
  if (viewConfig.summaryNamespaces.includes(namespace)) {
61347
61504
  extraActions.push(buttonActions.createSummaryButton(t, namespace, data, push, getRedirectLink));
61348
61505
  extraActions.push(buttonActions.createRecordsButton(t, setOpenRecordsModal));
61506
+ if (canDelete) {
61507
+ if (viewConfig.deleteNamespaces.includes(namespace)) {
61508
+ extraActions.push(buttonActions.createDeleteButton(t, deleteSubject));
61509
+ }
61510
+ }
61349
61511
  }
61350
61512
  setPageActions(actions);
61351
61513
  setExtraPageActions(extraActions);
@@ -61811,6 +61973,9 @@ const View = ({
61811
61973
  }) => {
61812
61974
  const getNamespaceConfig = namespace => namespaceConfiguration?.[namespace] || {};
61813
61975
  const [openRecordsModal, setOpenRecordsModal] = React.useState(false);
61976
+ console.log({
61977
+ partners
61978
+ });
61814
61979
 
61815
61980
  // HANDLES THE URL PARAMS FOR THE VIEW PAGE
61816
61981
  const {
@@ -61859,7 +62024,8 @@ const View = ({
61859
62024
  });
61860
62025
  const {
61861
62026
  canEdit,
61862
- isSupported
62027
+ isSupported,
62028
+ canDelete
61863
62029
  } = useViewPermissions({
61864
62030
  data,
61865
62031
  id,
@@ -61892,6 +62058,23 @@ const View = ({
61892
62058
  data,
61893
62059
  serviceMap
61894
62060
  });
62061
+ const subjects = {
62062
+ "management-location": "location",
62063
+ "management-stakeholder": "stakeholder"
62064
+ };
62065
+ const handleDeleteSubject = React.useCallback(async () => {
62066
+ try {
62067
+ await AdminService$1.deleteSubject({
62068
+ subject: subjects[namespace],
62069
+ id: id
62070
+ });
62071
+ antd.message.success(t("Subject deleted successfully"));
62072
+ push(getRedirectLink(`/app/management/subject/${subjects[namespace]}`));
62073
+ } catch (error) {
62074
+ handleError(error);
62075
+ antd.message.error(t("Failed to delete subject"));
62076
+ }
62077
+ }, [namespace, id, t, push, getRedirectLink]);
61895
62078
  const {
61896
62079
  pageActions,
61897
62080
  extraPageActions
@@ -61911,7 +62094,9 @@ const View = ({
61911
62094
  getRedirectLink,
61912
62095
  t,
61913
62096
  viewConfig,
61914
- buttonActions
62097
+ buttonActions,
62098
+ canDelete,
62099
+ deleteSubject: handleDeleteSubject
61915
62100
  });
61916
62101
  React.useEffect(() => {
61917
62102
  if (namespace && id && namespaceConfig && typeof getSubjectsDetails === 'function') {
@@ -61955,6 +62140,7 @@ const View = ({
61955
62140
  return null;
61956
62141
  }, [namespace, match, data]);
61957
62142
  const sourceOptions = React.useMemo(() => {
62143
+ if (!partners) return [];
61958
62144
  return partners.map(partner => {
61959
62145
  const isOwnData = partner.id === user?.company?.id;
61960
62146
  return {