datastake-daf 0.6.809 → 0.6.811
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 +1513 -1795
- package/dist/hooks/index.js +4 -11
- package/dist/layouts/index.js +484 -460
- package/dist/pages/index.js +1746 -753
- package/dist/services/index.js +5 -19
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/dist/utils/index.js +489 -484
- package/package.json +1 -1
- package/public/Vegetation/damage-from-insects-default.svg +2 -0
- package/public/Vegetation/dry-or-dead-default.svg +2 -0
- package/public/Vegetation/healthy-default.svg +2 -0
- package/public/Vegetation/yellowing.svg +2 -0
- package/src/@daf/core/components/AuthForm/index.jsx +3 -12
- package/src/@daf/core/components/Icon/configs/Droplets.js +9 -0
- package/src/@daf/core/components/Icon/configs/TrendUp.js +8 -0
- package/src/@daf/core/components/Icon/configs/index.js +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +3 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +51 -51
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +1 -6
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +12 -47
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +10 -36
- package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +30 -22
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +3 -4
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +2 -6
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +12 -14
- package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +0 -3
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +9 -12
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +4 -16
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +17 -9
- package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +8 -9
- package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +99 -124
- package/src/@daf/hooks/useAdminDashboard.js +4 -7
- package/src/@daf/pages/Locations/MineSite/columns.js +18 -1
- package/src/@daf/pages/Locations/MineSite/config.js +2 -2
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/BiodiversityHabitat/InvasiveSpecies.jsx +107 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/BiodiversityHabitat/ObservedFauna.jsx +80 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/BiodiversityHabitat/Stats.jsx +62 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/BiodiversityHabitat/index.jsx +109 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/KeyInformation/index.jsx +8 -4
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/PlantedSpecies.jsx +21 -9
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/SeedlingsHeight.jsx +36 -2
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/Stats.jsx +3 -3
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/VegetationHealth.jsx +19 -8
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/index.jsx +13 -9
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/SalinityLevels.jsx +100 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/SoilType.jsx +84 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/Stats.jsx +72 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/WaterQuality.jsx +84 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/index.jsx +101 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/chartHelpers.js +102 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/index.jsx +8 -2
- package/src/@daf/services/AdminService.js +4 -15
- package/src/@daf/services/DashboardService.js +3 -3
- package/src/@daf/utils/filters.js +15 -13
- package/src/@daf/utils/numbers.js +1 -1
- package/src/constants/locales/en/translation.js +0 -9
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "./helper.js";
|
|
14
14
|
import { getColumns } from "./columns.js";
|
|
15
15
|
import CombineSubjectsModal from "../../AdminModals/CombineSubjects/index.jsx";
|
|
16
|
+
|
|
16
17
|
const { useToken } = theme;
|
|
17
18
|
|
|
18
19
|
export default function SubjectsTable({
|
|
@@ -39,7 +40,10 @@ export default function SubjectsTable({
|
|
|
39
40
|
const { token } = useToken();
|
|
40
41
|
const [isCombineModalOpen, setIsModalOpen] = useState(false);
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
const getDataWithStringPagination = async ({ params }) => {
|
|
43
47
|
const { pagination, tab, filters, search, sort, ...otherParams } = params;
|
|
44
48
|
|
|
45
49
|
let paginationObj = { page: 1, pageSize: 20 };
|
|
@@ -61,14 +65,10 @@ export default function SubjectsTable({
|
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
const page = Number(paginationObj.page) || 1;
|
|
65
|
-
const pageSize = Number(paginationObj.pageSize) || 20;
|
|
66
|
-
const skip = (page - 1) * pageSize;
|
|
67
|
-
|
|
68
68
|
const transformedParams = {
|
|
69
69
|
pagination: {
|
|
70
|
-
skip,
|
|
71
|
-
take: pageSize,
|
|
70
|
+
skip: String(paginationObj.page || 1),
|
|
71
|
+
take: String(paginationObj.pageSize || 20),
|
|
72
72
|
},
|
|
73
73
|
tab: activeTab,
|
|
74
74
|
};
|
|
@@ -133,7 +133,7 @@ export default function SubjectsTable({
|
|
|
133
133
|
{
|
|
134
134
|
icon: "Merge",
|
|
135
135
|
onClick: () => setIsModalOpen(true),
|
|
136
|
-
tooltip: t("merge-subjects"),
|
|
136
|
+
tooltip: t("admin::merge-subjects"),
|
|
137
137
|
disabled: selectedSubjects.length < 2,
|
|
138
138
|
},
|
|
139
139
|
]}
|
|
@@ -192,13 +192,11 @@ export default function SubjectsTable({
|
|
|
192
192
|
onSuccess={(data) => {
|
|
193
193
|
setIsModalOpen(false);
|
|
194
194
|
setLoading(true);
|
|
195
|
+
message.success(t("Subjects successfully merged."))
|
|
195
196
|
if (typeof mergeSubjectsFunction === 'function') {
|
|
196
|
-
mergeSubjectsFunction(data).
|
|
197
|
-
setTimeout(() => {
|
|
198
|
-
fetchData();
|
|
199
|
-
}, 500);
|
|
200
|
-
}).finally(() => {
|
|
197
|
+
mergeSubjectsFunction(data).finally(() => {
|
|
201
198
|
setSelectedSubjects([]);
|
|
199
|
+
fetchData();
|
|
202
200
|
});
|
|
203
201
|
}
|
|
204
202
|
}}
|
|
@@ -209,4 +207,4 @@ export default function SubjectsTable({
|
|
|
209
207
|
/>
|
|
210
208
|
</>
|
|
211
209
|
);
|
|
212
|
-
}
|
|
210
|
+
}
|
|
@@ -32,7 +32,6 @@ export function useAdminTable({
|
|
|
32
32
|
defaultPageSize: defaultPageSize || 20,
|
|
33
33
|
getRedirectLink,
|
|
34
34
|
});
|
|
35
|
-
console.log(filter, "filter.activeFilters");
|
|
36
35
|
|
|
37
36
|
const activeTab = useMemo(() => filter.activeFilters.activeTab, [filter.activeFilters]);
|
|
38
37
|
|
|
@@ -60,14 +59,12 @@ export function useAdminTable({
|
|
|
60
59
|
fetchPendingAccounts();
|
|
61
60
|
}, []);
|
|
62
61
|
|
|
63
|
-
|
|
64
62
|
const fetchData = useCallback(async () => {
|
|
65
63
|
try {
|
|
66
64
|
setLoading(true);
|
|
67
65
|
const params = filterParams({
|
|
68
66
|
activeFilters: filter.activeFilters,
|
|
69
67
|
});
|
|
70
|
-
console.log(params, "params");
|
|
71
68
|
const { data } = await getData({ params });
|
|
72
69
|
setData(data.data || data);
|
|
73
70
|
filter.setPagination((prev) => ({ ...prev, total: data?.meta?.total || data?.length || 0 }));
|
|
@@ -3,7 +3,7 @@ import { ExclamationCircleOutlined } from "@ant-design/icons";
|
|
|
3
3
|
import { useCallback, useEffect } from "react";
|
|
4
4
|
import { useForms } from "../../../../../../context/Forms/index.js";
|
|
5
5
|
import Users from "../Users/index.jsx";
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
export default function Edit({
|
|
8
8
|
t,
|
|
9
9
|
goTo,
|
|
@@ -37,17 +37,14 @@ export default function Edit({
|
|
|
37
37
|
}, [isChanged, addCheck, removeCheck]);
|
|
38
38
|
|
|
39
39
|
const deleteUser = useCallback(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
fetchData();
|
|
45
|
-
} catch (err) {
|
|
46
|
-
handleError(err);
|
|
47
|
-
}
|
|
40
|
+
(id) => {
|
|
41
|
+
// TODO: add call
|
|
42
|
+
console.log("DELETE", id);
|
|
43
|
+
fetchData();
|
|
48
44
|
},
|
|
49
|
-
[fetchData
|
|
45
|
+
[fetchData],
|
|
50
46
|
);
|
|
47
|
+
|
|
51
48
|
const updateUser = useCallback((id, val) => {
|
|
52
49
|
setIsChanged(true);
|
|
53
50
|
setData((prev) => ({
|
|
@@ -74,9 +71,9 @@ export default function Edit({
|
|
|
74
71
|
|
|
75
72
|
const onSuspend = () => {
|
|
76
73
|
Modal.confirm({
|
|
77
|
-
title: t("
|
|
74
|
+
title: t("sbg-admin::suspend-title"),
|
|
78
75
|
icon: <ExclamationCircleOutlined />,
|
|
79
|
-
content:
|
|
76
|
+
content: t("sbg-admin::suspend-content"),
|
|
80
77
|
okText: t("Yes"),
|
|
81
78
|
cancelText: t("No"),
|
|
82
79
|
onOk: async () => {
|
|
@@ -34,7 +34,6 @@ export default function Users({
|
|
|
34
34
|
inviteCompanyAccount = () => {},
|
|
35
35
|
companyId,
|
|
36
36
|
handleError = () => {},
|
|
37
|
-
|
|
38
37
|
}) {
|
|
39
38
|
const [hasError, setHasError] = useState(false);
|
|
40
39
|
const [showFilters, setShowFilters] = useState(false);
|
|
@@ -73,9 +72,9 @@ export default function Users({
|
|
|
73
72
|
const onDeleteUserClick = useCallback(
|
|
74
73
|
(id) => {
|
|
75
74
|
Modal.confirm({
|
|
76
|
-
title: t("
|
|
75
|
+
title: t("sbg-admin::remove-user-title"),
|
|
77
76
|
icon: <ExclamationCircleOutlined />,
|
|
78
|
-
content:
|
|
77
|
+
content: t("sbg-admin::remove-user-body"),
|
|
79
78
|
okText: t("Yes"),
|
|
80
79
|
cancelText: t("No"),
|
|
81
80
|
onOk: () => {
|
|
@@ -88,15 +87,8 @@ export default function Users({
|
|
|
88
87
|
);
|
|
89
88
|
|
|
90
89
|
const data = useMemo(() => {
|
|
91
|
-
const { users = []
|
|
92
|
-
let filtered = [
|
|
93
|
-
...users,
|
|
94
|
-
...pendingUsers.map(u => ({
|
|
95
|
-
...u,
|
|
96
|
-
status: 'pending',
|
|
97
|
-
id: u.invitationToken || u.email // ensure pending users have an ID
|
|
98
|
-
}))
|
|
99
|
-
];
|
|
90
|
+
const { users = [] } = accountData;
|
|
91
|
+
let filtered = [...users];
|
|
100
92
|
|
|
101
93
|
if (!isEmptyOrSpaces(activeFilters.search)) {
|
|
102
94
|
const search = activeFilters.search.toLowerCase();
|
|
@@ -194,10 +186,6 @@ export default function Users({
|
|
|
194
186
|
inviteCompanyAccount={inviteCompanyAccount}
|
|
195
187
|
companyId={companyId}
|
|
196
188
|
handleError={handleError}
|
|
197
|
-
existingEmails={[
|
|
198
|
-
...(accountData?.users || []).map(u => u.email?.toLowerCase()),
|
|
199
|
-
...(accountData?.pendingUsers || []).map(u => u.email?.toLowerCase()),
|
|
200
|
-
].filter(Boolean)}
|
|
201
189
|
/>
|
|
202
190
|
</div>
|
|
203
191
|
);
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { Tag } from "antd";
|
|
2
2
|
|
|
3
3
|
export const renderStatus = ({ val, t = (s) => s }) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
// switch (val) {
|
|
5
|
+
// case "active":
|
|
6
|
+
// return <Tag color="green">{t("Active")}</Tag>;
|
|
7
|
+
// case "unsaved":
|
|
8
|
+
// return <Tag color="red">{t("Unsaved")}</Tag>;
|
|
9
|
+
// case "inactive":
|
|
10
|
+
// case "suspended":
|
|
11
|
+
// return <Tag color="red">{t("Suspended")}</Tag>;
|
|
12
|
+
// case "pending":
|
|
13
|
+
// return <Tag color="orange">{t("Pending")}</Tag>;
|
|
14
|
+
// default:
|
|
15
|
+
// return <Tag color="default">{t("Unknown")}</Tag>;
|
|
16
|
+
// }
|
|
17
|
+
|
|
18
|
+
if (val) {
|
|
11
19
|
return <Tag color="green">{t("Active")}</Tag>;
|
|
20
|
+
} else {
|
|
21
|
+
return <Tag color="red">{t("Suspended")}</Tag>;
|
|
12
22
|
}
|
|
13
|
-
|
|
14
|
-
return <Tag color="red">{t("Suspended")}</Tag>;
|
|
15
23
|
};
|
|
@@ -172,15 +172,14 @@ function AdminView({
|
|
|
172
172
|
try {
|
|
173
173
|
const { pendingCompanyId, status, ...userDataToInvite } = user;
|
|
174
174
|
console.log('Sending invitation for:', user.email, userDataToInvite);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
// console.log('Invitation sent successfully for:', user.email);
|
|
175
|
+
await inviteCompanyAccount({
|
|
176
|
+
companyId: editData.id,
|
|
177
|
+
data: {
|
|
178
|
+
...userDataToInvite,
|
|
179
|
+
pendingCompanyId,
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
console.log('Invitation sent successfully for:', user.email);
|
|
184
183
|
} catch (inviteError) {
|
|
185
184
|
console.error('Failed to invite user:', user.email, inviteError);
|
|
186
185
|
handleError(inviteError);
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
|
-
import { Checkbox, message } from 'antd';
|
|
2
|
+
import { Checkbox, Form, Input, message } from 'antd';
|
|
3
3
|
import DafButton from '../../../Button/index.jsx';
|
|
4
4
|
import Loading from "../../../Loading/index.jsx";
|
|
5
|
-
import AuthForm from "../../../AuthForm/index.jsx";
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const theme = window.theme;
|
|
10
6
|
export default function AppInvitation({
|
|
7
|
+
// Redux State
|
|
11
8
|
errors,
|
|
12
9
|
user,
|
|
13
10
|
invitationSuccess,
|
|
11
|
+
// Actions
|
|
14
12
|
confirmInvitation,
|
|
15
13
|
getUserFromInvitation,
|
|
16
|
-
|
|
14
|
+
// Configuration
|
|
17
15
|
Layout,
|
|
18
16
|
redirectPath = "/",
|
|
19
17
|
loginPath = "/login",
|
|
20
18
|
appRedirectPath = "/app",
|
|
21
19
|
params: propParams = {},
|
|
22
|
-
goTo,
|
|
23
|
-
isMobile = false,
|
|
24
|
-
t,
|
|
25
20
|
}) {
|
|
26
|
-
const {
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
const routeParams = useParams();
|
|
23
|
+
const { app, companyCode, userCode } = { ...routeParams, ...propParams };
|
|
24
|
+
const [passwords] = Form.useForm();
|
|
27
25
|
const [checking, setChecking] = useState(true);
|
|
26
|
+
const goTo = useNavigate();
|
|
27
|
+
const [termsAgreed, setTermsAgreed] = useState(false);
|
|
28
28
|
const [passwordReseted, setPasswordReseted] = useState(false);
|
|
29
29
|
|
|
30
30
|
useEffect(() => {
|
|
@@ -46,125 +46,36 @@ export default function AppInvitation({
|
|
|
46
46
|
localStorage.setItem('token', data.token);
|
|
47
47
|
}
|
|
48
48
|
message.success(t('Invitation accepted'));
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
window.location.href = redirectPath;
|
|
53
|
-
}
|
|
49
|
+
// Fix: ensure we don't rely on a variable from useParams that might not exist
|
|
50
|
+
// Just use the configured redirectPath
|
|
51
|
+
goTo(redirectPath);
|
|
54
52
|
},
|
|
55
53
|
{ companyCode, userCode }
|
|
56
54
|
);
|
|
57
55
|
}
|
|
58
56
|
}, [invitationSuccess, user, confirmInvitation, goTo, redirectPath, companyCode, userCode, t]);
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (!isInInvitationFlow) {
|
|
68
|
-
if (user) {
|
|
69
|
-
if (goTo && typeof goTo === 'function') {
|
|
70
|
-
goTo(appRedirectPath);
|
|
71
|
-
} else {
|
|
72
|
-
window.location.href = appRedirectPath;
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
if (goTo && typeof goTo === 'function') {
|
|
76
|
-
goTo(redirectPath);
|
|
77
|
-
} else {
|
|
78
|
-
window.location.href = redirectPath;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, [user, goTo, appRedirectPath, redirectPath, checking, invitationSuccess]);
|
|
58
|
+
const displayError = (name) => {
|
|
59
|
+
return errors && errors[name] && errors[name].length > 0 && {
|
|
60
|
+
help: errors[name][0],
|
|
61
|
+
validateStatus: 'error',
|
|
62
|
+
};
|
|
63
|
+
};
|
|
83
64
|
|
|
84
65
|
const subTitle = !passwordReseted ? 'Set up your password and agree with out terms and conditions.' :
|
|
85
66
|
isMobile ? 'Your account has been successfully set up. To log in use a desktop device.'
|
|
86
67
|
: 'Your account has been successfully set up. Please click the button below to log in.';
|
|
87
68
|
const title = passwordReseted ? 'Thank You!' : undefined;
|
|
88
69
|
|
|
89
|
-
const fields = [
|
|
90
|
-
{
|
|
91
|
-
name: 'email',
|
|
92
|
-
label: t("Email"),
|
|
93
|
-
type: 'input',
|
|
94
|
-
disabled: true,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: 'password',
|
|
98
|
-
label: t("Password"),
|
|
99
|
-
type: 'password',
|
|
100
|
-
required: true,
|
|
101
|
-
rules: [{
|
|
102
|
-
required: true,
|
|
103
|
-
message: t("errors::password should not be empty")
|
|
104
|
-
}],
|
|
105
|
-
placeholder: t("Password"),
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: 'confirmPassword',
|
|
109
|
-
label: t("Confirm Password"),
|
|
110
|
-
type: 'password',
|
|
111
|
-
required: true,
|
|
112
|
-
dependencies: ['password'],
|
|
113
|
-
rules: [
|
|
114
|
-
{
|
|
115
|
-
required: true,
|
|
116
|
-
message: t("errors::password should not be empty"),
|
|
117
|
-
},
|
|
118
|
-
({ getFieldValue }) => ({
|
|
119
|
-
validator(rule, value) {
|
|
120
|
-
if (!value || getFieldValue('password') === value) {
|
|
121
|
-
return Promise.resolve();
|
|
122
|
-
}
|
|
123
|
-
return Promise.reject(t('errors::passwordNotMatch'));
|
|
124
|
-
},
|
|
125
|
-
}),
|
|
126
|
-
],
|
|
127
|
-
placeholder: t("Confirm Password"),
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'mailUpdates',
|
|
131
|
-
type: 'custom',
|
|
132
|
-
valuePropName: 'checked',
|
|
133
|
-
component: <Checkbox>{t("Sign up to receive updates")}</Checkbox>,
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: 'agreeTerms',
|
|
137
|
-
type: 'custom',
|
|
138
|
-
valuePropName: 'checked',
|
|
139
|
-
rules: [{
|
|
140
|
-
validator: (_, value) => value ? Promise.resolve() : Promise.reject(new Error(t('You must agree to the terms and conditions')))
|
|
141
|
-
}],
|
|
142
|
-
component: (
|
|
143
|
-
<Checkbox>
|
|
144
|
-
<p className="mb-0">
|
|
145
|
-
{t('Agree to the Terms of Use of this application and the Privacy Policy')}
|
|
146
|
-
</p>
|
|
147
|
-
</Checkbox>
|
|
148
|
-
),
|
|
149
|
-
}
|
|
150
|
-
];
|
|
151
|
-
|
|
152
|
-
const handleSubmit = (values) => {
|
|
153
|
-
const { password, mailUpdates } = values;
|
|
154
|
-
confirmInvitation(
|
|
155
|
-
{ password, mailUpdates },
|
|
156
|
-
() => { },
|
|
157
|
-
{ companyCode, userCode }
|
|
158
|
-
);
|
|
159
|
-
setPasswordReseted(true);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
70
|
if (checking && !invitationSuccess) {
|
|
163
71
|
return <Loading />;
|
|
164
72
|
}
|
|
165
73
|
|
|
74
|
+
// If auto-confirming (inviteToken present), we might want to show loading or nothing until redirect
|
|
166
75
|
if (invitationSuccess && user && user.inviteToken) {
|
|
167
|
-
|
|
76
|
+
// The useEffect will handle the redirect/confirm.
|
|
77
|
+
// We can show loading here too or just return null.
|
|
78
|
+
// Original code: checks invitationSuccess && !user.inviteToken for form, else redirect.
|
|
168
79
|
return <Loading />;
|
|
169
80
|
}
|
|
170
81
|
|
|
@@ -177,7 +88,6 @@ export default function AppInvitation({
|
|
|
177
88
|
<DafButton
|
|
178
89
|
type="primary"
|
|
179
90
|
className="normal-br"
|
|
180
|
-
style={theme || window.theme ? { backgroundColor: (theme || window.theme).colorPrimary, borderColor: (theme || window.theme).colorPrimary } : {}}
|
|
181
91
|
onClick={() => {
|
|
182
92
|
window.location.href = loginPath;
|
|
183
93
|
}}
|
|
@@ -187,21 +97,86 @@ export default function AppInvitation({
|
|
|
187
97
|
)}
|
|
188
98
|
</div>
|
|
189
99
|
) : (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
100
|
+
<>
|
|
101
|
+
<Form name="password" layout="vertical" form={passwords} >
|
|
102
|
+
<Form.Item
|
|
103
|
+
required
|
|
104
|
+
name="password"
|
|
105
|
+
{...displayError('password')}
|
|
106
|
+
label={t("Password")}
|
|
107
|
+
rules={[{
|
|
108
|
+
required: true,
|
|
109
|
+
message: t("errors::password should not be empty")
|
|
110
|
+
}]}>
|
|
111
|
+
<Input.Password size="large" placeholder={t("Password")} />
|
|
112
|
+
</Form.Item>
|
|
113
|
+
<Form.Item
|
|
114
|
+
required
|
|
115
|
+
name="confirmPassword"
|
|
116
|
+
{...displayError('confirmPassword')}
|
|
117
|
+
label={t("Confirm Password")}
|
|
118
|
+
dependencies={['password']}
|
|
119
|
+
rules={[
|
|
120
|
+
{
|
|
121
|
+
required: true,
|
|
122
|
+
message: t("errors::password should not be empty"),
|
|
123
|
+
},
|
|
124
|
+
({ getFieldValue }) => ({
|
|
125
|
+
validator(rule, value) {
|
|
126
|
+
if (!value || getFieldValue('password') === value) {
|
|
127
|
+
return Promise.resolve();
|
|
128
|
+
}
|
|
129
|
+
return Promise.reject(t('errors::passwordNotMatch'));
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
]}>
|
|
133
|
+
<Input.Password size="large" placeholder={t("Confirm Password")} />
|
|
134
|
+
</Form.Item>
|
|
135
|
+
<Form.Item
|
|
136
|
+
name="mailUpdates" valuePropName="checked" noStyle>
|
|
137
|
+
<Checkbox>{t("Sign up to receive updates")}</Checkbox>
|
|
138
|
+
</Form.Item>
|
|
139
|
+
<Form.Item
|
|
140
|
+
name="agreeTerms" valuePropName="checked" noStyle>
|
|
141
|
+
<Checkbox
|
|
142
|
+
checked={termsAgreed}
|
|
143
|
+
onChange={(e) => setTermsAgreed(e.target.checked)}
|
|
144
|
+
>
|
|
145
|
+
<p className="mb-0">
|
|
146
|
+
{t('Agree to the Terms of Use of this application and the Privacy Policy')}
|
|
147
|
+
</p>
|
|
148
|
+
</Checkbox>
|
|
149
|
+
</Form.Item>
|
|
150
|
+
</Form>
|
|
151
|
+
<div className="buttons">
|
|
152
|
+
<DafButton
|
|
153
|
+
className="normal-br"
|
|
154
|
+
type="primary"
|
|
155
|
+
block
|
|
156
|
+
size="large"
|
|
157
|
+
disabled={!termsAgreed}
|
|
158
|
+
onClick={() => {
|
|
159
|
+
passwords.validateFields().then(data => {
|
|
160
|
+
const { password, mailUpdates } = data;
|
|
161
|
+
confirmInvitation(
|
|
162
|
+
{ password, mailUpdates },
|
|
163
|
+
() => { },
|
|
164
|
+
{ companyCode, userCode }
|
|
165
|
+
);
|
|
166
|
+
setPasswordReseted(true);
|
|
167
|
+
});
|
|
168
|
+
}}
|
|
169
|
+
>
|
|
170
|
+
{t("Confirm")}
|
|
171
|
+
</DafButton>
|
|
172
|
+
</div>
|
|
173
|
+
</>
|
|
200
174
|
)}
|
|
201
175
|
</>
|
|
202
176
|
);
|
|
203
177
|
|
|
204
178
|
if (Layout) {
|
|
179
|
+
// Assuming Layout accepts these props as per Nashiriki AuthLayout
|
|
205
180
|
return <Layout app={app} step={1} subTitle={subTitle} title={title}>{Content}</Layout>;
|
|
206
181
|
}
|
|
207
182
|
|
|
@@ -214,5 +189,5 @@ export default function AppInvitation({
|
|
|
214
189
|
);
|
|
215
190
|
}
|
|
216
191
|
|
|
217
|
-
return
|
|
192
|
+
return user ? <Navigate to={appRedirectPath} /> : <Navigate to={redirectPath} />;
|
|
218
193
|
}
|
|
@@ -46,20 +46,15 @@ export function useAdminDashboard({ dashboardService, onError }) {
|
|
|
46
46
|
}, [dashboardService, onError]);
|
|
47
47
|
|
|
48
48
|
const fetchUserGrowth = useCallback(
|
|
49
|
-
async (
|
|
49
|
+
async (params) => {
|
|
50
50
|
if (!dashboardService?.getUserGrowth) {
|
|
51
51
|
console.warn("dashboardService.getUserGrowth not provided");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
if (activeFilter === undefined || activeFilter === null) {
|
|
56
|
-
console.warn("activeFilter not provided to fetchUserGrowth");
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
55
|
setUserGrowthDataLoading(true);
|
|
61
56
|
try {
|
|
62
|
-
const response = await dashboardService.getUserGrowth(
|
|
57
|
+
const response = await dashboardService.getUserGrowth(params);
|
|
63
58
|
setUserGrowthData(response || []);
|
|
64
59
|
} catch (err) {
|
|
65
60
|
if (onError) {
|
|
@@ -73,9 +68,11 @@ export function useAdminDashboard({ dashboardService, onError }) {
|
|
|
73
68
|
},
|
|
74
69
|
[dashboardService, onError]
|
|
75
70
|
);
|
|
71
|
+
|
|
76
72
|
useEffect(() => {
|
|
77
73
|
fetchDashboardData();
|
|
78
74
|
}, [fetchDashboardData]);
|
|
75
|
+
|
|
79
76
|
return {
|
|
80
77
|
data,
|
|
81
78
|
loading,
|
|
@@ -39,7 +39,24 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
39
39
|
|
|
40
40
|
return <Tooltip title={v}>{v}</Tooltip>;
|
|
41
41
|
},
|
|
42
|
-
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
dataIndex: 'category',
|
|
45
|
+
title: t('Category'),
|
|
46
|
+
ellipsis: true,
|
|
47
|
+
show: true,
|
|
48
|
+
render: (v, all) => {
|
|
49
|
+
if (all.empty) {
|
|
50
|
+
return <div className="daf-default-cell" />
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const locationCategories = [...(data?.options?.locationCategories || []), ...(options?.productionSiteCategories || [])]
|
|
54
|
+
|
|
55
|
+
const category = findOptions(v, locationCategories);
|
|
56
|
+
|
|
57
|
+
return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
|
|
58
|
+
},
|
|
59
|
+
},
|
|
43
60
|
{
|
|
44
61
|
dataIndex: 'region',
|
|
45
62
|
title: findOptions(user?.company?.country, options?.administrativeLevel1)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel1) : t("Province"),
|
|
@@ -85,8 +85,8 @@ export const getFiltersConfig = ({t}) => {
|
|
|
85
85
|
},
|
|
86
86
|
category: {
|
|
87
87
|
type: 'select',
|
|
88
|
-
label: '
|
|
89
|
-
placeholder: () => `${t('Filter by')} ${t('
|
|
88
|
+
label: 'Category',
|
|
89
|
+
placeholder: () => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
90
90
|
style: { flex: 1 },
|
|
91
91
|
labelStyle: { flex: 1 },
|
|
92
92
|
getLabel: (option) => option.label,
|