datastake-daf 0.6.813 → 0.6.814

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 (56) 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/components/index.js +3056 -4315
  7. package/dist/hooks/index.js +4 -11
  8. package/dist/layouts/index.js +478 -464
  9. package/dist/pages/index.js +490 -576
  10. package/dist/services/index.js +6 -56
  11. package/dist/style/datastake/mapbox-gl.css +330 -0
  12. package/dist/utils/index.js +483 -492
  13. package/package.json +1 -1
  14. package/src/@daf/core/components/AuthForm/index.jsx +3 -12
  15. package/src/@daf/core/components/Icon/configs/index.js +3 -1
  16. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -0
  17. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -0
  18. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +3 -1
  19. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +51 -51
  20. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +1 -6
  21. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +31 -56
  22. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +10 -36
  23. package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +1 -1
  24. package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +10 -37
  25. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  26. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +0 -2
  27. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +30 -22
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +13 -25
  29. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +2 -17
  30. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +13 -27
  31. package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +1 -0
  32. package/src/@daf/core/components/Screens/Admin/AdminTables/components/index.jsx +2 -4
  33. package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +0 -3
  34. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +9 -12
  35. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +4 -16
  36. package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +17 -9
  37. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +8 -9
  38. package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +99 -124
  39. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +1 -48
  40. package/src/@daf/hooks/useAdminDashboard.js +4 -7
  41. package/src/@daf/pages/View/hooks/useViewActions.js +0 -13
  42. package/src/@daf/pages/View/hooks/useViewPermissions.js +0 -16
  43. package/src/@daf/pages/View/index.jsx +4 -29
  44. package/src/@daf/services/AdminService.js +5 -47
  45. package/src/@daf/services/DashboardService.js +3 -3
  46. package/src/@daf/utils/filters.js +15 -13
  47. package/src/constants/locales/en/translation.js +0 -13
  48. package/src/helpers/copyToClipboard.js +0 -60
  49. package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +0 -81
  50. package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +0 -77
  51. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +0 -127
  52. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +0 -43
  53. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +0 -201
  54. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +0 -146
  55. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +0 -58
  56. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +0 -176
@@ -1,30 +1,30 @@
1
1
  import React, { useState, useEffect } from "react";
2
- import { Checkbox, message } from 'antd';
2
+ import { Checkbox, Form, Input, message } from 'antd';
3
3
  import DafButton from '../../../Button/index.jsx';
4
4
  import Loading from "../../../Loading/index.jsx";
5
- import AuthForm from "../../../AuthForm/index.jsx";
6
5
 
7
-
8
-
9
- const theme = window.theme;
10
6
  export default function AppInvitation({
7
+ // Redux State
11
8
  errors,
12
9
  user,
13
10
  invitationSuccess,
11
+ // Actions
14
12
  confirmInvitation,
15
13
  getUserFromInvitation,
16
- theme,
14
+ // Configuration
17
15
  Layout,
18
16
  redirectPath = "/",
19
17
  loginPath = "/login",
20
18
  appRedirectPath = "/app",
21
19
  params: propParams = {},
22
- goTo,
23
- isMobile = false,
24
- t,
25
20
  }) {
26
- const { app, companyCode, userCode } = propParams;
21
+ const { t } = useTranslation();
22
+ const routeParams = useParams();
23
+ const { app, companyCode, userCode } = { ...routeParams, ...propParams };
24
+ const [passwords] = Form.useForm();
27
25
  const [checking, setChecking] = useState(true);
26
+ const goTo = useNavigate();
27
+ const [termsAgreed, setTermsAgreed] = useState(false);
28
28
  const [passwordReseted, setPasswordReseted] = useState(false);
29
29
 
30
30
  useEffect(() => {
@@ -46,125 +46,36 @@ export default function AppInvitation({
46
46
  localStorage.setItem('token', data.token);
47
47
  }
48
48
  message.success(t('Invitation accepted'));
49
- if (goTo && typeof goTo === 'function') {
50
- goTo(redirectPath);
51
- } else {
52
- window.location.href = redirectPath;
53
- }
49
+ // Fix: ensure we don't rely on a variable from useParams that might not exist
50
+ // Just use the configured redirectPath
51
+ goTo(redirectPath);
54
52
  },
55
53
  { companyCode, userCode }
56
54
  );
57
55
  }
58
56
  }, [invitationSuccess, user, confirmInvitation, goTo, redirectPath, companyCode, userCode, t]);
