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.
@@ -0,0 +1,127 @@
1
+ import React from 'react';
2
+ import { Tooltip } from 'antd';
3
+ import { findOptions, getLinkValue } from '../../../../../../helpers/StringHelper.js';
4
+ import MoreMenu from '../../../../../core/components/Table/MoreMenu/index.jsx';
5
+ import { renderDateFormatted } from '../../../../../../helpers/Forms.js';
6
+
7
+ export const getColumns = ({
8
+ t = () => {},
9
+ options = {},
10
+ user = {},
11
+ goTo = () => {},
12
+ getRedirectLink = () => {},
13
+ }) => [
14
+ {
15
+ title: t("ID"),
16
+ dataIndex: "datastakeId",
17
+ key: "datastakeId",
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
+ title: t("Name"),
28
+ dataIndex: "name",
29
+ key: "name",
30
+ render: (v, all) => {
31
+ if (all.empty) {
32
+ return <div className="daf-default-cell" />;
33
+ }
34
+
35
+ return <Tooltip title={v}>{v}</Tooltip>;
36
+ },
37
+ },
38
+ {
39
+ dataIndex: 'category',
40
+ title: t('type'),
41
+ ellipsis: true,
42
+ show: true,
43
+ render: (v, all) => {
44
+ if (all.empty) {
45
+ return <div className="daf-default-cell" />
46
+ }
47
+ const locationCategories = [...(options?.locationCategories || []), ...(options?.productionSiteCategories || [])]
48
+ const category = findOptions(v, locationCategories);
49
+
50
+ return <Tooltip title={category}>{category}</Tooltip>;
51
+ },
52
+ },
53
+ {
54
+ dataIndex: 'region',
55
+ title: findOptions(user?.company?.country, options?.administrativeLevel1)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel1) : t("Province"),
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 region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
64
+
65
+ return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
66
+ },
67
+ },
68
+ {
69
+ dataIndex: 'territory',
70
+ title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2) : t("Territory"),
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 district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
79
+
80
+ return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
81
+ },
82
+ },
83
+ {
84
+ dataIndex: 'lastUpdate',
85
+ title: t('Last Update'),
86
+ ellipsis: true,
87
+ show: true,
88
+ render: (v, all) => {
89
+ if (all.empty) {
90
+ return <div className="daf-default-cell" />
91
+ }
92
+ const date = v ? renderDateFormatted(v, "DD MMM YYYY", user?.language || 'en') : "-";
93
+ return <Tooltip title={date}>{date}</Tooltip>
94
+ }
95
+ },
96
+ {
97
+ id: 'actions',
98
+ title: "",
99
+ width: 60,
100
+ render: (_, all) => {
101
+ if (all.empty) {
102
+ return <div className="daf-default-cell" />;
103
+ }
104
+
105
+ const moreMenuItems = [
106
+ {
107
+ label: t("Summary"),
108
+ value: "Summary",
109
+ onClick: () => {
110
+ let link = `/app/mine-summary/${all.datastakeId}`
111
+ goTo(getRedirectLink(link));
112
+ },
113
+ },
114
+ {
115
+ label: t("Details"),
116
+ value: "details",
117
+ onClick: () => {
118
+ let link = `/app/view/production-sites/${all.datastakeId}`;
119
+ goTo(getRedirectLink(link));
120
+ },
121
+ },
122
+ ];
123
+
124
+ return <MoreMenu items={moreMenuItems} />
125
+ }
126
+ }
127
+ ]
@@ -0,0 +1,52 @@
1
+ import React, { useMemo } from 'react'
2
+ import ComponentWithFocus from '../../../../../core/components/Dashboard/ComponentWithFocus/index.jsx';
3
+ import StickyTable from '../../../../../core/components/Table/StickyTable/index.jsx';
4
+ import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
5
+ import Style from './style.js';
6
+ import { getColumns } from './columns.js';
7
+
8
+ function ProductionSites({
9
+ t = () => {},
10
+ options = {},
11
+ user = {},
12
+ goTo = () => {},
13
+ getRedirectLink = () => {},
14
+ }) {
15
+ const data = [];
16
+
17
+ const Wrapper = useMemo(() => {
18
+ return data.length > 5 ? ComponentWithFocus : "div";
19
+ }, [data.length]);
20
+
21
+ const columns = useMemo(() => {
22
+ return getColumns({ t, options, user, goTo, getRedirectLink });
23
+ }, [t, options, user, goTo, getRedirectLink]);
24
+
25
+ return (
26
+ <Widget
27
+ title={t("Production Sites")}
28
+ className="with-border-header no-px-body"
29
+ >
30
+ <Wrapper>
31
+ <Style>
32
+ <div
33
+ className="daf-table-wrapper"
34
+ style={{
35
+ maxHeight: "526px",
36
+ overflowY: "auto",
37
+ }}
38
+ >
39
+ <StickyTable
40
+ columns={columns}
41
+ dataSource={data}
42
+ hideOnLoading={false}
43
+ doEmptyRows={true}
44
+ />
45
+ </div>
46
+ </Style>
47
+ </Wrapper>
48
+ </Widget>
49
+ )
50
+ }
51
+
52
+ export default ProductionSites
@@ -0,0 +1,26 @@
1
+ import styled from "styled-components";
2
+
3
+ const Style = styled.div`
4
+ overflow: hidden;
5
+
6
+ .daf-table {
7
+ padding: 0px;
8
+ margin-top: 0px;
9
+
10
+ .ant-tag {
11
+ text-align: center;
12
+ }
13
+ }
14
+
15
+ .daf-select-filters .filters {
16
+ padding-top: 16px;
17
+ padding-left: 0;
18
+ padding-right: 0;
19
+ }
20
+
21
+ .daf-table {
22
+ padding-top: 16px;
23
+ }
24
+ `;
25
+
26
+ export default Style;
@@ -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
@@ -81,7 +81,7 @@ export const getFiltersConfig = ({t}) => {
81
81
  getLabel: (option) => option.label,
82
82
  getValue: (option) => option.value,
83
83
  },
