datastake-daf 0.6.809 → 0.6.810

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 (40) 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 +215 -527
  7. package/dist/hooks/index.js +4 -11
  8. package/dist/pages/index.js +228 -224
  9. package/dist/services/index.js +5 -19
  10. package/dist/utils/index.js +5 -24
  11. package/package.json +1 -1
  12. package/src/@daf/core/components/AuthForm/index.jsx +3 -12
  13. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -0
  14. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -0
  15. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +3 -1
  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 +1 -6
  18. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +12 -47
  19. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +10 -36
  20. package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +1 -1
  21. package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +0 -1
  22. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  23. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +30 -22
  24. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +3 -4
  25. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +2 -6
  26. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +12 -14
  27. package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +1 -0
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +0 -3
  29. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +9 -12
  30. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +4 -16
  31. package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +17 -9
  32. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +8 -9
  33. package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +99 -124
  34. package/src/@daf/hooks/useAdminDashboard.js +4 -7
  35. package/src/@daf/pages/Locations/MineSite/columns.js +18 -1
  36. package/src/@daf/pages/Locations/MineSite/config.js +2 -2
  37. package/src/@daf/services/AdminService.js +4 -15
  38. package/src/@daf/services/DashboardService.js +3 -3
  39. package/src/@daf/utils/filters.js +15 -13
  40. package/src/constants/locales/en/translation.js +0 -9