59
57
 
60
-
61
- useEffect(() => {
62
-
63
- const isInInvitationFlow = checking ||
64
- (invitationSuccess && user && user.inviteToken) ||
65
- (invitationSuccess && user && !user.inviteToken);
66
-
67
- if (!isInInvitationFlow) {
68
- if (user) {
69
- if (goTo && typeof goTo === 'function') {
70
- goTo(appRedirectPath);
71
- } else {
72
- window.location.href = appRedirectPath;
73
- }
74
- } else {
75
- if (goTo && typeof goTo === 'function') {
76
- goTo(redirectPath);
77
- } else {
78
- window.location.href = redirectPath;
79
- }
80
- }
81
- }
82
- }, [user, goTo, appRedirectPath, redirectPath, checking, invitationSuccess]);
58
+ const displayError = (name) => {
59
+ return errors && errors[name] && errors[name].length > 0 && {
60
+ help: errors[name][0],
61
+ validateStatus: 'error',
62
+ };
63
+ };
83
64
 
84
65
  const subTitle = !passwordReseted ? 'Set up your password and agree with out terms and conditions.' :
85
66
  isMobile ? 'Your account has been successfully set up. To log in use a desktop device.'
86
67
  : 'Your account has been successfully set up. Please click the button below to log in.';
87
68
  const title = passwordReseted ? 'Thank You!' : undefined;
88
69
 
89
- const fields = [
90
- {
91
- name: 'email',
92
- label: t("Email"),
93
- type: 'input',
94
- disabled: true,
95
- },
96
- {
97
- name: 'password',
98
- label: t("Password"),
99
- type: 'password',
100
- required: true,
101
- rules: [{
102
- required: true,
103
- message: t("errors::password should not be empty")
104
- }],
105
- placeholder: t("Password"),
106
- },
107
- {
108
- name: 'confirmPassword',
109
- label: t("Confirm Password"),
110
- type: 'password',
111
- required: true,
112
- dependencies: ['password'],
113
- rules: [
114
- {
115
- required: true,
116
- message: t("errors::password should not be empty"),
117
- },
118
- ({ getFieldValue }) => ({
119
- validator(rule, value) {
120
- if (!value || getFieldValue('password') === value) {
121
- return Promise.resolve();
122
- }
123
- return Promise.reject(t('errors::passwordNotMatch'));
124
- },
125
- }),
126
- ],
127
- placeholder: t("Confirm Password"),
128
- },
129
- {
130
- name: 'mailUpdates',
131
- type: 'custom',
132
- valuePropName: 'checked',
133
- component: <Checkbox>{t("Sign up to receive updates")}</Checkbox>,
134
- },
135
- {
136
- name: 'agreeTerms',
137
- type: 'custom',
138
- valuePropName: 'checked',
139
- rules: [{
140
- validator: (_, value) => value ? Promise.resolve() : Promise.reject(new Error(t('You must agree to the terms and conditions')))
141
- }],
142
- component: (
143
- <Checkbox>
144
- <p className="mb-0">
145
- {t('Agree to the Terms of Use of this application and the Privacy Policy')}
146
- </p>
147
- </Checkbox>
148
- ),
149
- }
150
- ];
151
-
152
- const handleSubmit = (values) => {
153
- const { password, mailUpdates } = values;
154
- confirmInvitation(
155
- { password, mailUpdates },
156
- () => { },
157
- { companyCode, userCode }
158
- );
159
- setPasswordReseted(true);
160
- };
161
-
162
70
  if (checking && !invitationSuccess) {
163
71
  return <Loading />;
164
72
  }
