datastake-daf 0.6.791 → 0.6.793

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.791",
3
+ "version": "0.6.793",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -128,13 +128,13 @@ function AuthForm ({
128
128
  case "input":
129
129
  case "email":
130
130
  case "number":
131
- inputNode = <Input type={field.type} placeholder={field.placeholder} {...field.props} />;
131
+ inputNode = <Input type={field.type} placeholder={field.placeholder} disabled={field.disabled} {...field.props} />;
132
132
  break;
133
133
  case "password":
134
- inputNode = <Input.Password placeholder={field.placeholder} {...field.props} />;
134
+ inputNode = <Input.Password placeholder={field.placeholder} disabled={field.disabled} {...field.props} />;
135
135
  break;
136
136
  case "textarea":
137
- inputNode = <Input.TextArea placeholder={field.placeholder} {...field.props} />;
137
+ inputNode = <Input.TextArea placeholder={field.placeholder} disabled={field.disabled} {...field.props} />;
138
138
  break;
139
139
  case "select": {
140
140
  const { onChange: fieldOnChange, value: fieldValue, ...restSelectProps } = field.props || {};
@@ -142,6 +142,7 @@ function AuthForm ({
142
142
  inputNode = (
143
143
  <StyledSelect
144
144
  placeholder={field.placeholder}
145
+ disabled={field.disabled}
145
146
  {...restSelectProps}
146
147
  >
147
148
  {field.options?.map((opt) => (
@@ -157,7 +158,7 @@ function AuthForm ({
157
158
  inputNode = field.component;
158
159
  break;
159
160
  default:
160
- inputNode = <Input placeholder={field.placeholder} {...field.props} />;
161
+ inputNode = <Input placeholder={field.placeholder} disabled={field.disabled} {...field.props} />;
161
162
  }
162
163
 
163
164
  const formItemProps = {
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import ProgressBar from '../index.jsx'
3
+ import ProgressBarSideIcon from '../components/SideIcon/index.jsx'
4
+
5
+ function ProgressBarWithIcon({
6
+ published,
7
+ data,
8
+ t
9
+ }) {
10
+ return (
11
+ <div style={{ display: "flex", alignItems: "center", gap: "5px" }}>
12
+ <ProgressBar
13
+ style={{ width: "100%" }}
14
+ tooltipTitle={published && t("Submitted")}
15
+ percentage={parseInt(data?.completion || 0)}
16
+ isSubmitted={published}
17
+ />
18
+ {published ? <ProgressBarSideIcon size={16} iconSize={10} /> : <span>{parseInt(data?.completion || 0)}%</span>}
19
+ </div>
20
+ )
21
+ }
22
+
23
+ export default ProgressBarWithIcon
@@ -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} />
@@ -0,0 +1,248 @@
1
+ import React from "react";
2
+ import { Tooltip } from "antd";
3
+ import { renderDateFormatted } from '../../../../../../helpers/Forms.js';
4
+ import { findOptions, getLinkValue } from '../../../../../../helpers/StringHelper.js';
5
+ import CustomIcon from '../../../../../core/components/Icon/CustomIcon.jsx';
6
+ import NavigationAction from '../../../../../core/components/Table/NavigationAction/index.jsx';
7
+
8
+
9
+ export const getColumns = ({ t, activeTab, options, user, goTo, getRedirectLink, theme }) =>
10
+ [
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 (
22
+ <Tooltip title={v}>{v || "-"}</Tooltip>
23
+ );
24
+ },
25
+ },
26
+ {
27
+ dataIndex: "name",
28
+ title: activeTab === "documents" || activeTab === "events" ? t("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 (
37
+ <Tooltip title={v}>{v || "-"}</Tooltip>
38
+ );
39
+ },
40
+ },
41
+ {
42
+ dataIndex: "keyStakeholders",
43
+ title: t("Key Stakeholders"),
44
+ ellipsis: true,
45
+ show: activeTab === "events",
46
+ render: (v, all) => {
47
+ if (all.empty) {
48
+ return <div className="daf-default-cell" />;
49
+ }
50
+
51
+ return (
52
+ <Tooltip title={v}>{v || "-"}</Tooltip>
53
+ );
54
+ },
55
+ },
56
+ {
57
+ dataIndex: "category",
58
+ title: t("Category"),
59
+ ellipsis: true,
60
+ show: activeTab === "stakeholders" || activeTab === "locations",
61
+ render: (v, all) => {
62
+ if (all.empty) {
63
+ return <div className="daf-default-cell" />;
64
+ }
65
+ const label = findOptions(v, options?.categoriesOptions) || "-";
66
+
67
+ return (
68
+ <Tooltip title={label}>{label || "-"}</Tooltip>
69
+ );
70
+ },
71
+ },
72
+ {
73
+ dataIndex: "subCategory",
74
+ title: t("Legal Form"),
75
+ ellipsis: true,
76
+ show: activeTab === "stakeholders",
77
+ render: (v, all) => {
78
+ if (all.empty) {
79
+ return <div className="daf-default-cell" />;
80
+ }
81
+
82
+ const label = findOptions(v, options?.subCategoriesOptionsSbgi) || "-";
83
+
84
+ return (
85
+ <Tooltip title={label}>{label || "-"}</Tooltip>
86
+ );
87
+ },
88
+ },
89
+ {
90
+ dataIndex: "country",
91
+ title: t("Country"),
92
+ ellipsis: true,
93
+ show: activeTab === "stakeholders" || activeTab === "locations",
94
+ render: (v, all) => {
95
+ if (all.empty) {
96
+ return <div className="daf-default-cell" />;
97
+ }
98
+
99
+ const label = findOptions(v, options?.countries) || "-";
100
+
101
+ return (
102
+ <Tooltip title={label}>{label || "-"}</Tooltip>
103
+ );
104
+ },
105
+ },
106
+ {
107
+ dataIndex: 'region',
108
+ title: findOptions(user?.company?.country, options?.administrativeLevel1)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel1) : t("Province"),
109
+ ellipsis: true,
110
+ show: activeTab === "locations",
111
+ render: (v, all) => {
112
+ if (all.empty) {
113
+ return <div className="daf-default-cell" />
114
+ }
115
+
116
+ const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
117
+
118
+ return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
119
+ },
120
+ },
121
+ {
122
+ dataIndex: 'territory',
123
+ title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2) : t("Territory"),
124
+ ellipsis: true,
125
+ show: activeTab === "locations",
126
+ render: (v, all) => {
127
+ if (all.empty) {
128
+ return <div className="daf-default-cell" />
129
+ }
130
+
131
+ const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
132
+
133
+ return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
134
+ },
135
+ },
136
+ {
137
+ dataIndex: "type",
138
+ show: activeTab === "documents",
139
+ title: t("Type"),
140
+ ellipsis: true,
141
+ render: (v, all) => {
142
+ if (all.empty) {
143
+ return <div className="daf-default-cell" />;
144
+ }
145
+
146
+ const label = findOptions(v, options?.documentationTypesOptions) || "-";
147
+
148
+ return (
149
+ <Tooltip title={label}>{label || "-"}</Tooltip>
150
+ );
151
+ },
152
+ },
153
+ {
154
+ dataIndex: "date",
155
+ title: t("Date"),
156
+ ellipsis: true,
157
+ show: activeTab === "events",
158
+ render: (v, all) => {
159
+ if (all.empty) {
160
+ return <div className="daf-default-cell" />;
161
+ }
162
+
163
+ const language = user?.language === 'sp' ? 'es' : user?.language
164
+ const date = v ? renderDateFormatted(v, 'DD MMM YYYY', language || 'en') : '-';
165
+
166
+ return <Tooltip title={date}>{date}</Tooltip>;
167
+ },
168
+ },
169
+ {
170
+ dataIndex: "lastUpdated",
171
+ title: t("Last Update"),
172
+ ellipsis: true,
173
+ show: true,
174
+ render: (v, all) => {
175
+ if (all.empty) {
176
+ return <div className="daf-default-cell" />;
177
+ }
178
+
179
+ const language = user?.language === 'sp' ? 'es' : user?.language
180
+ const date = v ? renderDateFormatted(v, 'DD MMM YYYY', language || 'en') : '-';
181
+
182
+ return <Tooltip title={date}>{date}</Tooltip>;
183
+ },
184
+ },
185
+ {
186
+ dataIndex: "scope",
187
+ title: t("Scope"),
188
+ ellipsis: true,
189
+ show: activeTab === "events",
190
+ render: (v, all) => {
191
+ if (all.empty) {
192
+ return <div className="daf-default-cell" />;
193
+ }
194
+
195
+ return (
196
+ <Tooltip title={v}>{v || "-"}</Tooltip>
197
+ );
198
+ },
199
+ },
200
+ {
201
+ dataIndex: "content",
202
+ title: t("Content"),
203
+ ellipsis: true,
204
+ show: activeTab === "documents",
205
+ render: (_, all) => {
206
+ if (all.empty) {
207
+ return <div className="daf-default-cell" />;
208
+ }
209
+
210
+ const content = {
211
+ name: all?.content?.[0]?.name,
212
+ link:all?.content?.[0]?.url
213
+ };
214
+
215
+ return (
216
+ <a
217
+ href={content.link}
218
+ target="_blank"
219
+ rel="noopener noreferrer"
220
+ style={{
221
+ // maxWidth: "100px",
222
+ whiteSpace: "nowrap",
223
+ overflow: "hidden",
224
+ textOverflow: "ellipsis",
225
+ }}
226
+ >
227
+ {content.name}
228
+ </a>
229
+ );
230
+ },
231
+ },
232
+ {
233
+ title: t(""),
234
+ dataIndex: "actions",
235
+ key: "actions",
236
+ width: 60,
237
+ show: true,
238
+ render: (v, all) => {
239
+ if (all.empty) {
240
+ return <div className="daf-default-cell" />;
241
+ }
242
+ const link = `/app/view/${activeTab}/${all.datastakeId}`;
243
+
244
+ return <NavigationAction onClick={() => goTo(getRedirectLink(link))} theme={theme} />
245
+
246
+ },
247
+ },
248
+ ].filter((column) => column.show);
@@ -0,0 +1,68 @@
1
+ import React, { useState, useMemo } from 'react'
2
+ import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
3
+ import Style from './style.js';
4
+ import SearchFilters from '../../../../../core/components/Filters/searchFilters/index.jsx';
5
+ import DafTable from '../../../../../core/components/Table/index.jsx';
6
+ import TabsHeader from '../../../../../core/components/Header/TabsHeader/index.jsx';
7
+ import { getColumns } from './columns.js';
8
+
9
+ function AssociatedInformation({
10
+ t = () => {},
11
+ user = {},
12
+ goTo = () => {},
13
+ getRedirectLink = () => {},
14
+ options = {},
15
+ }) {
16
+ const tabs = [
17
+ { value: "stakeholders", label: t("Stakeholders") },
18
+ { value: "locations", label: t("Locations") },
19
+ { value: "documents", label: t("Documents") },
20
+ { value: "events", label: t("Events") },
21
+ ];
22
+ const [activeTab, setActiveTab] = useState("stakeholders");
23
+
24
+ const data = [];
25
+
26
+ const columns = useMemo(
27
+ () => getColumns({ t, isMonitoring: false, activeTab, options, getRedirectLink, user }),
28
+ [t, activeTab, options, getRedirectLink, user],
29
+ );
30
+
31
+ return (
32
+ <Widget
33
+ title={t("Associated Information")}
34
+ expandable
35
+ className="with-border-header no-px-body overflow-hidden"
36
+ >
37
+ <div style={{ display: "flex", flexDirection: "column", gap: "24px", marginLeft: "12px" }}>
38
+ <TabsHeader
39
+ tabs={tabs}
40
+ onChange={setActiveTab}
41
+ value={activeTab}
42
+ className="mt-0"
43
+ />
44
+ <Style>
45
+ <div>
46
+ <SearchFilters t={t} />
47
+ </div>
48
+ <div>
49
+ <div className="daf-table-wrapper">
50
+ <DafTable
51
+ columns={columns}
52
+ data={data[activeTab]}
53
+ className="pr-0"
54
+ doEmptyRows
55
+ rowKey={"datas"}
56
+ hideOnLoading={false}
57
+ scroll={{ x: false, y: 55 * 5 }}
58
+ key={activeTab}
59
+ />
60
+ </div>
61
+ </div>
62
+ </Style>
63
+ </div>
64
+ </Widget>
65
+ )
66
+ }
67
+
68
+ export default AssociatedInformation
@@ -0,0 +1,29 @@
1
+ import styled from "styled-components";
2
+
3
+ const Style = styled.div`
4
+ max-width: 98%;
5
+ margin-left: var(--size-lg);
6
+ overflow: hidden;
7
+ padding-right: 24px;
8
+
9
+ .daf-table {
10
+ padding: 0px;
11
+ margin-top: 0px;
12
+
13
+ .ant-tag {
14
+ text-align: center;
15
+ }
16
+ }
17
+
18
+ .daf-select-filters .filters {
19
+ padding-top: 16px;
20
+ padding-left: 0;
21
+ padding-right: 0;
22
+ }
23
+
24
+ .daf-table {
25
+ padding-top: 16px;
26
+ }
27
+ `;
28
+
29
+ export default Style;
@@ -0,0 +1,93 @@
1
+ import { Tooltip } from "antd";
2
+ import ProgressBarWithIcon from "../../../../../core/components/ProgressBar/ProgressBarWithIcon/index.jsx";
3
+ import { renderDateFormatted } from "../../../../../../helpers/Forms.js";
4
+ import MoreMenu from "../../../../../core/components/Table/MoreMenu/index.jsx";
5
+ import NavigationAction from "../../../../../core/components/Table/NavigationAction/index.jsx";
6
+
7
+ export const getColumns = ({
8
+ t,
9
+ data,
10
+ user,
11
+ goTo,
12
+ getRedirectLink,
13
+ theme,
14
+ }) => [
15
+ {
16
+ dataIndex: 'name',
17
+ title: t('Name'),
18
+ ellipsis: true,
19
+ show: true,
20
+ render: (v, all) => {
21
+ if (all.empty) {
22
+ return <div className="daf-default-cell" />
23
+ }
24
+ return <Tooltip title={v}>{v}</Tooltip>
25
+ }
26
+ },
27
+ {
28
+ dataIndex: 'completion',
29
+ title: t('Completion'),
30
+ ellipsis: true,
31
+ show: true,
32
+ render: (v, all) => {
33
+ if (all.empty) {
34
+ return <div className="daf-default-cell" />
35
+ }
36
+ const published = false;
37
+
38
+ return <ProgressBarWithIcon published={published} data={v} t={t} />
39
+ }
40
+ },
41
+ {
42
+ dataIndex: 'lastUpdate',
43
+ title: t('Last Update'),
44
+ ellipsis: true,
45
+ show: true,
46
+ render: (v, all) => {
47
+ if (all.empty) {
48
+ return <div className="daf-default-cell" />
49
+ }
50
+ const date = v ? renderDateFormatted(v, "DD MMM YYYY", user?.language || 'en') : "-";
51
+ return <Tooltip title={date}>{date}</Tooltip>
52
+ }
53
+ },
54
+ {
55
+ id: 'actions',
56
+ title: "",
57
+ width: 60,
58
+ render: (_, all) => {
59
+ if (all.empty) {
60
+ return <div className="daf-default-cell" />;
61
+ }
62
+
63
+ const moreMenuItems = [
64
+ {
65
+ label: t("Summary"),
66
+ value: "Summary",
67
+ onClick: () => {
68
+ let link = `/app/operator-summary/${all.datastakeId}`
69
+ goTo(getRedirectLink(link));
70
+ },
71
+ disabled: true,
72
+ },
73
+ {
74
+ label: t("Details"),
75
+ value: "details",
76
+ onClick: () => {
77
+ let link = `/app/view/kyc/user`;
78
+ goTo(getRedirectLink(link));
79
+ },
80
+ disabled: true,
81
+ },
82
+ ];
83
+
84
+ const managementSystemsOnClick = () => {
85
+ let link = `/app/view/management-systems/user`;
86
+ goTo(getRedirectLink(link));
87
+ }
88
+
89
+ return all?.key === 'kyc' ? <MoreMenu items={moreMenuItems} />
90
+ : <NavigationAction onClick={managementSystemsOnClick} theme={theme} disabled />
91
+ }
92
+ }
93
+ ]
@@ -0,0 +1,43 @@
1
+ import React, { useMemo } from 'react'
2
+ import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
3
+ import DAFTable from '../../../../../core/components/Table/index.jsx';
4
+ import { getColumns } from './columns.js';
5
+
6
+ function OrganisationInformation({
7
+ t = () => {},
8
+ user = {},
9
+ goTo = () => {},
10
+ getRedirectLink = () => {},
11
+ theme = {},
12
+ }) {
13
+ const organistionInfo = [
14
+ {key: 'kyc', label: t("My KYC")},
15
+ {key: 'management-systems', label: t("Management Systems")},
16
+ ]
17
+
18
+ const tableData = useMemo(() => {
19
+ return organistionInfo.map((item) => {
20
+ return {
21
+ key: item.key,
22
+ name: item.label,
23
+ completion: 0,
24
+ lastUpdate: "",
25
+ }
26
+ })
27
+ }, [organistionInfo])
28
+
29
+ const columns = useMemo(() => {
30
+ return getColumns({ t, data: tableData, user, goTo, getRedirectLink, theme })
31
+ }, [tableData, user, goTo, getRedirectLink, theme])
32
+
33
+ return (
34
+ <Widget
35
+ title={t("Organisation Information")}
36
+ className="with-border-header daf-table-wrapper no-pagination no-px-body"
37
+ >
38
+ <DAFTable columns={columns} data={tableData} />
39
+ </Widget>
40
+ )
41
+ }
42
+
43
+ export default OrganisationInformation