datastake-daf 0.6.818 → 0.6.820

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 (95) hide show
  1. package/dist/components/index.js +2978 -1820
  2. package/dist/hooks/index.js +16 -5
  3. package/dist/pages/index.js +294 -95
  4. package/dist/services/index.js +104 -14
  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/core/components/ViewForm/components/Records/config.js +1 -0
  49. package/src/@daf/core/components/ViewForm/components/Records/index.jsx +0 -1
  50. package/src/@daf/hooks/useAdminDashboard.js +7 -4
  51. package/src/@daf/hooks/useSources.js +2 -1
  52. package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/config.js +2 -2
  53. package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/index.js +3 -2
  54. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +4 -1
  55. package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/config.js +3 -3
  56. package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/index.jsx +4 -2
  57. package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/config.js +2 -2
  58. package/src/@daf/pages/Dashboards/UserDashboard/config.js +2 -2
  59. package/src/@daf/pages/Dashboards/UserDashboard/index.jsx +1 -0
  60. package/src/@daf/pages/Dashboards/helper.js +2 -2
  61. package/src/@daf/pages/Events/columns.js +15 -3
  62. package/src/@daf/pages/Events/config.js +1 -1
  63. package/src/@daf/pages/Locations/MineSite/columns.js +19 -2
  64. package/src/@daf/pages/TablePage/columns.js +2 -0
  65. package/src/@daf/pages/TablePage/create.jsx +3 -1
  66. package/src/@daf/pages/View/hooks/useViewActions.js +13 -0
  67. package/src/@daf/pages/View/hooks/useViewPermissions.js +16 -0
  68. package/src/@daf/pages/View/index.jsx +33 -5
  69. package/src/@daf/services/AdminService.js +80 -8
  70. package/src/@daf/services/DashboardService.js +3 -3
  71. package/src/@daf/services/LinkedSubjects.js +1 -1
  72. package/src/@daf/utils/filters.js +13 -15
  73. package/src/constants/locales/en/translation.js +24 -4
  74. package/src/constants/locales/fr/translation.js +17 -0
  75. package/src/constants/locales/sp/translation.js +28 -7
  76. package/src/helpers/copyToClipboard.js +60 -0
  77. package/build/favicon.ico +0 -0
  78. package/build/logo192.png +0 -0
  79. package/build/logo512.png +0 -0
  80. package/build/manifest.json +0 -25
  81. package/build/robots.txt +0 -3
  82. package/dist/style/datastake/mapbox-gl.css +0 -330
  83. package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +0 -395
  84. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/configTransformer.js +0 -137
  85. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.js +0 -9
  86. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +0 -196
  87. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/configTransformer.js +0 -216
  88. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.js +0 -7
  89. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +0 -184
  90. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +0 -64
  91. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +0 -10
  92. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +0 -77
  93. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +0 -51
  94. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
  95. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +0 -76
