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
package/package.json
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import { Form } from "antd";
|
|
3
|
+
import Style from "./style";
|
|
4
|
+
import { INPUT_TYPES } from "../../../config";
|
|
5
|
+
import Text from "../Inputs/Text";
|
|
6
|
+
import Phone from "../Inputs/Phone";
|
|
7
|
+
import Select from "../Inputs/Select";
|
|
8
|
+
import Switch from "../Inputs/Switch";
|
|
9
|
+
import ResetPassword from "../Inputs/ResetPassword";
|
|
10
|
+
import ImageUpload from "../Inputs/ImageUpload.js";
|
|
11
|
+
|
|
12
|
+
export default function EditForm({
|
|
13
|
+
activeForm = {},
|
|
14
|
+
onChange = () => {},
|
|
15
|
+
data = {},
|
|
16
|
+
setInputLoading = () => { },
|
|
17
|
+
inputLoading,
|
|
18
|
+
t = (key) => key,
|
|
19
|
+
apiURL,
|
|
20
|
+
getAppHeader,
|
|
21
|
+
getToken
|
|
22
|
+
}) {
|
|
23
|
+
|
|
24
|
+
const config = {
|
|
25
|
+
setLoading: setInputLoading,
|
|
26
|
+
loading: inputLoading,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const renderInput = (input = {}) => {
|
|
30
|
+
if (input.type === INPUT_TYPES.RESET_PASSWORD) {
|
|
31
|
+
if (input.disabled) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return <ResetPassword config={config} key={input.key} t={t} />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (input.type === INPUT_TYPES.SWITCH) {
|
|
39
|
+
return (
|
|
40
|
+
<Form.Item key={input.key}>
|
|
41
|
+
<Switch data={data} input={input} onChange={onChange} t={t} />
|
|
42
|
+
</Form.Item>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (input.type === INPUT_TYPES.INPUT_GROUP) {
|
|
47
|
+
return (
|
|
48
|
+
<div className="input-group" key={input.key}>
|
|
49
|
+
{(input.inputs).map(renderInput)}
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const _renderInput = () => {
|
|
55
|
+
switch (input.type) {
|
|
56
|
+
case INPUT_TYPES.IMAGE_UPLOAD:
|
|
57
|
+
return <ImageUpload
|
|
58
|
+
data={data}
|
|
59
|
+
input={input}
|
|
60
|
+
onChange={onChange}
|
|
61
|
+
getToken={getToken}
|
|
62
|
+
config={config}
|
|
63
|
+
t={t}
|
|
64
|
+
apiURL={apiURL}
|
|
65
|
+
getAppHeader={ getAppHeader }
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/>;
|
|
69
|
+
case INPUT_TYPES.TEXT:
|
|
70
|
+
return <Text data={data} input={input} onChange={onChange} t={t} />;
|
|
71
|
+
case INPUT_TYPES.SELECT:
|
|
72
|
+
return <Select data={data} input={input} onChange={onChange} t={t} />;
|
|
73
|
+
case INPUT_TYPES.PHONE:
|
|
74
|
+
return <Phone data={data} input={input} onChange={onChange} t={t} />;
|
|
75
|
+
default:
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Form.Item label={input.label} key={input.key}>{_renderInput()}</Form.Item>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Form
|
|
87
|
+
autoComplete="new-password"
|
|
88
|
+
layout="vertical"
|
|
89
|
+
className="main-form"
|
|
90
|
+
>
|
|
91
|
+
<Style>
|
|
92
|
+
{(activeForm?.inputGroups || []).map((gr, i) => (
|
|
93
|
+
<div key={`form-gr-${i}`} className="form-gr">
|
|
94
|
+
<div className="group-header">
|
|
95
|
+
{gr.title ? (
|
|
96
|
+
<h3>{t(gr.title)}</h3>
|
|
97
|
+
) : null}
|
|
98
|
+
<p>{t(gr.subTitle)}</p>
|
|
99
|
+
</div>
|
|
100
|
+
{(gr.inputs || [])
|
|
101
|
+
.filter((i) => {
|
|
102
|
+
if (typeof i.showIf === 'function') {
|
|
103
|
+
return i.showIf(data);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return true;
|
|
107
|
+
})
|
|
108
|
+
.map(renderInput)}
|
|
109
|
+
</div>
|
|
110
|
+
))}
|
|
111
|
+
</Style>
|
|
112
|
+
</Form>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export default styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 34px;
|
|
7
|
+
padding-bottom: 34px;
|
|
8
|
+
|
|
9
|
+
.group-header {
|
|
10
|
+
border-bottom: 1px solid #E5E7EB;
|
|
11
|
+
margin-bottom: var(--size-lg);
|
|
12
|
+
|
|
13
|
+
h3 {
|
|
14
|
+
font-size: 20px;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
margin-bottom: 4px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
p {
|
|
20
|
+
color: #667085;
|
|
21
|
+
margin-bottom: var(--size-lg);
|
|
22
|
+
font-weight: 500;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.input-group {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: 8px;
|
|
29
|
+
|
|
30
|
+
.ant-form-item {
|
|
31
|
+
flex: 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Upload } from "antd";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { InboxOutlined } from "@ant-design/icons";
|
|
6
|
+
import { getImageUploadViewValue } from "../../../../../../components/ViewForm/helper.js";
|
|
7
|
+
|
|
8
|
+
const Style = styled.div`
|
|
9
|
+
flex: 1;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export default function ImageUpload({
|
|
13
|
+
data = {},
|
|
14
|
+
input = {},
|
|
15
|
+
onChange = () => { },
|
|
16
|
+
config,
|
|
17
|
+
t = (key) => key,
|
|
18
|
+
apiURL,
|
|
19
|
+
getToken,
|
|
20
|
+
getAppHeader
|
|
21
|
+
}) {
|
|
22
|
+
const value = data[input.key];
|
|
23
|
+
console.log('ImageUpload EDIT - Key:', input.key, 'Value:', value, 'Full data:', data);
|
|
24
|
+
const values = getImageUploadViewValue(value)
|
|
25
|
+
|
|
26
|
+
// Build headers with defensive checks
|
|
27
|
+
const headers = {
|
|
28
|
+
Authorization: `Bearer ${typeof getToken === 'function' ? getToken() : ''}`,
|
|
29
|
+
...(typeof getAppHeader === 'function' ? getAppHeader() : {}),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Style>
|
|
34
|
+
<Upload.Dragger
|
|
35
|
+
accept="image/*"
|
|
36
|
+
disabled={input.disabled}
|
|
37
|
+
classList={!values || !values.length ? 'empty' : ''}
|
|
38
|
+
action={`${apiURL}/upload`}
|
|
39
|
+
maxCount={1}
|
|
40
|
+
headers={headers}
|
|
41
|
+
defaultFileList={values}
|
|
42
|
+
style={{ width: '100%' }}
|
|
43
|
+
onChange={(e) => {
|
|
44
|
+
onChange({ [input.key]: e });
|
|
45
|
+
if (e.file && e.file.status && typeof config?.setLoading === 'function') {
|
|
46
|
+
if (e.file.status === 'uploading') {
|
|
47
|
+
config.setLoading(true);
|
|
48
|
+
} else {
|
|
49
|
+
config.setLoading(false);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<div style={{ width: '100%' }}>
|
|
55
|
+
<p className="ant-upload-drag-icon">
|
|
56
|
+
<InboxOutlined />
|
|
57
|
+
</p>
|
|
58
|
+
<p className="ant-upload-text">{t('Click or drag file to this area to upload')}</p>
|
|
59
|
+
<p className="ant-upload-hint">
|
|
60
|
+
{t('Support for a single or bulk upload.')}
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
</Upload.Dragger>
|
|
64
|
+
</Style>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PhoneInput from "../../../../../../components/Inputs/PhoneInput/index";
|
|
4
|
+
|
|
5
|
+
export default function Phone({ data = {}, input = {}, onChange = () => { }, t = (key) => key }) {
|
|
6
|
+
return (
|
|
7
|
+
<PhoneInput
|
|
8
|
+
disabled={input.disabled}
|
|
9
|
+
defaultDialCode={data[input.key]}
|
|
10
|
+
initialValue={data[input.key]}
|
|
11
|
+
onChange={(v) => {
|
|
12
|
+
if (!data[v] && !v) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
onChange({ [input.key]: v });
|
|
16
|
+
}}
|
|
17
|
+
allowClear
|
|
18
|
+
country={null}
|
|
19
|
+
size="large"
|
|
20
|
+
t={t}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { Button, Form, Input, message } from "antd";
|
|
5
|
+
|
|
6
|
+
const Style = styled.div`
|
|
7
|
+
.form-footer {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
gap: 8px;
|
|
11
|
+
margin-top: 28px;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export default function ResetPassword({
|
|
16
|
+
config = {},
|
|
17
|
+
onPasswordChange,
|
|
18
|
+
t = (key) => key
|
|
19
|
+
}) {
|
|
20
|
+
const [MainForm] = Form.useForm();
|
|
21
|
+
|
|
22
|
+
const _resetForm = () =>
|
|
23
|
+
MainForm.resetFields(['confirmPassword', 'password', 'currentPassword']);
|
|
24
|
+
|
|
25
|
+
const _submit = () => {
|
|
26
|
+
MainForm.validateFields()
|
|
27
|
+
.then(async (v) => {
|
|
28
|
+
try {
|
|
29
|
+
config?.setLoading(true);
|
|
30
|
+
|
|
31
|
+
if (onPasswordChange) {
|
|
32
|
+
await onPasswordChange({
|
|
33
|
+
oldPassword: v.currentPassword,
|
|
34
|
+
newPassword: v.password,
|
|
35
|
+
plainPassword: v.confirmPassword,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
config?.setLoading(false);
|
|
40
|
+
message.success(t('Password successfully updated.'));
|
|
41
|
+
MainForm.resetFields();
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.log(err);
|
|
44
|
+
config?.setLoading(false);
|
|
45
|
+
message.error((err.message || 'Error changing password'));
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
.catch((err) => console.log(err));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Style>
|
|
53
|
+
<Form form={MainForm} layout="vertical">
|
|
54
|
+
<Form.Item
|
|
55
|
+
label={("Current password")}
|
|
56
|
+
name="currentPassword"
|
|
57
|
+
rules={[
|
|
58
|
+
{
|
|
59
|
+
required: true,
|
|
60
|
+
message: ("errors::password should not be empty"),
|
|
61
|
+
},
|
|
62
|
+
]}
|
|
63
|
+
>
|
|
64
|
+
<Input.Password
|
|
65
|
+
size="large"
|
|
66
|
+
placeholder={t("••••••••")}
|
|
67
|
+
type="password"
|
|
68
|
+
className="email" />
|
|
69
|
+
</Form.Item>
|
|
70
|
+
<Form.Item
|
|
71
|
+
label={t("New password")}
|
|
72
|
+
name="password"
|
|
73
|
+
rules={[
|
|
74
|
+
{
|
|
75
|
+
required: true,
|
|
76
|
+
message: ("errors::password should not be empty"),
|
|
77
|
+
},
|
|
78
|
+
]}
|
|
79
|
+
>
|
|
80
|
+
<Input.Password
|
|
81
|
+
size="large"
|
|
82
|
+
placeholder={t("••••••••")}
|
|
83
|
+
type="password"
|
|
84
|
+
className="email" />
|
|
85
|
+
</Form.Item>
|
|
86
|
+
<Form.Item
|
|
87
|
+
label={t("Confirm new password")}
|
|
88
|
+
name="confirmPassword"
|
|
89
|
+
dependencies={['password']}
|
|
90
|
+
rules={[
|
|
91
|
+
{
|
|
92
|
+
required: true,
|
|
93
|
+
message: ("errors::password should not be empty"),
|
|
94
|
+
},
|
|
95
|
+
({ getFieldValue }) => ({
|
|
96
|
+
validator(rule, value) {
|
|
97
|
+
if (!value || getFieldValue('password') === value) {
|
|
98
|
+
return Promise.resolve();
|
|
99
|
+
}
|
|
100
|
+
return Promise.reject(t('errors::passwordNotMatch'));
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
]}>
|
|
104
|
+
<Input.Password
|
|
105
|
+
size="large"
|
|
106
|
+
placeholder={("••••••••")}
|
|
107
|
+
type="password"
|
|
108
|
+
className="email" />
|
|
109
|
+
</Form.Item>
|
|
110
|
+
<div className="form-footer">
|
|
111
|
+
<Button onClick={_resetForm}>
|
|
112
|
+
{t('Cancel')}
|
|
113
|
+
</Button>
|
|
114
|
+
<Button type="primary" onClick={_submit} disabled={config?.loading} loading={config?.loading}>
|
|
115
|
+
{t('Update')}
|
|
116
|
+
</Button>
|
|
117
|
+
</div>
|
|
118
|
+
</Form>
|
|
119
|
+
</Style>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Select } from "antd";
|
|
3
|
+
import { renderInputBody } from "../helper";
|
|
4
|
+
|
|
5
|
+
export default function SelectInput({ data = {}, input = {}, onChange = () => { }, t = (key) => key }) {
|
|
6
|
+
const disabled = input.disabled;
|
|
7
|
+
|
|
8
|
+
const body = (
|
|
9
|
+
<Select
|
|
10
|
+
value={data[input.key]}
|
|
11
|
+
onChange={(e) => onChange({ [input.key]: e })}
|
|
12
|
+
size="large"
|
|
13
|
+
disabled={disabled}
|
|
14
|
+
placeholder={t(input.placeholder || input.label)}
|
|
15
|
+
>
|
|
16
|
+
{(input.options || []).map((o) => (
|
|
17
|
+
<Select.Option key={`${input.key}:${o.value}`} value={o.value}>
|
|
18
|
+
{t(o.label)}
|
|
19
|
+
</Select.Option>
|
|
20
|
+
))}
|
|
21
|
+
</Select>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return renderInputBody({ t, disabled, body });
|
|
25
|
+
}
|
|
26
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Switch } from "antd";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { renderInputBody } from "../helper";
|
|
6
|
+
|
|
7
|
+
const Style = styled.div`
|
|
8
|
+
width: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
gap: 32px;
|
|
11
|
+
|
|
12
|
+
.label-cont {
|
|
13
|
+
flex: 1;
|
|
14
|
+
|
|
15
|
+
h3 {
|
|
16
|
+
font-size: var(--font-size-lg);
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
margin-bottom: 4px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
p {
|
|
22
|
+
color: #6C737F;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export default function FormSwitch({ data = {}, input = {}, onChange = () => { }, t = (key) => key }) {
|
|
30
|
+
const disabled = input.disabled;
|
|
31
|
+
|
|
32
|
+
const body = (
|
|
33
|
+
<div className="flex flex-1 flex-column justify-content-center">
|
|
34
|
+
<Switch
|
|
35
|
+
disabled={input.disabled}
|
|
36
|
+
size="large"
|
|
37
|
+
checked={data[input.key]}
|
|
38
|
+
defaultChecked={input.defaultChecked}
|
|
39
|
+
placeholder={t(input.placeholder || input.label)}
|
|
40
|
+
onChange={(e) => onChange({ [input.key]: e })} />
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Style>
|
|
46
|
+
<div className="label-cont">
|
|
47
|
+
<h3>{t(input.label)}</h3>
|
|
48
|
+
<p>{t(input.subLabel)}</p>
|
|
49
|
+
</div>
|
|
50
|
+
<div className="flex flex-column justify-content-center">
|
|
51
|
+
{renderInputBody({ t, disabled, body })}
|
|
52
|
+
</div>
|
|
53
|
+
</Style>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Input } from "antd";
|
|
3
|
+
import { renderInputBody } from "../helper";
|
|
4
|
+
|
|
5
|
+
export default function Text({ data = {}, input = {}, onChange = () => { }, t = (key) => key }) {
|
|
6
|
+
const disabled = input.disabled;
|
|
7
|
+
|
|
8
|
+
const body = (
|
|
9
|
+
<Input
|
|
10
|
+
disabled={input.disabled}
|
|
11
|
+
size="large"
|
|
12
|
+
value={data[input.key]}
|
|
13
|
+
placeholder={t(input.placeholder || input.label)}
|
|
14
|
+
onChange={(e) => onChange({ [input.key]: e.target.value })} />
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return renderInputBody({ t, disabled, body });
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Form, Select, Tooltip } from "antd";
|
|
4
|
+
|
|
5
|
+
export default function TransferRights({ input = {}, t = (key) => key }) {
|
|
6
|
+
return (
|
|
7
|
+
<Form.Item
|
|
8
|
+
label={t("Transfer administrative rights")}
|
|
9
|
+
name={input.key}
|
|
10
|
+
rules={[
|
|
11
|
+
{
|
|
12
|
+
required: true,
|
|
13
|
+
message: t("errors::password should not be empty"),
|
|
14
|
+
},
|
|
15
|
+
]}
|
|
16
|
+
>
|
|
17
|
+
<Tooltip title={t('Feature Unavailable')}>
|
|
18
|
+
<div className="flex-1 flex flex-column">
|
|
19
|
+
<Select
|
|
20
|
+
disabled
|
|
21
|
+
placeholder={t('Select User')}
|
|
22
|
+
size="large"
|
|
23
|
+
type="password"
|
|
24
|
+
className="email" />
|
|
25
|
+
</div>
|
|
26
|
+
</Tooltip>
|
|
27
|
+
</Form.Item>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Tooltip } from "antd";
|
|
3
|
+
|
|
4
|
+
export const renderInputBody = ({ t = (key) => key, disabled, body }) => {
|
|
5
|
+
return disabled ? (
|
|
6
|
+
<Tooltip title={t("You can't edit this")}>
|
|
7
|
+
<div className="flex flex-1 flex-column">
|
|
8
|
+
{body}
|
|
9
|
+
</div>
|
|
10
|
+
</Tooltip>
|
|
11
|
+
) : body;
|
|
12
|
+
}
|
|
13
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
overflow: hidden;
|
|
10
|
+
|
|
11
|
+
.ant-menu {
|
|
12
|
+
min-width: 200px;
|
|
13
|
+
height: 100%;
|
|
14
|
+
|
|
15
|
+
.ant-menu-item {
|
|
16
|
+
padding-left: var(--size) !important;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.view-content {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
position: relative;
|
|
25
|
+
width: 100%;
|
|
26
|
+
flex: 1;
|
|
27
|
+
overflow: auto;
|
|
28
|
+
|
|
29
|
+
.form-edit {
|
|
30
|
+
width: 100%;
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
padding-top: var(--size-lg);
|
|
34
|
+
overflow: auto;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
padding: 20px 100px 0 100px;
|
|
37
|
+
|
|
38
|
+
.main-form {
|
|
39
|
+
min-width: 400px;
|
|
40
|
+
width: 100%;
|
|
41
|
+
max-width: 700px;
|
|
42
|
+
min-height: 100%;
|
|
43
|
+
margin: auto;
|
|
44
|
+
|
|
45
|
+
@media screen and (max-width: 1200px) {
|
|
46
|
+
min-width: 600px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media screen and (max-width: 768px) {
|
|
50
|
+
min-width: 100%;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/components/Settings/Edit/index.js
|
|
2
|
+
import Style from "./components/style";
|
|
3
|
+
import EditForm from "./components/Form";
|
|
4
|
+
import { getMainApiUrl, getAppHeader } from "../../../../../services/BaseService.js";
|
|
5
|
+
import { getToken } from "../../../../../../helpers/Token.js";
|
|
6
|
+
|
|
7
|
+
export default function SettingsEdit({
|
|
8
|
+
sections,
|
|
9
|
+
activeForm,
|
|
10
|
+
activeFormKey,
|
|
11
|
+
data,
|
|
12
|
+
isChanged,
|
|
13
|
+
onChange,
|
|
14
|
+
onSave,
|
|
15
|
+
onCancel,
|
|
16
|
+
setInputLoading,
|
|
17
|
+
inputLoading,
|
|
18
|
+
permissions,
|
|
19
|
+
changeSection,
|
|
20
|
+
goToView,
|
|
21
|
+
customComponents,
|
|
22
|
+
renderHeader,
|
|
23
|
+
renderMenu,
|
|
24
|
+
children,
|
|
25
|
+
t,
|
|
26
|
+
}) {
|
|
27
|
+
return (
|
|
28
|
+
<Style>
|
|
29
|
+
{renderHeader ? renderHeader({
|
|
30
|
+
type: "edit",
|
|
31
|
+
changed: isChanged,
|
|
32
|
+
permissions,
|
|
33
|
+
onSave,
|
|
34
|
+
onCancel,
|
|
35
|
+
goToView,
|
|
36
|
+
t,
|
|
37
|
+
}) : null}
|
|
38
|
+
<div className="view-content">
|
|
39
|
+
{renderMenu ? renderMenu({
|
|
40
|
+
view: "edit",
|
|
41
|
+
form: sections,
|
|
42
|
+
activeFormKey,
|
|
43
|
+
changeSection,
|
|
44
|
+
}) : null}
|
|
45
|
+
<div className="form-edit">
|
|
46
|
+
<EditForm
|
|
47
|
+
t={t}
|
|
48
|
+
activeForm={activeForm}
|
|
49
|
+
onChange={onChange}
|
|
50
|
+
setInputLoading={setInputLoading}
|
|
51
|
+
inputLoading={inputLoading}
|
|
52
|
+
data={data}
|
|
53
|
+
customComponents={customComponents}
|
|
54
|
+
apiURL={getMainApiUrl()}
|
|
55
|
+
getAppHeader={getAppHeader}
|
|
56
|
+
getToken={getToken}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
{children}
|
|
61
|
+
</Style>
|
|
62
|
+
);
|
|
63
|
+
}
|