datastake-daf 0.6.786 → 0.6.787

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 (42) hide show
  1. package/dist/components/index.js +685 -407
  2. package/dist/services/index.js +10 -1
  3. package/dist/utils/index.js +28 -12
  4. package/package.json +1 -1
  5. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +0 -1
  6. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
  7. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
  8. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
  9. package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +0 -1
  10. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +1 -1
  11. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
  12. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  13. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +5 -5
  14. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
  15. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +224 -0
  16. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +65 -0
  17. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +23 -5
  18. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +36 -36
  19. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +12 -21
  20. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +13 -8
  21. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
  22. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +2 -2
  23. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +180 -0
  24. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
  25. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +27 -0
  26. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +157 -0
  27. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +31 -0
  28. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +77 -0
  29. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +117 -0
  30. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +54 -0
  31. package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
  32. package/src/@daf/services/AdminService.js +12 -3
  33. package/src/@daf/services/DashboardService.js +2 -1
  34. package/src/@daf/utils/filters.js +89 -89
  35. package/src/constants/locales/en/translation.js +3 -0
  36. package/src/constants/locales/fr/translation.js +1 -1
  37. package/src/constants/locales/sp/translation.js +1 -1
  38. package/build/favicon.ico +0 -0
  39. package/build/logo192.png +0 -0
  40. package/build/logo512.png +0 -0
  41. package/build/manifest.json +0 -25
  42. package/build/robots.txt +0 -3
