datastake-daf 0.6.787 → 0.6.789

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 (62) 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 +588 -729
  7. package/dist/pages/index.js +775 -34
  8. package/dist/services/index.js +1 -10
  9. package/dist/utils/index.js +12 -28
  10. package/package.json +1 -1
  11. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/ActivityIndicators.stories.js +24 -0
  12. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/index.jsx +1 -0
  13. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/style.js +34 -0
  14. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/KeyIndicators.stories.js +39 -0
  15. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/LabelWithIcon.jsx +38 -0
  16. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/index.jsx +16 -3
  17. package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/style.js +33 -0
  18. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +1 -0
  19. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
  20. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
  21. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
  22. package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +1 -0
  23. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +1 -1
  24. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
  25. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  26. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +5 -5
  27. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +5 -23
  29. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +36 -36
  30. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +21 -12
  31. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +8 -13
  32. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
  33. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +2 -2
  34. package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityImagery/index.jsx +29 -0
  35. package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityLocation/index.jsx +94 -0
  36. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/PlantedSpecies/index.jsx +56 -0
  37. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SeedlingsHeight/index.jsx +121 -0
  38. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SurvivalRate/index.jsx +94 -0
  39. package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/index.jsx +54 -0
  40. package/src/@daf/pages/Summary/Activities/Monitoring/components/WorkersDistribution/index.jsx +49 -0
  41. package/src/@daf/pages/Summary/Activities/Monitoring/config.js +51 -0
  42. package/src/@daf/pages/Summary/Activities/Monitoring/helper.js +236 -0
  43. package/src/@daf/pages/Summary/Activities/Monitoring/index.jsx +66 -0
  44. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +1 -1
  45. package/src/@daf/services/AdminService.js +3 -12
  46. package/src/@daf/services/DashboardService.js +1 -2
  47. package/src/@daf/utils/filters.js +89 -89
  48. package/src/constants/locales/en/translation.js +0 -3
  49. package/src/constants/locales/fr/translation.js +1 -1
  50. package/src/constants/locales/sp/translation.js +1 -1
  51. package/src/pages.js +1 -0
  52. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +0 -224
  53. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +0 -65
  54. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +0 -180
  55. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
  56. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +0 -27
  57. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +0 -157
  58. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +0 -31
  59. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +0 -77
  60. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +0 -117
  61. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +0 -54
  62. package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
