datastake-daf 0.6.748 → 0.6.749
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 +3979 -2782
- package/dist/pages/index.js +1305 -692
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Settings/Edit/components/Form/index.js +115 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Form/style.js +35 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/ImageUpload.js +67 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/Phone.js +24 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/ResetPassword.js +122 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/Select.js +26 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/Switch.js +56 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/Text.js +19 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/TransferRights.js +30 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/helper.js +13 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/style.js +56 -0
- package/src/@daf/core/components/Screens/Settings/Edit/index.js +63 -0
- package/src/@daf/core/components/Screens/Settings/View/components/Content/helper.js +142 -0
- package/src/@daf/core/components/Screens/Settings/View/components/Content/index.js +61 -0
- package/src/@daf/core/components/Screens/Settings/View/components/Content/style.js +338 -0
- package/src/@daf/core/components/Screens/Settings/View/index.js +46 -0
- package/src/@daf/core/components/Screens/Settings/components/Header/index.js +64 -0
- package/src/@daf/core/components/Screens/Settings/components/Menu/index.js +36 -0
- package/src/@daf/core/components/Screens/Settings/config.js +30 -0
- package/src/@daf/core/components/Screens/Settings/index.js +164 -0
- package/src/@daf/pages/Documents/columns.js +25 -8
- package/src/@daf/pages/Documents/config.js +7 -10
- package/src/@daf/pages/Events/Activities/columns.js +19 -9
- package/src/@daf/pages/Events/Activities/config.js +23 -13
- package/src/@daf/pages/Events/Incidents/columns.js +19 -9
- package/src/@daf/pages/Events/Incidents/config.js +23 -13
- package/src/@daf/pages/Events/columns.js +33 -8
- package/src/@daf/pages/Events/config.js +14 -22
- package/src/@daf/pages/Locations/MineSite/columns.js +53 -18
- package/src/@daf/pages/Locations/columns.js +54 -32
- package/src/@daf/pages/Locations/config.js +12 -2
- package/src/@daf/pages/Stakeholders/Operators/columns.js +57 -22
- package/src/@daf/pages/Stakeholders/columns.js +45 -23
- package/src/@daf/pages/Stakeholders/config.js +12 -2
- package/src/@daf/pages/Stakeholders/index.jsx +1 -0
- package/src/@daf/services/BaseService.js +15 -0
- package/src/index.js +9 -0
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/dist/style/datastake/mapbox-gl.css +0 -330
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// import { Avatar, Switch, Image } from "antd";
|
|
2
|
+
// import { INPUT_TYPES, PLACEHOLDER } from "../../../config";
|
|
3
|
+
// import { getImageUploadViewValue } from "../../../../../ViewForm/helper";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// export const renderInputView = ({ input, data, t }) => {
|
|
8
|
+
// const value = data?.[input.key];
|
|
9
|
+
|
|
10
|
+
// switch (input.type) {
|
|
11
|
+
// case INPUT_TYPES.TEXT:
|
|
12
|
+
// case INPUT_TYPES.SELECT:
|
|
13
|
+
// case INPUT_TYPES.PHONE:
|
|
14
|
+
// if (input.type === INPUT_TYPES.IMAGE_UPLOAD) {
|
|
15
|
+
// const fileList = getImageUploadViewValue(value);
|
|
16
|
+
// return (
|
|
17
|
+
// <div className="value">
|
|
18
|
+
// {fileList.length ? fileList.map(f => f.url).join(', ') : PLACEHOLDER}
|
|
19
|
+
// </div>
|
|
20
|
+
// );
|
|
21
|
+
// }
|
|
22
|
+
// return (
|
|
23
|
+
// <div className="value">
|
|
24
|
+
// {value || PLACEHOLDER}
|
|
25
|
+
// </div>
|
|
26
|
+
// );
|
|
27
|
+
|
|
28
|
+
// case INPUT_TYPES.SWITCH:
|
|
29
|
+
// return (
|
|
30
|
+
// <div className="value">
|
|
31
|
+
// <Switch checked={value} disabled />
|
|
32
|
+
// </div>
|
|
33
|
+
// );
|
|
34
|
+
|
|
35
|
+
// case INPUT_TYPES.IMAGE_UPLOAD:
|
|
36
|
+
// return (
|
|
37
|
+
// <div className="value">
|
|
38
|
+
// {value ? (
|
|
39
|
+
// <Image
|
|
40
|
+
// src={value}
|
|
41
|
+
// width={100}
|
|
42
|
+
// height={100}
|
|
43
|
+
// style={{ objectFit: 'cover' }}
|
|
44
|
+
// />
|
|
45
|
+
// ) : (
|
|
46
|
+
// <Avatar size={100} icon="UserOutlined" />
|
|
47
|
+
// )}
|
|
48
|
+
// </div>
|
|
49
|
+
// );
|
|
50
|
+
|
|
51
|
+
// case INPUT_TYPES.RESET_PASSWORD:
|
|
52
|
+
// return (
|
|
53
|
+
// <div className="value">
|
|
54
|
+
// {t('Click edit to reset password')}
|
|
55
|
+
// </div>
|
|
56
|
+
// );
|
|
57
|
+
|
|
58
|
+
// default:
|
|
59
|
+
// return <div className="value">{PLACEHOLDER}</div>;
|
|
60
|
+
// }
|
|
61
|
+
// };
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
/* eslint-disable no-case-declarations */
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
import React from "react";
|
|
71
|
+
import { Image } from "antd";
|
|
72
|
+
import { getImageUploadViewValue } from "../../../../../ViewForm/helper";
|
|
73
|
+
import { INPUT_TYPES, PLACEHOLDER } from "../../../config";
|
|
74
|
+
import { renderDateFormatted } from "../../../../../../../../utils";
|
|
75
|
+
export const renderInputView = ({ input, data, t }) => {
|
|
76
|
+
switch (input.type) {
|
|
77
|
+
case INPUT_TYPES.IMAGE_UPLOAD:
|
|
78
|
+
const value = data[input.key];
|
|
79
|
+
console.log('IMAGE_UPLOAD - Key:', input.key, 'Value from backend:', value, 'Full data:', data);
|
|
80
|
+
let fileList = getImageUploadViewValue(value);
|
|
81
|
+
|
|
82
|
+
return fileList.length ? (
|
|
83
|
+
<div className="image-container">
|
|
84
|
+
{fileList.filter(f => f.url).map((v, i) => (
|
|
85
|
+
<Image
|
|
86
|
+
key={i}
|
|
87
|
+
width={200}
|
|
88
|
+
src={v.url}
|
|
89
|
+
/>
|
|
90
|
+
))}
|
|
91
|
+
</div>
|
|
92
|
+
) : typeof value !== 'object' ? (
|
|
93
|
+
<div className="value">
|
|
94
|
+
{value || PLACEHOLDER}
|
|
95
|
+
</div>
|
|
96
|
+
) : (
|
|
97
|
+
<div className="value">
|
|
98
|
+
{PLACEHOLDER}
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
case INPUT_TYPES.SELECT:
|
|
102
|
+
const _v = (input.options || []).find((v) => v.value === data[input.key]);
|
|
103
|
+
|
|
104
|
+
if (_v) {
|
|
105
|
+
return (
|
|
106
|
+
<div className="value">
|
|
107
|
+
{_v.label || PLACEHOLDER}
|
|
108
|
+
</div>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<div className="value">
|
|
114
|
+
{PLACEHOLDER}
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
case INPUT_TYPES.SWITCH:
|
|
118
|
+
return (
|
|
119
|
+
<div className="value">
|
|
120
|
+
{t(!(data[input.key] || input.defaultChecked) ? 'Off' : 'On')}
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
case INPUT_TYPES.RESET_PASSWORD:
|
|
124
|
+
return (
|
|
125
|
+
<div className="value">
|
|
126
|
+
{data.passwordChangedAt ? renderDateFormatted(data.passwordChangedAt, "DD MMM YYYY"): '--'}
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
case INPUT_TYPES.TRANSFER_RIGHTS:
|
|
130
|
+
return (
|
|
131
|
+
<div className="value">
|
|
132
|
+
{data.companyEmail || PLACEHOLDER}
|
|
133
|
+
</div>
|
|
134
|
+
)
|
|
135
|
+
default:
|
|
136
|
+
return (
|
|
137
|
+
<div className="value">
|
|
138
|
+
{typeof data[input.key] === 'string' ? data[input.key] || PLACEHOLDER : PLACEHOLDER}
|
|
139
|
+
</div>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { renderInputView } from "./helper";
|
|
4
|
+
import { INPUT_TYPES } from "../../../config";
|
|
5
|
+
|
|
6
|
+
const INPUT_STYLE = { width: 'calc(50% - 10px)' };
|
|
7
|
+
|
|
8
|
+
export default function Content({
|
|
9
|
+
activeForm = {},
|
|
10
|
+
data = {},
|
|
11
|
+
t = (key) => key,
|
|
12
|
+
}) {
|
|
13
|
+
|
|
14
|
+
const renderInput = (input) => {
|
|
15
|
+
if (input.type === INPUT_TYPES.INPUT_GROUP) {
|
|
16
|
+
return (
|
|
17
|
+
<React.Fragment key={input.key}>
|
|
18
|
+
{(input.inputs || []).map(renderInput)}
|
|
19
|
+
</React.Fragment>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="input" style={INPUT_STYLE}>
|
|
25
|
+
<div className="label">
|
|
26
|
+
{t(input.label)}
|
|
27
|
+
</div>
|
|
28
|
+
{renderInputView({ input, data, t })}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className="content">
|
|
35
|
+
<div className="wrapper">
|
|
36
|
+
{(activeForm?.inputGroups || []).map((gr, i) => (
|
|
37
|
+
<div key={`gr-${i}`} className="group">
|
|
38
|
+
{gr.title ? (
|
|
39
|
+
<div className="title with-subtitle">
|
|
40
|
+
<h1>{t(gr.title)}</h1>
|
|
41
|
+
{gr.subTitle ? (
|
|
42
|
+
<p>{t(gr.subTitle)}</p>
|
|
43
|
+
) : null}
|
|
44
|
+
</div>
|
|
45
|
+
) : null}
|
|
46
|
+
{(gr.inputs || [])
|
|
47
|
+
.filter((i) => {
|
|
48
|
+
if (typeof i.showIf === 'function') {
|
|
49
|
+
return i.showIf(data);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return true;
|
|
53
|
+
})
|
|
54
|
+
.map(renderInput)}
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export default styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
justify-content: flex-start;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
|
|
10
|
+
.ant-menu {
|
|
11
|
+
min-width: 200px;
|
|
12
|
+
height: 100%;
|
|
13
|
+
|
|
14
|
+
.ant-menu-item{
|
|
15
|
+
padding-left: var(--size)!important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ant-menu-submenu {
|
|
19
|
+
.ant-menu-submenu-title {
|
|
20
|
+
padding-left: var(--size) !important;
|
|
21
|
+
}
|
|
22
|
+
.ant-menu.ant-menu-sub {
|
|
23
|
+
.ant-menu-item {
|
|
24
|
+
padding-left: 32px !important;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.view-content {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
position: relative;
|
|
35
|
+
width: 100%;
|
|
36
|
+
flex: 1;
|
|
37
|
+
overflow: auto;
|
|
38
|
+
|
|
39
|
+
.content {
|
|
40
|
+
width: 100%;
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
overflow-y: auto;
|
|
44
|
+
padding: 20px 20px 0 20px;
|
|
45
|
+
|
|
46
|
+
.title {
|
|
47
|
+
margin-bottom: 20px;
|
|
48
|
+
font-size: var(--size-lg);
|
|
49
|
+
|
|
50
|
+
&.with-subtitle {
|
|
51
|
+
margin-bottom: var(--size-lg) !important;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: baseline !important;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
|
|
56
|
+
h1 {
|
|
57
|
+
margin-bottom: 4px !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
p {
|
|
61
|
+
margin-bottom: 0px;
|
|
62
|
+
color: #667085;
|
|
63
|
+
font-size: 15px;
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.wrapper {
|
|
70
|
+
padding: 0;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: row;
|
|
73
|
+
flex-wrap: wrap;
|
|
74
|
+
|
|
75
|
+
.group, .group-extra {
|
|
76
|
+
width: 100%;
|
|
77
|
+
background: #fbfbfb;
|
|
78
|
+
border: 1px solid #f2f2f2;
|
|
79
|
+
padding: var(--size);
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
flex-wrap: wrap;
|
|
83
|
+
margin-bottom: 20px;
|
|
84
|
+
justify-content: space-between;
|
|
85
|
+
|
|
86
|
+
.title {
|
|
87
|
+
width: 100%;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
margin-bottom: var(--size);
|
|
91
|
+
|
|
92
|
+
h1 {
|
|
93
|
+
font-size: 20px;
|
|
94
|
+
color: #001529;
|
|
95
|
+
margin-bottom: 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.input {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
justify-content: space-between;
|
|
103
|
+
width: calc(50% - 10px);
|
|
104
|
+
border-bottom: 1px solid #e4e8ed;
|
|
105
|
+
margin-bottom: var(--size);
|
|
106
|
+
margin-top: auto !important;
|
|
107
|
+
|
|
108
|
+
.label {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.label, .value {
|
|
114
|
+
font-size: 14px;
|
|
115
|
+
color: #828282;
|
|
116
|
+
line-height: 22px;
|
|
117
|
+
margin: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.value {
|
|
121
|
+
color: #001529;
|
|
122
|
+
font-weight: 400;
|
|
123
|
+
margin-bottom: var(--size);
|
|
124
|
+
margin-top: 8px;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.input.checkboxGroup {
|
|
129
|
+
margin-top: 12px !important;
|
|
130
|
+
.opt {
|
|
131
|
+
display: flex;
|
|
132
|
+
justify-content: space-between;
|
|
133
|
+
align-items: center;
|
|
134
|
+
padding: 6px 0;
|
|
135
|
+
color: rgba(0, 0, 0, 0.78);
|
|
136
|
+
&:not(:last-of-type) {
|
|
137
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.input.last {
|
|
143
|
+
margin: 0;
|
|
144
|
+
border: none;
|
|
145
|
+
.value {
|
|
146
|
+
margin: 0;
|
|
147
|
+
margin-top: 8px;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.group {
|
|
153
|
+
&.display, &.repeatable {
|
|
154
|
+
padding-bottom: var(--size);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.group.repeatable, .group-extra.repeatable {
|
|
159
|
+
justify-content: flex-start;
|
|
160
|
+
.repeatable-row {
|
|
161
|
+
width: 100%;
|
|
162
|
+
display: flex;
|
|
163
|
+
background: white;
|
|
164
|
+
button {
|
|
165
|
+
border-radius: 8px;
|
|
166
|
+
span[role="img"] {
|
|
167
|
+
font-size: 12px;
|
|
168
|
+
svg {
|
|
169
|
+
margin-top: -5px;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
&.open {
|
|
174
|
+
color: var(--mmt-primary-70) !important;
|
|
175
|
+
background: #e6f7ff !important;
|
|
176
|
+
border-color: #91d5ff !important;
|
|
177
|
+
.input {
|
|
178
|
+
color: var(--mmt-primary-70) !important;
|
|
179
|
+
background: #e6f7ff !important;
|
|
180
|
+
border-color: #91d5ff !important;
|
|
181
|
+
.value {
|
|
182
|
+
color: var(--mmt-primary-70) !important;
|
|
183
|
+
background: #e6f7ff !important;
|
|
184
|
+
border: none;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
.input {
|
|
190
|
+
margin-right: 0 !important;
|
|
191
|
+
margin: 0;
|
|
192
|
+
border-bottom: none;
|
|
193
|
+
.label {
|
|
194
|
+
display: flex;
|
|
195
|
+
align-items: center;
|
|
196
|
+
padding: 0px 8px 12px;
|
|
197
|
+
border-bottom: 1px solid #e4e8ed;
|
|
198
|
+
min-height: 35px;
|
|
199
|
+
}
|
|
200
|
+
.value {
|
|
201
|
+
padding: 12px 8px;
|
|
202
|
+
background: white;
|
|
203
|
+
border-bottom: 1px solid #e4e8ed;
|
|
204
|
+
min-height: 48px;
|
|
205
|
+
margin-bottom: 0;
|
|
206
|
+
margin-top: 0;
|
|
207
|
+
}
|
|
208
|
+
&.first-col{
|
|
209
|
+
.value {
|
|
210
|
+
padding-left: 14px;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
.input.action {
|
|
215
|
+
.value {
|
|
216
|
+
text-align: center;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
.no-data {
|
|
220
|
+
padding: 12px;
|
|
221
|
+
background: white;
|
|
222
|
+
width: 100%;
|
|
223
|
+
text-align: center;
|
|
224
|
+
margin-bottom: 0 !important;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.group.repeatable {
|
|
229
|
+
.input {
|
|
230
|
+
.label {
|
|
231
|
+
display: flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
height: 100%;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
.repetable-row-extra {
|
|
237
|
+
width: 100%;
|
|
238
|
+
display: flex;
|
|
239
|
+
flex-wrap: wrap;
|
|
240
|
+
padding: var(--size) 0;
|
|
241
|
+
background: #fbfbfb;
|
|
242
|
+
overflow: hidden;
|
|
243
|
+
transition: all 300ms ease;
|
|
244
|
+
.input {
|
|
245
|
+
display: flex !important;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
justify-content: space-between;
|
|
248
|
+
border-bottom: 1px solid #e4e8ed;
|
|
249
|
+
margin-bottom: var(--size);
|
|
250
|
+
}
|
|
251
|
+
.label, .value {
|
|
252
|
+
font-size: 14px;
|
|
253
|
+
color: #828282;
|
|
254
|
+
line-height: 22px;
|
|
255
|
+
margin: 0;
|
|
256
|
+
border-bottom: none;
|
|
257
|
+
padding-right: var(--size);
|
|
258
|
+
padding-bottom: 0px;
|
|
259
|
+
}
|
|
260
|
+
.value {
|
|
261
|
+
color: #001529;
|
|
262
|
+
font-weight: 400;
|
|
263
|
+
margin-bottom: var(--size);
|
|
264
|
+
background: none;
|
|
265
|
+
border-bottom: none;
|
|
266
|
+
padding: 0 8px;
|
|
267
|
+
min-height: unset;
|
|
268
|
+
}
|
|
269
|
+
.input.last {
|
|
270
|
+
margin: 0;
|
|
271
|
+
border: none;
|
|
272
|
+
.value {
|
|
273
|
+
margin: 0;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.group.display {
|
|
281
|
+
flex-wrap: wrap;
|
|
282
|
+
.title {
|
|
283
|
+
margin-bottom: 0;
|
|
284
|
+
}
|
|
285
|
+
.group {
|
|
286
|
+
width: calc(100% / 2 - 8px);
|
|
287
|
+
background: white;
|
|
288
|
+
margin-bottom: 0;
|
|
289
|
+
margin-top: var(--size);
|
|
290
|
+
.title {
|
|
291
|
+
margin-bottom: var(--size);
|
|
292
|
+
h1 {
|
|
293
|
+
font-size: var(--font-size-lg);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.section-tabs {
|
|
301
|
+
.ant-tabs-bar.ant-tabs-top-bar {
|
|
302
|
+
display: flex;
|
|
303
|
+
justify-content: center;
|
|
304
|
+
border-bottom: none;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.anticon {
|
|
310
|
+
vertical-align: 0;
|
|
311
|
+
margin-right: 0px;
|
|
312
|
+
margin-top: 4px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.image-container{
|
|
316
|
+
display: flex;
|
|
317
|
+
flex-direction: row;
|
|
318
|
+
flex-wrap: wrap;
|
|
319
|
+
vertical-align: middle;
|
|
320
|
+
.ant-image{
|
|
321
|
+
border: 1px solid rgb(204, 204, 204);
|
|
322
|
+
margin-right: 10px;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
@media (min-width: 768px){
|
|
327
|
+
.group.col-md-6.col-sm-12.ml-2,
|
|
328
|
+
.group.col-md-6.col-sm-12.mr-2 {
|
|
329
|
+
flex: 0 0 calc(50% - 0.75rem);
|
|
330
|
+
max-width: calc(50% - 0.75rem);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
b {
|
|
335
|
+
color: #001529;
|
|
336
|
+
}
|
|
337
|
+
`;
|
|
338
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/components/Settings/View/index.js
|
|
2
|
+
import Style from "./components/Content/style";
|
|
3
|
+
import Content from "./components/Content";
|
|
4
|
+
|
|
5
|
+
export default function SettingsView({
|
|
6
|
+
sections,
|
|
7
|
+
activeForm,
|
|
8
|
+
activeFormKey,
|
|
9
|
+
data,
|
|
10
|
+
permissions,
|
|
11
|
+
goToEdit,
|
|
12
|
+
goToView,
|
|
13
|
+
changeSection,
|
|
14
|
+
customComponents,
|
|
15
|
+
renderHeader,
|
|
16
|
+
renderMenu,
|
|
17
|
+
children,
|
|
18
|
+
t,
|
|
19
|
+
}) {
|
|
20
|
+
return (
|
|
21
|
+
<Style>
|
|
22
|
+
{renderHeader ? renderHeader({
|
|
23
|
+
type: "view",
|
|
24
|
+
permissions,
|
|
25
|
+
goToEdit,
|
|
26
|
+
goToView,
|
|
27
|
+
t,
|
|
28
|
+
}) : null}
|
|
29
|
+
<div className="view-content">
|
|
30
|
+
{renderMenu ? renderMenu({
|
|
31
|
+
view: "view",
|
|
32
|
+
form: sections,
|
|
33
|
+
activeFormKey,
|
|
34
|
+
changeSection,
|
|
35
|
+
}) : null}
|
|
36
|
+
<Content
|
|
37
|
+
t={t}
|
|
38
|
+
activeForm={activeForm}
|
|
39
|
+
data={data}
|
|
40
|
+
customComponents={customComponents}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
{children}
|
|
44
|
+
</Style>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import DAFHeader from "../../../../Header/index.jsx";
|
|
3
|
+
import { useForms } from "../../../../../context/Forms";
|
|
4
|
+
import React, { useMemo } from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default function SettingsHeader({
|
|
8
|
+
type = "edit",
|
|
9
|
+
changed = false,
|
|
10
|
+
onSave = () => {},
|
|
11
|
+
goToEdit = () => {},
|
|
12
|
+
goToView = () => {},
|
|
13
|
+
t = (key) => key,
|
|
14
|
+
}) {
|
|
15
|
+
const { changeNotificationState } = useForms();
|
|
16
|
+
|
|
17
|
+
const breadCrumbs = useMemo(
|
|
18
|
+
() => [
|
|
19
|
+
{
|
|
20
|
+
name: t("Settings"),
|
|
21
|
+
onClick: () => goToView(),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
[ goToView],
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const extra = () => {
|
|
28
|
+
if (type === "edit") {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
disabled: !changed,
|
|
32
|
+
onClick: () => onSave(true),
|
|
33
|
+
tooltip: t("Save"),
|
|
34
|
+
icon: "Save",
|
|
35
|
+
type: "primary",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
onClick: () => {
|
|
39
|
+
changeNotificationState({ onYes: () => goToView() });
|
|
40
|
+
},
|
|
41
|
+
icon: "Close",
|
|
42
|
+
tooltip: t("Cancel"),
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
onClick: () => goToEdit(),
|
|
50
|
+
icon: t("Edit"),
|
|
51
|
+
type: "primary",
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<DAFHeader
|
|
58
|
+
breadcrumbs={breadCrumbs}
|
|
59
|
+
title={t("Settings")}
|
|
60
|
+
actionButtons={extra()}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import { Menu } from "antd";
|
|
3
|
+
import React, { useMemo } from "react";
|
|
4
|
+
|
|
5
|
+
export default function FormMenu({ view = "view", form = {}, activeFormKey, changeSection, t }) {
|
|
6
|
+
|
|
7
|
+
const values = useMemo(
|
|
8
|
+
() =>
|
|
9
|
+
Object.keys(form)
|
|
10
|
+
.sort((a, b) => form[a].position - form[b].position)
|
|
11
|
+
.map((key) => ({
|
|
12
|
+
value: key,
|
|
13
|
+
label: form[key].label,
|
|
14
|
+
})),
|
|
15
|
+
[form],
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Menu
|
|
20
|
+
mode="inline"
|
|
21
|
+
defaultSelectedKeys={[activeFormKey]}
|
|
22
|
+
selectedKeys={[activeFormKey]}
|
|
23
|
+
style={{ overflowY: "auto", overflowX: "hidden" }}
|
|
24
|
+
onSelect={(group) => {
|
|
25
|
+
if (changeSection) {
|
|
26
|
+
changeSection(group.key);
|
|
27
|
+
}
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
{values.map((v) => (
|
|
31
|
+
<Menu.Item key={v.value}>{(v.label)}</Menu.Item>
|
|
32
|
+
))}
|
|
33
|
+
</Menu>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Settings Configuration Constants and Helpers
|
|
2
|
+
export const ACTIVE_FORM_KEY = 'activeForm';
|
|
3
|
+
export const PLACEHOLDER = '--';
|
|
4
|
+
|
|
5
|
+
export const INPUT_TYPES = {
|
|
6
|
+
TEXT: 'text',
|
|
7
|
+
SWITCH: 'switch',
|
|
8
|
+
SELECT: 'select',
|
|
9
|
+
PHONE: 'phone',
|
|
10
|
+
INPUT_GROUP: 'inputGroup',
|
|
11
|
+
RESET_PASSWORD: 'resetPassword',
|
|
12
|
+
IMAGE_UPLOAD: 'imageUpload',
|
|
13
|
+
TRANSFER_RIGHTS: 'transferRights',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const getDefaultActiveForm = (query, sections, defaultSection = 'user') => {
|
|
17
|
+
if (query && query.get(ACTIVE_FORM_KEY)) {
|
|
18
|
+
const v = query.get(ACTIVE_FORM_KEY);
|
|
19
|
+
return Object.keys(sections).includes(v) ? v : defaultSection;
|
|
20
|
+
}
|
|
21
|
+
return defaultSection;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
ACTIVE_FORM_KEY,
|
|
26
|
+
PLACEHOLDER,
|
|
27
|
+
INPUT_TYPES,
|
|
28
|
+
getDefaultActiveForm,
|
|
29
|
+
};
|
|
30
|
+
|