datastake-daf 0.6.813 → 0.6.815

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 (70) 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 +3181 -4417
  7. package/dist/hooks/index.js +4 -11
  8. package/dist/layouts/index.js +478 -464
  9. package/dist/pages/index.js +1123 -742
  10. package/dist/services/index.js +6 -56
  11. package/dist/utils/index.js +511 -492
  12. package/package.json +1 -1
  13. package/src/@daf/core/components/AuthForm/index.jsx +3 -12
  14. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +123 -104
  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/core/components/Table/index.jsx +11 -6
  41. package/src/@daf/hooks/useAdminDashboard.js +4 -7
  42. package/src/@daf/pages/Events/Activities/columns.js +15 -11
  43. package/src/@daf/pages/Events/Incidents/columns.js +15 -11
  44. package/src/@daf/pages/Events/Testimonials/columns.js +173 -0
  45. package/src/@daf/pages/Events/Testimonials/config.js +175 -0
  46. package/src/@daf/pages/Events/columns.js +7 -3
  47. package/src/@daf/pages/Locations/MineSite/columns.js +16 -11
  48. package/src/@daf/pages/Locations/columns.js +7 -3
  49. package/src/@daf/pages/Stakeholders/Operators/columns.js +16 -12
  50. package/src/@daf/pages/Stakeholders/Workers/columns.js +16 -12
  51. package/src/@daf/pages/Stakeholders/columns.js +8 -4
  52. package/src/@daf/pages/TablePage/helper.js +15 -0
  53. package/src/@daf/pages/View/hooks/useViewActions.js +0 -13
  54. package/src/@daf/pages/View/hooks/useViewPermissions.js +0 -16
  55. package/src/@daf/pages/View/index.jsx +4 -29
  56. package/src/@daf/services/AdminService.js +5 -47
  57. package/src/@daf/services/DashboardService.js +3 -3
  58. package/src/@daf/utils/filters.js +15 -13
  59. package/src/constants/locales/en/translation.js +0 -13
  60. package/src/helpers/copyToClipboard.js +0 -60
  61. package/src/helpers/errorHandling.js +142 -74
  62. package/src/utils.js +1 -1
  63. package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +0 -81
  64. package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +0 -77
  65. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +0 -127
  66. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +0 -43
  67. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +0 -201
  68. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +0 -146
  69. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +0 -58
  70. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +0 -176
@@ -6,67 +6,42 @@ export default function NewAccount({
6
6
  t,
7
7
  isOpen,
8
8
  onClose,
9
- accountTypes ,
9
+ accountTypes = [],
10
10
  fetchData,
11
- updateAccount,
12
11
  inviteAccount,
13
- isPending=false,
14
- accountToEdit,
15
12
  }) {
16
13
  const [MainForm] = Form.useForm();
17
14
  const [loading, setLoading] = useState(false);
18
15
  const [accountUsed, setAccountUsed] = useState(false);
19
16
 
20
- console.log("typesssssssss", accountToEdit);
21
-
22
-
23
- const isEdit = useMemo(() => accountToEdit && typeof accountToEdit === "object", [accountToEdit]);
17
+ const isEdit = useMemo(() => isOpen && typeof isOpen === "object", [isOpen]);
24
18
 
25
19
  useEffect(() => {
26
- if (accountToEdit && typeof accountToEdit === "object") {
20
+ if (isOpen && typeof isOpen === "object") {
27
21
  MainForm.setFieldsValue({
28
- name: accountToEdit.name,
29
- email: accountToEdit.email,
30
- type: accountToEdit?.otherData?.interface,
22
+ name: isOpen.name,
23
+ email: isOpen?.admin?.email,
31
24
  });
32
25
  } else {
33
26
  MainForm.resetFields();
34
27
  }
35
- }, [accountToEdit, MainForm]);
28
+ }, [isOpen, MainForm]);
36
29
 
