From d854ab3862b31cbc1ff42fca3127726a9d6b94f4 Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 15 Jan 2025 01:49:07 +0530 Subject: [PATCH 1/8] Keep the theme color same for all order types --- src/medical-orders/medical-supply-order-panel.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/medical-orders/medical-supply-order-panel.scss b/src/medical-orders/medical-supply-order-panel.scss index f08157f..c5bfb2a 100644 --- a/src/medical-orders/medical-supply-order-panel.scss +++ b/src/medical-orders/medical-supply-order-panel.scss @@ -4,9 +4,9 @@ @use '@openmrs/esm-styleguide/src/vars' as *; .desktopTile { - border-left: layout.$spacing-02 solid colors.$cyan-20; + border-left: layout.$spacing-02 solid colors.$purple-70; background-color: $ui-02; - border-top: 1px solid colors.$cyan-20; + border-top: 1px solid colors.$purple-20; border-right: none; padding: 0; } From 858ad00868c36ffb11bbd66b8653abbe68e5ac7f Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 15 Jan 2025 01:49:51 +0530 Subject: [PATCH 2/8] Workspace title must be same as the order type --- ...al-supply-orderable-concept-search.workspace.tsx | 13 ++++++++++++- translations/en.json | 1 + translations/fr.json | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/medical-orders/medical-supply-orderable-concept-search/medical-supply-orderable-concept-search.workspace.tsx b/src/medical-orders/medical-supply-orderable-concept-search/medical-supply-orderable-concept-search.workspace.tsx index 96f40bb..ffa3075 100644 --- a/src/medical-orders/medical-supply-orderable-concept-search/medical-supply-orderable-concept-search.workspace.tsx +++ b/src/medical-orders/medical-supply-orderable-concept-search/medical-supply-orderable-concept-search.workspace.tsx @@ -14,7 +14,7 @@ import { useOrderType, usePatientChartStore, } from '@openmrs/esm-patient-common-lib'; -import React, { type ComponentProps, useCallback, useMemo, useRef, useState } from 'react'; +import React, { type ComponentProps, useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import styles from './medical-supply-orderable-concept-search.scss'; import { Button, Search } from '@carbon/react'; @@ -45,6 +45,7 @@ const OrderableConceptSearchWorkspace: React.FC { const { t } = useTranslation(); const isTablet = useLayoutType() === 'tablet'; @@ -53,6 +54,16 @@ const OrderableConceptSearchWorkspace: React.FC(); + useEffect(() => { + if (orderType) { + setTitle( + t('addOrderForOrderType', 'Add {{orderTypeDisplay}}', { + orderTypeDisplay: orderType.display.toLocaleLowerCase(), + }), + ); + } + }, [setTitle, orderType, t]); + const [currentOrder, setCurrentOrder] = useState(initialOrder); const orderableConceptSets = useMemo( diff --git a/translations/en.json b/translations/en.json index 5843c92..dc2ff3a 100644 --- a/translations/en.json +++ b/translations/en.json @@ -29,6 +29,7 @@ "returnToOrderBasket": "Return to order basket", "saveOrder": "Save order", "searchAgain": "search again", + "searchMedicalSupplyOrderables": "Search medical supply orderables", "searchResultsMatchesForTerm_one": "{{count}} results for \"{{searchTerm}}\"", "searchResultsMatchesForTerm_other": "{{count}} results for \"{{searchTerm}}\"", "testOrderReferenceNumber": "{{orderType}} reference number", diff --git a/translations/fr.json b/translations/fr.json index 1ad4157..b67a782 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -29,6 +29,7 @@ "returnToOrderBasket": "Retourner au panier de commande", "saveOrder": "Enregistrer la commande", "searchAgain": "Rechercher à nouveau", + "searchMedicalSupplyOrderables": "Search medical supply orderables", "searchResultsMatchesForTerm_one": "{{count}} résultats pour \"{{searchTerm}}\"", "searchResultsMatchesForTerm_many": "{{count}} résultats pour \"{{searchTerm}}\"", "searchResultsMatchesForTerm_other": "{{count}} résultats pour \"{{searchTerm}}\"", From 574ef264c01c2e2b4fbc3369d48804d1c76bd86b Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 15 Jan 2025 01:50:04 +0530 Subject: [PATCH 3/8] Update the framework and patient common lib --- yarn.lock | 328 +++++++++++++++++++++++++++--------------------------- 1 file changed, 164 insertions(+), 164 deletions(-) diff --git a/yarn.lock b/yarn.lock index c854684..d5536fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3424,28 +3424,28 @@ __metadata: languageName: node linkType: hard -"@openmrs/esm-api@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-api@npm:6.0.1-pre.2575" +"@openmrs/esm-api@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-api@npm:6.0.3-pre.2638" dependencies: "@types/fhir": "npm:0.0.31" lodash-es: "npm:^4.17.21" peerDependencies: - "@openmrs/esm-config": 5.x - "@openmrs/esm-error-handling": 5.x - "@openmrs/esm-navigation": 5.x - "@openmrs/esm-offline": 5.x - checksum: 10/0d52d3db7ff9bdbe07acb336c5e99368b7b9486b06bef6846e0b9d98085a20aab6fd40d75a04db9f9b8a84f93e8335c5fc997cbe1595e9c46acd396ad9e0e594 + "@openmrs/esm-config": 6.x + "@openmrs/esm-error-handling": 6.x + "@openmrs/esm-navigation": 6.x + "@openmrs/esm-offline": 6.x + checksum: 10/35b07a4ccfa522d90e70353a5a29d4392a5594c5057b848f1bfac6cb7b1360ebf6b92ea1f391634f303fbd8f61888cfb49164fdfb4fc4c6ba8cd4ebc1834d411 languageName: node linkType: hard -"@openmrs/esm-app-shell@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-app-shell@npm:6.0.1-pre.2575" +"@openmrs/esm-app-shell@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-app-shell@npm:6.0.3-pre.2638" dependencies: "@carbon/react": "npm:~1.37.0" - "@openmrs/esm-framework": "npm:6.0.1-pre.2575" - "@openmrs/esm-styleguide": "npm:6.0.1-pre.2575" + "@openmrs/esm-framework": "npm:6.0.3-pre.2638" + "@openmrs/esm-styleguide": "npm:6.0.3-pre.2638" dayjs: "npm:^1.10.4" dexie: "npm:^3.0.3" html-webpack-plugin: "npm:^5.5.0" @@ -3470,58 +3470,58 @@ __metadata: workbox-strategies: "npm:^6.1.5" workbox-webpack-plugin: "npm:^6.1.5" workbox-window: "npm:^6.1.5" - checksum: 10/bfd3d14aec7696dfd9ecc15e2208a7c3d15e6d8faba88ff7260211506eb12b5d125f0ae611bed957f21a0ca138ed409ed894f66e99837de78bb1fa74ac1e2a2e + checksum: 10/311a1e2d2a6a812755f84e23464ee4e3880caeeddc6aca796f17b1be5aecec25f8d96562aea557c23951960475fa27b0684d45fa1b89d1aa68a2752eeecd0d6c languageName: node linkType: hard -"@openmrs/esm-config@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-config@npm:6.0.1-pre.2575" +"@openmrs/esm-config@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-config@npm:6.0.3-pre.2638" dependencies: ramda: "npm:^0.26.1" peerDependencies: - "@openmrs/esm-globals": 5.x - "@openmrs/esm-state": 5.x - "@openmrs/esm-utils": 5.x - single-spa: 5.x - checksum: 10/f1e8344df30ab938908f3aefe8bf5af87c048b7df2818a635beb0b9821ae3a8a440570f02586b16efa24a2ab752ba758ed8fbdf1304d5ce37cea63bdb4ad8d58 + "@openmrs/esm-globals": 6.x + "@openmrs/esm-state": 6.x + "@openmrs/esm-utils": 6.x + single-spa: 6.x + checksum: 10/358b4d1083fe263582a3fe61a61807ffcfa4511c4dab455779c446e5924ff9fab1e037dae32eaa0b7461a165123e399cd515ec79302f40d619a1e825793c1bcf languageName: node linkType: hard -"@openmrs/esm-context@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-context@npm:6.0.1-pre.2575" +"@openmrs/esm-context@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-context@npm:6.0.3-pre.2638" dependencies: immer: "npm:^10.0.4" peerDependencies: - "@openmrs/esm-globals": 5.x - "@openmrs/esm-state": 5.x - checksum: 10/1a72dd0132b4597df51f1b86202cf3041314cd0ba437058872eeace01d2b30f50819bcc7986670a3caa21126a73b94eea83850ec53a07b88ea7175ed28fc0b6e + "@openmrs/esm-globals": 6.x + "@openmrs/esm-state": 6.x + checksum: 10/d3986ff0f537fcc2693d179f8c6218da5a3cccf3660769ef475a704f16b3dab7cfa8da28f35790aa2d08708b98fe2027554606781a6f3cd52c4fa605cfe2229d languageName: node linkType: hard -"@openmrs/esm-dynamic-loading@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-dynamic-loading@npm:6.0.1-pre.2575" +"@openmrs/esm-dynamic-loading@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-dynamic-loading@npm:6.0.3-pre.2638" peerDependencies: - "@openmrs/esm-globals": 5.x - "@openmrs/esm-translations": 5.x - checksum: 10/a5215e209a8f033a86b517ab4ca1c8ca2b53ab14c3669a745072d92c428ba503721a978fac00bf48342e7f3c85993030e00647138b2336ad33701de835b9e6f0 + "@openmrs/esm-globals": 6.x + "@openmrs/esm-translations": 6.x + checksum: 10/a69a4efa3dcbdc51b8e9ba263d3381a96ed7c5b6a970978dec4e4bf6c5d71fa8dda2fd5c5e3d9de17caa4f4b9b5d6037b6376491ce8ebc80a92eb625a81f1c9f languageName: node linkType: hard -"@openmrs/esm-error-handling@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-error-handling@npm:6.0.1-pre.2575" +"@openmrs/esm-error-handling@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-error-handling@npm:6.0.3-pre.2638" peerDependencies: - "@openmrs/esm-globals": 5.x - checksum: 10/15d7254e6565349e53e7a174f17f2a795cc8947bb2590035b568faad73b0773053ea80da3e81756ab0e475228e9d242c5133b0d3d6daf2952e8c46635ca6b418 + "@openmrs/esm-globals": 6.x + checksum: 10/f046fee9a7b99a3a68440b580ef3fea9e0332533346ec3e38c7d810c3399a4ad641f7987352c15153f18e59a0a941ed5e2c534affe24b265950cd91693bbc32f languageName: node linkType: hard -"@openmrs/esm-expression-evaluator@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-expression-evaluator@npm:6.0.1-pre.2575" +"@openmrs/esm-expression-evaluator@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-expression-evaluator@npm:6.0.3-pre.2638" dependencies: "@jsep-plugin/arrow": "npm:^1.0.5" "@jsep-plugin/new": "npm:^1.0.3" @@ -3530,61 +3530,61 @@ __metadata: "@jsep-plugin/template": "npm:^1.0.4" "@jsep-plugin/ternary": "npm:^1.1.3" jsep: "npm:^1.3.9" - checksum: 10/922dda4716c283a424cee303056309c18e35cb09c81547cb8f33da6105f28b26d11eabd71c0c4d8897a20c76acdb2c294e610b8eac3d511b6558a441461e84ed + checksum: 10/697b2f84f1dd8ffd24d1e2a4c65e04a556d4381e0d5e6766321ddf2f633b693879b80b54f944d4a46d31fbace9b9e0588d406ce4158adeaa1a76f86d474a3bea languageName: node linkType: hard -"@openmrs/esm-extensions@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-extensions@npm:6.0.1-pre.2575" +"@openmrs/esm-extensions@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-extensions@npm:6.0.3-pre.2638" dependencies: lodash-es: "npm:^4.17.21" peerDependencies: - "@openmrs/esm-api": 5.x - "@openmrs/esm-config": 5.x - "@openmrs/esm-expression-evaluator": 5.x - "@openmrs/esm-feature-flags": 5.x - "@openmrs/esm-state": 5.x - "@openmrs/esm-utils": 5.x - single-spa: 5.x - checksum: 10/29373a8aafcee56c4579ec1bfd30e9fe47f435d8c601e5ad1a98526cbd4b19f22c7aaab8e7936432b2a15d14501edb82af12d38e287fa42fcf586cc7702702c8 + "@openmrs/esm-api": 6.x + "@openmrs/esm-config": 6.x + "@openmrs/esm-expression-evaluator": 6.x + "@openmrs/esm-feature-flags": 6.x + "@openmrs/esm-state": 6.x + "@openmrs/esm-utils": 6.x + single-spa: 6.x + checksum: 10/6851144fad3bfd83aca5fe2e893ee50cbb3d2865c45aa7a9da81ace3a21ba424d8f861e81befa75f9e165131694d23db4d09e10259c57074d11e54c6956db884 languageName: node linkType: hard -"@openmrs/esm-feature-flags@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-feature-flags@npm:6.0.1-pre.2575" +"@openmrs/esm-feature-flags@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-feature-flags@npm:6.0.3-pre.2638" dependencies: ramda: "npm:^0.26.1" peerDependencies: - "@openmrs/esm-globals": 5.x - "@openmrs/esm-state": 5.x - single-spa: 5.x - checksum: 10/14b624ecab373991297dd3faf4c19f0b451073dc3aa14233124ecf304abc641fb0bac12b440438b590b2ee74c6f53191fbb460ba0a1582482328b41da3190802 - languageName: node - linkType: hard - -"@openmrs/esm-framework@npm:6.0.1-pre.2575, @openmrs/esm-framework@npm:next": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-framework@npm:6.0.1-pre.2575" - dependencies: - "@openmrs/esm-api": "npm:6.0.1-pre.2575" - "@openmrs/esm-config": "npm:6.0.1-pre.2575" - "@openmrs/esm-context": "npm:6.0.1-pre.2575" - "@openmrs/esm-dynamic-loading": "npm:6.0.1-pre.2575" - "@openmrs/esm-error-handling": "npm:6.0.1-pre.2575" - "@openmrs/esm-expression-evaluator": "npm:6.0.1-pre.2575" - "@openmrs/esm-extensions": "npm:6.0.1-pre.2575" - "@openmrs/esm-feature-flags": "npm:6.0.1-pre.2575" - "@openmrs/esm-globals": "npm:6.0.1-pre.2575" - "@openmrs/esm-navigation": "npm:6.0.1-pre.2575" - "@openmrs/esm-offline": "npm:6.0.1-pre.2575" - "@openmrs/esm-react-utils": "npm:6.0.1-pre.2575" - "@openmrs/esm-routes": "npm:6.0.1-pre.2575" - "@openmrs/esm-state": "npm:6.0.1-pre.2575" - "@openmrs/esm-styleguide": "npm:6.0.1-pre.2575" - "@openmrs/esm-translations": "npm:6.0.1-pre.2575" - "@openmrs/esm-utils": "npm:6.0.1-pre.2575" + "@openmrs/esm-globals": 6.x + "@openmrs/esm-state": 6.x + single-spa: 6.x + checksum: 10/90a8e4643b5993fd07210c8bad135bc6064db6a0f66571b91b87521cb97a9ba712bd6dbcaeac021ec18a7b4e744c5ae9680fd258b11bf0cfc3ed02c9ee73df71 + languageName: node + linkType: hard + +"@openmrs/esm-framework@npm:6.0.3-pre.2638, @openmrs/esm-framework@npm:next": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-framework@npm:6.0.3-pre.2638" + dependencies: + "@openmrs/esm-api": "npm:6.0.3-pre.2638" + "@openmrs/esm-config": "npm:6.0.3-pre.2638" + "@openmrs/esm-context": "npm:6.0.3-pre.2638" + "@openmrs/esm-dynamic-loading": "npm:6.0.3-pre.2638" + "@openmrs/esm-error-handling": "npm:6.0.3-pre.2638" + "@openmrs/esm-expression-evaluator": "npm:6.0.3-pre.2638" + "@openmrs/esm-extensions": "npm:6.0.3-pre.2638" + "@openmrs/esm-feature-flags": "npm:6.0.3-pre.2638" + "@openmrs/esm-globals": "npm:6.0.3-pre.2638" + "@openmrs/esm-navigation": "npm:6.0.3-pre.2638" + "@openmrs/esm-offline": "npm:6.0.3-pre.2638" + "@openmrs/esm-react-utils": "npm:6.0.3-pre.2638" + "@openmrs/esm-routes": "npm:6.0.3-pre.2638" + "@openmrs/esm-state": "npm:6.0.3-pre.2638" + "@openmrs/esm-styleguide": "npm:6.0.3-pre.2638" + "@openmrs/esm-translations": "npm:6.0.3-pre.2638" + "@openmrs/esm-utils": "npm:6.0.3-pre.2638" dayjs: "npm:^1.10.7" peerDependencies: dayjs: 1.x @@ -3593,54 +3593,54 @@ __metadata: react-dom: 18.x react-i18next: 11.x rxjs: 6.x - single-spa: 5.x + single-spa: 6.x swr: 2.x - checksum: 10/8babce46766832908e319135cd8620a6ff42f45f23e1051af08499d203e71f462d09bfa875abe58abd7acfcad93bcf84eeb1aece10000c4b827b90aa72dc96c1 + checksum: 10/de18c24f951eef94aa16f5581d1939e6be7f176ddd3a920fe9c43ff1a816dc8cdf40170d16931d4021a99deb6942ebd43c77840ed1f8ca3d0c1d4393a67dff9b languageName: node linkType: hard -"@openmrs/esm-globals@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-globals@npm:6.0.1-pre.2575" +"@openmrs/esm-globals@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-globals@npm:6.0.3-pre.2638" dependencies: "@types/fhir": "npm:0.0.31" peerDependencies: - single-spa: 5.x - checksum: 10/4cff4363d511bbb3c79a2729f4e36293768bd2f0be3dfdf141d811b791ed665b0a001512d8ade087e8a29cf61144c6c113f61f64b50114b5fbf6456258f560cc + single-spa: 6.x + checksum: 10/87912614dbf8315d8c79b97c50f0745e74d817b4f7010e707cd4423393d3d7741458feef4916fbce522ce101546633629d58646007d7d0e622f1989ebe3c5acf languageName: node linkType: hard -"@openmrs/esm-navigation@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-navigation@npm:6.0.1-pre.2575" +"@openmrs/esm-navigation@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-navigation@npm:6.0.3-pre.2638" dependencies: path-to-regexp: "npm:6.1.0" peerDependencies: - "@openmrs/esm-state": 5.x - checksum: 10/c459ec60fc5549aeefadc8bcb78f0ddd27f8a5829dd438d784bfaca96c9c54f5dc6dceee1ef91ba952ada5a93598b6c603b7af68c1b96eb85e2e2fa19aaf6892 + "@openmrs/esm-state": 6.x + checksum: 10/cb1774b7e08d096e36ae0140c30ea99e4934703102aaad71394138358e45e88013d5c21cf0529a0d8a7286f5f19caaeed4a2cc28fc53b89e4a6935868cbc64e2 languageName: node linkType: hard -"@openmrs/esm-offline@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-offline@npm:6.0.1-pre.2575" +"@openmrs/esm-offline@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-offline@npm:6.0.3-pre.2638" dependencies: dexie: "npm:^3.0.3" lodash-es: "npm:^4.17.21" uuid: "npm:^9.0.1" workbox-window: "npm:^6.1.5" peerDependencies: - "@openmrs/esm-api": 5.x - "@openmrs/esm-globals": 5.x - "@openmrs/esm-state": 5.x + "@openmrs/esm-api": 6.x + "@openmrs/esm-globals": 6.x + "@openmrs/esm-state": 6.x rxjs: 6.x - checksum: 10/8be54345e950e585f4fdb4fa6d1da98b8a55a5737f03da69facc4170b9f0546c6572c0643b57de061ed2844ee1e31427c70fee75422f0e7bd7ab41a36e105131 + checksum: 10/78150a19c4c557b0c5a12cb1fb2f283b7387edb550c306ff91f7ad14eb3f386bb76ee5b98d9d32774a2be1e01bf6d76de03067cfc1ba893cdfa625945d36a687 languageName: node linkType: hard "@openmrs/esm-patient-common-lib@npm:next": - version: 8.2.1-pre.6329 - resolution: "@openmrs/esm-patient-common-lib@npm:8.2.1-pre.6329" + version: 9.1.1-pre.6579 + resolution: "@openmrs/esm-patient-common-lib@npm:9.1.1-pre.6579" dependencies: "@carbon/react": "npm:^1.12.0" lodash-es: "npm:^4.17.21" @@ -3649,26 +3649,26 @@ __metadata: "@openmrs/esm-framework": 6.x react: 18.x single-spa: 6.x - checksum: 10/b853ff48dd18e0dae9a8e024c7fec9b904c6964ea64c1bff715c415b3a8cb5c6e90714e4499435d87d523c4438e12a0c1de35ffb478b03fbb72d3925bcb44ebc + checksum: 10/bc8661a1a4ef139a9e4d7714210b6a22d4f6c3eef4966af3aca477b9207a39a3bed378d56be619e429874707c6fd2382ebfc59326fdd5e27cf95b254c460b866 languageName: node linkType: hard -"@openmrs/esm-react-utils@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-react-utils@npm:6.0.1-pre.2575" +"@openmrs/esm-react-utils@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-react-utils@npm:6.0.3-pre.2638" dependencies: lodash-es: "npm:^4.17.21" single-spa-react: "npm:^6.0.0" peerDependencies: - "@openmrs/esm-api": 5.x - "@openmrs/esm-config": 5.x - "@openmrs/esm-context": 5.x - "@openmrs/esm-error-handling": 5.x - "@openmrs/esm-extensions": 5.x - "@openmrs/esm-feature-flags": 5.x - "@openmrs/esm-globals": 5.x - "@openmrs/esm-navigation": 5.x - "@openmrs/esm-utils": 5.x + "@openmrs/esm-api": 6.x + "@openmrs/esm-config": 6.x + "@openmrs/esm-context": 6.x + "@openmrs/esm-error-handling": 6.x + "@openmrs/esm-extensions": 6.x + "@openmrs/esm-feature-flags": 6.x + "@openmrs/esm-globals": 6.x + "@openmrs/esm-navigation": 6.x + "@openmrs/esm-utils": 6.x dayjs: 1.x i18next: 21.x react: 18.x @@ -3676,40 +3676,40 @@ __metadata: react-i18next: 11.x rxjs: 6.x swr: 2.x - checksum: 10/df60919ad031cebc78886001ec1682da2a0cf5130561782cd49312c4f392beb6ed5872d32e8a1f861a65a0825bcca665ec32ce0594da89ea542fee5286f03520 + checksum: 10/bd365fd84ddd17a9dd5e0a02b858be857f9dc8cc4efa7d13d646c18e009c88385738dcaf62fe246b1fe87ea6e17dbea67abf75dc0cf666aa0e0e4d92e1a4056e languageName: node linkType: hard -"@openmrs/esm-routes@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-routes@npm:6.0.1-pre.2575" +"@openmrs/esm-routes@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-routes@npm:6.0.3-pre.2638" peerDependencies: - "@openmrs/esm-config": 5.x - "@openmrs/esm-dynamic-loading": 5.x - "@openmrs/esm-extensions": 5.x - "@openmrs/esm-feature-flags": 5.x - "@openmrs/esm-globals": 5.x - "@openmrs/esm-utils": 5.x + "@openmrs/esm-config": 6.x + "@openmrs/esm-dynamic-loading": 6.x + "@openmrs/esm-extensions": 6.x + "@openmrs/esm-feature-flags": 6.x + "@openmrs/esm-globals": 6.x + "@openmrs/esm-utils": 6.x single-spa: 6.x - checksum: 10/e0dbb00e6b8e010d1244d30fe098d4009beb1c1b3432fb9ed592272b01351db0b9866330b947335ba4291f0b0df4869208a5c72c0d369a4c2f1c1ee6e1d02cd2 + checksum: 10/3026dce425ffd8f9406a4ffc014ef250df070af1aa180e71904916887be4e977f8f908c389076f9f5787499c57dd8e9908d30772f462fd1df44cfd75717e2cee languageName: node linkType: hard -"@openmrs/esm-state@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-state@npm:6.0.1-pre.2575" +"@openmrs/esm-state@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-state@npm:6.0.3-pre.2638" dependencies: zustand: "npm:^4.5.5" peerDependencies: - "@openmrs/esm-globals": 5.x - "@openmrs/esm-utils": 5.x - checksum: 10/5620c720075e9099c646881e6434e2ac3785af3fea85e2f298731c153ec31954b21c02f3d721a02baf0e4999a2d484779cdfffdb98278ab1340b961e75ced725 + "@openmrs/esm-globals": 6.x + "@openmrs/esm-utils": 6.x + checksum: 10/dbdfd533434430d0960d9b3eba4963f208129da208335f0a4db45f71095182d6267c07563e751009f6eaf2deb41ff8ad452ec387a472ad35221d31d4f0cb4481 languageName: node linkType: hard -"@openmrs/esm-styleguide@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-styleguide@npm:6.0.1-pre.2575" +"@openmrs/esm-styleguide@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-styleguide@npm:6.0.3-pre.2638" dependencies: "@carbon/charts": "npm:^1.12.0" "@carbon/react": "npm:~1.37.0" @@ -3721,19 +3721,19 @@ __metadata: react-aria-components: "npm:^1.3.3" react-avatar: "npm:^5.0.3" peerDependencies: - "@openmrs/esm-error-handling": 5.x - "@openmrs/esm-extensions": 5.x - "@openmrs/esm-navigation": 5.x - "@openmrs/esm-react-utils": 5.x - "@openmrs/esm-state": 5.x - "@openmrs/esm-translations": 5.x + "@openmrs/esm-error-handling": 6.x + "@openmrs/esm-extensions": 6.x + "@openmrs/esm-navigation": 6.x + "@openmrs/esm-react-utils": 6.x + "@openmrs/esm-state": 6.x + "@openmrs/esm-translations": 6.x dayjs: 1.x i18next: 21.x react: 18.x react-dom: 18.x react-i18next: 11.x rxjs: 6.x - checksum: 10/46789498d9bcf5f74b815dc99ab96385f16ce777364320debcc3b018a48a7ce8bd5d95d700650d64f7c7197daad1515aab83f38bd6f45eca32b2a0197ec8cdaf + checksum: 10/09b662864783bdd8326a5402a3e4585e8a62eb9eb70e7871019fdbbdf9967f17f5c32e531388818c7b0d972baa6141c2270852d73f0928a5a23a4cf16d44bbfb languageName: node linkType: hard @@ -3767,36 +3767,36 @@ __metadata: languageName: node linkType: hard -"@openmrs/esm-translations@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-translations@npm:6.0.1-pre.2575" +"@openmrs/esm-translations@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-translations@npm:6.0.3-pre.2638" dependencies: i18next: "npm:21.10.0" peerDependencies: i18next: 21.x - checksum: 10/7d7c2e7b7852765392d2255c177429b50398da669af2e92b0c8d4bf4da3186e2acdf2a03c3ad9685410ed4e0c628122cd2bb55eea5a19dafffe9c05e75c1e59a + checksum: 10/b2169bc84bbdd26275a2673fd34fd6945073b2415c9a1b71efbe65be0b62e82d87bd1700fbc4687843a231ea4fa02bb16c67904ca96906c84c9fcf80dde31bc7 languageName: node linkType: hard -"@openmrs/esm-utils@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/esm-utils@npm:6.0.1-pre.2575" +"@openmrs/esm-utils@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/esm-utils@npm:6.0.3-pre.2638" dependencies: "@formatjs/intl-durationformat": "npm:^0.2.4" "@internationalized/date": "npm:^3.5.5" semver: "npm:7.3.2" peerDependencies: - "@openmrs/esm-globals": 5.x + "@openmrs/esm-globals": 6.x dayjs: 1.x i18next: 21.x rxjs: 6.x - checksum: 10/35ac162cd1cf169a3614a9ddedc7bf5da72bc2fbfa584086eb19ba85aa0a623a41e0d266e5b2b5d2a3465765dcbba6e699a27f5f059ffc0d99ee9550e5609fc1 + checksum: 10/7a7eb5ac158803d51ac453582c20949a340c984c061221c4af76355adfcb8a2e71c180d0265edf50a2786f7ecaea8922c8e59827c1378f4d5797818ae4961526 languageName: node linkType: hard -"@openmrs/webpack-config@npm:6.0.1-pre.2575": - version: 6.0.1-pre.2575 - resolution: "@openmrs/webpack-config@npm:6.0.1-pre.2575" +"@openmrs/webpack-config@npm:6.0.3-pre.2638": + version: 6.0.3-pre.2638 + resolution: "@openmrs/webpack-config@npm:6.0.3-pre.2638" dependencies: "@swc/core": "npm:^1.3.58" clean-webpack-plugin: "npm:^4.0.0" @@ -3814,7 +3814,7 @@ __metadata: webpack-stats-plugin: "npm:^1.0.3" peerDependencies: webpack: 5.x - checksum: 10/87c0ebabffadc79779f52de58b93ce4b93101ea9043e43e17d229e1bbeb694ddc21c3a59c4c2e75c7777b5de774116b2d4c5bbffd1dd116dd9e3dfce39d8eb5e + checksum: 10/715e9e685e42abdc9c6704993b425709d3d0a9a43198e7b6e3d93e83c4da1bb47263b01f39385474df91b85839f6c5b46a0149cc461b7272f3d23aa79aa8b2c3 languageName: node linkType: hard @@ -15476,11 +15476,11 @@ __metadata: linkType: hard "openmrs@npm:next": - version: 6.0.1-pre.2575 - resolution: "openmrs@npm:6.0.1-pre.2575" + version: 6.0.3-pre.2638 + resolution: "openmrs@npm:6.0.3-pre.2638" dependencies: - "@openmrs/esm-app-shell": "npm:6.0.1-pre.2575" - "@openmrs/webpack-config": "npm:6.0.1-pre.2575" + "@openmrs/esm-app-shell": "npm:6.0.3-pre.2638" + "@openmrs/webpack-config": "npm:6.0.3-pre.2638" "@pnpm/npm-conf": "npm:^2.1.0" "@swc/core": "npm:^1.3.58" autoprefixer: "npm:^10.4.20" @@ -15519,7 +15519,7 @@ __metadata: yargs: "npm:^17.6.2" bin: openmrs: ./dist/cli.js - checksum: 10/9475c98aff6b7242d9f09f330f8f34979ef4f3ef1c3b4b649b3ea005028dd503ebff698b77d7f2b0d82d2bb835a89f7d19cd409ae1af713618f7bdb0d5eb5b88 + checksum: 10/a1278c2a7ee9f245ac9a7d09027865224887d26e7f8c6d9c3dcb7bd49b1a654824c2d734da75b637030f23f759e3c39f7c1e29369a63e0e60153a69c87dd5772 languageName: node linkType: hard From fae8373c99a32c025ce3c0ae9c3b023c41a9ea64 Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 15 Jan 2025 01:53:20 +0530 Subject: [PATCH 4/8] Make the showing/hiding reference number field configurable --- src/config-schema.ts | 7 +++ .../medical-supply-order-form.component.tsx | 52 ++++++++++--------- translations/en.json | 2 +- translations/fr.json | 2 +- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/config-schema.ts b/src/config-schema.ts index 5bd3bc1..06112d8 100644 --- a/src/config-schema.ts +++ b/src/config-schema.ts @@ -26,6 +26,12 @@ export const configSchema = { }, ], }, + showReferenceNumberField: { + _type: Type.Boolean, + _default: true, + _description: + 'Whether to display the Reference number field in the Order form. This field maps to the accesion_number property in the Order data model', + }, quantityUnits: { _type: Type.Object, _description: 'Concept to be used for fetching quantity units', @@ -53,6 +59,7 @@ export type ConfigObject = { orderTypeUuid: string; orderableConceptSets: Array; }>; + showReferenceNumberField: boolean; quantityUnits: { conceptUuid: string; map: 'answers' | 'setMembers'; diff --git a/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx b/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx index facc8ae..867c1f6 100644 --- a/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx +++ b/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx @@ -30,6 +30,7 @@ import styles from './medical-supply-order-form.scss'; import { type Concept, ordersEqual, prepOrderPostData, useQuantityUnits } from '../resources'; import { moduleName } from '../../constants'; import { type MedicalSupplyOrderBasketItem } from '../types'; +import { type ConfigObject } from '../../config-schema'; export interface OrderFormProps extends DefaultPatientWorkspaceProps { initialOrder: MedicalSupplyOrderBasketItem; @@ -55,6 +56,7 @@ export function OrderForm({ const [showErrorNotification, setShowErrorNotification] = useState(false); const { orderType } = useOrderType(orderTypeUuid); const { concepts, isLoadingQuantityUnits, errorFetchingQuantityUnits } = useQuantityUnits(); + const { showReferenceNumberField } = useConfig(); const OrderFormSchema = useMemo( () => @@ -167,31 +169,31 @@ export function OrderForm({ - - - - ( - - )} - /> - - - + {showReferenceNumberField && ( + + + + ( + + )} + /> + + + + )} diff --git a/translations/en.json b/translations/en.json index dc2ff3a..a10a8fc 100644 --- a/translations/en.json +++ b/translations/en.json @@ -25,6 +25,7 @@ "quantityRequired": "Quantity is required", "quantityUnit": "Quantity unit", "quantityUnitsRequired": "Quantity units is required", + "referenceFieldLabelText": "Reference number", "removeFromBasket": "Remove from basket", "returnToOrderBasket": "Return to order basket", "saveOrder": "Save order", @@ -32,7 +33,6 @@ "searchMedicalSupplyOrderables": "Search medical supply orderables", "searchResultsMatchesForTerm_one": "{{count}} results for \"{{searchTerm}}\"", "searchResultsMatchesForTerm_other": "{{count}} results for \"{{searchTerm}}\"", - "testOrderReferenceNumber": "{{orderType}} reference number", "testType": "Test type", "trySearchingAgain": "Please try searching again", "tryTo": "Try to", diff --git a/translations/fr.json b/translations/fr.json index b67a782..c09fbe9 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -25,6 +25,7 @@ "quantityRequired": "La quantité est requise", "quantityUnit": "Unité de quantité", "quantityUnitsRequired": "Les unités de quantité sont requises", + "referenceFieldLabelText": "Reference number", "removeFromBasket": "Retirer du panier", "returnToOrderBasket": "Retourner au panier de commande", "saveOrder": "Enregistrer la commande", @@ -33,7 +34,6 @@ "searchResultsMatchesForTerm_one": "{{count}} résultats pour \"{{searchTerm}}\"", "searchResultsMatchesForTerm_many": "{{count}} résultats pour \"{{searchTerm}}\"", "searchResultsMatchesForTerm_other": "{{count}} résultats pour \"{{searchTerm}}\"", - "testOrderReferenceNumber": "Numéro de référence {{orderType}}", "testType": "Type de test", "trySearchingAgain": "Veuillez réessayer de rechercher", "tryTo": "Essayer de", From d58fc78d73d6349721feaa74d9b25706a82a626c Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 15 Jan 2025 01:54:45 +0530 Subject: [PATCH 5/8] The reference fields and instructions fields should be nullable --- .../medical-supply-order-form.component.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx b/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx index 867c1f6..9e0f5c6 100644 --- a/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx +++ b/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx @@ -61,7 +61,7 @@ export function OrderForm({ const OrderFormSchema = useMemo( () => z.object({ - instructions: z.string().optional(), + instructions: z.string().nullish(), urgency: z.string().refine((value) => value !== '', { message: t('addLabOrderPriorityRequired', 'Priority is required'), }), @@ -79,7 +79,7 @@ export function OrderForm({ invalid_type_error: t('quantityUnitsRequired', 'Quantity units is required'), }, ), - accessionNumber: z.string().optional(), + accessionNumber: z.string().nullish(), concept: z.object( { display: z.string(), uuid: z.string() }, { From 3570668c91deeb9693c9f60483bd5a7003e8131e Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 15 Jan 2025 01:58:00 +0530 Subject: [PATCH 6/8] Replace the priority combobox with select --- .../medical-supply-order-form.component.tsx | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx b/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx index 9e0f5c6..1f0f98b 100644 --- a/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx +++ b/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx @@ -19,6 +19,8 @@ import { Layer, NumberInput, SelectSkeleton, + Select, + SelectItem, TextArea, TextInput, } from '@carbon/react'; @@ -268,19 +270,19 @@ export function OrderForm({ ( - onChange(selectedItem?.value || '')} - selectedItem={priorityOptions.find((option) => option.value === value) || null} - shouldFilterItem={filterItemsByName} + render={({ field, fieldState }) => ( + )} /> From bf872b667eae25a1c583a15b85bb30a9889e02e2 Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Thu, 16 Jan 2025 14:51:46 +0530 Subject: [PATCH 7/8] Support scheduled date for medical supply orders --- .../medical-supply-order-form.component.tsx | 112 ++++++--- src/medical-orders/resources.ts | 13 +- yarn.lock | 222 +++++++++--------- 3 files changed, 201 insertions(+), 146 deletions(-) diff --git a/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx b/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx index 1f0f98b..9394448 100644 --- a/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx +++ b/src/medical-orders/medical-supply-order-form/medical-supply-order-form.component.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import React, { type ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react'; import classNames from 'classnames'; import { type DefaultPatientWorkspaceProps, @@ -6,8 +6,9 @@ import { useOrderBasket, useOrderType, priorityOptions, + type OrderUrgency, } from '@openmrs/esm-patient-common-lib'; -import { translateFrom, useLayoutType, useSession, useConfig, ExtensionSlot } from '@openmrs/esm-framework'; +import { useLayoutType, useSession, useConfig, ExtensionSlot, OpenmrsDatePicker } from '@openmrs/esm-framework'; import { Button, ButtonSet, @@ -25,12 +26,11 @@ import { TextInput, } from '@carbon/react'; import { useTranslation } from 'react-i18next'; -import { Controller, type FieldErrors, useForm } from 'react-hook-form'; +import { Controller, type ControllerRenderProps, type FieldErrors, useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; import styles from './medical-supply-order-form.scss'; import { type Concept, ordersEqual, prepOrderPostData, useQuantityUnits } from '../resources'; -import { moduleName } from '../../constants'; import { type MedicalSupplyOrderBasketItem } from '../types'; import { type ConfigObject } from '../../config-schema'; @@ -62,34 +62,40 @@ export function OrderForm({ const OrderFormSchema = useMemo( () => - z.object({ - instructions: z.string().nullish(), - urgency: z.string().refine((value) => value !== '', { - message: t('addLabOrderPriorityRequired', 'Priority is required'), + z + .object({ + instructions: z.string().nullish(), + urgency: z.string().refine((value) => value !== '', { + message: t('addLabOrderPriorityRequired', 'Priority is required'), + }), + quantity: z.number({ + required_error: t('quantityRequired', 'Quantity is required'), + invalid_type_error: t('quantityRequired', 'Quantity is required'), + }), + quantityUnits: z.object( + { + display: z.string(), + uuid: z.string(), + }, + { + required_error: t('quantityUnitsRequired', 'Quantity units is required'), + invalid_type_error: t('quantityUnitsRequired', 'Quantity units is required'), + }, + ), + accessionNumber: z.string().nullish(), + concept: z.object( + { display: z.string(), uuid: z.string() }, + { + required_error: t('addOrderableConceptRequired', 'Orderable concept is required'), + invalid_type_error: t('addOrderableConceptRequired', 'Orderable concept is required'), + }, + ), + scheduledDate: z.date().nullish(), + }) + .refine((data) => data.urgency !== 'ON_SCHEDULED_DATE' || Boolean(data.scheduledDate), { + message: t('scheduledDateRequired', 'Scheduled date is required'), + path: ['scheduledDate'], }), - quantity: z.number({ - required_error: t('quantityRequired', 'Quantity is required'), - invalid_type_error: t('quantityRequired', 'Quantity is required'), - }), - quantityUnits: z.object( - { - display: z.string(), - uuid: z.string(), - }, - { - required_error: t('quantityUnitsRequired', 'Quantity units is required'), - invalid_type_error: t('quantityUnitsRequired', 'Quantity units is required'), - }, - ), - accessionNumber: z.string().nullish(), - concept: z.object( - { display: z.string(), uuid: z.string() }, - { - required_error: t('addOrderableConceptRequired', 'Orderable concept is required'), - invalid_type_error: t('addOrderableConceptRequired', 'Orderable concept is required'), - }, - ), - }), [t], ); @@ -97,6 +103,8 @@ export function OrderForm({ control, handleSubmit, formState: { errors, defaultValues, isDirty }, + setValue, + watch, } = useForm({ mode: 'all', resolver: zodResolver(OrderFormSchema), @@ -105,9 +113,7 @@ export function OrderForm({ }, }); - const filterItemsByName = useCallback((menu) => { - return menu?.item?.value?.toLowerCase().includes(menu?.inputValue?.toLowerCase()); - }, []); + const isScheduledDateRequired = watch('urgency') === 'ON_SCHEDULED_DATE'; const handleFormSubmission = useCallback( (data: MedicalSupplyOrderBasketItem) => { @@ -156,6 +162,19 @@ export function OrderForm({ promptBeforeClosing(() => isDirty); }, [isDirty, promptBeforeClosing]); + const handleUpdateUrgency = useCallback( + (fieldOnChange: ControllerRenderProps['onChange']) => { + return (e: ChangeEvent) => { + const value = e.target.value as OrderUrgency; + if (value !== 'ON_SCHEDULED_DATE') { + setValue('scheduledDate', null); + } + fieldOnChange(e); + }; + }, + [setValue], + ); + const responsiveSize = isTablet ? 'lg' : 'sm'; return ( @@ -274,6 +293,7 @@ export function OrderForm({