datastake-daf 0.6.819 → 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 (81) hide show
  1. package/dist/components/index.js +3936 -2875
  2. package/dist/hooks/index.js +16 -5
  3. package/dist/pages/index.js +255 -67
  4. package/dist/services/index.js +104 -9
  5. package/dist/utils/index.js +75 -8
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/AuthForm/index.jsx +12 -3
  8. package/src/@daf/core/components/DynamicForm/_index.scss +1 -3
  9. package/src/@daf/core/components/EditForm/_index.scss +0 -4
  10. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +27 -1
  11. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +2 -3
  12. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +0 -1
  13. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -3
  14. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +1 -1
  15. package/src/@daf/core/components/Screens/Admin/AdminModals/AddAccount/index.jsx +82 -10
  16. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +51 -51
  17. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -1
  18. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +53 -31
  19. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +36 -10
  20. package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +2 -2
  21. package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +37 -10
  22. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  23. package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +81 -0
  24. package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +77 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
  26. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +22 -30
  27. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +28 -16
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +93 -0
  29. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +43 -0
  30. package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +201 -0
  31. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +113 -0
  32. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +58 -0
  33. package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +176 -0
  34. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +3 -6
  35. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +17 -2
  36. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/helper.js +3 -6
  37. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +27 -13
  38. package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +0 -1
  39. package/src/@daf/core/components/Screens/Admin/AdminTables/components/index.jsx +4 -2
  40. package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +3 -0
  41. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +21 -9
  42. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +16 -11
  43. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +16 -4
  44. package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +9 -17
  45. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +12 -16
  46. package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +124 -99
  47. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +44 -28
  48. package/src/@daf/hooks/useAdminDashboard.js +7 -4
  49. package/src/@daf/hooks/useSources.js +2 -1
  50. package/src/@daf/pages/Events/columns.js +15 -3
  51. package/src/@daf/pages/Locations/MineSite/columns.js +18 -1
  52. package/src/@daf/pages/TablePage/columns.js +2 -0
  53. package/src/@daf/pages/TablePage/hook.js +0 -2
  54. package/src/@daf/pages/View/hooks/useViewActions.js +13 -0
  55. package/src/@daf/pages/View/hooks/useViewPermissions.js +16 -0
  56. package/src/@daf/pages/View/index.jsx +33 -5
  57. package/src/@daf/services/AdminService.js +80 -8
  58. package/src/@daf/services/DashboardService.js +3 -3
  59. package/src/@daf/utils/filters.js +13 -15
  60. package/src/constants/locales/en/translation.js +24 -4
  61. package/src/constants/locales/fr/translation.js +17 -0
  62. package/src/constants/locales/sp/translation.js +28 -7
  63. package/src/helpers/copyToClipboard.js +60 -0
  64. package/build/favicon.ico +0 -0
  65. package/build/logo192.png +0 -0
  66. package/build/logo512.png +0 -0
  67. package/build/manifest.json +0 -25
  68. package/build/robots.txt +0 -3
  69. package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +0 -395
  70. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/configTransformer.js +0 -137
  71. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.js +0 -9
  72. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +0 -196
  73. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/configTransformer.js +0 -216
  74. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.js +0 -7
  75. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +0 -184
  76. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +0 -64
  77. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +0 -10
  78. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +0 -77
  79. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +0 -51
  80. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
  81. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +0 -76
@@ -270,36 +270,28 @@ export const getColumns = ({
270
270
  );
271
271
  }
272
272
 
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
- ];
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
+ ];
303
295
 
304
296
  return <MoreMenu items={moreMenuItems} />;
305
297
  },
@@ -18,9 +18,9 @@ import {
18
18
 
19
19
  import CombineAccountModal from "../../AdminModals/CombineAccount/index.jsx";
20
20
 
21
- import NewAccount from "../../../Admin/AdminModals/NewAccount/index.jsx";
21
+ // import NewAccount from "../../../Admin/AdminModals/NewAccount/index.jsx";
22
22
  import CustomIcon from "../../../../Icon/CustomIcon.jsx";
23
-
23
+ import AddAccountModal from "../../AdminModals/AddAccount/index.jsx";
24
24
  export default function AccountTable({
25
25
  goTo,
26
26
  t = (text) => text,
@@ -35,6 +35,7 @@ export default function AccountTable({
35
35
  actionButton,
36
36
  inviteAccount,
37
37
  }) {
38
+ const accountTypes = config?.accountTypes;
38
39
  const [showFilters, setShowFilters] = useState(false);
39
40
  const [hasError, setHasError] = useState(false);
40
41
  const [selectedAccounts, setSelectedAccounts] = useState([]);
@@ -60,15 +61,15 @@ export default function AccountTable({
60
61
  filtersConfig,
61
62
  getRedirectLink,
62
63
  getData,
63
- fetchPendingOnMount: true,
64
+ fetchPendingOnMount: true,
64
65
  });
65
66
 
66
67
  const selectOptions = useMemo(() => {
67
68
  return {
68
69
  country: config.options?.countries,
69
- type: config.accountTypes,
70
+ type: accountTypes,
70
71
  };
71
- }, [config.options, config.accountTypes]);
72
+ }, [config.options, accountTypes]);
72
73
 
73
74
  useEffect(() => {
74
75
  if (initFetchDone) {
@@ -96,12 +97,23 @@ export default function AccountTable({
96
97
  console.log(err);
97
98
  }
98
99
  },
99
- onCancel: () => {},
100
+ onCancel: () => { },
100
101
  });
101
102
  },
102
103
  [t, fetchData, fetchPendingAccounts],
103
104
  );
104
105
 
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
+
105
117
  const columns = useMemo(
106
118
  () =>
107
119
  getColumns({
@@ -113,7 +125,7 @@ export default function AccountTable({
113
125
  getRedirectLink,
114
126
  onCanelVerification: onCanelVerification,
115
127
  onCopyInvitation: config.onTableClick.onCopyInvitation,
116
- onResendInvitation: config.onTableClick.onResendInvitation,
128
+ onResendInvitation: onResendInvitation,
117
129
  setAddAccountVisible: config.onTableClick.setAddAccountVisible,
118
130
  setSelectedAccounts: setSelectedAccounts,
119
131
  selectedAccounts: selectedAccounts,
@@ -129,13 +141,13 @@ export default function AccountTable({
129
141
  headerTitle={headerTitle}
130
142
  actionButton={[
131
143
  ...actionButton,
132
- {
133
- icon: "Merge",
134
- // type: "primary",
135
- onClick: () => setCombineAccountVisible(true),
136
- tooltip: "Combine",
137
- disabled: selectedAccounts.length < 2,
138
- },
144
+ // {
145
+ // icon: "Merge",
146
+ // // type: "primary",
147
+ // onClick: () => setCombineAccountVisible(true),
148
+ // tooltip: "Combine",
149
+ // disabled: selectedAccounts.length < 2,
150
+ // },
139
151
  ]}
140
152
  tabs={getTabs({
141
153
  totalPending: totalPending,
@@ -197,7 +209,7 @@ export default function AccountTable({
197
209
  />
198
210
  </AdminTable>
199
211
 
200
- <NewAccount
212
+ <AddAccountModal
201
213
  t={t}
202
214
  isOpen={config.addAccountVisible}
203
215
  onClose={() => {
@@ -207,7 +219,7 @@ export default function AccountTable({
207
219
  fetchData();
208
220
  fetchPendingAccounts();
209
221
  }}
210
- accountTypes={config.accountTypes}
222
+ accountTypes={accountTypes}
211
223
  inviteAccount={inviteAccount}
212
224
  />
213
225
  <CombineAccountModal
@@ -0,0 +1,93 @@
1
+ import { Checkbox, Tooltip, Avatar } from "antd";
2
+ import CustomIcon from "../../../../Icon/CustomIcon.jsx";
3
+ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
4
+ import { renderDateFormatted } from "../../../../../../../helpers/Forms.js";
5
+ export const getColumns = ({
6
+ t,
7
+ goTo = () => {},
8
+ show = "show",
9
+ getRedirectLink = () => {},
10
+
11
+ }) => {
12
+ const cols = [
13
+
14
+ {
15
+ title: t("ID"),
16
+ dataIndex: "datastakeId",
17
+ key: "datastakeId",
18
+ ellipsis: true,
19
+ show: true,
20
+ render: (value, all) => {
21
+ if (all.empty) {
22
+ return <div className="daf-default-cell" />;
23
+ }
24
+
25
+ return <Tooltip title={value}>{value}</Tooltip>;
26
+ },
27
+ },
28
+ {
29
+ title: t("Title"),
30
+ dataIndex: "name",
31
+ key: "name",
32
+ ellipsis: true,
33
+ show: true,
34
+ render: (value, all) => {
35
+ if (all.empty) {
36
+ return <div className="daf-default-cell" />;
37
+ }
38
+
39
+ return <Tooltip title={value}>{value}</Tooltip>;
40
+ },
41
+ },
42
+
43
+ {
44
+ title: t("Date"),
45
+ dataIndex: "date",
46
+ key: "date",
47
+ show: true,
48
+ render: (value, all) => {
49
+ if (all.empty) {
50
+ return <div className="daf-default-cell" />;
51
+ }
52
+ return <Tooltip title={renderDateFormatted(value, "DD MMM YYYY", 'en')}>{renderDateFormatted(value, "DD MMM YYYY", 'en') }</Tooltip>;
53
+ },
54
+ },
55
+ {
56
+ title: t("Last Update"),
57
+ dataIndex: "updatedAt",
58
+ key: "updatedAt",
59
+ show: true,
60
+ render: (value, all) => {
61
+ if (all.empty) {
62
+ return <div className="daf-default-cell" />;
63
+ }
64
+ return <Tooltip title={renderDateFormatted(value, "DD MMM YYYY", 'en')}>{renderDateFormatted(value, "DD MMM YYYY", 'en')}</Tooltip>;
65
+ },
66
+ },
67
+ {
68
+ title: "",
69
+ dataIndex: "actions",
70
+ key: "actions",
71
+ width: 60,
72
+ show: true,
73
+ render: (value, all) => {
74
+ if (all.empty) {
75
+ return <div className="daf-default-cell" />;
76
+ }
77
+
78
+ return (
79
+ <div
80
+ className="cursor-pointer"
81
+ onClick={() => {
82
+ goTo(getRedirectLink(`/app/view/management-document/${all.id}`));
83
+ }}
84
+ >
85
+ <CustomIcon name="Link" width={18} height={18} />
86
+ </div>
87
+ );
88
+ },
89
+ },
90
+ ];
91
+
92
+ return cols.filter((c) => c[show]);
93
+ };
@@ -0,0 +1,43 @@
1
+
2
+
3
+ export const selectFiltersConfig = {
4
+ category: {
5
+ type: "select",
6
+ label: "Category",
7
+ placeholder: (t) => t("Category"),
8
+ style: { flex: 1 },
9
+ labelStyle: { flex: 1 },
10
+ getLabel: (option) => option.label,
11
+ getValue: (option) => option.value,
12
+ },
13
+ country: {
14
+ type: "select",
15
+ label: "Country",
16
+ placeholder: (t) => t("Country"),
17
+ style: { flex: 1 },
18
+ labelStyle: { flex: 1 },
19
+ getLabel: (option) => option.label,
20
+ getValue: (option) => option.value,
21
+ },
22
+ sources: {
23
+ type: "select",
24
+ label: "Sources",
25
+ placeholder: (t) => t("Sources"),
26
+ style: { flex: 1 },
27
+ labelStyle: { flex: 1 },
28
+ getLabel: (option) => option.label,
29
+ getValue: (option) => option.value,
30
+ },
31
+ };
32
+
33
+ export const filtersConfig = {
34
+ name: "",
35
+ datastakeId: "",
36
+ };
37
+
38
+ export const defaultUrlParams = { activeTab: "active" };
39
+
40
+ export const checkboxConfig = {
41
+ name: "Name",
42
+ datastakeId: "ID",
43
+ };
@@ -0,0 +1,201 @@
1
+ import { useState, useMemo } from "react";
2
+ import { useAdminTable } from "../hook";
3
+ import AdminTable from "../components/index.jsx";
4
+ import DAFTable from "../../../../Table/index.jsx";
5
+ import { theme, Tag, message } from "antd";
6
+ import CustomIcon from "../../../../Icon/CustomIcon.jsx";
7
+ import {
8
+ selectFiltersConfig,
9
+ filtersConfig,
10
+ defaultUrlParams,
11
+ checkboxConfig,
12
+ } from "./helper.js";
13
+ import { getColumns } from "./column.js";
14
+ const { useToken } = theme;
15
+
16
+ export default function DocumentsTable({
17
+ t = (text) => text,
18
+ isMobile,
19
+ goTo,
20
+ getRedirectLink,
21
+ location,
22
+ getData,
23
+ module,
24
+ config,
25
+ defaultPageSize = 20,
26
+ view,
27
+ headerTitle,
28
+ breadcrumbs,
29
+ refetchTrigger,
30
+ user,
31
+ options,
32
+ }) {
33
+ const [showFilters, setShowFilters] = useState(false);
34
+ const [hasError, setHasError] = useState(false);
35
+ const [selectedDocuments, setSelectedDocuments] = useState([]);
36
+ const { token } = useToken();
37
+
38
+ const getDataWithStringPagination = async ({ params }) => {
39
+ const { pagination, tab, filters, search, sort, ...otherParams } = params;
40
+
41
+ let paginationObj = { page: 1, pageSize: 20 };
42
+ if (pagination) {
43
+ try {
44
+ paginationObj = typeof pagination === 'string' ? JSON.parse(pagination) : pagination;
45
+ } catch (e) {
46
+ console.error('Failed to parse pagination', e);
47
+ }
48
+ }
49
+
50
+
51
+ const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
52
+
53
+ let pageNumber = 1;
54
+
55
+ if (paginationObj.page || paginationObj.current) {
56
+ pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
57
+ } else if (typeof paginationObj.skip === 'number') {
58
+
59
+ pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
60
+ }
61
+
62
+ pageNumber = pageNumber || 1;
63
+
64
+
65
+ let activeTab = tab || "active";
66
+ if (!tab && filters) {
67
+ try {
68
+ const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
69
+ activeTab = parsedFilters.activeTab || "active";
70
+ } catch (e) {
71
+ activeTab = "active";
72
+ }
73
+ }
74
+
75
+ const transformedParams = {
76
+ pagination: {
77
+ skip: pageNumber,
78
+ take: pageSize,
79
+ },
80
+ tab: activeTab,
81
+ };
82
+
83
+ return getData({ params: transformedParams });
84
+ };
85
+
86
+ const {
87
+ filter,
88
+ activeTab,
89
+ canClearSearch,
90
+ totalPending,
91
+ data,
92
+ loading,
93
+ initFetchDone,
94
+ fetchData,
95
+ fetchPendingAccounts,
96
+ setLoading,
97
+ } = useAdminTable({
98
+ goTo,
99
+ location,
100
+ selectFiltersConfig,
101
+ view,
102
+ // defaultUrlParams,
103
+ module,
104
+ defaultPageSize,
105
+ filtersConfig,
106
+ getRedirectLink,
107
+ getData: getDataWithStringPagination,
108
+ refetchTrigger,
109
+ });
110
+
111
+ const selectOptions = useMemo(() => {
112
+ return {
113
+ category: config.options?.category,
114
+ country: config.options?.countries,
115
+ sources: [],
116
+ };
117
+ }, [config.options]);
118
+
119
+ const columns = useMemo(() => {
120
+ return getColumns({
121
+ t,
122
+ goTo,
123
+ token,
124
+ module,
125
+ selectedDocuments,
126
+ setSelectedDocuments,
127
+ getRedirectLink,
128
+ selectOptions,
129
+ entity: headerTitle,
130
+ options,
131
+ });
132
+ }, [t, goTo, module, token, selectedDocuments, getRedirectLink, selectOptions, headerTitle, options]);
133
+
134
+ console.log({data}, "data");
135
+
136
+ return (
137
+ <>
138
+ <AdminTable
139
+ filters={filter}
140
+ t={t}
141
+ headerTitle={headerTitle}
142
+ // actionButton={[
143
+ // {
144
+ // icon: "Merge",
145
+ // onClick: () => setIsModalOpen(true),
146
+ // tooltip: t("merge-subjects"),
147
+ // disabled: selectedDocuments.length < 2,
148
+ // },
149
+ // ]}
150
+ // tabs={getTabs({ t })}
151
+ isMobile={isMobile}
152
+ // activeTab={activeTab}
153
+ showFilters={showFilters}
154
+ setShowFilters={setShowFilters}
155
+ hasError={hasError}
156
+ setHasError={setHasError}
157
+ canClearSearch={canClearSearch}
158
+ selectOptions={selectOptions}
159
+ checkboxConfig={checkboxConfig}
160
+ defaultTableFilters={{}}
161
+ breadcrumbs={breadcrumbs}
162
+ >
163
+ {selectedDocuments.length > 0 && (
164
+ <div className="flex flex-row ml-6 mt-5" style={{ flexWrap: "wrap", gap: "8px" }}>
165
+ {selectedDocuments.map((document) => (
166
+ <Tag
167
+ key={document.id}
168
+ className="flex flex-row gap-2 items-center"
169
+ onClick={() =>
170
+ setSelectedDocuments((prev) => prev.filter((a) => a.id !== document.id))
171
+ }
172
+ style={{ cursor: "pointer" }}
173
+ >
174
+ <span>{document.name}</span>
175
+ <CustomIcon name="Close" size={10} />
176
+ </Tag>
177
+ ))}
178
+ </div>
179
+ )}
180
+ <DAFTable
181
+ columns={columns}
182
+ data={data}
183
+ loading={loading}
184
+ hideOnLoading={false}
185
+ pagination={filter.pagination}
186
+ rowKey="id"
187
+ selectOptions={selectOptions}
188
+ doEmptyRows
189
+ setShowFilters={setShowFilters}
190
+ filtersConfig={selectFiltersConfig}
191
+ onFilterChange={filter.onFiltersChange}
192
+ showFilters={showFilters}
193
+ defaultFilters={filter.defaultFilters}
194
+ onChange={filter.onTableChange}
195
+ />
196
+ </AdminTable>
197
+
198
+
199
+ </>
200
+ );
201
+ }
@@ -0,0 +1,113 @@
1
+ import { Checkbox, Tooltip, Avatar } from "antd";
2
+ import CustomIcon from "../../../../Icon/CustomIcon.jsx";
3
+ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
4
+
5
+ export const getColumns = ({
6
+ t,
7
+ goTo = () => {},
8
+ show = "show",
9
+ getRedirectLink = () => {},
10
+
11
+ options,
12
+ }) => {
13
+ const cols = [
14
+
15
+ {
16
+ title: t("ID"),
17
+ dataIndex: "datastakeId",
18
+ key: "datastakeId",
19
+ ellipsis: true,
20
+ show: true,
21
+ render: (value, all) => {
22
+ if (all.empty) {
23
+ return <div className="daf-default-cell" />;
24
+ }
25
+
26
+ return <Tooltip title={value}>{value}</Tooltip>;
27
+ },
28
+ },
29
+ {
30
+ title: t("Title"),
31
+ dataIndex: "name",
32
+ key: "name",
33
+ ellipsis: true,
34
+ show: true,
35
+ render: (value, all) => {
36
+ if (all.empty) {
37
+ return <div className="daf-default-cell" />;
38
+ }
39
+
40
+ return <Tooltip title={value}>{value}</Tooltip>;
41
+ },
42
+ },
43
+ {
44
+ title: t("type"),
45
+ dataIndex: "typeOfEvent",
46
+ key: "typeOfEvent",
47
+ ellipsis: true,
48
+ show: true,
49
+ render: (value, all) => {
50
+ if (all.empty) {
51
+ return <div className="daf-default-cell" />;
52
+ }
53
+
54
+
55
+ const _categoryOptions = (options?.eventCategoryOptions || options?.categoryOptions || [])?.map((item) => ({
56
+ value: item.value,
57
+ label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label,
58
+ }))
59
+
60
+ const type = findOptions(value, options?.eventsType || []) || "-";
61
+
62
+ return <Tooltip title={type}>{type}</Tooltip>;
63
+ },
64
+ },
65
+ {
66
+ title: t("Date"),
67
+ dataIndex: "date",
68
+ key: "date",
69
+ render: (value, all) => {
70
+ if (all.empty) {
71
+ return <div className="daf-default-cell" />;
72
+ }
73
+ return <Tooltip title={value}>{value}</Tooltip>;
74
+ },
75
+ },
76
+ {
77
+ title: t("Scope"),
78
+ dataIndex: "scope",
79
+ key: "scope",
80
+ render: (value, all) => {
81
+ if (all.empty) {
82
+ return <div className="daf-default-cell" />;
83
+ }
84
+ return <Tooltip title={value}>{value}</Tooltip>;
85
+ },
86
+ },
87
+ {
88
+ title: "",
89
+ dataIndex: "actions",
90
+ key: "actions",
91
+ width: 60,
92
+ show: true,
93
+ render: (value, all) => {
94
+ if (all.empty) {
95
+ return <div className="daf-default-cell" />;
96
+ }
97
+
98
+ return (
99
+ <div
100
+ className="cursor-pointer"
101
+ onClick={() => {
102
+ goTo(getRedirectLink(`/app/view/management-event/${all.id}`));
103
+ }}
104
+ >
105
+ <CustomIcon name="Link" width={18} height={18} />
106
+ </div>
107
+ );
108
+ },
109
+ },
110
+ ];
111
+
112
+ return cols.filter((c) => c[show]);
113
+ };
@@ -0,0 +1,58 @@
1
+ export const getTabs = ({ t }) => {
2
+ return [
3
+ {
4
+ key: "active",
5
+ label: t("Active"),
6
+ },
7
+ {
8
+ key: "pending",
9
+ label: t("Pending"),
10
+ },
11
+ {
12
+ key: 'suspended',
13
+ label: t("Suspended"),
14
+ }
15
+ ];
16
+ };
17
+
18
+ export const selectFiltersConfig = {
19
+ category: {
20
+ type: "select",
21
+ label: "Category",
22
+ placeholder: (t) => t("Category"),
23
+ style: { flex: 1 },
24
+ labelStyle: { flex: 1 },
25
+ getLabel: (option) => option.label,
26
+ getValue: (option) => option.value,
27
+ },
28
+ country: {
29
+ type: "select",
30
+ label: "Country",
31
+ placeholder: (t) => t("Country"),
32
+ style: { flex: 1 },
33
+ labelStyle: { flex: 1 },
34
+ getLabel: (option) => option.label,
35
+ getValue: (option) => option.value,
36
+ },
37
+ sources: {
38
+ type: "select",
39
+ label: "Sources",
40
+ placeholder: (t) => t("Sources"),
41
+ style: { flex: 1 },
42
+ labelStyle: { flex: 1 },
43
+ getLabel: (option) => option.label,
44
+ getValue: (option) => option.value,
45
+ },
46
+ };
47
+
48
+ export const filtersConfig = {
49
+ name: "",
50
+ datastakeId: "",
51
+ };
52
+
53
+ export const defaultUrlParams = { activeTab: "active" };
54
+
55
+ export const checkboxConfig = {
56
+ name: "Name",
57
+ datastakeId: "ID",
58
+ };