datastake-daf 0.6.792 → 0.6.794

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.
Files changed (74) hide show
  1. package/dist/components/index.js +4377 -3187
  2. package/dist/pages/index.js +1401 -589
  3. package/dist/services/index.js +69 -3
  4. package/dist/utils/index.js +14 -17
  5. package/package.json +1 -1
  6. package/src/@daf/core/components/ProgressBar/ProgressBarWithIcon/index.jsx +23 -0
  7. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +0 -1
  8. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
  9. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
  10. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
  11. package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +0 -1
  12. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/columns.js +79 -0
  13. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/helper.js +2 -2
  14. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +18 -8
  15. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -6
  16. package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
  17. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
  18. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +6 -7
  19. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
  20. package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +272 -0
  21. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +1 -0
  22. package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +1 -0
  23. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +223 -0
  24. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +65 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +73 -45
  26. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +37 -37
  27. package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +48 -22
  28. package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +1 -0
  29. package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +81 -0
  30. package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +76 -0
  31. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +38 -0
  32. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +13 -0
  33. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +77 -0
  34. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +38 -0
  35. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
  36. package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +75 -0
  37. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +3 -1
  38. package/src/@daf/core/components/Screens/Admin/AdminViews/components/SidebarMenu/index.jsx +5 -3
  39. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +13 -8
  40. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
  41. package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +3 -4
  42. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +81 -2
  43. package/src/@daf/core/components/Table/NavigationAction/index.jsx +5 -3
  44. package/src/@daf/pages/Dashboards/SelfAssesment/components/AssociatedInformation/columns.js +248 -0
  45. package/src/@daf/pages/Dashboards/SelfAssesment/components/AssociatedInformation/index.jsx +68 -0
  46. package/src/@daf/pages/Dashboards/SelfAssesment/components/AssociatedInformation/style.js +29 -0
  47. package/src/@daf/pages/Dashboards/SelfAssesment/components/OrganisationInformation/columns.js +93 -0
  48. package/src/@daf/pages/Dashboards/SelfAssesment/components/OrganisationInformation/index.jsx +43 -0
  49. package/src/@daf/pages/Dashboards/SelfAssesment/components/ProductionSites/columns.js +127 -0
  50. package/src/@daf/pages/Dashboards/SelfAssesment/components/ProductionSites/index.jsx +52 -0
  51. package/src/@daf/pages/Dashboards/SelfAssesment/components/ProductionSites/style.js +26 -0
  52. package/src/@daf/pages/Dashboards/SelfAssesment/index.jsx +39 -0
  53. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +180 -0
  54. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
  55. package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +27 -0
  56. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +157 -0
  57. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +31 -0
  58. package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +77 -0
  59. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +117 -0
  60. package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +54 -0
  61. package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
  62. package/src/@daf/services/AdminService.js +79 -7
  63. package/src/@daf/services/DashboardService.js +2 -1
  64. package/src/@daf/utils/filters.js +15 -13
  65. package/src/constants/locales/en/translation.js +7 -0
  66. package/src/constants/locales/fr/translation.js +1 -1
  67. package/src/constants/locales/sp/translation.js +1 -1
  68. package/src/index.js +1 -0
  69. package/src/pages.js +1 -0
  70. package/build/favicon.ico +0 -0
  71. package/build/logo192.png +0 -0
  72. package/build/logo512.png +0 -0
  73. package/build/manifest.json +0 -25
  74. package/build/robots.txt +0 -3
