datastake-daf 0.6.765 → 0.6.767
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 +482 -245
- package/dist/layouts/index.js +0 -3
- package/dist/pages/index.js +299 -241
- package/dist/services/index.js +18 -0
- package/dist/utils/index.js +328 -5
- package/package.json +4 -2
- package/src/@daf/core/components/Charts/BarChart/index.jsx +4 -0
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +1 -1
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +1 -9
- package/src/@daf/core/components/Dashboard/Map/StakeholderIcon/index.js +3 -0
- package/src/@daf/core/components/Dashboard/Map/hook.js +31 -1
- package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +0 -2
- package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +49 -11
- package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +10 -7
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/config.js +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/helper.js +4 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/index.jsx +5 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +34 -26
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/index.jsx +56 -52
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +52 -67
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +96 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +96 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +116 -89
- package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/create.jsx +106 -0
- package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/index.jsx +115 -0
- package/src/@daf/core/components/Table/MoreTags/index.jsx +17 -5
- package/src/@daf/hooks/useMapHelper.js +5 -0
- package/src/@daf/layouts/AuthLayout/components/Navbar/index.jsx +0 -1
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +10 -10
- package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +11 -5
- package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/helper.js +1 -14
- package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +12 -5
- package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/index.jsx +1 -1
- package/src/@daf/pages/Dashboards/UserDashboard/components/Triangulation/hook.js +1 -1
- package/src/@daf/pages/Data/Channels/columns.js +175 -0
- package/src/@daf/pages/Data/Channels/config.js +0 -0
- package/src/@daf/pages/Data/Channels/create.jsx +0 -0
- package/src/@daf/pages/Data/Channels/index.jsx +0 -0
- package/src/@daf/pages/Events/Activities/columns.js +1 -4
- package/src/@daf/pages/Events/helper.js +2 -2
- package/src/@daf/pages/Events/index.jsx +1 -1
- package/src/@daf/pages/Locations/MineSite/columns.js +6 -4
- package/src/@daf/pages/Stakeholders/Operators/columns.js +4 -2
- package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +1 -0
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +2 -2
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +7 -7
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +3 -2
- package/src/@daf/pages/Summary/Minesite/index.jsx +3 -1
- package/src/@daf/pages/Summary/Operator/components/Governance/index.js +0 -1
- package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +33 -21
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +13 -13
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +8 -8
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +10 -3
- package/src/@daf/pages/Summary/Operator/index.jsx +3 -0
- package/src/@daf/pages/Summary/components/InformationAvailability/index.js +4 -3
- package/src/@daf/services/AdminService.js +14 -0
- package/src/constants/locales/en/translation.js +109 -2
- package/src/constants/locales/fr/translation.js +109 -1
- package/src/constants/locales/sp/translation.js +104 -1
- package/src/index.js +2 -0
- package/dist/style/datastake/mapbox-gl.css +0 -330
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { message } from "antd";
|
|
3
|
+
import SubjectsTable from "../AdminTables/SubjectsTable/index.jsx";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Admin Subjects Screen Wrapper
|
|
7
|
+
* This is a ready-to-use route component that can be configured per application
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} config - Application configuration
|
|
10
|
+
* @param {string} config.appName - Application name
|
|
11
|
+
* @param {string} config.module - Module identifier (APP constant)
|
|
12
|
+
* @param {Function} config.goTo - Navigation function
|
|
13
|
+
* @param {Function} config.t - Translation function
|
|
14
|
+
* @param {Object} config.location - Router location object
|
|
15
|
+
* @param {boolean} config.isMobile - Is mobile viewport
|
|
16
|
+
* @param {Function} config.getRedirectLink - Function to get redirect links
|
|
17
|
+
* @param {Object} config.AdminService - Admin service with methods
|
|
18
|
+
* @param {Object} config.options - Options object with categories, countries, etc.
|
|
19
|
+
* @param {Function} config.handleError - Error handling function
|
|
20
|
+
* @param {number} config.defaultPageSize - Default pagination page size
|
|
21
|
+
* @param {string} config.view - View identifier
|
|
22
|
+
* @param {string} config.headerTitle - Header title for the table
|
|
23
|
+
* @param {Array} config.breadcrumbs - Breadcrumbs configuration
|
|
24
|
+
* @param {any} config.refetchTrigger - Trigger to refetch data
|
|
25
|
+
* @param {Function} config.getData - Optional custom getData function
|
|
26
|
+
*/
|
|
27
|
+
export default function AdminSubjectsScreen({ config }) {
|
|
28
|
+
const {
|
|
29
|
+
appName = "app",
|
|
30
|
+
module,
|
|
31
|
+
goTo,
|
|
32
|
+
t,
|
|
33
|
+
location,
|
|
34
|
+
isMobile,
|
|
35
|
+
getRedirectLink,
|
|
36
|
+
AdminService,
|
|
37
|
+
options,
|
|
38
|
+
handleError,
|
|
39
|
+
defaultPageSize = 20,
|
|
40
|
+
view,
|
|
41
|
+
headerTitle = "subjects",
|
|
42
|
+
breadcrumbs,
|
|
43
|
+
refetchTrigger,
|
|
44
|
+
getData,
|
|
45
|
+
} = config;
|
|
46
|
+
|
|
47
|
+
const handleMergeSubjects = useCallback(
|
|
48
|
+
async (mergeData) => {
|
|
49
|
+
try {
|
|
50
|
+
if (AdminService.mergeSubjects) {
|
|
51
|
+
await AdminService.mergeSubjects(mergeData);
|
|
52
|
+
message.success(t("Subjects merged successfully"));
|
|
53
|
+
} else {
|
|
54
|
+
console.warn("AdminService.mergeSubjects is not implemented");
|
|
55
|
+
message.success(t("Subjects merged successfully"));
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
handleError?.(err);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
[AdminService, t, handleError]
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
// Use custom getData if provided, otherwise use default AdminService.getSubjects
|
|
65
|
+
const getSubjects = useCallback((params) => {
|
|
66
|
+
if (getData) {
|
|
67
|
+
return getData(params);
|
|
68
|
+
}
|
|
69
|
+
return AdminService.getSubjects(params);
|
|
70
|
+
}, [getData, AdminService]);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<SubjectsTable
|
|
74
|
+
t={t}
|
|
75
|
+
goTo={goTo}
|
|
76
|
+
getRedirectLink={getRedirectLink}
|
|
77
|
+
location={location}
|
|
78
|
+
module={module}
|
|
79
|
+
headerTitle={headerTitle}
|
|
80
|
+
getData={getSubjects}
|
|
81
|
+
isMobile={isMobile}
|
|
82
|
+
defaultPageSize={defaultPageSize}
|
|
83
|
+
view={view}
|
|
84
|
+
breadcrumbs={breadcrumbs}
|
|
85
|
+
mergeSubjectsFunction={handleMergeSubjects}
|
|
86
|
+
refetchTrigger={refetchTrigger}
|
|
87
|
+
config={{
|
|
88
|
+
options: {
|
|
89
|
+
category: options?.category,
|
|
90
|
+
countries: options?.countries,
|
|
91
|
+
},
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
@@ -8,4 +8,5 @@ export { default as AdminDashboardScreen } from "./Dashboard.jsx";
|
|
|
8
8
|
export { default as AdminUsersScreen } from "./Users.jsx";
|
|
9
9
|
export { default as AdminAccountsScreen } from "./Accounts.jsx";
|
|
10
10
|
export { default as AdminAccountsViewScreen } from "./AccountsView.jsx";
|
|
11
|
-
|
|
11
|
+
export { default as AdminSubjectsScreen } from "./Subjects.jsx";
|
|
12
|
+
export { default as AdminLocationScreen } from "./Location.jsx";
|
|
@@ -3,102 +3,129 @@ import AdminDashboardScreen from "./AdminScreens/Dashboard.jsx";
|
|
|
3
3
|
import AdminUsersScreen from "./AdminScreens/Users.jsx";
|
|
4
4
|
import AdminAccountsScreen from "./AdminScreens/Accounts.jsx";
|
|
5
5
|
import AdminAccountsViewScreen from "./AdminScreens/AccountsView.jsx";
|
|
6
|
+
import AdminSubjectsScreen from "./AdminScreens/Subjects.jsx";
|
|
7
|
+
import AdminLocationScreen from "./AdminScreens/Location.jsx";
|
|
6
8
|
|
|
7
|
-
/**
|
|
8
|
-
* Generate Admin Routes for any application
|
|
9
|
-
*
|
|
10
|
-
* This function returns a complete set of admin routes that can be used directly
|
|
11
|
-
* in application's route configuration. Just provide the configuration and
|
|
12
|
-
* you get back ready-to-use routes.
|
|
13
|
-
*
|
|
14
|
-
* @param {Object} config - Application-specific configuration
|
|
15
|
-
* @param {string} config.appName - Application name (e.g., "wazi", "tazama")
|
|
16
|
-
* @param {Function} config.useAdminDashboardConfig - Hook that returns dashboard config
|
|
17
|
-
* @param {Function} config.useAdminUsersConfig - Hook that returns users config
|
|
18
|
-
* @param {Function} config.useAdminAccountsConfig - Hook that returns accounts config
|
|
19
|
-
* @param {Function} config.useAdminAccountsViewConfig - Hook that returns accounts view config
|
|
20
|
-
* @param {Function} config.userIsAdmin - Function to check if user is admin
|
|
21
|
-
*
|
|
22
|
-
* @returns {Array} Array of route objects ready to be used with React Router
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```javascript
|
|
26
|
-
* import { getAdminRoutes } from "datastake-daf/dist/admin";
|
|
27
|
-
*
|
|
28
|
-
* const routes = getAdminRoutes({
|
|
29
|
-
* appName: "wazi",
|
|
30
|
-
* useAdminDashboardConfig,
|
|
31
|
-
* useAdminUsersConfig,
|
|
32
|
-
* useAdminAccountsConfig,
|
|
33
|
-
* useAdminAccountsViewConfig,
|
|
34
|
-
* userIsAdmin: (user) => user?.role === 'admin'
|
|
35
|
-
* });
|
|
36
|
-
*
|
|
37
|
-
* export default routes;
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
9
|
export function getAdminRoutes(config) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
10
|
+
const {
|
|
11
|
+
appName,
|
|
12
|
+
useAdminDashboardConfig,
|
|
13
|
+
useAdminUsersConfig,
|
|
14
|
+
useAdminAccountsConfig,
|
|
15
|
+
useAdminAccountsViewConfig,
|
|
16
|
+
useAdminSubjectsConfig,
|
|
17
|
+
useAdminLocationConfig,
|
|
18
|
+
userIsAdmin,
|
|
19
|
+
} = config;
|
|
49
20
|
|
|
50
|
-
|
|
21
|
+
const APP_PREFIX = `APP_${appName.toUpperCase()}`;
|
|
51
22
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
23
|
+
function DashboardWrapper() {
|
|
24
|
+
const dashboardConfig = useAdminDashboardConfig();
|
|
25
|
+
return <AdminDashboardScreen config={dashboardConfig} />;
|
|
26
|
+
}
|
|
57
27
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
28
|
+
function UsersWrapper() {
|
|
29
|
+
const usersConfig = useAdminUsersConfig();
|
|
30
|
+
return <AdminUsersScreen config={usersConfig} />;
|
|
31
|
+
}
|
|
62
32
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
33
|
+
function AccountsWrapper() {
|
|
34
|
+
const accountsConfig = useAdminAccountsConfig();
|
|
35
|
+
return <AdminAccountsScreen config={accountsConfig} />;
|
|
36
|
+
}
|
|
67
37
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
38
|
+
function AccountsViewWrapper() {
|
|
39
|
+
const accountsViewConfig = useAdminAccountsViewConfig();
|
|
40
|
+
return <AdminAccountsViewScreen config={accountsViewConfig} />;
|
|
41
|
+
}
|
|
72
42
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
43
|
+
function SubjectsWrapper() {
|
|
44
|
+
const subjectsConfig =
|
|
45
|
+
typeof useAdminSubjectsConfig === "function"
|
|
46
|
+
? useAdminSubjectsConfig()
|
|
47
|
+
: undefined;
|
|
48
|
+
return <AdminSubjectsScreen config={subjectsConfig} />;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function LocationWrapper() {
|
|
52
|
+
const locationConfig =
|
|
53
|
+
typeof useAdminLocationConfig === "function"
|
|
54
|
+
? useAdminLocationConfig()
|
|
55
|
+
: undefined;
|
|
56
|
+
return <AdminLocationScreen config={locationConfig} />;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const subjectsIndexComponent =
|
|
60
|
+
typeof useAdminLocationConfig === "function"
|
|
61
|
+
? <LocationWrapper />
|
|
62
|
+
: typeof useAdminSubjectsConfig === "function"
|
|
63
|
+
? <SubjectsWrapper />
|
|
64
|
+
: <div />;
|
|
65
|
+
|
|
66
|
+
const routes = [
|
|
67
|
+
{
|
|
68
|
+
path: "",
|
|
69
|
+
key: `${APP_PREFIX}_DASHBOARD`,
|
|
70
|
+
exact: true,
|
|
71
|
+
visible: (user) => userIsAdmin(user),
|
|
72
|
+
component: <DashboardWrapper />,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
path: "accounts",
|
|
76
|
+
key: `${APP_PREFIX}_ACCOUNTS`,
|
|
77
|
+
exact: true,
|
|
78
|
+
visible: (user) => userIsAdmin(user),
|
|
79
|
+
component: <AccountsWrapper />,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
path: "admin-users",
|
|
83
|
+
key: `${APP_PREFIX}_ADMIN_USERS`,
|
|
84
|
+
exact: true,
|
|
85
|
+
visible: (user) => userIsAdmin(user),
|
|
86
|
+
component: <UsersWrapper />,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
path: "accounts/:mode/:id/:group",
|
|
90
|
+
key: `${APP_PREFIX}_ADMIN_VIEW`,
|
|
91
|
+
exact: true,
|
|
92
|
+
visible: (user) => userIsAdmin(user),
|
|
93
|
+
component: <AccountsViewWrapper />,
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
{
|
|
97
|
+
path: "subjects",
|
|
98
|
+
key: `${APP_PREFIX}_SUBJECTS_INDEX`,
|
|
99
|
+
exact: true,
|
|
100
|
+
visible: (user) => userIsAdmin(user),
|
|
101
|
+
component: subjectsIndexComponent,
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
...(typeof useAdminLocationConfig === "function"
|
|
105
|
+
? [
|
|
106
|
+
{
|
|
107
|
+
path: "subjects/location",
|
|
108
|
+
key: `${APP_PREFIX}_ADMIN_SUBJECTS_LOCATIONS`,
|
|
109
|
+
exact: true,
|
|
110
|
+
visible: (user) => userIsAdmin(user),
|
|
111
|
+
component: <LocationWrapper />,
|
|
112
|
+
},
|
|
113
|
+
]
|
|
114
|
+
: []),
|
|
115
|
+
...(typeof useAdminSubjectsConfig === "function"
|
|
116
|
+
? [
|
|
117
|
+
{
|
|
118
|
+
path: "subjects/stakeholder",
|
|
119
|
+
key: `${APP_PREFIX}_ADMIN_SUBJECTS_STAKEHOLDERS`,
|
|
120
|
+
exact: true,
|
|
121
|
+
visible: (user) => userIsAdmin(user),
|
|
122
|
+
component: <SubjectsWrapper />,
|
|
123
|
+
},
|
|
124
|
+
]
|
|
125
|
+
: []),
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
return routes;
|
|
103
129
|
}
|
|
104
130
|
|
|
131
|
+
export default getAdminRoutes;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { useEffect} from 'react'
|
|
2
|
+
import { message } from 'antd';
|
|
3
|
+
import { MessageTypes } from '../../../helpers/messages.js';
|
|
4
|
+
import DynamicForm from '../../core/components/DynamicForm/index.jsx';
|
|
5
|
+
|
|
6
|
+
const Create = ({
|
|
7
|
+
namespace = 'stakeholders',
|
|
8
|
+
view = 'scoping',
|
|
9
|
+
edit = false,
|
|
10
|
+
formData = {},
|
|
11
|
+
loading = false,
|
|
12
|
+
onSubmitted = () => {},
|
|
13
|
+
onCancel = () => {},
|
|
14
|
+
getData = () => {},
|
|
15
|
+
saveData = () => {},
|
|
16
|
+
form: formConfig = {},
|
|
17
|
+
formValue = {},
|
|
18
|
+
defaultData = {},
|
|
19
|
+
user = {},
|
|
20
|
+
APP,
|
|
21
|
+
query,
|
|
22
|
+
goTo = () => {},
|
|
23
|
+
t = () => {},
|
|
24
|
+
ajaxForms = {},
|
|
25
|
+
changeAjaxForms = () => {},
|
|
26
|
+
ajaxOptions = {},
|
|
27
|
+
changeAjaxOptions = () => {},
|
|
28
|
+
getAppHeader = () => {},
|
|
29
|
+
getApiBaseUrl = () => {},
|
|
30
|
+
scope
|
|
31
|
+
}) => {
|
|
32
|
+
let {
|
|
33
|
+
form = {},
|
|
34
|
+
data = defaultData || {},
|
|
35
|
+
} = !edit ? (formData[`${APP}-${view}`] || {}) : {
|
|
36
|
+
form: formConfig,
|
|
37
|
+
data: formValue
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
|
|
42
|
+
if (!edit) {
|
|
43
|
+
getData({ namespace, module: APP, view, scope });
|
|
44
|
+
} else {
|
|
45
|
+
form = formConfig;
|
|
46
|
+
data = formValue;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, [edit, user?.language, scope]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className="daf-create-form">
|
|
53
|
+
<DynamicForm
|
|
54
|
+
form={form}
|
|
55
|
+
data={data}
|
|
56
|
+
showSaveAndNext={false}
|
|
57
|
+
module={APP}
|
|
58
|
+
onCancel={onCancel}
|
|
59
|
+
isCreate
|
|
60
|
+
t={t}
|
|
61
|
+
excludedKeys={["title"]}
|
|
62
|
+
user={user}
|
|
63
|
+
ajaxForms={ajaxForms}
|
|
64
|
+
ajaxOptions={ajaxOptions}
|
|
65
|
+
getAppHeader={getAppHeader}
|
|
66
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
67
|
+
changeAjaxOptions={changeAjaxOptions}
|
|
68
|
+
app={APP}
|
|
69
|
+
query={query}
|
|
70
|
+
goTo={goTo}
|
|
71
|
+
changeAjaxForms={changeAjaxForms}
|
|
72
|
+
submit={(payload, setSelectedFormNext) => {
|
|
73
|
+
const payloadData = { ...payload, module: APP, namespace };
|
|
74
|
+
|
|
75
|
+
const newPayload = {
|
|
76
|
+
...defaultData,
|
|
77
|
+
...payloadData,
|
|
78
|
+
form: 'stakeholder'
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
const callback = (type, m, data) => {
|
|
83
|
+
if (setSelectedFormNext) {
|
|
84
|
+
setSelectedFormNext();
|
|
85
|
+
}
|
|
86
|
+
if (type === MessageTypes.SUCCESS) {
|
|
87
|
+
if (onSubmitted) onSubmitted(type, m, data);
|
|
88
|
+
} else {
|
|
89
|
+
message.error(m);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
saveData(
|
|
94
|
+
!data && !data.id ? newPayload : Object.assign(newPayload, { id: data.id }),
|
|
95
|
+
callback,
|
|
96
|
+
);
|
|
97
|
+
}}
|
|
98
|
+
isFormDisabled={() => {
|
|
99
|
+
return !data || !data.typeOfEvent;
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default Create
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { useFetchData } from '../../../../../pages/hook.js';
|
|
3
|
+
import TablePageWithTabs from '../TablePageWithTabs/index.jsx';
|
|
4
|
+
|
|
5
|
+
const TableWithTabsAndCreate = ({
|
|
6
|
+
t = () => {},
|
|
7
|
+
goTo = () => {},
|
|
8
|
+
user = {},
|
|
9
|
+
options = {},
|
|
10
|
+
getRedirectLink = () => {},
|
|
11
|
+
theme = {},
|
|
12
|
+
loading = false,
|
|
13
|
+
data = {},
|
|
14
|
+
isMobile,
|
|
15
|
+
APP,
|
|
16
|
+
location,
|
|
17
|
+
formConfig = {
|
|
18
|
+
getFormData: () => {},
|
|
19
|
+
saveFormData: () => {},
|
|
20
|
+
formLoading: false,
|
|
21
|
+
query: {},
|
|
22
|
+
ajaxForms: {},
|
|
23
|
+
changeAjaxForms: () => {},
|
|
24
|
+
ajaxOptions: {},
|
|
25
|
+
changeAjaxOptions: () => {},
|
|
26
|
+
formData: {},
|
|
27
|
+
formValue: {},
|
|
28
|
+
form: {},
|
|
29
|
+
namespace: '',
|
|
30
|
+
view: '',
|
|
31
|
+
scope: '',
|
|
32
|
+
},
|
|
33
|
+
filtersConfig = {
|
|
34
|
+
getFiltersConfig: () => {},
|
|
35
|
+
getFilterOptions: () => {},
|
|
36
|
+
extendingFilters: {},
|
|
37
|
+
checkboxConfig: {},
|
|
38
|
+
selectOptions: {},
|
|
39
|
+
selectFiltersConfig: {},
|
|
40
|
+
},
|
|
41
|
+
getData = () => {},
|
|
42
|
+
getApiBaseUrl = () => {},
|
|
43
|
+
getAppHeader = () => {},
|
|
44
|
+
applications = [],
|
|
45
|
+
subjectClear,
|
|
46
|
+
subject,
|
|
47
|
+
columns,
|
|
48
|
+
viewConfig = {
|
|
49
|
+
title: '',
|
|
50
|
+
breadcrumbs: [],
|
|
51
|
+
createTitle: '',
|
|
52
|
+
},
|
|
53
|
+
onDownload,
|
|
54
|
+
}) => {
|
|
55
|
+
const [selectOptions, setSelectOptions] = useState();
|
|
56
|
+
const [activeTab, setActiveTab] = useState("own");
|
|
57
|
+
|
|
58
|
+
useFetchData({
|
|
59
|
+
location,
|
|
60
|
+
getData,
|
|
61
|
+
activeTab,
|
|
62
|
+
extendingFilters: filtersConfig.extendingFilters,
|
|
63
|
+
subject,
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
setSelectOptions((prev) => ({
|
|
68
|
+
...prev,
|
|
69
|
+
...filtersConfig.getFilterOptions(options, t),
|
|
70
|
+
}))
|
|
71
|
+
}, [options, t])
|
|
72
|
+
|
|
73
|
+
const handleActiveTabChange = useCallback((value) => {
|
|
74
|
+
setActiveTab(value);
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
useEffect(
|
|
78
|
+
() => () => {
|
|
79
|
+
if(subjectClear && typeof subjectClear === 'function') {
|
|
80
|
+
subjectClear();
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
[],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<TablePageWithTabs
|
|
88
|
+
t={t}
|
|
89
|
+
title={t(viewConfig.title || "")}
|
|
90
|
+
breadCrumbs={viewConfig.breadcrumbs}
|
|
91
|
+
location={location}
|
|
92
|
+
loading={loading}
|
|
93
|
+
goTo={goTo}
|
|
94
|
+
defaultActiveTab={"own"}
|
|
95
|
+
columns={columns}
|
|
96
|
+
data={data}
|
|
97
|
+
checkboxConfig={filtersConfig.checkboxConfig}
|
|
98
|
+
APP={APP}
|
|
99
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
100
|
+
selectOptions={selectOptions}
|
|
101
|
+
selectFiltersConfig={filtersConfig.selectFiltersConfig}
|
|
102
|
+
getRedirectLink={getRedirectLink}
|
|
103
|
+
filtersConfig={filtersConfig}
|
|
104
|
+
isMobile={isMobile}
|
|
105
|
+
view={subject}
|
|
106
|
+
getActiveTab={handleActiveTabChange}
|
|
107
|
+
onDownload={onDownload && typeof onDownload === 'function' ? onDownload : undefined}
|
|
108
|
+
drawerTitle={t(viewConfig.createTitle || "")}
|
|
109
|
+
>
|
|
110
|
+
|
|
111
|
+
</TablePageWithTabs>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export default TableWithTabsAndCreate;
|
|
@@ -9,6 +9,9 @@ export default function MoreTags({
|
|
|
9
9
|
maxWidthCont = 120,
|
|
10
10
|
maxTextCont = 100,
|
|
11
11
|
diff = 30,
|
|
12
|
+
style = {},
|
|
13
|
+
tagColor,
|
|
14
|
+
limit,
|
|
12
15
|
}) {
|
|
13
16
|
const ref = useRef();
|
|
14
17
|
const [width, setWidth] = useState(0);
|
|
@@ -27,6 +30,12 @@ export default function MoreTags({
|
|
|
27
30
|
}, []);
|
|
28
31
|
|
|
29
32
|
const _calculate = () => {
|
|
33
|
+
// If limit prop is provided and valid, use it instead of calculating
|
|
34
|
+
if (typeof limit === 'number' && limit > 0) {
|
|
35
|
+
setIndexToReturn(Math.min(limit - 1, values.length - 1));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
const tabs = ref.current.querySelectorAll(".check-tabs");
|
|
31
40
|
let filled = 0;
|
|
32
41
|
let indexToReturn;
|
|
@@ -60,7 +69,7 @@ export default function MoreTags({
|
|
|
60
69
|
|
|
61
70
|
useEffect(() => {
|
|
62
71
|
_calculate();
|
|
63
|
-
}, [width, values]);
|
|
72
|
+
}, [width, values, limit]);
|
|
64
73
|
|
|
65
74
|
return (
|
|
66
75
|
<div className="daf-more-tags">
|
|
@@ -76,8 +85,9 @@ export default function MoreTags({
|
|
|
76
85
|
overflow: "hidden",
|
|
77
86
|
textOverflow: "ellipsis",
|
|
78
87
|
whiteSpace: "nowrap",
|
|
88
|
+
...style,
|
|
79
89
|
}}
|
|
80
|
-
color={ac.color}
|
|
90
|
+
color={tagColor || ac.color}
|
|
81
91
|
>
|
|
82
92
|
<Tooltip title={typeof ac === "object" ? ac.label : ac}>
|
|
83
93
|
<span
|
|
@@ -86,6 +96,7 @@ export default function MoreTags({
|
|
|
86
96
|
overflow: "hidden",
|
|
87
97
|
textOverflow: "ellipsis",
|
|
88
98
|
whiteSpace: "nowrap",
|
|
99
|
+
...style,
|
|
89
100
|
}}
|
|
90
101
|
>
|
|
91
102
|
{typeof ac === "object" ? ac.label : ac}
|
|
@@ -100,7 +111,7 @@ export default function MoreTags({
|
|
|
100
111
|
.map((ac) => (typeof ac === "object" ? ac.label : ac))
|
|
101
112
|
.join(", ")}
|
|
102
113
|
>
|
|
103
|
-
<Tag>+{other.length}</Tag>
|
|
114
|
+
<Tag color={tagColor || 'default'} style={style}>+{other.length}</Tag>
|
|
104
115
|
</Tooltip>
|
|
105
116
|
) : null}
|
|
106
117
|
</div>
|
|
@@ -110,10 +121,10 @@ export default function MoreTags({
|
|
|
110
121
|
ac.renderTag("check-tabs")
|
|
111
122
|
) : (
|
|
112
123
|
<Tag
|
|
113
|
-
color={ac.color}
|
|
124
|
+
color={tagColor || ac.color}
|
|
114
125
|
key={`${ac}-${i}`}
|
|
115
126
|
className="check-tabs"
|
|
116
|
-
style={{ maxWidth: _maxWidthCont }}
|
|
127
|
+
style={{ maxWidth: _maxWidthCont, ...style }}
|
|
117
128
|
>
|
|
118
129
|
<Text
|
|
119
130
|
ellipsis={{ tooltip: typeof ac === "object" ? ac.label : ac }}
|
|
@@ -134,4 +145,5 @@ MoreTags.propTypes = {
|
|
|
134
145
|
maxWidthCont: PropTypes.number,
|
|
135
146
|
maxTextCont: PropTypes.number,
|
|
136
147
|
diff: PropTypes.number,
|
|
148
|
+
limit: PropTypes.number,
|
|
137
149
|
};
|
|
@@ -9,6 +9,11 @@ export const defaultMapConfig = {
|
|
|
9
9
|
preferCanvas: true,
|
|
10
10
|
zoomControl: false,
|
|
11
11
|
maxBounds: maxBounds,
|
|
12
|
+
zoomSnap: 0.5,
|
|
13
|
+
zoomDelta: 0.5,
|
|
14
|
+
wheelPxPerZoomLevel: 150,
|
|
15
|
+
zoomAnimation: true,
|
|
16
|
+
zoomAnimationThreshold: 10,
|
|
12
17
|
};
|
|
13
18
|
|
|
14
19
|
export const filterValidGPS = (data) => {
|
|
@@ -23,7 +23,6 @@ const AuthNavbar = ({
|
|
|
23
23
|
defaultValue = StorageManager.get('datastakeLng') || 'en',
|
|
24
24
|
onClose
|
|
25
25
|
}) => {
|
|
26
|
-
console.log({navbarDefaultValue: defaultValue})
|
|
27
26
|
return (
|
|
28
27
|
<Style className={formatClassname([typeof onClose === 'function' && 'bordered'])}>
|
|
29
28
|
<div className="d-navbar flex-c jus-c">
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState, useMemo } from "react";
|
|
2
|
+
import { findOptions } from '../../../../../../../../helpers/StringHelper.js';
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
export function useIdentification({ data, theme = {}, options = {} }) {
|
|
@@ -58,16 +59,15 @@ export function useIdentification({ data, theme = {}, options = {} }) {
|
|
|
58
59
|
const values = graphData.filter((d) => d.date === title);
|
|
59
60
|
return {
|
|
60
61
|
title: "Products",
|
|
61
|
-
items: values.map((val) =>
|
|
62
|
-
|
|
63
|
-
options?.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})),
|
|
62
|
+
items: values.map((val) => {
|
|
63
|
+
return{
|
|
64
|
+
label: findOptions(val.typeOfProduct, options?.mineralOptions) || val.typeOfProduct,
|
|
65
|
+
color: colors[
|
|
66
|
+
allSeenProducts.indexOf(val.typeOfProduct) % colors.length
|
|
67
|
+
],
|
|
68
|
+
value: val.value.toLocaleString(),
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
return { title: "", items: [] };
|