@openmrs/esm-stock-management-app 1.0.1-pre.678 → 1.0.1-pre.683
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/172.js +1 -1
- package/dist/20.js +1 -1
- package/dist/26.js +1 -1
- package/dist/26.js.LICENSE.txt +20 -28
- package/dist/26.js.map +1 -1
- package/dist/273.js +2 -0
- package/dist/273.js.LICENSE.txt +40 -0
- package/dist/273.js.map +1 -0
- package/dist/290.js +1 -1
- package/dist/606.js +1 -1
- package/dist/627.js +1 -1
- package/dist/973.js +1 -0
- package/dist/973.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +61 -61
- package/dist/openmrs-esm-stock-management-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/stock-items/add-stock-item/transactions/transaction-filters/transaction-locations-filter.component.tsx +0 -1
- package/src/stock-items/add-stock-item/transactions/transactions.component.tsx +16 -47
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +18 -174
- package/src/stock-operations/add-stock-operation/add-stock-operation.scss +19 -0
- package/src/stock-operations/add-stock-operation/stock-operation-reference.component.tsx +38 -0
- package/src/stock-operations/add-stock-operation/stock-operation-related-link.component.tsx +38 -0
- package/src/stock-operations/add-stock-operation/stock-operation-status.component.tsx +170 -0
- package/src/stock-operations/edit-stock-operation/edit-stock-operation-action-menu.component.tsx +1 -1
- package/src/stock-operations/stock-operations-table.component.tsx +17 -156
- package/src/stock-operations/stock-operations-table.scss +18 -0
- package/src/stock-reports/report-list/stock-report-parameters.component.tsx +44 -0
- package/src/stock-reports/report-list/stock-report-status.component.tsx +139 -0
- package/src/stock-reports/report-list/stock-reports.component.tsx +39 -26
- package/src/stock-reports/report-list/stock-reports.scss +18 -0
- package/dist/241.js +0 -1
- package/dist/241.js.map +0 -1
- package/dist/764.js +0 -2
- package/dist/764.js.LICENSE.txt +0 -32
- package/dist/764.js.map +0 -1
@@ -20,26 +20,15 @@ import {
|
|
20
20
|
TableToolbarContent,
|
21
21
|
TableToolbarSearch,
|
22
22
|
Tile,
|
23
|
-
StructuredListHead,
|
24
|
-
StructuredListRow,
|
25
|
-
StructuredListCell,
|
26
|
-
StructuredListBody,
|
27
23
|
DatePickerInput,
|
28
24
|
DatePicker,
|
29
25
|
TableToolbarMenu,
|
30
26
|
TableToolbarAction,
|
31
|
-
Button,
|
32
27
|
InlineLoading,
|
33
28
|
} from '@carbon/react';
|
34
|
-
import { ArrowRight
|
29
|
+
import { ArrowRight } from '@carbon/react/icons';
|
35
30
|
import { formatDisplayDate } from '../core/utils/datetimeUtils';
|
36
|
-
import {
|
37
|
-
StockOperationStatusCancelled,
|
38
|
-
StockOperationStatusNew,
|
39
|
-
StockOperationStatusRejected,
|
40
|
-
StockOperationStatusReturned,
|
41
|
-
} from '../core/api/types/stockOperation/StockOperationStatus';
|
42
|
-
import { isDesktop, restBaseUrl, useConfig, showModal } from '@openmrs/esm-framework';
|
31
|
+
import { isDesktop, restBaseUrl } from '@openmrs/esm-framework';
|
43
32
|
import StockOperationTypesSelector from './stock-operation-types-selector/stock-operation-types-selector.component';
|
44
33
|
import { launchAddOrEditDialog } from './stock-operation.utils';
|
45
34
|
import { initialStockOperationValue } from '../core/utils/utils';
|
@@ -51,6 +40,7 @@ import { DATE_PICKER_CONTROL_FORMAT, DATE_PICKER_FORMAT, StockFilters } from '..
|
|
51
40
|
import { handleMutate } from '../utils';
|
52
41
|
|
53
42
|
import styles from './stock-operations-table.scss';
|
43
|
+
import StockOperationStatus from './add-stock-operation/stock-operation-status.component';
|
54
44
|
|
55
45
|
interface StockOperationsTableProps {
|
56
46
|
status?: string;
|
@@ -164,94 +154,15 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
164
154
|
destination: `${stockOperation?.destinationName ?? ''}`,
|
165
155
|
location: (
|
166
156
|
<>
|
167
|
-
{
|
168
|
-
{stockOperation?.sourceName ?? ''}{' '}
|
157
|
+
{stockOperation?.sourceName ?? ''}
|
169
158
|
{stockOperation?.sourceName && stockOperation?.destinationName ? <ArrowRight size={16} /> : ''}{' '}
|
170
|
-
{stockOperation?.destinationName ?? ''}
|
159
|
+
{stockOperation?.destinationName ?? ''}
|
171
160
|
</>
|
172
161
|
),
|
173
162
|
responsiblePerson: `${
|
174
163
|
stockOperation?.responsiblePersonFamilyName ?? stockOperation?.responsiblePersonOther ?? ''
|
175
164
|
} ${stockOperation?.responsiblePersonGivenName ?? ''}`,
|
176
165
|
operationDate: formatDisplayDate(stockOperation?.operationDate),
|
177
|
-
details: (
|
178
|
-
<div className="tbl-expand-display-fields">
|
179
|
-
<div className="field-label">
|
180
|
-
<span className="field-title"> {t('created', 'Created')}</span>
|
181
|
-
<span className="field-desc">
|
182
|
-
<span className="action-date">{formatDisplayDate(stockOperation?.dateCreated)}</span> {t('by', 'By')}
|
183
|
-
<span className="action-by">
|
184
|
-
{stockOperation.creatorFamilyName ?? ''} {stockOperation.creatorGivenName ?? ''}
|
185
|
-
</span>
|
186
|
-
</span>
|
187
|
-
</div>
|
188
|
-
{stockOperation?.status !== StockOperationStatusNew &&
|
189
|
-
stockOperation?.status !== StockOperationStatusReturned &&
|
190
|
-
stockOperation?.submittedDate && (
|
191
|
-
<div className="field-label">
|
192
|
-
<span className="field-title">{t('submitted', 'Submitted')}</span>
|
193
|
-
<span className="field-desc">
|
194
|
-
<span className="action-date">{formatDisplayDate(stockOperation?.submittedDate)}</span>{' '}
|
195
|
-
{t('by', 'By')}
|
196
|
-
<span className="action-by">
|
197
|
-
{stockOperation.submittedByFamilyName ?? ''} {stockOperation.submittedByGivenName ?? ''}
|
198
|
-
</span>
|
199
|
-
</span>
|
200
|
-
</div>
|
201
|
-
)}
|
202
|
-
|
203
|
-
{stockOperation?.completedDate && (
|
204
|
-
<div className="field-label">
|
205
|
-
<span className="field-title">{t('completed', 'Completed')}</span>
|
206
|
-
<span className="field-desc">
|
207
|
-
<span className="action-date">{formatDisplayDate(stockOperation?.completedDate)}</span> {t('by', 'By')}
|
208
|
-
<span className="action-by">
|
209
|
-
{stockOperation.completedByFamilyName ?? ''} {stockOperation.completedByGivenName ?? ''}
|
210
|
-
</span>
|
211
|
-
</span>
|
212
|
-
</div>
|
213
|
-
)}
|
214
|
-
|
215
|
-
{stockOperation?.status === StockOperationStatusCancelled && (
|
216
|
-
<div className="field-label">
|
217
|
-
<span className="field-title"> {t('cancelled', 'Cancelled')}</span>
|
218
|
-
<span className="field-desc">
|
219
|
-
<span className="action-date">{formatDisplayDate(stockOperation?.cancelledDate)}</span> {t('by', 'By')}
|
220
|
-
<span className="action-by">
|
221
|
-
{stockOperation.cancelledByFamilyName ?? ''} {stockOperation.cancelledByGivenName ?? ''}
|
222
|
-
</span>
|
223
|
-
<p>{stockOperation.cancelReason}</p>
|
224
|
-
</span>
|
225
|
-
</div>
|
226
|
-
)}
|
227
|
-
|
228
|
-
{stockOperation?.status === StockOperationStatusRejected && (
|
229
|
-
<div className="field-label">
|
230
|
-
<span className="field-title">Rejected</span>
|
231
|
-
<span className="field-desc">
|
232
|
-
<span className="action-date">{formatDisplayDate(stockOperation?.rejectedDate)}</span> {t('by', 'By')}
|
233
|
-
<span className="action-by">
|
234
|
-
{stockOperation.rejectedByFamilyName ?? ''} {stockOperation.rejectedByGivenName ?? ''}
|
235
|
-
</span>
|
236
|
-
<p>{stockOperation.rejectionReason}</p>
|
237
|
-
</span>
|
238
|
-
</div>
|
239
|
-
)}
|
240
|
-
|
241
|
-
{stockOperation?.status === StockOperationStatusReturned && (
|
242
|
-
<div className="field-label">
|
243
|
-
<span className="field-title">Returned</span>
|
244
|
-
<span className="field-desc">
|
245
|
-
<span className="action-date">{formatDisplayDate(stockOperation?.returnedDate)}</span> By
|
246
|
-
<span className="action-by">
|
247
|
-
{stockOperation.returnedByFamilyName ?? ''} {stockOperation.returnedByGivenName ?? ''}
|
248
|
-
</span>
|
249
|
-
<p>{stockOperation.returnReason}</p>
|
250
|
-
</span>
|
251
|
-
</div>
|
252
|
-
)}
|
253
|
-
</div>
|
254
|
-
),
|
255
166
|
actions: (
|
256
167
|
<EditStockOperationActionMenu
|
257
168
|
model={stockOperation}
|
@@ -264,7 +175,7 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
264
175
|
/>
|
265
176
|
),
|
266
177
|
}));
|
267
|
-
}, [items, operations,
|
178
|
+
}, [items, operations, handleEditClick, operation]);
|
268
179
|
|
269
180
|
if (isLoading && !filterApplied) {
|
270
181
|
return (
|
@@ -358,74 +269,24 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
358
269
|
</TableRow>
|
359
270
|
</TableHead>
|
360
271
|
<TableBody>
|
361
|
-
{rows
|
272
|
+
{rows?.map((row: any, index) => {
|
362
273
|
return (
|
363
274
|
<React.Fragment key={row.id}>
|
364
275
|
<TableExpandRow
|
365
276
|
className={isDesktop ? styles.desktopRow : styles.tabletRow}
|
366
277
|
{...getRowProps({ row })}
|
367
278
|
>
|
368
|
-
{row.cells.map(
|
369
|
-
|
370
|
-
|
371
|
-
)}
|
279
|
+
{row.cells.map((cell) => (
|
280
|
+
<TableCell key={cell.id}>{cell.value}</TableCell>
|
281
|
+
))}
|
372
282
|
</TableExpandRow>
|
373
|
-
|
374
|
-
|
375
|
-
<
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
</StructuredListHead>
|
381
|
-
<StructuredListBody>
|
382
|
-
<StructuredListRow>
|
383
|
-
<StructuredListCell noWrap>
|
384
|
-
{items[index]?.dateCreated ? formatDisplayDate(items[index]?.dateCreated) : ''}
|
385
|
-
|
386
|
-
{items[index]?.dateCreated ? 'By' : ''}
|
387
|
-
|
388
|
-
{items[index]?.dateCreated ? items[index]?.creatorFamilyName : ''}
|
389
|
-
</StructuredListCell>
|
390
|
-
<StructuredListCell>
|
391
|
-
{items[index]?.completedDate ? formatDisplayDate(items[index]?.completedDate) : ''}
|
392
|
-
|
393
|
-
{items[index]?.completedDate ? 'By' : ''}
|
394
|
-
|
395
|
-
{items[index]?.completedDate ? items[index]?.creatorFamilyName : ''}
|
396
|
-
</StructuredListCell>
|
397
|
-
</StructuredListRow>
|
398
|
-
<StructuredListRow>
|
399
|
-
<StructuredListCell noWrap>
|
400
|
-
{items[index]?.stockOperationItems.map((item) => item.quantity)[1]
|
401
|
-
? formatDisplayDate(items[index]?.dateCreated)
|
402
|
-
: ''}
|
403
|
-
|
404
|
-
{items[index]?.stockOperationItems.map((item) => item.quantity)[1] ? 'By' : ''}
|
405
|
-
|
406
|
-
{items[index]?.stockOperationItems.map((item) => item.quantity)[1]
|
407
|
-
? items[index]?.creatorFamilyName
|
408
|
-
: ''}
|
409
|
-
</StructuredListCell>
|
410
|
-
<StructuredListCell>
|
411
|
-
{items[index]?.stockOperationItems.map((item) => item.quantity)[1]
|
412
|
-
? formatDisplayDate(items[index]?.completedDate)
|
413
|
-
: ''}
|
414
|
-
|
415
|
-
{items[index]?.stockOperationItems.map((item) => item.quantity)[1] &&
|
416
|
-
items[index]?.completedDate
|
417
|
-
? 'By'
|
418
|
-
: ''}
|
419
|
-
|
420
|
-
{items[index]?.stockOperationItems.map((item) => item.quantity)[1] &&
|
421
|
-
items[index]?.completedDate
|
422
|
-
? items[index]?.creatorFamilyName
|
423
|
-
: ''}
|
424
|
-
</StructuredListCell>
|
425
|
-
</StructuredListRow>
|
426
|
-
</StructuredListBody>
|
427
|
-
</>
|
428
|
-
</TableExpandedRow>
|
283
|
+
{row.isExpanded ? (
|
284
|
+
<TableExpandedRow colSpan={headers.length + 2}>
|
285
|
+
<StockOperationStatus model={items[index]} />
|
286
|
+
</TableExpandedRow>
|
287
|
+
) : (
|
288
|
+
<TableExpandedRow className={styles.hiddenRow} colSpan={headers.length + 2} />
|
289
|
+
)}
|
429
290
|
</React.Fragment>
|
430
291
|
);
|
431
292
|
})}
|
@@ -58,3 +58,21 @@
|
|
58
58
|
margin: auto;
|
59
59
|
width: 20%;
|
60
60
|
}
|
61
|
+
|
62
|
+
.statusContainer {
|
63
|
+
display: flex;
|
64
|
+
margin: 10px;
|
65
|
+
gap: 1rem;
|
66
|
+
}
|
67
|
+
|
68
|
+
.textHeading {
|
69
|
+
font-weight: bold;
|
70
|
+
}
|
71
|
+
|
72
|
+
.statusDescriptions {
|
73
|
+
margin-top: 4px;
|
74
|
+
|
75
|
+
.text {
|
76
|
+
margin-right: 4px;
|
77
|
+
}
|
78
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { parseParametersToMap } from '../../core/api/types/BatchJob';
|
3
|
+
interface StockReportParametersProps {
|
4
|
+
model: any;
|
5
|
+
}
|
6
|
+
|
7
|
+
const StockReportParameters = (props: StockReportParametersProps) => {
|
8
|
+
let parameterMap: React.ReactNode;
|
9
|
+
|
10
|
+
const displayParameterMap = (
|
11
|
+
batchJobUuid: string,
|
12
|
+
parameterMap: { [key: string]: { [key: string]: string } } | null,
|
13
|
+
): React.ReactNode => {
|
14
|
+
if (!parameterMap) {
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
const objectKeys: string[] = Object.keys(parameterMap);
|
18
|
+
if (objectKeys.length === 0) {
|
19
|
+
return null;
|
20
|
+
}
|
21
|
+
return objectKeys.map((key, index) => {
|
22
|
+
const displayField: string = parameterMap[key]['description'] ?? key;
|
23
|
+
const displayValue: string = parameterMap[key]['display'] ?? parameterMap[key]['value'];
|
24
|
+
return (
|
25
|
+
<div key={`${batchJobUuid}-param-${index}`}>
|
26
|
+
{displayField}: {displayValue}
|
27
|
+
</div>
|
28
|
+
);
|
29
|
+
});
|
30
|
+
};
|
31
|
+
|
32
|
+
try {
|
33
|
+
parameterMap = displayParameterMap(
|
34
|
+
props.model?.uuid,
|
35
|
+
parseParametersToMap(props.model?.parameters, ['param.report']),
|
36
|
+
);
|
37
|
+
} catch (ex) {
|
38
|
+
console.log(ex);
|
39
|
+
}
|
40
|
+
|
41
|
+
return <span>{parameterMap}</span>;
|
42
|
+
};
|
43
|
+
|
44
|
+
export default StockReportParameters;
|
@@ -0,0 +1,139 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import styles from './stock-reports.scss';
|
3
|
+
import { formatDate, parseDate } from '@openmrs/esm-framework';
|
4
|
+
import { BatchJobStatusCancelled, parseParametersToMap } from '../../core/api/types/BatchJob';
|
5
|
+
import { useTranslation } from 'react-i18next';
|
6
|
+
|
7
|
+
interface StockReportStatusProps {
|
8
|
+
model: any;
|
9
|
+
}
|
10
|
+
|
11
|
+
const StockReportStatus = (props: StockReportStatusProps) => {
|
12
|
+
const { t } = useTranslation();
|
13
|
+
let executionStateMap: React.ReactNode;
|
14
|
+
|
15
|
+
const displayParameterMap = (
|
16
|
+
batchJobUuid: string,
|
17
|
+
parameterMap: { [key: string]: { [key: string]: string } } | null,
|
18
|
+
): React.ReactNode => {
|
19
|
+
if (!parameterMap) {
|
20
|
+
return null;
|
21
|
+
}
|
22
|
+
const objectKeys: string[] = Object.keys(parameterMap);
|
23
|
+
if (objectKeys.length === 0) {
|
24
|
+
return null;
|
25
|
+
}
|
26
|
+
return objectKeys.map((key, index) => {
|
27
|
+
const displayField: string = parameterMap[key]['description'] ?? key;
|
28
|
+
const displayValue: string = parameterMap[key]['display'] ?? parameterMap[key]['value'];
|
29
|
+
return (
|
30
|
+
<div key={`${batchJobUuid}-param-${index}`}>
|
31
|
+
{displayField}: {displayValue}
|
32
|
+
</div>
|
33
|
+
);
|
34
|
+
});
|
35
|
+
};
|
36
|
+
|
37
|
+
try {
|
38
|
+
executionStateMap = displayParameterMap(props.model?.uuid, parseParametersToMap(props.model?.executionState));
|
39
|
+
} catch (ex) {
|
40
|
+
console.log(ex);
|
41
|
+
}
|
42
|
+
return (
|
43
|
+
<div className={styles.statusContainer}>
|
44
|
+
{/* cancelled */}
|
45
|
+
{props.model?.status === BatchJobStatusCancelled && (
|
46
|
+
<div>
|
47
|
+
<span className={styles.textHeading}>{t('cancelled', 'Cancelled')}:</span>
|
48
|
+
<div className={styles.statusDescriptions}>
|
49
|
+
<span className={styles.text}>
|
50
|
+
{formatDate(parseDate(props.model?.cancelledDate.toString()), {
|
51
|
+
time: true,
|
52
|
+
mode: 'standard',
|
53
|
+
})}
|
54
|
+
<p>{props.model?.cancelReason}</p>
|
55
|
+
</span>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
)}
|
59
|
+
{/* start time */}
|
60
|
+
{props.model?.startTime && (
|
61
|
+
<div>
|
62
|
+
<span className={styles.textHeading}>{t('started', 'Started')}:</span>
|
63
|
+
<div className={styles.statusDescriptions}>
|
64
|
+
<span className={styles.text}>
|
65
|
+
{formatDate(parseDate(props.model?.startTime.toString()), {
|
66
|
+
time: true,
|
67
|
+
mode: 'standard',
|
68
|
+
})}
|
69
|
+
</span>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
)}
|
73
|
+
{/* endTime */}
|
74
|
+
{props.model?.endTime && (
|
75
|
+
<div>
|
76
|
+
<span className={styles.textHeading}>{t('ended', 'Ended')}:</span>
|
77
|
+
<div className={styles.statusDescriptions}>
|
78
|
+
<span className={styles.text}>
|
79
|
+
{formatDate(parseDate(props.model?.endTime.toString()), {
|
80
|
+
time: true,
|
81
|
+
mode: 'standard',
|
82
|
+
})}
|
83
|
+
</span>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
)}
|
87
|
+
{/* expiration */}
|
88
|
+
{props.model?.expiration && (
|
89
|
+
<div>
|
90
|
+
<span className={styles.textHeading}>{t('expires', 'Expires')}:</span>
|
91
|
+
<div className={styles.statusDescriptions}>
|
92
|
+
<span className={styles.text}>
|
93
|
+
{formatDate(parseDate(props.model?.expiration.toString()), {
|
94
|
+
time: true,
|
95
|
+
mode: 'standard',
|
96
|
+
})}
|
97
|
+
</span>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
)}
|
101
|
+
{/* executionMap */}
|
102
|
+
{executionStateMap && (
|
103
|
+
<div>
|
104
|
+
<span className={styles.textHeading}>{t('executionState', 'Execution State')}:</span>
|
105
|
+
<div className={styles.statusDescriptions}>
|
106
|
+
<span className={styles.text}>{executionStateMap}</span>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
)}
|
110
|
+
{/* completedDate */}
|
111
|
+
{props.model?.completedDate && (
|
112
|
+
<div>
|
113
|
+
<span className={styles.textHeading}>{t('completed', 'Completed')}:</span>
|
114
|
+
<div className={styles.statusDescriptions}>
|
115
|
+
<span className={styles.text}>
|
116
|
+
{formatDate(parseDate(props.model?.completedDate.toString()), {
|
117
|
+
time: true,
|
118
|
+
mode: 'standard',
|
119
|
+
})}
|
120
|
+
</span>
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
)}
|
124
|
+
{/* exitMessage */}
|
125
|
+
{props.model?.exitMessage && (
|
126
|
+
<div>
|
127
|
+
<span className={styles.textHeading}>{t('exitMessage', 'Message')}:</span>
|
128
|
+
<div className={styles.statusDescriptions}>
|
129
|
+
<span className={styles.text}>
|
130
|
+
<p>{props.model?.exitMessage}</p>
|
131
|
+
</span>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
)}
|
135
|
+
</div>
|
136
|
+
);
|
137
|
+
};
|
138
|
+
|
139
|
+
export default StockReportStatus;
|
@@ -20,6 +20,9 @@ import {
|
|
20
20
|
InlineLoading,
|
21
21
|
TableToolbarMenu,
|
22
22
|
TableToolbarAction,
|
23
|
+
TableExpandHeader,
|
24
|
+
TableExpandRow,
|
25
|
+
TableExpandedRow,
|
23
26
|
} from '@carbon/react';
|
24
27
|
import { isDesktop, restBaseUrl, useSession } from '@openmrs/esm-framework';
|
25
28
|
import NewReportActionButton from './new-report-button.component';
|
@@ -49,6 +52,8 @@ import {
|
|
49
52
|
} from '@carbon/react/icons';
|
50
53
|
import { handleMutate } from '../../utils';
|
51
54
|
import { PrivilagedView } from '../../core/components/privilages-component/privilages.component';
|
55
|
+
import StockReportStatus from './stock-report-status.component';
|
56
|
+
import StockReportParameters from './stock-report-parameters.component';
|
52
57
|
|
53
58
|
const StockReports: React.FC = () => {
|
54
59
|
const { t } = useTranslation();
|
@@ -111,16 +116,16 @@ const StockReports: React.FC = () => {
|
|
111
116
|
}, []);
|
112
117
|
|
113
118
|
const tableRows = useMemo(() => {
|
114
|
-
return reports?.map((batchJob) => ({
|
119
|
+
return reports?.map((batchJob, index) => ({
|
115
120
|
...batchJob,
|
116
121
|
checkbox: 'isBatchJobActive',
|
117
122
|
id: batchJob?.uuid,
|
118
123
|
key: `key-${batchJob?.uuid}`,
|
119
124
|
uuid: `${batchJob?.uuid}`,
|
120
|
-
batchJobType: batchJob
|
125
|
+
batchJobType: batchJob?.batchJobType,
|
121
126
|
dateRequested: formatDisplayDateTime(batchJob.dateCreated),
|
122
|
-
parameters:
|
123
|
-
report: batchJob
|
127
|
+
parameters: <StockReportParameters model={reports[index]} />,
|
128
|
+
report: batchJob?.description,
|
124
129
|
requestedBy: batchJob?.owners?.map((p, index) => (
|
125
130
|
<div key={`${batchJob.uuid}-owner-${index}`}>{`${p.ownerFamilyName} ${p.ownerGivenName}`}</div>
|
126
131
|
)),
|
@@ -218,34 +223,42 @@ const StockReports: React.FC = () => {
|
|
218
223
|
<Table {...getTableProps()}>
|
219
224
|
<TableHead>
|
220
225
|
<TableRow>
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
),
|
235
|
-
)}
|
226
|
+
<TableExpandHeader />
|
227
|
+
{headers.map((header: any) => (
|
228
|
+
<TableHeader
|
229
|
+
{...getHeaderProps({
|
230
|
+
header,
|
231
|
+
isSortable: header.isSortable,
|
232
|
+
})}
|
233
|
+
className={isDesktop ? styles.desktopHeader : styles.tabletHeader}
|
234
|
+
key={`${header.key}`}
|
235
|
+
>
|
236
|
+
{header.header?.content ?? header.header}
|
237
|
+
</TableHeader>
|
238
|
+
))}
|
236
239
|
<TableHeader></TableHeader>
|
237
240
|
</TableRow>
|
238
241
|
</TableHead>
|
239
242
|
<TableBody>
|
240
|
-
{rows.map((row: any) => {
|
243
|
+
{rows.map((row: any, index) => {
|
241
244
|
return (
|
242
245
|
<React.Fragment key={row.id}>
|
243
|
-
<
|
244
|
-
{
|
245
|
-
|
246
|
-
|
247
|
-
)
|
248
|
-
|
246
|
+
<TableExpandRow
|
247
|
+
className={isDesktop ? styles.desktopRow : styles.tabletRow}
|
248
|
+
{...getRowProps({ row })}
|
249
|
+
>
|
250
|
+
{row.cells.map((cell: any) => (
|
251
|
+
<TableCell key={cell.id}>{cell.value}</TableCell>
|
252
|
+
))}
|
253
|
+
</TableExpandRow>
|
254
|
+
|
255
|
+
{row.isExpanded ? (
|
256
|
+
<TableExpandedRow colSpan={headers.length + 2}>
|
257
|
+
<StockReportStatus model={reports[index]} />
|
258
|
+
</TableExpandedRow>
|
259
|
+
) : (
|
260
|
+
<TableExpandedRow className={styles.hiddenRow} colSpan={headers.length + 2} />
|
261
|
+
)}
|
249
262
|
</React.Fragment>
|
250
263
|
);
|
251
264
|
})}
|
@@ -60,3 +60,21 @@
|
|
60
60
|
flex-direction: column;
|
61
61
|
align-items: center;
|
62
62
|
}
|
63
|
+
|
64
|
+
.statusContainer {
|
65
|
+
display: flex;
|
66
|
+
margin: 10px;
|
67
|
+
gap: 1rem;
|
68
|
+
}
|
69
|
+
|
70
|
+
.textHeading {
|
71
|
+
font-weight: bold;
|
72
|
+
}
|
73
|
+
|
74
|
+
.statusDescriptions {
|
75
|
+
margin-top: 4px;
|
76
|
+
|
77
|
+
.text {
|
78
|
+
margin-right: 4px;
|
79
|
+
}
|
80
|
+
}
|