ui-soxo-bootstrap-core 2.6.1-dev.3 → 2.6.1-dev.31

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.
Files changed (68) hide show
  1. package/core/components/extra-info/extra-info-details.js +2 -2
  2. package/core/components/index.js +2 -11
  3. package/core/components/landing-api/landing-api.js +216 -18
  4. package/core/components/landing-api/landing-api.scss +22 -0
  5. package/core/components/license-management/license-alert.js +97 -0
  6. package/core/lib/Store.js +8 -4
  7. package/core/lib/components/global-header/global-header.js +217 -242
  8. package/core/lib/components/index.js +2 -2
  9. package/core/lib/components/sidemenu/sidemenu.js +19 -13
  10. package/core/lib/components/sidemenu/sidemenu.scss +1 -1
  11. package/core/lib/elements/basic/country-phone-input/country-phone-input.js +14 -9
  12. package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +1 -1
  13. package/core/lib/elements/basic/menu-tree/menu-tree.js +26 -13
  14. package/core/lib/models/forms/components/form-creator/form-creator.js +525 -468
  15. package/core/lib/models/forms/components/form-creator/form-creator.scss +30 -26
  16. package/core/lib/models/menus/components/menu-list/menu-list.js +424 -467
  17. package/core/lib/models/process/components/process-dashboard/process-dashboard.js +469 -3
  18. package/core/lib/models/process/components/process-dashboard/process-dashboard.scss +4 -0
  19. package/core/lib/modules/generic/generic-list/ExportReactCSV.js +28 -2
  20. package/core/lib/pages/change-password/change-password.js +17 -24
  21. package/core/lib/pages/change-password/change-password.scss +45 -48
  22. package/core/lib/pages/login/commnication-mode-selection.js +2 -2
  23. package/core/lib/pages/login/login.js +53 -64
  24. package/core/lib/pages/login/login.scss +9 -0
  25. package/core/lib/pages/login/reset-password.js +17 -17
  26. package/core/lib/pages/login/reset-password.scss +10 -1
  27. package/core/lib/pages/profile/themes.json +4 -4
  28. package/core/lib/utils/api/api.utils.js +53 -45
  29. package/core/lib/utils/common/common.utils.js +49 -35
  30. package/core/lib/utils/generic/generic.utils.js +2 -1
  31. package/core/lib/utils/http/http.utils.js +33 -4
  32. package/core/lib/utils/index.js +4 -1
  33. package/core/models/base/base.js +7 -3
  34. package/core/models/core-scripts/core-scripts.js +147 -126
  35. package/core/models/doctor/components/doctor-add/doctor-add.js +9 -4
  36. package/core/models/menus/components/menu-add/menu-add.js +1 -1
  37. package/core/models/menus/components/menu-lists/menu-lists.js +53 -54
  38. package/core/models/menus/menus.js +49 -2
  39. package/core/models/roles/components/role-add/role-add.js +92 -59
  40. package/core/models/roles/components/role-list/role-list.js +1 -1
  41. package/core/models/staff/components/staff-add/staff-add.js +20 -32
  42. package/core/models/users/components/assign-role/assign-role.js +145 -50
  43. package/core/models/users/components/assign-role/assign-role.scss +209 -45
  44. package/core/models/users/components/assign-role/avatar-props.js +45 -0
  45. package/core/models/users/components/user-add/user-add.js +46 -55
  46. package/core/models/users/components/user-add/user-edit.js +25 -4
  47. package/core/models/users/users.js +9 -1
  48. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +1 -1
  49. package/core/modules/reporting/components/reporting-dashboard/README.md +316 -0
  50. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.js +174 -0
  51. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.scss +76 -0
  52. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +90 -0
  53. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -0
  54. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +448 -0
  55. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +199 -0
  56. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +195 -822
  57. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.scss +43 -0
  58. package/core/modules/reporting/components/reporting-dashboard/reporting-table.js +517 -0
  59. package/core/modules/steps/action-buttons.js +30 -16
  60. package/core/modules/steps/action-buttons.scss +55 -9
  61. package/core/modules/steps/chat-assistant.js +141 -0
  62. package/core/modules/steps/openai-realtime.js +275 -0
  63. package/core/modules/steps/readme.md +167 -0
  64. package/core/modules/steps/steps.js +1286 -60
  65. package/core/modules/steps/steps.scss +703 -86
  66. package/core/modules/steps/timeline.js +21 -19
  67. package/core/modules/steps/voice-navigation.js +709 -0
  68. package/package.json +2 -1
