@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.
Files changed (39) hide show
  1. package/dist/172.js +1 -1
  2. package/dist/20.js +1 -1
  3. package/dist/26.js +1 -1
  4. package/dist/26.js.LICENSE.txt +20 -28
  5. package/dist/26.js.map +1 -1
  6. package/dist/273.js +2 -0
  7. package/dist/273.js.LICENSE.txt +40 -0
  8. package/dist/273.js.map +1 -0
  9. package/dist/290.js +1 -1
  10. package/dist/606.js +1 -1
  11. package/dist/627.js +1 -1
  12. package/dist/973.js +1 -0
  13. package/dist/973.js.map +1 -0
  14. package/dist/main.js +1 -1
  15. package/dist/main.js.map +1 -1
  16. package/dist/openmrs-esm-stock-management-app.js +1 -1
  17. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +61 -61
  18. package/dist/openmrs-esm-stock-management-app.js.map +1 -1
  19. package/dist/routes.json +1 -1
  20. package/package.json +1 -1
  21. package/src/stock-items/add-stock-item/transactions/transaction-filters/transaction-locations-filter.component.tsx +0 -1
  22. package/src/stock-items/add-stock-item/transactions/transactions.component.tsx +16 -47
  23. package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +18 -174
  24. package/src/stock-operations/add-stock-operation/add-stock-operation.scss +19 -0
  25. package/src/stock-operations/add-stock-operation/stock-operation-reference.component.tsx +38 -0
  26. package/src/stock-operations/add-stock-operation/stock-operation-related-link.component.tsx +38 -0
  27. package/src/stock-operations/add-stock-operation/stock-operation-status.component.tsx +170 -0
  28. package/src/stock-operations/edit-stock-operation/edit-stock-operation-action-menu.component.tsx +1 -1
  29. package/src/stock-operations/stock-operations-table.component.tsx +17 -156
  30. package/src/stock-operations/stock-operations-table.scss +18 -0
  31. package/src/stock-reports/report-list/stock-report-parameters.component.tsx +44 -0
  32. package/src/stock-reports/report-list/stock-report-status.component.tsx +139 -0
  33. package/src/stock-reports/report-list/stock-reports.component.tsx +39 -26
  34. package/src/stock-reports/report-list/stock-reports.scss +18 -0
  35. package/dist/241.js +0 -1
  36. package/dist/241.js.map +0 -1
  37. package/dist/764.js +0 -2
  38. package/dist/764.js.LICENSE.txt +0 -32
  39. package/dist/764.js.map +0 -1
@@ -20,7 +20,7 @@ import StockOperationApproveDispatchButton from '../stock-operations-dialog/stoc
20
20
  import StockOperationCompleteDispatchButton from '../stock-operations-dialog/stock-operations-completed-dispatch-button.component';
21
21
  import StockOperationIssueStockButton from '../stock-operations-dialog/stock-operations-issue-stock-button.component';
22
22
  import { StockOperation } from './stock-operation-context/useStockOperationContext';