165
73
 
74
+ // If auto-confirming (inviteToken present), we might want to show loading or nothing until redirect
166
75
  if (invitationSuccess && user && user.inviteToken) {
167
-
76
+ // The useEffect will handle the redirect/confirm.
77
+ // We can show loading here too or just return null.
78
+ // Original code: checks invitationSuccess && !user.inviteToken for form, else redirect.
168
79
  return <Loading />;
169
80
  }
170
81
 
@@ -177,7 +88,6 @@ export default function AppInvitation({
177
88
  <DafButton
178
89
  type="primary"
179
90
  className="normal-br"
180
- style={theme || window.theme ? { backgroundColor: (theme || window.theme).colorPrimary, borderColor: (theme || window.theme).colorPrimary } : {}}
181
91
  onClick={() => {
182
92
  window.location.href = loginPath;
183
93
  }}
@@ -187,21 +97,86 @@ export default function AppInvitation({
187
97
  )}
188
98
  </div>
189
99
  ) : (
190
- <AuthForm
191
- fields={fields}
192
- onSubmit={handleSubmit}
193
- submitText={t("Confirm")}
194
- initialValues={{ email: user?.email }}
195
- errors={errors}
196
- t={t}
197
- executeRecaptcha={() => Promise.resolve(true)}
198
- theme={theme || window.theme}
199
- />
100
+ <>
101
+ <Form name="password" layout="vertical" form={passwords} >
102
+ <Form.Item
103
+ required
104
+ name="password"
105
+ {...displayError('password')}
106
+ label={t("Password")}
107
+ rules={[{
108
+ required: true,
109
+ message: t("errors::password should not be empty")
110
+ }]}>
111
+ <Input.Password size="large" placeholder={t("Password")} />
112
+ </Form.Item>
113
+ <Form.Item
114
+ required
115
+ name="confirmPassword"
116
+ {...displayError('confirmPassword')}
117
+ label={t("Confirm Password")}
118
+ dependencies={['password']}
119
+ rules={[
120
+ {
121
+ required: true,
122
+ message: t("errors::password should not be empty"),
123
+ },
124
+ ({ getFieldValue }) => ({
125
+ validator(rule, value) {
126
+ if (!value || getFieldValue('password') === value) {
127
+ return Promise.resolve();
128
+ }
129
+ return Promise.reject(t('errors::passwordNotMatch'));
130
+ },
131
+ }),
132
+ ]}>
133
+ <Input.Password size="large" placeholder={t("Confirm Password")} />
134
+ </Form.Item>
135
+ <Form.Item
136
+ name="mailUpdates" valuePropName="checked" noStyle>
137
+ <Checkbox>{t("Sign up to receive updates")}</Checkbox>
138
+ </Form.Item>
139
+ <Form.Item
140
+ name="agreeTerms" valuePropName="checked" noStyle>
141
+ <Checkbox
142
+ checked={termsAgreed}
143
+ onChange={(e) => setTermsAgreed(e.target.checked)}
144
+ >
145
+ <p className="mb-0">
146
+ {t('Agree to the Terms of Use of this application and the Privacy Policy')}
147
+ </p>
148
+ </Checkbox>
149
+ </Form.Item>
150
+ </Form>
151
+ <div className="buttons">
152
+ <DafButton
153
+ className="normal-br"
154
+ type="primary"
155
+ block
156
+ size="large"
157
+ disabled={!termsAgreed}
158
+ onClick={() => {
159
+ passwords.validateFields().then(data => {
160
+ const { password, mailUpdates } = data;
161
+ confirmInvitation(
162
+ { password, mailUpdates },
163
+ () => { },
164
+ { companyCode, userCode }
165
+ );
166
+ setPasswordReseted(true);
167
+ });
168
+ }}
169
+ >
170
+ {t("Confirm")}
171
+ </DafButton>
172
+ </div>
173
+ </>
200
174
  )}