@@ -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({
@@ -7523,14 +7529,15 @@ const getRowConfig$1 = ({
7523
7529
  data = {},
7524
7530
  goTo,
7525
7531
  getRedirectLink,
7526
- theme = {}
7532
+ theme = {},
7533
+ APP
7527
7534
  }) => [{
7528
7535
  label: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorNavigateLabel, {
7529
7536
  t: t,
7530
7537
  getRedirectLink: getRedirectLink,
7531
7538
  theme: theme,
7532
7539
  label: "Identified Mine Sites",
7533
- link: "/app/production-sites"
7540
+ link: APP === 'nashiriki' ? '/app/scl' : '/app/production-sites'
7534
7541
  }),
7535
7542
  render: () => {
7536
7543
  return /*#__PURE__*/jsxRuntime.jsx("span", {
@@ -8137,7 +8144,8 @@ function KeyIndicators$1({
8137
8144
  theme = {},
8138
8145
  getRedirectLink = () => {},
8139
8146
  t = () => {},
8140
- goTo = () => {}
8147
+ goTo = () => {},
8148
+ APP
8141
8149
  }) {
8142
8150
  const fetchConfig = React.useMemo(() => ({
8143
8151
  ...defaultFetchConfig$6,
@@ -8161,9 +8169,10 @@ function KeyIndicators$1({
8161
8169
  },
8162
8170
  goTo,
8163
8171
  getRedirectLink,
8164
- theme
8172
+ theme,
8173
+ APP
8165
8174
  });
8166
- }, [t, data, goTo, getRedirectLink, theme]);
8175
+ }, [t, data, goTo, getRedirectLink, theme, APP]);
8167
8176
  return /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
8168
8177
  t: t,
8169
8178
  config: config,
@@ -12732,7 +12741,7 @@ const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
12732
12741
  number: 0,
12733
12742
  name: item.name,
12734
12743
  sources: parentId ? [parentId] : [],
12735
- subTitle: findOptions(item?.category, options?.categoriesOptions),
12744
+ subTitle: findOptions(item?.category, options?.categoriesOptions || options?.category || []),
12736
12745
  leftIcon: type === "client" ? rightIcon : leftIcon,
12737
12746
  leftBackground: type === "client" ? rightBackground : leftBackground,
12738
12747
  topIcon: mapIcon(item.category),
@@ -12749,7 +12758,7 @@ const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
12749
12758
  id: data.id,
12750
12759
  number: 0,
12751
12760
  name: data.name,
12752
- subTitle: findOptions(data?.category, options?.categoriesOptions),
12761
+ subTitle: findOptions(data?.category, options?.categoriesOptions || options?.category || []),
12753
12762
  leftIcon: middleIcon,
12754
12763
  leftBackground: theme.colorPrimary10,
12755
12764
  topIcon: mapIcon(data.category),
@@ -13907,7 +13916,9 @@ function SupplyChain({
13907
13916
  setSelectedPartners,
13908
13917
  informationSources,
13909
13918
  hardcodedData,
13910
- breadcrumbs = []
13919
+ breadcrumbs = [],
13920
+ supportText,
13921
+ APP
13911
13922
  }) {
13912
13923
  const sourceOptions = React.useMemo(() => {
13913
13924
  if (!partners?.length) return [];
@@ -13950,6 +13961,7 @@ function SupplyChain({
13950
13961
  defaultSelected: partners?.map(p => p.id) || []
13951
13962
  }, partners?.length)
13952
13963
  }),
13964
+ supportText: supportText,
13953
13965
  breadcrumbs: breadcrumbs
13954
13966
  }),
13955
13967
  children: [/*#__PURE__*/jsxRuntime.jsx("section", {
@@ -13958,7 +13970,8 @@ function SupplyChain({
13958
13970
  theme: theme,
13959
13971
  t: t,
13960
13972
  goTo: goTo,
13961
- getRedirectLink: getRedirectLink
13973
+ getRedirectLink: getRedirectLink,
13974
+ APP: APP
13962
13975
  })
13963
13976
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
13964
13977
  children: /*#__PURE__*/jsxRuntime.jsx(SupplyChainMap, {
@@ -13995,11 +14008,11 @@ const getActionWidgetsConfig = ({
13995
14008
  }) => [{
13996
14009
  icon: "MineSite",
13997
14010
  title: t("Create Mine Site"),
13998
- onClick: () => goTo(getRedirectLink("/app/production-sites?create=true"))
14011
+ onClick: () => goTo(getRedirectLink(`/app/${APP === 'nashiriki' ? 'scl' : 'production-sites'}?create=true`))
13999
14012
  }, {
14000
14013
  icon: "FileEdit",
14001
14014
  title: "Report Activity",
14002
- onClick: () => goTo(getRedirectLink("/app/activities?create=true"))
14015
+ onClick: () => goTo(getRedirectLink(`/app/${APP === 'nashiriki' ? 'corrective-actions' : 'activities'}?create=true`))
14003
14016
  }, {
14004
14017
  icon: "ReportIncidents",
14005
14018
  title: "Report Incident",
@@ -14060,7 +14073,8 @@ const getRowConfig = ({
14060
14073
  data = {},
14061
14074
  goTo,
14062
14075
  getRedirectLink,
14063
- theme = {}
14076
+ theme = {},
14077
+ APP
14064
14078
  }) => [{
14065
14079
  label: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorNavigateLabel, {
14066
14080
  t: t,
@@ -14090,8 +14104,8 @@ const getRowConfig = ({
14090
14104
  t: t,
14091
14105
  getRedirectLink: getRedirectLink,
14092
14106
  theme: theme,
14093
- label: "Activities",
14094
- link: "/app/activities"
14107
+ label: APP === 'nashiriki' ? 'Corrective Actions' : 'Activities',
14108
+ link: APP === 'nashiriki' ? '/app/corrective-actions' : '/app/activities'
14095
14109
  }),
14096
14110
  render: () => {
14097
14111
  return /*#__PURE__*/jsxRuntime.jsx("span", {
@@ -14134,7 +14148,8 @@ function KeyIndicators({
14134
14148
  goTo = () => {},
14135
14149
  getRedirectLink = () => {},
14136
14150
  theme = {},
14137
- partners = []
14151
+ partners = [],
14152
+ APP
14138
14153
  }) {
14139
14154
  const fetchConfig = React.useMemo(() => ({
14140
14155
  ...defaultFetchConfig$5
@@ -14153,8 +14168,9 @@ function KeyIndicators({
14153
14168
  },
14154
14169
  goTo,
14155
14170
  getRedirectLink,
14156
- theme
14157
- }), [t, data, goTo, getRedirectLink, partners, theme]);
14171
+ theme,
14172
+ APP
14173
+ }), [t, data, goTo, getRedirectLink, partners, theme, APP]);
14158
14174
  return /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
14159
14175
  t: t,
14160
14176
  config: config,
@@ -14185,7 +14201,7 @@ const getFiltersConfig$e = ({
14185
14201
  const value = filters.type ? {
14186
14202
  value: filters.type
14187
14203
  } : {};
14188
- const eventCategoryOptions = (options?.eventCategoryOptions || [])?.map(item => ({
14204
+ const eventCategoryOptions = (options?.eventCategoryOptions || options?.categoryOptions || [])?.map(item => ({
14189
14205
  value: item.value,
14190
14206
  label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
14191
14207
  }));
@@ -14196,7 +14212,7 @@ const getFiltersConfig$e = ({
14196
14212
  key: "category",
14197
14213
  type: "select",
14198
14214
  ...value,
14199
- options: options?.categoriesOptions ?? []
14215
+ options: options?.categoriesOptions || options?.category || []
14200
14216
  }];
14201
14217
  }
14202
14218
  if (activeTab === 'event') {
@@ -15487,7 +15503,8 @@ function UserDashboard({
15487
15503
  partners: informationSourcesCount,
15488
15504
  t: t,
15489
15505
  goTo: goTo,
15490
- getRedirectLink: getRedirectLink
15506
+ getRedirectLink: getRedirectLink,
15507
+ APP: APP
15491
15508
  })
15492
15509
  }), /*#__PURE__*/jsxRuntime.jsx("section", {
15493
15510
  children: /*#__PURE__*/jsxRuntime.jsx(MineSites, {
@@ -41038,6 +41055,10 @@ const Create = ({
41038
41055
  ...payloadData,
41039
41056
  form: formType
41040
41057
  };
41058
+ const {
41059
+ datastakeId,
41060
+ ...finalPayload
41061
+ } = newPayload;
41041
41062
  const callback = (type, m, data) => {
41042
41063
  if (setSelectedFormNext) {
41043
41064
  setSelectedFormNext();
@@ -41048,7 +41069,7 @@ const Create = ({
41048
41069
  antd.message.error(m);
41049
41070
  }
41050
41071
  };
41051
- saveData(!data && !data.id ? newPayload : Object.assign(newPayload, {
41072
+ saveData(!data && !data.id ? finalPayload : Object.assign(finalPayload, {
41052
41073
  id: data.id
41053
41074
  }), callback);
41054
41075
  },
@@ -42487,7 +42508,7 @@ const getFilterOptions$9 = (options, t) => {
42487
42508
  category,
42488
42509
  eventCategoryOptions
42489
42510
  } = options || {};
42490
- const catOptions = eventCategoryOptions?.map(item => ({
42511
+ const catOptions = (eventCategoryOptions || categoryOptions || [])?.map(item => ({
42491
42512
  value: item.value,
42492
42513
  label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
42493
42514
  }));
@@ -42807,14 +42828,29 @@ const getColumns$b = ({
42807
42828
  items: sources
42808
42829
  });
42809
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
42810
42849
  }, {
42811
42850
  title: t("Status"),
42812
42851
  dataIndex: "status",
42813
42852
  key: "status",
42814
42853
  show: activeTab === "own",
42815
- correctiveActions: activeTab === "own",
42816
- testimonials: activeTab === "own",
42817
- incident: activeTab === "own",
42818
42854
  render: (value, all) => {
42819
42855
  if (all.empty) {
42820
42856
  return /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -44742,6 +44778,29 @@ const getColumns$6 = ({
44742
44778
  children: category
44743
44779
  });
44744
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
+ }
44745
44804
  }, {
44746
44805
  dataIndex: 'operator',
44747
44806
  title: t('Operator'),
@@ -44834,7 +44893,7 @@ const getColumns$6 = ({
44834
44893
  label: t("Summary"),
44835
44894
  value: "Summary",
44836
44895
  onClick: () => {
44837
- let link = `/app/${subject === 'scl' ? 'summary/scl' : 'mine-summary'}/${all.datastakeId}`;
44896
+ let link = `/app/mine-summary/${all.datastakeId}`;
44838
44897
  if (activeTab === "shared") {
44839
44898
  link += `?sourceId=${all?.authorId?.id}`;
44840
44899
  }
@@ -45367,7 +45426,8 @@ const getColumns$3 = ({
45367
45426
  theme,
45368
45427
  subject,
45369
45428
  data,
45370
- applications
45429
+ applications,
45430
+ APP
45371
45431
  }) => {
45372
45432
  const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
45373
45433
  return registry?.columns({
@@ -45380,7 +45440,8 @@ const getColumns$3 = ({
45380
45440
  theme,
45381
45441
  subject,
45382
45442
  data,
45383
- applications
45443
+ applications,
45444
+ APP
45384
45445
  });
45385
45446
  };
45386
45447
 
@@ -50912,6 +50973,7 @@ const getSourcesType = subject => {
50912
50973
  locations: "location",
50913
50974
  location: "location",
50914
50975
  "production-sites": "location",
50976
+ scl: "location",
50915
50977
  stakeholders: "stakeholder",
50916
50978
  stakeholder: "stakeholder",
50917
50979
  workers: "stakeholder",
@@ -50969,9 +51031,6 @@ const Records = ({
50969
51031
  source: selectedSource
50970
51032
  }
50971
51033
  });
50972
- console.log({
50973
- data
50974
- });
50975
51034
  setVersions(data);
50976
51035
  } catch (error) {
50977
51036
  console.error('Error fetching versions:', error);
@@ -52543,48 +52602,6 @@ styled__default["default"].div`
52543
52602
  width: calc(100% - 48px);
52544
52603
  `;
52545
52604
 
52546
- styled__default["default"].div`
52547
- display: flex;
52548
- flex-direction: column;
52549
- gap: 10px;
52550
- height: fit-content;
52551
- margin-top: 24px;
52552
-
52553
- .daf-table {
52554
- margin-top: 12px;
52555
- }
52556
-
52557
- .merge-modal-section-text {
52558
- font-family: SF UI Display;
52559
- font-weight: 500;
52560
- font-style: Medium;
52561
- font-size: 14px;
52562
- leading-trim: NONE;
52563
- line-height: 20px;
52564
- margin-left: 30px;
52565
- letter-spacing: 0%;
52566
- }
52567
-
52568
- .select-container {
52569
- padding: 12px 24px;
52570
- border: 1px solid;
52571
- border-radius: 8px;
52572
- margin: 2px 30px 48px 30px;
52573
- display: flex;
52574
- flex-wrap: wrap;
52575
- gap: 10px;
52576
-
52577
- .ant-form-item {
52578
- margin-bottom: 0;
52579
- }
52580
-
52581
- @media (max-width: 868px) {
52582
- flex-direction: column;
52583
- gap: 10px;
52584
- }
52585
- }
52586
- `;
52587
-
52588
52605
  class AdminService extends BaseService {
52589
52606
  updateCompany(id, data) {
52590
52607
  return this.apiPut({
@@ -52608,6 +52625,20 @@ class AdminService extends BaseService {
52608
52625
  data
52609
52626
  });
52610
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
+ }
52611
52642
  inviteAccount(data) {
52612
52643
  return this.apiPost({
52613
52644
  url: `/accounts/inviteAccount`,
@@ -52624,8 +52655,15 @@ class AdminService extends BaseService {
52624
52655
  }
52625
52656
  updateAccount({
52626
52657
  data,
52627
- id
52658
+ id,
52659
+ isPending = false
52628
52660
  }) {
52661
+ if (isPending) {
52662
+ return this.apiPut({
52663
+ data,
52664
+ url: `/accounts/invitation/${id}`
52665
+ });
52666
+ }
52629
52667
  return this.apiPut({
52630
52668
  data,
52631
52669
  url: `/accounts/${id}`
@@ -52639,11 +52677,11 @@ class AdminService extends BaseService {
52639
52677
  });
52640
52678
  }
52641
52679
  transferAdmin({
52642
- userId,
52643
- id
52680
+ companyId,
52681
+ userId
52644
52682
  }) {
52645
52683
  return this.apiPut({
52646
- url: `/accounts/transfer-rights/${id}`,
52684
+ url: `/companies/${companyId}/transfer-rights`,
52647
52685
  data: {
52648
52686
  userId
52649
52687
  }
@@ -52740,6 +52778,58 @@ class AdminService extends BaseService {
52740
52778
  url: `/management/subject/${subject}/${id}`
52741
52779
  });
52742
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
+ }
52743
52833
  viewLocation({
52744
52834
  id
52745
52835
  }) {
@@ -52762,7 +52852,7 @@ class AdminService extends BaseService {
52762
52852
  const type = subject === 'location' ? 'location' : 'stakeholder';
52763
52853
  return this.apiPut({
52764
52854
  url: `/management/subject/${type}/${id}`,
52765
- data: filterCreateData(data)
52855
+ data: data
52766
52856
  });
52767
52857
  }
52768
52858
  deleteSubject({
@@ -52774,17 +52864,78 @@ class AdminService extends BaseService {
52774
52864
  url: `/management/subject/${type}/${id}`
52775
52865
  });
52776
52866
  }
52777
- getUserGrowth(activeFilter) {
52778
- return this.apiGet({
52867
+ async getUserGrowth(activeFilter) {
52868
+ const {
52869
+ data
52870
+ } = await this.apiGet({
52779
52871
  url: `/accounts/dashboard/user-growth`,
52780
52872
  isUserManager: true,
52781
52873
  params: {
52782
52874
  activeFilter
52783
52875
  }
52784
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
+ });
52785
52894
  }
52786
52895
  }
52787
- 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
+ `;
52788
52939
 
52789
52940
  const Styles = styled__default["default"].div`
52790
52941
  width: 100%;
@@ -61131,7 +61282,8 @@ const useViewPermissions = ({
61131
61282
  id,
61132
61283
  namespaceOverrides = {
61133
61284
  supportedNamespaces: {},
61134
- canEdit: {}
61285
+ canEdit: {},
61286
+ canDelete: {}
61135
61287
  },
61136
61288
  namespace,
61137
61289
  user,
@@ -61142,6 +61294,9 @@ const useViewPermissions = ({
61142
61294
  viewConfig
61143
61295
  }) => {
61144
61296
  const baseNamespaceKeys = Object.keys(namespaceConfig || {});
61297
+ console.log({
61298
+ namespaceConfig
61299
+ });
61145
61300
  const baseSupportedNamespaces = baseNamespaceKeys?.reduce((acc, key) => {
61146
61301
  acc[key] = () => true;
61147
61302
  return acc;
@@ -61165,6 +61320,16 @@ const useViewPermissions = ({
61165
61320
  };
61166
61321
  return canEditAction[namespace] ? canEditAction[namespace]() : false;
61167
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]);
61168
61333
  React.useEffect(() => {
61169
61334
  if (data) {
61170
61335
  if (typeof isSupportedNamespaces[namespace] === "function") {
@@ -61177,7 +61342,8 @@ const useViewPermissions = ({
61177
61342
  return {
61178
61343
  isSupportedNamespaces,
61179
61344
  canEdit,
61180
- isSupported
61345
+ isSupported,
61346
+ canDelete
61181
61347
  };
61182
61348
  };
61183
61349
 
@@ -61296,7 +61462,9 @@ const useViewActions = ({
61296
61462
  getRedirectLink,
61297
61463
  t,
61298
61464
  viewConfig,
61299
- buttonActions
61465
+ buttonActions,
61466
+ canDelete,
61467
+ deleteSubject
61300
61468
  }) => {
61301
61469
  const [pageActions, setPageActions] = React.useState([]);
61302
61470
  const [extraPageActions, setExtraPageActions] = React.useState([]);
@@ -61327,9 +61495,19 @@ const useViewActions = ({
61327
61495
  }
61328
61496
  }
61329
61497
  }
61498
+ if (canDelete) {
61499
+ if (viewConfig.deleteNamespaces.includes(namespace)) {
61500
+ actions.push(buttonActions.createDeleteButton(t, deleteSubject));
61501
+ }
61502
+ }
61330
61503
  if (viewConfig.summaryNamespaces.includes(namespace)) {
61331
61504
  extraActions.push(buttonActions.createSummaryButton(t, namespace, data, push, getRedirectLink));
61332
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
+ }
61333
61511
  }
61334
61512
  setPageActions(actions);
61335
61513
  setExtraPageActions(extraActions);
@@ -61529,11 +61707,6 @@ class LinkedSubjectsService extends BaseService {
61529
61707
  getForm({
61530
61708
  namespace
61531
61709
  }, language = "en", scope) {
61532
- console.log({
61533
- namespace,
61534
- language,
61535
- scope
61536
- });
61537
61710
  return this.apiGet({
61538
61711
  url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
61539
61712
  isApp: true,
@@ -61800,6 +61973,9 @@ const View = ({
61800
61973
  }) => {
61801
61974
  const getNamespaceConfig = namespace => namespaceConfiguration?.[namespace] || {};
61802
61975
  const [openRecordsModal, setOpenRecordsModal] = React.useState(false);
61976
+ console.log({
61977
+ partners
61978
+ });
61803
61979
 
61804
61980
  // HANDLES THE URL PARAMS FOR THE VIEW PAGE
61805
61981
  const {
@@ -61848,7 +62024,8 @@ const View = ({
61848
62024
  });
61849
62025
  const {
61850
62026
  canEdit,
61851
- isSupported
62027
+ isSupported,
62028
+ canDelete
61852
62029
  } = useViewPermissions({
61853
62030
  data,
61854
62031
  id,
@@ -61881,6 +62058,23 @@ const View = ({
61881
62058
  data,
61882
62059
  serviceMap
61883
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]);
61884
62078
  const {
61885
62079
  pageActions,
61886
62080
  extraPageActions
@@ -61900,7 +62094,9 @@ const View = ({
61900
62094
  getRedirectLink,
61901
62095
  t,
61902
62096
  viewConfig,
61903
- buttonActions
62097
+ buttonActions,
62098
+ canDelete,
62099
+ deleteSubject: handleDeleteSubject
61904
62100
  });
61905
62101
  React.useEffect(() => {
61906
62102
  if (namespace && id && namespaceConfig && typeof getSubjectsDetails === 'function') {
@@ -61944,6 +62140,7 @@ const View = ({
61944
62140
  return null;
61945
62141
  }, [namespace, match, data]);
61946
62142
  const sourceOptions = React.useMemo(() => {
62143
+ if (!partners) return [];
61947
62144
  return partners.map(partner => {
61948
62145
  const isOwnData = partner.id === user?.company?.id;
61949
62146
  return {
@@ -61978,7 +62175,9 @@ const View = ({
61978
62175
  children: /*#__PURE__*/jsxRuntime.jsx(Multiselect, {
61979
62176
  options: [...sourceOptions],
61980
62177
  isAvatarGroup: true,
61981
- selectionType: "checkbox",
62178
+ selectionType: "checkbox"
62179
+ // key={partners?.length}
62180
+ ,
61982
62181
  canUnselectLast: false,
61983
62182
  isSingle: true,
61984
62183
  onChange: selected => {
@@ -61990,7 +62189,7 @@ const View = ({
61990
62189
  },
61991
62190
  dropDownWidth: 200,
61992
62191
  defaultSelected: (partners || []).map(p => p.id) || []
61993
- }, partners?.length)
62192
+ })
61994
62193
  })
61995
62194
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
61996
62195
  className: "view-content",