@visns-studio/visns-components 4.7.2 → 4.7.4
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 +15 -14
- 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 +1637 -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 +916 -0
- package/src/components/crm/generic/GenericFormBuilder.jsx +1909 -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/index.css +0 -2902
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -150
- 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,166 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
useNavigate,
|
|
4
|
+
useLocation,
|
|
5
|
+
Routes,
|
|
6
|
+
Route,
|
|
7
|
+
Navigate,
|
|
8
|
+
Outlet,
|
|
9
|
+
} from 'react-router-dom';
|
|
10
|
+
import { ToastContainer } from 'react-toastify';
|
|
11
|
+
import { Tooltip } from 'react-tooltip';
|
|
12
|
+
import 'react-tooltip/dist/react-tooltip.css';
|
|
13
|
+
import 'react-toastify/dist/ReactToastify.css';
|
|
14
|
+
|
|
15
|
+
import CustomFetch from '../Fetch';
|
|
16
|
+
import GenericMain from './GenericMain';
|
|
17
|
+
import Login from '../auth/Login';
|
|
18
|
+
import Reset from '../auth/Reset';
|
|
19
|
+
import Verify from '../auth/Verify';
|
|
20
|
+
|
|
21
|
+
const ProtectedRoute = ({ user, loading, redirectPath = '/login' }) => {
|
|
22
|
+
const location = useLocation();
|
|
23
|
+
|
|
24
|
+
return loading ? null : !user || !user.id ? (
|
|
25
|
+
<Navigate
|
|
26
|
+
to={redirectPath}
|
|
27
|
+
replace
|
|
28
|
+
state={{ previousUrl: location.pathname }}
|
|
29
|
+
/>
|
|
30
|
+
) : (
|
|
31
|
+
<Outlet />
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const GenericAuth = ({
|
|
36
|
+
layout = 'full',
|
|
37
|
+
loginBg,
|
|
38
|
+
logo,
|
|
39
|
+
headerLogo,
|
|
40
|
+
providers,
|
|
41
|
+
navigation,
|
|
42
|
+
routeConfig,
|
|
43
|
+
themeType = 'primary',
|
|
44
|
+
}) => {
|
|
45
|
+
const navigate = useNavigate();
|
|
46
|
+
const location = useLocation();
|
|
47
|
+
const [userProfile, setUserProfile] = useState({});
|
|
48
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
49
|
+
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
|
50
|
+
|
|
51
|
+
const updateAuthStatus = async () => {
|
|
52
|
+
try {
|
|
53
|
+
const { data } = await CustomFetch('/ajax/user/profile', 'GET');
|
|
54
|
+
setUserProfile(data);
|
|
55
|
+
setIsAuthenticated(true);
|
|
56
|
+
setIsLoading(false);
|
|
57
|
+
|
|
58
|
+
if (location.pathname.split('/')[1] === 'login') {
|
|
59
|
+
navigate('/', { replace: true });
|
|
60
|
+
}
|
|
61
|
+
} catch (error) {
|
|
62
|
+
setIsLoading(false);
|
|
63
|
+
if (['Unauthenticatdata.'].includes(error)) {
|
|
64
|
+
const currentUrl = window.location.pathname;
|
|
65
|
+
|
|
66
|
+
setIsAuthenticated(false);
|
|
67
|
+
navigate('/login', { state: { previousUrl: currentUrl } });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
updateAuthStatus();
|
|
74
|
+
}, [isAuthenticated]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<>
|
|
78
|
+
<Routes>
|
|
79
|
+
<Route
|
|
80
|
+
path="login"
|
|
81
|
+
element={
|
|
82
|
+
<LoginComponent
|
|
83
|
+
loginBg={loginBg}
|
|
84
|
+
logo={logo}
|
|
85
|
+
providers={providers}
|
|
86
|
+
setIsAuthenticated={setIsAuthenticated}
|
|
87
|
+
setUserProfile={setUserProfile}
|
|
88
|
+
/>
|
|
89
|
+
}
|
|
90
|
+
/>
|
|
91
|
+
<Route
|
|
92
|
+
path="reset"
|
|
93
|
+
element={
|
|
94
|
+
<ResetComponent
|
|
95
|
+
loginBg={loginBg}
|
|
96
|
+
logo={logo}
|
|
97
|
+
setIsAuthenticated={setIsAuthenticated}
|
|
98
|
+
/>
|
|
99
|
+
}
|
|
100
|
+
/>
|
|
101
|
+
<Route
|
|
102
|
+
path="verify/:code"
|
|
103
|
+
element={
|
|
104
|
+
<VerifyComponent
|
|
105
|
+
loginBg={loginBg}
|
|
106
|
+
logo={logo}
|
|
107
|
+
setIsAuthenticated={setIsAuthenticated}
|
|
108
|
+
/>
|
|
109
|
+
}
|
|
110
|
+
/>
|
|
111
|
+
<Route
|
|
112
|
+
element={
|
|
113
|
+
<ProtectedRoute
|
|
114
|
+
user={userProfile}
|
|
115
|
+
loading={isLoading}
|
|
116
|
+
/>
|
|
117
|
+
}
|
|
118
|
+
>
|
|
119
|
+
<Route
|
|
120
|
+
path="/*"
|
|
121
|
+
element={
|
|
122
|
+
<GenericMain
|
|
123
|
+
layout={layout}
|
|
124
|
+
logo={headerLogo}
|
|
125
|
+
navigation={navigation}
|
|
126
|
+
routeConfig={routeConfig}
|
|
127
|
+
setUserProfile={setUserProfile}
|
|
128
|
+
setSystemAuth={setIsAuthenticated}
|
|
129
|
+
themeType={themeType}
|
|
130
|
+
userProfile={userProfile}
|
|
131
|
+
/>
|
|
132
|
+
}
|
|
133
|
+
/>
|
|
134
|
+
</Route>
|
|
135
|
+
</Routes>
|
|
136
|
+
<ToastContainer
|
|
137
|
+
theme="light"
|
|
138
|
+
position="bottom-center"
|
|
139
|
+
style={{ width: '600px' }}
|
|
140
|
+
/>
|
|
141
|
+
<Tooltip id="system-tooltip" />
|
|
142
|
+
</>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const LoginComponent = React.memo(
|
|
147
|
+
({ loginBg, logo, providers, setIsAuthenticated, setUserProfile }) => (
|
|
148
|
+
<Login
|
|
149
|
+
loginBg={loginBg}
|
|
150
|
+
logo={logo}
|
|
151
|
+
providers={providers}
|
|
152
|
+
setSystemAuth={setIsAuthenticated}
|
|
153
|
+
setUserProfile={setUserProfile}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const ResetComponent = React.memo(({ loginBg, logo, setIsAuthenticated }) => (
|
|
159
|
+
<Reset loginBg={loginBg} logo={logo} setSystemAuth={setIsAuthenticated} />
|
|
160
|
+
));
|
|
161
|
+
|
|
162
|
+
const VerifyComponent = React.memo(({ loginBg, logo, setIsAuthenticated }) => (
|
|
163
|
+
<Verify loginBg={loginBg} logo={logo} setSystemAuth={setIsAuthenticated} />
|
|
164
|
+
));
|
|
165
|
+
|
|
166
|
+
export default GenericAuth;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { toast } from 'react-toastify';
|
|
3
|
+
import CustomFetch from '../../crm/Fetch';
|
|
4
|
+
|
|
5
|
+
const GenericDashboard = ({ userProfile }) => {
|
|
6
|
+
const [data, setData] = useState([]);
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div className="grid">
|
|
10
|
+
<div className="grid__row">
|
|
11
|
+
<div className="grid__three dashtopwidge">
|
|
12
|
+
<div className="dashtopwidge__left">
|
|
13
|
+
<h2>
|
|
14
|
+
Current
|
|
15
|
+
<span>
|
|
16
|
+
<strong>Enquiries</strong>
|
|
17
|
+
</span>
|
|
18
|
+
</h2>
|
|
19
|
+
</div>
|
|
20
|
+
<div className="dashtopwidge__right">
|
|
21
|
+
<span>0</span>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div className="grid__three dashtopwidge">
|
|
25
|
+
<div className="dashtopwidge__left">
|
|
26
|
+
<h2>
|
|
27
|
+
Current{' '}
|
|
28
|
+
<span>
|
|
29
|
+
<strong>Enquiries</strong>
|
|
30
|
+
</span>
|
|
31
|
+
</h2>
|
|
32
|
+
</div>
|
|
33
|
+
<div className="dashtopwidge__right">
|
|
34
|
+
<span>0</span>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default GenericDashboard;
|