@@ -0,0 +1,77 @@
1
+ import React from "react";
2
+ import TablePage from "../../../TablePage/index.jsx";
3
+
4
+ const OrganisationInformationTable = ({
5
+ t = () => {},
6
+ goTo = () => {},
7
+ user = {},
8
+ options = {},
9
+ getRedirectLink = () => {},
10
+ theme = {},
11
+ loading = false,
12
+ data = {},
13
+ isMobile,
14
+ APP,
15
+ location,
16
+ getData = () => {},
17
+ getApiBaseUrl = () => {},
18
+ getAppHeader = () => {},
19
+ getFormData = () => {},
20
+ saveFormData = () => {},
21
+ formLoading = false,
22
+ query = {},
23
+ ajaxForms = {},
24
+ changeAjaxForms = () => {},
25
+ ajaxOptions = {},
26
+ changeAjaxOptions = () => {},
27
+ formData = {},
28
+ formValue = {},
29
+ form = {},
30
+ applications = [],
31
+ subjectClear = () => {},
32
+ breadcrumbs = [],
33
+ extendingFilters = {},
34
+ createDefaultValues = {},
35
+ }) => {
36
+ return (
37
+ <TablePage
38
+ t={t}
39
+ goTo={goTo}
40
+ user={user}
41
+ options={options}
42
+ getRedirectLink={getRedirectLink}
43
+ theme={theme}
44
+ loading={loading}
45
+ data={data}
46
+ isMobile={isMobile}
47
+ APP={APP}
48
+ location={location}
49
+ applications={applications}
50
+
51
+ subject="organisations"
52
+ getData={getData}
53
+ getApiBaseUrl={getApiBaseUrl}
54
+ getAppHeader={getAppHeader}
55
+ subjectClear={subjectClear}
56
+ extendingFilters={extendingFilters}
57
+ breadcrumbs={breadcrumbs}
58
+
59
+ formConfig={{
60
+ getFormData,
61
+ saveFormData,
62
+ formLoading,
63
+ query,
64
+ ajaxForms,
65
+ changeAjaxForms,
66
+ ajaxOptions,
67
+ changeAjaxOptions,
68
+ formData,
69
+ formValue,
70
+ form,
71
+ }}
72
+ defaultValues={createDefaultValues}
73
+ />
74
+ );
75
+ };
76
+
77
+ export default OrganisationInformationTable;
@@ -0,0 +1,117 @@
1
+ import React from 'react';
2
+ import { Tooltip, Tag } from 'antd';
3
+ import { findOptions } from '../../../../helpers/StringHelper.js';
4
+ import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
+ import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
6
+ import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
+ import { renderStatusTag } from '../../../utils/tags.js';
9
+
10
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
11
+ {
12
+ dataIndex: 'datastakeId',
13
+ title: t('ID'),
14
+ ellipsis: true,
15
+ show: true,
16
+ render: (v, all) => {
17
+ if (all.empty) {
18
+ return <div className="daf-default-cell" />
19
+ }
20
+
21
+ return <Tooltip title={v}>{v}</Tooltip>;
22
+ },
23
+ },
24
+ {
25
+ dataIndex: 'name',
26
+ title: t('Name'),
27
+ ellipsis: true,
28
+ show: true,
29
+ render: (v, all) => {
30
+ if (all.empty) {
31
+ return <div className="daf-default-cell" />
32
+ }
33
+
34
+ return <Tooltip title={v}>{v}</Tooltip>;
35
+ },
36
+ },
37
+ {
38
+ dataIndex: 'category',
39
+ title: t('Type'),
40
+ ellipsis: true,
41
+ show: true,
42
+ render: (v, all) => {
43
+ if (all.empty) {
44
+ return <div className="daf-default-cell" />
45
+ }
46
+ const category = findOptions(v, options?.locationCategories);
47
+
48
+ return <Tooltip title={category}>{category}</Tooltip>;
49
+ },
50
+ },
51
+ {
52
+ dataIndex: 'region',
53
+ title: t('Region'),
54
+ ellipsis: true,
55
+ show: true,
56
+ render: (v, all) => {
57
+ if (all.empty) {
58
+ return <div className="daf-default-cell" />
59
+ }
60
+
61
+ const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
62
+
63
+ return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
64
+ },
65
+ },
66
+ {
67
+ dataIndex: 'district',
68
+ title: t('District'),
69
+ ellipsis: true,
70
+ show: true,
71
+ render: (v, all) => {
72
+ if (all.empty) {
73
+ return <div className="daf-default-cell" />
74
+ }
75
+
76
+ const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
77
+
78
+ return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
79
+ },
80
+ },
81
+ {
82
+ title: t("Last Update"),
83
+ dataIndex: "updatedAt",
84
+ key: "updatedAt",
85
+ width: 125,
86
+ render: (date, all) => {
87
+ if (all.empty) {
88
+ return <div className="daf-default-cell" />;
89
+ }
90
+
91
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
92
+ return <Tooltip title={_date}>{_date}</Tooltip>;
93
+ },
94
+ ellipsis: true,
95
+ },
96
+
97
+ {
98
+ id: 'actions',
99
+ title: "",
100
+ width: 60,
101
+ render: (_, all) => {
102
+ if (all.empty) {
103
+ return <div className="daf-default-cell" />;
104
+ }
105
+
106
+ const onClick = () => {
107
+ let link = `/app/view/${subject}/${all.datastakeId}`;
108
+ if (activeTab === "shared") {
109
+ link += `?sourceId=${all?.authorId?.id}`;
110
+ }
111
+ goTo(getRedirectLink(link));
112
+ };
113
+
114
+ return <NavigationAction onClick={onClick} theme={theme} />;
115
+ }
116
+ }
117
+ ].filter((column) => column.show !== false);
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import TablePage from '../../../TablePage/index.jsx';
3
+ import { getColumns } from './columns.js';
4
+
5
+ const ProductionSiteTable = ({
6
+ t = () => {},
7
+ goTo = () => {},
8
+ user = {},
9
+ options = {},
10
+ getRedirectLink = () => {},
11
+ theme = {},
12
+ loading = false,
13
+ data = {},
14
+ isMobile,
15
+ APP,
16
+ location,
17
+ getData = () => {},
18
+ getApiBaseUrl = () => {},
19
+ getAppHeader = () => {},
20
+ applications = [],
21
+ subjectClear = () => {},
22
+ breadcrumbs = [],
23
+ extendingFilters = {},
24
+ createDefaultValues = {},
25
+ }) => {
26
+ return (
27
+ <TablePage
28
+ t={t}
29
+ goTo={goTo}
30
+ user={user}
31
+ options={options}
32
+ getRedirectLink={getRedirectLink}
33
+ theme={theme}
34
+ loading={loading}
35
+ data={data}
36
+ isMobile={isMobile}
37
+ APP={APP}
38
+ location={location}
39
+ applications={applications}
40
+ subject="production-sites"
41
+ getData={getData}
42
+ getApiBaseUrl={getApiBaseUrl}
43
+ getAppHeader={getAppHeader}
44
+ subjectClear={subjectClear}
45
+ extendingFilters={extendingFilters}
46
+ breadcrumbs={breadcrumbs}
47
+ formConfig={formConfig}
48
+ defaultValues={createDefaultValues}
49
+ onDownload={() => console.log("download")}
50
+ />
51
+ )
52
+ }
53
+
54
+ export default ProductionSiteTable
File without changes
@@ -69,10 +69,10 @@ class AdminService extends BaseService {
69
69
  }
70
70
 
