@openmrs/esm-stock-management-app 1.0.1-pre.678 → 1.0.1-pre.680
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/690.js +1 -0
- package/dist/690.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 +57 -57
- 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/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
|
+
}
|