@openmrs/esm-patient-orders-app 7.0.2-pre.3866 → 7.0.2-pre.3883
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.
- package/.turbo/turbo-build.log +14 -14
- package/dist/287.js +1 -1
- package/dist/347.js +1 -1
- package/dist/429.js +2 -0
- package/dist/429.js.map +1 -0
- package/dist/55.js +1 -1
- package/dist/574.js +1 -1
- package/dist/99.js +1 -0
- package/dist/99.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-orders-app.js +1 -1
- package/dist/openmrs-esm-patient-orders-app.js.buildmanifest.json +65 -65
- package/dist/openmrs-esm-patient-orders-app.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +3 -3
- package/src/components/medication-record.component.tsx +90 -0
- package/src/components/medication-record.scss +52 -0
- package/src/components/order-details-table.scss +0 -24
- package/src/components/orders-details-table.component.tsx +72 -43
- package/src/components/test-order.component.tsx +17 -0
- package/src/components/test-order.scss +13 -0
- package/translations/en.json +10 -1
- package/dist/551.js +0 -2
- package/dist/551.js.map +0 -1
- package/dist/874.js +0 -1
- package/dist/874.js.map +0 -1
- /package/dist/{551.js.LICENSE.txt → 429.js.LICENSE.txt} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
assets by path [1m[32m*.js[39m[22m 1.
|
|
1
|
+
assets by path [1m[32m*.js[39m[22m 1.76 MiB
|
|
2
2
|
assets by chunk 1.05 MiB (id hint: vendors)
|
|
3
|
-
assets by status [1m[
|
|
3
|
+
assets by status [1m[33m899 KiB[39m[22m [1m[33m[big][39m[22m
|
|
4
4
|
asset [1m[33m130.js[39m[22m [1m[33m453 KiB[39m[22m [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m [1m[33m[big][39m[22m (id hint: vendors) 2 related assets
|
|
5
|
-
asset [1m[
|
|
5
|
+
asset [1m[33m429.js[39m[22m [1m[33m446 KiB[39m[22m [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m [1m[33m[big][39m[22m (id hint: vendors) 2 related assets
|
|
6
6
|
asset [1m[32m940.js[39m[22m 75.5 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
7
7
|
asset [1m[32m591.js[39m[22m 67.8 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 2 related assets
|
|
8
8
|
asset [1m[32m950.js[39m[22m 23.3 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
@@ -12,15 +12,15 @@ assets by path [1m[32m*.js[39m[22m 1.72 MiB
|
|
|
12
12
|
assets by path [1m[32m*.json[39m[22m 15.6 KiB
|
|
13
13
|
asset [1m[32mopenmrs-esm-patient-orders-app.js.buildmanifest.json[39m[22m 14.9 KiB [1m[32m[emitted][39m[22m
|
|
14
14
|
asset [1m[32mroutes.json[39m[22m 700 bytes [1m[32m[emitted][39m[22m [from: src/routes.json] [1m[32m[copied][39m[22m
|
|
15
|
-
orphan modules 3.
|
|
15
|
+
orphan modules 3.53 MiB [1m[33m[orphan][39m[22m 551 modules
|
|
16
16
|
runtime modules 41.6 KiB 28 modules
|
|
17
|
-
built modules 4.
|
|
18
|
-
modules by path [1m../[39m[22m 4.
|
|
19
|
-
modules by path [1m../../node_modules/[39m[22m 4.
|
|
17
|
+
built modules 4.45 MiB (javascript) 378 bytes (consume-shared) 336 bytes (share-init) [1m[33m[built][39m[22m
|
|
18
|
+
modules by path [1m../[39m[22m 4.32 MiB
|
|
19
|
+
modules by path [1m../../node_modules/[39m[22m 4.19 MiB 104 modules
|
|
20
20
|
modules by path [1m../esm-patient-common-lib/src/[39m[22m 131 KiB 6 modules
|
|
21
|
-
modules by path [1m./[39m[22m
|
|
22
|
-
modules
|
|
23
|
-
modules
|
|
21
|
+
modules by path [1m./[39m[22m 132 KiB
|
|
22
|
+
javascript modules 127 KiB 10 modules
|
|
23
|
+
optional modules 5.05 KiB [1m[33m[optional][39m[22m 9 modules
|
|
24
24
|
consume-shared-module modules 378 bytes 9 modules
|
|
25
25
|
provide-module modules 336 bytes
|
|
26
26
|
modules by path [1mprovide shared module (default) @openmrs/[39m[22m 84 bytes 2 modules
|
|
@@ -31,14 +31,14 @@ built modules 4.41 MiB (javascript) 378 bytes (consume-shared) 336 bytes (share-
|
|
|
31
31
|
[1m[33mWARNING[39m[22m in [1masset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
|
|
32
32
|
This can impact web performance.
|
|
33
33
|
Assets:
|
|
34
|
-
main.js (
|
|
34
|
+
main.js (524 KiB)
|
|
35
35
|
130.js (453 KiB)
|
|
36
|
-
|
|
36
|
+
429.js (446 KiB)[39m[22m
|
|
37
37
|
|
|
38
38
|
[1m[33mWARNING[39m[22m in [1mentrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
|
|
39
39
|
Entrypoints:
|
|
40
|
-
main (
|
|
40
|
+
main (524 KiB)
|
|
41
41
|
main.js
|
|
42
42
|
[39m[22m
|
|
43
43
|
|
|
44
|
-
webpack 5.89.0 compiled with [1m[33m2 warnings[39m[22m in
|
|
44
|
+
webpack 5.89.0 compiled with [1m[33m2 warnings[39m[22m in 74735 ms
|
package/dist/287.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_patient_orders_app=globalThis.webpackChunk_openmrs_esm_patient_orders_app||[]).push([[287],{5746:(e,t,r)=>{r.d(t,{Z:()=>s});var n=r(272),o=r.n(n),i=r(2609),a=r.n(i)()(o());a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-orders__order-basket__productiveHeading01___aAMkC{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);margin-bottom:.5rem}.-esm-patient-orders__order-basket__productiveHeading02___JR6Pm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-orders__order-basket__productiveHeading03___Qul45{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-orders__order-basket__productiveHeading04___UPbmi{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-orders__order-basket__productiveHeading05___JQ5Yo{font-size:var(--cds-heading-05-font-size, 2rem);font-weight:var(--cds-heading-05-font-weight, 400);line-height:var(--cds-heading-05-line-height, 1.25);letter-spacing:var(--cds-heading-05-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-orders__order-basket__productiveHeading06___FLzLQ{font-size:var(--cds-heading-06-font-size, 2.625rem);font-weight:var(--cds-heading-06-font-weight, 300);line-height:var(--cds-heading-06-line-height, 1.199);letter-spacing:var(--cds-heading-06-letter-spacing, 0);margin-bottom:1.5rem}.-esm-patient-orders__order-basket__bodyShort01___kBn0A{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px)}.-esm-patient-orders__order-basket__bodyShort02___gKL5T{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0)}.-esm-patient-orders__order-basket__bodyLong01___jMGsh{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}.-esm-patient-orders__order-basket__bodyLong02___e6XDW{font-size:var(--cds-body-02-font-size, 1rem);font-weight:var(--cds-body-02-font-weight, 400);line-height:var(--cds-body-02-line-height, 1.5);letter-spacing:var(--cds-body-02-letter-spacing, 0)}.-esm-patient-orders__order-basket__label01___k_7MI{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-patient-orders__order-basket__caption01___htfVm{font-size:var(--cds-legal-01-font-size, 0.75rem);font-weight:var(--cds-legal-01-font-weight, 400);line-height:var(--cds-legal-01-line-height, 1.33333);letter-spacing:var(--cds-legal-01-letter-spacing, 0.32px)}.-esm-patient-orders__order-basket__clipTextWithEllipsis___axdS4{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.-esm-patient-orders__order-basket__text02___SDpzW{color:#525252}.-esm-patient-orders__order-basket__container___XnXp7{display:flex;flex-direction:column;justify-content:space-between;height:var(--desktop-workspace-window-height)}.-esm-patient-orders__order-basket__orderBasketContainer___F8hsg{margin:1rem}.-esm-patient-orders__order-basket__orderBasketContainer___F8hsg .cds--btn-set .cds--btn{max-width:50%;height:4rem}.-esm-patient-orders__order-basket__orderBasketSlot___IyOy9{display:flex;flex-direction:column;gap:2rem}.-esm-patient-orders__order-basket__orderBasketSlotTablet___cT0Ew{gap:1rem}.-esm-patient-orders__order-basket__buttonSet___me45x{padding:0rem}.-esm-patient-orders__order-basket__bottomButton___f2w2K{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-orders__order-basket__inlineNotification___XpH5s,.-esm-patient-orders__order-basket__actionNotification___NsF1Q{max-width:unset !important}.omrs-breakpoint-lt-desktop .-esm-patient-orders__order-basket__container___XnXp7{height:var(--tablet-workspace-window-height)}.omrs-breakpoint-lt-desktop .-esm-patient-orders__order-basket__buttonSet___me45x{padding:1.5rem 1rem;background-color:#fff}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/order-basket/order-basket.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,gEC81BI,2DAAA,CAAA,0DAAA,CAAA,8DAAA,CAAA,mEAAA,CD51BF,mBEeW,CFZb,gECy1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CDv1BF,kBEoBW,CFjBb,gECo1BI,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDl1BF,kBEeW,CFZb,gEC+0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CD70BF,kBEUW,CFPb,gEC00BI,+CAAA,CAAA,kDAAA,CAAA,mDAAA,CAAA,sDAAA,CDx0BF,kBEKW,CFFb,gECq0BI,mDAAA,CAAA,kDAAA,CAAA,oDAAA,CAAA,sDAAA,CDn0BF,oBEKW,CFFb,wDCg0BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CD5zBJ,wDC4zBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDxzBJ,uDCwzBI,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CDpzBJ,uDCozBI,4CAAA,CAAA,+CAAA,CAAA,+CAAA,CAAA,mDAAA,CDhzBJ,oDCgzBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD5yBJ,sDC4yBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CDxyBJ,iEACE,sBAAA,CACA,eAAA,CACA,kBAAA,CAGF,mDACE,aD5DQ,CIFV,sDACE,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,6CAAA,CAGF,iEACE,WDoBW,CCjBb,yFACE,aAAA,CACA,WAAA,CAGF,4DACE,YAAA,CACA,qBAAA,CACA,QAAA,CAGF,kEACE,QAAA,CAGF,sDACE,YAAA,CAGF,yDACE,WAAA,CACA,YAAA,CACA,wBAAA,CACA,oBAAA,CACA,aAAA,CAGF,8HACE,0BAAA,CAKA,kFACE,4CAAA,CAGF,kFACE,mBAAA,CACA,qBJpDI",sourceRoot:""}]),a.locals={productiveHeading01:"-esm-patient-orders__order-basket__productiveHeading01___aAMkC",productiveHeading02:"-esm-patient-orders__order-basket__productiveHeading02___JR6Pm",productiveHeading03:"-esm-patient-orders__order-basket__productiveHeading03___Qul45",productiveHeading04:"-esm-patient-orders__order-basket__productiveHeading04___UPbmi",productiveHeading05:"-esm-patient-orders__order-basket__productiveHeading05___JQ5Yo",productiveHeading06:"-esm-patient-orders__order-basket__productiveHeading06___FLzLQ",bodyShort01:"-esm-patient-orders__order-basket__bodyShort01___kBn0A",bodyShort02:"-esm-patient-orders__order-basket__bodyShort02___gKL5T",bodyLong01:"-esm-patient-orders__order-basket__bodyLong01___jMGsh",bodyLong02:"-esm-patient-orders__order-basket__bodyLong02___e6XDW",label01:"-esm-patient-orders__order-basket__label01___k_7MI",caption01:"-esm-patient-orders__order-basket__caption01___htfVm",clipTextWithEllipsis:"-esm-patient-orders__order-basket__clipTextWithEllipsis___axdS4",text02:"-esm-patient-orders__order-basket__text02___SDpzW",container:"-esm-patient-orders__order-basket__container___XnXp7",orderBasketContainer:"-esm-patient-orders__order-basket__orderBasketContainer___F8hsg",orderBasketSlot:"-esm-patient-orders__order-basket__orderBasketSlot___IyOy9",orderBasketSlotTablet:"-esm-patient-orders__order-basket__orderBasketSlotTablet___cT0Ew",buttonSet:"-esm-patient-orders__order-basket__buttonSet___me45x",bottomButton:"-esm-patient-orders__order-basket__bottomButton___f2w2K",inlineNotification:"-esm-patient-orders__order-basket__inlineNotification___XpH5s",actionNotification:"-esm-patient-orders__order-basket__actionNotification___NsF1Q"};const s=a},287:(e,t,r)=>{r.r(t),r.d(t,{default:()=>x});var n=r(268),o=r.n(n),i=r(2779),a=r.n(i),s=r(4924),d=r(7986),c=r(2870),A=r(2821),l=r(3255);function _(e,t,r,n,o){var i=new Date,a=(0,c.parseDate)(null==r?void 0:r.startDatetime),s=(0,c.parseDate)(null==r?void 0:r.stopDatetime);!r||a<i&&(!s||s>i)||console.warn("createEmptyEncounter received an active visit that is not currently active. This is a programming error. Attempting to place the order using the visit start date.");var d={patient:e,location:n,encounterType:t,encounterDatetime:void 0,visit:null==r?void 0:r.uuid,obs:[]};return(0,c.openmrsFetch)("".concat(c.restBaseUrl,"/encounter"),{headers:{"Content-Type":"application/json"},method:"POST",body:d,signal:null==o?void 0:o.signal}).then((function(e){var t;return null==e||null===(t=e.data)||void 0===t?void 0:t.uuid}))}var u=r(321),p=r.n(u),m=r(1195),g=r.n(m),h=r(3275),b=r.n(h),f=r(7162),C=r.n(f),v=r(2094),k=r.n(v),y=r(757),D=r.n(y),w=r(5746),B={};B.styleTagTransform=D(),B.setAttributes=C(),B.insert=b().bind(null,"head"),B.domAPI=g(),B.insertStyleElement=k(),p()(w.Z,B);const E=w.Z&&w.Z.locals?w.Z.locals:void 0;function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function F(e,t,r,n,o,i,a){try{var s=e[i](a),d=s.value}catch(e){return void r(e)}s.done?t(d):Promise.resolve(d).then(n,o)}function z(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){F(i,n,o,a,s,"next",e)}function s(e){F(i,n,o,a,s,"throw",e)}a(void 0)}))}}const x=function(e){var t,r,i=e.patientUuid,u=e.closeWorkspace,p=e.closeWorkspaceWithSavedChanges,m=e.promptBeforeClosing,g=(0,s.useTranslation)().t,h="tablet"===(0,c.useLayoutType)(),b=(0,c.useConfig)(),f=(0,c.useSession)(),C=(0,A.useVisitOrOfflineVisit)(i).activeVisit,v=(0,A.useOrderBasket)(),k=v.orders,y=v.clearOrders,D=function(e){var t=(0,A.useSystemVisitSetting)(),r=t.systemVisitEnabled,o=t.isLoadingSystemVisitSetting,i=t.errorFetchingSystemVisitSetting,a=new Date,s="".concat(a.getFullYear(),"-").concat(a.getMonth()+1,"-").concat(a.getDate()),d=(0,l.ZP)(o||r||!e?null:"".concat(c.restBaseUrl,"/encounter?patient=").concat(e,"&fromdate=").concat(s,"&limit=1"),c.openmrsFetch),_=(0,A.useVisitOrOfflineVisit)(e);return(0,n.useMemo)((function(){var e,t,n,a,s,c,A;return o||i?{activeVisitRequired:!1,isLoading:o,error:i,encounterUuid:null,mutate:function(){}}:r?{activeVisitRequired:!0,isLoading:null==_?void 0:_.isLoading,encounterUuid:null==_||null===(n=_.currentVisit)||void 0===n||null===(t=n.encounters)||void 0===t||null===(e=t[0])||void 0===e?void 0:e.uuid,error:null==_?void 0:_.error,mutate:null==_?void 0:_.mutate}:{activeVisitRequired:!1,isLoading:null==d?void 0:d.isLoading,encounterUuid:null==d||null===(A=d.data)||void 0===A||null===(c=A.data)||void 0===c||null===(s=c.results)||void 0===s||null===(a=s[0])||void 0===a?void 0:a.uuid,error:null==d?void 0:d.error,mutate:null==d?void 0:d.mutate}}),[o,i,_,d,r])}(i),w=D.activeVisitRequired,B=D.isLoading,F=D.encounterUuid,x=D.error,T=D.mutate,I=(t=(0,n.useState)(""),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}}(t,r)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),W=I[0],L=I[1],N=function(e){var t=(0,l.kY)().mutate;return{mutate:(0,n.useCallback)((function(){return t((function(t){return"string"==typeof t&&t.startsWith("".concat(c.restBaseUrl,"/order?patient=").concat(e))}))}),[e,t])}}(i),V=N.mutate;(0,n.useEffect)((function(){m((function(){return!!k.length}))}),[k]);var H,O,U,P=(0,n.useCallback)((function(){var e=(0,c.showModal)("start-visit-dialog",{patientUuid:i,closeModal:function(){return e()}})}),[i]),j=(0,n.useCallback)(z((function(){var e,t,r,n,o;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(a){switch(a.label){case 0:if(e=new AbortController,L(""),t=F)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,_(i,null==b?void 0:b.orderEncounterType,w?C:null,null==f||null===(r=f.sessionLocation)||void 0===r?void 0:r.uuid,e)];case 2:return t=a.sent(),T(),[3,4];case 3:return n=a.sent(),L(n),console.error(n),[2];case 4:return[4,(0,A.postOrders)(t,e)];case 5:return o=a.sent(),y({exceptThoseMatching:function(e){return o.map((function(e){return e.display})).includes(e.display)}}),V(),0==o.length?(p(),function(e,t){var r=t.filter((function(e){return["NEW","RENEW"].includes(e.action)})).map((function(e){return e.display})).join(", "),n=t.filter((function(e){return"REVISE"===e.action})).map((function(e){return e.display})).join(", "),o=t.filter((function(e){return"DISCONTINUE"===e.action})).map((function(e){return e.display})).join(", ");(0,c.showSnackbar)({isLowContrast:!0,kind:"success",title:e("orderCompleted","Placed orders"),subtitle:(r&&"".concat(e("ordered","Placed order for")," ").concat(r,". "))+(n&&"".concat(e("updated","Updated")," ").concat(n,". "))+(o&&"".concat(e("discontinued","Discontinued")," ").concat(o,"."))})}(g,k)):function(e){(0,c.showSnackbar)({isLowContrast:!1,kind:"error",title:e("error","Error"),subtitle:e("errorSavingOrder","There were errors saving some orders.")})}(g),[2,function(){return e.abort()}]}}))})),[C,w,y,p,b,F,T,V,k,i,f,g]),M=(0,n.useCallback)((function(){u({onWorkspaceClose:y})}),[y,u]);return o().createElement(o().Fragment,null,o().createElement("div",{className:E.container},o().createElement("div",{className:E.orderBasketContainer},o().createElement(c.ExtensionSlot,{className:a()(E.orderBasketSlot,(H={},O=E.orderBasketSlotTablet,U=h,O in H?Object.defineProperty(H,O,{value:U,enumerable:!0,configurable:!0,writable:!0}):H[O]=U,H)),name:"order-basket-slot"})),o().createElement("div",null,(W||x)&&o().createElement(d.K0D,{kind:"error",title:g("errorCreatingAnEncounter","Error when creating an encounter"),subtitle:g("tryReopeningTheWorkspaceAgain","Please try launching the workspace again"),lowContrast:!0,className:E.inlineNotification,inline:!0}),o().createElement(d.uVA,{className:E.buttonSet},o().createElement(d.zxk,{className:E.bottomButton,kind:"secondary",onClick:M},g("cancel","Cancel")),o().createElement(d.zxk,{className:E.bottomButton,kind:"primary",onClick:j,disabled:!(null==k?void 0:k.length)||B||w&&!C||(null==k?void 0:k.some((function(e){return e.isOrderIncomplete})))},g("signAndClose","Sign and close"))))),w&&!C&&o().createElement(d.FQz,{kind:"error",actionButtonLabel:g("startVisit","Start visit"),onActionButtonClick:P,title:g("startAVisitToRecordOrders","Start a visit to order"),subtitle:g("activeVisitRequired","An active visit is required to make orders"),lowContrast:!0,inline:!0,className:E.actionNotification,hasFocus:!0}))}}}]);
|
|
1
|
+
"use strict";(globalThis.webpackChunk_openmrs_esm_patient_orders_app=globalThis.webpackChunk_openmrs_esm_patient_orders_app||[]).push([[287],{5746:(e,t,r)=>{r.d(t,{Z:()=>s});var n=r(272),o=r.n(n),i=r(2609),a=r.n(i)()(o());a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-orders__order-basket__productiveHeading01___aAMkC{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);margin-bottom:.5rem}.-esm-patient-orders__order-basket__productiveHeading02___JR6Pm{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-orders__order-basket__productiveHeading03___Qul45{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-orders__order-basket__productiveHeading04___UPbmi{font-size:var(--cds-heading-04-font-size, 1.75rem);font-weight:var(--cds-heading-04-font-weight, 400);line-height:var(--cds-heading-04-line-height, 1.28572);letter-spacing:var(--cds-heading-04-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-orders__order-basket__productiveHeading05___JQ5Yo{font-size:var(--cds-heading-05-font-size, 2rem);font-weight:var(--cds-heading-05-font-weight, 400);line-height:var(--cds-heading-05-line-height, 1.25);letter-spacing:var(--cds-heading-05-letter-spacing, 0);margin-bottom:1rem}.-esm-patient-orders__order-basket__productiveHeading06___FLzLQ{font-size:var(--cds-heading-06-font-size, 2.625rem);font-weight:var(--cds-heading-06-font-weight, 300);line-height:var(--cds-heading-06-line-height, 1.199);letter-spacing:var(--cds-heading-06-letter-spacing, 0);margin-bottom:1.5rem}.-esm-patient-orders__order-basket__bodyShort01___kBn0A{font-size:var(--cds-body-compact-01-font-size, 0.875rem);font-weight:var(--cds-body-compact-01-font-weight, 400);line-height:var(--cds-body-compact-01-line-height, 1.28572);letter-spacing:var(--cds-body-compact-01-letter-spacing, 0.16px)}.-esm-patient-orders__order-basket__bodyShort02___gKL5T{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0)}.-esm-patient-orders__order-basket__bodyLong01___jMGsh{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px)}.-esm-patient-orders__order-basket__bodyLong02___e6XDW{font-size:var(--cds-body-02-font-size, 1rem);font-weight:var(--cds-body-02-font-weight, 400);line-height:var(--cds-body-02-line-height, 1.5);letter-spacing:var(--cds-body-02-letter-spacing, 0)}.-esm-patient-orders__order-basket__label01___k_7MI{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px)}.-esm-patient-orders__order-basket__caption01___htfVm{font-size:var(--cds-legal-01-font-size, 0.75rem);font-weight:var(--cds-legal-01-font-weight, 400);line-height:var(--cds-legal-01-line-height, 1.33333);letter-spacing:var(--cds-legal-01-letter-spacing, 0.32px)}.-esm-patient-orders__order-basket__clipTextWithEllipsis___axdS4{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.-esm-patient-orders__order-basket__text02___SDpzW{color:#525252}.-esm-patient-orders__order-basket__container___XnXp7{display:flex;flex-direction:column;justify-content:space-between;height:var(--desktop-workspace-window-height)}.-esm-patient-orders__order-basket__orderBasketContainer___F8hsg{margin:1rem}.-esm-patient-orders__order-basket__orderBasketContainer___F8hsg .cds--btn-set .cds--btn{max-width:50%;height:4rem}.-esm-patient-orders__order-basket__orderBasketSlot___IyOy9{display:flex;flex-direction:column;gap:2rem}.-esm-patient-orders__order-basket__orderBasketSlotTablet___cT0Ew{gap:1rem}.-esm-patient-orders__order-basket__buttonSet___me45x{padding:0rem}.-esm-patient-orders__order-basket__bottomButton___f2w2K{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-orders__order-basket__inlineNotification___XpH5s,.-esm-patient-orders__order-basket__actionNotification___NsF1Q{max-width:unset !important}.omrs-breakpoint-lt-desktop .-esm-patient-orders__order-basket__container___XnXp7{height:var(--tablet-workspace-window-height)}.omrs-breakpoint-lt-desktop .-esm-patient-orders__order-basket__buttonSet___me45x{padding:1.5rem 1rem;background-color:#fff}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/root.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss","webpack://./src/order-basket/order-basket.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CCnDF,gEC81BI,2DAAA,CAAA,0DAAA,CAAA,8DAAA,CAAA,mEAAA,CD51BF,mBEeW,CFZb,gECy1BI,uDAAA,CAAA,0DAAA,CAAA,4DAAA,CAAA,8DAAA,CDv1BF,kBEoBW,CFjBb,gECo1BI,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDl1BF,kBEeW,CFZb,gEC+0BI,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CAAA,sDAAA,CD70BF,kBEUW,CFPb,gEC00BI,+CAAA,CAAA,kDAAA,CAAA,mDAAA,CAAA,sDAAA,CDx0BF,kBEKW,CFFb,gECq0BI,mDAAA,CAAA,kDAAA,CAAA,oDAAA,CAAA,sDAAA,CDn0BF,oBEKW,CFFb,wDCg0BI,wDAAA,CAAA,uDAAA,CAAA,2DAAA,CAAA,gEAAA,CD5zBJ,wDC4zBI,oDAAA,CAAA,uDAAA,CAAA,yDAAA,CAAA,2DAAA,CDxzBJ,uDCwzBI,gDAAA,CAAA,+CAAA,CAAA,mDAAA,CAAA,wDAAA,CDpzBJ,uDCozBI,4CAAA,CAAA,+CAAA,CAAA,+CAAA,CAAA,mDAAA,CDhzBJ,oDCgzBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CD5yBJ,sDC4yBI,gDAAA,CAAA,gDAAA,CAAA,oDAAA,CAAA,yDAAA,CDxyBJ,iEACE,sBAAA,CACA,eAAA,CACA,kBAAA,CAGF,mDACE,aD5DQ,CIFV,sDACE,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,6CAAA,CAGF,iEACE,WDoBW,CCjBb,yFACE,aAAA,CACA,WAAA,CAGF,4DACE,YAAA,CACA,qBAAA,CACA,QAAA,CAGF,kEACE,QAAA,CAGF,sDACE,YAAA,CAGF,yDACE,WAAA,CACA,YAAA,CACA,wBAAA,CACA,oBAAA,CACA,aAAA,CAGF,8HACE,0BAAA,CAKA,kFACE,4CAAA,CAGF,kFACE,mBAAA,CACA,qBJpDI",sourceRoot:""}]),a.locals={productiveHeading01:"-esm-patient-orders__order-basket__productiveHeading01___aAMkC",productiveHeading02:"-esm-patient-orders__order-basket__productiveHeading02___JR6Pm",productiveHeading03:"-esm-patient-orders__order-basket__productiveHeading03___Qul45",productiveHeading04:"-esm-patient-orders__order-basket__productiveHeading04___UPbmi",productiveHeading05:"-esm-patient-orders__order-basket__productiveHeading05___JQ5Yo",productiveHeading06:"-esm-patient-orders__order-basket__productiveHeading06___FLzLQ",bodyShort01:"-esm-patient-orders__order-basket__bodyShort01___kBn0A",bodyShort02:"-esm-patient-orders__order-basket__bodyShort02___gKL5T",bodyLong01:"-esm-patient-orders__order-basket__bodyLong01___jMGsh",bodyLong02:"-esm-patient-orders__order-basket__bodyLong02___e6XDW",label01:"-esm-patient-orders__order-basket__label01___k_7MI",caption01:"-esm-patient-orders__order-basket__caption01___htfVm",clipTextWithEllipsis:"-esm-patient-orders__order-basket__clipTextWithEllipsis___axdS4",text02:"-esm-patient-orders__order-basket__text02___SDpzW",container:"-esm-patient-orders__order-basket__container___XnXp7",orderBasketContainer:"-esm-patient-orders__order-basket__orderBasketContainer___F8hsg",orderBasketSlot:"-esm-patient-orders__order-basket__orderBasketSlot___IyOy9",orderBasketSlotTablet:"-esm-patient-orders__order-basket__orderBasketSlotTablet___cT0Ew",buttonSet:"-esm-patient-orders__order-basket__buttonSet___me45x",bottomButton:"-esm-patient-orders__order-basket__bottomButton___f2w2K",inlineNotification:"-esm-patient-orders__order-basket__inlineNotification___XpH5s",actionNotification:"-esm-patient-orders__order-basket__actionNotification___NsF1Q"};const s=a},287:(e,t,r)=>{r.r(t),r.d(t,{default:()=>x});var n=r(268),o=r.n(n),i=r(2779),a=r.n(i),s=r(4924),d=r(9997),c=r(2870),A=r(2821),l=r(3255);function _(e,t,r,n,o){var i=new Date,a=(0,c.parseDate)(null==r?void 0:r.startDatetime),s=(0,c.parseDate)(null==r?void 0:r.stopDatetime);!r||a<i&&(!s||s>i)||console.warn("createEmptyEncounter received an active visit that is not currently active. This is a programming error. Attempting to place the order using the visit start date.");var d={patient:e,location:n,encounterType:t,encounterDatetime:void 0,visit:null==r?void 0:r.uuid,obs:[]};return(0,c.openmrsFetch)("".concat(c.restBaseUrl,"/encounter"),{headers:{"Content-Type":"application/json"},method:"POST",body:d,signal:null==o?void 0:o.signal}).then((function(e){var t;return null==e||null===(t=e.data)||void 0===t?void 0:t.uuid}))}var u=r(321),p=r.n(u),m=r(1195),g=r.n(m),h=r(3275),b=r.n(h),f=r(7162),C=r.n(f),v=r(2094),k=r.n(v),y=r(757),D=r.n(y),w=r(5746),B={};B.styleTagTransform=D(),B.setAttributes=C(),B.insert=b().bind(null,"head"),B.domAPI=g(),B.insertStyleElement=k(),p()(w.Z,B);const E=w.Z&&w.Z.locals?w.Z.locals:void 0;function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function F(e,t,r,n,o,i,a){try{var s=e[i](a),d=s.value}catch(e){return void r(e)}s.done?t(d):Promise.resolve(d).then(n,o)}function z(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){F(i,n,o,a,s,"next",e)}function s(e){F(i,n,o,a,s,"throw",e)}a(void 0)}))}}const x=function(e){var t,r,i=e.patientUuid,u=e.closeWorkspace,p=e.closeWorkspaceWithSavedChanges,m=e.promptBeforeClosing,g=(0,s.useTranslation)().t,h="tablet"===(0,c.useLayoutType)(),b=(0,c.useConfig)(),f=(0,c.useSession)(),C=(0,A.useVisitOrOfflineVisit)(i).activeVisit,v=(0,A.useOrderBasket)(),k=v.orders,y=v.clearOrders,D=function(e){var t=(0,A.useSystemVisitSetting)(),r=t.systemVisitEnabled,o=t.isLoadingSystemVisitSetting,i=t.errorFetchingSystemVisitSetting,a=new Date,s="".concat(a.getFullYear(),"-").concat(a.getMonth()+1,"-").concat(a.getDate()),d=(0,l.ZP)(o||r||!e?null:"".concat(c.restBaseUrl,"/encounter?patient=").concat(e,"&fromdate=").concat(s,"&limit=1"),c.openmrsFetch),_=(0,A.useVisitOrOfflineVisit)(e);return(0,n.useMemo)((function(){var e,t,n,a,s,c,A;return o||i?{activeVisitRequired:!1,isLoading:o,error:i,encounterUuid:null,mutate:function(){}}:r?{activeVisitRequired:!0,isLoading:null==_?void 0:_.isLoading,encounterUuid:null==_||null===(n=_.currentVisit)||void 0===n||null===(t=n.encounters)||void 0===t||null===(e=t[0])||void 0===e?void 0:e.uuid,error:null==_?void 0:_.error,mutate:null==_?void 0:_.mutate}:{activeVisitRequired:!1,isLoading:null==d?void 0:d.isLoading,encounterUuid:null==d||null===(A=d.data)||void 0===A||null===(c=A.data)||void 0===c||null===(s=c.results)||void 0===s||null===(a=s[0])||void 0===a?void 0:a.uuid,error:null==d?void 0:d.error,mutate:null==d?void 0:d.mutate}}),[o,i,_,d,r])}(i),w=D.activeVisitRequired,B=D.isLoading,F=D.encounterUuid,x=D.error,T=D.mutate,I=(t=(0,n.useState)(""),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){s=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}}(t,r)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),W=I[0],L=I[1],N=function(e){var t=(0,l.kY)().mutate;return{mutate:(0,n.useCallback)((function(){return t((function(t){return"string"==typeof t&&t.startsWith("".concat(c.restBaseUrl,"/order?patient=").concat(e))}))}),[e,t])}}(i),V=N.mutate;(0,n.useEffect)((function(){m((function(){return!!k.length}))}),[k]);var H,O,U,P=(0,n.useCallback)((function(){var e=(0,c.showModal)("start-visit-dialog",{patientUuid:i,closeModal:function(){return e()}})}),[i]),j=(0,n.useCallback)(z((function(){var e,t,r,n,o;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(a){switch(a.label){case 0:if(e=new AbortController,L(""),t=F)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,_(i,null==b?void 0:b.orderEncounterType,w?C:null,null==f||null===(r=f.sessionLocation)||void 0===r?void 0:r.uuid,e)];case 2:return t=a.sent(),T(),[3,4];case 3:return n=a.sent(),L(n),console.error(n),[2];case 4:return[4,(0,A.postOrders)(t,e)];case 5:return o=a.sent(),y({exceptThoseMatching:function(e){return o.map((function(e){return e.display})).includes(e.display)}}),V(),0==o.length?(p(),function(e,t){var r=t.filter((function(e){return["NEW","RENEW"].includes(e.action)})).map((function(e){return e.display})).join(", "),n=t.filter((function(e){return"REVISE"===e.action})).map((function(e){return e.display})).join(", "),o=t.filter((function(e){return"DISCONTINUE"===e.action})).map((function(e){return e.display})).join(", ");(0,c.showSnackbar)({isLowContrast:!0,kind:"success",title:e("orderCompleted","Placed orders"),subtitle:(r&&"".concat(e("ordered","Placed order for")," ").concat(r,". "))+(n&&"".concat(e("updated","Updated")," ").concat(n,". "))+(o&&"".concat(e("discontinued","Discontinued")," ").concat(o,"."))})}(g,k)):function(e){(0,c.showSnackbar)({isLowContrast:!1,kind:"error",title:e("error","Error"),subtitle:e("errorSavingOrder","There were errors saving some orders.")})}(g),[2,function(){return e.abort()}]}}))})),[C,w,y,p,b,F,T,V,k,i,f,g]),M=(0,n.useCallback)((function(){u({onWorkspaceClose:y})}),[y,u]);return o().createElement(o().Fragment,null,o().createElement("div",{className:E.container},o().createElement("div",{className:E.orderBasketContainer},o().createElement(c.ExtensionSlot,{className:a()(E.orderBasketSlot,(H={},O=E.orderBasketSlotTablet,U=h,O in H?Object.defineProperty(H,O,{value:U,enumerable:!0,configurable:!0,writable:!0}):H[O]=U,H)),name:"order-basket-slot"})),o().createElement("div",null,(W||x)&&o().createElement(d.K0D,{kind:"error",title:g("errorCreatingAnEncounter","Error when creating an encounter"),subtitle:g("tryReopeningTheWorkspaceAgain","Please try launching the workspace again"),lowContrast:!0,className:E.inlineNotification,inline:!0}),o().createElement(d.uVA,{className:E.buttonSet},o().createElement(d.zxk,{className:E.bottomButton,kind:"secondary",onClick:M},g("cancel","Cancel")),o().createElement(d.zxk,{className:E.bottomButton,kind:"primary",onClick:j,disabled:!(null==k?void 0:k.length)||B||w&&!C||(null==k?void 0:k.some((function(e){return e.isOrderIncomplete})))},g("signAndClose","Sign and close"))))),w&&!C&&o().createElement(d.FQz,{kind:"error",actionButtonLabel:g("startVisit","Start visit"),onActionButtonClick:P,title:g("startAVisitToRecordOrders","Start a visit to order"),subtitle:g("activeVisitRequired","An active visit is required to make orders"),lowContrast:!0,inline:!0,className:E.actionNotification,hasFocus:!0}))}}}]);
|
package/dist/347.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_openmrs_esm_patient_orders_app=globalThis.webpackChunk_openmrs_esm_patient_orders_app||[]).push([[347],{2717:(e,r,t)=>{t.d(r,{Z:()=>s});var n=t(272),a=t.n(n),o=t(2609),l=t.n(o)()(a());l.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-orders__cancel-order-form__productiveHeading03___RXx2x,.-esm-patient-orders__cancel-order-form__title___JRPr1{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0)}.-esm-patient-orders__cancel-order-form__title___JRPr1{margin:0 .5rem .5rem 0}.-esm-patient-orders__cancel-order-form__orderDisplay___Qh6Ju{margin-bottom:1rem}.-esm-patient-orders__cancel-order-form__danger___cyWf7{color:#da1e28}.-esm-patient-orders__cancel-order-form__button___HaTwk{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-orders__cancel-order-form__button___HaTwk .cds--inline-loading{min-height:1rem !important}.-esm-patient-orders__cancel-order-form__button___HaTwk .cds--inline-loading__text{font-size:unset !important}.-esm-patient-orders__cancel-order-form__tablet___zcFGF{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-orders__cancel-order-form__desktop___TlOEb{padding:0rem}.-esm-patient-orders__cancel-order-form__form___s61QC{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - 6rem)}.omrs-breakpoint-lt-desktop .-esm-patient-orders__cancel-order-form__form___s61QC{background-color:#ededed}.omrs-breakpoint-gt-tablet .-esm-patient-orders__cancel-order-form__form___s61QC{background-color:#fff}.-esm-patient-orders__cancel-order-form__grid___wvDgf{margin:1rem}.-esm-patient-orders__cancel-order-form__row___Wa8jp{margin:.5rem 0rem 0rem;display:flex;flex-flow:row wrap;gap:1rem}.-esm-patient-orders__cancel-order-form__spacer___ClI0I{margin-top:1rem}.-esm-patient-orders__cancel-order-form__noteInput___MfEaR{width:100%}.-esm-patient-orders__cancel-order-form__errorNotification___jz56i{margin:.5rem 0}.-esm-patient-orders__cancel-order-form__errorContainer___ss0lP{margin:1rem}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/order-cancellation-form/cancel-order-form.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,4HC61BI,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDz1BJ,uDAEE,sBAAA,CAGF,8DACE,kBEgBW,CFbb,wDACE,aDCO,CCET,wDACE,WAAA,CACA,YAAA,CACA,wBAAA,CACA,oBAAA,CACA,aAAA,CAEA,6EACE,0BAAA,CAGF,mFACE,0BAAA,CAIJ,wDACE,mBAAA,CACA,qBDvCM,CC0CR,yDACE,YAAA,CAGF,sDACE,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,yBAAA,CAGF,kFACE,wBAAA,CAGF,iFACE,qBD1DM,CC6DR,sDACE,WEhCW,CFmCb,qDACE,sBAAA,CACA,YAAA,CACA,kBAAA,CACA,QEvCW,CF0Cb,wDACE,eE3CW,CF8Cb,2DACE,UAAA,CAGF,mEACE,cAAA,CAGF,gEACE,WEvDW",sourceRoot:""}]),l.locals={productiveHeading03:"-esm-patient-orders__cancel-order-form__productiveHeading03___RXx2x",title:"-esm-patient-orders__cancel-order-form__title___JRPr1",orderDisplay:"-esm-patient-orders__cancel-order-form__orderDisplay___Qh6Ju",danger:"-esm-patient-orders__cancel-order-form__danger___cyWf7",button:"-esm-patient-orders__cancel-order-form__button___HaTwk",tablet:"-esm-patient-orders__cancel-order-form__tablet___zcFGF",desktop:"-esm-patient-orders__cancel-order-form__desktop___TlOEb",form:"-esm-patient-orders__cancel-order-form__form___s61QC",grid:"-esm-patient-orders__cancel-order-form__grid___wvDgf",row:"-esm-patient-orders__cancel-order-form__row___Wa8jp",spacer:"-esm-patient-orders__cancel-order-form__spacer___ClI0I",noteInput:"-esm-patient-orders__cancel-order-form__noteInput___MfEaR",errorNotification:"-esm-patient-orders__cancel-order-form__errorNotification___jz56i",errorContainer:"-esm-patient-orders__cancel-order-form__errorContainer___ss0lP"};const s=l},2347:(e,r,t)=>{t.r(r),t.d(r,{default:()=>S});var n=t(268),a=t.n(n),o=t(3565),l=t.n(o),s=t(3955),i=t(4924),c=t(195),_=t(8883),d=t(
|
|
1
|
+
"use strict";(globalThis.webpackChunk_openmrs_esm_patient_orders_app=globalThis.webpackChunk_openmrs_esm_patient_orders_app||[]).push([[347],{2717:(e,r,t)=>{t.d(r,{Z:()=>s});var n=t(272),a=t.n(n),o=t(2609),l=t.n(o)()(a());l.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-orders__cancel-order-form__productiveHeading03___RXx2x,.-esm-patient-orders__cancel-order-form__title___JRPr1{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0)}.-esm-patient-orders__cancel-order-form__title___JRPr1{margin:0 .5rem .5rem 0}.-esm-patient-orders__cancel-order-form__orderDisplay___Qh6Ju{margin-bottom:1rem}.-esm-patient-orders__cancel-order-form__danger___cyWf7{color:#da1e28}.-esm-patient-orders__cancel-order-form__button___HaTwk{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-orders__cancel-order-form__button___HaTwk .cds--inline-loading{min-height:1rem !important}.-esm-patient-orders__cancel-order-form__button___HaTwk .cds--inline-loading__text{font-size:unset !important}.-esm-patient-orders__cancel-order-form__tablet___zcFGF{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-orders__cancel-order-form__desktop___TlOEb{padding:0rem}.-esm-patient-orders__cancel-order-form__form___s61QC{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - 6rem)}.omrs-breakpoint-lt-desktop .-esm-patient-orders__cancel-order-form__form___s61QC{background-color:#ededed}.omrs-breakpoint-gt-tablet .-esm-patient-orders__cancel-order-form__form___s61QC{background-color:#fff}.-esm-patient-orders__cancel-order-form__grid___wvDgf{margin:1rem}.-esm-patient-orders__cancel-order-form__row___Wa8jp{margin:.5rem 0rem 0rem;display:flex;flex-flow:row wrap;gap:1rem}.-esm-patient-orders__cancel-order-form__spacer___ClI0I{margin-top:1rem}.-esm-patient-orders__cancel-order-form__noteInput___MfEaR{width:100%}.-esm-patient-orders__cancel-order-form__errorNotification___jz56i{margin:.5rem 0}.-esm-patient-orders__cancel-order-form__errorContainer___ss0lP{margin:1rem}","",{version:3,sources:["webpack://./../../node_modules/@openmrs/esm-styleguide/src/_vars.scss","webpack://./src/order-cancellation-form/cancel-order-form.scss","webpack://./../../node_modules/@carbon/type/scss/_styles.scss","webpack://./../../node_modules/@carbon/layout/scss/generated/_spacing.scss"],names:[],mappings:"AAoDA,MACE,mBAAA,CACA,mBAAA,CACA,mBAAA,CClDF,4HC61BI,kDAAA,CAAA,kDAAA,CAAA,kDAAA,CAAA,sDAAA,CDz1BJ,uDAEE,sBAAA,CAGF,8DACE,kBEgBW,CFbb,wDACE,aDCO,CCET,wDACE,WAAA,CACA,YAAA,CACA,wBAAA,CACA,oBAAA,CACA,aAAA,CAEA,6EACE,0BAAA,CAGF,mFACE,0BAAA,CAIJ,wDACE,mBAAA,CACA,qBDvCM,CC0CR,yDACE,YAAA,CAGF,sDACE,YAAA,CACA,qBAAA,CACA,6BAAA,CACA,yBAAA,CAGF,kFACE,wBAAA,CAGF,iFACE,qBD1DM,CC6DR,sDACE,WEhCW,CFmCb,qDACE,sBAAA,CACA,YAAA,CACA,kBAAA,CACA,QEvCW,CF0Cb,wDACE,eE3CW,CF8Cb,2DACE,UAAA,CAGF,mEACE,cAAA,CAGF,gEACE,WEvDW",sourceRoot:""}]),l.locals={productiveHeading03:"-esm-patient-orders__cancel-order-form__productiveHeading03___RXx2x",title:"-esm-patient-orders__cancel-order-form__title___JRPr1",orderDisplay:"-esm-patient-orders__cancel-order-form__orderDisplay___Qh6Ju",danger:"-esm-patient-orders__cancel-order-form__danger___cyWf7",button:"-esm-patient-orders__cancel-order-form__button___HaTwk",tablet:"-esm-patient-orders__cancel-order-form__tablet___zcFGF",desktop:"-esm-patient-orders__cancel-order-form__desktop___TlOEb",form:"-esm-patient-orders__cancel-order-form__form___s61QC",grid:"-esm-patient-orders__cancel-order-form__grid___wvDgf",row:"-esm-patient-orders__cancel-order-form__row___Wa8jp",spacer:"-esm-patient-orders__cancel-order-form__spacer___ClI0I",noteInput:"-esm-patient-orders__cancel-order-form__noteInput___MfEaR",errorNotification:"-esm-patient-orders__cancel-order-form__errorNotification___jz56i",errorContainer:"-esm-patient-orders__cancel-order-form__errorContainer___ss0lP"};const s=l},2347:(e,r,t)=>{t.r(r),t.d(r,{default:()=>S});var n=t(268),a=t.n(n),o=t(3565),l=t.n(o),s=t(3955),i=t(4924),c=t(195),_=t(8883),d=t(9997),m=t(2870),A=t(2821),u=t(321),f=t.n(u),C=t(1195),p=t.n(C),g=t(3275),b=t.n(g),E=t(7162),y=t.n(E),v=t(2094),h=t.n(v),D=t(757),k=t.n(D),w=t(2717),F={};F.styleTagTransform=k(),F.setAttributes=y(),F.insert=b().bind(null,"head"),F.domAPI=p(),F.insertStyleElement=h(),f()(w.Z,F);const B=w.Z&&w.Z.locals?w.Z.locals:void 0;function T(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function x(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,a,o=[],l=!0,s=!1;try{for(t=t.call(e);!(l=(n=t.next()).done)&&(o.push(n.value),!r||o.length!==r);l=!0);}catch(e){s=!0,a=e}finally{try{l||null==t.return||t.return()}finally{if(s)throw a}}return o}}(e,r)||function(e,r){if(e){if("string"==typeof e)return T(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?T(e,r):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const S=function(e){var r=e.order,t=e.patientUuid,o=e.closeWorkspace,u=e.promptBeforeClosing,f=(0,i.useTranslation)().t,C="tablet"===(0,m.useLayoutType)(),p=x((0,n.useState)(!1),2),g=p[0],b=p[1],E=x((0,n.useState)(!1),2),y=E[0],v=E[1],h=(0,A.usePatientOrders)(t).mutate,D=(0,n.useMemo)((function(){return c.z.object({cancellationDate:c.z.date({required_error:f("cancellationDateRequired","Cancellation date is required")}).refine((function(e){return e>=l()().startOf("day").toDate()}),{message:f("dateCannotBeBeforeToday","Date cannot be before today")}),reasonForCancellation:c.z.string({required_error:f("reasonForCancellationRequired","Reason for cancellation is required")})})}),[]),k=(0,s.cI)({mode:"all",resolver:(0,_.F)(D)}),w=k.control,F=k.handleSubmit,T=k.formState,S=T.errors,N=T.isDirty;(0,n.useEffect)((function(){u((function(){return N}))}),[N]);var R=(0,n.useCallback)((function(e){var t=e;v(!1),b(!0);var n={fulfillerStatus:"DECLINED",fulfillerComment:t.reasonForCancellation};(function(e,r){var t=(0,m.useAbortController)();return(0,m.openmrsFetch)("".concat(m.restBaseUrl,"/order/").concat(e.uuid,"/fulfillerdetails/"),{method:"POST",headers:{"Content-Type":"application/json"},body:r,signal:t.signal})})(r,n).then((function(e){b(!1),o(),h(),(0,m.showSnackbar)({title:f("orderCancelled","Order cancelled"),kind:"success",subtitle:f("successfullyCancelledOrder","Order {{orderNumber}} has been cancelled successfully",{orderNumber:null==r?void 0:r.orderNumber})})}),(function(e){b(!1),(0,m.showSnackbar)({isLowContrast:!0,title:f("errorCancellingOrder","Error cancelling order"),kind:"error",subtitle:null==e?void 0:e.message})}))}),[]);return a().createElement(d.l09,{className:B.form},a().createElement("div",{className:B.grid},a().createElement(d.Kqy,null,a().createElement("section",null,a().createElement("h4",{className:B.orderDisplay},null==r?void 0:r.display)),a().createElement("section",null,a().createElement(s.Qr,{name:"cancellationDate",control:w,render:function(e){var r=e.field,t=r.onChange,n=r.value;return a().createElement("div",{className:B.row},a().createElement(d.Mtg,{id:"cancellationDate",minDate:l()().startOf("day"),dateFormat:"d/m/Y",datePickerType:"single",value:n,onChange:function(e){var r=x(e,1)[0];return t(r)},autocomplete:"off"},a().createElement(d.aj6,{id:"date-picker-calendar-id",placeholder:"dd/mm/yyyy",labelText:f("cancellationDate","Cancellation date"),type:"text",invalid:!!S.cancellationDate,invalidText:!!S.cancellationDate&&S.cancellationDate.message})))}})),a().createElement("section",null,a().createElement(s.Qr,{name:"reasonForCancellation",control:w,render:function(e){var r=e.field,t=r.onChange,n=r.value;return a().createElement("div",{className:B.row},a().createElement(d.Kx8,{type:"text",id:"reasonForCancellation",labelText:f("reasonForCancellation","Reason for cancellation"),value:n,onChange:function(e){return t(e.target.value)},invalid:!!S.reasonForCancellation,invalidText:!!S.reasonForCancellation&&S.reasonForCancellation.message}))}})))),y&&a().createElement(d.sgG,{className:B.errorContainer},a().createElement(d.K0D,{lowContrast:!0,title:f("error","Error"),subtitle:f("pleaseFillRequiredFields","Please fill all the required fields")+".",onClose:function(){return v(!1)}})),a().createElement(d.uVA,{className:C?B.tablet:B.desktop},a().createElement(d.zxk,{className:B.button,kind:"secondary",onClick:o},f("discard","Discard")),a().createElement(d.zxk,{className:B.button,kind:"primary",onClick:F(R,(function(e){(null==e?void 0:e.oneFieldRequired)&&v(!0)})),disabled:g,type:"submit"},g?a().createElement(d.lSo,{description:f("saving","Saving")+"..."}):f("saveAndClose","Save and close"))))}}}]);
|