@openmrs/esm-dispensing-app 1.6.2 → 1.6.3-pre.3

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.
Files changed (190) hide show
  1. package/.turbo/cache/3973258467ef7c66-meta.json +1 -0
  2. package/.turbo/cache/3973258467ef7c66.tar.zst +0 -0
  3. package/.turbo/turbo-build.log +44 -0
  4. package/dist/1616.js +2 -0
  5. package/dist/{524.js.LICENSE.txt → 1616.js.LICENSE.txt} +9 -14
  6. package/dist/1616.js.map +1 -0
  7. package/dist/1637.js +1 -0
  8. package/dist/1637.js.map +1 -0
  9. package/dist/1644.js +1 -0
  10. package/dist/1901.js +1 -0
  11. package/dist/1905.js +1 -0
  12. package/dist/1905.js.map +1 -0
  13. package/dist/2016.js +1 -0
  14. package/dist/2511.js +1 -0
  15. package/dist/2511.js.map +1 -0
  16. package/dist/2757.js +1 -0
  17. package/dist/3574.js +1 -0
  18. package/dist/3652.js +1 -0
  19. package/dist/3935.js +2 -0
  20. package/dist/3935.js.map +1 -0
  21. package/dist/4272.js +1 -0
  22. package/dist/4378.js +1 -0
  23. package/dist/4460.js +1 -0
  24. package/dist/4705.js +1 -0
  25. package/dist/5240.js +1 -0
  26. package/dist/5336.js +1 -0
  27. package/dist/5673.js +1 -0
  28. package/dist/5711.js +1 -0
  29. package/dist/5737.js +1 -0
  30. package/dist/5833.js +1 -0
  31. package/dist/5962.js +1 -0
  32. package/dist/6497.js +1 -0
  33. package/dist/6566.js +1 -0
  34. package/dist/6582.js +1 -0
  35. package/dist/6582.js.map +1 -0
  36. package/dist/6727.js +1 -0
  37. package/dist/6868.js +2 -0
  38. package/dist/6868.js.LICENSE.txt +14 -0
  39. package/dist/6868.js.map +1 -0
  40. package/dist/6936.js +1 -0
  41. package/dist/6936.js.map +1 -0
  42. package/dist/6973.js +1 -0
  43. package/dist/6973.js.map +1 -0
  44. package/dist/7294.js +2 -0
  45. package/dist/7294.js.map +1 -0
  46. package/dist/7484.js +1 -0
  47. package/dist/7484.js.map +1 -0
  48. package/dist/7626.js +1 -0
  49. package/dist/7626.js.map +1 -0
  50. package/dist/7687.js +1 -0
  51. package/dist/7687.js.map +1 -0
  52. package/dist/7807.js +1 -0
  53. package/dist/7998.js +1 -0
  54. package/dist/8077.js +1 -0
  55. package/dist/8077.js.map +1 -0
  56. package/dist/8271.js +1 -0
  57. package/dist/8319.js +1 -0
  58. package/dist/8323.js +1 -0
  59. package/dist/8788.js +1 -0
  60. package/dist/8949.js +1 -0
  61. package/dist/8949.js.map +1 -0
  62. package/dist/9204.js +2 -0
  63. package/dist/{204.js.LICENSE.txt → 9204.js.LICENSE.txt} +2 -0
  64. package/dist/9204.js.map +1 -0
  65. package/dist/9261.js +1 -0
  66. package/dist/9579.js +1 -0
  67. package/dist/9870.js +2 -0
  68. package/dist/9870.js.LICENSE.txt +9 -0
  69. package/dist/9870.js.map +1 -0
  70. package/dist/main.js +1 -1
  71. package/dist/main.js.LICENSE.txt +21 -11
  72. package/dist/main.js.map +1 -1
  73. package/dist/openmrs-esm-dispensing-app.js +1 -1
  74. package/dist/openmrs-esm-dispensing-app.js.buildmanifest.json +455 -244
  75. package/dist/openmrs-esm-dispensing-app.js.map +1 -1
  76. package/dist/routes.json +1 -1
  77. package/jest.config.js +3 -1
  78. package/package.json +7 -4
  79. package/src/components/{action-buttons.component.test.tsx → action-buttons.test.tsx} +7 -7
  80. package/src/components/medication-card.component.tsx +3 -3
  81. package/src/components/medication-card.scss +8 -8
  82. package/src/components/medication-dispense-review.scss +10 -10
  83. package/src/components/medication-event.component.tsx +4 -4
  84. package/src/components/medication-event.scss +10 -5
  85. package/src/components/patient-details.component.tsx +4 -4
  86. package/src/components/patient-details.scss +12 -12
  87. package/src/components/prescription-actions/close-action-button.component.tsx +1 -1
  88. package/src/components/prescription-actions/dispense-action-button.component.tsx +1 -1
  89. package/src/components/prescription-actions/pause-action-button.component.tsx +1 -1
  90. package/src/conditions/conditions.component.tsx +93 -0
  91. package/src/conditions/conditions.resource.ts +100 -0
  92. package/src/conditions/conditions.scss +9 -0
  93. package/src/config-schema.ts +8 -0
  94. package/src/dashboard/dispensing-dashboard-link.component.tsx +1 -1
  95. package/src/dashboard/dispensing-dashboard.component.tsx +10 -4
  96. package/src/declarations.d.ts +0 -1
  97. package/src/diagnoses/diagnoses.component.tsx +92 -0
  98. package/src/diagnoses/diagnoses.resource.ts +30 -0
  99. package/src/diagnoses/diagnoses.scss +9 -0
  100. package/src/dispensing-tiles/dispensing-tile.component.tsx +20 -17
  101. package/src/dispensing-tiles/dispensing-tile.scss +8 -8
  102. package/src/dispensing-tiles/dispensing-tiles.scss +4 -5
  103. package/src/forms/close-dispense-form.workspace.tsx +25 -23
  104. package/src/forms/forms.scss +5 -9
  105. package/src/forms/medication-dispense-review.component.tsx +211 -196
  106. package/src/forms/pause-dispense-form.workspace.tsx +25 -23
  107. package/src/forms/stock-dispense/stock-dispense.component.tsx +10 -10
  108. package/src/history/history-and-comments.scss +15 -15
  109. package/src/index.ts +3 -0
  110. package/src/location/location.resource.test.tsx +1 -0
  111. package/src/medication/medication.resource.tsx +1 -1
  112. package/src/patient/patient-info-cell.component.tsx +1 -1
  113. package/src/pharmacy-header/pharmacy-header.scss +11 -11
  114. package/src/prescriptions/prescription-actions.scss +0 -1
  115. package/src/prescriptions/prescription-details.component.tsx +6 -6
  116. package/src/prescriptions/prescription-details.scss +10 -10
  117. package/src/prescriptions/prescription-expanded.component.tsx +5 -9
  118. package/src/prescriptions/prescription-expanded.scss +6 -7
  119. package/src/prescriptions/prescription-tab-lists.component.tsx +5 -5
  120. package/src/prescriptions/prescriptions.scss +15 -29
  121. package/src/print-prescription/prescription-printout.component.tsx +1 -1
  122. package/src/routes.json +14 -0
  123. package/src/utils.ts +1 -1
  124. package/tools/setup-tests.ts +1 -0
  125. package/tools/update-openmrs-deps.mjs +42 -0
  126. package/translations/en.json +9 -1
  127. package/translations/es.json +23 -23
  128. package/translations/it.json +87 -87
  129. package/translations/ky.json +92 -0
  130. package/tsconfig.json +3 -2
  131. package/dist/16.js +0 -1
  132. package/dist/204.js +0 -2
  133. package/dist/204.js.map +0 -1
  134. package/dist/240.js +0 -1
  135. package/dist/261.js +0 -1
  136. package/dist/271.js +0 -1
  137. package/dist/272.js +0 -1
  138. package/dist/294.js +0 -2
  139. package/dist/294.js.map +0 -1
  140. package/dist/319.js +0 -1
  141. package/dist/323.js +0 -1
  142. package/dist/336.js +0 -1
  143. package/dist/378.js +0 -1
  144. package/dist/460.js +0 -1
  145. package/dist/484.js +0 -1
  146. package/dist/484.js.map +0 -1
  147. package/dist/497.js +0 -1
  148. package/dist/524.js +0 -2
  149. package/dist/524.js.map +0 -1
  150. package/dist/566.js +0 -1
  151. package/dist/574.js +0 -1
  152. package/dist/579.js +0 -1
  153. package/dist/626.js +0 -1
  154. package/dist/626.js.map +0 -1
  155. package/dist/637.js +0 -1
  156. package/dist/637.js.map +0 -1
  157. package/dist/644.js +0 -1
  158. package/dist/652.js +0 -1
  159. package/dist/673.js +0 -1
  160. package/dist/705.js +0 -1
  161. package/dist/711.js +0 -1
  162. package/dist/727.js +0 -1
  163. package/dist/737.js +0 -1
  164. package/dist/749.js +0 -1
  165. package/dist/749.js.map +0 -1
  166. package/dist/757.js +0 -1
  167. package/dist/77.js +0 -1
  168. package/dist/77.js.map +0 -1
  169. package/dist/788.js +0 -1
  170. package/dist/803.js +0 -1
  171. package/dist/803.js.map +0 -1
  172. package/dist/807.js +0 -1
  173. package/dist/833.js +0 -1
  174. package/dist/888.js +0 -1
  175. package/dist/888.js.map +0 -1
  176. package/dist/890.js +0 -1
  177. package/dist/890.js.map +0 -1
  178. package/dist/901.js +0 -1
  179. package/dist/905.js +0 -1
  180. package/dist/905.js.map +0 -1
  181. package/dist/935.js +0 -2
  182. package/dist/935.js.map +0 -1
  183. package/dist/962.js +0 -1
  184. package/src/root.scss +0 -50
  185. package/src/setup-tests.ts +0 -1
  186. package/dist/{935.js.LICENSE.txt → 3935.js.LICENSE.txt} +0 -0
  187. package/dist/{294.js.LICENSE.txt → 7294.js.LICENSE.txt} +0 -0
  188. package/src/components/{medication-card.component.test.tsx → medication-card.test.tsx} +0 -0
  189. package/src/forms/{medication-dispense-review.component.test.tsx → medication-dispense-review.test.tsx} +1 -1
  190. /package/{i18next-parser.config.js → tools/i18next-parser.config.js} +0 -0
