ui-soxo-bootstrap-core 2.6.1-dev.1 → 2.6.1-dev.11
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/core/components/extra-info/extra-info-details.js +2 -2
- package/core/lib/Store.js +3 -3
- package/core/lib/components/global-header/global-header.js +2 -2
- package/core/lib/components/sidemenu/sidemenu.js +19 -13
- package/core/lib/elements/basic/country-phone-input/country-phone-input.js +14 -8
- package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +1 -1
- package/core/lib/elements/basic/menu-tree/menu-tree.js +26 -13
- package/core/lib/models/forms/components/form-creator/form-creator.scss +5 -4
- package/core/lib/models/menus/components/menu-list/menu-list.js +424 -467
- package/core/lib/pages/change-password/change-password.js +17 -24
- package/core/lib/pages/change-password/change-password.scss +45 -48
- package/core/lib/pages/login/commnication-mode-selection.js +46 -0
- package/core/lib/pages/login/communication-mode-selection.scss +60 -0
- package/core/lib/pages/login/login.js +126 -22
- package/core/lib/pages/login/login.scss +229 -334
- package/core/lib/pages/login/reset-password.js +124 -0
- package/core/lib/pages/login/reset-password.scss +31 -0
- package/core/lib/pages/profile/themes.json +4 -4
- package/core/lib/utils/api/api.utils.js +30 -18
- package/core/lib/utils/common/common.utils.js +85 -0
- package/core/lib/utils/http/http.utils.js +1 -0
- package/core/lib/utils/index.js +4 -1
- package/core/models/base/base.js +7 -3
- package/core/models/core-scripts/core-scripts.js +9 -0
- package/core/models/doctor/components/doctor-add/doctor-add.js +9 -4
- package/core/models/menus/components/menu-add/menu-add.js +1 -1
- package/core/models/menus/components/menu-lists/menu-lists.js +5 -9
- package/core/models/menus/menus.js +21 -2
- package/core/models/roles/components/role-add/role-add.js +92 -59
- package/core/models/roles/components/role-list/role-list.js +1 -1
- package/core/models/staff/components/staff-add/staff-add.js +20 -32
- package/core/models/users/components/assign-role/assign-role.js +145 -50
- package/core/models/users/components/assign-role/assign-role.scss +209 -45
- package/core/models/users/components/assign-role/avatar-props.js +45 -0
- package/core/models/users/components/user-add/user-add.js +46 -55
- package/core/models/users/components/user-add/user-edit.js +25 -4
- package/core/models/users/users.js +16 -1
- package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +1 -1
- package/core/modules/reporting/components/reporting-dashboard/README.md +316 -0
- package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.js +266 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +75 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +252 -0
- package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +126 -0
- package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +285 -399
- package/core/modules/steps/action-buttons.js +42 -44
- package/core/modules/steps/action-buttons.scss +35 -6
- package/core/modules/steps/steps.js +12 -10
- package/core/modules/steps/steps.scss +229 -31
- package/core/modules/steps/timeline.js +21 -19
- package/package.json +2 -1
|
@@ -1,25 +1,82 @@
|
|
|
1
1
|
.assign-role {
|
|
2
2
|
display: flex;
|
|
3
|
-
gap:
|
|
3
|
+
gap: 8px;
|
|
4
4
|
|
|
5
|
+
/* Checkbox Color Override */
|
|
6
|
+
.ant-checkbox-checked .ant-checkbox-inner {
|
|
7
|
+
background-color: rgb(68, 106, 169);
|
|
8
|
+
border-color: rgb(68, 106, 169);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.ant-checkbox:hover .ant-checkbox-inner,
|
|
12
|
+
.ant-checkbox-wrapper:hover .ant-checkbox-inner {
|
|
13
|
+
border-color: rgb(68, 106, 169);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ant-checkbox-checked::after {
|
|
17
|
+
border-color: rgb(68, 106, 169);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* TAKE FULL SCREEN HEIGHT */
|
|
21
|
+
height: calc(100vh - 80px);
|
|
22
|
+
min-height: 0;
|
|
23
|
+
|
|
24
|
+
.ant-card {
|
|
25
|
+
border-radius: 6px;
|
|
26
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
27
|
+
border: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* LEFT PANEL */
|
|
5
31
|
.left-panel {
|
|
6
|
-
width:
|
|
32
|
+
width: 360px;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
height: 100%;
|
|
36
|
+
min-height: 0;
|
|
7
37
|
|
|
38
|
+
/* User Card */
|
|
8
39
|
.user-card {
|
|
9
|
-
margin-bottom: 12px;
|
|
10
|
-
background: #fafafa;
|
|
11
|
-
border: none;
|
|
12
40
|
display: flex;
|
|
13
41
|
align-items: center;
|
|
14
42
|
gap: 12px;
|
|
15
|
-
padding:
|
|
43
|
+
padding: 14px;
|
|
44
|
+
|
|
45
|
+
background: #ffffff;
|
|
46
|
+
border-radius: 10px;
|
|
47
|
+
|
|
48
|
+
border: 1px solid #f0f0f0;
|
|
49
|
+
|
|
50
|
+
box-shadow:
|
|
51
|
+
0 2px 6px rgba(0, 0, 0, 0.06),
|
|
52
|
+
0 6px 16px rgba(0, 0, 0, 0.04);
|
|
53
|
+
|
|
54
|
+
margin-bottom: 16px;
|
|
55
|
+
|
|
56
|
+
transition: all 0.2s ease;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
box-shadow:
|
|
60
|
+
0 4px 10px rgba(0, 0, 0, 0.08),
|
|
61
|
+
0 10px 22px rgba(0, 0, 0, 0.06);
|
|
62
|
+
transform: translateY(-1px);
|
|
63
|
+
}
|
|
16
64
|
|
|
17
65
|
.user-info {
|
|
18
|
-
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
line-height: 1.2;
|
|
69
|
+
|
|
70
|
+
.name {
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
color: #1f1f1f;
|
|
74
|
+
}
|
|
19
75
|
|
|
20
76
|
.user-id {
|
|
21
77
|
font-size: 12px;
|
|
22
|
-
color:
|
|
78
|
+
color: #8c8c8c;
|
|
79
|
+
margin-top: 2px;
|
|
23
80
|
}
|
|
24
81
|
}
|
|
25
82
|
}
|
|
@@ -27,23 +84,86 @@
|
|
|
27
84
|
.role-list-header {
|
|
28
85
|
display: flex;
|
|
29
86
|
justify-content: space-between;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
87
|
+
align-items: center;
|
|
88
|
+
margin-bottom: 10px;
|
|
89
|
+
|
|
90
|
+
.count {
|
|
91
|
+
font-size: 12px;
|
|
92
|
+
color: #888;
|
|
33
93
|
}
|
|
34
94
|
}
|
|
35
95
|
|
|
96
|
+
.view-all-btn {
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
color: #1677ff;
|
|
99
|
+
font-weight: 500;
|
|
100
|
+
}
|
|
101
|
+
|
|
36
102
|
.role-search {
|
|
37
|
-
margin:
|
|
103
|
+
margin-bottom: 10px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.selected-summary {
|
|
107
|
+
font-size: 12px;
|
|
108
|
+
color: rgb(68, 106, 169);
|
|
109
|
+
margin-bottom: 10px;
|
|
110
|
+
font-weight: 500;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* SCROLL AREA */
|
|
114
|
+
.role-list-wrapper {
|
|
115
|
+
flex: 1;
|
|
116
|
+
overflow-y: auto;
|
|
117
|
+
min-height: 0;
|
|
118
|
+
padding-right: 4px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Scrollbar */
|
|
122
|
+
.role-list-wrapper,
|
|
123
|
+
.menus-content {
|
|
124
|
+
scrollbar-width: thin; /* Firefox */
|
|
125
|
+
scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
|
|
126
|
+
|
|
127
|
+
&::-webkit-scrollbar-thumb {
|
|
128
|
+
background: rgba(0, 0, 0, 0);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:hover::-webkit-scrollbar-thumb {
|
|
132
|
+
background: rgba(0, 0, 0, 0.25);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&::-webkit-scrollbar {
|
|
136
|
+
width: 6px;
|
|
137
|
+
height: 6px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&::-webkit-scrollbar-track {
|
|
141
|
+
background: transparent;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&::-webkit-scrollbar-thumb {
|
|
145
|
+
background: rgba(0, 0, 0, 0.25);
|
|
146
|
+
border-radius: 10px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
150
|
+
background: rgba(0, 0, 0, 0.4);
|
|
151
|
+
}
|
|
38
152
|
}
|
|
39
153
|
|
|
40
154
|
.role-item {
|
|
41
155
|
cursor: pointer;
|
|
42
156
|
border-radius: 6px;
|
|
43
|
-
padding:
|
|
157
|
+
padding: 10px 12px;
|
|
158
|
+
transition: 0.2s;
|
|
159
|
+
|
|
160
|
+
&:hover {
|
|
161
|
+
background: #f5f7fa;
|
|
162
|
+
}
|
|
44
163
|
|
|
45
164
|
&.active {
|
|
46
|
-
background: #
|
|
165
|
+
background: #e6f4ff;
|
|
166
|
+
// border-left: 3px solid rgb(68, 106, 169);
|
|
47
167
|
}
|
|
48
168
|
|
|
49
169
|
.ant-list-item-meta-title {
|
|
@@ -52,66 +172,110 @@
|
|
|
52
172
|
|
|
53
173
|
.ant-list-item-meta-description {
|
|
54
174
|
font-size: 12px;
|
|
55
|
-
color:
|
|
175
|
+
color: #777;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Skeleton Loader */
|
|
180
|
+
.role-skeleton {
|
|
181
|
+
display: flex;
|
|
182
|
+
flex-direction: column;
|
|
183
|
+
gap: 8px;
|
|
184
|
+
padding: 2px;
|
|
185
|
+
|
|
186
|
+
.role-skeleton-item {
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
gap: 12px;
|
|
190
|
+
padding: 10px 12px;
|
|
191
|
+
border-radius: 6px;
|
|
192
|
+
|
|
193
|
+
background: #fff;
|
|
194
|
+
border: 1px solid #f0f0f0;
|
|
195
|
+
|
|
196
|
+
.meta {
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-direction: column;
|
|
199
|
+
gap: 6px;
|
|
200
|
+
flex: 1;
|
|
201
|
+
}
|
|
56
202
|
}
|
|
57
203
|
}
|
|
58
204
|
}
|
|
59
205
|
|
|
206
|
+
/* RIGHT PANEL */
|
|
60
207
|
.right-panel {
|
|
61
208
|
flex: 1;
|
|
62
209
|
display: flex;
|
|
63
210
|
flex-direction: column;
|
|
64
|
-
|
|
65
|
-
|
|
211
|
+
height: 100%;
|
|
212
|
+
min-height: 0;
|
|
66
213
|
|
|
67
214
|
.menus-header {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
215
|
+
margin-bottom: 12px;
|
|
216
|
+
|
|
217
|
+
.title {
|
|
218
|
+
font-size: 16px;
|
|
219
|
+
font-weight: 600;
|
|
220
|
+
}
|
|
71
221
|
|
|
72
222
|
.sub-text {
|
|
73
223
|
font-size: 12px;
|
|
74
224
|
color: #888;
|
|
75
|
-
margin-top: 4px;
|
|
76
225
|
}
|
|
77
226
|
}
|
|
78
227
|
|
|
79
228
|
.menus-content {
|
|
80
|
-
|
|
229
|
+
flex: 1;
|
|
230
|
+
overflow-y: auto;
|
|
231
|
+
min-height: 0;
|
|
232
|
+
padding: 8px 4px;
|
|
233
|
+
scrollbar-width: thin; /* Firefox */
|
|
234
|
+
scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
|
|
235
|
+
|
|
236
|
+
&::-webkit-scrollbar {
|
|
237
|
+
width: 6px;
|
|
238
|
+
height: 6px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&::-webkit-scrollbar-track {
|
|
242
|
+
background: transparent;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
&::-webkit-scrollbar-thumb {
|
|
246
|
+
background: rgba(0, 0, 0, 0.25);
|
|
247
|
+
border-radius: 10px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
251
|
+
background: rgba(0, 0, 0, 0.4);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.empty-state {
|
|
256
|
+
height: 300px;
|
|
257
|
+
display: flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
justify-content: center;
|
|
81
260
|
}
|
|
82
261
|
|
|
83
262
|
.footer-actions {
|
|
84
|
-
margin-top: 16px;
|
|
85
263
|
display: flex;
|
|
86
264
|
justify-content: flex-end;
|
|
87
|
-
|
|
265
|
+
padding-top: 12px;
|
|
266
|
+
border-top: 1px solid #f0f0f0;
|
|
88
267
|
}
|
|
89
268
|
}
|
|
90
269
|
|
|
91
|
-
/*
|
|
92
|
-
📱 iPad Mini (481px – 768px)
|
|
93
|
-
=============================== */
|
|
270
|
+
/* TABLET / MOBILE */
|
|
94
271
|
@media (max-width: 768px) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
gap: 12px;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.assign-role .left-panel {
|
|
101
|
-
width: 100%;
|
|
102
|
-
}
|
|
272
|
+
flex-direction: column;
|
|
273
|
+
height: auto;
|
|
103
274
|
|
|
104
|
-
.
|
|
275
|
+
.left-panel,
|
|
276
|
+
.right-panel {
|
|
105
277
|
width: 100%;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/* Better spacing for tablets */
|
|
109
|
-
.assign-role .right-panel {
|
|
110
|
-
padding: 14px;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.assign-role .footer-actions {
|
|
114
|
-
justify-content: flex-end;
|
|
278
|
+
height: auto;
|
|
115
279
|
}
|
|
116
280
|
}
|
|
117
281
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const avatarColors = [
|
|
2
|
+
'#5B8FF9',
|
|
3
|
+
'#61DDAA',
|
|
4
|
+
'#65789B',
|
|
5
|
+
'#a0d911',
|
|
6
|
+
'#F6BD16',
|
|
7
|
+
'#7262FD',
|
|
8
|
+
'#faad14',
|
|
9
|
+
'#78D3F8',
|
|
10
|
+
'#9661BC',
|
|
11
|
+
'#F6903D',
|
|
12
|
+
'#008685',
|
|
13
|
+
'#F08BB4',
|
|
14
|
+
'#722ed1',
|
|
15
|
+
'#eb2f96',
|
|
16
|
+
'#13c2c2',
|
|
17
|
+
'#eb2f96',
|
|
18
|
+
'#fa8c16',
|
|
19
|
+
'#52c41a',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export const getAvatarProps = (name) => {
|
|
23
|
+
const safeName = (name ?? '').toString().trim();
|
|
24
|
+
|
|
25
|
+
// Find first alphabetic character
|
|
26
|
+
const match = safeName.match(/[A-Za-z]/);
|
|
27
|
+
const letter = match ? match[0].toUpperCase() : '-';
|
|
28
|
+
|
|
29
|
+
// deterministic color based on string
|
|
30
|
+
let hash = 0;
|
|
31
|
+
for (let i = 0; i < safeName.length; i++) {
|
|
32
|
+
hash = safeName.charCodeAt(i) + ((hash << 5) - hash);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const color = avatarColors[Math.abs(hash) % avatarColors.length] || '#999';
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
letter,
|
|
39
|
+
style: {
|
|
40
|
+
backgroundColor: color,
|
|
41
|
+
color: '#fff',
|
|
42
|
+
fontWeight: 600,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -6,7 +6,7 @@ import { Skeleton, Typography, message, Switch, Form, Input, Select, Checkbox, R
|
|
|
6
6
|
|
|
7
7
|
import AsyncSelect from 'react-select/async';
|
|
8
8
|
|
|
9
|
-
import { Table, Card, Button, JSONInput, GlobalContext, safeJSON } from './../../../../lib/';
|
|
9
|
+
import { Table, Card, Button, JSONInput, GlobalContext, safeJSON, CountryPhoneInput, phoneValidator } from './../../../../lib/';
|
|
10
10
|
|
|
11
11
|
import { ModelsAPI, PagesAPI, RolesAPI } from '../../..';
|
|
12
12
|
|
|
@@ -30,7 +30,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
30
30
|
const [selectedBranches, setSelectedBranches] = useState([]);
|
|
31
31
|
|
|
32
32
|
// for default branch
|
|
33
|
-
const [defaultBranch, setDefaultBranch] = useState(null);
|
|
33
|
+
// const [defaultBranch, setDefaultBranch] = useState(null);
|
|
34
34
|
//Need to check this condition
|
|
35
35
|
const [authentication, setAuthentication] = useState(false);
|
|
36
36
|
|
|
@@ -95,7 +95,10 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
95
95
|
const [body, setBody] = useState(formContent);
|
|
96
96
|
|
|
97
97
|
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
98
|
-
|
|
98
|
+
|
|
99
|
+
// state for doctor and staff visibility
|
|
100
|
+
const [doctorVisible, setDoctorVisible] = useState(false);
|
|
101
|
+
const [staffVisible, setStaffVisible] = useState(false);
|
|
99
102
|
|
|
100
103
|
const formData = {
|
|
101
104
|
...body,
|
|
@@ -270,8 +273,6 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
270
273
|
const getStaff = () => {
|
|
271
274
|
UsersAPI.getAllStaff()
|
|
272
275
|
.then((res) => {
|
|
273
|
-
console.log('Staff List Response:', res);
|
|
274
|
-
|
|
275
276
|
if (Array.isArray(res)) {
|
|
276
277
|
const list = res.map((staff) => ({
|
|
277
278
|
label: `${staff.shortName || 'No Name'} (${staff.id})`,
|
|
@@ -325,20 +326,25 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
325
326
|
}
|
|
326
327
|
if (!formContent) return;
|
|
327
328
|
|
|
328
|
-
// normalize branch ids to NUMBER
|
|
329
329
|
const org =
|
|
330
330
|
typeof formContent.organization_details === 'string' ? JSON.parse(formContent.organization_details) : formContent.organization_details;
|
|
331
331
|
|
|
332
|
+
// normalize branch ids to NUMBER
|
|
332
333
|
const branchIds = (org?.branch_ids || []).map(Number);
|
|
333
|
-
|
|
334
|
+
|
|
335
|
+
// find default branch pointer
|
|
336
|
+
const defaultBranchObj = org?.branch?.find((br) => br.defaultBranch);
|
|
337
|
+
|
|
338
|
+
// extract dbPtr (branch code)
|
|
339
|
+
const defaultBranchCode = defaultBranchObj?.branch_id ? Number(defaultBranchObj.branch_id) : undefined;
|
|
334
340
|
|
|
335
341
|
// state (for filtering)
|
|
336
342
|
setSelectedBranches(branchIds);
|
|
337
343
|
|
|
338
|
-
// form
|
|
344
|
+
// form values
|
|
339
345
|
form.setFieldsValue({
|
|
340
346
|
selectedBranches: branchIds,
|
|
341
|
-
defaultBranch:
|
|
347
|
+
defaultBranch: defaultBranchCode,
|
|
342
348
|
});
|
|
343
349
|
}, [formContent, form]);
|
|
344
350
|
// Generate branch options for Select component
|
|
@@ -351,6 +357,10 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
351
357
|
* Submit values
|
|
352
358
|
*/
|
|
353
359
|
const onSubmit = (values) => {
|
|
360
|
+
const mobileData = values.mobile;
|
|
361
|
+
|
|
362
|
+
const mobileWithCountryCode = `+${mobileData.code.dialCode}${mobileData.value}`;
|
|
363
|
+
|
|
354
364
|
values.defaultBranch = String(values.defaultBranch);
|
|
355
365
|
|
|
356
366
|
/**If PanelOpen is open and edit mode then password will be existing password else new password*/
|
|
@@ -372,6 +382,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
372
382
|
values = {
|
|
373
383
|
...values,
|
|
374
384
|
auth_type: 'LDAP',
|
|
385
|
+
mobile: mobileWithCountryCode,
|
|
375
386
|
FA: authentication,
|
|
376
387
|
};
|
|
377
388
|
|
|
@@ -538,31 +549,17 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
538
549
|
borderTop: '1px solid #f0f0f0',
|
|
539
550
|
color: '#1890ff',
|
|
540
551
|
}}
|
|
541
|
-
onClick={() =>
|
|
552
|
+
onClick={() => setDoctorVisible(true)}
|
|
542
553
|
>
|
|
543
554
|
+ Add New Doctor
|
|
544
555
|
</div>
|
|
545
556
|
</>
|
|
546
557
|
)}
|
|
547
558
|
/>
|
|
548
|
-
{/* Render DoctorAdd OUTSIDE the Select */}
|
|
549
|
-
<DoctorAdd
|
|
550
|
-
visible={visible}
|
|
551
|
-
onCancel={() => setVisible(false)}
|
|
552
|
-
attributes={attributes}
|
|
553
|
-
doctorData={selectedDoctor}
|
|
554
|
-
doctorId={doctorID}
|
|
555
|
-
onSuccess={getDoctors}
|
|
556
|
-
/>
|
|
557
559
|
</Form.Item>
|
|
558
560
|
)}
|
|
559
561
|
{userType === 'STAFF' && (
|
|
560
|
-
<Form.Item
|
|
561
|
-
name="staff_code"
|
|
562
|
-
preserve={false} // THIS FIXES IT
|
|
563
|
-
label="Staff Code"
|
|
564
|
-
rules={[{ required: true, message: 'Please select a staff code' }]}
|
|
565
|
-
>
|
|
562
|
+
<Form.Item name="staff_code" label="Staff Code" rules={[{ required: true, message: 'Please select a staff code' }]}>
|
|
566
563
|
<Select
|
|
567
564
|
placeholder="Select Code"
|
|
568
565
|
options={staffList}
|
|
@@ -581,18 +578,13 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
581
578
|
borderTop: '1px solid #f0f0f0',
|
|
582
579
|
color: '#1890ff',
|
|
583
580
|
}}
|
|
584
|
-
onClick={() =>
|
|
581
|
+
onClick={() => setStaffVisible(true)}
|
|
585
582
|
>
|
|
586
583
|
+ Add New Staff
|
|
587
584
|
</div>
|
|
588
585
|
</>
|
|
589
586
|
)}
|
|
590
587
|
/>
|
|
591
|
-
{/* Render DoctorAdd OUTSIDE the Select */}
|
|
592
|
-
|
|
593
|
-
<StaffAdd visible={visible} onCancel={() => setVisible(false)} staffData={selectedStaff} staffId={staffID} onSuccess={getStaff} />
|
|
594
|
-
|
|
595
|
-
<></>
|
|
596
588
|
</Form.Item>
|
|
597
589
|
)}
|
|
598
590
|
</Col>
|
|
@@ -610,23 +602,10 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
610
602
|
<Form.Item
|
|
611
603
|
name="mobile"
|
|
612
604
|
label="Mobile"
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
{
|
|
616
|
-
pattern: /^[0-9]{10}$/,
|
|
617
|
-
message: 'Mobile number must be exactly 10 digits',
|
|
618
|
-
},
|
|
619
|
-
]}
|
|
605
|
+
validateTrigger="onBlur"
|
|
606
|
+
rules={[{ required: true, message: 'Mobile number required' }, { validator: phoneValidator }]}
|
|
620
607
|
>
|
|
621
|
-
<
|
|
622
|
-
placeholder="Enter Mobile"
|
|
623
|
-
maxLength={10}
|
|
624
|
-
onKeyPress={(e) => {
|
|
625
|
-
if (!/[0-9]/.test(e.key)) {
|
|
626
|
-
e.preventDefault();
|
|
627
|
-
}
|
|
628
|
-
}}
|
|
629
|
-
/>
|
|
608
|
+
<CountryPhoneInput defaultCountryCode={process.env.REACT_APP_COUNTRYCODE} enableSearch inputStyle={{ width: '100%' }} />
|
|
630
609
|
</Form.Item>
|
|
631
610
|
</Col>
|
|
632
611
|
<Col span={8}>
|
|
@@ -669,7 +648,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
669
648
|
<Col span={8}>
|
|
670
649
|
{/* Default Branch */}
|
|
671
650
|
<Form.Item label="Default Branch" name="defaultBranch" rules={[{ required: true, message: 'Please select default branch' }]}>
|
|
672
|
-
<Select placeholder="Select Default Branch"
|
|
651
|
+
<Select placeholder="Select Default Branch">
|
|
673
652
|
{branchOptions
|
|
674
653
|
.filter((opt) => selectedBranches.includes(Number(opt.value)))
|
|
675
654
|
.map((opt) => (
|
|
@@ -682,15 +661,20 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
682
661
|
</Col>
|
|
683
662
|
</Row>
|
|
684
663
|
<Row gutter={16}>
|
|
664
|
+
<Col span={8}>
|
|
665
|
+
<Form.Item name="user_group" label="User Group" rules={[{ required: true, message: 'Please enter your user group' }]}>
|
|
666
|
+
<Input placeholder="Enter User Group" />
|
|
667
|
+
</Form.Item>
|
|
668
|
+
</Col>
|
|
685
669
|
<Col span={8}>
|
|
686
670
|
{formContent?.id ? (
|
|
687
671
|
<>
|
|
688
|
-
<Form.Item>
|
|
672
|
+
{/* <Form.Item>
|
|
689
673
|
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
690
674
|
<Checkbox onChange={handleCheackChange} />
|
|
691
675
|
<span>Select the option if you want to change the password</span>
|
|
692
676
|
</div>
|
|
693
|
-
</Form.Item>
|
|
677
|
+
</Form.Item> */}
|
|
694
678
|
|
|
695
679
|
{isPasswordVisible && (
|
|
696
680
|
<Form.Item
|
|
@@ -743,11 +727,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
743
727
|
{/* Path Ends */}
|
|
744
728
|
|
|
745
729
|
{/* Path */}
|
|
746
|
-
|
|
747
|
-
<Form.Item name="user_group" label="User Group" rules={[{ required: true, message: 'Please enter your user group' }]}>
|
|
748
|
-
<Input placeholder="Enter User Group" />
|
|
749
|
-
</Form.Item>
|
|
750
|
-
</Col>
|
|
730
|
+
|
|
751
731
|
{/* <Col span={8}>
|
|
752
732
|
<Form.Item name="role_id" label="Role" rules={[{ required: true, message: 'Please select a Role' }]}>
|
|
753
733
|
<Select placeholder="Select Role">
|
|
@@ -846,6 +826,17 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
|
|
|
846
826
|
</Form.Item>
|
|
847
827
|
</Form>
|
|
848
828
|
)}
|
|
829
|
+
{/* Render DoctorAdd OUTSIDE the Select */}
|
|
830
|
+
<DoctorAdd
|
|
831
|
+
visible={doctorVisible}
|
|
832
|
+
onCancel={() => setDoctorVisible(false)}
|
|
833
|
+
// attributes={attributes}
|
|
834
|
+
doctorData={selectedDoctor}
|
|
835
|
+
doctorId={doctorID}
|
|
836
|
+
onSuccess={getDoctors}
|
|
837
|
+
/>
|
|
838
|
+
|
|
839
|
+
<StaffAdd visible={staffVisible} onCancel={() => setStaffVisible(false)} staffData={selectedStaff} staffId={staffID} onSuccess={getStaff} />
|
|
849
840
|
</section>
|
|
850
841
|
);
|
|
851
842
|
};
|
|
@@ -3,6 +3,7 @@ import { Modal, Button, Skeleton } from 'antd';
|
|
|
3
3
|
import { EditOutlined } from '@ant-design/icons';
|
|
4
4
|
import UserAdd from '../../../../models/users/components/user-add/user-add';
|
|
5
5
|
import { UsersAPI } from '../../..';
|
|
6
|
+
import { formatPhoneForForm } from '../../../../lib';
|
|
6
7
|
|
|
7
8
|
export default function UserEdit(record) {
|
|
8
9
|
const [visible, setVisible] = useState(false);
|
|
@@ -37,25 +38,35 @@ export default function UserEdit(record) {
|
|
|
37
38
|
} catch (e) {
|
|
38
39
|
orgDetails = {};
|
|
39
40
|
}
|
|
41
|
+
|
|
42
|
+
// find default branch pointer
|
|
43
|
+
const defaultBranchObj = orgDetails?.branch?.find((br) => br.defaultBranch);
|
|
44
|
+
|
|
45
|
+
// extract dbPtr (branch code)
|
|
46
|
+
const defaultBranchCode = defaultBranchObj?.branch_id ? Number(defaultBranchObj.branch_id) : undefined;
|
|
47
|
+
|
|
48
|
+
const formattedMobile = formatPhoneForForm(apiData.mobile);
|
|
49
|
+
|
|
40
50
|
// Construct mapped data object
|
|
41
51
|
const mappedData = {
|
|
42
52
|
id: apiData.id,
|
|
43
53
|
user_type: otherDetails.user_type || apiData.user_type,
|
|
44
54
|
name: apiData.name,
|
|
45
55
|
email: apiData.email,
|
|
46
|
-
mobile:
|
|
56
|
+
mobile: formattedMobile,
|
|
47
57
|
designation: apiData.designation_code,
|
|
48
|
-
department: apiData.department_id,
|
|
58
|
+
department: Number(apiData.department_id),
|
|
49
59
|
// Handle selected branches and default branch
|
|
50
60
|
organization_details: orgDetails,
|
|
51
61
|
selectedBranches: orgDetails.branch_ids || [],
|
|
52
|
-
defaultBranch:
|
|
62
|
+
defaultBranch: defaultBranchCode || null,
|
|
53
63
|
role_id: apiData.role_id,
|
|
54
64
|
password: apiData.password,
|
|
55
65
|
user_group: apiData.user_group,
|
|
56
66
|
// Handle doctor codes
|
|
57
67
|
default_code: apiData.doctor_code,
|
|
58
68
|
doctor_code: apiData.doctor_code,
|
|
69
|
+
staff_code: apiData.staff_id,
|
|
59
70
|
auth_type: apiData.auth_type,
|
|
60
71
|
FA: apiData.FA,
|
|
61
72
|
active: apiData.active ? true : false,
|
|
@@ -81,7 +92,17 @@ export default function UserEdit(record) {
|
|
|
81
92
|
<Skeleton active />
|
|
82
93
|
</div>
|
|
83
94
|
) : (
|
|
84
|
-
<UserAdd
|
|
95
|
+
<UserAdd
|
|
96
|
+
mode="Edit"
|
|
97
|
+
formContent={userData}
|
|
98
|
+
callback={() => {
|
|
99
|
+
setVisible(false);
|
|
100
|
+
if (record.callback) {
|
|
101
|
+
record.callback();
|
|
102
|
+
}
|
|
103
|
+
}}
|
|
104
|
+
edit={true}
|
|
105
|
+
/>
|
|
85
106
|
)}
|
|
86
107
|
</Modal>
|
|
87
108
|
</div>
|
|
@@ -292,7 +292,12 @@ class Users extends Base {
|
|
|
292
292
|
information from the API. */
|
|
293
293
|
|
|
294
294
|
getUser = ({ id }) => {
|
|
295
|
-
return ApiUtils.get({
|
|
295
|
+
return ApiUtils.get({
|
|
296
|
+
url: `users/${id}`,
|
|
297
|
+
headers: {
|
|
298
|
+
db_ptr: 'nuraho',
|
|
299
|
+
},
|
|
300
|
+
});
|
|
296
301
|
};
|
|
297
302
|
/* The `getUserRole` method is a function that takes an object with an `id` property as a parameter.
|
|
298
303
|
It then uses the `ApiUtils.get` function to make a GET request to the endpoint `core-user-roles`
|
|
@@ -359,6 +364,16 @@ class Users extends Base {
|
|
|
359
364
|
url: 'staff/get-all-staff',
|
|
360
365
|
});
|
|
361
366
|
};
|
|
367
|
+
|
|
368
|
+
createForgotePassword = (formBody) => {
|
|
369
|
+
return ApiUtils.post({
|
|
370
|
+
url: `bookings/trigger-reset-password-link`,
|
|
371
|
+
formBody,
|
|
372
|
+
headers: {
|
|
373
|
+
db_ptr: 'nuraho',
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
};
|
|
362
377
|
}
|
|
363
378
|
|
|
364
379
|
export default Users;
|