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,39 @@
1
+ import React from 'react'
2
+ import DashboardLayout from '../../../core/components/Dashboard/DashboardLayout/index.jsx';
3
+ import Header from '../../../core/components/Header/index.jsx';
4
+ import OrganisationInformation from './components/OrganisationInformation/index.jsx';
5
+ import ProductionSites from './components/ProductionSites/index.jsx';
6
+ import AssociatedInformation from './components/AssociatedInformation/index.jsx';
7
+
8
+ function SelfAssesment({
9
+ t = () => {},
10
+ breadcrumbs = [],
11
+ user = {},
12
+ goTo = () => {},
13
+ getRedirectLink = () => {},
14
+ theme = {},
15
+ options = {},
16
+ }) {
17
+ return (
18
+ <DashboardLayout
19
+ header={
20
+ <Header
21
+ title={t("Self Assesment")}
22
+ breadcrumbs={breadcrumbs}
23
+ />
24
+ }
25
+ >
26
+ <section>
27
+ <OrganisationInformation t={t} user={user} goTo={goTo} getRedirectLink={getRedirectLink} theme={theme} />
28
+ </section>
29
+ <section>
30
+ <ProductionSites t={t} options={options} user={user} goTo={goTo} getRedirectLink={getRedirectLink} />
31
+ </section>
32
+ <section>
33
+ <AssociatedInformation t={t} user={user} goTo={goTo} getRedirectLink={getRedirectLink} />
34
+ </section>
35
+ </DashboardLayout>
36
+ )
37
+ }
38
+
39
+ export default SelfAssesment
@@ -0,0 +1,180 @@
1
+ import React from 'react';
2
+ import { Tooltip } from 'antd';
3
+ import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
4
+ import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
+ import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
6
+ import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
+ import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
9
+ import MoreOptions from '../../../core/components/Table/MoreOptions/index.jsx';
10
+ import { renderStatusTag } from '../../../utils/tags.js';
11
+
12
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
13
+ {
14
+ dataIndex: 'datastakeId',
15
+ title: t('ID'),
16
+ ellipsis: true,
17
+ show: true,
18
+ render: (v, all) => {
19
+ if (all.empty) {
20
+ return <div className="daf-default-cell" />
21
+ }
22
+
23
+ return <Tooltip title={v}>{v}</Tooltip>;
24
+ },
25
+ },
26
+ {
27
+ dataIndex: 'name',
28
+ title: t('Name'),
29
+ ellipsis: true,
30
+ show: true,
31
+ render: (v, all) => {
32
+ if (all.empty) {
33
+ return <div className="daf-default-cell" />
34
+ }
35
+
36
+ return <Tooltip title={v}>{v}</Tooltip>;
37
+ },
38
+ },
39
+ {
40
+ dataIndex: 'category',
41
+ title: t('Category'),
42
+ ellipsis: true,
43
+ show: true,
44
+ render: (v, all) => {
45
+ if (all.empty) {
46
+ return <div className="daf-default-cell" />
47
+ }
48
+ const category = findOptions(v, options?.locationCategories);
49
+
50
+ return <Tooltip title={category}>{category}</Tooltip>;
51
+ },
52
+ },
53
+ {
54
+ dataIndex: 'lealForm',
55
+ title: t('Legal Form'),
56
+ ellipsis: true,
57
+ show: true,
58
+ render: (v, all) => {
59
+ if (all.empty) {
60
+ return <div className="daf-default-cell" />
61
+ }
62
+
63
+ const legalForm = findOptions(v, options?.legalFormOptions);
64
+
65
+ return legalForm ? <Tooltip title={legalForm}>{legalForm}</Tooltip> : '-';
66
+ },
67
+ },
68
+ {
69
+ dataIndex: 'country',
70
+ title: t('Country'),
71
+ ellipsis: true,
72
+ show: true,
73
+ render: (v, all) => {
74
+ if (all.empty) {
75
+ return <div className="daf-default-cell" />
76
+ }
77
+
78
+ const country = findOptions(v, options?.countryOptions);
79
+
80
+ return country ? <Tooltip title={country}>{country}</Tooltip> : '-';
81
+ },
82
+ },
83
+
84
+ // {
85
+ // dataIndex: 'operator',
86
+ // title: t('Operator'),
87
+ // ellipsis: true,
88
+ // show: true,
89
+ // render: (v, all) => {
90
+ // if (all.empty) {
91
+ // return <div className="daf-default-cell" />
92
+ // }
93
+
94
+ // const operators = all?.operator?.map((operator) => operator?.locationClient?.name)?.filter(Boolean);
95
+ // return (operators && operators.length > 0) ? <MoreOptions data={operators || []} toolTipPlacement={operators?.length < 2 ? "topLeft" : "top"} /> : '-';
96
+ // },
97
+ // },
98
+ {
99
+ title: t("Last Update"),
100
+ dataIndex: "updatedAt",
101
+ key: "updatedAt",
102
+ width: 125,
103
+ render: (date, all) => {
104
+ if (all.empty) {
105
+ return <div className="daf-default-cell" />;
106
+ }
107
+
108
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
109
+ return <Tooltip title={_date}>{_date}</Tooltip>;
110
+ },
111
+ ellipsis: true,
112
+ },
113
+ // {
114
+ // title: t("Status"),
115
+ // dataIndex: 'status',
116
+ // ellipsis: true,
117
+ // show: activeTab == "own",
118
+ // render: (v, all) => {
119
+ // if (all.empty) {
120
+ // return <div className="daf-default-cell" />
121
+ // }
122
+ // const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
123
+
124
+ // return renderStatusTag({ value: _val, t });
125
+ // },
126
+ // },
127
+
128
+ // {
129
+ // title: t("Sources"),
130
+ // dataIndex: 'sources',
131
+ // ellipsis: true,
132
+ // show: activeTab !== "own",
133
+ // render: (v, all) => {
134
+ // if (all.empty) {
135
+ // return <div className="daf-default-cell" />
136
+ // }
137
+ // const sources = sourceAvatarConfig(v, user, applications);
138
+ // return <AvatarGroup items={sources}></AvatarGroup>;
139
+ // },
140
+ // },
141
+ {
142
+ id: 'actions',
143
+ title: "",
144
+ width: 60,
145
+ render: (_, all) => {
146
+ if (all.empty) {
147
+ return <div className="daf-default-cell" />;
148
+ }
149
+ const onClick = () => {
150
+ let link = `/app/view/${subject}/${all.datastakeId}`;
151
+ if (activeTab === "shared") {
152
+ link += `?sourceId=${all?.authorId?.id}`;
153
+ }
154
+ goTo(getRedirectLink(link));
155
+ };
156
+ const moreMenuItems = [
157
+ {
158
+ label: t("Details"),
159
+ value: "details",
160
+ onClick: onClick,
161
+ },
162
+ {
163
+ label: t("Summary"),
164
+ value: "Summary",
165
+ onClick: () => {
166
+ let link = `/app/mine-summary/${all.datastakeId}`
167
+ if (activeTab === "shared") {
168
+ link += `?sourceId=${all?.authorId?.id}`;
169
+ }
170
+ goTo(getRedirectLink(link));
171
+ },
172
+ // disabled: true,
173
+ },
174
+ ];
175
+ return <div >
176
+ <MoreMenu items={moreMenuItems} />
177
+ </div>;
178
+ }
179
+ }
180
+ ].filter((column) => column.show !== false);
@@ -0,0 +1,27 @@
1
+ import React, { useState, useEffect, useRef } from 'react'
2
+ import TabsHeader from '../../../../core/components/Header/TabsHeader'
3
+ import {Widget} from '../../../../core/components/Dashboard/Widget'
4
+ import {getColumns} from './columns.js'
5
+ import {useParams} from 'react-router-dom'
6
+ import {DAFTable} from '../../../../core/components/Table'
7
+ import {useIsDatastake} from '../../../../hooks/useIsDatastake.js'
8
+
9
+ const AssociatedInformationTable = () => {
10
+ const tabs =[
11
+ {value:"stakeholders", label:"Stakeholders"},
12
+ {value:"locations", label:"Locations"},
13
+ {values:"events", label:"Events"},
14
+ {values:"DOcuments",label:"Documents"},
15
+ ]
16
+ const [activeTab, setActiveTab] = useState("stakeholders");
17
+ const [data,setData]= useState({
18
+ stakeholders:[],
19
+ locations:[],
20
+ events:[],
21
+ documents:[],
22
+ })
23
+ const [_options, _setOptions] = useState({});
24
+ const params = useParams();
25
+ const { user } = useSelector((state) => state.authentication);
26
+ const { getRedirectLink } = useIsDatastake();
27
+ }
@@ -0,0 +1,157 @@
1
+ import { Tooltip } from "antd";
2
+ import CustomIcon from "../../../../core/components/Icon/CustomIcon.jsx";
3
+ // import {findOptions} from "../../../../helpers/StringHelper.js";
4
+ import ProgressBar from "../../../../core/components/ProgressBar/index.jsx";
5
+ import ProgressBarSideIcon from "../../../../core/components/ProgressBar/components/SideIcon/index.jsx";
6
+ import { Link } from "react-router-dom";
7
+ import { renderDateFormatted } from "../../../../../helpers/Forms.js";
8
+
9
+ export const getColumns = ({
10
+ t,
11
+ goTo = () => {},
12
+ show = "show",
13
+ getRedirectLink = () => {},
14
+ token,
15
+ selectedSubjects,
16
+ setSelectedSubjects,
17
+ selectOptions,
18
+ entity,
19
+ }) => {
20
+ const cols = [
21
+ {
22
+ dataIndex: "formName",
23
+ title: t("form"),
24
+ ellipsis: true,
25
+ show: true,
26
+ render: (v, all) => {
27
+ if (all.empty) {
28
+ return <div className="daf-default-cell" />;
29
+ }
30
+
31
+ const title = all?.published
32
+ ? t("general-information")
33
+ : t("registration");
34
+
35
+ return <Tooltip title={title}>{title}</Tooltip>;
36
+ },
37
+ },
38
+ {
39
+ dataIndex: "completion",
40
+ title: t("completion"),
41
+ ellipsis: true,
42
+ show: !isMonitoring,
43
+ render: (v, all) => {
44
+ if (all.empty) {
45
+ return <div className="daf-default-cell" />;
46
+ }
47
+
48
+ const submittedStages = ["evaluation", "planning", "improvement"];
49
+
50
+ const step1Stage = data?.stepStages?.["step-1"];
51
+ const step2Stage = data?.stepStages?.["step-2"];
52
+ const isSubmitted =
53
+ data?.published &&
54
+ submittedStages.includes(step1Stage) &&
55
+ submittedStages.includes(step2Stage);
56
+
57
+ return (
58
+ <div style={{ display: "flex", alignItems: "center", gap: "5px" }}>
59
+ <ProgressBar
60
+ tooltipTitle={isSubmitted && t("Submitted")}
61
+ style={{ width: "100%" }}
62
+ percentage={v || 0}
63
+ isSubmitted={isSubmitted}
64
+ ></ProgressBar>
65
+ {isSubmitted ? (
66
+ <ProgressBarSideIcon size={16} iconSize={10} />
67
+ ) : (
68
+ <span>{v || 0}%</span>
69
+ )}
70
+ </div>
71
+ );
72
+ },
73
+ },
74
+ {
75
+ dataIndex: "monitoring",
76
+ title: t("Monitoring"),
77
+ ellipsis: true,
78
+ show: isMonitoring,
79
+ render: (v, all) => {
80
+ if (all.empty) {
81
+ return <div className="daf-default-cell" />;
82
+ }
83
+
84
+ return <Tooltip title={v || 0}>{v || 0}</Tooltip>;
85
+ },
86
+ },
87
+ {
88
+ dataIndex: "lastUpdate",
89
+ title: t("Last Update"),
90
+ ellipsis: true,
91
+ show: true,
92
+ render: (_v, all) => {
93
+ if (all.empty) {
94
+ return <div className="daf-default-cell" />;
95
+ }
96
+
97
+ const v = _v
98
+ ? renderDateFormatted(_v, "DD MMM YYYY", user?.language || "en")
99
+ : "-";
100
+
101
+ return <Tooltip title={v}>{v}</Tooltip>;
102
+ },
103
+ },
104
+ {
105
+ dataIndex: "action",
106
+ title: "",
107
+ width: 60,
108
+ show: true,
109
+ render: (_, all) => {
110
+ if (all.empty) {
111
+ return <div className="daf-default-cell" />;
112
+ }
113
+
114
+ let link = `/app/mines/${all.datastakeId}/${all?.key?.toLowerCase()}`;
115
+
116
+ if (all?.key.includes("monitoring")) {
117
+ return (
118
+ <Link to={getRedirectLink(link)}>
119
+ <CustomIcon name="Link" width={18} height={18} />
120
+ </Link>
121
+ );
122
+ }
123
+
124
+ if (all?.key.includes("identification")) {
125
+ link = `/app/view/location/${all.datastakeId}`;
126
+ }
127
+
128
+ const stage = data?.stage;
129
+ const key = all?.key;
130
+ let isDisabled = false;
131
+
132
+ if (
133
+ (stage === "evaluation" && (key === "improvement" || key === "planning")) ||
134
+ (stage === "planning" && key === "improvement") ||
135
+ (!["evaluation", "planning", "improvement"].includes(stage) &&
136
+ key !== "identification")
137
+ ) {
138
+ isDisabled = true;
139
+ }
140
+
141
+ return <div style={{ display: "flex", justifyContent: "center" }}>
142
+ {isDisabled ? (
143
+ <span style={{ cursor: "not-allowed", opacity: 0.5 }}>
144
+ <CustomIcon name="Link" width={18} height={18} />
145
+ </span>
146
+ ) : (
147
+ <Link to={getRedirectLink(link)}>
148
+ <CustomIcon name="Link" width={18} height={18} />
149
+ </Link>
150
+ )}
151
+ </div>;
152
+ },
153
+ },
154
+ ]
155
+
156
+ return cols.filter((c) => c[show]);
157
+ };
@@ -0,0 +1,31 @@
1
+ export const getFiltersConfig = ({t}) => {
2
+ return {
3
+ timeframe: {
4
+ type: "timeframe",
5
+ label: "Timeframe",
6
+ style: { flex: 1 },
7
+ },
8
+ }
9
+ }
10
+
11
+ export const getFilterOptions = (options, t) => {
12
+ const { timeframe = [] } = options || {};
13
+ const _default = {
14
+ timeframe: timeframe,
15
+ }
16
+
17
+ return _default;
18
+ }
19
+
20
+ export const formConfig = {
21
+ namespace: 'organisation',
22
+ view: 'information',
23
+ scope: 'create',
24
+ formType: 'organisation',
25
+ }
26
+
27
+ export const viewConfig = {
28
+ title: "Organisations",
29
+ createTitle: "Create Organisation",
30
+ }
31
+
@@ -0,0 +1,77 @@
1
+ import React from "react";
2
+ import TablePage from "../../../TablePage/index.jsx";
3
+
4
+ const OrganisationInformationTable = ({
5
+ t = () => {},
6
+ goTo = () => {},
7
+ user = {},
8
+ options = {},
9
+ getRedirectLink = () => {},
10
+ theme = {},
11
+ loading = false,
12
+ data = {},
13
+ isMobile,
14
+ APP,
15
+ location,
16
+ getData = () => {},
17
+ getApiBaseUrl = () => {},
18
+ getAppHeader = () => {},
19
+ getFormData = () => {},
20
+ saveFormData = () => {},
21
+ formLoading = false,
22
+ query = {},
23
+ ajaxForms = {},
24
+ changeAjaxForms = () => {},
25
+ ajaxOptions = {},
26
+ changeAjaxOptions = () => {},
27
+ formData = {},
28
+ formValue = {},
29
+ form = {},
30
+ applications = [],
31
+ subjectClear = () => {},
32
+ breadcrumbs = [],
33
+ extendingFilters = {},
34
+ createDefaultValues = {},
35
+ }) => {
36
+ return (
37
+ <TablePage
38
+ t={t}
39
+ goTo={goTo}
40
+ user={user}
41
+ options={options}
42
+ getRedirectLink={getRedirectLink}
43
+ theme={theme}
44
+ loading={loading}
45
+ data={data}
46
+ isMobile={isMobile}
47
+ APP={APP}
48
+ location={location}
49
+ applications={applications}
50
+
51
+ subject="organisations"
52
+ getData={getData}
53
+ getApiBaseUrl={getApiBaseUrl}
54
+ getAppHeader={getAppHeader}
55
+ subjectClear={subjectClear}
56
+ extendingFilters={extendingFilters}
57
+ breadcrumbs={breadcrumbs}
58
+
59
+ formConfig={{
60
+ getFormData,
61
+ saveFormData,
62
+ formLoading,
63
+ query,
64
+ ajaxForms,
65
+ changeAjaxForms,
66
+ ajaxOptions,
67
+ changeAjaxOptions,
68
+ formData,
69
+ formValue,
70
+ form,
71
+ }}
72
+ defaultValues={createDefaultValues}
73
+ />
74
+ );
75
+ };
76
+
77
+ export default OrganisationInformationTable;
@@ -0,0 +1,117 @@
1
+ import React from 'react';
2
+ import { Tooltip, Tag } from 'antd';
3
+ import { findOptions } from '../../../../helpers/StringHelper.js';
4
+ import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
+ import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
6
+ import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
+ import { renderStatusTag } from '../../../utils/tags.js';
9
+
10
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
11
+ {
12
+ dataIndex: 'datastakeId',
13
+ title: t('ID'),
14
+ ellipsis: true,
15
+ show: true,
16
+ render: (v, all) => {
17
+ if (all.empty) {
18
+ return <div className="daf-default-cell" />
19
+ }
20
+
21
+ return <Tooltip title={v}>{v}</Tooltip>;
22
+ },
23
+ },
24
+ {
25
+ dataIndex: 'name',
26
+ title: t('Name'),
27
+ ellipsis: true,
28
+ show: true,
29
+ render: (v, all) => {
30
+ if (all.empty) {
31
+ return <div className="daf-default-cell" />
32
+ }
33
+
34
+ return <Tooltip title={v}>{v}</Tooltip>;
35
+ },
36
+ },
37
+ {
38
+ dataIndex: 'category',
39
+ title: t('Type'),
40
+ ellipsis: true,
41
+ show: true,
42
+ render: (v, all) => {
43
+ if (all.empty) {
44
+ return <div className="daf-default-cell" />
45
+ }
46
+ const category = findOptions(v, options?.locationCategories);
47
+
48
+ return <Tooltip title={category}>{category}</Tooltip>;
49
+ },
50
+ },
51
+ {
52
+ dataIndex: 'region',
53
+ title: t('Region'),
54
+ ellipsis: true,
55
+ show: true,
56
+ render: (v, all) => {
57
+ if (all.empty) {
58
+ return <div className="daf-default-cell" />
59
+ }
60
+
61
+ const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
62
+
63
+ return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
64
+ },
65
+ },
66
+ {
67
+ dataIndex: 'district',
68
+ title: t('District'),
69
+ ellipsis: true,
70
+ show: true,
71
+ render: (v, all) => {
72
+ if (all.empty) {
73
+ return <div className="daf-default-cell" />
74
+ }
75
+
76
+ const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
77
+
78
+ return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
79
+ },
80
+ },
81
+ {
82
+ title: t("Last Update"),
83
+ dataIndex: "updatedAt",
84
+ key: "updatedAt",
85
+ width: 125,
86
+ render: (date, all) => {
87
+ if (all.empty) {
88
+ return <div className="daf-default-cell" />;
89
+ }
90
+
91
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
92
+ return <Tooltip title={_date}>{_date}</Tooltip>;
93
+ },
94
+ ellipsis: true,
95
+ },
96
+
97
+ {
98
+ id: 'actions',
99
+ title: "",
100
+ width: 60,
101
+ render: (_, all) => {
102
+ if (all.empty) {
103
+ return <div className="daf-default-cell" />;
104
+ }
105
+
106
+ const onClick = () => {
107
+ let link = `/app/view/${subject}/${all.datastakeId}`;
108
+ if (activeTab === "shared") {
109
+ link += `?sourceId=${all?.authorId?.id}`;
110
+ }
111
+ goTo(getRedirectLink(link));
112
+ };
113
+
114
+ return <NavigationAction onClick={onClick} theme={theme} />;
115
+ }
116
+ }
117
+ ].filter((column) => column.show !== false);
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import TablePage from '../../../TablePage/index.jsx';
3
+ import { getColumns } from './columns.js';
4
+
5
+ const ProductionSiteTable = ({
6
+ t = () => {},
7
+ goTo = () => {},
8
+ user = {},
9
+ options = {},
10
+ getRedirectLink = () => {},
11
+ theme = {},
12
+ loading = false,
13
+ data = {},
14
+ isMobile,
15
+ APP,
16
+ location,
17
+ getData = () => {},
18
+ getApiBaseUrl = () => {},
19
+ getAppHeader = () => {},
20
+ applications = [],
21
+ subjectClear = () => {},
22
+ breadcrumbs = [],
23
+ extendingFilters = {},
24
+ createDefaultValues = {},
25
+ }) => {
26
+ return (
27
+ <TablePage
28
+ t={t}
29
+ goTo={goTo}
30
+ user={user}
31
+ options={options}
32
+ getRedirectLink={getRedirectLink}
33
+ theme={theme}
34
+ loading={loading}
35
+ data={data}
36
+ isMobile={isMobile}
37
+ APP={APP}
38
+ location={location}
39
+ applications={applications}
40
+ subject="production-sites"
41
+ getData={getData}
42
+ getApiBaseUrl={getApiBaseUrl}
43
+ getAppHeader={getAppHeader}
44
+ subjectClear={subjectClear}
45
+ extendingFilters={extendingFilters}
46
+ breadcrumbs={breadcrumbs}
47
+ formConfig={formConfig}
48
+ defaultValues={createDefaultValues}
49
+ onDownload={() => console.log("download")}
50
+ />
51
+ )
52
+ }
53
+
54
+ export default ProductionSiteTable
File without changes