@@ -0,0 +1,77 @@
1
+ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
2
+ import { getNameByLevel } from "./helpers.js";
3
+ import LocationTable from "../../AdminTables/LocationTable/index.jsx";
4
+
5
+ const isView = true;
6
+
7
+ export default function View({
8
+ userRoles = [],
9
+ conf,
10
+ data = {},
11
+ formOptions = {},
12
+ t,
13
+ goTo,
14
+ location,
15
+ getRedirectLink,
16
+ accountStatuses,
17
+ module,
18
+ }) {
19
+ const renderItem = (item) => {
20
+ if (item.type === "location") {
21
+ return (
22
+ <LocationTable
23
+ isView={isView}
24
+ entityData={data}
25
+ goTo={goTo}
26
+ getRedirectLink={getRedirectLink}
27
+ t={t}
28
+ location={location}
29
+ module={module}
30
+ />
31
+ );
32
+ }
33
+
34
+ const getValue = () => {
35
+ const val =
36
+ item.getFormApps === true
37
+ ? data?.apps?.find((app) => app.app === module)?.[item?.propertyName]
38
+ : data?.[item.key];
39
+
40
+ if (item.type === "select") {
41
+ const option = findOptions(val, formOptions[item.optionsName] || []);
42
+ return option ? t(option) : "-";
43
+ }
44
+
45
+ if (item.type === "administrative") {
46
+ return getNameByLevel(data?.linking?.SCL, item.level) || "-";
47
+ }
48
+
49
+ return val ?? "-";
50
+ };
51
+
52
+ return (
53
+ <div className="input" key={item.key}>
54
+ <p className="label">
55
+ <span>{t(item.label)}</span>
56
+ </p>
57
+ <p className="value">{getValue()}</p>
58
+ </div>
59
+ );
60
+ };
61
+
62
+
63
+
64
+ return (
65
+ <div className="content">
66
+ <div className="wrapper" style={{ width: 700 }}>
67
+ <div className="group">
68
+ <div className="daf-title with-subtitle">
69
+ <h1>{t(conf.title)}</h1>
70
+ </div>
71
+
72
+ {conf.items.map((item) => renderItem(item))}
73
+ </div>
74
+ </div>
75
+ </div>
76
+ );
77
+ }
@@ -0,0 +1,38 @@
1
+ export const config = [
2
+ {
3
+ label: "Core Data",
4
+ key: "core-data",
5
+ title: "Core Data",
6
+ items: [
7
+ {
8
+ label: "Name",
9
+ key: "name",
10
+ type: "input"
11
+ },
12
+ {
13
+ label: "Category",
14
+ key: "category",
15
+ type: "select",
16
+ optionsName: "category"
17
+ },
18
+ {
19
+ label: "Country",
20
+ key: "country",
21
+ type: "select",
22
+ optionsName: "countries"
23
+ },
24
+ // {
25
+ // label: "Province",
26
+ // key: "administrativeLevel1",
27
+ // type: "administrative",
28
+ // level: "level_1"
29
+ // },
30
+ // {
31
+ // label: "Territory",
32
+ // key: "administrativeLevel2",
33
+ // type: "administrative",
34
+ // level: "level_2"
35
+ // },
36
+ ],
37
+ },
38
+ ];
@@ -0,0 +1,75 @@
1
+ import { findOptions } from "../../../../../../../helpers/StringHelper.js";
2
+ import StakeholderTable from "../../AdminTables/SubjectsTable/index.jsx";
3
+ const isView = true;
4
+
5
+ export default function View({
6
+ userRoles = [],
7
+ conf,
8
+ data = {},
9
+ formOptions = {},
10
+ t,
11
+ goTo,
12
+ stakeholder,
13
+ getRedirectLink,
14
+ accountStatuses,
15
+ module,
16
+ }) {
17
+ const renderItem = (item) => {
18
+ if (item.type === "stakeholder") {
19
+ return (
20
+ <StakeholderTable
21
+ isView={isView}
22
+ entityData={data}
23
+ goTo={goTo}
24
+ getRedirectLink={getRedirectLink}
25
+ t={t}
26
+ stakeholder={stakeholder}
27
+ module={module}
28
+ />
29
+ );
30
+ }
31
+
32
+ const getValue = () => {
33
+ const val =
34
+ item.getFormApps === true
35
+ ? data?.apps?.find((app) => app.app === module)?.[item?.propertyName]
36
+ : data?.[item.key];
37
+
38
+ if (item.type === "select") {
39
+ const option = findOptions(val, formOptions[item.optionsName] || []);
40
+ return option ? t(option) : "-";
41
+ }
42
+
43
+ if (item.type === "administrative") {
44
+ return getNameByLevel(data?.linking?.SCL, item.level) || "-";
45
+ }
46
+
47
+ return val ?? "-";
48
+ };
49
+
50
+ return (
51
+ <div className="input" key={item.key}>
52
+ <p className="label">
53
+ <span>{t(item.label)}</span>
54
+ </p>
55
+ <p className="value">{getValue()}</p>
56
+ </div>
57
+ );
58
+ };
59
+
60
+
61
+
62
+ return (
63
+ <div className="content">
64
+ <div className="wrapper" style={{ width: 700 }}>
65
+ <div className="group">
66
+ <div className="daf-title with-subtitle">
67
+ <h1>{t(conf.title)}</h1>
68
+ </div>
69
+
70
+ {conf.items.map((item) => renderItem(item))}
71
+ </div>
72
+ </div>
73
+ </div>
74
+ );
75
+ }
@@ -37,7 +37,7 @@ export default function Edit({
37
37
 
38
38
  const deleteUser = useCallback(
39
39
  (id) => {
40
- // TODO: add call
40
+ // TODO: add call
41
41
  console.log("DELETE", id);
42
42
  fetchData();
43
43
  },
@@ -174,6 +174,8 @@ export default function Edit({
174
174
  );
175
175
  };
176
176
 
177
+ console.log(conf,"data");
178
+
177
179
  return (
178
180
  <div className="form-edit flex-row">
179
181
  <Form
@@ -1,7 +1,9 @@
1
1
  import { Menu } from "antd";
2
- import { config } from "../../config";
2
+ import { config as defaultConfig } from "../../config";
3
3
 
4
- export default function SideBarMenu({ selectedGroup, onChange = () => {}, t }) {
4
+ export default function SideBarMenu({ selectedGroup, onChange = () => {}, t, config }) {
5
+ const menuConfig = config || defaultConfig;
6
+
5
7
  return (
6
8
  <Menu
7
9
  mode="inline"
@@ -12,7 +14,7 @@ export default function SideBarMenu({ selectedGroup, onChange = () => {}, t }) {
12
14
  onChange(g.key);
13
15
  }}
14
16
  items={
15
- config.map((conf) => {
17
+ menuConfig.map((conf) => {
16
18
  return {
17
19
  key: conf.key,
18
20
  label: t(conf.label),
@@ -167,10 +167,7 @@ export const getColumns = ({
167
167
  return cols.filter((v) => v.show);
168
168
  };
169
169
 
170
- export const checkboxConfig = {
171
- name: "Name",
172
- datastakeId: "ID",
173
- };
170
+ export const checkboxConfig = {};
174
171
 
175
172
  export const selectFiltersConfig = {
176
173
  userRole: {
@@ -194,9 +191,17 @@ export const selectFiltersConfig = {
194
191
  };
195
192
 
196
193
  export const filtersConfig = {
197
- name: "",
198
- datastakeId: "",
194
+ search: "",
195
+ };
196
+
197
+ export const defaultUrlParams = {
198
+ search: "",
199
+ userRole: null,
200
+ status: null,
199
201
  };
200
202
 
201
- export const defaultUrlParams = {};
202
- export const defaultTableFilters = {};
203
+ export const defaultTableFilters = {
204
+ search: "",
205
+ userRole: null,
206
+ status: null,
207
+ };
@@ -60,10 +60,10 @@ export default function Users({
60
60
  userRole: userRoles.filter((u) => !u.isForAppAdmin),
61
61
  status: accountStatuses,
62
62
  };
63
- }, [userRoles]);
63
+ }, [userRoles, accountStatuses]);
64
64
 
65
65
  const canClearSearch = useMemo(() => {
66
- return !!activeFilters.search;
66
+ return !!activeFilters.search || !!activeFilters.userRole || !!activeFilters.status;
67
67
  }, [activeFilters]);
68
68
 
69
69
  const onDeleteUserClick = useCallback(
@@ -55,7 +55,6 @@ function AdminView({
55
55
  }, [data]);
56
56
 
57
57
  const goToView = useCallback(() => {
58
- console.log("goToView");
59
58
  changeNotificationState({
60
59
  onYes: () => {
61
60
  setEditData(data);
@@ -63,7 +62,7 @@ function AdminView({
63
62
  goTo(`/app/accounts/view/${id}/${group}`);
64
63
  },
65
64
  });
66
- }, [goTo, changeNotificationState, data]);
65
+ }, [goTo, changeNotificationState, data, id, group]);
67
66
 
68
67
  const breadCrumbs = useMemo(() => {
69
68
  return renderBreadCrumbs({
@@ -99,9 +98,9 @@ function AdminView({
99
98
  setIsChanged(false);
100
99
  setLoading(false);
101
100
  } catch (err) {
102
- console.log(err);
101
+ handleError?.(err);
103
102
  }
104
- }, [id]);
103
+ }, [id, getAccountData, module, handleError]);
105
104
 
106
105
  useEffect(() => {
107
106
  fetchData();
@@ -5,6 +5,7 @@ import AdminAccountsScreen from "./AdminScreens/Accounts.jsx";
5
5
  import AdminAccountsViewScreen from "./AdminScreens/AccountsView.jsx";
6
6
  import AdminSubjectsScreen from "./AdminScreens/Subjects.jsx";
7
7
  import AdminLocationScreen from "./AdminScreens/Location.jsx";
8
+ import AdminSubjectsViewScreen from "./AdminScreens/SubjectsView.jsx";
8
9
 
9
10
  export function getAdminRoutes(config) {
10
11
  const {
@@ -15,6 +16,8 @@ export function getAdminRoutes(config) {
15
16
  useAdminAccountsViewConfig,
16
17
  useAdminSubjectsConfig,
17
18
  useAdminLocationConfig,
19
+ useAdminSubjectsViewConfig,
20
+ useAdminLocationViewConfig,
18
21
  userIsAdmin,
19
22
  } = config;
20
23
 
@@ -56,6 +59,38 @@ export function getAdminRoutes(config) {
56
59
  return <AdminLocationScreen config={locationConfig} />;
57
60
  }
58
61
 
62
+ function LocationViewWrapper() {
63
+ const locationViewConfig =
64
+ typeof useAdminLocationViewConfig === "function"
65
+ ? useAdminLocationViewConfig()
66
+ : undefined;
67
+ return <AdminSubjectsViewScreen config={{ ...locationViewConfig, subject: "location" }} />;
68
+ }
69
+
70
+ function StakeholderViewWrapper() {
71
+ const stakeholderViewConfig =
72
+ typeof useAdminSubjectsViewConfig === "function"
73
+ ? useAdminSubjectsViewConfig()
74
+ : undefined;
75
+ return <AdminSubjectsViewScreen config={{ ...stakeholderViewConfig, subject: "stakeholder" }} />;
76
+ }
77
+
78
+ function LocationEditWrapper() {
79
+ const locationViewConfig =
80
+ typeof useAdminLocationViewConfig === "function"
81
+ ? useAdminLocationViewConfig()
82
+ : undefined;
83
+ return <AdminSubjectsViewScreen config={{ ...locationViewConfig, subject: "location", mode: "edit" }} />;
84
+ }
85
+
86
+ function StakeholderEditWrapper() {
87
+ const stakeholderViewConfig =
88
+ typeof useAdminSubjectsViewConfig === "function"
89
+ ? useAdminSubjectsViewConfig()
90
+ : undefined;
91
+ return <AdminSubjectsViewScreen config={{ ...stakeholderViewConfig, subject: "stakeholder", mode: "edit" }} />;
92
+ }
93
+
59
94
  const subjectsIndexComponent =
60
95
  typeof useAdminLocationConfig === "function"
61
96
  ? <LocationWrapper />
@@ -104,7 +139,7 @@ export function getAdminRoutes(config) {
104
139
  ...(typeof useAdminLocationConfig === "function"
105
140
  ? [
106
141
  {
107
- path: "subjects/location",
142
+ path: "management/subjects/location",
108
143
  key: `${APP_PREFIX}_ADMIN_SUBJECTS_LOCATIONS`,
109
144
  exact: true,
110
145
  visible: (user) => userIsAdmin(user),
@@ -115,7 +150,7 @@ export function getAdminRoutes(config) {
115
150
  ...(typeof useAdminSubjectsConfig === "function"
116
151
  ? [
117
152
  {
118
- path: "subjects/stakeholder",
153
+ path: "management/subjects/stakeholder",
119
154
  key: `${APP_PREFIX}_ADMIN_SUBJECTS_STAKEHOLDERS`,
120
155
  exact: true,
121
156
  visible: (user) => userIsAdmin(user),
@@ -123,6 +158,50 @@ export function getAdminRoutes(config) {
123
158
  },
124
159
  ]
125
160
  : []),
161
+ ...(typeof useAdminLocationViewConfig === "function"
162
+ ? [
163
+ {
164
+ path: "management/subject/location/:id",
165
+ key: `${APP_PREFIX}_ADMIN_LOCATION_VIEW`,
166
+ exact: true,
167
+ visible: (user) => userIsAdmin(user),
168
+ component: <LocationViewWrapper />,
169
+ },
170
+ ]
171
+ : []),
172
+ ...(typeof useAdminSubjectsViewConfig === "function"
173
+ ? [
174
+ {
175
+ path: "management/subject/stakeholder/:id",
176
+ key: `${APP_PREFIX}_ADMIN_STAKEHOLDER_VIEW`,
177
+ exact: true,
178
+ visible: (user) => userIsAdmin(user),
179
+ component: <StakeholderViewWrapper />,
180
+ },
181
+ ]
182
+ : []),
183
+ ...(typeof useAdminLocationViewConfig === "function"
184
+ ? [
185
+ {
186
+ path: "management/subject/location/edit/:id",
187
+ key: `${APP_PREFIX}_ADMIN_LOCATION_EDIT`,
188
+ exact: true,
189
+ visible: (user) => userIsAdmin(user),
190
+ component: <LocationEditWrapper />,
191
+ },
192
+ ]
193
+ : []),
194
+ ...(typeof useAdminSubjectsViewConfig === "function"
195
+ ? [
196
+ {
197
+ path: "management/subject/stakeholder/edit/:id",
198
+ key: `${APP_PREFIX}_ADMIN_STAKEHOLDER_EDIT`,
199
+ exact: true,
200
+ visible: (user) => userIsAdmin(user),
201
+ component: <StakeholderEditWrapper />,
202
+ },
203
+ ]
204
+ : []),
126
205
  ];
127
206
 
128
207
  return routes;
@@ -1,18 +1,20 @@
1
1
  import React from 'react'
2
2
  import CustomIcon from '../../Icon/CustomIcon.jsx';
3
3
 
4
- const NavigationAction = ({onClick, theme}) => {
4
+ const NavigationAction = ({onClick, theme, disabled = false}) => {
5
5
  return (
6
6
  <div style={{ display: "flex", justifyContent: "center" }}>
7
7
  <button
8
8
  onClick={onClick}
9
+ disabled={disabled}
9
10
  style={{
10
- cursor: 'pointer',
11
11
  border: 'none',
12
12
  background: 'transparent',
13
13
  padding: 0,
14
14
  display: 'flex',
15
- alignItems: 'center'
15
+ alignItems: 'center',
16
+ opacity: disabled ? 0.5 : 1,
17
+ cursor: disabled ? 'not-allowed' : 'pointer',
16
18
  }}
17
19
  >
18
20
  <CustomIcon name="Link" size={15} color={theme.baseGray70} />