@@ -2,7 +2,14 @@ import React, { useEffect, useState } from 'react';
2
2
  import dayjs from 'dayjs';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { ComboBox, Dropdown, NumberInput, Stack, TextArea } from '@carbon/react';
5
- import { OpenmrsDatePicker, useLayoutType, useConfig, useSession, userHasAccess } from '@openmrs/esm-framework';
5
+ import {
6
+ OpenmrsDatePicker,
7
+ useLayoutType,
8
+ useConfig,
9
+ useSession,
10
+ userHasAccess,
11
+ ResponsiveWrapper,
12
+ } from '@openmrs/esm-framework';
6
13
  import { getConceptCodingUuid, getMedicationReferenceOrCodeableConcept, getOpenMRSMedicineDrugName } from '../utils';
7
14
  import { useMedicationCodeableConcept, useMedicationFormulations } from '../medication/medication.resource';
8
15
  import { useMedicationRequest, usePrescriptionDetails } from '../medication-request/medication-request.resource';
@@ -206,94 +213,97 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
206
213
  editAction={userCanModify && allowEditing ? () => setIsEditingFormulation(true) : null}
207
214
  />
208
215
  ) : (
209
- <Dropdown
210
- id="medicationFormulation"
211
- light={isTablet}
212
- items={medicationFormulations}
213
- itemToString={(item: Medication) => getOpenMRSMedicineDrugName(item)}
214
- initialSelectedItem={{
215
- ...medicationFormulations?.find(
216
- (formulation) => formulation.id === medicationDispense.medicationReference?.reference.split('/')[1],
217
- ),
218
- }}
219
- onChange={({ selectedItem }) => {
220
- updateMedicationDispense({
221
- ...medicationDispense,
222
- medicationCodeableConcept: undefined,
223
- medicationReference: {
224
- reference: 'Medication/' + selectedItem?.id,
225
- display: getOpenMRSMedicineDrugName(selectedItem),
226
- },
227
- });
228
- setIsEditingFormulation(false);
229
- }}
230
- required
231
- />
232
- )}
233
-
234
- {isSubstitution && (
235
- <div className={styles.dispenseDetailsContainer}>
236
- <ComboBox
237
- className={styles.substitutionType}
238
- id="substitutionType"
239
- light={isTablet}
240
- items={substitutionTypes}
241
- titleText={t('substitutionType', 'Type of substitution')}
242
- itemToString={(item) => item?.text}
216
+ <ResponsiveWrapper>
217
+ <Dropdown
218
+ id="medicationFormulation"
219
+ items={medicationFormulations}
220
+ itemToString={(item: Medication) => getOpenMRSMedicineDrugName(item)}
243
221
  initialSelectedItem={{
244
- id: medicationDispense.substitution.type?.coding[0]?.code,
245
- text: medicationDispense.substitution.type?.text,
222
+ ...medicationFormulations?.find(
223
+ (formulation) => formulation.id === medicationDispense.medicationReference?.reference.split('/')[1],
224
+ ),
246
225
  }}
247
226
  onChange={({ selectedItem }) => {
248
227
  updateMedicationDispense({
249
228
  ...medicationDispense,
250
- substitution: {
251
- ...medicationDispense.substitution,
252
- type: {
253
- coding: [
254
- {
255
- code: selectedItem?.id,
256
- },
257
- ],
258
- },
229
+ medicationCodeableConcept: undefined,
230
+ medicationReference: {
231
+ reference: 'Medication/' + selectedItem?.id,
232
+ display: getOpenMRSMedicineDrugName(selectedItem),
259
233
  },
260
234
  });
235
+ setIsEditingFormulation(false);
261
236
  }}
237
+ required
262
238
  />
263
- </div>
239
+ </ResponsiveWrapper>
264
240
  )}
265
241
 
266
242
  {isSubstitution && (
267
243
  <div className={styles.dispenseDetailsContainer}>
268
- <ComboBox
269
- className={styles.substitutionReason}
270
- id="substitutionReason"
271
- light={isTablet}
272
- items={substitutionReasons}
273
- titleText={t('substitutionReason', 'Reason for substitution')}
274
- itemToString={(item) => item?.text}
275
- initialSelectedItem={{
276
- id: medicationDispense.substitution.reason[0]?.coding[0]?.code,
277
- text: medicationDispense.substitution.reason[0]?.text,
278
- }}
279
- onChange={({ selectedItem }) => {
280
- updateMedicationDispense({
281
- ...medicationDispense,
282
- substitution: {
283
- ...medicationDispense.substitution,
284
- reason: [
285
- {
244
+ <ResponsiveWrapper>
245
+ <ComboBox
246
+ className={styles.substitutionType}
247
+ id="substitutionType"
248
+ items={substitutionTypes}
249
+ titleText={t('substitutionType', 'Type of substitution')}
250
+ itemToString={(item) => item?.text}
251
+ initialSelectedItem={{
252
+ id: medicationDispense.substitution.type?.coding[0]?.code,
253
+ text: medicationDispense.substitution.type?.text,
254
+ }}
255
+ onChange={({ selectedItem }) => {
256
+ updateMedicationDispense({
257
+ ...medicationDispense,
258
+ substitution: {
259
+ ...medicationDispense.substitution,
260
+ type: {
286
261
  coding: [
287
262
  {
288
263
  code: selectedItem?.id,
289
264
  },
290
265
  ],
291
266
  },
292
- ],
293
- },
294
- });
295
- }}
296
- />
267
+ },
268
+ });
269
+ }}
270
+ />
271
+ </ResponsiveWrapper>
272
+ </div>
273
+ )}
274
+
275
+ {isSubstitution && (
276
+ <div className={styles.dispenseDetailsContainer}>
277
+ <ResponsiveWrapper>
278
+ <ComboBox
279
+ className={styles.substitutionReason}
280
+ id="substitutionReason"
281
+ items={substitutionReasons}
282
+ titleText={t('substitutionReason', 'Reason for substitution')}
283
+ itemToString={(item) => item?.text}
284
+ initialSelectedItem={{
285
+ id: medicationDispense.substitution.reason[0]?.coding[0]?.code,
286
+ text: medicationDispense.substitution.reason[0]?.text,
287
+ }}
288
+ onChange={({ selectedItem }) => {
289
+ updateMedicationDispense({
290
+ ...medicationDispense,
291
+ substitution: {
292
+ ...medicationDispense.substitution,
293
+ reason: [
294
+ {
295
+ coding: [
296
+ {
297
+ code: selectedItem?.id,
298
+ },
299
+ ],
300
+ },
301
+ ],
302
+ },
303
+ });
304
+ }}
305
+ />
306
+ </ResponsiveWrapper>
297
307
  </div>
298
308
  )}
299
309
 
@@ -324,29 +334,30 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
324
334
  }}