84
- type: {
84
+ category: {
85
85
  type: 'select',
86
86
  label: 'Type',
87
87
  placeholder: () => `${t('Filter by')} ${t('Type').toLowerCase()}`,
@@ -124,14 +124,15 @@ export const getFilterOptions = (options, t) => {
124
124
  administrativeLevel1,
125
125
  administrativeLevel2,
126
126
  mineralOptions,
127
+ productionSiteCategories,
127
128
  locationCategories = [],
128
129
  } = options || {};
129
130
 
130
131
  const _default = {
131
- category: stakeholderCategoryOptions || categoryOptions,
132
+ // category: stakeholderCategoryOptions || categoryOptions,
132
133
  country: countries,
133
134
  product: mineralOptions,
134
- type: locationCategories,
135
+ category: productionSiteCategories || locationCategories,
135
136
  administrativeLevel1,
136
137
  administrativeLevel2,
137
138
  subCategory: subCategoriesOptions,
package/src/index.js CHANGED
@@ -97,6 +97,7 @@ export { default as ProgressBar } from "./@daf/core/components/ProgressBar/index
97
97
  export { default as MultiBarProgress } from "./@daf/core/components/ProgressBar/MultiBarProgress/index.jsx";
98
98
  export { default as MultiColorProgressBar } from "./@daf/core/components/ProgressBar/MultiColorProgressBar/index.jsx";
99
99
  export { default as ProgressBarSideIcon } from "./@daf/core/components/ProgressBar/components/SideIcon/index.jsx";
100
+ export { default as ProgressBarWithIcon } from "./@daf/core/components/ProgressBar/ProgressBarWithIcon/index.jsx";
100
101
  export { default as ProgressTabs } from "./@daf/core/components/ProgressTabs/index.jsx";
101
102
 
102
103
  // Data Store
package/src/pages.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Dashboards
2
2
  export { default as SupplyChainDashboard } from './@daf/pages/Dashboards/SupplyChain/index.jsx';
3
3
  export { default as UserDashboard } from './@daf/pages/Dashboards/UserDashboard/index.jsx';
4
+ export { default as SelfAssesment } from './@daf/pages/Dashboards/SelfAssesment/index.jsx';
4
5
  export { default as OperatorsTable } from './@daf/pages/Stakeholders/Operators/index.jsx';
5
6
  export { default as LocationsTable } from './@daf/pages/Locations/index.jsx';
6
7
  export { default as StakeholdersTable } from './@daf/pages/Stakeholders/index.jsx';