@@ -0,0 +1,51 @@
1
+ import React from "react";
2
+ import { camelCaseToTitle } from "../../../../../utils";
3
+
4
+
5
+
6
+ export const getKeyIndicatorsRowConfig = ({ t, data = {} }) => [
7
+
8
+ {
9
+ label: t('Primary Data Collection'),
10
+ render: () => {
11
+
12
+ return <div className="flex">{'-'}</div>;
13
+ }
14
+ },
15
+ {
16
+ label: t('Monitoring Organization'),
17
+ render: () => <div>{data?.technicalPartner?.name || '-'}</div>
18
+ },
19
+ {
20
+ label: t('Team Members'),
21
+ render: () => <div> {data?.teamMembers?.length || '0'}</div>
22
+ },
23
+ {
24
+ label: t('Monitored Area'),
25
+ render: () => <div>{data?.totalAreaParcelMonitored ? `${data?.totalAreaParcelMonitored} ha` : '0 ha'}</div>
26
+ },
27
+
28
+ ];
29
+
30
+ export const getSiteConditionsConfig = ({ t, data = {} }) => [
31
+ {
32
+ label: t('Season'),
33
+ icon: 'Tree',
34
+ render: () => <div>{camelCaseToTitle(data?.season)|| '-'}</div>
35
+ },
36
+ {
37
+ label: t('Weather conditions'),
38
+ icon: 'Globe',
39
+ render: () => <div>{ camelCaseToTitle(data?.weatherConditions )|| '-'}</div>
40
+ },
41
+ {
42
+ label: t('Tide level'),
43
+ icon: 'WaterDrop',
44
+ render: () => <div>{camelCaseToTitle(data?.tideLevel )|| '-'}</div>
45
+ },
46
+ {
47
+ label: t('Disturbances'),
48
+ icon: 'Lightning',
49
+ render: () => <div>{data?.hasDisturbances ? t('Yes') : t('No')}</div>
50
+ },
51
+ ];
@@ -0,0 +1,236 @@
1
+ import L from "leaflet";
2
+
3
+ const normalizeUrl = (url) => url?.endsWith(':') ? url.slice(0, -1) : url;
4
+
5
+
6
+ export const extractFromPhotoDoc = (photoDoc, label, docIndex) => {
7
+ const photos = photoDoc?.pictures?.filter(p => p?.url) || (photoDoc?.url ? [photoDoc] : []);
8
+
9
+ return photos.map((photo, photoIndex) => ({
10
+ src: normalizeUrl(photo.url),
11
+ alt: photo.name || photo.alt || `${label} - Image ${docIndex + 1}-${photoIndex + 1}`
12
+ }));
13
+ };
14
+
15
+ export const getActivityImages = (activityData) => {
16
+ const photoArrays = [
17
+ { data: activityData?.groupPhotos, label: 'Group Photo' },
18
+ { data: activityData?.photosStartActivity, label: 'Start of Activity' },
19
+ { data: activityData?.photosDuringActivity, label: 'During Activity' },
20
+ { data: activityData?.photosEndActivity, label: 'End of Activity' }
21
+ ];
22
+
23
+ return photoArrays
24
+ .flatMap(({ data, label }) =>
25
+ Array.isArray(data)
26
+ ? data.flatMap((photoDoc, index) => extractFromPhotoDoc(photoDoc, label, index))
27
+ : []
28
+ );
29
+ };
30
+
31
+ const GENDER_COLORS = ['#016C6E', '#00AEB1'];
32
+
33
+ export const getGenderDistributionData = (activityData) => {
34
+ return {
35
+ Male: activityData?.genderDistributionMale || 0,
36
+ Female: activityData?.genderDistributionFemale || 0,
37
+ };
38
+ };
39
+
40
+
41
+ export const isGenderDistributionEmpty = (genderDistributionData) => {
42
+ return Object.values(genderDistributionData).every(val => !val || val === 0);
43
+ };
44
+
45
+ export const calculateGenderPieData = (genderDistributionData) => {
46
+ const total = Object.values(genderDistributionData).reduce((all, val) => all + (val || 0), 0);
47
+
48
+ return Object.keys(genderDistributionData).map((key, index) => {
49
+ const color = GENDER_COLORS[index % GENDER_COLORS.length];
50
+
51
+ return {
52
+ value: genderDistributionData[key] || 0,
53
+ percent: total > 0 ? (genderDistributionData[key] || 0) / total : 0,
54
+ color: color,
55
+ label: key,
56
+ key: key,
57
+ };
58
+ });
59
+ };
60
+
61
+ export const getGenderTooltipChildren = (item, isEmpty, genderDistributionData, t, renderTooltipJsx) => {
62
+ if (isEmpty) {
63
+ if (!Object.keys(genderDistributionData).length) {
64
+ return null;
65
+ }
66
+
67
+ return renderTooltipJsx({
68
+ title: t("Gender"),
69
+ items: Object.keys(genderDistributionData).map((k) => ({
70
+ label: k,
71
+ value: 0,
72
+ })),
73
+ });
74
+ }
75
+
76
+ return renderTooltipJsx({
77
+ title: t("Gender"),
78
+ items: [
79
+ {
80
+ color: item.color,
81
+ label: t(item.label),
82
+ value: `${item.value || 0}`,
83
+ },
84
+ ],
85
+ });
86
+ };
87
+
88
+ export const getIndicatorType = (value) => {
89
+ if (value === "yes" || value === true) return "compliant";
90
+ if (value === "no" || value === false) return "notCompliant";
91
+ if (value === null || value === undefined) return "empty";
92
+ return "empty"; // default fallback
93
+ };
94
+
95
+ export const getActivityIndicatorsConfig = (activityData, t) => {
96
+
97
+ return [
98
+ { icon: "Aid", label: t("Aid kit availability"), type: getIndicatorType(activityData?.aidKitAccessible) },
99
+ { icon: "MineOperators", label: t("H&S training delivery"), type: getIndicatorType(activityData?.hsTrainingConfirmation) },
100
+ { icon: "Users", label: t("Workers safe pairing"), type: getIndicatorType(activityData?.duosFormed) },
101
+ {
102
+ icon: "Bear",
103
+ label: t("No children"),
104
+ type: getIndicatorType(activityData?.presenceOfChildren),
105
+ },
106
+ { icon: "Security", label: t("Security presence"), type: getIndicatorType(activityData?.focalPointPresent) },
107
+ { icon: "UserCircle", label: t("Relay presence"), type: getIndicatorType(activityData?.relayPresent) },
108
+ ];
109
+ };
110
+
111
+ export const getMapDataFromActivity = (activityData, t) => {
112
+
113
+ const location = activityData?.location;
114
+ const perimeter = location?.perimeter;
115
+
116
+ const area = Array.isArray(perimeter) && perimeter.length > 0
117
+ ? perimeter
118
+ .filter((coord) => Array.isArray(coord) && coord.length >= 2)
119
+ .map((coord) => {
120
+ const first = typeof coord[0] === 'number' ? coord[0] : parseFloat(coord[0]);
121
+ const second = typeof coord[1] === 'number' ? coord[1] : parseFloat(coord[1]);
122
+
123
+ if (isNaN(first) || isNaN(second) || !isFinite(first) || !isFinite(second)) {
124
+ return null;
125
+ }
126
+
127
+ // Try both formats and use Leaflet to validate
128
+ // First try as [lat, lng]
129
+ try {
130
+ const latLng1 = L.latLng(first, second);
131
+ if (latLng1.lat >= -90 && latLng1.lat <= 90 &&
132
+ latLng1.lng >= -180 && latLng1.lng <= 180) {
133
+ return [latLng1.lat, latLng1.lng];
134
+ }
135
+ } catch (e) {
136
+ // Not valid as [lat, lng], try swapping
137
+ }
138
+
139
+ // Try as [lng, lat] (GeoJSON format) - swap them
140
+ try {
141
+ const latLng2 = L.latLng(second, first);
142
+ if (latLng2.lat >= -90 && latLng2.lat <= 90 &&
143
+ latLng2.lng >= -180 && latLng2.lng <= 180) {
144
+ return [latLng2.lat, latLng2.lng];
145
+ }
146
+ } catch (e) {
147
+ // Invalid coordinates
148
+ }
149
+
150
+ return null;
151
+ })
152
+ .filter((coord) => coord !== null)
153
+ : null;
154
+
155
+ // Don't return early - we need to check for markers even if there's no perimeter
156
+
157
+ const mapData = [];
158
+ const baseColor = '#15FFFFB2';
159
+ const locationName = location?.name || activityData?.name || t("Activity Location");
160
+ const datastakeId = location?.datastakeId || activityData?.datastakeId;
161
+
162
+ // Helper to validate coordinates
163
+ const isValidCoordinate = (coord) => {
164
+ const num = typeof coord === 'number' ? coord : parseFloat(coord);
165
+ return !isNaN(num) && isFinite(num);
166
+ };
167
+
168
+ // Entry 1: Perimeter polygon (independent - show if it exists)
169
+ if (area && area.length >= 3) {
170
+ mapData.push({
171
+ _id: {},
172
+ id: `${activityData?.id || activityData?.datastakeId || 'perimeter'}-perimeter`,
173
+ area: area,
174
+ color: baseColor,
175
+ // No gps property - this will display only the polygon without markers
176
+ name: locationName,
177
+ plotName: locationName,
178
+ territoryTitle: t("Associated Plot"),
179
+ subTitle: t("Activity Location"),
180
+ type: t("Activity Location"),
181
+ datastakeId: datastakeId,
182
+ sources: null,
183
+ link: null,
184
+ });
185
+ }
186
+
187
+ // Entry 2: Arrival marker (independent - show if it exists)
188
+ const arrivalLat = activityData?.locationCheckArrival?.latitude;
189
+ const arrivalLng = activityData?.locationCheckArrival?.longitude;
190
+ if (isValidCoordinate(arrivalLat) && isValidCoordinate(arrivalLng)) {
191
+ mapData.push({
192
+ _id: {},
193
+ id: `${activityData?.id || activityData?.datastakeId || 'arrival'}-arrival`,
194
+ // Include area if it exists, so marker can show on top of polygon
195
+ area: area && area.length >= 3 ? area : null,
196
+ color: baseColor,
197
+ gps: {
198
+ latitude: typeof arrivalLat === 'number' ? arrivalLat : parseFloat(arrivalLat),
199
+ longitude: typeof arrivalLng === 'number' ? arrivalLng : parseFloat(arrivalLng),
200
+ },
201
+ name: t("Activity Start"),
202
+ plotName: locationName,
203
+ territoryTitle: t("Associated Plot"),
204
+ datastakeId: `${datastakeId}-arrival`,
205
+ sources: null,
206
+ link: null,
207
+ });
208
+ }
209
+
210
+ // Entry 3: Departure marker (independent - show if it exists)
211
+ const departureLat = activityData?.locationCheckDeparture?.latitude;
212
+ const departureLng = activityData?.locationCheckDeparture?.longitude;
213
+ if (isValidCoordinate(departureLat) && isValidCoordinate(departureLng)) {
214
+ mapData.push({
215
+ _id: {},
216
+ id: `${activityData?.id || activityData?.datastakeId || 'departure'}-departure`,
217
+ // Include area if it exists, so marker can show on top of polygon
218
+ area: area && area.length >= 3 ? area : null,
219
+ color: baseColor,
220
+ gps: {
221
+ latitude: typeof departureLat === 'number' ? departureLat : parseFloat(departureLat),
222
+ longitude: typeof departureLng === 'number' ? departureLng : parseFloat(departureLng),
223
+ },
224
+ name: t("Activity End"),
225
+ plotName: locationName,
226
+ territoryTitle: t("Associated Plot"),
227
+ datastakeId: `${datastakeId}-departure`,
228
+ markerColor: "#FF7A45",
229
+ sources: null,
230
+ link: null,
231
+ });
232
+ }
233
+
234
+ // Return mapData even if empty - let the map component handle empty arrays
235
+ return mapData;
236
+ };
@@ -0,0 +1,66 @@
1
+ import { useMemo } from 'react';
2
+ import { DashboardLayout, Header, KeyIndicators } from '../../../../../../src/index.js'
3
+ import { getKeyIndicatorsRowConfig, getSiteConditionsConfig } from './config';
4
+ import { getActivityIndicatorsConfig } from './helper';
5
+ import ActivityLocation from './components/ActivityLocation/index.jsx';
6
+ import ActivityImagery from './components/ActivityImagery/index.jsx';
7
+ import WorkersDistribution from './components/WorkersDistribution/index.jsx';
8
+ import MangroveGrowthAndSurvival from './components/MangroveGrowthAndSurvival/index.jsx';
9
+
10
+
11
+ const MonitoringActivitySummary = ({ activityData, supportText, onDownload, downloadDisabled, actionButtons, breadcrumbs, goBackTo, loading, t = () => { } }) => {
12
+ const keyIndicatorsConfig = useMemo(() => getKeyIndicatorsRowConfig({ t, data: activityData }), [t, activityData]);
13
+
14
+ // Activity Indicators Config - mapped from activityData
15
+ const activityIndicatorsConfig = useMemo(() =>
16
+ getActivityIndicatorsConfig(activityData, t),
17
+ [activityData, t]
18
+ );
19
+
20
+ // Site Conditions Config
21
+ const siteConditionsConfig = useMemo(() =>
22
+ getSiteConditionsConfig({ t, data: activityData }),
23
+ [t, activityData]
24
+ );
25
+
26
+
27
+ console.log({activityData});
28
+ return (
29
+ <DashboardLayout
30
+ header={
31
+ <Header
32
+ title={'Monitoring Activity Summary'}
33
+ supportText={supportText || ''}
34
+ onDownload={onDownload}
35
+ downloadDisabled={downloadDisabled}
36
+ actionButtons={actionButtons}
37
+ breadcrumbs={breadcrumbs}
38
+ goBackTo={goBackTo}
39
+ loading={loading}
40
+ />
41
+ }
42
+ >
43
+ <section>
44
+ <KeyIndicators title={t("Key Information")} config={keyIndicatorsConfig} loading={loading} />
45
+ </section>
46
+
47
+ <ActivityLocation activityData={activityData} loading={loading} t={t} />
48
+
49
+ <KeyIndicators
50
+ loading={loading}
51
+ config={siteConditionsConfig}
52
+ title={t("straatos::site-conditions")}
53
+ widgetClassName="h-w-btn-header"
54
+ />
55
+
56
+ <MangroveGrowthAndSurvival
57
+ activityData={activityData}
58
+ loading={loading}
59
+ t={t}
60
+ />
61
+
62
+ </DashboardLayout>
63
+ )
64
+ }
65
+
66
+ export default MonitoringActivitySummary;
@@ -28,7 +28,7 @@ const StakeholderMapping = ({
28
28
  metrics: {
29
29
  operator: ['operator.locationClient'],
30
30
  government: ['custom.stakeholderId', 'governance'],
31
- trader: ['trade'],
31
+ trader: ['trade.locationClient'],
32
32
  other: ['civilSociety', 'international'],
33
33
  }
34
34
  },
@@ -69,10 +69,10 @@ class AdminService extends BaseService {
69
69
  }
70
70
 
71
71
  getSubjects({ subject, params }) {
72
- return this.apiGet({
73
- url: `/management/subjects/${subject}`,
72
+ return this.apiGet({
73
+ url: `${subject}`,
74
74
  params,
75
- });
75
+ })
76
76
  }
77
77
 
78
78
  mergeSubjects({ subject, ...data }) {
@@ -81,15 +81,6 @@ 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
-
93
84
  }
94
85
 
95
86
  export default createLazyService(AdminService);
@@ -26,5 +26,4 @@ class DashboardService extends BaseService {
26
26
  }
27
27
  }