37
- const onSubmit = async () => {
38
- try {
39
- const val = await MainForm.validateFields();
40
- console.log(val, "val");
41
- setLoading(true);
42
-
43
- if (isEdit && accountToEdit?.id) {
44
- // Update existing account
45
- await updateAccount({
46
- id: accountToEdit.id,
47
- data: val,
48
- isPending: accountToEdit.status === 'pending' || isPending
49
- });
50
- } else {
51
- // Create new account
52
- if (!inviteAccount) {
53
- throw new Error("inviteAccount function is required for creating new accounts");
30
+ const onSubmit = () => {
31
+ MainForm.validateFields()
32
+ .then(async (val) => {
33
+ try {
34
+ setLoading(true);
35
+ await inviteAccount(val);
36
+ setLoading(false);
37
+ fetchData();
38
+ onClose();
39
+ } catch (err) {
40
+ console.log(err);
41
+ setLoading(false);
54
42
  }
55
- await inviteAccount(val);
56
- }
57
-
58
- setLoading(false);
59
- fetchData();
60
- onClose();
61
- MainForm.resetFields();
62
- } catch (err) {
63
- console.log(err);
64
- setLoading(false);
65
- if (err.errorFields) {
66
- // Validation errors, don't show error message
67
- return;
68
- }
69
- }
43
+ })
44
+ .catch(() => {});
70
45
  };
71
46
 
72
47
  return (
@@ -82,18 +57,18 @@ export default function NewAccount({
82
57
  <Form.Item name="name" label={t("Name")} rules={[{ required: true }]}>
83
58
  <Input placeholder={t("Type")} />
84
59
  </Form.Item>
85
-
86
-
87
- <Form.Item
88
- name="email"
89
- label={t("Email")}
90
- rules={[{ required: true, type: "email" }]}
91
- >
92
- <Input placeholder={t("Type")} />
93
- </Form.Item>
94
-
95
60
  <Form.Item name="type" label={t("Type")} rules={[{ required: true }]}>
96
- <Select placeholder={t("Select")} options={accountTypes || []} />
61
+ <Select placeholder={t("Select")} options={accountTypes} />
62
+ </Form.Item>
63
+ <Form.Item name="email" label={t("Email")} rules={[{ required: true, type: "email" }]}>
64
+ <Input
65
+ placeholder={t("Type")}
66
+ onChange={() => {
67
+ if (accountUsed) {
68
+ setAccountUsed(false);
69
+ }
70
+ }}
71
+ />
97
72
  </Form.Item>
98
73
  {accountUsed && (
99
74
  <Alert
@@ -13,17 +13,11 @@ export default function NewUser({
13
13
  inviteCompanyAccount = () => {},
14
14
  companyId,
15
15
  handleError = () => {},
16
- existingEmails = [],
17
16
  }) {
18
17
  const [MainForm] = Form.useForm();
19
18
  const [accountUsed, setAccountUsed] = useState(false);
20
19
  const [loading, setLoading] = useState(false);
21
20
 
22
- const checkEmailExists = (email) => {
23
- if (!email) return false;
24
- return existingEmails.includes(email.toLowerCase());
25
- };
26
-
27
21
  useEffect(() => {
28
22
  if (defaultData) {
29
23
  MainForm.setFieldsValue({
@@ -36,12 +30,6 @@ export default function NewUser({
36
30
  const onSubmit = async () => {
37
31
  try {
38
32
  const val = await MainForm.validateFields();
39
-
40
- if (checkEmailExists(val.email)) {
41
- setAccountUsed(true);
42
- return;
43
- }
44
-
45
33
  setLoading(true);
46
34
 
47
35
  const apiPayload = {
@@ -62,7 +50,6 @@ export default function NewUser({
62
50
  const localUserData = {
63
51
  ...apiPayload,
64
52
  status: 'pending',
65
- id: apiPayload.email, // Add a unique ID for the table key
66
53
  // apps: {
67
54
  // [module]: {
68
55
  // role: val.role,
@@ -97,29 +84,16 @@ export default function NewUser({
97
84
  <Input placeholder={t("Type")} />
98
85
  </Form.Item>
99
86
 
100
- <Form.Item name="email" label={t("Email")} rules={[{ required: true, type: "email" }]}>
101
- <Input
102
- placeholder={t("Type")}
103
- onChange={(e) => {
104
- const emailExists = checkEmailExists(e.target.value);
105
- setAccountUsed(emailExists);
106
- }}
107
- onBlur={(e) => {
108
- const emailExists = checkEmailExists(e.target.value);
109
- setAccountUsed(emailExists);
110
- }}
111
- />
112
- </Form.Item>
113
- {accountUsed && (
114
- <Alert
115
- message={t("This email corresponds to another account.")}
116
- type="error"
117
- className="mb-2"
118
- showIcon
119
- closable
120
- onClose={() => setAccountUsed(false)}
121
- />
122
- )}
87
+ <Form.Item name="email" label={t("Email")} rules={[{ required: true, type: "email" }]}>
88
+ <Input
89
+ placeholder={t("Type")}
90
+ onChange={() => {
91
+ if (accountUsed) {
92
+ setAccountUsed(false);
93
+ }
94
+ }}
95
+ />
96
+ </Form.Item>
123
97
 
124
98
  <Form.Item name="role" label={t("Role")} rules={[{ required: true }]}>
125
99
  <Select
@@ -56,7 +56,7 @@ export default function TransferRights({
56
56
  return (
57
57
  <Modal
58
58
  t={t}
59
- title={t("admin::transfer-account-admin-rights")}
59
+ title={t("admin::transfer-admin-rights")}
60
60
  open={isOpen}
61
61
  onClose={onClose}
62
62
  loading={loading}
@@ -2,7 +2,6 @@ import React, { useCallback, useMemo, useState } from "react";
2
2
  import { message } from "antd";
3
3
  import AccountTable from "../AdminTables/AccountTable/index.jsx";
4
4
  import DefaultNewAccountModal from "../AdminModals/NewAccount/index.jsx";
5
- import { copyStringToClipboard } from "../../../../../../helpers/copyToClipboard.js";
6
5
 
7
6
  /**
8
7
  * Admin Accounts Screen Wrapper
@@ -36,21 +35,20 @@ export default function AdminAccountsScreen({ config }) {
36
35
  options,
37
36
  useQuery,
38
37
  NewAccountModal,
39
- appUrl
40
38
  } = config;
41
- console.log(accountTypes, "accountTypes");
42
- // const userTypes = useMemo(() => accountTypes.map((c) => ({
43
- // label: c.label,
44
- // value: c.value,
45
- // })), [accountTypes]);
46
39
 
47
40
  const AccountModal = NewAccountModal || DefaultNewAccountModal;
48
41
 
49
42
  const query = useQuery ? useQuery() : { get: () => null };
50
43
  const [addAccountVisible, setAddAccountVisible] = useState(!!query.get("create"));
51
- const [accountToEdit, setAccountToEdit] = useState(null);
52
44
 
45
+ const onResendInvitation = useCallback(() => {
46
+ message.success(t("Invitation email resent"));
47
+ }, [t]);
53
48
 
49
+ const onCopyInvitation = useCallback(() => {
50
+ message.success(t("Invitation link copied"));
51
+ }, [t]);
54
52
 
55
53
  const actionButtons = useMemo(
56
54
  () => [
@@ -64,13 +62,6 @@ console.log(accountTypes, "accountTypes");
64
62
  [t]
65
63
  );
66
64
 
67
-
68
- function handleAccountModal(data) {
69
- console.log(data, "data");
70
- setAddAccountVisible(true);
71
- setAccountToEdit(data);
72
- }
73
-
74
65
  function handleGetData(params) {
75
66
  return AdminService.getAccounts(params);
76
67
  }
@@ -78,18 +69,7 @@ console.log(accountTypes, "accountTypes");
78
69
  function handleCancelVerification(token) {
79
70
  return AdminService.cancelInvitation(token);
80
71
  }
81
- function handleResendInvitation(account) {
82
- console.log("account", account);
83
- const token = account.invitationToken || account.users?.[0]?.invitationToken || account.admin?.invitationToken;
84
- return AdminService.resendInvitation({ invitationToken: token });
85
- }
86
72
 
87
-
88
- function handleCopyInvitation(account) {
89
- const link = `${appUrl}/register?code=${account.invitationToken}`;
90
- copyStringToClipboard(link);
91
- message.success(t("Invitation link copied"));
92
- }
93
73
  return (
94
74
  <>
95
75
  <AccountTable
@@ -104,15 +84,14 @@ function handleCopyInvitation(account) {
104
84
  getData={handleGetData}
105
85
  config={{
106
86
  accountTypes,
107
- addAccountVisible,
108
87
  options: {
109
88
  countries: options?.countries,
110
89
  },
111
90
  onTableClick: {
112
91
  onCanelVerification: handleCancelVerification,
113
- onCopyInvitation: handleCopyInvitation,
114
- onResendInvitation: handleResendInvitation,
115
- setAddAccountVisible: handleAccountModal,
92
+ onCopyInvitation,
93
+ onResendInvitation,
94
+ setAddAccountVisible,
116
95
  },
117
96
  }}
118
97
  />
@@ -120,17 +99,11 @@ function handleCopyInvitation(account) {
120
99
  <AccountModal
121
100
  t={t}
122
101
  isOpen={addAccountVisible}
123
- onClose={() => {
124
- setAddAccountVisible(false);
125
- setAccountToEdit(null);
126
- }}
102
+ onClose={() => setAddAccountVisible(false)}
127
103
  accountTypes={accountTypes}
128
- countriesOptions={options?.countries}
129
104
  fetchData={() => {
130
105
  }}
131
106
  inviteAccount={(data) => AdminService.inviteAccount(data)}
132
- updateAccount={({ data, id, isPending }) => AdminService.updateAccount({ data, id, isPending })}
133
- accountToEdit={accountToEdit}
134
107
  />
135
108
  </>
136
109
  );
@@ -38,7 +38,8 @@ export default function AdminDashboardScreen({ config }) {
38
38
 
39
39
  const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
40
40
  const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
41
- const safeUserGrowth = userGrowthData || data?.userGrowthData || [];
41
+ const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
42
+ console.log("safeUserGrowth", safeUserGrowth);
42
43
 
43
44
  return (
44
45
  <AdminDashboard
@@ -49,7 +50,6 @@ export default function AdminDashboardScreen({ config }) {
49
50
  loadingUserGrowth={userGrowthDataLoading}
50
51
  fetchUserGrowth={fetchUserGrowth}
51
52
  adminTranslationIdentifier={appName}
52
- userGrowthData={safeUserGrowth}
53
53
  data={{
54
54
  keyIndicatorsData: keyIndicatorsConfig,
55
55
  userActivityData: safeUserActivity,
@@ -11,5 +11,3 @@ export { default as AdminAccountsViewScreen } from "./AccountsView.jsx";
11
11
  export { default as AdminSubjectsScreen } from "./Subjects.jsx";
12
12
  export { default as AdminLocationScreen } from "./Location.jsx";
13
13
  export { default as AdminSubjectsViewScreen } from "./SubjectsView.jsx";
14
- export { default as AdminDocumentsScreen } from "./Documents.jsx";
15
- export { default as AdminEventsScreen } from "./Events.jsx";
@@ -270,28 +270,36 @@ export const getColumns = ({
270
270
  );
271
271
  }
272
272
 
273
- const moreMenuItems = [
274
- {
275
- label: t("Edit"),
276
- value: "edit",
277
- onClick: () => setAddAccountVisible(val),
278
- },
279
- {
280
- label: t("Resend Invitation"),
281
- value: "resend",
282
- onClick: () => onResendInvitation(val),
283
- },
284
- {
285
- label: t("Copy Invitation Link"),
286
- value: "copy",
287
- onClick: () => onCopyInvitation(val),
288
- },
289
- {
290
- label: t("admin::cancel-invitation"),
291
- value: "cancel",
292
- onClick: () => onCanelVerification(val),
293
- },
294
- ];
273
+ const moreMenuItems = !val.emailVerified
274
+ ? [
275
+ {
276
+ label: t("admin::cancel-invitation"),
277
+ value: "cancel",
278
+ onClick: () => onCanelVerification(val),
279
+ },
280
+ ]
281
+ : [
282
+ {
283
+ label: t("Edit"),
284
+ value: "edit",
285
+ onClick: () => setAddAccountVisible(val),
286
+ },
287
+ {
288
+ label: t("Resend Invitation"),
289
+ value: "resend",
290
+ onClick: () => onResendInvitation(val),
291
+ },
292
+ {
293
+ label: t("Copy Invitation Link"),
294
+ value: "copy",
295
+ onClick: () => onCopyInvitation(val),
296
+ },
297
+ {
298
+ label: t("admin::cancel-invitation"),
299
+ value: "cancel",
300
+ onClick: () => onCanelVerification(val),
301
+ },
302
+ ];
295
303
 
296
304
  return <MoreMenu items={moreMenuItems} />;
297
305
  },
@@ -35,7 +35,6 @@ export default function AccountTable({
35
35
  actionButton,
36
36
  inviteAccount,
37
37
  }) {
38
- const accountTypes = config?.accountTypes;
39
38
  const [showFilters, setShowFilters] = useState(false);
40
39
  const [hasError, setHasError] = useState(false);
41
40
  const [selectedAccounts, setSelectedAccounts] = useState([]);
@@ -61,15 +60,15 @@ export default function AccountTable({
61
60
  filtersConfig,
62
61
  getRedirectLink,
63
62
  getData,
64
- fetchPendingOnMount: true,
63
+ fetchPendingOnMount: true,
65
64
  });
66
65
 
67
66
  const selectOptions = useMemo(() => {
68
67
  return {
69
68
  country: config.options?.countries,
70
- type: accountTypes,
69
+ type: config.accountTypes,
71
70
  };
72
- }, [config.options, accountTypes]);
71
+ }, [config.options, config.accountTypes]);
73
72
 
74
73
  useEffect(() => {
75
74
  if (initFetchDone) {
@@ -97,23 +96,12 @@ export default function AccountTable({
97
96
  console.log(err);
98
97
  }
99
98
  },
100
- onCancel: () => { },
99
+ onCancel: () => {},
101
100
  });
102
101
  },
103
102
  [t, fetchData, fetchPendingAccounts],
104
103
  );
105
104
 
106
- const onResendInvitation = useCallback(
107
- async (user) => {
108
- try {
109
- await config.onTableClick.onResendInvitation(user);
110
- message.success(t("Email successfully sent"));
111
- } catch (error) {
112
- console.error("Failed to resend invitation:", error);
113
- message.error(t("Failed to resend invitation"));
114
- }
115
- }, [t, config.onTableClick]);
116
-
117
105
  const columns = useMemo(
118
106
  () =>
119
107
  getColumns({
@@ -125,7 +113,7 @@ export default function AccountTable({
125
113
  getRedirectLink,
126
114
  onCanelVerification: onCanelVerification,
127
115
  onCopyInvitation: config.onTableClick.onCopyInvitation,
128
- onResendInvitation: onResendInvitation,
116
+ onResendInvitation: config.onTableClick.onResendInvitation,
129
117
  setAddAccountVisible: config.onTableClick.setAddAccountVisible,
130
118
  setSelectedAccounts: setSelectedAccounts,
131
119
  selectedAccounts: selectedAccounts,
@@ -141,13 +129,13 @@ export default function AccountTable({
141
129
  headerTitle={headerTitle}
142
130
  actionButton={[
143
131
  ...actionButton,
144
- // {
145
- // icon: "Merge",
146
- // // type: "primary",
147
- // onClick: () => setCombineAccountVisible(true),
148
- // tooltip: "Combine",
149
- // disabled: selectedAccounts.length < 2,
150
- // },
132
+ {
133
+ icon: "Merge",
134
+ // type: "primary",
135
+ onClick: () => setCombineAccountVisible(true),
136
+ tooltip: "Combine",
137
+ disabled: selectedAccounts.length < 2,
138
+ },
151
139
  ]}
152
140
  tabs={getTabs({
153
141
  totalPending: totalPending,
@@ -219,7 +207,7 @@ export default function AccountTable({
219
207
  fetchData();
220
208
  fetchPendingAccounts();
221
209
  }}
222
- accountTypes={accountTypes}
210
+ accountTypes={config.accountTypes}
223
211
  inviteAccount={inviteAccount}
224
212
  />
225
213
  <CombineAccountModal
@@ -53,22 +53,7 @@ export default function LocationTable({
53
53
  console.error('Failed to parse pagination', e);
54
54
  }
55
55
  }
56
-
57
-
58
- const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
59
-
60
- let pageNumber = 1;
61
-
62
- if (paginationObj.page || paginationObj.current) {
63
- pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
64
- } else if (typeof paginationObj.skip === 'number') {
65
56
 
66
- pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
67
- }
68
-
69
- pageNumber = pageNumber || 1;
70
-
71
-
72
57
  let activeTab = tab || "active";
73
58
  if (!tab && filters) {
74
59
  try {
@@ -81,8 +66,8 @@ export default function LocationTable({
81
66
 
82
67
  const transformedParams = {
83
68
  pagination: {
84
- skip: pageNumber,
85
- take: pageSize,
69
+ skip: String(paginationObj.page || 1),
70
+ take: String(paginationObj.pageSize || 20),
86
71
  },
87
72
  tab: activeTab,
88
73
  };
@@ -13,6 +13,7 @@ import {
13
13
  } from "./helper.js";
14
14
  import { getColumns } from "./columns.js";
15
15
  import CombineSubjectsModal from "../../AdminModals/CombineSubjects/index.jsx";
16
+
16
17
  const { useToken } = theme;
17
18
 
18
19
  export default function SubjectsTable({
@@ -39,7 +40,10 @@ export default function SubjectsTable({
39
40
  const { token } = useToken();
40
41
  const [isCombineModalOpen, setIsModalOpen] = useState(false);
41
42
 
42
- const getDataWithStringPagination = async ({ params }) => {
43
+
44
+
45
+
46
+ const getDataWithStringPagination = async ({ params }) => {
43
47
  const { pagination, tab, filters, search, sort, ...otherParams } = params;
44
48
 
45
49
  let paginationObj = { page: 1, pageSize: 20 };
@@ -50,21 +54,7 @@ export default function SubjectsTable({
50
54
  console.error('Failed to parse pagination', e);
51
55
  }
52
56
  }
53
-
54
- const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
55
-
56
- let pageNumber = 1;
57
-
58
- if (paginationObj.page || paginationObj.current) {
59
- pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
60
- } else if (typeof paginationObj.skip === 'number') {
61
-
62
- pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
63
- }
64
-
65
- pageNumber = pageNumber || 1;
66
-
67
-
57
+
68
58
  let activeTab = tab || "active";
69
59
  if (!tab && filters) {
70
60
  try {
@@ -77,16 +67,14 @@ export default function SubjectsTable({
77
67
 
78
68
  const transformedParams = {
79
69
  pagination: {
80
- skip: pageNumber,
81
- take: pageSize,
70
+ skip: String(paginationObj.page || 1),
71
+ take: String(paginationObj.pageSize || 20),
82
72
  },
83
73
  tab: activeTab,
84
74
  };
85
75
 
86
76
  return getData({ params: transformedParams });
87
77
  };
88
-
89
-
90
78
  const {
91
79
  filter,
92
80
  activeTab,
@@ -145,7 +133,7 @@ export default function SubjectsTable({
145
133
  {
146
134
  icon: "Merge",
147
135
  onClick: () => setIsModalOpen(true),
148
- tooltip: t("merge-subjects"),
136
+ tooltip: t("admin::merge-subjects"),
149
137
  disabled: selectedSubjects.length < 2,
150
138
  },
151
139
  ]}
@@ -204,13 +192,11 @@ export default function SubjectsTable({
204
192
  onSuccess={(data) => {
205
193
  setIsModalOpen(false);
206
194
  setLoading(true);
195
+ message.success(t("Subjects successfully merged."))
207
196
  if (typeof mergeSubjectsFunction === 'function') {
208
- mergeSubjectsFunction(data).then(() => {
209
- setTimeout(() => {
210
- fetchData();
211
- }, 500);
212
- }).finally(() => {
197
+ mergeSubjectsFunction(data).finally(() => {
213
198
  setSelectedSubjects([]);
199
+ fetchData();
214
200
  });
215
201
  }
216
202
  }}
@@ -221,4 +207,4 @@ export default function SubjectsTable({
221
207
  />
222
208
  </>
223
209
  );
224
- }
210
+ }
@@ -56,6 +56,7 @@ export default function UserTable({
56
56
  defaultPageSize,
57
57
  fetchPendingOnMount: true, // Users table needs pending count
58
58
  });
59
+
59
60
  const selectOptions = useMemo(() => {
60
61
  return {
61
62
  account: accounts,
@@ -22,8 +22,6 @@ export default function AdminTable({
22
22
  breadcrumbs,
23
23
  children,
24
24
  }) {
25
-
26
- console.log(tabs, "tabs");
27
25
  return (
28
26
  <>
29
27
  <div className="semibold form-input-output daf-create-view">
@@ -31,7 +29,7 @@ export default function AdminTable({
31
29
  <div className="column start table-content">
32
30
  <div className="mt-6 ml-6 mr-6">
33
31
  <div className="flex flex-row">
34
- {tabs && tabs.length > 0 && <div className="mr-2">
32
+ <div className="mr-2">
35
33
  <Tabs
36
34
  t={t}
37
35
  tabs={tabs}
@@ -40,7 +38,7 @@ export default function AdminTable({
40
38
  filters.setActiveFilters((p) => ({ ...p, activeTab: val }))
41
39
  }
42
40
  />
43
- </div>}
41
+ </div>
44
42
  <div className="flex-1">
45
43
  <SearchFilters
46
44
  t={t}
@@ -32,7 +32,6 @@ export function useAdminTable({
32
32
  defaultPageSize: defaultPageSize || 20,
33
33
  getRedirectLink,
34
34
  });
35
- console.log(filter, "filter.activeFilters");
36
35
 
37
36
  const activeTab = useMemo(() => filter.activeFilters.activeTab, [filter.activeFilters]);
38
37
 
@@ -60,14 +59,12 @@ export function useAdminTable({
60
59
  fetchPendingAccounts();
61
60
  }, []);
62
61
 
63
-
64
62
  const fetchData = useCallback(async () => {
65
63
  try {
66
64
  setLoading(true);
67
65
  const params = filterParams({
68
66
  activeFilters: filter.activeFilters,
69
67
  });
70
- console.log(params, "params");
71
68
  const { data } = await getData({ params });
72
69
  setData(data.data || data);
73
70
  filter.setPagination((prev) => ({ ...prev, total: data?.meta?.total || data?.length || 0 }));