ui-soxo-bootstrap-core 2.6.32-dev.5 → 2.6.33

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.
@@ -109,7 +109,7 @@ import ConsentComponent from './consent/consent'
109
109
  import TaskOverviewLegacy from './../models/process/components/task-overview-legacy/task-overview-legacy'
110
110
 
111
111
  import ReportingDashboard from '../../modules/reporting/components/reporting-dashboard/reporting-dashboard';
112
- import ReportingTable from '../../modules/reporting/components/reporting-dashboard/reporting-table'
112
+
113
113
  import ProcessStepsPage from '../../modules/steps/steps'
114
114
  export {
115
115
 
@@ -198,7 +198,7 @@ export {
198
198
  TaskOverviewLegacy,
199
199
  // WebCamera,
200
200
  ConsentComponent,
201
- ReportingTable,
201
+
202
202
  ReportingDashboard,
203
203
  ProcessStepsPage
204
204
 
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import React, { useEffect, useRef } from 'react';
11
- import { Html5Qrcode } from 'html5-qrcode/cjs/index.js';
11
+ import { Html5Qrcode } from 'html5-qrcode';
12
12
 
13
13
  /**
14
14
  * QrScanner Component
@@ -69,6 +69,7 @@ class CoreScript extends Base {
69
69
  // Settings db pointer
70
70
  if (!dbPtr) dbPtr = localStorage.db_ptr;
71
71
  return ApiUtils.post({
72
+ // baseUrl: 'http://localhost:8002/dev/',
72
73
  url: `core-scripts/dashboardquery/${id}`,
73
74
  formBody,
74
75
  headers: {
@@ -90,20 +91,6 @@ class CoreScript extends Base {
90
91
  });
91
92
  };
92
93
 
93
- getCorescript = (formBody,dbPtr) => {
94
-
95
- if (!dbPtr) dbPtr = localStorage.db_ptr;
96
- return ApiUtils.post({
97
- // baseUrl: 'http://localhost:8002/dev/',
98
- url: `core-scripts/get-core-script`,
99
- headers: {
100
- 'Content-Type': 'application/json',
101
- Authorization: 'Bearer ' + localStorage.access_token,
102
- db_ptr: dbPtr,
103
- },
104
- formBody,
105
- });
106
- };
107
94
  getQuery = (formBody) => {
108
95
  return ApiUtils.post({
109
96
  url: `core-scripts/execute-script-api`,
@@ -160,29 +160,6 @@ class MenusAPI extends Base {
160
160
  });
161
161
  };
162
162
 
163
- getBranches = () => {
164
- return ApiUtils.get({
165
- url: 'branches',
166
- });
167
- };
168
-
169
- switchBranch = (formBody, dbPtr) => {
170
- return ApiUtils.post({
171
- url: `auth/switch-branch`,
172
- headers: { db_ptr: dbPtr },
173
- formBody,
174
- });
175
- };
176
-
177
- getProfile = (token) => {
178
- return ApiUtils.get({
179
- url: 'auth/profile',
180
- headers: {
181
- Authorization: `Bearer ${token}`,
182
- },
183
- });
184
- };
185
-
186
163
  /**
187
164
  * create menu
188
165
  */
@@ -208,6 +185,7 @@ class MenusAPI extends Base {
208
185
  : 'menus/get-menus'; // NURA
209
186
 
210
187
  if (!dbPtr) dbPtr = localStorage.db_ptr;
188
+
211
189
  return this.get({
212
190
  url,
213
191
  config,
@@ -327,12 +305,6 @@ class MenusAPI extends Base {
327
305
  // }
328
306
  ];
329
307
  };
330
- // license summary api call
331
- getSummary = () => {
332
- return ApiUtils.get({
333
- url: 'license/summary',
334
- });
335
- };
336
308
  }
337
309
 
338
310
  export default MenusAPI;
@@ -387,7 +387,8 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
387
387
  ...values,
388
388
  auth_type: 'LDAP',
389
389
  mobile: mobileWithCountryCode,
390
- FA: authentication,
390
+ FA: formContent?.FA === false ? false : authentication,
391
+
391
392
  };
392
393
 
393
394
  setLoading(true);
@@ -400,7 +401,7 @@ const UserAdd = ({ model, callback, edit, history, formContent, match, additiona
400
401
  addAllBranches: props.ldap.addAllBranches,
401
402
  auth_user: selectedOption.value,
402
403
  auth_type: 'LDAP',
403
- FA: authentication,
404
+ FA: formContent?.FA === false ? false : authentication,
404
405
  };
405
406
  }
406
407
 
@@ -1,10 +1,7 @@
1
- import React, { useState, useContext } from 'react';
2
- import { Modal, Tag } from 'antd';
1
+ import React from 'react';
2
+ import { Tag } from 'antd';
3
3
  import * as Icons from '@ant-design/icons';
4
4
  import { Link } from 'react-router-dom';
5
- import { GlobalContext, safeJSON, Location } from '../../../../../lib';
6
- // import { PdfViewer } from '../../../../../lib';
7
- import { CoreScripts } from '../../../../../models';
8
5
 
9
6
  /**
10
7
  * Utilities for rendering Reporting Dashboard display columns.
@@ -77,7 +74,7 @@ export function isActionTypeEntry(entry = {}) {
77
74
  * @param {DisplayRecord} record
78
75
  * @returns {string}
79
76
  */
80
- export function getRedirectLink(entry = {}, record = {}, CustomComponents = {}) {
77
+ export function getRedirectLink(entry = {}, record = {}) {
81
78
  let redirectLink = entry.redirect_link || '';
82
79
 
83
80
  if (Array.isArray(entry.replace_variables)) {
@@ -90,41 +87,6 @@ export function getRedirectLink(entry = {}, record = {}, CustomComponents = {})
90
87
  return redirectLink;
91
88
  }
92
89
 
93
- /**
94
- * Resolves the PDF/file location for file-based action entries.
95
- *
96
- * Supports either:
97
- * - `entry.file_location` as a direct URL/path
98
- * - `entry.file_location` as a record field name
99
- *
100
- * @param {DisplayColumnEntry} entry
101
- * @param {DisplayRecord} record
102
- * @returns {string}
103
- */
104
- export function getFileLocation(entry = {}, record = {}) {
105
- if (entry.file_location && typeof entry.file_location === 'string' && record[entry.file_location]) {
106
- return record[entry.file_location];
107
- }
108
-
109
- return record.file_location || entry.file_location || '';
110
- }
111
-
112
- /**
113
- * Resolves a value from the row when a config field points to a record key,
114
- * otherwise returns the provided literal value.
115
- *
116
- * @param {*} value
117
- * @param {DisplayRecord} record
118
- * @returns {*}
119
- */
120
- function resolveRecordValue(value, record = {}) {
121
- if (typeof value === 'string' && Object.prototype.hasOwnProperty.call(record, value)) {
122
- return record[value];
123
- }
124
-
125
- return value;
126
- }
127
-
128
90
  /**
129
91
  * Resolves action label text with backward-compatible precedence.
130
92
  *
@@ -208,154 +170,6 @@ function renderCustomComponent({ entry, record, CustomComponents, refresh }) {
208
170
  );
209
171
  }
210
172
 
211
- /**
212
- * Renders a PDF file action inside a modal viewer.
213
- *
214
- * @param {Object} root0
215
- * @param {DisplayColumnEntry} root0.entry
216
- * @param {DisplayRecord} root0.record
217
- * @param {Object.<string, React.ComponentType<any>>} root0.CustomComponents
218
- * @returns {React.ReactNode}
219
- */
220
- function FileActionLink({ entry, record, CustomComponents }) {
221
- const [isPdfVisible, setIsPdfVisible] = useState(false);
222
- const fileUrl = getFileLocation(entry, record);
223
- const actionLabel = getActionLabel(entry, record);
224
- const FileLoaderComponent = CustomComponents?.FileLoader;
225
-
226
- if (!fileUrl) {
227
- return null;
228
- }
229
-
230
- const fileLoaderProps = {
231
- url: fileUrl,
232
- type: resolveRecordValue(entry.file_type, record) || 'pdf',
233
- defaultScale: resolveRecordValue(entry.default_scale, record),
234
- viewerType: resolveRecordValue(entry.viewer_type, record),
235
- config: {
236
- requireLinuxPath: resolveRecordValue(entry.require_linux_path, record),
237
- replaceBranch: resolveRecordValue(entry.replace_branch, record),
238
- ...(entry.file_loader_config || {}),
239
- },
240
- entry,
241
- record,
242
- };
243
-
244
- return (
245
- <>
246
- {/* 1. Add the trigger link/button here */}
247
- <a
248
- onClick={(e) => {
249
- e.preventDefault();
250
- setIsPdfVisible(true);
251
- }}
252
- style={{ cursor: 'pointer' }}
253
- >
254
- {actionLabel}
255
- </a>
256
-
257
- <Modal
258
- open={isPdfVisible}
259
- onCancel={() => setIsPdfVisible(false)}
260
- footer={null}
261
- destroyOnClose
262
- width={950}
263
- style={{ top: 10 }}
264
- title={actionLabel}
265
- >
266
- {/* 2. Ensure the loader component exists */}
267
- {FileLoaderComponent ? <FileLoaderComponent {...fileLoaderProps} /> : <p>Loader not found</p>}
268
- </Modal>
269
- </>
270
- );
271
- }
272
-
273
- /**
274
- * Returns the branch access list from the signed-in user's organization details.
275
- *
276
- * `organization_details` may arrive as a JSON string, so this helper keeps the
277
- * parsing logic in one place before branch comparisons are made.
278
- *
279
- * @param {Object} user
280
- * @returns {Array}
281
- */
282
- function getAccessibleBranches(user = {}) {
283
- const orgDetails = safeJSON(user?.organization_details);
284
- return Array.isArray(orgDetails?.branch) ? orgDetails.branch : [];
285
- }
286
-
287
- /**
288
- * Resolves branch metadata used to decide whether an action link should prompt
289
- * for a branch switch before navigation.
290
- *
291
- * When an action entry includes `replace_variables` with the `index` field, the
292
- * row is treated as branch-aware content. We compare the record's branch id
293
- * against the active branch from `localStorage.db_ptr`, and also resolve whether
294
- * the user has access to the target branch.
295
- *
296
- * @param {DisplayColumnEntry} entry
297
- * @param {DisplayRecord} record
298
- * @param {Object} user
299
- * @returns {{requiresBranchSwitch: boolean, hasTargetBranchAccess: boolean}}
300
- */
301
- function getBranchNavigationState(entry = {}, record = {}, user = {}) {
302
- const branchFieldConfig = entry.replace_variables?.find((variable) => variable.field === 'index');
303
-
304
- if (!branchFieldConfig) {
305
- return { requiresBranchSwitch: false, hasTargetBranchAccess: false };
306
- }
307
-
308
- const accessibleBranches = getAccessibleBranches(user);
309
- const activeDbPtr = localStorage.getItem('db_ptr');
310
- const activeBranch = accessibleBranches.find((branch) => String(branch.dbPtr) === String(activeDbPtr));
311
- const targetBranchId = record[branchFieldConfig.field];
312
- const targetBranch = accessibleBranches.find((branch) => String(branch.branch_id) === String(targetBranchId));
313
-
314
- return {
315
- requiresBranchSwitch: Boolean(targetBranchId) && String(activeBranch?.branch_id) !== String(targetBranchId),
316
- hasTargetBranchAccess: Boolean(targetBranch),
317
- };
318
- }
319
-
320
- /**
321
- * Renders a branch-switch confirmation link for cross-branch records.
322
- *
323
- * The actual branch change is handled by the landing page via the `index`
324
- * query parameter. This link only confirms intent and blocks navigation when
325
- * the user does not have access to the target branch.
326
- *
327
- * @param {Object} root0
328
- * @param {string} root0.label
329
- * @param {string} root0.redirectLink
330
- * @param {boolean} root0.hasTargetBranchAccess
331
- * @returns {React.ReactNode}
332
- */
333
- function BranchAwareActionLink({ label, redirectLink, hasTargetBranchAccess }) {
334
- return (
335
- <a
336
- onClick={(e) => {
337
- e.preventDefault();
338
- Modal.confirm({
339
- title: 'Switch Branch?', // Adding a title makes it look more standard
340
- content: 'This record belongs to another branch. Would you like to switch branches to view the details?',
341
- onOk: () => {
342
- if (hasTargetBranchAccess) {
343
- Location.navigate({ url: redirectLink });
344
- return;
345
- }
346
-
347
- Modal.error({
348
- title: 'Access Denied',
349
- content: 'This data belongs to another branch.Would you like to switch branches to view the details?',
350
- });
351
- },
352
- });
353
- }}
354
- >
355
- {label}
356
- </a>
357
- );
358
- }
359
173
  /**
360
174
  * Renders table cell content for a configured display column.
361
175
  *
@@ -396,21 +210,10 @@ export function renderDisplayCell({ entry, record, CustomComponents, refresh })
396
210
  }
397
211
  return null;
398
212
  }
399
- if (isLegacyActionEntry(entry) || isActionTypeEntry(entry)) {
400
- if (entry.redirect_link_type === 'file') {
401
- return <FileActionLink entry={entry} record={record} CustomComponents={CustomComponents} />;
402
- }
403
- const { user = {} } = useContext(GlobalContext);
404
213
 
214
+ if (isLegacyActionEntry(entry) || isActionTypeEntry(entry)) {
405
215
  const redirectLink = getRedirectLink(entry, record);
406
- const label = getActionLabel(entry, record);
407
- const { requiresBranchSwitch, hasTargetBranchAccess } = getBranchNavigationState(entry, record, user);
408
-
409
- if (requiresBranchSwitch) {
410
- return <BranchAwareActionLink label={label} redirectLink={redirectLink} hasTargetBranchAccess={hasTargetBranchAccess} />;
411
- }
412
-
413
- return <Link to={`${redirectLink}`}>{label}</Link>;
216
+ return <Link to={`${redirectLink}`}>{getActionLabel(entry, record)}</Link>;
414
217
  }
415
218
 
416
219
  if (entry.field === 'custom') {
@@ -3,7 +3,6 @@ import {
3
3
  isLegacyActionEntry,
4
4
  isActionTypeEntry,
5
5
  getRedirectLink,
6
- getFileLocation,
7
6
  getActionLabel,
8
7
  renderDisplayCell,
9
8
  } from './display-cell-renderer';
@@ -29,13 +28,6 @@ describe('display-cell-renderer', () => {
29
28
  expect(link).toBe('/bill/10/visit/OP100');
30
29
  });
31
30
 
32
- test('resolves file location from direct config value or record field', () => {
33
- expect(getFileLocation({ file_location: 'https://example.com/report.pdf' }, {})).toBe('https://example.com/report.pdf');
34
- expect(getFileLocation({ file_location: 'document_url' }, { document_url: 'https://example.com/record.pdf' })).toBe(
35
- 'https://example.com/record.pdf',
36
- );
37
- });
38
-
39
31
  test('keeps legacy action label behavior unchanged', () => {
40
32
  const entry = {
41
33
  field: 'action',
@@ -85,71 +77,6 @@ describe('display-cell-renderer', () => {
85
77
  expect(element.props.opb_id).toBe(1);
86
78
  });
87
79
 
88
- test('renders file action entry as pdf viewer trigger', () => {
89
- const element = renderDisplayCell({
90
- entry: {
91
- type: 'action',
92
- field: 'action_text',
93
- redirect_link_type: 'file',
94
- file_location: 'https://example.com/report.pdf',
95
- label: 'Open PDF',
96
- },
97
- record: { action_text: 'Preview PDF' },
98
- refresh: jest.fn(),
99
- CustomComponents: {},
100
- });
101
-
102
- expect(typeof element.type).toBe('function');
103
- expect(element.props.entry.redirect_link_type).toBe('file');
104
- expect(element.props.entry.file_location).toBe('https://example.com/report.pdf');
105
- });
106
-
107
- test('passes file action props to CustomComponents.FileUpload when available', () => {
108
- const FileUpload = () => null;
109
- const element = renderDisplayCell({
110
- entry: {
111
- type: 'action',
112
- field: 'action_text',
113
- redirect_link_type: 'file',
114
- file_location: 'document_path',
115
- file_type: 'document_type',
116
- default_scale: 'zoom_level',
117
- viewer_type: 'inline_viewer',
118
- require_linux_path: 'needs_linux_path',
119
- replace_branch: 'should_replace_branch',
120
- file_loader_config: {
121
- sample: true,
122
- },
123
- },
124
- record: {
125
- action_text: 'Preview',
126
- document_path: '\\\\server\\reports\\doc.pdf',
127
- document_type: 'pdf',
128
- zoom_level: 1.25,
129
- inline_viewer: true,
130
- needs_linux_path: true,
131
- should_replace_branch: false,
132
- },
133
- refresh: jest.fn(),
134
- CustomComponents: { FileUpload },
135
- });
136
-
137
- expect(typeof element.type).toBe('function');
138
-
139
- const modalContent = element.props.children[1].props.children;
140
- expect(modalContent.type).toBe(FileUpload);
141
- expect(modalContent.props.url).toBe('\\\\server\\reports\\doc.pdf');
142
- expect(modalContent.props.type).toBe('pdf');
143
- expect(modalContent.props.defaultScale).toBe(1.25);
144
- expect(modalContent.props.viewerType).toBe(true);
145
- expect(modalContent.props.config).toEqual({
146
- requireLinuxPath: true,
147
- replaceBranch: false,
148
- sample: true,
149
- });
150
- expect(modalContent.props.record.document_path).toBe('\\\\server\\reports\\doc.pdf');
151
- });
152
-
153
80
  test('renders styled tag/span/icon/text for non-action path', () => {
154
81
  const tagElement = renderDisplayCell({
155
82
  entry: { field: 'status', enableColor: true, columnType: 'tag' },