@@ -13,20 +13,13 @@ function AuthForm ({
13
13
  errors,
14
14
  t = (key) => key,
15
15
  executeRecaptcha = () => {},
16
- getCurrentStep = () => {},
17
- theme,
16
+ getCurrentStep = () => {}
18
17
  }){
19
18
  const [formInstance] = Form.useForm(form);
20
19
  const [currentStep, setCurrentStep] = useState(0);
21
20
  const [allFormValues, setAllFormValues] = useState(initialValues);
22
21
  const [formErrors, setFormErrors] = useState(null);
23
22
 
24
- const buttonStyle = theme?.colorPrimary ? {
25
- backgroundColor: theme.colorPrimary,
26
- borderColor: theme.colorPrimary,
27
- } : {};
28
-
29
-
30
23
  const isMultiStep = !!steps;
31
24
  const currentFields = isMultiStep ? steps?.[currentStep]?.fields : fields || [];
32
25
 
@@ -173,7 +166,6 @@ function AuthForm ({
173
166
  name: field.name,
174
167
  label: field.label,
175
168
  rules: field.rules,
176
- dependencies: field.dependencies,
177
169
  style: { marginBottom: 0 }
178
170
  };
179
171
  if (field.valuePropName && field.type !== 'select') {
@@ -225,7 +217,6 @@ function AuthForm ({
225
217
  htmlType="submit"
226
218
  disabled={isLastStep && !allFieldsFilled}
227
219
  block className="normal-br"
228
- style={buttonStyle}
229
220
  >
230
221
  {isLastStep ? submitText : t("Next")}
231
222
  </BorderedButton>
@@ -234,14 +225,14 @@ function AuthForm ({
234
225
  }}
235
226
  </Form.Item>
236
227
  <div className="buttons" style={{ marginTop: 0}}>
237
- <BorderedButton onClick={prev} block className="normal-br" style={buttonStyle}>
228
+ <BorderedButton onClick={prev} block className="normal-br">
238
229
  {t("Back")}
239
230
  </BorderedButton>
240
231
  </div>
241
232
  </div>
242
233
  ) : (
243
234
  <div className="buttons" style={{ marginTop: isMultiStep ? '16px' : 0}}>
244
- <BorderedButton type="primary" htmlType="submit" block className="normal-br" style={buttonStyle}>
235
+ <BorderedButton type="primary" htmlType="submit" block className="normal-br">
245
236
  {isMultiStep ? t("Next") : submitText}
246
237
  </BorderedButton>
247
238
  </div>
@@ -8,6 +8,7 @@ export default function TopContributors({ data, loading, t }) {
8
8
  const container = useRef(null);
9
9
 
10
10
  useTopContributors({ container, data, t });
11
+ console.log("topcontributorshhhh", data);
11
12
  return (
12
13
  <Widget
13
14
  title={t(`admin::top-contributors`)}
@@ -12,6 +12,7 @@ export default function useUserGrowth({ container, data: mainData = {}, t, trans
12
12
  const [mainGraph, setMainGraph] = useState(null);
13
13
  const [data, setData] = useState([]);
14
14
  const { token } = useToken();
15
+ console.log("mainData", mainData);
15
16
  const fetchData = () => {
16
17
  const { dates = [] } = mainData;
17
18
  const _data = [];
@@ -9,11 +9,13 @@ export default function UserGrowth({ loading, data = [], t, translationKeys, fet
9
9
  const [selectValue, setSelectValue] = useState(selectOptions[0]?.value);
10
10
 
11
11
  useUserGrowth({ container, data, t, translationKeys });
12
+ console.log("usergrowthhhhh", data);
13
+
12
14
  useEffect(() => {
13
15
  if (typeof fetchUserGrowth === "function") {
14
16
  fetchUserGrowth(selectValue);
15
17
  }
16
- }, [selectValue, fetchUserGrowth]);
18
+ }, [selectValue]);
17
19
 
18
20
  return (
19
21
  <Widget
@@ -34,19 +34,19 @@ export default function CombineLocationModal({
34
34
 
35
35
  const onSubmit = () => {
36
36
  MainForm.validateFields().then((data) => {
37
- const ids = selectedLocations.map((location) => location.id);
37
+ const ids = selectedLocations.map((location) => location.id);
38
38
  const allowedKeys = [
39
- "id",
40
- "name",
41
- "country",
42
- "category",
43
- "administrativeLevel1",
39
+ "id",
40
+ "name",
41
+ "country",
42
+ "category",
43
+ "administrativeLevel1",
44
44
  "administrativeLevel2"
45
- ];
45
+ ];
46
46
  const filteredData = Object.fromEntries(
47
47
  Object.entries(data).filter(([key]) => allowedKeys.includes(key))
48
48
  );
49
-
49
+
50
50
  onSuccess({
51
51
  ids,
52
52
  data: filteredData,
@@ -66,15 +66,15 @@ export default function CombineLocationModal({
66
66
  destroyOnHidden={true}
67
67
  onValuesChange={() => {
68
68
  setIsDisabled(() => {
69
- const values = MainForm.getFieldsValue();
70
-
71
- const requiredFields = entity?.includes("location")
72
- ? ["id", "name", "category", "country", "administrativeLevel1", "administrativeLevel2"]
73
- : ["id", "name", "category", "country"];
74
-
75
- return requiredFields.some((field) => values[field] === undefined);
69
+ const values = MainForm.getFieldsValue();
70
+
71
+ const requiredFields = entity?.includes("location")
72
+ ? ["id", "name", "category", "country", "administrativeLevel1", "administrativeLevel2"]
73
+ : ["id", "name", "category", "country"];
74
+
75
+ return requiredFields.some((field) => values[field] === undefined);
76
76
  });
77
- }}
77
+ }}
78
78
  >
79
79
  <Container>
80
80
  <div className="daf-table-wrapper no-pagination">
@@ -124,7 +124,7 @@ export default function CombineLocationModal({
124
124
  options={selectedLocations.map((location) => {
125
125
  return {
126
126
  label: location?.datastakeId || "-",
127
- value: location?.id || "-",
127
+ value: location?.id || "-",
128
128
  };
129
129
  })}
130
130
  placeholder={t("ID")}
@@ -181,41 +181,41 @@ export default function CombineLocationModal({
181
181
 
182
182
  {entity?.includes("location") && (
183
183
  <>
184
- <Form.Item className="flex-1" name="administrativeLevel1">
185
- <Select
186
- placeholder={t("Province")}
187
- options={selectedLocations
188
- .map((location) => {
189
- const _data = getAdminLevelName(location?.linking?.SCL, "level_1");
190
- return {
191
- label: _data?.name || "-",
192
- value: _data?.id || "-",
193
- };
194
- })
195
- .filter(
196
- (option, index, self) =>
197
- index === self.findIndex((o) => o.value === option.value),
198
- )}
199
- />
200
- </Form.Item>
184
+ <Form.Item className="flex-1" name="administrativeLevel1">
185
+ <Select
186
+ placeholder={t("Province")}
187
+ options={selectedLocations
188
+ .map((location) => {
189
+ const _data = getAdminLevelName(location?.linking?.SCL, "level_1");
190
+ return {
191
+ label: _data?.name || "-",
192
+ value: _data?.id || "-",
193
+ };
194
+ })
195
+ .filter(
196
+ (option, index, self) =>
197
+ index === self.findIndex((o) => o.value === option.value),
198
+ )}
199
+ />
200
+ </Form.Item>
201
201
 
202
- <Form.Item className="flex-1" name="administrativeLevel2">
203
- <Select
204
- placeholder={t("Territory")}
205
- options={selectedLocations
206
- .map((location) => {
207
- const _data = getAdminLevelName(location?.linking?.SCL, "level_2");
208
- return {
209
- label: _data?.name || "-",
210
- value: _data?.id || "-",
211
- };
212
- })
213
- .filter(
214
- (option, index, self) =>
215
- index === self.findIndex((o) => o.value === option.value),
216
- )}
217
- />
218
- </Form.Item>
202
+ <Form.Item className="flex-1" name="administrativeLevel2">
203
+ <Select
204
+ placeholder={t("Territory")}
205
+ options={selectedLocations
206
+ .map((location) => {
207
+ const _data = getAdminLevelName(location?.linking?.SCL, "level_2");
208
+ return {
209
+ label: _data?.name || "-",
210
+ value: _data?.id || "-",
211
+ };
212
+ })
213
+ .filter(
214
+ (option, index, self) =>
215
+ index === self.findIndex((o) => o.value === option.value),
216
+ )}
217
+ />
218
+ </Form.Item>
219
219
  </>
220
220
  )}
221
221
  </Form>
@@ -37,8 +37,6 @@ export default function CombineSubjectsModal({
37
37
  const onSubmit = () => {
38
38
  MainForm.validateFields().then((data) => {
39
39
  const ids = selectedSubjects.map((subject) => subject.id);
40
- console.log(ids, "ids");
41
- console.log(data, "data");
42
40
  onSuccess({
43
41
  ids,
44
42
  data,
@@ -114,10 +112,7 @@ export default function CombineSubjectsModal({
114
112
  >
115
113
  <Form.Item className="flex-1" name="id">
116
114
  <Select
117
- options={selectedSubjects.map((s) => ({
118
- label: s?.datastakeId || "-",
119
- value: s?.id || "-",
120
- }))}
115
+ options={mapToSelectOptions(selectedSubjects, "datastakeId", selectOptions, null)}
121
116
  placeholder={t("ID")}
122
117
  ></Select>
123
118
  </Form.Item>
@@ -1,8 +1,6 @@
1
1
  import Modal from "../../../../Modal/index.jsx";
2
2
  import { Form, Select, Input, Alert } from "antd";
3
3
  import { useState, useEffect, useMemo } from "react";
4
- import AuthenticationService from "../../../../../../services/AuthenticationService.js";
5
- import { StorageManager } from "../../../../../../../helpers/StorageManager.js";
6
4
 
7
5
  export default function NewAccount({
8
6
  t,
@@ -11,28 +9,10 @@ export default function NewAccount({
11
9
  accountTypes = [],
12
10
  fetchData,
13
11
  inviteAccount,
14
- selectOptions,
15
12
  }) {
16
13
  const [MainForm] = Form.useForm();
17
14
  const [loading, setLoading] = useState(false);
18
15
  const [accountUsed, setAccountUsed] = useState(false);
19
- const [countries, setCountries] = useState([]);
20
-
21
- useEffect(() => {
22
- const getCountries = async () => {
23
- try {
24
- const language = StorageManager.get("datastakeLng") || "en";
25
- const { data } = await AuthenticationService.getFormOptions({
26
- references: ["countries"],
27
- language,
28
- });
29
- setCountries(data?.countries || []);
30
- } catch (e) {
31
- console.error(e);
32
- }
33
- };
34
- getCountries();
35
- }, []);
36
16
 
37
17
  const isEdit = useMemo(() => isOpen && typeof isOpen === "object", [isOpen]);
38
18
 
@@ -40,8 +20,7 @@ export default function NewAccount({
40
20
  if (isOpen && typeof isOpen === "object") {
41
21
  MainForm.setFieldsValue({
42
22
  name: isOpen.name,
43
- country: isOpen?.country,
44
- type: isOpen?.type,
23
+ email: isOpen?.admin?.email,
45
24
  });
46
25
  } else {
47
26
  MainForm.resetFields();
@@ -78,32 +57,18 @@ export default function NewAccount({
78
57
  <Form.Item name="name" label={t("Name")} rules={[{ required: true }]}>
79
58
  <Input placeholder={t("Type")} />
80
59
  </Form.Item>
81
-
82
- {isEdit ? (
83
- <Form.Item
84
- name="country"
85
- label={t("Country")}
86
- rules={[{ required: true, type: "country" }]}
87
- >
88
- <Select
89
- placeholder={t("Select")}
90
- options={(countries || []).map((c) => ({
91
- label: c?.label,
92
- value: c?.value,
93
- }))}
94
- />
95
- </Form.Item>
96
- ) : (
97
- <Form.Item
98
- name="email"
99
- label={t("Email")}
100
- rules={[{ required: true, type: "email" }]}
101
- >
102
- <Input placeholder={t("Type")} />
103
- </Form.Item>
104
- )}
105
60
  <Form.Item name="type" label={t("Type")} rules={[{ required: true }]}>
106
- <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
+ />
107
72
  </Form.Item>
108
73
  {accountUsed && (
109
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}
@@ -101,7 +101,6 @@ export default function AdminAccountsScreen({ config }) {
101
101
  isOpen={addAccountVisible}
102
102
  onClose={() => setAddAccountVisible(false)}
103
103
  accountTypes={accountTypes}
104
- countriesOptions={options?.countries}
105
104
  fetchData={() => {
106
105
  }}
107
106
  inviteAccount={(data) => AdminService.inviteAccount(data)}
@@ -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,
@@ -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([]);
@@ -67,9 +66,9 @@ export default function AccountTable({
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) {
@@ -208,7 +207,7 @@ export default function AccountTable({
208
207
  fetchData();
209
208
  fetchPendingAccounts();
210
209
  }}
211
- accountTypes={accountTypes}
210
+ accountTypes={config.accountTypes}
212
211
  inviteAccount={inviteAccount}
213
212
  />
214
213
  <CombineAccountModal
@@ -64,14 +64,10 @@ export default function LocationTable({
64
64
  }
65
65
  }
66
66
 
67
- const page = Number(paginationObj.page) || 1;
68
- const pageSize = Number(paginationObj.pageSize) || 20;
69
- const skip = (page - 1) * pageSize;
70
-
71
67
  const transformedParams = {
72
68
  pagination: {
73
- skip,
74
- take: pageSize,
69
+ skip: String(paginationObj.page || 1),
70
+ take: String(paginationObj.pageSize || 20),
75
71
  },
76
72
  tab: activeTab,
77
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 };
@@ -61,14 +65,10 @@ export default function SubjectsTable({
61
65
  }
62
66
  }
63
67
 
64
- const page = Number(paginationObj.page) || 1;
65
- const pageSize = Number(paginationObj.pageSize) || 20;
66
- const skip = (page - 1) * pageSize;
67
-
68
68
  const transformedParams = {
69
69
  pagination: {
70
- skip,
71
- take: pageSize,
70
+ skip: String(paginationObj.page || 1),
71
+ take: String(paginationObj.pageSize || 20),
72
72
  },
73
73
  tab: activeTab,
74
74
  };
@@ -133,7 +133,7 @@ export default function SubjectsTable({
133
133
  {
134
134
  icon: "Merge",
135
135
  onClick: () => setIsModalOpen(true),
136
- tooltip: t("merge-subjects"),
136
+ tooltip: t("admin::merge-subjects"),
137
137
  disabled: selectedSubjects.length < 2,
138
138
  },
139
139
  ]}
@@ -192,13 +192,11 @@ export default function SubjectsTable({
192
192
  onSuccess={(data) => {
193
193
  setIsModalOpen(false);
194
194
  setLoading(true);
195
+ message.success(t("Subjects successfully merged."))
195
196
  if (typeof mergeSubjectsFunction === 'function') {
196
- mergeSubjectsFunction(data).then(() => {
197
- setTimeout(() => {
198
- fetchData();
199
- }, 500);
200
- }).finally(() => {
197
+ mergeSubjectsFunction(data).finally(() => {
201
198
  setSelectedSubjects([]);
199
+ fetchData();
202
200
  });
203
201
  }
204
202
  }}
@@ -209,4 +207,4 @@ export default function SubjectsTable({
209
207
  />
210
208
  </>
211
209
  );
212
- }
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,
@@ -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 }));