23
- import { formatDate, parseDate, showSnackbar } from '@openmrs/esm-framework';
23
+ import { showSnackbar } from '@openmrs/esm-framework';
24
24
  import {
25
25
  OperationType,
26
26
  StockOperationTypeIsStockIssue,
@@ -33,6 +33,8 @@ import { getStockOperationLinks, operationStatusColor } from '../stock-operation
33
33
  import styles from './add-stock-operation.scss';
34
34
  import { useStockOperationTypes } from '../../stock-lookups/stock-lookups.resource';
35
35
  import { StockOperationLinkDTO } from '../../core/api/types/stockOperation/StockOperationLinkDTO';
36
+ import StockOperationStatus from './stock-operation-status.component';
37
+ import StockOperationRelatedLink from './stock-operation-related-link.component';
36
38
 
37
39
  const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
38
40
  const { t } = useTranslation();
@@ -191,16 +193,10 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
191
193
  {!isEditing && props.operation.name === 'Stock Issue' ? (
192
194
  <></>
193
195
  ) : (
194
- <div
195
- style={{
196
- display: 'flex',
197
- justifyContent: 'space-between',
198
- margin: '5px',
199
- }}
200
- >
196
+ <div className={styles.statusBody}>
201
197
  <div style={{ margin: '10px' }}>
202
198
  {isEditing && (
203
- <div style={{ display: 'flex', flexDirection: 'row' }}>
199
+ <div className={styles.statusLabel}>
204
200
  <span className={styles.textHeading}>{t('status', 'Status ')}:</span>
205
201
  <span
206
202
  style={{
@@ -212,157 +208,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
212
208
  </span>
213
209
  </div>
214
210
  )}
215
- <div className={styles.statusContainer}>
216
- {props?.model?.dateCreated && (
217
- <div>
218
- <span className={styles.textHeading}>{t('started', 'Started')}:</span>
219
- <div className={styles.statusDescriptions}>
220
- <span className={styles.text}>
221
- {formatDate(parseDate(props?.model?.dateCreated.toString()), {
222
- time: true,
223
- mode: 'standard',
224
- })}
225
- </span>
226
-
227
- <span className={styles.text}>By</span>
228
-
229
- <span className={styles.text}>
230
- {props?.model?.creatorFamilyName} &nbsp;
231
- {props?.model?.creatorGivenName}
232
- </span>
233
- </div>
234
- </div>
235
- )}
236
-
237
- {props?.model?.submittedDate && (
238
- <div>
239
- <span className={styles.textHeading}>{t('submitted', 'Submitted')}:</span>
240
- <div className={styles.statusDescriptions}>
241
- <span className={styles.text}>
242
- {formatDate(parseDate(props?.model?.submittedDate.toString()), {
243
- time: true,
244
- mode: 'standard',
245
- })}
246
- </span>
247
-
248
- <span className={styles.text}>By</span>
249
-
250
- <span className={styles.text}>
251
- {props?.model?.submittedByFamilyName} &nbsp;
252
- {props?.model?.submittedByGivenName}
253
- </span>
254
- </div>
255
- </div>
256
- )}
257
-
258
- {props?.model?.dispatchedDate && (
259
- <div>
260
- <span className={styles.textHeading}>{t('dispatched', 'Dispatched')}:</span>
261
- <div className={styles.statusDescriptions}>
262
- <span className={styles.text}>
263
- {formatDate(parseDate(props?.model?.dispatchedDate.toString()), {
264
- time: true,
265
- mode: 'standard',
266
- })}
267
- </span>
268
-
269
- <span className={styles.text}>By</span>
270
-
271
- <span className={styles.text}>
272
- {props?.model?.dispatchedByFamilyName} &nbsp;
273
- {props?.model?.dispatchedByGivenName}
274
- </span>
275
- </div>
276
- </div>
277
- )}
278
-
279
- {props?.model?.returnedDate && (
280
- <div>
281
- <span className={styles.textHeading}>{t('returned', 'Returned')}:</span>
282
- <div className={styles.statusDescriptions}>
283
- <span className={styles.text}>
284
- {formatDate(parseDate(props?.model?.returnedDate.toString()), {
285
- time: true,
286
- mode: 'standard',
287
- })}
288
- </span>
289
-
290
- <span className={styles.text}>By</span>
291
-
292
- <span className={styles.text}>
293
- {props?.model?.returnedByFamilyName} &nbsp;
294
- {props?.model?.returnedByGivenName}
295
- </span>
296
- <span className={styles.text}>{props?.model?.returnReason}</span>
297
- </div>
298
- </div>
299
- )}
300
-
301
- {props?.model?.completedDate && (
302
- <div>
303
- <span className={styles.textHeading}>{t('completed', 'Completed')}:</span>
304
- <div className={styles.statusDescriptions}>
305
- <span className={styles.text}>
306
- {formatDate(parseDate(props?.model?.completedDate.toString()), {
307
- time: true,
308
- mode: 'standard',
309
- })}
310
- </span>
311
-
312
- <span className={styles.text}>By</span>
313
-
314
- <span className={styles.text}>
315
- {props?.model?.completedByFamilyName} &nbsp;
316
- {props?.model?.completedByGivenName}
317
- </span>
318
- </div>
319
- </div>
320
- )}
321
-
322
- {props?.model?.status === 'CANCELLED' && (
323
- <div>
324
- <span className={styles.textHeading}>{t('cancelled', 'Cancelled')}:</span>
325
- <div className={styles.statusDescriptions}>
326
- <span className={styles.text}>
327
- {formatDate(parseDate(props?.model?.cancelledDate.toString()), {
328
- time: true,
329
- mode: 'standard',
330
- })}
331
- </span>
332
-
333
- <span className={styles.text}>By</span>
334
-
335
- <span className={styles.text}>
336
- {props?.model?.cancelledByFamilyName} &nbsp;
337
- {props?.model?.cancelledByGivenName}
338
- <span className={styles.text}>{props?.model?.cancelReason}</span>
339
- </span>
340
- </div>
341
- </div>
342
- )}
343
-
344
- {props?.model?.status === 'REJECTED' && (
345
- <div>
346
- <span className={styles.textHeading}>{t('rejected', 'Rejected')}:</span>
347
- <div className={styles.statusDescriptions}>
348
- <span className={styles.text}>
349
- {formatDate(parseDate(props?.model?.rejectedDate.toString()), {
350
- time: true,
351
- mode: 'standard',
352
- })}
353
- </span>
354
-
355
- <span className={styles.text}>By</span>
356
-
357
- <span className={styles.text}>
358
- {props?.model?.rejectedByFamilyName} &nbsp;
359
- {props?.model?.rejectedByGivenName}
360
- <span>{props?.model?.rejectionReason}</span>
361
- </span>
362
- </div>
363
- </div>
364
- )}
365
- </div>
211
+ <StockOperationStatus model={props?.model} />
366
212
  </div>
367
213
 
368
214
  {((!props?.model?.permission?.canEdit &&
@@ -452,13 +298,12 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
452
298
  <span> </span>
453
299
  {item?.childVoided && item?.childOperationNumber}
454
300
  {!item?.childVoided && (
455
- <span
456
- style={{
457
- marginLeft: '2px',
458
- color: '#0f62fe',
459
- }}
460
- >
461
- {item?.childOperationNumber}
301
+ <span className={styles.relatedLink}>
302
+ <StockOperationRelatedLink
303
+ operationTypes={types.results}
304
+ operationUuid={item?.childUuid}
305
+ operationNumber={item?.childOperationNumber}
306
+ />
462
307
  </span>
463
308
  )}
464
309
  </span>
@@ -477,13 +322,12 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
477
322
  <span> </span>
478
323
  {item?.parentVoided && item?.parentOperationNumber}
479
324
  {!item?.parentVoided && (
480
- <span
481
- style={{
482
- marginLeft: '2px',
483
- color: '#0f62fe',
484
- }}
485
- >
486
- {item?.parentOperationNumber}
325
+ <span className={styles.relatedLink}>
326
+ <StockOperationRelatedLink
327
+ operationTypes={types.results}
328
+ operationUuid={item?.parentUuid}
329
+ operationNumber={item?.parentOperationNumber}
330
+ />
487
331
  </span>
488
332
  )}
489
333
  </span>
@@ -1,6 +1,7 @@
1
1
  @use '@carbon/layout';
2
2
  @use '@carbon/type';
3
3
  @use '~@openmrs/esm-styleguide/src/vars' as *;
4
+
4
5
  .sectionTitle {
5
6
  @include type.type-style('heading-compact-02');
6
7
  color: $text-02;
@@ -29,6 +30,7 @@
29
30
 
30
31
  .statusDescriptions {
31
32
  margin-top: 4px;
33
+
32
34
  .text {
33
35
  margin-right: 4px;
34
36
  }
@@ -39,3 +41,20 @@
39
41
  display: flex;
40
42
  flex-direction: row;
41
43
  }
44
+
45
+ .statusLabel {
46
+ display: flex;
47
+ flex-direction: row;
48
+ margin-left: 10px;
49
+ }
50
+
51
+ .statusBody {
52
+ display: flex;
53
+ justify-content: space-between;
54
+ margin: 5px;
55
+ }
56
+
57
+ .relatedLink {
58
+ margin-left: 2px;
59
+ color: #0f62fe;
60
+ }
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { StockOperationDTO } from '../../core/api/types/stockOperation/StockOperationDTO';
3
+ import { launchAddOrEditDialog } from '../stock-operation.utils';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { getStockOperation } from '../stock-operations.resource';
6
+ import { useStockOperationTypes } from '../../stock-lookups/stock-lookups.resource';
7
+
8
+ interface StockOperationReferenceProps {
9
+ operationUuid: string;
10
+ operationNumber: string;
11
+ }
12
+
13
+ const StockOperationReference = (props: StockOperationReferenceProps) => {
14
+ const { t } = useTranslation();
15
+ const { types } = useStockOperationTypes();
16
+
17
+ let model: StockOperationDTO;
18
+
19
+ getStockOperation(props?.operationUuid).then((resp) => {
20
+ model = resp.data;
21
+ });
22
+
23
+ const handleEdit = () => {
24
+ const operation = types.results?.find((op) => op?.uuid === model?.operationTypeUuid);
25
+
26
+ if (!operation) {
27
+ return;
28
+ }
29
+ launchAddOrEditDialog(t, model, true, operation, types?.results, false);
30
+ };
31
+ return (
32
+ <a onClick={handleEdit} style={{ cursor: 'pointer' }}>
33
+ {props?.operationNumber}
34
+ </a>
35
+ );
36
+ };
37
+
38
+ export default StockOperationReference;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { StockOperationDTO } from '../../core/api/types/stockOperation/StockOperationDTO';
4
+ import { StockOperationType } from '../../core/api/types/stockOperation/StockOperationType';
5
+ import { launchAddOrEditDialog } from '../stock-operation.utils';
6
+ import { getStockOperation } from '../stock-operations.resource';
7
+
8
+ interface StockOperationRelatedLinkProps {
9
+ operationTypes: StockOperationType[];
10
+ operationUuid: string;
11
+ operationNumber: string;
12
+ }
13
+
14
+ const StockOperationRelatedLink = (props: StockOperationRelatedLinkProps) => {
15
+ const { t } = useTranslation();
16
+ const operationTypes = props?.operationTypes;
17
+ let model: StockOperationDTO;
18
+
19
+ getStockOperation(props?.operationUuid).then((resp) => {
20
+ model = resp.data;
21
+ });
22
+
23
+ const handleEdit = () => {
24
+ const operation = operationTypes?.find((op) => op?.uuid === model?.operationTypeUuid);
25
+
26
+ if (!operation) {
27
+ return;
28
+ }
29
+ launchAddOrEditDialog(t, model, true, operation, operationTypes, false);
30
+ };
31
+ return (
32
+ <span onClick={handleEdit} style={{ cursor: 'pointer', textDecoration: 'underline' }}>
33
+ {props?.operationNumber}
34
+ </span>
35
+ );
36
+ };
37
+
38
+ export default StockOperationRelatedLink;
@@ -0,0 +1,170 @@
1
+ import { useTranslation } from 'react-i18next';
2
+ import { StockOperationDTO } from '../../core/api/types/stockOperation/StockOperationDTO';
3
+ import React from 'react';
4
+ import { formatDate, parseDate } from '@openmrs/esm-framework';
5
+ import styles from '../stock-operations-table.scss';
6
+
7
+ interface StockOperationStatusProps {
8
+ model: StockOperationDTO;
9
+ }
10
+
11
+ const StockOperationStatus: React.FC<StockOperationStatusProps> = (props) => {
12
+ const { t } = useTranslation();
13
+ return (
14
+ <>
15
+ <div className={styles.statusContainer}>
16
+ {props.model?.dateCreated && (
17
+ <div>
18
+ <span className={styles.textHeading}>{t('started', 'Started')}:</span>
19
+ <div className={styles.statusDescriptions}>
20
+ <span className={styles.text}>
21
+ {formatDate(parseDate(props.model?.dateCreated.toString()), {
22
+ time: true,
23
+ mode: 'standard',
24
+ })}
25
+ </span>
26
+
27
+ <span className={styles.text}>{t('by', 'By')}</span>
28
+
29
+ <span className={styles.text}>
30
+ {props.model?.creatorFamilyName} &nbsp;
31
+ {props.model?.creatorGivenName}
32
+ </span>
33
+ </div>
34
+ </div>
35
+ )}
36
+
37
+ {props.model.submittedDate && (
38
+ <div>
39
+ <span className={styles.textHeading}>{t('submitted', 'Submitted')}:</span>
40
+ <div className={styles.statusDescriptions}>
41
+ <span className={styles.text}>
42
+ {formatDate(parseDate(props.model?.submittedDate.toString()), {
43
+ time: true,
44
+ mode: 'standard',
45
+ })}
46
+ </span>
47
+
48
+ <span className={styles.text}>{t('by', 'By')}</span>
49
+
50
+ <span className={styles.text}>
51
+ {props.model?.submittedByFamilyName} &nbsp;
52
+ {props.model?.submittedByGivenName}
53
+ </span>
54
+ </div>
55
+ </div>
56
+ )}
57
+
58
+ {props.model?.dispatchedDate && (
59
+ <div>
60
+ <span className={styles.textHeading}>{t('dispatched', 'Dispatched')}:</span>
61
+ <div className={styles.statusDescriptions}>
62
+ <span className={styles.text}>
63
+ {formatDate(parseDate(props.model?.dispatchedDate.toString()), {
64
+ time: true,
65
+ mode: 'standard',
66
+ })}
67
+ </span>
68
+
69
+ <span className={styles.text}>{t('by', 'By')}</span>
70
+
71
+ <span className={styles.text}>
72
+ {props.model?.dispatchedByFamilyName} &nbsp;
73
+ {props.model?.dispatchedByGivenName}
74
+ </span>
75
+ </div>
76
+ </div>
77
+ )}
78
+
79
+ {props.model?.returnedDate && (
80
+ <div>
81
+ <span className={styles.textHeading}>{t('returned', 'Returned')}:</span>
82
+ <div className={styles.statusDescriptions}>
83
+ <span className={styles.text}>
84
+ {formatDate(parseDate(props.model?.returnedDate.toString()), {
85
+ time: true,
86
+ mode: 'standard',
87
+ })}
88
+ </span>
89
+
90
+ <span className={styles.text}>{t('by', 'By')}</span>
91
+
92
+ <span className={styles.text}>
93
+ {props.model?.returnedByFamilyName} &nbsp;
94
+ {props.model?.returnedByGivenName}
95
+ </span>
96
+ <span className={styles.text}>{props.model?.returnReason}</span>
97
+ </div>
98
+ </div>
99
+ )}
100
+
101
+ {props.model?.completedDate && (
102
+ <div>
103
+ <span className={styles.textHeading}>{t('completed', 'Completed')}:</span>
104
+ <div className={styles.statusDescriptions}>
105
+ <span className={styles.text}>
106
+ {formatDate(parseDate(props.model?.completedDate.toString()), {
107
+ time: true,
108
+ mode: 'standard',
109
+ })}
110
+ </span>
111
+
112
+ <span className={styles.text}>{t('by', 'By')}</span>
113
+
114
+ <span className={styles.text}>
115
+ {props.model?.completedByFamilyName} &nbsp;
116
+ {props.model?.completedByGivenName}
117
+ </span>
118
+ </div>
119
+ </div>
120
+ )}
121
+
122
+ {props.model?.status === 'CANCELLED' && (
123
+ <div>
124
+ <span className={styles.textHeading}>{t('cancelled', 'Cancelled')}:</span>
125
+ <div className={styles.statusDescriptions}>
126
+ <span className={styles.text}>
127
+ {formatDate(parseDate(props.model?.cancelledDate.toString()), {
128
+ time: true,
129
+ mode: 'standard',
130
+ })}
131
+ </span>
132
+
133
+ <span className={styles.text}>{t('by', 'By')}</span>
134
+
135
+ <span className={styles.text}>
136
+ {props.model?.cancelledByFamilyName} &nbsp;
137
+ {props.model?.cancelledByGivenName}
138
+ <span className={styles.text}>{props.model?.cancelReason}</span>
139
+ </span>
140
+ </div>
141
+ </div>
142
+ )}
143
+
144
+ {props.model?.status === 'REJECTED' && (
145
+ <div>
146
+ <span className={styles.textHeading}>{t('rejected', 'Rejected')}:</span>
147
+ <div className={styles.statusDescriptions}>
148
+ <span className={styles.text}>
149
+ {formatDate(parseDate(props.model?.rejectedDate.toString()), {
150
+ time: true,
151
+ mode: 'standard',
152
+ })}
153
+ </span>
154
+
155
+ <span className={styles.text}>{t('by', 'By')}</span>
156
+
157
+ <span className={styles.text}>
158
+ {props.model?.rejectedByFamilyName} &nbsp;
159
+ {props.model?.rejectedByGivenName}
160
+ <span>{props.model?.rejectionReason}</span>
161
+ </span>
162
+ </div>
163
+ </div>
164
+ )}
165
+ </div>
166
+ </>
167
+ );
168
+ };
169
+
170
+ export default StockOperationStatus;
@@ -25,7 +25,7 @@ const EditStockOperationActionMenu: React.FC<EditStockOperationActionMenuProps>
25
25
  const { t } = useTranslation();
26
26
 
27
27
  const handleEdit = () => {
28
- const operation = operations.find((op) => op.uuid === model.operationTypeUuid);
28
+ const operation = operations?.find((op) => op?.uuid === model?.operationTypeUuid);
29
29
  launchAddOrEditDialog(t, model, true, operation, operations, false);
30
30
  };
31
31