ui-soxo-bootstrap-core 2.4.25-dev.10 → 2.4.25-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.
@@ -155,6 +155,15 @@ class RolesAPI extends BaseAPI {
155
155
 
156
156
  /**
157
157
  * Cutsom Api for creating user
158
+ getRole = () => {
159
+ return ApiUtils.get({
160
+ url: `core-roles/get-core-roles?active=Y`,
161
+ });
162
+ };
163
+
164
+
165
+ /**
166
+ * Cutsom Api for updating user
158
167
  *
159
168
  * @param {*} values
160
169
  * @returns
@@ -8,7 +8,7 @@ import AsyncSelect from 'react-select/async';
8
8
 
9
9
  import { Table, Card, Button, JSONInput, GlobalContext } from './../../../../lib/';
10
10
 
11
- import { ModelsAPI, PagesAPI } from '../../..';
11
+ import { ModelsAPI, PagesAPI, RolesAPI } from '../../..';
12
12
 
13
13
  import { UsersAPI } from '../../..';
14
14
  import DoctorAdd from '../../../doctor/components/doctor-add/doctor-add';
@@ -87,6 +87,8 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
87
87
  const [departments, setDepartments] = useState([]);
88
88
  // doctor list state
89
89
  const [doctorList, setDoctorList] = useState([]);
90
+ // for role list
91
+ const [roles, setRoles] = useState([]);
90
92
 
91
93
  const [form] = Form.useForm();
92
94
 
@@ -134,6 +136,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
134
136
 
135
137
  useEffect(() => {
136
138
  loadUsers();
139
+
137
140
  setLoading(false);
138
141
 
139
142
  if (firmDetails) {
@@ -206,6 +209,24 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
206
209
  .finally(() => setLoading(false));
207
210
  };
208
211
 
212
+ /**
213
+ * get role lists
214
+ */
215
+ function getRoles() {
216
+ RolesAPI.getRole()
217
+ .then((res) => {
218
+ // if API returns { statusCode: 200, result: [...] }
219
+ if (Array.isArray(res.result)) {
220
+ setRoles(res.result.filter((r) => r.active === 'Y')); // optional: only active roles
221
+ } else {
222
+ setRoles([]);
223
+ }
224
+ })
225
+ .catch((err) => {
226
+ setRoles([]);
227
+ });
228
+ }
229
+
209
230
  /** Get Department List */
210
231
  const getDepartments = () => {
211
232
  setLoading(true);
@@ -282,6 +303,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
282
303
  getBranches();
283
304
  getDesignations();
284
305
  getDepartments();
306
+ getRoles();
285
307
  getDoctors(); // load doctor list
286
308
  getStaff();
287
309
  }, []);
@@ -558,6 +580,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
558
580
  <Input placeholder="Enter Email Address" />
559
581
  </Form.Item>
560
582
  </Col>
583
+
561
584
  <Col span={8}>
562
585
  {/* Mobile */}
563
586
  <Form.Item name="mobile" label="Mobile" rules={[{ required: true, message: 'Please enter your mobile number' }]}>
@@ -686,6 +709,17 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
686
709
  <Input placeholder="Enter User Group" />
687
710
  </Form.Item>
688
711
  </Col>
712
+ <Col span={8}>
713
+ <Form.Item name="role_id" label="Role" rules={[{ required: true, message: 'Please Input Role' }]}>
714
+ <Select placeholder="Select Role" style={{ width: '100%' }}>
715
+ {roles.map((role) => (
716
+ <Option key={role.id} value={role.id}>
717
+ {role.name}
718
+ </Option>
719
+ ))}
720
+ </Select>
721
+ </Form.Item>
722
+ </Col>
689
723
 
690
724
  {/* <Form.Item name="mobile" label="Mobile" required={mobileRequired}>
691
725
  <Input placeholder="Enter Mobile" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-soxo-bootstrap-core",
3
- "version": "2.4.25-dev.10",
3
+ "version": "2.4.25-dev.11",
4
4
  "description": "All the Core Components for you to start",
5
5
  "keywords": [
6
6
  "all in one"