datastake-daf 0.6.813 → 0.6.814
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 +3056 -4315
- package/dist/hooks/index.js +4 -11
- package/dist/layouts/index.js +478 -464
- package/dist/pages/index.js +490 -576
- package/dist/services/index.js +6 -56
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/dist/utils/index.js +483 -492
- package/package.json +1 -1
- package/src/@daf/core/components/AuthForm/index.jsx +3 -12
- package/src/@daf/core/components/Icon/configs/index.js +3 -1
- 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 +31 -56
- 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 +10 -37
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +0 -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 +13 -25
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +2 -17
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +13 -27
- package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/components/index.jsx +2 -4
- 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/core/components/Screens/Admin/adminRoutes.js +1 -48
- package/src/@daf/hooks/useAdminDashboard.js +4 -7
- package/src/@daf/pages/View/hooks/useViewActions.js +0 -13
- package/src/@daf/pages/View/hooks/useViewPermissions.js +0 -16
- package/src/@daf/pages/View/index.jsx +4 -29
- package/src/@daf/services/AdminService.js +5 -47
- package/src/@daf/services/DashboardService.js +3 -3
- package/src/@daf/utils/filters.js +15 -13
- package/src/constants/locales/en/translation.js +0 -13
- package/src/helpers/copyToClipboard.js +0 -60
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +0 -81
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +0 -77
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +0 -127
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +0 -43
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +0 -201
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +0 -146
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +0 -58
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +0 -176
package/package.json
CHANGED
|
@@ -13,20 +13,13 @@ function AuthForm ({
|
|
|
13
13
|
errors,
|
|
14
14
|
t = (key) => key,
|
|
15
15
|
executeRecaptcha = () => {},
|
|
16
|
-
getCurrentStep = () => {}
|
|
17
|
-
theme,
|
|
16
|
+
getCurrentStep = () => {}
|
|
18
17
|
}){
|
|
19
18
|
const [formInstance] = Form.useForm(form);
|
|
20
19
|
const [currentStep, setCurrentStep] = useState(0);
|
|
21
20
|
const [allFormValues, setAllFormValues] = useState(initialValues);
|
|
22
21
|
const [formErrors, setFormErrors] = useState(null);
|
|
23
22
|
|
|
24
|
-
const buttonStyle = theme?.colorPrimary ? {
|
|
25
|
-
backgroundColor: theme.colorPrimary,
|
|
26
|
-
borderColor: theme.colorPrimary,
|
|
27
|
-
} : {};
|
|
28
|
-
|
|
29
|
-
|
|
30
23
|
const isMultiStep = !!steps;
|
|
31
24
|
const currentFields = isMultiStep ? steps?.[currentStep]?.fields : fields || [];
|
|
32
25
|
|
|
@@ -173,7 +166,6 @@ function AuthForm ({
|
|
|
173
166
|
name: field.name,
|
|
174
167
|
label: field.label,
|
|
175
168
|
rules: field.rules,
|
|
176
|
-
dependencies: field.dependencies,
|
|
177
169
|
style: { marginBottom: 0 }
|
|
178
170
|
};
|
|
179
171
|
if (field.valuePropName && field.type !== 'select') {
|
|
@@ -225,7 +217,6 @@ function AuthForm ({
|
|
|
225
217
|
htmlType="submit"
|
|
226
218
|
disabled={isLastStep && !allFieldsFilled}
|
|
227
219
|
block className="normal-br"
|
|
228
|
-
style={buttonStyle}
|
|
229
220
|
>
|
|
230
221
|
{isLastStep ? submitText : t("Next")}
|
|
231
222
|
</BorderedButton>
|
|
@@ -234,14 +225,14 @@ function AuthForm ({
|
|
|
234
225
|
}}
|
|
235
226
|
</Form.Item>
|
|
236
227
|
<div className="buttons" style={{ marginTop: 0}}>
|
|
237
|
-
<BorderedButton onClick={prev} block className="normal-br"
|
|
228
|
+
<BorderedButton onClick={prev} block className="normal-br">
|
|
238
229
|
{t("Back")}
|
|
239
230
|
</BorderedButton>
|
|
240
231
|
</div>
|
|
241
232
|
</div>
|
|
242
233
|
) : (
|
|
243
234
|
<div className="buttons" style={{ marginTop: isMultiStep ? '16px' : 0}}>
|
|
244
|
-
<BorderedButton type="primary" htmlType="submit" block className="normal-br"
|
|
235
|
+
<BorderedButton type="primary" htmlType="submit" block className="normal-br">
|
|
245
236
|
{isMultiStep ? t("Next") : submitText}
|
|
246
237
|
</BorderedButton>
|
|
247
238
|
</div>
|
|
@@ -230,6 +230,7 @@ import Up from "./Up";
|
|
|
230
230
|
import Down from "./Down";
|
|
231
231
|
import TrendUp from "./TrendUp";
|
|
232
232
|
import Droplets from "./Droplets";
|
|
233
|
+
import AddDocument from "./AddDocument";
|
|
233
234
|
|
|
234
235
|
const config = {
|
|
235
236
|
AppAdmin,
|
|
@@ -463,7 +464,8 @@ const config = {
|
|
|
463
464
|
Up,
|
|
464
465
|
Down,
|
|
465
466
|
TrendUp,
|
|
466
|
-
Droplets
|
|
467
|
+
Droplets,
|
|
468
|
+
AddDocument
|
|
467
469
|
};
|
|
468
470
|
|
|
469
471
|
export default config;
|
|
@@ -12,6 +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
|
+
console.log("mainData", mainData);
|
|
15
16
|
const fetchData = () => {
|
|
16
17
|
const { dates = [] } = mainData;
|
|
17
18
|
const _data = [];
|
|
@@ -9,11 +9,13 @@ 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
|
+
console.log("usergrowthhhhh", data);
|
|
13
|
+
|
|
12
14
|
useEffect(() => {
|
|
13
15
|
if (typeof fetchUserGrowth === "function") {
|
|
14
16
|
fetchUserGrowth(selectValue);
|
|
15
17
|
}
|
|
16
|
-
}, [selectValue
|
|
18
|
+
}, [selectValue]);
|
|
17
19
|
|
|
18
20
|
return (
|
|
19
21
|
<Widget
|
|
@@ -34,19 +34,19 @@ export default function CombineLocationModal({
|
|
|
34
34
|
|
|
35
35
|
const onSubmit = () => {
|
|
36
36
|
MainForm.validateFields().then((data) => {
|
|
37
|
-
const ids = selectedLocations.map((location) => location.id);
|
|
37
|
+
const ids = selectedLocations.map((location) => location.id);
|
|
38
38
|
const allowedKeys = [
|
|
39
|
-
"id",
|
|
40
|
-
"name",
|
|
41
|
-
"country",
|
|
42
|
-
"category",
|
|
43
|
-
"administrativeLevel1",
|
|
39
|
+
"id",
|
|
40
|
+
"name",
|
|
41
|
+
"country",
|
|
42
|
+
"category",
|
|
43
|
+
"administrativeLevel1",
|
|
44
44
|
"administrativeLevel2"
|
|
45
|
-
];
|
|
45
|
+
];
|
|
46
46
|
const filteredData = Object.fromEntries(
|
|
47
47
|
Object.entries(data).filter(([key]) => allowedKeys.includes(key))
|
|
48
48
|
);
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
onSuccess({
|
|
51
51
|
ids,
|
|
52
52
|
data: filteredData,
|
|
@@ -66,15 +66,15 @@ export default function CombineLocationModal({
|
|
|
66
66
|
destroyOnHidden={true}
|
|
67
67
|
onValuesChange={() => {
|
|
68
68
|
setIsDisabled(() => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
const values = MainForm.getFieldsValue();
|
|
70
|
+
|
|
71
|
+
const requiredFields = entity?.includes("location")
|
|
72
|
+
? ["id", "name", "category", "country", "administrativeLevel1", "administrativeLevel2"]
|
|
73
|
+
: ["id", "name", "category", "country"];
|
|
74
|
+
|
|
75
|
+
return requiredFields.some((field) => values[field] === undefined);
|
|
76
76
|
});
|
|
77
|
-
|
|
77
|
+
}}
|
|
78
78
|
>
|
|
79
79
|
<Container>
|
|
80
80
|
<div className="daf-table-wrapper no-pagination">
|
|
@@ -124,7 +124,7 @@ export default function CombineLocationModal({
|
|
|
124
124
|
options={selectedLocations.map((location) => {
|
|
125
125
|
return {
|
|
126
126
|
label: location?.datastakeId || "-",
|
|
127
|
-
|
|
127
|
+
value: location?.id || "-",
|
|
128
128
|
};
|
|
129
129
|
})}
|
|
130
130
|
placeholder={t("ID")}
|
|
@@ -181,41 +181,41 @@ export default function CombineLocationModal({
|
|
|
181
181
|
|
|
182
182
|
{entity?.includes("location") && (
|
|
183
183
|
<>
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
184
|
+
<Form.Item className="flex-1" name="administrativeLevel1">
|
|
185
|
+
<Select
|
|
186
|
+
placeholder={t("Province")}
|
|
187
|
+
options={selectedLocations
|
|
188
|
+
.map((location) => {
|
|
189
|
+
const _data = getAdminLevelName(location?.linking?.SCL, "level_1");
|
|
190
|
+
return {
|
|
191
|
+
label: _data?.name || "-",
|
|
192
|
+
value: _data?.id || "-",
|
|
193
|
+
};
|
|
194
|
+
})
|
|
195
|
+
.filter(
|
|
196
|
+
(option, index, self) =>
|
|
197
|
+
index === self.findIndex((o) => o.value === option.value),
|
|
198
|
+
)}
|
|
199
|
+
/>
|
|
200
|
+
</Form.Item>
|
|
201
201
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
202
|
+
<Form.Item className="flex-1" name="administrativeLevel2">
|
|
203
|
+
<Select
|
|
204
|
+
placeholder={t("Territory")}
|
|
205
|
+
options={selectedLocations
|
|
206
|
+
.map((location) => {
|
|
207
|
+
const _data = getAdminLevelName(location?.linking?.SCL, "level_2");
|
|
208
|
+
return {
|
|
209
|
+
label: _data?.name || "-",
|
|
210
|
+
value: _data?.id || "-",
|
|
211
|
+
};
|
|
212
|
+
})
|
|
213
|
+
.filter(
|
|
214
|
+
(option, index, self) =>
|
|
215
|
+
index === self.findIndex((o) => o.value === option.value),
|
|
216
|
+
)}
|
|
217
|
+
/>
|
|
218
|
+
</Form.Item>
|
|
219
219
|
</>
|
|
220
220
|
)}
|
|
221
221
|
</Form>
|
|
@@ -37,8 +37,6 @@ export default function CombineSubjectsModal({
|
|
|
37
37
|
const onSubmit = () => {
|
|
38
38
|
MainForm.validateFields().then((data) => {
|
|
39
39
|
const ids = selectedSubjects.map((subject) => subject.id);
|
|
40
|
-
console.log(ids, "ids");
|
|
41
|
-
console.log(data, "data");
|
|
42
40
|
onSuccess({
|
|
43
41
|
ids,
|
|
44
42
|
data,
|
|
@@ -114,10 +112,7 @@ export default function CombineSubjectsModal({
|
|
|
114
112
|
>
|
|
115
113
|
<Form.Item className="flex-1" name="id">
|
|
116
114
|
<Select
|
|
117
|
-
options={selectedSubjects
|
|
118
|
-
label: s?.datastakeId || "-",
|
|
119
|
-
value: s?.id || "-",
|
|
120
|
-
}))}
|
|
115
|
+
options={mapToSelectOptions(selectedSubjects, "datastakeId", selectOptions, null)}
|
|
121
116
|
placeholder={t("ID")}
|
|
122
117
|
></Select>
|
|
123
118
|
</Form.Item>
|
|
@@ -6,67 +6,42 @@ export default function NewAccount({
|
|
|
6
6
|
t,
|
|
7
7
|
isOpen,
|
|
8
8
|
onClose,
|
|
9
|
-
accountTypes ,
|
|
9
|
+
accountTypes = [],
|
|
10
10
|
fetchData,
|
|
11
|
-
updateAccount,
|
|
12
11
|
inviteAccount,
|
|
13
|
-
isPending=false,
|
|
14
|
-
accountToEdit,
|
|
15
12
|
}) {
|
|
16
13
|
const [MainForm] = Form.useForm();
|
|
17
14
|
const [loading, setLoading] = useState(false);
|
|
18
15
|
const [accountUsed, setAccountUsed] = useState(false);
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const isEdit = useMemo(() => accountToEdit && typeof accountToEdit === "object", [accountToEdit]);
|
|
17
|
+
const isEdit = useMemo(() => isOpen && typeof isOpen === "object", [isOpen]);
|
|
24
18
|
|
|
25
19
|
useEffect(() => {
|
|
26
|
-
if (
|
|
20
|
+
if (isOpen && typeof isOpen === "object") {
|
|
27
21
|
MainForm.setFieldsValue({
|
|
28
|
-
name:
|
|
29
|
-
email:
|
|
30
|
-
type: accountToEdit?.otherData?.interface,
|
|
22
|
+
name: isOpen.name,
|
|
23
|
+
email: isOpen?.admin?.email,
|
|
31
24
|
});
|
|
32
25
|
} else {
|
|
33
26
|
MainForm.resetFields();
|
|
34
27
|
}
|
|
35
|
-
|
|
28
|
+
}, [isOpen, MainForm]);
|
|
36
29
|
|
|
37
|
-
const onSubmit =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
} else {
|
|
51
|
-
// Create new account
|
|
52
|
-
if (!inviteAccount) {
|
|
53
|
-
throw new Error("inviteAccount function is required for creating new accounts");
|
|
30
|
+
const onSubmit = () => {
|
|
31
|
+
MainForm.validateFields()
|
|
32
|
+
.then(async (val) => {
|
|
33
|
+
try {
|
|
34
|
+
setLoading(true);
|
|
35
|
+
await inviteAccount(val);
|
|
36
|
+
setLoading(false);
|
|
37
|
+
fetchData();
|
|
38
|
+
onClose();
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.log(err);
|
|
41
|
+
setLoading(false);
|
|
54
42
|
}
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
setLoading(false);
|
|
59
|
-
fetchData();
|
|
60
|
-
onClose();
|
|
61
|
-
MainForm.resetFields();
|
|
62
|
-
} catch (err) {
|
|
63
|
-
console.log(err);
|
|
64
|
-
setLoading(false);
|
|
65
|
-
if (err.errorFields) {
|
|
66
|
-
// Validation errors, don't show error message
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
43
|
+
})
|
|
44
|
+
.catch(() => {});
|
|
70
45
|
};
|
|
71
46
|
|
|
72
47
|
return (
|
|
@@ -82,18 +57,18 @@ export default function NewAccount({
|
|
|
82
57
|
<Form.Item name="name" label={t("Name")} rules={[{ required: true }]}>
|
|
83
58
|
<Input placeholder={t("Type")} />
|
|
84
59
|
</Form.Item>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<Form.Item
|
|
88
|
-
name="email"
|
|
89
|
-
label={t("Email")}
|
|
90
|
-
rules={[{ required: true, type: "email" }]}
|
|
91
|
-
>
|
|
92
|
-
<Input placeholder={t("Type")} />
|
|
93
|
-
</Form.Item>
|
|
94
|
-
|
|
95
60
|
<Form.Item name="type" label={t("Type")} rules={[{ required: true }]}>
|
|
96
|
-
<Select placeholder={t("Select")} options={accountTypes
|
|
61
|
+
<Select placeholder={t("Select")} options={accountTypes} />
|
|
62
|
+
</Form.Item>
|
|
63
|
+
<Form.Item name="email" label={t("Email")} rules={[{ required: true, type: "email" }]}>
|
|
64
|
+
<Input
|
|
65
|
+
placeholder={t("Type")}
|
|
66
|
+
onChange={() => {
|
|
67
|
+
if (accountUsed) {
|
|
68
|
+
setAccountUsed(false);
|
|
69
|
+
}
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
97
72
|
</Form.Item>
|
|
98
73
|
{accountUsed && (
|
|
99
74
|
<Alert
|
|
@@ -13,17 +13,11 @@ export default function NewUser({
|
|
|
13
13
|
inviteCompanyAccount = () => {},
|
|
14
14
|
companyId,
|
|
15
15
|
handleError = () => {},
|
|
16
|
-
existingEmails = [],
|
|
17
16
|
}) {
|
|
18
17
|
const [MainForm] = Form.useForm();
|
|
19
18
|
const [accountUsed, setAccountUsed] = useState(false);
|
|
20
19
|
const [loading, setLoading] = useState(false);
|
|
21
20
|
|
|
22
|
-
const checkEmailExists = (email) => {
|
|
23
|
-
if (!email) return false;
|
|
24
|
-
return existingEmails.includes(email.toLowerCase());
|
|
25
|
-
};
|
|
26
|
-
|
|
27
21
|
useEffect(() => {
|
|
28
22
|
if (defaultData) {
|
|
29
23
|
MainForm.setFieldsValue({
|
|
@@ -36,12 +30,6 @@ export default function NewUser({
|
|
|
36
30
|
const onSubmit = async () => {
|
|
37
31
|
try {
|
|
38
32
|
const val = await MainForm.validateFields();
|
|
39
|
-
|
|
40
|
-
if (checkEmailExists(val.email)) {
|
|
41
|
-
setAccountUsed(true);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
33
|
setLoading(true);
|
|
46
34
|
|
|
47
35
|
const apiPayload = {
|
|
@@ -62,7 +50,6 @@ export default function NewUser({
|
|
|
62
50
|
const localUserData = {
|
|
63
51
|
...apiPayload,
|
|
64
52
|
status: 'pending',
|
|
65
|
-
id: apiPayload.email, // Add a unique ID for the table key
|
|
66
53
|
// apps: {
|
|
67
54
|
// [module]: {
|
|
68
55
|
// role: val.role,
|
|
@@ -97,29 +84,16 @@ export default function NewUser({
|
|
|
97
84
|
<Input placeholder={t("Type")} />
|
|
98
85
|
</Form.Item>
|
|
99
86
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}}
|
|
111
|
-
/>
|
|
112
|
-
</Form.Item>
|
|
113
|
-
{accountUsed && (
|
|
114
|
-
<Alert
|
|
115
|
-
message={t("This email corresponds to another account.")}
|
|
116
|
-
type="error"
|
|
117
|
-
className="mb-2"
|
|
118
|
-
showIcon
|
|
119
|
-
closable
|
|
120
|
-
onClose={() => setAccountUsed(false)}
|
|
121
|
-
/>
|
|
122
|
-
)}
|
|
87
|
+
<Form.Item name="email" label={t("Email")} rules={[{ required: true, type: "email" }]}>
|
|
88
|
+
<Input
|
|
89
|
+
placeholder={t("Type")}
|
|
90
|
+
onChange={() => {
|
|
91
|
+
if (accountUsed) {
|
|
92
|
+
setAccountUsed(false);
|
|
93
|
+
}
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
</Form.Item>
|
|
123
97
|
|
|
124
98
|
<Form.Item name="role" label={t("Role")} rules={[{ required: true }]}>
|
|
125
99
|
<Select
|
|
@@ -2,7 +2,6 @@ import React, { useCallback, useMemo, useState } from "react";
|
|
|
2
2
|
import { message } from "antd";
|
|
3
3
|
import AccountTable from "../AdminTables/AccountTable/index.jsx";
|
|
4
4
|
import DefaultNewAccountModal from "../AdminModals/NewAccount/index.jsx";
|
|
5
|
-
import { copyStringToClipboard } from "../../../../../../helpers/copyToClipboard.js";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Admin Accounts Screen Wrapper
|
|
@@ -36,21 +35,20 @@ export default function AdminAccountsScreen({ config }) {
|
|
|
36
35
|
options,
|
|
37
36
|
useQuery,
|
|
38
37
|
NewAccountModal,
|
|
39
|
-
appUrl
|
|
40
38
|
} = config;
|
|
41
|
-
console.log(accountTypes, "accountTypes");
|
|
42
|
-
// const userTypes = useMemo(() => accountTypes.map((c) => ({
|
|
43
|
-
// label: c.label,
|
|
44
|
-
// value: c.value,
|
|
45
|
-
// })), [accountTypes]);
|
|
46
39
|
|
|
47
40
|
const AccountModal = NewAccountModal || DefaultNewAccountModal;
|
|
48
41
|
|
|
49
42
|
const query = useQuery ? useQuery() : { get: () => null };
|
|
50
43
|
const [addAccountVisible, setAddAccountVisible] = useState(!!query.get("create"));
|
|
51
|
-
const [accountToEdit, setAccountToEdit] = useState(null);
|
|
52
44
|
|
|
45
|
+
const onResendInvitation = useCallback(() => {
|
|
46
|
+
message.success(t("Invitation email resent"));
|
|
47
|
+
}, [t]);
|
|
53
48
|
|
|
49
|
+
const onCopyInvitation = useCallback(() => {
|
|
50
|
+
message.success(t("Invitation link copied"));
|
|
51
|
+
}, [t]);
|
|
54
52
|
|
|
55
53
|
const actionButtons = useMemo(
|
|
56
54
|
() => [
|
|
@@ -64,13 +62,6 @@ console.log(accountTypes, "accountTypes");
|
|
|
64
62
|
[t]
|
|
65
63
|
);
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
function handleAccountModal(data) {
|
|
69
|
-
console.log(data, "data");
|
|
70
|
-
setAddAccountVisible(true);
|
|
71
|
-
setAccountToEdit(data);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
65
|
function handleGetData(params) {
|
|
75
66
|
return AdminService.getAccounts(params);
|
|
76
67
|
}
|
|
@@ -78,18 +69,7 @@ console.log(accountTypes, "accountTypes");
|
|
|
78
69
|
function handleCancelVerification(token) {
|
|
79
70
|
return AdminService.cancelInvitation(token);
|
|
80
71
|
}
|
|
81
|
-
function handleResendInvitation(account) {
|
|
82
|
-
console.log("account", account);
|
|
83
|
-
const token = account.invitationToken || account.users?.[0]?.invitationToken || account.admin?.invitationToken;
|
|
84
|
-
return AdminService.resendInvitation({ invitationToken: token });
|
|
85
|
-
}
|
|
86
72
|
|
|
87
|
-
|
|
88
|
-
function handleCopyInvitation(account) {
|
|
89
|
-
const link = `${appUrl}/register?code=${account.invitationToken}`;
|
|
90
|
-
copyStringToClipboard(link);
|
|
91
|
-
message.success(t("Invitation link copied"));
|
|
92
|
-
}
|
|
93
73
|
return (
|
|
94
74
|
<>
|
|
95
75
|
<AccountTable
|
|
@@ -104,15 +84,14 @@ function handleCopyInvitation(account) {
|
|
|
104
84
|
getData={handleGetData}
|
|
105
85
|
config={{
|
|
106
86
|
accountTypes,
|
|
107
|
-
addAccountVisible,
|
|
108
87
|
options: {
|
|
109
88
|
countries: options?.countries,
|
|
110
89
|
},
|
|
111
90
|
onTableClick: {
|
|
112
91
|
onCanelVerification: handleCancelVerification,
|
|
113
|
-
onCopyInvitation
|
|
114
|
-
onResendInvitation
|
|
115
|
-
setAddAccountVisible
|
|
92
|
+
onCopyInvitation,
|
|
93
|
+
onResendInvitation,
|
|
94
|
+
setAddAccountVisible,
|
|
116
95
|
},
|
|
117
96
|
}}
|
|
118
97
|
/>
|
|
@@ -120,17 +99,11 @@ function handleCopyInvitation(account) {
|
|
|
120
99
|
<AccountModal
|
|
121
100
|
t={t}
|
|
122
101
|
isOpen={addAccountVisible}
|
|
123
|
-
onClose={() =>
|
|
124
|
-
setAddAccountVisible(false);
|
|
125
|
-
setAccountToEdit(null);
|
|
126
|
-
}}
|
|
102
|
+
onClose={() => setAddAccountVisible(false)}
|
|
127
103
|
accountTypes={accountTypes}
|
|
128
|
-
countriesOptions={options?.countries}
|
|
129
104
|
fetchData={() => {
|
|
130
105
|
}}
|
|
131
106
|
inviteAccount={(data) => AdminService.inviteAccount(data)}
|
|
132
|
-
updateAccount={({ data, id, isPending }) => AdminService.updateAccount({ data, id, isPending })}
|
|
133
|
-
accountToEdit={accountToEdit}
|
|
134
107
|
/>
|
|
135
108
|
</>
|
|
136
109
|
);
|
|
@@ -38,7 +38,8 @@ export default function AdminDashboardScreen({ config }) {
|
|
|
38
38
|
|
|
39
39
|
const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
|
|
40
40
|
const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
|
|
41
|
-
const safeUserGrowth = userGrowthData
|
|
41
|
+
const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
|
|
42
|
+
console.log("safeUserGrowth", safeUserGrowth);
|
|
42
43
|
|
|
43
44
|
return (
|
|
44
45
|
<AdminDashboard
|
|
@@ -49,7 +50,6 @@ export default function AdminDashboardScreen({ config }) {
|
|
|
49
50
|
loadingUserGrowth={userGrowthDataLoading}
|
|
50
51
|
fetchUserGrowth={fetchUserGrowth}
|
|
51
52
|
adminTranslationIdentifier={appName}
|
|
52
|
-
userGrowthData={safeUserGrowth}
|
|
53
53
|
data={{
|
|
54
54
|
keyIndicatorsData: keyIndicatorsConfig,
|
|
55
55
|
userActivityData: safeUserActivity,
|
|
@@ -11,5 +11,3 @@ export { default as AdminAccountsViewScreen } from "./AccountsView.jsx";
|
|
|
11
11
|
export { default as AdminSubjectsScreen } from "./Subjects.jsx";
|
|
12
12
|
export { default as AdminLocationScreen } from "./Location.jsx";
|
|
13
13
|
export { default as AdminSubjectsViewScreen } from "./SubjectsView.jsx";
|
|
14
|
-
export { default as AdminDocumentsScreen } from "./Documents.jsx";
|
|
15
|
-
export { default as AdminEventsScreen } from "./Events.jsx";
|
|
@@ -270,28 +270,36 @@ export const getColumns = ({
|
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
const moreMenuItems =
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
273
|
+
const moreMenuItems = !val.emailVerified
|
|
274
|
+
? [
|
|
275
|
+
{
|
|
276
|
+
label: t("admin::cancel-invitation"),
|
|
277
|
+
value: "cancel",
|
|
278
|
+
onClick: () => onCanelVerification(val),
|
|
279
|
+
},
|
|
280
|
+
]
|
|
281
|
+
: [
|
|
282
|
+
{
|
|
283
|
+
label: t("Edit"),
|
|
284
|
+
value: "edit",
|
|
285
|
+
onClick: () => setAddAccountVisible(val),
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
label: t("Resend Invitation"),
|
|
289
|
+
value: "resend",
|
|
290
|
+
onClick: () => onResendInvitation(val),
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
label: t("Copy Invitation Link"),
|
|
294
|
+
value: "copy",
|
|
295
|
+
onClick: () => onCopyInvitation(val),
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
label: t("admin::cancel-invitation"),
|
|
299
|
+
value: "cancel",
|
|
300
|
+
onClick: () => onCanelVerification(val),
|
|
301
|
+
},
|
|
302
|
+
];
|
|
295
303
|
|
|
296
304
|
return <MoreMenu items={moreMenuItems} />;
|
|
297
305
|
},
|