325
335
  />
326
336
 
327
- <ComboBox
328
- id="quantityUnits"
329
- disabled={!userCanModify || !allowEditing}
330
- light={isTablet}
331
- items={drugDispensingUnits}
332
- titleText={t('drugDispensingUnit', 'Dispensing unit')}
333
- itemToString={(item) => item?.text}
334
- initialSelectedItem={{
335
- id: medicationDispense.quantity.code,
336
- text: medicationDispense.quantity.unit,
337
- }}
338
- onChange={({ selectedItem }) => {
339
- updateMedicationDispense({
340
- ...medicationDispense,
341
- // note that we specifically recreate doesQuantity to overwrite any unit or system properties that may have been set
342
- quantity: {
343
- value: medicationDispense.quantity.value,
344
- code: selectedItem?.id,
345
- },
346
- });
347
- }}
348
- required
349
- />
337
+ <ResponsiveWrapper>
338
+ <ComboBox
339
+ id="quantityUnits"
340
+ disabled={!userCanModify || !allowEditing}
341
+ items={drugDispensingUnits}
342
+ titleText={t('drugDispensingUnit', 'Dispensing unit')}
343
+ itemToString={(item) => item?.text}
344
+ initialSelectedItem={{
345
+ id: medicationDispense.quantity.code,
346
+ text: medicationDispense.quantity.unit,
347
+ }}
348
+ onChange={({ selectedItem }) => {
349
+ updateMedicationDispense({
350
+ ...medicationDispense,
351
+ // note that we specifically recreate doesQuantity to overwrite any unit or system properties that may have been set
352
+ quantity: {
353
+ value: medicationDispense.quantity.value,
354
+ code: selectedItem?.id,
355
+ },
356
+ });
357
+ }}
358
+ required
359
+ />
360
+ </ResponsiveWrapper>
350
361
  </div>