71
71
  getSubjects({ subject, params }) {
72
- return this.apiGet({
73
- url: `${subject}`,
72
+ return this.apiGet({
73
+ url: `/management/subjects/${subject}`,
74
74
  params,
75
- })
75
+ });
76
76
  }
77
77
 
78
78
  mergeSubjects({ subject, ...data }) {
@@ -81,6 +81,15 @@ class AdminService extends BaseService {
81
81
  data,
82
82
  })
83
83
  }
84
+ getUserGrowth(activeFilter) {
85
+ return this.apiGet({
86
+ url: `/accounts/dashboard/user-growth`,
87
+ isUserManager: true,
88
+ params: { activeFilter },
89
+ });
90
+ }
91
+
92
+
84
93
  }
85
94
 
86
95
  export default createLazyService(AdminService);
@@ -26,4 +26,5 @@ class DashboardService extends BaseService {
26
26
  }
27
27
  }
28
28
 
29
- export default createLazyService(DashboardService);
29
+ export default createLazyService(DashboardService);
30
+
@@ -1,102 +1,102 @@
1
1
  export const defaultFilterKeys = ["search", "sortDir", "sortBy", "timeframe", "activeTab"];
2
-
3
2
  function hasJsonStructure(str) {
4
- if (typeof str !== "string") return false;
5
- try {
6
- const result = JSON.parse(str);
7
- const type = Object.prototype.toString.call(result);
8
- return type === "[object Object]" || type === "[object Array]";
9
- } catch (err) {
10
- return false;
11
- }
3
+ if (typeof str !== "string") return false;
4
+ try {
5
+ const result = JSON.parse(str);
6
+ const type = Object.prototype.toString.call(result);
7
+ return type === "[object Object]" || type === "[object Array]";
8
+ } catch (err) {
9
+ return false;
10
+ }
12
11
  }
13
-
14
12
  export const getDefaultActiveFilters = (
15
- params,
16
- selectFiltersConfig,
17
- defaultPageSize,
18
- defaultFilters = {},
19
- doPagination,
13
+ params,
14
+ selectFiltersConfig,
15
+ defaultPageSize,
16
+ defaultFilters = {},
17
+ doPagination,
20
18
  ) => {
21
- const o = {};
22
-
23
- defaultFilterKeys.forEach((k) => {
24
- if (params.has(k)) {
25
- if (hasJsonStructure(params.get(k))) {
26
- o[k] = JSON.parse(params.get(k));
27
- } else {
28
- o[k] = params.get(k);
29
- }
30
- } else if (defaultFilters[k]) {
31
- if (hasJsonStructure(defaultFilters[k])) {
32
- o[k] = JSON.parse(defaultFilters[k]);
33
- } else {
34
- o[k] = defaultFilters[k];
35
- }
36
- }
37
- });
38
-
39
- if (params.has("searchParams")) {
40
- try {
41
- o.searchParams = JSON.parse(params.get("searchParams"));
42
- } catch (e) {
43
- o.searchParams = params.get("searchParams").split(",");
44
- }
45
- }
46
-
47
- if (doPagination) {
48
- o.page = Number(params.get("page")) || 1;
49
- o.pageSize = Number(params.get("pageSize")) || defaultPageSize;
50
- }
51
-
52
- Object.keys(selectFiltersConfig).forEach((k) => {
53
- if (params.has(k)) {
54
- if (hasJsonStructure(params.get(k))) {
55
- o[k] = JSON.parse(params.get(k));
56
- } else {
57
- o[k] = params.get(k);
58
- }
59
- }
60
- });
61
-
62
- return o;
19
+ const o = {};
20
+ defaultFilterKeys.forEach((k) => {
21
+ if (params.has(k)) {
22
+ if (hasJsonStructure(params.get(k))) {
23
+ o[k] = JSON.parse(params.get(k));
24
+ } else {
25
+ o[k] = params.get(k);
26
+ }
27
+ } else if (defaultFilters[k]) {
28
+ if (hasJsonStructure(defaultFilters[k])) {
29
+ o[k] = JSON.parse(defaultFilters[k]);
30
+ } else {
31
+ o[k] = defaultFilters[k];
32
+ }
33
+ }
34
+ });
35
+ if (params.has("searchParams")) {
36
+ try {
37
+ o.searchParams = JSON.parse(params.get("searchParams"));
38
+ } catch (e) {
39
+ o.searchParams = params.get("searchParams").split(",");
40
+ }
41
+ }
42
+ if (doPagination) {
43
+ o.page = Number(params.get("page")) || 1;
44
+ o.pageSize = Number(params.get("pageSize")) || defaultPageSize;
45
+ }
46
+ Object.keys(selectFiltersConfig).forEach((k) => {
47
+ if (params.has(k)) {
48
+ if (hasJsonStructure(params.get(k))) {
49
+ o[k] = JSON.parse(params.get(k));
50
+ } else {
51
+ o[k] = params.get(k);
52
+ }
53
+ }
54
+ });
55
+ return o;
63
56
  };
