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.
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +588 -729
- package/dist/pages/index.js +775 -34
- package/dist/services/index.js +1 -10
- package/dist/utils/index.js +12 -28
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/ActivityIndicators.stories.js +24 -0
- package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/index.jsx +1 -0
- package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/style.js +34 -0
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/KeyIndicators.stories.js +39 -0
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/LabelWithIcon.jsx +38 -0
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/index.jsx +16 -3
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/style.js +33 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +5 -5
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +5 -23
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +36 -36
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +21 -12
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +8 -13
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +2 -2
- package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityImagery/index.jsx +29 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityLocation/index.jsx +94 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/PlantedSpecies/index.jsx +56 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SeedlingsHeight/index.jsx +121 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SurvivalRate/index.jsx +94 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/index.jsx +54 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/WorkersDistribution/index.jsx +49 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/config.js +51 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/helper.js +236 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/index.jsx +66 -0
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +1 -1
- package/src/@daf/services/AdminService.js +3 -12
- package/src/@daf/services/DashboardService.js +1 -2
- package/src/@daf/utils/filters.js +89 -89
- package/src/constants/locales/en/translation.js +0 -3
- package/src/constants/locales/fr/translation.js +1 -1
- package/src/constants/locales/sp/translation.js +1 -1
- package/src/pages.js +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +0 -224
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +0 -65
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +0 -180
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +0 -27
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +0 -157
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +0 -31
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +0 -77
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +0 -117
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +0 -54
- package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
package/dist/services/index.js
CHANGED
|
@@ -765,7 +765,7 @@ class AdminService extends BaseService {
|
|
|
765
765
|
params
|
|
766
766
|
}) {
|
|
767
767
|
return this.apiGet({
|
|
768
|
-
url:
|
|
768
|
+
url: `${subject}`,
|
|
769
769
|
params
|
|
770
770
|
});
|
|
771
771
|
}
|
|
@@ -778,15 +778,6 @@ class AdminService extends BaseService {
|
|
|
778
778
|
data
|
|
779
779
|
});
|
|
780
780
|
}
|
|
781
|
-
getUserGrowth(activeFilter) {
|
|
782
|
-
return this.apiGet({
|
|
783
|
-
url: `/accounts/dashboard/user-growth`,
|
|
784
|
-
isUserManager: true,
|
|
785
|
-
params: {
|
|
786
|
-
activeFilter
|
|
787
|
-
}
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
781
|
}
|
|
791
782
|
var AdminService$1 = createLazyService(AdminService);
|
|
792
783
|
|
package/dist/utils/index.js
CHANGED
|
@@ -7506,6 +7506,7 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
7506
7506
|
});
|
|
7507
7507
|
return o;
|
|
7508
7508
|
};
|
|
7509
|
+
const NEW_PAGINATION_APPS = ["nashiriki"];
|
|
7509
7510
|
const filterParams = (value, module) => {
|
|
7510
7511
|
const {
|
|
7511
7512
|
activeFilters,
|
|
@@ -7521,12 +7522,10 @@ const filterParams = (value, module) => {
|
|
|
7521
7522
|
...filters
|
|
7522
7523
|
} = activeFilters || {};
|
|
7523
7524
|
const params = {};
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
take: pageSize || 20
|
|
7529
|
-
};
|
|
7525
|
+
params.pagination = JSON.stringify({
|
|
7526
|
+
[NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
|
|
7527
|
+
[NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
|
|
7528
|
+
});
|
|
7530
7529
|
if (search && searchParams) {
|
|
7531
7530
|
params.search = JSON.stringify({
|
|
7532
7531
|
qs: search,
|
|
@@ -7541,24 +7540,12 @@ const filterParams = (value, module) => {
|
|
|
7541
7540
|
}
|
|
7542
7541
|
if (Object.keys(filters).length) {
|
|
7543
7542
|
if (value.sourceId && value.sourceId === "overview") {
|
|
7544
|
-
|
|
7545
|
-
activeTab,
|
|
7546
|
-
...restFilters
|
|
7547
|
-
} = filters;
|
|
7548
|
-
Object.assign(params, restFilters);
|
|
7549
|
-
if (activeTab !== undefined) {
|
|
7550
|
-
params.tab = activeTab;
|
|
7551
|
-
}
|
|
7543
|
+
params.filters = JSON.stringify(filters);
|
|
7552
7544
|
} else {
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
} = filters;
|
|
7558
|
-
Object.assign(params, restFilters);
|
|
7559
|
-
if (activeTab !== undefined) {
|
|
7560
|
-
params.tab = activeTab;
|
|
7561
|
-
}
|
|
7545
|
+
params.filters = JSON.stringify({
|
|
7546
|
+
...filters,
|
|
7547
|
+
authorId: undefined
|
|
7548
|
+
});
|
|
7562
7549
|
}
|
|
7563
7550
|
}
|
|
7564
7551
|
return {
|
|
@@ -7765,9 +7752,6 @@ function getRedirectPath(user, fallback = '', app, isDatastake) {
|
|
|
7765
7752
|
}
|
|
7766
7753
|
|
|
7767
7754
|
const en = {
|
|
7768
|
-
"sbg-admin::remove-user-title": "Remove User Title",
|
|
7769
|
-
"sbg-admin::remove-user-body": "Remove User Body",
|
|
7770
|
-
"add-account": "Add Account",
|
|
7771
7755
|
"Site": "Site",
|
|
7772
7756
|
"Production Sites": "Production Sites",
|
|
7773
7757
|
"Type of account": "Type of account",
|
|
@@ -9467,7 +9451,7 @@ const fr = {
|
|
|
9467
9451
|
Documentation: "Documents",
|
|
9468
9452
|
"Edit project": "Modifier le projet",
|
|
9469
9453
|
Name: "Nom",
|
|
9470
|
-
Type: "
|
|
9454
|
+
Type: "Tapez",
|
|
9471
9455
|
type: "Type",
|
|
9472
9456
|
Province: "Province",
|
|
9473
9457
|
Territory: "Territoire",
|
|
@@ -11278,7 +11262,7 @@ const sp = {
|
|
|
11278
11262
|
"Documentation": "Documentos",
|
|
11279
11263
|
"Edit project": "Modificar proyecto",
|
|
11280
11264
|
"Name": "Nombre",
|
|
11281
|
-
"Type": "
|
|
11265
|
+
"Type": "Escribe",
|
|
11282
11266
|
"type": "Tipo",
|
|
11283
11267
|
"Province": "Provincia",
|
|
11284
11268
|
"Territory": "Territorio",
|
package/package.json
CHANGED
package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/ActivityIndicators.stories.js
CHANGED
|
@@ -250,3 +250,27 @@ export const NoMinWidth = {
|
|
|
250
250
|
);
|
|
251
251
|
},
|
|
252
252
|
};
|
|
253
|
+
|
|
254
|
+
export const SingleColumn = {
|
|
255
|
+
name: "Single Column Layout",
|
|
256
|
+
args: {
|
|
257
|
+
className: "single-column",
|
|
258
|
+
},
|
|
259
|
+
render: (args) => {
|
|
260
|
+
const config = [
|
|
261
|
+
{ icon: "Package", label: "Aid kit availability", type: "compliant" },
|
|
262
|
+
{ icon: "SchoolHat", label: "H&S training delivery", type: "compliant" },
|
|
263
|
+
{ icon: "UsersCheck", label: "Workers safe pairing", type: "notCompliant" },
|
|
264
|
+
{ icon: "User", label: "Children presence", type: "compliant" },
|
|
265
|
+
{ icon: "Lock", label: "Security presence", type: "empty" },
|
|
266
|
+
{ icon: "Refresh05", label: "Relay presence", type: "compliant" },
|
|
267
|
+
];
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<ActivityIndicators
|
|
271
|
+
{...args}
|
|
272
|
+
config={config}
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
},
|
|
276
|
+
};
|
|
@@ -27,6 +27,7 @@ import styled from "styled-components";
|
|
|
27
27
|
* @param {ReactNode} children - Additional content to render
|
|
28
28
|
* @param {boolean} noTitle - Hide the widget title
|
|
29
29
|
* @param {string} filterMode - Filter indicators by type: "all" | "compliant" | "notCompliant" | "empty"
|
|
30
|
+
* @param {string} className - Additional CSS classes. Use "single-column" to force single-column layout
|
|
30
31
|
*/
|
|
31
32
|
export default function ActivityIndicatorsWidget({
|
|
32
33
|
t = (s) => s,
|
|
@@ -99,6 +99,40 @@ const Style = styled.div`
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
&.single-column {
|
|
104
|
+
grid-template-columns: 1fr;
|
|
105
|
+
|
|
106
|
+
.indicator-item {
|
|
107
|
+
/* Remove the 2-column specific separators first */
|
|
108
|
+
&:nth-child(1),
|
|
109
|
+
&:nth-child(2),
|
|
110
|
+
&:nth-child(3),
|
|
111
|
+
&:nth-child(4) {
|
|
112
|
+
&::after {
|
|
113
|
+
display: none !important;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* On single column, all items except last get separator */
|
|
118
|
+
&:not(:last-child) {
|
|
119
|
+
&::after {
|
|
120
|
+
content: '' !important;
|
|
121
|
+
position: absolute;
|
|
122
|
+
bottom: 0;
|
|
123
|
+
left: var(--size-lg);
|
|
124
|
+
right: var(--size-lg);
|
|
125
|
+
height: 1px;
|
|
126
|
+
background-color: var(--border-color, #E5E7EB);
|
|
127
|
+
display: block !important;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:last-child::after {
|
|
132
|
+
display: none !important;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
102
136
|
`;
|
|
103
137
|
|
|
104
138
|
export const NoMinWidth = styled.div`
|
|
@@ -120,3 +120,42 @@ export const NoMinWidth = {
|
|
|
120
120
|
],
|
|
121
121
|
},
|
|
122
122
|
};
|
|
123
|
+
|
|
124
|
+
export const SiteConditions = {
|
|
125
|
+
name: "SiteConditions",
|
|
126
|
+
args: {
|
|
127
|
+
title: "Site Conditions",
|
|
128
|
+
className: "small-content",
|
|
129
|
+
config: [
|
|
130
|
+
{
|
|
131
|
+
label: "Season",
|
|
132
|
+
icon: "Tree",
|
|
133
|
+
render: () => <div>Rainy</div>
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: "Weather conditions",
|
|
137
|
+
icon: "Globe",
|
|
138
|
+
render: () => <div>Cloudy</div>
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: "Tide level",
|
|
142
|
+
icon: "WaterDrop",
|
|
143
|
+
render: () => <div>Medium</div>
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
label: "Disturbances",
|
|
147
|
+
icon: "Lightning",
|
|
148
|
+
render: () => <div>None</div>
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
render: (args) => {
|
|
153
|
+
return (
|
|
154
|
+
<DashboardLayout>
|
|
155
|
+
<section>
|
|
156
|
+
<KeyIndicators {...args} />
|
|
157
|
+
</section>
|
|
158
|
+
</DashboardLayout>
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import CustomIcon from '../../../Icon/CustomIcon.jsx';
|
|
4
|
+
|
|
5
|
+
const LabelWithIcon = ({ t, name, icon, iconColor = "#028788", iconWidth = 16, iconHeight = 16 }) => {
|
|
6
|
+
// name is expected to be already translated (string) or a translation key
|
|
7
|
+
// If it's a string that looks like a translation key (contains '::'), translate it
|
|
8
|
+
// Otherwise, use it as-is (already translated)
|
|
9
|
+
const displayText = (typeof name === 'string' && name.includes('::') && t && typeof t === 'function')
|
|
10
|
+
? t(name)
|
|
11
|
+
: name;
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className="flex items-center" style={{ gap: 8 }}>
|
|
15
|
+
{icon && <CustomIcon name={icon} color={iconColor} width={iconWidth} height={iconHeight} />}
|
|
16
|
+
<span style={{
|
|
17
|
+
fontSize: '14px',
|
|
18
|
+
fontWeight: 500,
|
|
19
|
+
lineHeight: '26px',
|
|
20
|
+
letterSpacing: '0%',
|
|
21
|
+
color: 'var(--base-gray-70)',
|
|
22
|
+
fontFamily: 'SF UI Display, -apple-system, BlinkMacSystemFont, sans-serif'
|
|
23
|
+
}}>{displayText}</span>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
LabelWithIcon.propTypes = {
|
|
29
|
+
t: PropTypes.func,
|
|
30
|
+
name: PropTypes.string.isRequired,
|
|
31
|
+
icon: PropTypes.string,
|
|
32
|
+
iconColor: PropTypes.string,
|
|
33
|
+
iconWidth: PropTypes.number,
|
|
34
|
+
iconHeight: PropTypes.number,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default LabelWithIcon;
|
|
38
|
+
|
|
@@ -2,6 +2,7 @@ import Style, { NoMinWidth } from "./style";
|
|
|
2
2
|
import Widget from "../index.jsx";
|
|
3
3
|
import { formatClassname } from "../../../../../../helpers/ClassesHelper";
|
|
4
4
|
import { Tooltip } from "antd";
|
|
5
|
+
import LabelWithIcon from "./LabelWithIcon.jsx";
|
|
5
6
|
|
|
6
7
|
export default function KeyIndicatorsWidget({
|
|
7
8
|
t = (s) => s,
|
|
@@ -25,8 +26,8 @@ export default function KeyIndicatorsWidget({
|
|
|
25
26
|
{children}
|
|
26
27
|
<Style className={formatClassname(["flex", className])}>
|
|
27
28
|
{config.map((c, i) => (
|
|
28
|
-
<div className=
|
|
29
|
-
<Label label={c.label} withTooltip={withTooltip} />
|
|
29
|
+
<div className={`row-item ${c.icon ? 'row-item-with-icon' : ''}`} key={`key-indicators-${i}`}>
|
|
30
|
+
<Label label={c.label} icon={c.icon} withTooltip={withTooltip} t={t} />
|
|
30
31
|
<div className="flex">{c.render()}</div>
|
|
31
32
|
</div>
|
|
32
33
|
))}
|
|
@@ -40,7 +41,19 @@ export default function KeyIndicatorsWidget({
|
|
|
40
41
|
return component;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
function Label({ label, withTooltip }) {
|
|
44
|
+
function Label({ label, icon, withTooltip, t }) {
|
|
45
|
+
if (icon) {
|
|
46
|
+
const labelContent = <LabelWithIcon t={t} name={label} icon={icon} />;
|
|
47
|
+
if (withTooltip) {
|
|
48
|
+
return (
|
|
49
|
+
<Tooltip title={label} placement="topLeft">
|
|
50
|
+
<h4>{labelContent}</h4>
|
|
51
|
+
</Tooltip>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return <h4>{labelContent}</h4>;
|
|
55
|
+
}
|
|
56
|
+
|
|
44
57
|
if (withTooltip) {
|
|
45
58
|
return (
|
|
46
59
|
<Tooltip title={label} placement="topLeft">
|
|
@@ -59,12 +59,45 @@ const Style = styled.div`
|
|
|
59
59
|
margin-top: 14px;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
&.row-item-with-icon {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
gap: 8px;
|
|
68
|
+
|
|
69
|
+
h4 {
|
|
70
|
+
margin-bottom: 0;
|
|
71
|
+
flex: 0 0 auto;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.flex {
|
|
75
|
+
flex: 0 0 auto;
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
font-size: 16px;
|
|
79
|
+
font-weight: 500;
|
|
80
|
+
line-height: 38px;
|
|
81
|
+
letter-spacing: 0;
|
|
82
|
+
color: var(--base-gray-90);
|
|
83
|
+
font-family: 'SF UI Display', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
62
86
|
}
|
|
63
87
|
|
|
64
88
|
&.small-content {
|
|
65
89
|
span {
|
|
66
90
|
font-size: 16px;
|
|
67
91
|
}
|
|
92
|
+
|
|
93
|
+
.row-item-with-icon {
|
|
94
|
+
.flex {
|
|
95
|
+
font-size: 16px;
|
|
96
|
+
line-height: 38px;
|
|
97
|
+
font-weight: 500;
|
|
98
|
+
color: var(--base-gray-90);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
68
101
|
}
|
|
69
102
|
|
|
70
103
|
.ant-tag {
|
|
@@ -10,6 +10,7 @@ const { useToken } = theme;
|
|
|
10
10
|
export default function useTopContributors({ container, data = [], t }) {
|
|
11
11
|
const [mainGraph, setMainGraph] = useState(null);
|
|
12
12
|
const { token } = useToken();
|
|
13
|
+
|
|
13
14
|
useEffect(() => {
|
|
14
15
|
if (container.current) {
|
|
15
16
|
if (mainGraph) {
|
|
@@ -12,7 +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
|
-
|
|
15
|
+
|
|
16
16
|
const fetchData = () => {
|
|
17
17
|
const { dates = [] } = mainData;
|
|
18
18
|
const _data = [];
|
|
@@ -9,7 +9,7 @@ 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
|
-
|
|
12
|
+
|
|
13
13
|
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
if (typeof fetchUserGrowth === "function") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Modal from "../../../../Modal/index.jsx";
|
|
2
2
|
import { Form, Input, Select, theme } from "antd";
|
|
3
3
|
import { Container } from "../CombineModalStyle.js";
|
|
4
|
-
|
|
4
|
+
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
5
5
|
import DAFTable from "../../../../Table/index.jsx";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
import { getColumns } from "./helper.js";
|
|
@@ -20,7 +20,7 @@ export default function AdminDashboardScreen({ config }) {
|
|
|
20
20
|
userGrowthDataLoading,
|
|
21
21
|
} = useWidgetFetch();
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
console.log({userGrowthData});
|
|
24
24
|
|
|
25
25
|
const actionsWidgetsConfig = useMemo(
|
|
26
26
|
() => getActionWidgetsConfig({ getRedirectLink }),
|
|
@@ -39,7 +39,7 @@ export default function AdminDashboardScreen({ config }) {
|
|
|
39
39
|
const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
|
|
40
40
|
const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
|
|
41
41
|
const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<AdminDashboard
|
|
@@ -47,11 +47,11 @@ export default function AdminLocationScreen({ config }) {
|
|
|
47
47
|
const handleMergeLocations = useCallback(
|
|
48
48
|
async (mergeData) => {
|
|
49
49
|
try {
|
|
50
|
-
if (AdminService.
|
|
51
|
-
await AdminService.
|
|
50
|
+
if (AdminService.mergeLocations) {
|
|
51
|
+
await AdminService.mergeLocations(mergeData);
|
|
52
52
|
message.success(t("Locations merged successfully"));
|
|
53
53
|
} else {
|
|
54
|
-
console.warn("AdminService.
|
|
54
|
+
console.warn("AdminService.mergeLocations is not implemented");
|
|
55
55
|
message.success(t("Locations merged successfully"));
|
|
56
56
|
}
|
|
57
57
|
} catch (err) {
|
|
@@ -61,12 +61,12 @@ export default function AdminLocationScreen({ config }) {
|
|
|
61
61
|
[AdminService, t, handleError]
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
// Use custom getData if provided, otherwise use default AdminService.
|
|
64
|
+
// Use custom getData if provided, otherwise use default AdminService.getLocations
|
|
65
65
|
const getLocations = useCallback((params) => {
|
|
66
66
|
if (getData) {
|
|
67
67
|
return getData(params);
|
|
68
68
|
}
|
|
69
|
-
return AdminService.
|
|
69
|
+
return AdminService.getLocations(params);
|
|
70
70
|
}, [getData, AdminService]);
|
|
71
71
|
|
|
72
72
|
return (
|
|
@@ -48,7 +48,7 @@ export default function AdminSubjectsScreen({ config }) {
|
|
|
48
48
|
async (mergeData) => {
|
|
49
49
|
try {
|
|
50
50
|
if (AdminService.mergeSubjects) {
|
|
51
|
-
await AdminService.mergeSubjects(
|
|
51
|
+
await AdminService.mergeSubjects(mergeData);
|
|
52
52
|
message.success(t("Subjects merged successfully"));
|
|
53
53
|
} else {
|
|
54
54
|
console.warn("AdminService.mergeSubjects is not implemented");
|
|
@@ -66,7 +66,7 @@ export default function AdminSubjectsScreen({ config }) {
|
|
|
66
66
|
if (getData) {
|
|
67
67
|
return getData(params);
|
|
68
68
|
}
|
|
69
|
-
return AdminService.getSubjects(
|
|
69
|
+
return AdminService.getSubjects(params);
|
|
70
70
|
}, [getData, AdminService]);
|
|
71
71
|
|
|
72
72
|
return (
|
|
@@ -2,7 +2,7 @@ import { useState, useMemo } from "react";
|
|
|
2
2
|
import { useAdminTable } from "../hook";
|
|
3
3
|
import AdminTable from "../components/index.jsx";
|
|
4
4
|
import DAFTable from "../../../../Table/index.jsx";
|
|
5
|
-
import { theme, Tag
|
|
5
|
+
import { theme, Tag } from "antd";
|
|
6
6
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
7
7
|
import {
|
|
8
8
|
getTabs,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
defaultUrlParams,
|
|
12
12
|
checkboxConfig,
|
|
13
13
|
} from "../SubjectsTable/helper.js";
|
|
14
|
+
import { getColumns } from "../SubjectsTable/columns.js";
|
|
14
15
|
import CombineLocationModal from "../../AdminModals/CombineLocation/index.jsx";
|
|
15
|
-
import { getColumns } from "./column.js";
|
|
16
16
|
const { useToken } = theme;
|
|
17
17
|
|
|
18
18
|
export default function LocationTable({
|
|
@@ -37,22 +37,6 @@ export default function LocationTable({
|
|
|
37
37
|
const { token } = useToken();
|
|
38
38
|
const [combineLocationVisible, setCombineLocationVisible] = useState(false);
|
|
39
39
|
|
|
40
|
-
// Wrapper to transform pagination params to strings and ensure tab is at root level
|
|
41
|
-
const getDataWithStringPagination = async ({ params }) => {
|
|
42
|
-
// Extract tab from the params (it should already be there from filterParams)
|
|
43
|
-
const { pagination, tab, ...otherParams } = params;
|
|
44
|
-
|
|
45
|
-
const transformedParams = {
|
|
46
|
-
...otherParams,
|
|
47
|
-
pagination: {
|
|
48
|
-
skip: String(pagination?.skip || 1),
|
|
49
|
-
take: String(pagination?.take || 20),
|
|
50
|
-
},
|
|
51
|
-
tab: tab || "active", // Ensure tab is at root level with default value
|
|
52
|
-
};
|
|
53
|
-
return getData({ params: transformedParams });
|
|
54
|
-
};
|
|
55
|
-
|
|
56
40
|
const {
|
|
57
41
|
filter,
|
|
58
42
|
activeTab,
|
|
@@ -74,7 +58,7 @@ export default function LocationTable({
|
|
|
74
58
|
defaultPageSize,
|
|
75
59
|
filtersConfig,
|
|
76
60
|
getRedirectLink,
|
|
77
|
-
getData
|
|
61
|
+
getData,
|
|
78
62
|
refetchTrigger,
|
|
79
63
|
});
|
|
80
64
|
|
|
@@ -96,7 +80,7 @@ export default function LocationTable({
|
|
|
96
80
|
setSelectedLocations,
|
|
97
81
|
getRedirectLink,
|
|
98
82
|
selectOptions,
|
|
99
|
-
entity: headerTitle
|
|
83
|
+
entity: headerTitle
|
|
100
84
|
});
|
|
101
85
|
}, [t, goTo, module, token, selectedLocations, getRedirectLink, selectOptions, headerTitle]);
|
|
102
86
|
|
|
@@ -105,7 +89,7 @@ export default function LocationTable({
|
|
|
105
89
|
<AdminTable
|
|
106
90
|
filters={filter}
|
|
107
91
|
t={t}
|
|
108
|
-
headerTitle={
|
|
92
|
+
headerTitle={headerTitle}
|
|
109
93
|
actionButton={[
|
|
110
94
|
{
|
|
111
95
|
icon: "Merge",
|
|
@@ -126,7 +110,6 @@ export default function LocationTable({
|
|
|
126
110
|
checkboxConfig={checkboxConfig}
|
|
127
111
|
defaultTableFilters={{}}
|
|
128
112
|
breadcrumbs={breadcrumbs}
|
|
129
|
-
|
|
130
113
|
>
|
|
131
114
|
{selectedLocations.length > 0 && (
|
|
132
115
|
<div
|
|
@@ -185,7 +168,6 @@ export default function LocationTable({
|
|
|
185
168
|
if (typeof mergeSubjectsFunction === 'function') {
|
|
186
169
|
mergeSubjectsFunction(data);
|
|
187
170
|
setSelectedLocations([])
|
|
188
|
-
message.success(t("Locations successfully merged."))
|
|
189
171
|
}
|
|
190
172
|
}}
|
|
191
173
|
selectedLocations={selectedLocations}
|
|
@@ -104,48 +104,48 @@ export const getColumns = ({
|
|
|
104
104
|
return <Tooltip title={country}>{country}</Tooltip>;
|
|
105
105
|
},
|
|
106
106
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
{
|
|
108
|
+
title: t("Province"),
|
|
109
|
+
dataIndex: "administrativeLevel1",
|
|
110
|
+
key: "administrativeLevel1",
|
|
111
|
+
ellipsis: true,
|
|
112
|
+
show: entity.includes("locations"),
|
|
113
|
+
render: (value, all) => {
|
|
114
|
+
if (all.empty) {
|
|
115
|
+
return <div className="daf-default-cell" />;
|
|
116
|
+
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
118
|
+
let label;
|
|
119
|
+
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
120
|
+
label = all?.linking?.SCL?.[value]?.name
|
|
121
|
+
} else {
|
|
122
|
+
label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
|
|
123
|
+
}
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
126
|
+
},
|
|
126
127
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
128
|
+
{
|
|
129
|
+
title: t("Territory"),
|
|
130
|
+
dataIndex: "administrativeLevel2",
|
|
131
|
+
key: "administrativeLevel2",
|
|
132
|
+
show: entity.includes("locations"),
|
|
133
|
+
ellipsis: true,
|
|
134
|
+
render: (value, all) => {
|
|
135
|
+
if (all.empty) {
|
|
136
|
+
return <div className="daf-default-cell" />;
|
|
137
|
+
}
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
let label;
|
|
140
|
+
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
141
|
+
label = all?.linking?.SCL?.[value]?.name
|
|
142
|
+
} else {
|
|
143
|
+
label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
|
|
144
|
+
}
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
147
|
+
},
|
|
147
148
|
},
|
|
148
|
-
},
|
|
149
149
|
{
|
|
150
150
|
title: t("Sources"),
|
|
151
151
|
dataIndex: "sources",
|