351
362
 
352
363
  <div className={styles.dispenseDetailsContainer}>
@@ -380,49 +391,83 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
380
391
  }}
381
392
  />
382
393
 
383
- <ComboBox
384
- id="dosingUnits"
385
- disabled={!userCanModify || !allowEditing}
386
- light={isTablet}
387
- items={drugDosingUnits}
388
- titleText={t('doseUnit', 'Dose unit')}
389
- itemToString={(item) => item?.text}
390
- initialSelectedItem={{
391
- id: medicationDispense.dosageInstruction[0].doseAndRate[0].doseQuantity?.code,
392
- text: medicationDispense.dosageInstruction[0].doseAndRate[0].doseQuantity?.unit,
393
- }}
394
- onChange={({ selectedItem }) => {
395
- updateMedicationDispense({
396
- ...medicationDispense,
397
- dosageInstruction: [
398
- {
399
- ...medicationDispense.dosageInstruction[0],
400
- doseAndRate: [
401
- {
402
- doseQuantity: {
403
- // note that we specifically recreate doesQuantity to overwrite any unit or system properties that may have been set
404
- value: medicationDispense.dosageInstruction[0].doseAndRate[0].doseQuantity?.value,
405
- code: selectedItem?.id,
394
+ <ResponsiveWrapper>
395
+ <ComboBox
396
+ id="dosingUnits"
397
+ disabled={!userCanModify || !allowEditing}
398
+ items={drugDosingUnits}
399
+ titleText={t('doseUnit', 'Dose unit')}
400
+ itemToString={(item) => item?.text}
401
+ initialSelectedItem={{
402
+ id: medicationDispense.dosageInstruction[0].doseAndRate[0].doseQuantity?.code,
403
+ text: medicationDispense.dosageInstruction[0].doseAndRate[0].doseQuantity?.unit,
404
+ }}
405
+ onChange={({ selectedItem }) => {
406
+ updateMedicationDispense({
407
+ ...medicationDispense,
408
+ dosageInstruction: [
409
+ {
410
+ ...medicationDispense.dosageInstruction[0],
411
+ doseAndRate: [
412
+ {
413
+ doseQuantity: {
414
+ // note that we specifically recreate doesQuantity to overwrite any unit or system properties that may have been set
415
+ value: medicationDispense.dosageInstruction[0].doseAndRate[0].doseQuantity?.value,
416
+ code: selectedItem?.id,
417
+ },
406
418
  },
419
+ ],
420
+ },
421
+ ],
422
+ });
423
+ }}
424
+ required
425
+ />
426
+ </ResponsiveWrapper>
427
+
428
+ <ResponsiveWrapper>
429
+ <ComboBox
430
+ id="editRoute"
431
+ disabled={!userCanModify || !allowEditing}
432
+ items={drugRoutes}
433
+ initialSelectedItem={{
434
+ id: medicationDispense.dosageInstruction[0].route?.coding[0]?.code,
435
+ text: medicationDispense.dosageInstruction[0].route?.text,
436
+ }}
437
+ titleText={t('route', 'Route')}
438
+ itemToString={(item) => item?.text}
439
+ onChange={({ selectedItem }) => {
440
+ updateMedicationDispense({
441
+ ...medicationDispense,
442
+ dosageInstruction: [
443
+ {
444
+ ...medicationDispense.dosageInstruction[0],
445
+ route: {
446
+ coding: [
447
+ {
448
+ code: selectedItem?.id,
449
+ },
450
+ ],
407
451
  },
408
- ],
409
- },
410
- ],
411
- });
412
- }}
413
- required
414
- />
452
+ },
453
+ ],
454
+ });
455
+ }}
456
+ required
457
+ />
458
+ </ResponsiveWrapper>
459
+ </div>
415
460
 
461
+ <ResponsiveWrapper>
416
462
  <ComboBox
417
- id="editRoute"
463
+ id="frequency"
418
464
  disabled={!userCanModify || !allowEditing}
419
- light={isTablet}
420
- items={drugRoutes}
465
+ items={orderFrequencies}
421
466
  initialSelectedItem={{
422
- id: medicationDispense.dosageInstruction[0].route?.coding[0]?.code,
423
- text: medicationDispense.dosageInstruction[0].route?.text,
467
+ id: medicationDispense.dosageInstruction[0].timing?.code?.coding[0]?.code,
468
+ text: medicationDispense.dosageInstruction[0].timing?.code?.text,
424
469
  }}
425
- titleText={t('route', 'Route')}
470
+ titleText={t('frequency', 'Frequency')}
426
471
  itemToString={(item) => item?.text}
427
472
  onChange={({ selectedItem }) => {
428
473
  updateMedicationDispense({
@@ -430,12 +475,15 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
430
475
  dosageInstruction: [
431
476
  {
432
477
  ...medicationDispense.dosageInstruction[0],
433
- route: {
434
- coding: [
435
- {
436
- code: selectedItem?.id,
437
- },
438
- ],
478
+ timing: {
479
+ ...medicationDispense.dosageInstruction[0].timing,
480
+ code: {
481
+ coding: [
482
+ {
483
+ code: selectedItem?.id,
484
+ },
485
+ ],
486
+ },
439
487
  },
440
488
  },
441
489
  ],
@@ -443,41 +491,7 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
443
491
  }}
444
492
  required
445
493
  />
446
- </div>
447
-
448
- <ComboBox
449
- id="frequency"
450
- disabled={!userCanModify || !allowEditing}
451
- light={isTablet}
452
- items={orderFrequencies}
453
- initialSelectedItem={{
454
- id: medicationDispense.dosageInstruction[0].timing?.code?.coding[0]?.code,
455
- text: medicationDispense.dosageInstruction[0].timing?.code?.text,
456
- }}
457
- titleText={t('frequency', 'Frequency')}
458
- itemToString={(item) => item?.text}
459
- onChange={({ selectedItem }) => {
460
- updateMedicationDispense({
461
- ...medicationDispense,
462
- dosageInstruction: [
463
- {
464
- ...medicationDispense.dosageInstruction[0],
465
- timing: {
466
- ...medicationDispense.dosageInstruction[0].timing,
467
- code: {
468
- coding: [
469
- {
470
- code: selectedItem?.id,
471
- },
472
- ],
473
- },
474
- },
475
- },
476
- ],
477
- });
478
- }}
479
- required
480
- />
494
+ </ResponsiveWrapper>
481
495
 
482
496
  <TextArea
483
497
  labelText={t('patientInstructions', 'Patient instructions')}
@@ -514,33 +528,34 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
514
528
  value={dayjs(medicationDispense.whenHandedOver).toDate()}></OpenmrsDatePicker>
515
529
 
516
530
  {providers && (
517
- <ComboBox
518
- id="dispenser"
519
- light={isTablet}
520
- initialSelectedItem={
521
- medicationDispense?.performer[0].actor.reference
522
- ? providers.find(
523
- (provider) => provider.uuid === medicationDispense?.performer[0].actor.reference.split('/')[1],
524
- )
525
- : null
526
- }
527
- onChange={({ selectedItem }) => {
528
- updateMedicationDispense({
529
- ...medicationDispense,
530
- performer: [
531
- {
532
- actor: {
533
- reference: `Practitioner/${selectedItem?.uuid}`,
531
+ <ResponsiveWrapper>
532
+ <ComboBox
533
+ id="dispenser"
534
+ initialSelectedItem={
535
+ medicationDispense?.performer[0].actor.reference
536
+ ? providers.find(
537
+ (provider) => provider.uuid === medicationDispense?.performer[0].actor.reference.split('/')[1],
538
+ )
539
+ : null
540
+ }
541
+ onChange={({ selectedItem }) => {
542
+ updateMedicationDispense({
543
+ ...medicationDispense,
544
+ performer: [
545
+ {
546
+ actor: {
547
+ reference: `Practitioner/${selectedItem?.uuid}`,
548
+ },
534
549
  },
535
- },
536
- ],
537
- });
538
- }}
539
- items={providers}
540
- itemToString={(item) => item?.person?.display}
541
- required
542
- titleText={t('dispensedBy', 'Dispensed by')}
543
- />
550
+ ],
551
+ });
552
+ }}
553
+ items={providers}
554
+ itemToString={(item) => item?.person?.display}
555
+ required
556
+ titleText={t('dispensedBy', 'Dispensed by')}
557
+ />
558
+ </ResponsiveWrapper>
544
559
  )}
545
560
  </Stack>
546
561
  </div>
@@ -5,6 +5,7 @@ import {
5
5
  type DefaultWorkspaceProps,
6
6
  ExtensionSlot,
7
7
  getCoreTranslation,
8
+ ResponsiveWrapper,
8
9
  showSnackbar,
9
10
  useConfig,
10
11
  useLayoutType,
@@ -152,29 +153,30 @@ const PauseDispenseForm: React.FC<PauseDispenseFormProps> = ({
152
153
  )}
153
154
  {patient && <ExtensionSlot name="patient-header-slot" state={bannerState} />}
154
155
  <section className={styles.formGroup}>
155
- <ComboBox
156
- id="reasonForPause"
157
- light={isTablet}
158
- items={reasonsForPause}
159
- titleText={t('reasonForPause', 'Reason for pause')}
160
- itemToString={(item) => item?.text}
161
- initialSelectedItem={{
162
- id: medicationDispense.statusReasonCodeableConcept?.coding[0]?.code,
163
- text: medicationDispense.statusReasonCodeableConcept?.text,
164
- }}
165
- onChange={({ selectedItem }) => {
166
- setMedicationDispensePayload({
167
- ...medicationDispensePayload,
168
- statusReasonCodeableConcept: {
169
- coding: [
170
- {
171
- code: selectedItem?.id,
172
- },
173
- ],
174
- },
175
- });
176
- }}
177
- />
156
+ <ResponsiveWrapper>
157
+ <ComboBox
158
+ id="reasonForPause"
159
+ items={reasonsForPause}
160
+ titleText={t('reasonForPause', 'Reason for pause')}
161
+ itemToString={(item) => item?.text}
162
+ initialSelectedItem={{
163
+ id: medicationDispense.statusReasonCodeableConcept?.coding[0]?.code,
164
+ text: medicationDispense.statusReasonCodeableConcept?.text,
165
+ }}
166
+ onChange={({ selectedItem }) => {
167
+ setMedicationDispensePayload({
168
+ ...medicationDispensePayload,
169
+ statusReasonCodeableConcept: {
170
+ coding: [
171
+ {
172
+ code: selectedItem?.id,
173
+ },
174
+ ],
175
+ },
176
+ });
177
+ }}
178
+ />
179
+ </ResponsiveWrapper>
178
180
  </section>
179
181
  </div>
180
182
  <section className={styles.buttonGroup}>
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
2
3
  import { ComboBox, InlineLoading, InlineNotification, Layer } from '@carbon/react';
4
+ import { formatDate, useConfig } from '@openmrs/esm-framework';
3
5
  import { type MedicationDispense, type InventoryItem } from '../../types';
6
+ import { type PharmacyConfig } from '../../config-schema';
4
7
  import { useDispenseStock } from './stock.resource';
5
- import { formatDate } from '@openmrs/esm-framework';
6
- import { useTranslation } from 'react-i18next';
7
8
 
8
9
  type StockDispenseProps = {
9
10
  medicationDispense: MedicationDispense;
@@ -13,17 +14,13 @@ type StockDispenseProps = {
13
14
 
14
15
  const StockDispense: React.FC<StockDispenseProps> = ({ medicationDispense, updateInventoryItem }) => {
15
16
  const { t } = useTranslation();
17
+ const config = useConfig<PharmacyConfig>();
18
+
16
19
  const drugUuid = medicationDispense?.medicationReference?.reference?.split('/')[1];
17
20
  const { inventoryItems, error, isLoading } = useDispenseStock(drugUuid);
18
- const validInventoryItems = inventoryItems.filter((item) => isValidBatch(medicationDispense, item));
19
- const validInventoryItemss = inventoryItems
21
+ const validInventoryItems = inventoryItems
20
22
  .filter((item) => isValidBatch(medicationDispense, item))
21
- .sort((a, b) => {
22
- const dateA = new Date(a.expiration);
23
- const dateB = new Date(b.expiration);
24
-
25
- return dateA.getDate() - dateB.getDate();
26
- });
23
+ .sort((a, b) => new Date(a.expiration).getTime() - new Date(b.expiration).getTime());
27
24
 
28
25
  function parseDate(dateString) {
29
26
  return new Date(dateString);
@@ -31,6 +28,9 @@ const StockDispense: React.FC<StockDispenseProps> = ({ medicationDispense, updat
31
28
 
32
29
  //check whether the drug will expire before the medication period ends
33
30
  function isValidBatch(medicationToDispense, inventoryItem) {
31
+ if (typeof config !== 'undefined' && !config.validateBatch) {
32
+ return true;
33
+ }
34
34
  if (medicationToDispense?.dosageInstruction && medicationToDispense?.dosageInstruction.length > 0) {
35
35
  return medicationToDispense.dosageInstruction.some((instruction) => {
36
36
  if (
@@ -1,6 +1,6 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/layout';
2
+ @use '@carbon/type';
3
+ @use '@openmrs/esm-styleguide/src/vars' as *;
4
4
 
5
5
  .historyAndCommentsContainer {
6
6
  max-width: 80%;
@@ -13,15 +13,15 @@
13
13
 
14
14
  form input {
15
15
  vertical-align: middle;
16
- margin: 0 10px 0 0;
17
- padding: 10px;
16
+ margin: 0 0.625rem 0 0;
17
+ padding: 0.625rem;
18
18
  border: 1px solid #8d8d8d !important;
19
19
  background-color: white;
20
20
  }
21
21
  form button {
22
22
  width: 90px;
23
- height: 20px;
24
- min-height: 2.5rem !important;
23
+ height: 1.25rem;
24
+ min-height: layout.$spacing-08 !important;
25
25
  }
26
26
 
27
27
  form :global(.cds--btn--ghost) {
@@ -30,22 +30,22 @@
30
30
 
31
31
  .requestTile {
32
32
  width: 100%;
33
- margin: 2px 0 8px;
34
- padding: 0 8px 0 8px;
33
+ margin: layout.$spacing-01 0 layout.$spacing-03;
34
+ padding: 0 layout.$spacing-03 0 layout.$spacing-03;
35
35
  background-color: #fff;
36
- border-left: 4px solid var(--brand-03);
36
+ border-left: layout.$spacing-03 solid var(--brand-03);
37
37
  color: $text-02;
38
- margin-bottom: 1rem !important;
38
+ margin-bottom: layout.$spacing-05 !important;
39
39
  }
40
40
 
41
41
  .dispenseTile {
42
42
  width: 100%;
43
- margin: 2px 0 8px;
44
- padding: 0 8px 0 8px;
43
+ margin: layout.$spacing-01 0 layout.$spacing-03;
44
+ padding: 0 layout.$spacing-03 0 layout.$spacing-03;
45
45
  background-color: #fff;
46
- border-left: 4px solid red;
46
+ border-left: layout.$spacing-03 solid red;
47
47
  color: $text-02;
48
- margin-bottom: 1rem !important;
48
+ margin-bottom: layout.$spacing-05 !important;
49
49
  }
50
50
 
51
51
  .medicationEventActionMenu {
package/src/index.ts CHANGED
@@ -44,3 +44,6 @@ export const dispenseWorkspace = getAsyncLifecycle(() => import('./forms/dispens
44
44
  export const pauseDispenseWorkspace = getAsyncLifecycle(() => import('./forms/pause-dispense-form.workspace'), options);
45
45
 
46
46
  export const printPrescriptionPreviewModal = getSyncLifecycle(PrescriptionPrintPreviewModal, options);
47
+
48
+ export const patientDiagnoses = getAsyncLifecycle(() => import('./diagnoses/diagnoses.component'), options);
49
+ export const patientConditions = getAsyncLifecycle(() => import('./conditions/conditions.component'), options);
@@ -34,6 +34,7 @@ const pharmacyConfig: PharmacyConfig = {
34
34
  substitutionType: { uuid: '' },
35
35
  },
36
36
  enableStockDispense: false,
37
+ validateBatch: false,
37
38
  };
38
39
 
39
40
  describe('Location Resource tests', () => {