ui-soxo-bootstrap-core 2.6.46-dev.6 → 2.6.46-dev.7
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.
|
@@ -15,13 +15,15 @@ import QRCode from 'qrcode.react';
|
|
|
15
15
|
export default function QRCodeElement({
|
|
16
16
|
value,
|
|
17
17
|
className,
|
|
18
|
-
imageSettings = {}
|
|
18
|
+
imageSettings = {},
|
|
19
|
+
size = 80,
|
|
20
|
+
|
|
19
21
|
}) {
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
return <div className={`${className}`}>
|
|
23
25
|
|
|
24
26
|
|
|
25
|
-
<QRCode size={
|
|
27
|
+
<QRCode size={size} width={20} value={value} imageSettings={imageSettings} />
|
|
26
28
|
</div>;
|
|
27
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import { Table, Skeleton, Input, Modal, message, Pagination } from 'antd';
|
|
3
3
|
import { QrcodeOutlined } from '@ant-design/icons';
|
|
4
4
|
import { ExportReactCSV, getExportData, Card, TableComponent, QrScanner } from './../../../../lib/';
|
|
@@ -270,10 +270,28 @@ export default function ReportingTable({
|
|
|
270
270
|
}
|
|
271
271
|
};
|
|
272
272
|
|
|
273
|
+
const filtered = useMemo(() => {
|
|
274
|
+
if (!patients || !query) return patients;
|
|
275
|
+
|
|
276
|
+
return patients.filter((record) => {
|
|
277
|
+
let keys = Object.keys(record);
|
|
278
|
+
let flag = false;
|
|
279
|
+
keys.forEach((key) => {
|
|
280
|
+
let ele = record[key];
|
|
281
|
+
if (ele && typeof ele === 'string' && ele.toLowerCase().indexOf(query.toLowerCase()) !== -1) {
|
|
282
|
+
flag = true;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
return flag;
|
|
286
|
+
});
|
|
287
|
+
}, [patients, query]);
|
|
288
|
+
|
|
273
289
|
useEffect(() => {
|
|
274
|
-
if (
|
|
290
|
+
if (filtered) {
|
|
275
291
|
// Export uses the visible display column structure and appends the same
|
|
276
292
|
// summary row that appears in the table when summary columns are enabled.
|
|
293
|
+
// Uses `filtered` (not the raw `patients`) so the exported file matches
|
|
294
|
+
// whatever the search box currently shows on screen.
|
|
277
295
|
const exportCols = cols.map((col) => {
|
|
278
296
|
if (col.title && typeof col.title === 'object' && col.title.props) {
|
|
279
297
|
return { ...col, title: col.title.props.title };
|
|
@@ -281,10 +299,10 @@ export default function ReportingTable({
|
|
|
281
299
|
return col;
|
|
282
300
|
});
|
|
283
301
|
const summaryCols = columns.filter((col) => col.enable_summary);
|
|
284
|
-
let dataToExport = [...
|
|
302
|
+
let dataToExport = [...filtered];
|
|
285
303
|
|
|
286
304
|
if (summaryCols.length > 0) {
|
|
287
|
-
const summaryValues = calculateSummaryValues(summaryCols,
|
|
305
|
+
const summaryValues = calculateSummaryValues(summaryCols, filtered);
|
|
288
306
|
const summaryRow = { isSummaryRow: true };
|
|
289
307
|
|
|
290
308
|
cols.forEach((col) => {
|
|
@@ -310,22 +328,7 @@ export default function ReportingTable({
|
|
|
310
328
|
setExportData({ exportDatas });
|
|
311
329
|
}
|
|
312
330
|
}
|
|
313
|
-
}, [
|
|
314
|
-
|
|
315
|
-
let filtered = patients;
|
|
316
|
-
if (patients && query) {
|
|
317
|
-
filtered = patients.filter((record) => {
|
|
318
|
-
let keys = Object.keys(record);
|
|
319
|
-
let flag = false;
|
|
320
|
-
keys.forEach((key) => {
|
|
321
|
-
let ele = record[key];
|
|
322
|
-
if (ele && typeof ele === 'string' && ele.toLowerCase().indexOf(query.toLowerCase()) !== -1) {
|
|
323
|
-
flag = true;
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
return flag;
|
|
327
|
-
});
|
|
328
|
-
}
|
|
331
|
+
}, [filtered, columns]);
|
|
329
332
|
|
|
330
333
|
/**
|
|
331
334
|
* Handles successful QR scans by looking up a matching record and navigating
|
|
@@ -449,9 +452,11 @@ export default function ReportingTable({
|
|
|
449
452
|
{exportData.exportDatas && !isNuradesk && (
|
|
450
453
|
<ExportReactCSV
|
|
451
454
|
title={config.caption}
|
|
452
|
-
fileName={`${(config.caption || 'Report').trim().replace(/\s+/g, '_')}_${moment().format('YYYY-MM-DD-HH-mm-ss-SSS')}.xlsx`}
|
|
453
455
|
headers={exportData.exportDatas.exportDataHeaders}
|
|
454
456
|
csvData={exportData.exportDatas.exportDataColumns}
|
|
457
|
+
fileName={`${config.caption || 'Report'}.xlsx`}
|
|
458
|
+
pdfFileName={`${config.caption || 'Report'}.pdf`}
|
|
459
|
+
dropdown
|
|
455
460
|
/>
|
|
456
461
|
)}
|
|
457
462
|
</div>
|