201
175
  </>
202
176
  );
203
177
 
204
178
  if (Layout) {
179
+ // Assuming Layout accepts these props as per Nashiriki AuthLayout
205
180
  return <Layout app={app} step={1} subTitle={subTitle} title={title}>{Content}</Layout>;
206
181
  }
207
182
 
@@ -214,5 +189,5 @@ export default function AppInvitation({
214
189
  );
215
190
  }
216
191
 
217
- return null;
192
+ return user ? <Navigate to={appRedirectPath} /> : <Navigate to={redirectPath} />;
218
193
  }
@@ -6,8 +6,7 @@ import AdminAccountsViewScreen from "./AdminScreens/AccountsView.jsx";
6
6
  import AdminSubjectsScreen from "./AdminScreens/Subjects.jsx";
7
7
  import AdminLocationScreen from "./AdminScreens/Location.jsx";
8
8
  import AdminSubjectsViewScreen from "./AdminScreens/SubjectsView.jsx";
9
- import AdminEventsScreen from "./AdminScreens/Events.jsx";
10
- import AdminDocumentsScreen from "./AdminScreens/Documents.jsx";
9
+
11
10
  export function getAdminRoutes(config) {
12
11
  const {
13
12
  appName,
@@ -19,8 +18,6 @@ export function getAdminRoutes(config) {
19
18
  useAdminLocationConfig,
20
19
  useAdminSubjectsViewConfig,
21
20
  useAdminLocationViewConfig,
22
- useAdminDocumentsConfig,
23
- useAdminEventsConfig,
24
21
  userIsAdmin,
25
22
  } = config;
26
23
 
@@ -94,31 +91,11 @@ export function getAdminRoutes(config) {
94
91
  return <AdminSubjectsViewScreen config={{ ...stakeholderViewConfig, subject: "stakeholder", mode: "edit" }} />;
95
92
  }
96
93
 
97
- function DocumentsWrapper() {
98
- const documentsConfig =
99
- typeof useAdminDocumentsConfig === "function"
100
- ? useAdminDocumentsConfig()
101
- : undefined;
102
- return <AdminDocumentsScreen config={documentsConfig} />;
103
- }
104
-
105
- function EventsWrapper() {
106
- const eventsConfig =
107
- typeof useAdminEventsConfig === "function"
108
- ? useAdminEventsConfig()
109
- : undefined;
110
- return <AdminEventsScreen config={eventsConfig} />;
111
- }
112
-
113
94
  const subjectsIndexComponent =
114
95
  typeof useAdminLocationConfig === "function"
115
96
  ? <LocationWrapper />
116
97
  : typeof useAdminSubjectsConfig === "function"
117
98
  ? <SubjectsWrapper />
118
- : typeof useAdminDocumentsConfig === "function"
119
- ? <DocumentsWrapper />
120
- : typeof useAdminEventsConfig === "function"
121
- ? <EventsWrapper />
122
99
  : <div />;
123
100
 
124
101
  const routes = [
@@ -179,30 +156,6 @@ export function getAdminRoutes(config) {
179
156
  visible: (user) => userIsAdmin(user),
180
157
  component: <SubjectsWrapper />,
181
158
  },
182
-
183
- ]
184
-
185
- : []),
186
- ...(typeof useAdminDocumentsConfig === "function"
187
- ? [
188
- {
189
- path: "management/subjects/document",
190
- key: `${APP_PREFIX}_ADMIN_SUBJECTS_DOCUMENTS`,
191
- exact: true,
192
- visible: (user) => userIsAdmin(user),
193
- component: <DocumentsWrapper />,
194
- },
195
- ]
196
- : []),
197
- ...(typeof useAdminEventsConfig === "function"
198
- ? [
199
- {
200
- path: "management/subjects/event",
201
- key: `${APP_PREFIX}_ADMIN_SUBJECTS_EVENTS`,
202
- exact: true,
203
- visible: (user) => userIsAdmin(user),
204
- component: <EventsWrapper />,
205
- },
206
159
  ]
207
160
  : []),
208
161
  ];