@@ -4,6 +4,7 @@ Implements utility functions to be used across project
4
4
 
5
5
  /*eslint no-useless-escape:"off",eqeqeq: "off"*/
6
6
  import moment from 'moment';
7
+ import { parsePhoneNumberFromString, isValidPhoneNumber } from 'libphonenumber-js';
7
8
 
8
9
  export function IsObjectHaveKeys(obj) {
9
10
  return obj && typeof obj == 'object' && Object.keys(obj).length;
@@ -122,41 +123,6 @@ export const checkLicenseStatus = (expiryDate) => {
122
123
  return { valid: true, daysLeft, message: null, level: null };
123
124
  };
124
125
 
125
- /**
126
- * Checks password expiry status.
127
- *
128
- * @param {string|Date} expiryDate
129
- * @param {number} warningDays
130
- * @param {string} expiredMessage
131
- * @param {(daysLeft: number) => string} warningMessage
132
- *
133
- * @returns {{ valid: boolean, daysLeft: number, message: string|null, level: "error"|"warning"|null }}
134
- */
135
-
136
- export const checkExpiryStatus = ({ expiryDate, warningDays, expiredMessage, warningMessage }) => {
137
- const expiry = new Date(expiryDate);
138
-
139
- if (isNaN(expiry)) {
140
- return { valid: false, daysLeft: 0, message: 'Invalid date', level: 'error' };
141
- }
142
-
143
- expiry.setHours(0, 0, 0, 0);
144
- const today = new Date();
145
- today.setHours(0, 0, 0, 0);
146
-
147
- const msDiff = expiry.getTime() - today.getTime();
148
- const daysLeft = Math.ceil(msDiff / (1000 * 60 * 60 * 24));
149
-
150
- if (daysLeft < 0) {
151
- return { valid: false, daysLeft, message: expiredMessage, level: 'error' };
152
- }
153
-
154
- if (daysLeft <= warningDays) {
155
- return { valid: true, daysLeft, message: warningMessage(daysLeft), level: 'warning' };
156
- }
157
-
158
- return { valid: true, daysLeft, message: null, level: null };
159
- };
160
126
 
161
127
  /**
162
128
  * Masks a mobile number by hiding all but the last `visibleDigits`.
@@ -221,3 +187,51 @@ export function safeJSON(value) {
221
187
  return null;
222
188
  }
223
189
  }
190
+
191
+ /**
192
+ * Convert +countrycode phone into form compatible structure
193
+ * @param {string} phone
194
+ * @returns {object|null}
195
+ */
196
+ export const formatPhoneForForm = (phone) => {
197
+ if (!phone) return null;
198
+
199
+ const parsed = parsePhoneNumberFromString(phone);
200
+
201
+ if (!parsed) return null;
202
+
203
+ return {
204
+ value: parsed.nationalNumber,
205
+ code: {
206
+ dialCode: parsed.countryCallingCode,
207
+ countryCode: parsed.country?.toLowerCase(),
208
+ },
209
+ valid: true,
210
+ };
211
+ };
212
+
213
+ /**
214
+ * Validates a phone number from CountryPhoneInput.
215
+ * Builds full number using country dial code and checks validity.
216
+ *
217
+ * @param {Object} _ - Ant Design rule parameter (unused)
218
+ * @param {Object} val - Phone value object from form
219
+ * @returns {Promise<void>}
220
+ */
221
+ export const phoneValidator = (_, val) => {
222
+ if (!val || !val.value || !val?.code?.dialCode) {
223
+ return Promise.resolve();
224
+ }
225
+
226
+ const fullPhone = `+${val.code.dialCode}${val.value}`;
227
+
228
+ return isValidPhoneNumber(fullPhone) ? Promise.resolve() : Promise.reject('Invalid mobile number');
229
+ };
230
+
231
+ // Returns phone number with country code (e.g., +919876543210)
232
+ export const formatPhoneWithCountryCode = (phone) => {
233
+ if (phone && typeof phone === 'object' && phone.code) {
234
+ return `+${phone.code.dialCode}${phone.value}`;
235
+ }
236
+ return phone;
237
+ };
@@ -31,7 +31,8 @@ export function getExportData(records, exportDataColumns) {
31
31
  const response = records.map((row, columnIndex) => {
32
32
 
33
33
  let entry = {
34
- 'Sl No': columnIndex + 1
34
+ 'Sl No': row.isSummaryRow ? '' : columnIndex + 1,
35
+ isSummaryRow: row.isSummaryRow
35
36
  };
36
37
 
37
38
  filteredColumns.forEach((column, indexValue) => {
@@ -70,24 +70,37 @@ export async function DeleteData({ url, ...props }) {
70
70
  *
71
71
  * @param {*} param
72
72
  */
73
-
74
73
  export async function ApiCall({ url, formBody, method, settings, ...props }) {
75
74
  const token = props.token || (await settings.getToken());
76
75
  const path = window.location.pathname;
77
76
  const baseUrl = props.baseUrl || process.env.REACT_APP_endpoint;
78
77
 
78
+ const isFormData = formBody instanceof FormData;
79
+
79
80
  const payload = {
80
81
  method,
81
82
  headers: {
82
83
  ...settings.headers,
83
- ...headers,
84
84
  ...(props.headers || {}),
85
85
  Authorization: `Bearer ${token}`,
86
- 'Content-Type': 'application/json',
87
86
  },
88
- body: formBody ? JSON.stringify(formBody) : null,
89
87
  };
90
88
 
89
+ // ✅ Upload + normal handling
90
+ if (method !== 'GET' && formBody) {
91
+ payload.body = formBody;
92
+
93
+ if (!isFormData && !(props.isUpload)) {
94
+ payload.body = JSON.stringify(formBody);
95
+ payload.headers['Content-Type'] = 'application/json';
96
+ }
97
+
98
+ // ❗ VERY IMPORTANT
99
+ if (isFormData || (props.isUpload)) {
100
+ delete payload.headers['Content-Type'];
101
+ }
102
+ }
103
+
91
104
  // 🟡 Handles both normal and retried responses
92
105
  const handleResponse = async (res) => {
93
106
  if (props.responseType === 'blob') {
@@ -153,5 +166,21 @@ export async function ApiCall({ url, formBody, method, settings, ...props }) {
153
166
  return result;
154
167
  } catch (err) {
155
168
  console.error('Login error -->', err?.message);
169
+ throw err;
156
170
  }
157
171
  }
172
+
173
+ /**
174
+ * Method for uploading documents
175
+ * @public
176
+ */
177
+ export async function UploadData({ url, formBody, ...props }) {
178
+ return ApiCall({
179
+ url,
180
+ formBody,
181
+ isUpload: true,
182
+ method: 'POST',
183
+ returnResponse: true,
184
+ ...props,
185
+ });
186
+ }
@@ -14,7 +14,7 @@ import { GetData, PostData, PutData, DeleteData } from './http/http.utils';
14
14
 
15
15
  import { getExportData } from './generic/generic.utils';
16
16
 
17
- import { ConvertBytesToArray, safeJSON } from './common/common.utils';
17
+ import { ConvertBytesToArray, safeJSON, formatPhoneForForm, phoneValidator, formatPhoneWithCountryCode } from './common/common.utils';
18
18
 
19
19
  import SettingsUtil from './setting.utils';
20
20
 
@@ -37,4 +37,7 @@ export {
37
37
  SettingsUtil,
38
38
  FormUtils,
39
39
  safeJSON,
40
+ formatPhoneForForm,
41
+ phoneValidator,
42
+ formatPhoneWithCountryCode,
40
43
  };
@@ -88,9 +88,13 @@ class BaseAPI {
88
88
  * Get the data from the table
89
89
  */
90
90
  get(config = {}) {
91
- // Get the records from firebase
92
-
93
- return ApiUtils.get({ url: config.url || this.endpoint, config });
91
+ const { url, headers, ...rest } = config;
92
+ return ApiUtils.get({
93
+ url: url || this.endpoint,
94
+ headers,
95
+ config: rest,
96
+ ...rest,
97
+ });
94
98
  }
95
99
 
96
100
  getRelations(id) {
@@ -9,142 +9,163 @@ import React from 'react';
9
9
 
10
10
  import Base from '../base/base';
11
11
 
12
- import { ApiUtils } from './../../lib/'
13
-
12
+ import { ApiUtils } from './../../lib/';
14
13
 
15
14
  class CoreScript extends Base {
15
+ constructor() {
16
+ super();
16
17
 
17
- constructor() {
18
- super();
19
-
20
- this.fields = [
21
- {
22
- field: 'name',
23
- caption: 'Name'
24
- },
25
- {
26
- field: 'amount',
27
- caption: 'Amount'
28
- }
29
- ];
30
-
31
- // this.columns = ;
32
- }
33
-
34
- get id() {
35
- return 'id';
36
- }
37
-
38
- get getEndpoint() {
39
- return 'core-scripts';
40
- }
41
-
42
-
43
- get modelName() {
44
- return `core-scripts`;
45
- }
46
-
47
- get columns() {
48
- return [
49
- {
50
- caption: 'Staff',
51
- field: 'staff.name',
52
- key: 'staff'
53
- },
54
- {
55
- caption: 'Weight',
56
- field: 'weight',
57
- key: 'weight'
58
- },
59
- {
60
- caption: 'Date',
61
- field: 'created_at',
62
- key: 'created_at'
63
- }
64
- ];
65
- }
66
-
67
-
68
- /**
69
- *Getting core_script data
70
- * @returns
71
- */
72
- getReportingLisitng = (id, formBody, dbPtr = null) => {
73
-
74
- // Settings db pointer
75
- if (!dbPtr) dbPtr = localStorage.db_ptr;
76
- return ApiUtils.post({
77
- url: `core-scripts/dashboardquery/${id}`,
78
- formBody,
79
- headers: {
80
- 'Content-Type': 'application/json',
81
- Authorization: 'Bearer ' + localStorage.access_token,
82
- db_ptr: dbPtr
18
+ this.fields = [
19
+ {
20
+ field: 'name',
21
+ caption: 'Name',
83
22
  },
84
- });
85
- };
86
-
87
-
88
- /**
89
- *Updating user details
90
- * @returns
91
- */
92
- getUserDetailsLisitng = (id, formBody) => {
23
+ {
24
+ field: 'amount',
25
+ caption: 'Amount',
26
+ },
27
+ ];
93
28
 
94
- return ApiUtils.post({
95
- url: `core-scripts/update-user-deatils/${id}`,
96
- formBody,
97
- });
98
- };
29
+ // this.columns = ;
30
+ }
99
31
 
32
+ get id() {
33
+ return 'id';
34
+ }
100
35
 
101
- /**
102
- *
103
- */
104
- getReportMenu = async ({ id }) => {
105
-
106
- const result = await this.getRecord({ id });
107
-
108
- const report = result.result
109
-
110
- return {
111
- ...report,
112
- caption: report.caption,
113
- path: '/reports/' + report.id,
114
- is_visible: true
115
- }
116
- }
117
-
118
- /**
119
- * To get extra script data corresponding to mode
120
- *
121
- * @param {*} mode
122
- * @returns
123
- */
124
- getExtraInfo = (mode) => {
125
- return ApiUtils.get({
126
- url: `core-scripts/get-script-data?mode=${mode}`,
127
- });
128
- };
36
+ get getEndpoint() {
37
+ return 'core-scripts';
38
+ }
129
39
 
40
+ get modelName() {
41
+ return `core-scripts`;
42
+ }
130
43
 
131
- /**
132
- * To get executed data
133
- *
134
- * @param {*} mode
135
- * @returns
136
- */
137
-
138
- getSelectedExtraInfo = (formBody) => {
139
- return ApiUtils.post({
140
- url: `core-scripts/get-selected-script-data`,
141
- formBody,
142
- headers: {
143
- 'Content-Type': 'application/json',
144
- Authorization: 'Bearer ' + localStorage.access_token,
145
- },
146
- });
44
+ get columns() {
45
+ return [
46
+ {
47
+ caption: 'Staff',
48
+ field: 'staff.name',
49
+ key: 'staff',
50
+ },
51
+ {
52
+ caption: 'Weight',
53
+ field: 'weight',
54
+ key: 'weight',
55
+ },
56
+ {
57
+ caption: 'Date',
58
+ field: 'created_at',
59
+ key: 'created_at',
60
+ },
61
+ ];
62
+ }
63
+
64
+ /**
65
+ *Getting core_script data
66
+ * @returns
67
+ */
68
+ getReportingLisitng = (id, formBody, dbPtr = null) => {
69
+ // Settings db pointer
70
+ if (!dbPtr) dbPtr = localStorage.db_ptr;
71
+ return ApiUtils.post({
72
+ url: `core-scripts/dashboardquery/${id}`,
73
+ formBody,
74
+ headers: {
75
+ 'Content-Type': 'application/json',
76
+ Authorization: 'Bearer ' + localStorage.access_token,
77
+ db_ptr: dbPtr,
78
+ },
79
+ });
80
+ };
81
+
82
+ /**
83
+ *Updating user details
84
+ * @returns
85
+ */
86
+ getUserDetailsLisitng = (id, formBody) => {
87
+ return ApiUtils.post({
88
+ url: `core-scripts/update-user-deatils/${id}`,
89
+ formBody,
90
+ });
91
+ };
92
+
93
+ getQuery = (formBody) => {
94
+ return ApiUtils.post({
95
+ url: `core-scripts/execute-script-api`,
96
+ formBody,
97
+ });
98
+ };
99
+ /**
100
+ *
101
+ */
102
+ getQuerySeacch = (formBody) => {
103
+ return ApiUtils.post({
104
+ // baseUrl: 'http://localhost:8002/dev/',
105
+ url: `core-scripts/execute-script-by-search`,
106
+ formBody,
107
+ });
108
+ };
109
+
110
+ getCorescript = (formBody,dbPtr) => {
111
+
112
+ if (!dbPtr) dbPtr = localStorage.db_ptr;
113
+ return ApiUtils.post({
114
+ // baseUrl: 'http://localhost:8002/dev/',
115
+ url: `core-scripts/get-core-script`,
116
+ headers: {
117
+ 'Content-Type': 'application/json',
118
+ Authorization: 'Bearer ' + localStorage.access_token,
119
+ db_ptr: dbPtr,
120
+ },
121
+ formBody,
122
+ });
123
+ };
124
+ /**
125
+ *
126
+ */
127
+ getReportMenu = async ({ id }) => {
128
+ const result = await this.getRecord({ id });
129
+
130
+ const report = result.result;
131
+
132
+ return {
133
+ ...report,
134
+ caption: report.caption,
135
+ path: '/reports/' + report.id,
136
+ is_visible: true,
147
137
  };
138
+ };
139
+
140
+ /**
141
+ * To get extra script data corresponding to mode
142
+ *
143
+ * @param {*} mode
144
+ * @returns
145
+ */
146
+ getExtraInfo = (mode) => {
147
+ return ApiUtils.get({
148
+ url: `core-scripts/get-script-data?mode=${mode}`,
149
+ });
150
+ };
151
+
152
+ /**
153
+ * To get executed data
154
+ *
155
+ * @param {*} mode
156
+ * @returns
157
+ */
158
+
159
+ getSelectedExtraInfo = (formBody) => {
160
+ return ApiUtils.post({
161
+ url: `core-scripts/get-selected-script-data`,
162
+ formBody,
163
+ headers: {
164
+ 'Content-Type': 'application/json',
165
+ Authorization: 'Bearer ' + localStorage.access_token,
166
+ },
167
+ });
168
+ };
148
169
  }
149
170
 
150
171
  export default CoreScript;
@@ -6,7 +6,8 @@ import { useTranslation, Button } from './../../../../lib/';
6
6
  import { UsersAPI } from '../../..';
7
7
  import SignatureCanvasComponent from '../../../../lib/components/consent/signature-pad';
8
8
 
9
- const DoctorAdd = ({ visible, onCancel, attributes, doctorId, doctorData, onSuccess }) => {
9
+ const DoctorAdd = ({ visible, onCancel, doctorId, doctorData, onSuccess }) => {
10
+ // console.log('attributes', attributes);
10
11
  const [form] = Form.useForm();
11
12
  const { t } = useTranslation();
12
13
 
@@ -21,8 +22,8 @@ const DoctorAdd = ({ visible, onCancel, attributes, doctorId, doctorData, onSucc
21
22
  const [doctorID, setDoctorID] = useState(false);
22
23
  const [selectedDoctor, setSelectedDoctor] = useState(null);
23
24
 
24
- const propValues = attributes || {};
25
- const doctorType = propValues?.type;
25
+ // const propValues = attributes || {};
26
+ // const doctorType = propValues?.type;
26
27
 
27
28
  const editMode = Boolean(doctorId);
28
29
 
@@ -37,6 +38,10 @@ const DoctorAdd = ({ visible, onCancel, attributes, doctorId, doctorData, onSucc
37
38
  message: '',
38
39
  });
39
40
 
41
+ const getDoctorTypeOptions = () => [
42
+ { label: 'In House', value: 'DRINH' },
43
+ { label: 'Out Side', value: 'DROTR' },
44
+ ];
40
45
  /** Autofocus on modal open */
41
46
  useEffect(() => {
42
47
  if (visible) {
@@ -266,7 +271,7 @@ const DoctorAdd = ({ visible, onCancel, attributes, doctorId, doctorData, onSucc
266
271
  <Row gutter={16}>
267
272
  <Col span={8}>
268
273
  <Form.Item label="Type" name="type">
269
- <Select placeholder="Select Type" options={doctorType || []} showSearch />
274
+ <Select placeholder="Select Type" options={getDoctorTypeOptions() || []} showSearch />
270
275
  </Form.Item>
271
276
  </Col>
272
277
 
@@ -164,7 +164,7 @@ const MenuAdd = ({ model, callback, edit, history, formContent, match, additiona
164
164
  <div className="left-container">
165
165
  {/* Caption */}
166
166
  <Form.Item name={'caption'} label="Caption" rules={[{ required: true, message: 'Caption is required' }]}>
167
- <Input placeholder="Enter caption" />
167
+ <Input placeholder="Enter caption" autoFocus />
168
168
  </Form.Item>
169
169
  {/* Caption Ends */}
170
170