datastake-daf 0.6.843 → 0.6.845
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/dist/components/index.js +1140 -1152
- package/dist/pages/index.js +21 -12
- package/package.json +1 -1
- package/src/@daf/core/components/EditForm/helper.js +14 -6
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +19 -6
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +4 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +2 -0
- package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/config.js +10 -1
- package/src/@daf/pages/ResetPassword/index.jsx +228 -228
- package/src/@daf/pages/Template/components/LinkingTemplate/config.js +1 -0
- package/src/@daf/pages/Template/components/LinkingTemplate/index.jsx +3 -1
- package/src/@daf/services/LinkedSubjects.js +1 -0
package/dist/pages/index.js
CHANGED
|
@@ -14265,6 +14265,8 @@ const getFiltersConfig$e = ({
|
|
|
14265
14265
|
value: item.value,
|
|
14266
14266
|
label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
|
|
14267
14267
|
}));
|
|
14268
|
+
const merged = [...(options?.locationCategories || []), ...(options?.productionSiteCategories || [])];
|
|
14269
|
+
const deduped = Array.from(new Map(merged.map(item => [item.value, item])).values());
|
|
14268
14270
|
if (activeTab === 'stakeholder') {
|
|
14269
14271
|
return [{
|
|
14270
14272
|
label: t("Stakeholder type"),
|
|
@@ -14291,7 +14293,7 @@ const getFiltersConfig$e = ({
|
|
|
14291
14293
|
key: "type",
|
|
14292
14294
|
type: "select",
|
|
14293
14295
|
...value,
|
|
14294
|
-
options:
|
|
14296
|
+
options: deduped
|
|
14295
14297
|
}];
|
|
14296
14298
|
};
|
|
14297
14299
|
|
|
@@ -34207,10 +34209,14 @@ const inputTypeComponent$1 = {
|
|
|
34207
34209
|
}
|
|
34208
34210
|
return {
|
|
34209
34211
|
label: o.label,
|
|
34210
|
-
items: opts.filter(op => op.
|
|
34212
|
+
items: opts.filter(op => op?.filters?.[0]?.value.includes(o.value))
|
|
34211
34213
|
};
|
|
34212
34214
|
});
|
|
34213
|
-
const notGrouped = opts.filter(op =>
|
|
34215
|
+
const notGrouped = opts.filter(op => {
|
|
34216
|
+
const filterValue = op?.filters?.[0]?.value;
|
|
34217
|
+
if (!filterValue) return true;
|
|
34218
|
+
return !gKeys.some(key => filterValue.includes(key));
|
|
34219
|
+
});
|
|
34214
34220
|
if (notGrouped.length) {
|
|
34215
34221
|
groupOptions.unshift(...notGrouped);
|
|
34216
34222
|
}
|
|
@@ -34374,20 +34380,19 @@ const inputTypeComponent$1 = {
|
|
|
34374
34380
|
}
|
|
34375
34381
|
return {
|
|
34376
34382
|
label: o.label,
|
|
34377
|
-
items: opts.filter(op => op.
|
|
34383
|
+
items: opts.filter(op => op?.filters?.[0]?.value.includes(o.value))
|
|
34378
34384
|
};
|
|
34379
34385
|
});
|
|
34380
|
-
const notGrouped = opts.filter(op =>
|
|
34386
|
+
const notGrouped = opts.filter(op => {
|
|
34387
|
+
const filterValue = op?.filters?.[0]?.value;
|
|
34388
|
+
if (!filterValue) return true;
|
|
34389
|
+
return !gKeys.some(key => filterValue.includes(key));
|
|
34390
|
+
});
|
|
34381
34391
|
if (notGrouped.length) {
|
|
34382
34392
|
groupOptions.unshift(...notGrouped);
|
|
34383
34393
|
}
|
|
34384
34394
|
opts = groupOptions;
|
|
34385
34395
|
}
|
|
34386
|
-
console.log({
|
|
34387
|
-
maxWidth,
|
|
34388
|
-
staticWidth,
|
|
34389
|
-
fullWidth
|
|
34390
|
-
});
|
|
34391
34396
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
34392
34397
|
size: "medium",
|
|
34393
34398
|
allowClear: true,
|
|
@@ -62422,7 +62427,8 @@ const namespaceMap = {
|
|
|
62422
62427
|
"armed-groups": "stakeholder",
|
|
62423
62428
|
scl: "location",
|
|
62424
62429
|
testimonials: 'event',
|
|
62425
|
-
'corrective-actions': 'event'
|
|
62430
|
+
'corrective-actions': 'event',
|
|
62431
|
+
kyc: 'stakeholder'
|
|
62426
62432
|
};
|
|
62427
62433
|
|
|
62428
62434
|
const getColumns = ({
|
|
@@ -62682,7 +62688,10 @@ const LinkingTemplate = ({
|
|
|
62682
62688
|
}), [conf]);
|
|
62683
62689
|
const id = conf.allData.id;
|
|
62684
62690
|
const dataSource = conf?.linkingTemplateContextData?.[id];
|
|
62685
|
-
|
|
62691
|
+
|
|
62692
|
+
// Derive namespace from conf.allData.form if not provided
|
|
62693
|
+
const derivedNamespace = namespace || conf.allData?.form;
|
|
62694
|
+
const _namespace = namespaceMap[derivedNamespace] || derivedNamespace;
|
|
62686
62695
|
const changeData = async () => {
|
|
62687
62696
|
try {
|
|
62688
62697
|
const _data = await LinkedSubjectsService$1.getLinkedSubjects({
|
package/package.json
CHANGED
|
@@ -778,10 +778,15 @@ export const inputTypeComponent = {
|
|
|
778
778
|
}
|
|
779
779
|
return {
|
|
780
780
|
label: o.label,
|
|
781
|
-
items: opts.filter((op) => op.
|
|
781
|
+
items: opts.filter((op) => op?.filters?.[0]?.value.includes(o.value)),
|
|
782
782
|
};
|
|
783
783
|
});
|
|
784
|
-
const notGrouped = opts.filter((op) =>
|
|
784
|
+
const notGrouped = opts.filter((op) => {
|
|
785
|
+
const filterValue = op?.filters?.[0]?.value;
|
|
786
|
+
if (!filterValue) return true;
|
|
787
|
+
|
|
788
|
+
return !gKeys.some(key => filterValue.includes(key));
|
|
789
|
+
});
|
|
785
790
|
if (notGrouped.length) {
|
|
786
791
|
groupOptions.unshift(...notGrouped);
|
|
787
792
|
}
|
|
@@ -975,18 +980,21 @@ export const inputTypeComponent = {
|
|
|
975
980
|
}
|
|
976
981
|
return {
|
|
977
982
|
label: o.label,
|
|
978
|
-
items: opts.filter((op) => op.
|
|
983
|
+
items: opts.filter((op) => op?.filters?.[0]?.value.includes(o.value)),
|
|
979
984
|
};
|
|
980
985
|
});
|
|
981
|
-
const notGrouped = opts.filter((op) =>
|
|
986
|
+
const notGrouped = opts.filter((op) => {
|
|
987
|
+
const filterValue = op?.filters?.[0]?.value;
|
|
988
|
+
if (!filterValue) return true;
|
|
989
|
+
|
|
990
|
+
return !gKeys.some(key => filterValue.includes(key));
|
|
991
|
+
});
|
|
982
992
|
if (notGrouped.length) {
|
|
983
993
|
groupOptions.unshift(...notGrouped);
|
|
984
994
|
}
|
|
985
995
|
opts = groupOptions;
|
|
986
996
|
}
|
|
987
997
|
|
|
988
|
-
console.log({maxWidth, staticWidth, fullWidth});
|
|
989
|
-
|
|
990
998
|
return (
|
|
991
999
|
<Select
|
|
992
1000
|
size="medium"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Modal from "../../../../Modal/index.jsx";
|
|
2
|
-
import { Form, Select, Input, Alert } from "antd";
|
|
2
|
+
import { Form, Select, Input, Alert, message } from "antd";
|
|
3
3
|
import { useState, useEffect, useMemo } from "react";
|
|
4
|
-
|
|
4
|
+
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
5
5
|
export default function NewAccount({
|
|
6
6
|
t,
|
|
7
7
|
isOpen,
|
|
@@ -12,26 +12,32 @@ export default function NewAccount({
|
|
|
12
12
|
inviteAccount,
|
|
13
13
|
isPending=false,
|
|
14
14
|
accountToEdit,
|
|
15
|
+
countries
|
|
15
16
|
}) {
|
|
16
17
|
const [MainForm] = Form.useForm();
|
|
17
18
|
const [loading, setLoading] = useState(false);
|
|
18
19
|
const [accountUsed, setAccountUsed] = useState(false);
|
|
19
20
|
|
|
20
21
|
|
|
21
|
-
|
|
22
22
|
const isEdit = useMemo(() => accountToEdit && typeof accountToEdit === "object", [accountToEdit]);
|
|
23
23
|
|
|
24
|
+
const selectedCountry = useMemo(
|
|
25
|
+
() => findOptions(accountToEdit?.otherData?.country, countries),
|
|
26
|
+
[accountToEdit?.otherData?.country, countries]
|
|
27
|
+
);
|
|
28
|
+
console.log(selectedCountry, "selectedCountry");
|
|
24
29
|
useEffect(() => {
|
|
25
30
|
if (accountToEdit && typeof accountToEdit === "object") {
|
|
26
31
|
MainForm.setFieldsValue({
|
|
27
32
|
name: accountToEdit.name,
|
|
28
33
|
email: accountToEdit.email,
|
|
29
34
|
type: accountToEdit?.otherData?.interface,
|
|
35
|
+
country: selectedCountry,
|
|
30
36
|
});
|
|
31
37
|
} else {
|
|
32
38
|
MainForm.resetFields();
|
|
33
39
|
}
|
|
34
|
-
|
|
40
|
+
}, [accountToEdit, MainForm, selectedCountry]);
|
|
35
41
|
|
|
36
42
|
const onSubmit = async () => {
|
|
37
43
|
try {
|
|
@@ -45,6 +51,7 @@ export default function NewAccount({
|
|
|
45
51
|
data: val,
|
|
46
52
|
isPending: accountToEdit.status === 'pending' || isPending
|
|
47
53
|
});
|
|
54
|
+
message.success(t("Account successfully updated"));
|
|
48
55
|
} else {
|
|
49
56
|
if (!inviteAccount) {
|
|
50
57
|
throw new Error("inviteAccount function is required for creating new accounts");
|
|
@@ -80,7 +87,7 @@ export default function NewAccount({
|
|
|
80
87
|
<Input placeholder={t("Type")} />
|
|
81
88
|
</Form.Item>
|
|
82
89
|
|
|
83
|
-
|
|
90
|
+
{!isEdit && (
|
|
84
91
|
<Form.Item
|
|
85
92
|
name="email"
|
|
86
93
|
label={t("Email")}
|
|
@@ -88,7 +95,13 @@ export default function NewAccount({
|
|
|
88
95
|
>
|
|
89
96
|
<Input placeholder={t("Type")} />
|
|
90
97
|
</Form.Item>
|
|
91
|
-
|
|
98
|
+
)}
|
|
99
|
+
{isEdit && (
|
|
100
|
+
<Form.Item name="country" label={t("Country")} rules={[{ required: true }]}>
|
|
101
|
+
<Select placeholder={t("Select")} options={countries} />
|
|
102
|
+
</Form.Item>
|
|
103
|
+
|
|
104
|
+
)}
|
|
92
105
|
<Form.Item name="type" label={t("Type")} rules={[{ required: true }]}>
|
|
93
106
|
<Select placeholder={t("Select")} options={accountTypes || []} />
|
|
94
107
|
</Form.Item>
|
|
@@ -49,6 +49,7 @@ export default function AdminAccountsScreen({ config }) {
|
|
|
49
49
|
const query = useQuery ? useQuery() : { get: () => null };
|
|
50
50
|
const [addAccountVisible, setAddAccountVisible] = useState(!!query.get("create"));
|
|
51
51
|
const [accountToEdit, setAccountToEdit] = useState(null);
|
|
52
|
+
const [refetchTrigger, setRefetchTrigger] = useState(0);
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
|
|
@@ -102,6 +103,7 @@ function handleCopyInvitation(account) {
|
|
|
102
103
|
headerTitle="accounts"
|
|
103
104
|
actionButton={actionButtons}
|
|
104
105
|
getData={handleGetData}
|
|
106
|
+
refetchTrigger={refetchTrigger}
|
|
105
107
|
config={{
|
|
106
108
|
accountTypes,
|
|
107
109
|
addAccountVisible,
|
|
@@ -125,8 +127,9 @@ function handleCopyInvitation(account) {
|
|
|
125
127
|
setAccountToEdit(null);
|
|
126
128
|
}}
|
|
127
129
|
accountTypes={accountTypes}
|
|
128
|
-
|
|
130
|
+
countries={options?.countries}
|
|
129
131
|
fetchData={() => {
|
|
132
|
+
setRefetchTrigger((prev) => prev + 1);
|
|
130
133
|
}}
|
|
131
134
|
inviteAccount={(data) => AdminService.inviteAccount(data)}
|
|
132
135
|
updateAccount={({ data, id, isPending }) => AdminService.updateAccount({ data, id, isPending })}
|
|
@@ -33,6 +33,7 @@ export default function AccountTable({
|
|
|
33
33
|
defaultPageSize = 20,
|
|
34
34
|
actionButton,
|
|
35
35
|
inviteAccount,
|
|
36
|
+
refetchTrigger,
|
|
36
37
|
}) {
|
|
37
38
|
const accountTypes = config?.accountTypes;
|
|
38
39
|
const [showFilters, setShowFilters] = useState(false);
|
|
@@ -61,6 +62,7 @@ export default function AccountTable({
|
|
|
61
62
|
getRedirectLink,
|
|
62
63
|
getData,
|
|
63
64
|
fetchPendingOnMount: true,
|
|
65
|
+
refetchTrigger,
|
|
64
66
|
});
|
|
65
67
|
|
|
66
68
|
const selectOptions = useMemo(() => {
|
|
@@ -14,6 +14,15 @@ export const getFiltersConfig = ({t, filters, activeTab, options}) => {
|
|
|
14
14
|
label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label,
|
|
15
15
|
}))
|
|
16
16
|
|
|
17
|
+
const merged = [
|
|
18
|
+
...(options?.locationCategories || []),
|
|
19
|
+
...(options?.productionSiteCategories || [])
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const deduped = Array.from(
|
|
23
|
+
new Map(merged.map(item => [item.value, item])).values()
|
|
24
|
+
);
|
|
25
|
+
|
|
17
26
|
if(activeTab === 'stakeholder') {
|
|
18
27
|
return [
|
|
19
28
|
{
|
|
@@ -47,7 +56,7 @@ export const getFiltersConfig = ({t, filters, activeTab, options}) => {
|
|
|
47
56
|
key: "type",
|
|
48
57
|
type: "select",
|
|
49
58
|
...value,
|
|
50
|
-
options:
|
|
59
|
+
options: deduped
|
|
51
60
|
},
|
|
52
61
|
];
|
|
53
62
|
}
|