28
28
 
29
- export default createLazyService(DashboardService);
30
-
29
+ export default createLazyService(DashboardService);
@@ -1,102 +1,102 @@
1
1
  export const defaultFilterKeys = ["search", "sortDir", "sortBy", "timeframe", "activeTab"];
2
+
2
3
  function hasJsonStructure(str) {
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
- }
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
+ }
11
12
  }
13
+
12
14
  export const getDefaultActiveFilters = (
13
- params,
14
- selectFiltersConfig,
15
- defaultPageSize,
16
- defaultFilters = {},
17
- doPagination,
15
+ params,
16
+ selectFiltersConfig,
17
+ defaultPageSize,
18
+ defaultFilters = {},
19
+ doPagination,
18
20
  ) => {
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;
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;
56
63
  };
64
+
57
65
  const NEW_PAGINATION_APPS = ["nashiriki"];
58
66
  export const filterParams = (value, module) => {
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
- };
67
+ const { activeFilters, ...rest } = value;
98
68
 
69
+ const { page, pageSize, sortDir, sortBy, search, searchParams, ...filters } =
70
+ activeFilters || {};
99
71
 
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
+ });
100
78
 
79
+ if (search && searchParams) {
80
+ params.search = JSON.stringify({
81
+ qs: search,
82
+ fields: searchParams,
83
+ });
84
+ }
101
85
 