64
-
65
57
  const NEW_PAGINATION_APPS = ["nashiriki"];
66
58
  export const filterParams = (value, module) => {
67
- const { activeFilters, ...rest } = value;
68
-
69
- const { page, pageSize, sortDir, sortBy, search, searchParams, ...filters } =
70
- activeFilters || {};
59
+ const { activeFilters, ...rest } = value;
60
+ const { page, pageSize, sortDir, sortBy, search, searchParams, ...filters } =
61
+ activeFilters || {};
62
+ const params = {};
63
+ // Use skip and take inside pagination object
64
+ // Calculate skip from page number (page 1 = skip 1, page 2 = skip 21, etc.)
65
+ params.pagination = {
66
+ skip: page ? ((page - 1) * (pageSize || 20) + 1) : 1,
67
+ take: pageSize || 20,
68
+ };
69
+ if (search && searchParams) {
70
+ params.search = JSON.stringify({
71
+ qs: search,
72
+ fields: searchParams,
73
+ });
74
+ }
75
+ if (sortDir && sortBy) {
76
+ params.sort = JSON.stringify({
77
+ dir: sortDir,
78
+ by: sortBy,
79
+ });
80
+ }
81
+ if (Object.keys(filters).length) {
82
+ if (value.sourceId && value.sourceId === "overview") {
83
+ const { activeTab, ...restFilters } = filters;
84
+ Object.assign(params, restFilters);
85
+ if (activeTab !== undefined) {
86
+ params.tab = activeTab;
87
+ }
88
+ } else {
89
+ const { authorId, activeTab, ...restFilters } = filters;
90
+ Object.assign(params, restFilters);
91
+ if (activeTab !== undefined) {
92
+ params.tab = activeTab;
93
+ }
94
+ }
95
+ }
96
+ return { ...rest, ...params };
97
+ };
71
98
 
72
- const params = {};
73
-
74
- params.pagination = JSON.stringify({
75
- [NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
76
- [NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize,
77
- });
78
99
 
79
- if (search && searchParams) {
80
- params.search = JSON.stringify({
81
- qs: search,
82
- fields: searchParams,
83
- });
84
- }
85
100
 
86
- if (sortDir && sortBy) {
87
- params.sort = JSON.stringify({
88
- dir: sortDir,
89
- by: sortBy,
90
- });
91
- }
92
101
 
93
- if (Object.keys(filters).length) {
94
- if (value.sourceId && value.sourceId === "overview") {
95
- params.filters = JSON.stringify(filters);
96
- } else {
97
- params.filters = JSON.stringify({ ...filters, authorId: undefined });
98
- }
99
- }
100
102
 
101
- return { ...rest, ...params };
102
- };
@@ -1,4 +1,7 @@
1
1
  const en = {
2
+ "sbg-admin::remove-user-title":"Remove User Title",
3
+ "sbg-admin::remove-user-body":"Remove User Body",
4
+ "add-account":"Add Account",
2
5
  "Site": "Site",
3
6
  "Production Sites": "Production Sites",
4
7
  "Type of account": "Type of account",
@@ -420,7 +420,7 @@ const fr = {
420
420
  Documentation: "Documents",
421
421
  "Edit project": "Modifier le projet",
422
422
  Name: "Nom",
423
- Type: "Tapez",
423
+ Type: "Type",
424
424
  type: "Type",
425
425
  Province: "Province",
426
426
  Territory: "Territoire",
@@ -233,7 +233,7 @@ const sp = {
233
233
  "Documentation": "Documentos",
234
234
  "Edit project": "Modificar proyecto",
235
235
  "Name": "Nombre",
236
- "Type": "Escribe",
236
+ "Type": "Tipo",
237
237
  "type": "Tipo",
238
238
  "Province": "Provincia",
239
239
  "Territory": "Territorio",
package/build/favicon.ico DELETED
Binary file
package/build/logo192.png DELETED
Binary file
package/build/logo512.png DELETED
Binary file
@@ -1,25 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
package/build/robots.txt DELETED
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow: