@visns-studio/visns-components 4.7.1 → 4.7.3
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 +13 -9
- package/src/components/cms/DataGrid.jsx +1461 -0
- package/src/components/cms/DropZone.jsx +349 -0
- package/src/components/cms/Field.jsx +802 -0
- package/src/components/cms/Form.jsx +476 -0
- package/src/components/cms/generic/CmsDetail.jsx +36 -0
- package/src/components/cms/generic/CmsIndex.jsx +73 -0
- package/src/components/cms/generic/CmsSort.jsx +125 -0
- package/src/components/cms/sorting/Item.jsx +115 -0
- package/src/components/cms/sorting/List.jsx +30 -0
- package/src/components/crm/AsyncSelect.jsx +125 -0
- package/src/components/crm/Autocomplete.jsx +174 -0
- package/src/components/crm/Breadcrumb.jsx +52 -0
- package/src/components/crm/Call.jsx +220 -0
- package/src/components/crm/DataGrid.jsx +2701 -0
- package/src/components/crm/Download.jsx +101 -0
- package/src/components/crm/Fetch.jsx +119 -0
- package/src/components/crm/Field.jsx +1557 -0
- package/src/components/crm/Form.jsx +1409 -0
- package/src/components/crm/Loader.jsx +29 -0
- package/src/components/crm/MultiSelect.jsx +78 -0
- package/src/components/crm/Navigation.jsx +619 -0
- package/src/components/crm/Notification.jsx +197 -0
- package/src/components/crm/QrCode.jsx +83 -0
- package/src/components/crm/Select.jsx +58 -0
- package/src/components/crm/SelectList.jsx +21 -0
- package/src/components/crm/TableFilter.jsx +198 -0
- package/src/components/crm/auth/Login.jsx +223 -0
- package/src/components/crm/auth/Profile.jsx +280 -0
- package/src/components/crm/auth/Reset.jsx +111 -0
- package/src/components/crm/auth/Verify.jsx +174 -0
- package/src/components/crm/auth/styles/Login.module.scss +243 -0
- package/src/components/crm/auth/styles/Profile.module.scss +222 -0
- package/src/components/crm/auth/styles/Reset.module.scss +216 -0
- package/src/components/crm/auth/styles/Verify.module.scss +216 -0
- package/src/components/crm/generic/AuditLog.jsx +108 -0
- package/src/components/crm/generic/AuditLogs.jsx +115 -0
- package/src/components/crm/generic/GenericAuth.jsx +166 -0
- package/src/components/crm/generic/GenericDashboard.jsx +42 -0
- package/src/components/crm/generic/GenericDetail.jsx +1499 -0
- package/src/components/crm/generic/GenericDynamic.jsx +915 -0
- package/src/components/crm/generic/GenericFormBuilder.jsx +1765 -0
- package/src/components/crm/generic/GenericIndex.jsx +376 -0
- package/src/components/crm/generic/GenericMain.jsx +129 -0
- package/src/components/crm/generic/GenericSort.jsx +188 -0
- package/src/components/crm/generic/NotificationList.jsx +64 -0
- package/src/components/crm/generic/styles/AuditLog.module.scss +147 -0
- package/src/components/crm/generic/styles/AuditLogs.module.scss +92 -0
- package/src/components/crm/generic/styles/GenericDetail.module.scss +634 -0
- package/src/components/crm/generic/styles/GenericDynamic.module.scss +932 -0
- package/src/components/crm/generic/styles/GenericFormBuilder.module.scss +944 -0
- package/src/components/crm/generic/styles/GenericIndex.module.scss +247 -0
- package/src/components/crm/generic/styles/GenericMain.module.scss +91 -0
- package/src/components/crm/generic/styles/GenericSort.module.scss +123 -0
- package/src/components/crm/generic/styles/NotificationList.module.scss +67 -0
- package/src/components/crm/sorting/Item.jsx +117 -0
- package/src/components/crm/sorting/List.jsx +32 -0
- package/src/components/crm/sorting/styles/Item.module.scss +68 -0
- package/src/components/crm/sorting/styles/List.module.scss +68 -0
- package/src/components/crm/styles/AsyncSelect.module.scss +8 -0
- package/src/components/crm/styles/Autocomplete.module.scss +44 -0
- package/src/components/crm/styles/DataGrid.module.scss +210 -0
- package/src/components/crm/styles/Field.module.scss +311 -0
- package/src/components/crm/styles/Form.module.scss +499 -0
- package/src/components/crm/styles/Loader.module.scss +94 -0
- package/src/components/crm/styles/MultiSelect.module.scss +8 -0
- package/src/components/crm/styles/Navigation.module.scss +978 -0
- package/src/components/crm/styles/Notification.module.scss +147 -0
- package/src/components/crm/styles/QrCode.module.scss +87 -0
- package/src/components/crm/styles/TableFilter.module.scss +52 -0
- package/src/components/styles/global.css +73 -0
- package/src/index.js +86 -0
- package/dist/104e5636d8ddb791614c.woff2 +0 -0
- package/dist/11fe6a83d647de5daf95.woff +0 -0
- package/dist/141e2a8c7836495afe2a.woff +0 -0
- package/dist/2ba5877f7079830b5383.woff +0 -0
- package/dist/2d6836f45b2037be41f3.woff +0 -0
- package/dist/399.0a0f3e0d21be1057d599.css +0 -8
- package/dist/399.b8f57fa3f8c0c10119e4.js +0 -1
- package/dist/47d566c3b1293dfd9d77.woff +0 -0
- package/dist/6282a13cbba671a71913.woff2 +0 -0
- package/dist/78266f551031aa9db127.woff +0 -0
- package/dist/7b7da89f1e3fdcbfe36c.woff2 +0 -0
- package/dist/7e78e8338af7efeda712.woff2 +0 -0
- package/dist/7fa387951673abf164b1.woff2 +0 -0
- package/dist/819d59862c2d0640aad8.woff +0 -0
- package/dist/b615e1a6c838ea059a56.woff +0 -0
- package/dist/b9b1aa739c660c4ce67c.woff2 +0 -0
- package/dist/c5f3640b11df9414facb.woff +0 -0
- package/dist/da26d162ff5af71d6590.woff2 +0 -0
- package/dist/dd5b2912dbf896310865.woff2 +0 -0
- package/dist/f282b331272463c1aa6c.woff2 +0 -0
- package/dist/main.83b033670d64419bb497.css +0 -1
- package/dist/main.b1723d17cd2d3513ab62.js +0 -1
- package/dist/report.html +0 -39
- package/dist/runtime.33c276593b23f8035b8d.js +0 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import '../../styles/global.css';
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { Link, useLocation } from 'react-router-dom';
|
|
5
|
+
import Reveal from 'react-reveal/Reveal';
|
|
6
|
+
import { toast } from 'react-toastify';
|
|
7
|
+
import { Person, LockOff } from 'akar-icons';
|
|
8
|
+
|
|
9
|
+
import CustomFetch from '../Fetch';
|
|
10
|
+
|
|
11
|
+
import styles from './styles/Login.module.scss';
|
|
12
|
+
|
|
13
|
+
const Login = ({ logo, providers, setSystemAuth, setUserProfile }) => {
|
|
14
|
+
const location = useLocation();
|
|
15
|
+
|
|
16
|
+
const [auth, setAuth] = useState({
|
|
17
|
+
email: '',
|
|
18
|
+
password: '',
|
|
19
|
+
location: location,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const [authClass, setAuthClass] = useState({
|
|
23
|
+
username: '',
|
|
24
|
+
password: '',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const renderSsoButton = () => {
|
|
28
|
+
let content =
|
|
29
|
+
providers && providers.length > 0 ? (
|
|
30
|
+
<div className="formItem fwItem lastItem forgotten">
|
|
31
|
+
<span>OR</span>
|
|
32
|
+
</div>
|
|
33
|
+
) : null;
|
|
34
|
+
|
|
35
|
+
if (providers) {
|
|
36
|
+
providers.forEach((provider) => {
|
|
37
|
+
switch (provider) {
|
|
38
|
+
case 'azure':
|
|
39
|
+
content = (
|
|
40
|
+
<>
|
|
41
|
+
{content}
|
|
42
|
+
<div
|
|
43
|
+
className={`${styles.formItem} ${styles.fwItem} ${styles.lastItem} ${styles.forgotten}`}
|
|
44
|
+
>
|
|
45
|
+
<button
|
|
46
|
+
className={styles.btn}
|
|
47
|
+
onClick={(e) => {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
|
|
50
|
+
window.location.href =
|
|
51
|
+
'/auth/azure';
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<img
|
|
55
|
+
src={
|
|
56
|
+
'https://d16lktya8ojp5z.cloudfront.net/generic/images/microsoft.png'
|
|
57
|
+
}
|
|
58
|
+
width="13px"
|
|
59
|
+
height="13px"
|
|
60
|
+
/>{' '}
|
|
61
|
+
Microsoft
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return content;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const handleChange = (e) => {
|
|
75
|
+
if (e) {
|
|
76
|
+
setAuth((prevState) => ({
|
|
77
|
+
...prevState,
|
|
78
|
+
[e.target.name]: e.target.value,
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const handleSubmit = (e) => {
|
|
84
|
+
if (e) {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
|
|
87
|
+
CustomFetch(
|
|
88
|
+
'/login/authenticate',
|
|
89
|
+
'POST',
|
|
90
|
+
{
|
|
91
|
+
...auth,
|
|
92
|
+
location:
|
|
93
|
+
location.state && location.state.previousUrl
|
|
94
|
+
? location.state.previousUrl
|
|
95
|
+
: '',
|
|
96
|
+
},
|
|
97
|
+
(result) => {
|
|
98
|
+
if (result.error === '') {
|
|
99
|
+
setUserProfile(result.user);
|
|
100
|
+
|
|
101
|
+
if (result.previous && result.previous !== '') {
|
|
102
|
+
window.location.href = result.previous;
|
|
103
|
+
} else {
|
|
104
|
+
setSystemAuth(true);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
setSystemAuth(false);
|
|
108
|
+
setAuthClass((prevState) => ({
|
|
109
|
+
...prevState,
|
|
110
|
+
username: 'inputError',
|
|
111
|
+
password: 'inputError',
|
|
112
|
+
}));
|
|
113
|
+
|
|
114
|
+
toast.error(
|
|
115
|
+
'Could not log in with the supplied credentials, please try again.'
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
(error) => {
|
|
120
|
+
setAuthClass((prevState) => ({
|
|
121
|
+
...prevState,
|
|
122
|
+
username: 'inputError',
|
|
123
|
+
password: 'inputError',
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
if (String(error) === 'CSRF token mismatch.') {
|
|
127
|
+
toast.error(
|
|
128
|
+
'Auth token has timed out, please reload the page before attempting to log back in.'
|
|
129
|
+
);
|
|
130
|
+
} else {
|
|
131
|
+
toast.error(String(error));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<div className={styles.lcontainer}>
|
|
140
|
+
<div className={styles.lwrap}>
|
|
141
|
+
<div className={styles.logincontainer}>
|
|
142
|
+
<form onSubmit={handleSubmit}>
|
|
143
|
+
<Reveal effect="fadeInUp">
|
|
144
|
+
<div className={styles.login}>
|
|
145
|
+
<img
|
|
146
|
+
src={logo}
|
|
147
|
+
alt="CRM"
|
|
148
|
+
className={styles.loginlogo}
|
|
149
|
+
/>
|
|
150
|
+
<div
|
|
151
|
+
className={`${styles.formItem} ${styles.fwItem}`}
|
|
152
|
+
>
|
|
153
|
+
<label className={styles.fi__label}>
|
|
154
|
+
<input
|
|
155
|
+
type="text"
|
|
156
|
+
name="email"
|
|
157
|
+
value={auth.email}
|
|
158
|
+
onChange={handleChange}
|
|
159
|
+
tabIndex="1"
|
|
160
|
+
className={authClass.username}
|
|
161
|
+
placeholder=" "
|
|
162
|
+
/>
|
|
163
|
+
<span className={styles.fi__span}>
|
|
164
|
+
Email
|
|
165
|
+
</span>
|
|
166
|
+
<small>
|
|
167
|
+
<Person strokeWidth={2} size={18} />
|
|
168
|
+
</small>
|
|
169
|
+
</label>
|
|
170
|
+
</div>
|
|
171
|
+
<div
|
|
172
|
+
className={`${styles.formItem} ${styles.fwItem}`}
|
|
173
|
+
>
|
|
174
|
+
<label className={styles.fi__label}>
|
|
175
|
+
<input
|
|
176
|
+
type="password"
|
|
177
|
+
name="password"
|
|
178
|
+
value={auth.password}
|
|
179
|
+
onChange={handleChange}
|
|
180
|
+
tabIndex="2"
|
|
181
|
+
className={authClass.password}
|
|
182
|
+
placeholder=" "
|
|
183
|
+
/>
|
|
184
|
+
<span className={styles.fi__span}>
|
|
185
|
+
Password
|
|
186
|
+
</span>
|
|
187
|
+
<small>
|
|
188
|
+
<LockOff
|
|
189
|
+
strokeWidth={2}
|
|
190
|
+
size={18}
|
|
191
|
+
/>
|
|
192
|
+
</small>
|
|
193
|
+
</label>
|
|
194
|
+
</div>
|
|
195
|
+
<div
|
|
196
|
+
className={`${styles.formItem} ${styles.fwItem} ${styles.lastItem}`}
|
|
197
|
+
>
|
|
198
|
+
<button
|
|
199
|
+
className={styles.btn}
|
|
200
|
+
type="submit"
|
|
201
|
+
>
|
|
202
|
+
Login
|
|
203
|
+
</button>
|
|
204
|
+
</div>
|
|
205
|
+
<div
|
|
206
|
+
className={`${styles.formItem} ${styles.fwItem} ${styles.lastItem} ${styles.forgotten}`}
|
|
207
|
+
>
|
|
208
|
+
<span>
|
|
209
|
+
Forgot your password?{' '}
|
|
210
|
+
<Link to="/reset">Click Here</Link>
|
|
211
|
+
</span>
|
|
212
|
+
</div>
|
|
213
|
+
{renderSsoButton()}
|
|
214
|
+
</div>
|
|
215
|
+
</Reveal>
|
|
216
|
+
</form>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export default Login;
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
// src/components/Profile.jsx
|
|
2
|
+
import '../../styles/global.css';
|
|
3
|
+
|
|
4
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
5
|
+
import PasswordStrengthBar from 'react-password-strength-bar';
|
|
6
|
+
import { toast } from 'react-toastify';
|
|
7
|
+
import SignaturePad from 'react-signature-pad-wrapper';
|
|
8
|
+
import CustomFetch from '../Fetch';
|
|
9
|
+
import TableFilter from '../TableFilter';
|
|
10
|
+
import styles from './styles/Profile.module.scss';
|
|
11
|
+
|
|
12
|
+
const Profile = ({ userProfile, setUserProfile }) => {
|
|
13
|
+
const signatureRef = useRef(null);
|
|
14
|
+
const [profile, setProfile] = useState({
|
|
15
|
+
name: '',
|
|
16
|
+
email: '',
|
|
17
|
+
password: '',
|
|
18
|
+
password_confirmation: '',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const [inputClasses, setInputClasses] = useState({
|
|
22
|
+
name: '',
|
|
23
|
+
email: '',
|
|
24
|
+
password: '',
|
|
25
|
+
password_confirmation: '',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const [filters, setFilters] = useState([
|
|
29
|
+
{
|
|
30
|
+
id: 'overview',
|
|
31
|
+
show: true,
|
|
32
|
+
label: 'Overview',
|
|
33
|
+
class: 'subactive',
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
const handleClearSignature = (e) => {
|
|
38
|
+
if (e) {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
signatureRef.current.clear();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const handleChangeProfile = (e) => {
|
|
45
|
+
const { name, value } = e.target;
|
|
46
|
+
setProfile((prevProfile) => ({
|
|
47
|
+
...prevProfile,
|
|
48
|
+
[name]: value,
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const handleSubmitProfile = async (e) => {
|
|
53
|
+
try {
|
|
54
|
+
if (e) {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Validate required fields
|
|
59
|
+
if (profile.name.trim() === '' || profile.email.trim() === '') {
|
|
60
|
+
setInputClasses({
|
|
61
|
+
name: profile.name.trim() === '' ? styles.inputError : '',
|
|
62
|
+
email: profile.email.trim() === '' ? styles.inputError : '',
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
toast.error('Please fill in all the required fields.');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Validate password and confirmation
|
|
70
|
+
if (
|
|
71
|
+
profile.password &&
|
|
72
|
+
profile.password !== profile.password_confirmation
|
|
73
|
+
) {
|
|
74
|
+
setInputClasses({
|
|
75
|
+
...inputClasses,
|
|
76
|
+
password: styles.inputError,
|
|
77
|
+
password_confirmation: styles.inputError,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
toast.error('Passwords do not match.');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Create a new payload object
|
|
85
|
+
let payload = {
|
|
86
|
+
name: profile.name,
|
|
87
|
+
email: profile.email,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Conditionally add password to payload if it has a value
|
|
91
|
+
if (profile.password.trim() !== '') {
|
|
92
|
+
payload.password = profile.password;
|
|
93
|
+
payload.password_confirmation = profile.password_confirmation;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
payload.signature = signatureRef.current.toDataURL();
|
|
97
|
+
|
|
98
|
+
const res = await CustomFetch(
|
|
99
|
+
`/ajax/users/${userProfile.id}`,
|
|
100
|
+
'PUT',
|
|
101
|
+
payload
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
setUserProfile((prevState) => ({
|
|
105
|
+
...prevState,
|
|
106
|
+
name: res.data.user.name,
|
|
107
|
+
signature: res.data.user.signature,
|
|
108
|
+
}));
|
|
109
|
+
toast.success('Your profile has been successfully updated.');
|
|
110
|
+
} catch (err) {
|
|
111
|
+
console.log(err);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const renderContent = (filter) => {
|
|
116
|
+
if (filter.show && filter.id === 'overview') {
|
|
117
|
+
return (
|
|
118
|
+
<div className={styles.gridtxt} key={filter.id}>
|
|
119
|
+
<div className={styles.gridtxt__header}>
|
|
120
|
+
<span>Overview</span>
|
|
121
|
+
</div>
|
|
122
|
+
<div className={styles.formcontainer}>
|
|
123
|
+
<form
|
|
124
|
+
className={styles.modalForm}
|
|
125
|
+
onSubmit={handleSubmitProfile}
|
|
126
|
+
>
|
|
127
|
+
<div className={styles.formItem}>
|
|
128
|
+
<label className={styles.fi__label}>
|
|
129
|
+
<input
|
|
130
|
+
type="text"
|
|
131
|
+
name="name"
|
|
132
|
+
onChange={handleChangeProfile}
|
|
133
|
+
className={`${styles.input} ${inputClasses.name}`}
|
|
134
|
+
value={profile.name}
|
|
135
|
+
/>
|
|
136
|
+
<span className={styles.fi__span}>
|
|
137
|
+
Name *
|
|
138
|
+
</span>
|
|
139
|
+
</label>
|
|
140
|
+
</div>
|
|
141
|
+
<div className={styles.formItem}>
|
|
142
|
+
<label className={styles.fi__label}>
|
|
143
|
+
<input
|
|
144
|
+
type="text"
|
|
145
|
+
name="email"
|
|
146
|
+
readOnly
|
|
147
|
+
className={`${styles.input} ${inputClasses.email}`}
|
|
148
|
+
value={profile.email}
|
|
149
|
+
/>
|
|
150
|
+
<span className={styles.fi__span}>
|
|
151
|
+
Email *
|
|
152
|
+
</span>
|
|
153
|
+
</label>
|
|
154
|
+
</div>
|
|
155
|
+
<div className={styles.formItem}>
|
|
156
|
+
<label className={styles.fi__label}>
|
|
157
|
+
<span
|
|
158
|
+
className={`${styles.fi__span} ${styles.prefocus}`}
|
|
159
|
+
>
|
|
160
|
+
Password
|
|
161
|
+
</span>
|
|
162
|
+
<input
|
|
163
|
+
type="password"
|
|
164
|
+
name="password"
|
|
165
|
+
onChange={handleChangeProfile}
|
|
166
|
+
value={profile.password}
|
|
167
|
+
className={`${styles.input} ${inputClasses.password}`}
|
|
168
|
+
/>
|
|
169
|
+
<PasswordStrengthBar
|
|
170
|
+
password={profile.password}
|
|
171
|
+
/>
|
|
172
|
+
</label>
|
|
173
|
+
</div>
|
|
174
|
+
<div className={styles.formItem}>
|
|
175
|
+
<label className={styles.fi__label}>
|
|
176
|
+
<span
|
|
177
|
+
className={`${styles.fi__span} ${styles.prefocus}`}
|
|
178
|
+
>
|
|
179
|
+
Password Confirmation
|
|
180
|
+
</span>
|
|
181
|
+
<input
|
|
182
|
+
type="password"
|
|
183
|
+
name="password_confirmation"
|
|
184
|
+
onChange={handleChangeProfile}
|
|
185
|
+
value={profile.password_confirmation}
|
|
186
|
+
className={`${styles.input} ${inputClasses.password_confirmation}`}
|
|
187
|
+
/>
|
|
188
|
+
</label>
|
|
189
|
+
</div>
|
|
190
|
+
<div className={styles.formItem}>
|
|
191
|
+
<label className={styles.fi__label}>
|
|
192
|
+
<SignaturePad
|
|
193
|
+
ref={signatureRef}
|
|
194
|
+
height={200}
|
|
195
|
+
options={{
|
|
196
|
+
penColor: 'black',
|
|
197
|
+
}}
|
|
198
|
+
redrawOnResize
|
|
199
|
+
canvasProps={{
|
|
200
|
+
style: {
|
|
201
|
+
border: '2px solid #ccc',
|
|
202
|
+
borderRadius: '10px',
|
|
203
|
+
padding: '10px',
|
|
204
|
+
},
|
|
205
|
+
className: styles.sigcanvas,
|
|
206
|
+
}}
|
|
207
|
+
/>
|
|
208
|
+
<span className={styles.fi__span}>
|
|
209
|
+
Signature
|
|
210
|
+
</span>
|
|
211
|
+
</label>
|
|
212
|
+
</div>
|
|
213
|
+
</form>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<div className={styles.polActions}>
|
|
217
|
+
<button
|
|
218
|
+
className={styles.btn}
|
|
219
|
+
onClick={handleSubmitProfile}
|
|
220
|
+
>
|
|
221
|
+
Save
|
|
222
|
+
</button>
|
|
223
|
+
<button
|
|
224
|
+
className={styles.btn}
|
|
225
|
+
onClick={handleClearSignature}
|
|
226
|
+
>
|
|
227
|
+
Clear
|
|
228
|
+
</button>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
return null;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
useEffect(() => {
|
|
237
|
+
setProfile((prevState) => ({
|
|
238
|
+
...prevState,
|
|
239
|
+
name: userProfile.name,
|
|
240
|
+
email: userProfile.email,
|
|
241
|
+
password: '',
|
|
242
|
+
password_confirmation: '',
|
|
243
|
+
}));
|
|
244
|
+
|
|
245
|
+
if (userProfile.signature) {
|
|
246
|
+
signatureRef.current.fromDataURL(userProfile.signature);
|
|
247
|
+
}
|
|
248
|
+
}, [userProfile]);
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
<div>
|
|
252
|
+
<div className={styles.grid}>
|
|
253
|
+
<div className={styles.grid__row}>
|
|
254
|
+
<div className={`${styles.grid__full} ${styles.crmtitle}`}>
|
|
255
|
+
<h1>My Profile</h1>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
<div className={styles.grid}>
|
|
260
|
+
<div className={styles.grid__subrow}>
|
|
261
|
+
<div className={styles.grid__subnav}>
|
|
262
|
+
<TableFilter
|
|
263
|
+
filters={filters}
|
|
264
|
+
setFilters={setFilters}
|
|
265
|
+
/>
|
|
266
|
+
</div>
|
|
267
|
+
<div className={styles.grid__subcontent}>
|
|
268
|
+
{filters.map((filter) => (
|
|
269
|
+
<React.Fragment key={`filter-${filter.id}`}>
|
|
270
|
+
{renderContent(filter)}
|
|
271
|
+
</React.Fragment>
|
|
272
|
+
))}
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export default Profile;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import '../../styles/global.css';
|
|
2
|
+
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import Reveal from 'react-reveal/Reveal';
|
|
5
|
+
import { toast } from 'react-toastify';
|
|
6
|
+
import parse from 'html-react-parser';
|
|
7
|
+
import { Person } from 'akar-icons';
|
|
8
|
+
|
|
9
|
+
import CustomFetch from '../Fetch';
|
|
10
|
+
|
|
11
|
+
import styles from './styles/Reset.module.scss';
|
|
12
|
+
|
|
13
|
+
const Reset = ({ logo }) => {
|
|
14
|
+
const [email, setEmail] = useState('');
|
|
15
|
+
const [emailClass, setEmailClass] = useState('');
|
|
16
|
+
|
|
17
|
+
const handleSubmit = (e) => {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
|
|
20
|
+
if (email === '') {
|
|
21
|
+
const error = 'Please type in your email address.';
|
|
22
|
+
setEmailClass('inputError');
|
|
23
|
+
toast.error(<div>{parse(error)}</div>);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
CustomFetch(
|
|
28
|
+
'/password/forgot',
|
|
29
|
+
'POST',
|
|
30
|
+
{ email: email },
|
|
31
|
+
function (result) {
|
|
32
|
+
if (result.error === '') {
|
|
33
|
+
setEmail('');
|
|
34
|
+
toast.success(
|
|
35
|
+
'You have successfully requested to reset your password, an email will be sent shortly. Please follow the instruction on the email.'
|
|
36
|
+
);
|
|
37
|
+
} else {
|
|
38
|
+
toast.error(result.error);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className={styles.lcontainer}>
|
|
46
|
+
<div className={styles.lwrap}>
|
|
47
|
+
<aside
|
|
48
|
+
className={styles.aside}
|
|
49
|
+
style={{
|
|
50
|
+
backgroundImage: `url(${loginBg})`,
|
|
51
|
+
backgroundSize: 'cover',
|
|
52
|
+
}}
|
|
53
|
+
></aside>
|
|
54
|
+
<div className={styles.logincontainer}>
|
|
55
|
+
<form onSubmit={handleSubmit}>
|
|
56
|
+
<Reveal effect="fadeInUp">
|
|
57
|
+
<div className={styles.login}>
|
|
58
|
+
<img
|
|
59
|
+
src={logo}
|
|
60
|
+
alt="CRM"
|
|
61
|
+
className={styles.loginlogo}
|
|
62
|
+
/>
|
|
63
|
+
<div
|
|
64
|
+
className={`${styles.formItem} ${styles.fwItem}`}
|
|
65
|
+
>
|
|
66
|
+
<h1>Forgot your password?</h1>
|
|
67
|
+
</div>
|
|
68
|
+
<div
|
|
69
|
+
className={`${styles.formItem} ${styles.fwItem}`}
|
|
70
|
+
>
|
|
71
|
+
<label className={styles.fi__label}>
|
|
72
|
+
<input
|
|
73
|
+
type="email"
|
|
74
|
+
name="email"
|
|
75
|
+
value={email}
|
|
76
|
+
onChange={(e) => {
|
|
77
|
+
setEmail(e.target.value);
|
|
78
|
+
setEmailClass('');
|
|
79
|
+
}}
|
|
80
|
+
tabIndex="1"
|
|
81
|
+
className={emailClass}
|
|
82
|
+
/>
|
|
83
|
+
<span className={styles.fi__span}>
|
|
84
|
+
Email
|
|
85
|
+
</span>
|
|
86
|
+
<small>
|
|
87
|
+
<Person strokeWidth={2} size={18} />
|
|
88
|
+
</small>
|
|
89
|
+
</label>
|
|
90
|
+
</div>
|
|
91
|
+
<div
|
|
92
|
+
className={`${styles.formItem} ${styles.fwItem} ${styles.lastItem}`}
|
|
93
|
+
>
|
|
94
|
+
<button
|
|
95
|
+
className={styles.btn}
|
|
96
|
+
type="submit"
|
|
97
|
+
tabIndex="2"
|
|
98
|
+
>
|
|
99
|
+
Reset Password
|
|
100
|
+
</button>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</Reveal>
|
|
104
|
+
</form>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default Reset;
|