86
+ if (sortDir && sortBy) {
87
+ params.sort = JSON.stringify({
88
+ dir: sortDir,
89
+ by: sortBy,
90
+ });
91
+ }
102
92
 
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
+
101
+ return { ...rest, ...params };
102
+ };
@@ -1,7 +1,4 @@
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",
5
2
  "Site": "Site",
6
3
  "Production Sites": "Production Sites",
7
4
  "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: "Type",
423
+ Type: "Tapez",
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": "Tipo",
236
+ "Type": "Escribe",
237
237
  "type": "Tipo",
238
238
  "Province": "Provincia",
239
239
  "Territory": "Territorio",
package/src/pages.js CHANGED
@@ -21,6 +21,7 @@ export { default as RestorationActivitySummary } from './@daf/pages/Summary/Acti
21
21
  export { default as PlantingCycleSummary } from './@daf/pages/Summary/Activities/PlantingCycle/index.jsx';
22
22
  export { default as MonitoringCampaignSummary } from './@daf/pages/Summary/Activities/MonitoringCampaign/index.jsx';
23
23
  export { default as MineSummary } from './@daf/pages/Summary/Minesite/index.jsx';
24
+ export { default as MonitoringActivitySummary } from './@daf/pages/Summary/Activities/Monitoring/index.jsx';
24
25
 
25
26
  // View
26
27
  export { default as View } from './@daf/pages/View/index.jsx';