@@ -46,20 +46,15 @@ export function useAdminDashboard({ dashboardService, onError }) {
46
46
  }, [dashboardService, onError]);
47
47
 
48
48
  const fetchUserGrowth = useCallback(
49
- async (activeFilter) => {
49
+ async (params) => {
50
50
  if (!dashboardService?.getUserGrowth) {
51
51
  console.warn("dashboardService.getUserGrowth not provided");
52
52
  return;
53
53
  }
54
54
 
55
- if (activeFilter === undefined || activeFilter === null) {
56
- console.warn("activeFilter not provided to fetchUserGrowth");
57
- return;
58
- }
59
-
60
55
  setUserGrowthDataLoading(true);
61
56
  try {
62
- const response = await dashboardService.getUserGrowth(activeFilter);
57
+ const response = await dashboardService.getUserGrowth(params);
63
58
  setUserGrowthData(response || []);
64
59
  } catch (err) {
65
60
  if (onError) {
@@ -73,9 +68,11 @@ export function useAdminDashboard({ dashboardService, onError }) {
73
68
  },
74
69
  [dashboardService, onError]
75
70
  );
71
+
76
72
  useEffect(() => {
77
73
  fetchDashboardData();
78
74
  }, [fetchDashboardData]);
75
+
79
76
  return {
80
77
  data,
81
78
  loading,
@@ -17,8 +17,6 @@ export const useViewActions = ({
17
17
  t,
18
18
  viewConfig,
19
19
  buttonActions,
20
- canDelete,
21
- deleteSubject,
22
20
  }) => {
23
21
  const [pageActions, setPageActions] = useState([]);
24
22
  const [extraPageActions, setExtraPageActions] = useState([]);
@@ -52,12 +50,6 @@ export const useViewActions = ({
52
50
  }
53
51
  }
54
52
  }
55
-
56
- if(canDelete) {
57
- if(viewConfig.deleteNamespaces.includes(namespace)){
58
- actions.push(buttonActions.createDeleteButton(t, deleteSubject))
59
- }
60
- }
61
53
 
62
54
  if (viewConfig.summaryNamespaces.includes(namespace)) {
63
55
  extraActions.push(
@@ -66,11 +58,6 @@ export const useViewActions = ({
66
58
  extraActions.push(
67
59
  buttonActions.createRecordsButton(t, setOpenRecordsModal)
68
60
  );
69
- if(canDelete) {
70
- if(viewConfig.deleteNamespaces.includes(namespace)){
71
- extraActions.push(buttonActions.createDeleteButton(t, deleteSubject))
72
- }
73
- }
74
61
  }
75
62
 
76
63
  setPageActions(actions);
@@ -6,7 +6,6 @@ export const useViewPermissions = ({
6
6
  namespaceOverrides = {
7
7
  supportedNamespaces: {},
8
8
  canEdit: {},
9
- canDelete: {},
10
9
  },
11
10
  namespace,
12
11
  user,
@@ -17,7 +16,6 @@ export const useViewPermissions = ({
17
16
  viewConfig,
18
17
  }) => {
19
18
  const baseNamespaceKeys = Object.keys(namespaceConfig || {});
20
- console.log({namespaceConfig})
21
19
 
22
20
  const baseSupportedNamespaces = baseNamespaceKeys?.reduce((acc, key) => {
23
21
  acc[key] = () => true;
@@ -57,19 +55,6 @@ export const useViewPermissions = ({
57
55
  return canEditAction[namespace] ? canEditAction[namespace]() : false;
58
56
  }, [namespace, data, user]);
59
57
 
60
- const canDelete = useMemo(() => {
61
- const basecanDeleteAction = baseNamespaceKeys.reduce((acc, key) => {
62
- acc[key] = () => isUserData();
63
- return acc;
64
- }, {});
65
-
66
- const canDeleteAction = {
67
- ...namespaceOverrides.canDelete,
68
- };
69
-
70
- return canDeleteAction[namespace] ? canDeleteAction[namespace]() : false;
71
- }, [namespace, data, user, namespaceOverrides])
72
-
73
58
  useEffect(() => {
74
59
  if (data) {
75
60
  if (typeof isSupportedNamespaces[namespace] === "function") {
@@ -84,7 +69,6 @@ export const useViewPermissions = ({
84
69
  isSupportedNamespaces,
85
70
  canEdit,
86
71
  isSupported,
87
- canDelete
88
72
  }
89
73
 
90
74
  }
@@ -1,11 +1,11 @@
1
- import React, { useMemo, useState, useEffect, useCallback } from 'react'
1
+ import React, { useMemo, useState, useEffect } from 'react'
2
2
  import { useViewUrlParams } from './hooks/useViewUrlParams.js'
3
3
  import { usePrepareForm } from './hooks/usePrepareForm.js'
4
4
  import { useViewPermissions } from './hooks/useViewPermissions.js'
5
5
  import { useSubmitSubject } from './hooks/useSubmitSubject.js'
6
6
  import { useCallToGetData } from './hooks/useCallToGetData.js'
7
7
  import { useViewActions } from './hooks/useViewActions.js'
8
- import AdminService from '../../services/AdminService.js'
8
+
9
9
  import { groupSubsections } from '../../../@daf/core/components/ViewForm/helper.js'
10
10
  import Loading from '../../../@daf/core/components/Loading/index.jsx'
11
11
  import Header from '../../../@daf/core/components/Header/index.jsx'
@@ -14,8 +14,7 @@ import ViewFormNavigation from '../../../@daf/core/components/ViewForm/navigatio
14
14
  import ViewForm from '../../../@daf/core/components/ViewForm/content.jsx'
15
15
  import Records from '../../../@daf/core/components/ViewForm/components/Records/index.jsx'
16
16
  import { Template } from '../Template/index.jsx'
17
- import {message} from 'antd'
18
- import { handleError } from '../../services/ErrorService.js'
17
+
19
18
  const View = ({
20
19
  push,
21
20
  getRedirectLink,
@@ -103,7 +102,7 @@ const View = ({
103
102
  viewConfig,
104
103
  });
105
104
 
106
- const { canEdit, isSupported, canDelete } = useViewPermissions({
105
+ const { canEdit, isSupported } = useViewPermissions({
107
106
  data,
108
107
  id,
109
108
  namespace,
@@ -133,28 +132,6 @@ const View = ({
133
132
  serviceMap,
134
133
  });
135
134
 
136
-
137
- const subjects = {
138
- "management-location": "location",
139
- "management-stakeholder": "stakeholder",
140
- }
141
-
142
-
143
- const handleDeleteSubject = useCallback(async () => {
144
- try {
145
- await AdminService.deleteSubject({
146
- subject: subjects[namespace],
147
- id: id,
148
- })
149
- message.success(t("Subject deleted successfully"))
150
- goTo(getRedirectLink(`/app/management/subject/${subjects[namespace]}`))
151
- } catch (error) {
152
- handleError(error)
153
- message.error(t("Failed to delete subject"))
154
- }
155
-
156
- }, [namespace, id, t])
157
-
158
135
  const { pageActions, extraPageActions } = useViewActions({
159
136
  namespace,
160
137
  data,
@@ -172,8 +149,6 @@ const View = ({
172
149
  t,
173
150
  viewConfig,
174
151
  buttonActions,
175
- canDelete,
176
- deleteSubject: handleDeleteSubject
177
152
  });
178
153
 
179
154
  useEffect(() => {
@@ -17,8 +17,6 @@ class AdminService extends BaseService {
17
17
  }
18
18
 
19
19
 
20
-
21
-
22
20
  inviteCompanyAccount({ companyId, data }) {
23
21
  return this.apiPost({
24
22
  url: `/accounts/${companyId}/invite`,
@@ -26,21 +24,6 @@ class AdminService extends BaseService {
26
24
  })
27
25
  }
28
26
 
29
- resendInvitation({invitationToken
30
- }){
31
- return this.apiPost({
32
- url: `/accounts/resendInvitation/${invitationToken}`,
33
- })
34
- }
35
-
36
- copyInvitation({invitationToken
37
- }){
38
- return this.apiPost({
39
- url: `/accounts/copyInvitation/${invitationToken}`,
40
- })
41
- }
42
-
43
-
44
27
  inviteAccount(data) {
45
28
  return this.apiPost({
46
29
  url: `/accounts/inviteAccount`,
@@ -55,14 +38,7 @@ class AdminService extends BaseService {
55
38
  })
56
39
  }
57
40
 
58
- updateAccount({ data, id, isPending=false }) {
59
- if (isPending) {
60
- return this.apiPut({
61
- data,
62
- url: `/accounts/invitation/${id}`,
63
- })
64
- }
65
-
41
+ updateAccount({ data, id }) {
66
42
  return this.apiPut({
67
43
  data,
68
44
  url: `/accounts/${id}`,
@@ -171,19 +147,6 @@ class AdminService extends BaseService {
171
147
  url: `/management/subject/${subject}/${id}`,
172
148
  });
173
149
  }
174
-
175
- getItems({ item }) {
176
- return this.apiGet({
177
- url: `/management/items/${item}`,
178
- });
179
- }
180
-
181
- getItemData({ item, id }) {
182
- return this.apiGet({
183
- url: `/management/item/${item}/${id}`,
184
- });
185
- }
186
-
187
150
 
188
151
 
189
152
  viewLocation({ id }) {
@@ -203,7 +166,7 @@ class AdminService extends BaseService {
203
166
  const type = subject === 'location' ? 'location' : 'stakeholder';
204
167
  return this.apiPut({
205
168
  url: `/management/subject/${type}/${id}`,
206
- data: data,
169
+ data: filterCreateData(data),
207
170
  });
208
171
  }
209
172
 
@@ -214,20 +177,15 @@ class AdminService extends BaseService {
214
177
  });
215
178
  }
216
179
 
217
- async getUserGrowth(activeFilter) {
218
- const { data } = await this.apiGet({
180
+ getUserGrowth(activeFilter) {
181
+ return this.apiGet({
219
182
  url: `/accounts/dashboard/user-growth`,
220
183
  isUserManager: true,
221
184
  params: { activeFilter },
222
185
  });
223
- return data;
224
186
  }
225
187
 
226
- removeUserFromAccount({ accountId, userId }) {
227
- return this.apiPut({
228
- url: `/companies/${accountId}/remove-user/${userId}`,
229
- })
230
- }
188
+
231
189
  }
232
190
 
233
191
  export default createLazyService(AdminService);
@@ -9,13 +9,13 @@ class DashboardService extends BaseService {
9
9
  isApp: true,
10
10
  });
11
11
  }
12
- async getUserGrowth(activeFilter) {
13
- const { data } = await this.apiGet({
12
+
13
+ getUserGrowth(activeFilter) {
14
+ return this.apiGet({
14
15
  url: `/accounts/dashboard/user-growth`,
15
16
  isUserManager: true,
16
17
  params: { activeFilter },
17
18
  });
18
- return data;
19
19
  }
20
20
 
21
21
  getAdminDashboard() {