@openmrs/esm-patient-programs-app 3.2.1-pre.217 → 3.2.1-pre.219
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 +34 -36
- package/dist/109.js +1 -0
- package/dist/13.js +1 -0
- package/dist/145.js +1 -1
- package/dist/154.js +2 -0
- package/dist/154.js.LICENSE.txt +53 -0
- package/dist/238.js +2 -0
- package/dist/{707.js.LICENSE.txt → 238.js.LICENSE.txt} +0 -0
- package/dist/340.js +1 -0
- package/dist/435.js +1 -1
- package/dist/461.js +1 -0
- package/dist/574.js +1 -1
- package/dist/709.js +1 -0
- package/dist/784.js +1 -1
- package/dist/784.js.LICENSE.txt +2 -7
- package/dist/858.js +1 -1
- package/dist/main.js +1 -0
- package/dist/openmrs-esm-patient-programs-app.js +1 -1
- package/dist/openmrs-esm-patient-programs-app.js.buildmanifest.json +128 -223
- package/dist/openmrs-esm-patient-programs-app.old +1 -1
- package/package.json +6 -10
- package/src/index.ts +1 -1
- package/src/programs/program-action-button/program-action-button.component.tsx +4 -4
- package/src/programs/programs-detailed-summary.component.tsx +42 -51
- package/src/programs/programs-detailed-summary.scss +1 -4
- package/src/programs/programs-detailed-summary.test.tsx +15 -5
- package/src/programs/programs-form.component.tsx +11 -10
- package/src/programs/programs-form.scss +1 -9
- package/src/programs/programs-form.test.tsx +104 -196
- package/src/programs/programs-overview.component.tsx +33 -39
- package/src/programs/programs-overview.scss +1 -3
- package/src/programs/programs-overview.test.tsx +6 -7
- package/translations/en.json +1 -1
- package/dist/186.js +0 -2
- package/dist/186.js.LICENSE.txt +0 -23
- package/dist/336.js +0 -2
- package/dist/336.js.LICENSE.txt +0 -20
- package/dist/337.js +0 -1
- package/dist/402.js +0 -1
- package/dist/478.js +0 -2
- package/dist/478.js.LICENSE.txt +0 -8
- package/dist/499.js +0 -1
- package/dist/60.js +0 -1
- package/dist/635.js +0 -2
- package/dist/635.js.LICENSE.txt +0 -16
- package/dist/692.js +0 -1
- package/dist/701.js +0 -1
- package/dist/707.js +0 -2
- package/dist/93.js +0 -1
- package/dist/963.js +0 -2
- package/dist/963.js.LICENSE.txt +0 -23
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[34m@openmrs/esm-patient-programs-app:build: [0m
|
|
36
|
-
[34m@openmrs/esm-patient-programs-app:build: [0mwebpack 5.73.0 compiled with [1m[33m1 warning[39m[22m in 175819 ms
|
|
1
|
+
[35m@openmrs/esm-patient-programs-app:build[0m: cache hit, replaying output [2ma2598755c9595432[0m
|
|
2
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m$ webpack --mode production
|
|
3
|
+
[35m@openmrs/esm-patient-programs-app:build: [0massets by chunk 1.83 MiB (id hint: vendors)
|
|
4
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m assets by status [1m[33m1.75 MiB[39m[22m [1m[33m[big][39m[22m
|
|
5
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m asset [1m[33m858.js[39m[22m [1m[33m1.33 MiB[39m[22m [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m [1m[33m[big][39m[22m (id hint: vendors) 1 related asset
|
|
6
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m asset [1m[33m154.js[39m[22m [1m[33m435 KiB[39m[22m [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m [1m[33m[big][39m[22m (id hint: vendors) 1 related asset
|
|
7
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m206.js[39m[22m 45.4 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
8
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m709.js[39m[22m 18.9 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors)
|
|
9
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m238.js[39m[22m 8.46 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
10
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m461.js[39m[22m 3.83 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors)
|
|
11
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m+ 12 assets
|
|
12
|
+
[35m@openmrs/esm-patient-programs-app:build: [0morphan modules 3.89 MiB [1m[33m[orphan][39m[22m 736 modules
|
|
13
|
+
[35m@openmrs/esm-patient-programs-app:build: [0mruntime modules 40.1 KiB 28 modules
|
|
14
|
+
[35m@openmrs/esm-patient-programs-app:build: [0mbuilt modules 4.01 MiB (javascript) 294 bytes (consume-shared) 252 bytes (share-init) [1m[33m[built][39m[22m
|
|
15
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m../../node_modules/[39m[22m 3.89 MiB 87 modules
|
|
16
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m./[39m[22m 49.6 KiB 11 modules
|
|
17
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m consume-shared-module modules 294 bytes
|
|
18
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m modules by path [1mconsume shared module (default) @openmrs/[39m[22m 126 bytes 3 modules
|
|
19
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m + 4 modules
|
|
20
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m provide-module modules 252 bytes
|
|
21
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m modules by path [1mprovide shared module (default) @openmrs/[39m[22m 84 bytes 2 modules
|
|
22
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m + 4 modules
|
|
23
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m../esm-patient-common-lib/src/[39m[22m 70.5 KiB
|
|
24
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m [1m../esm-patient-common-lib/src/index.ts + 31 modules[39m[22m 59.7 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
25
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m + 5 modules
|
|
26
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m [1mcontainer entry[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
27
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m
|
|
28
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m[1m[33mWARNING[39m[22m in [1masset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
|
|
29
|
+
[35m@openmrs/esm-patient-programs-app:build: [0mThis can impact web performance.
|
|
30
|
+
[35m@openmrs/esm-patient-programs-app:build: [0mAssets:
|
|
31
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m 858.js (1.33 MiB)
|
|
32
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m 154.js (435 KiB)[39m[22m
|
|
33
|
+
[35m@openmrs/esm-patient-programs-app:build: [0m
|
|
34
|
+
[35m@openmrs/esm-patient-programs-app:build: [0mwebpack 5.73.0 compiled with [1m[33m1 warning[39m[22m in 154857 ms
|
package/dist/109.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_openmrs_esm_patient_programs_app=self.webpackChunk_openmrs_esm_patient_programs_app||[]).push([[109],{6983:(e,r,t)=>{t.d(r,{Z:()=>i});var n=t(9601),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-programs__programs-overview__widgetCard___W1HJv{border:1px solid #e0e0e0}",""]),l.locals={widgetCard:"-esm-patient-programs__programs-overview__widgetCard___W1HJv"};const i=l},2109:(e,r,t)=>{t.r(r),t.d(r,{default:()=>Z});var n=t(7900),a=t.n(n),o=t(4924),l=t(5573),i=t(7047),s=t(6759),d=t(3771),c=t(3066),u=t(4076),m=t(6039);function p(){return p=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},p.apply(this,arguments)}const g=function(e){var r=e.enrollment,t=(0,o.useTranslation)().t,n="eligible"===r.enrollmentStatus?r.enrollmentFormUuid:r.discontinuationFormUuid,l=function(e){d.formEntrySub.next({formUuid:n,encounterUuid:""}),(0,d.launchPatientWorkspace)("patient-form-entry-workspace",{workspaceTitle:"".concat(null==r?void 0:r.display," ").concat(e," Form")})};return"eligible"===r.enrollmentStatus?a().createElement(i.zxk,{onClick:function(){return l(t("enrollment","Enrollment"))},renderIcon:function(e){return a().createElement(m.sQ,p({size:20},e))},kind:"tertiary",size:"small"},t("enroll","Enroll")):a().createElement(i.zxk,{onClick:function(){return l(t("discontinue","Discontinue"))},renderIcon:function(e){return a().createElement(m.sQ,p({size:20},e))},kind:"danger--ghost",size:"small"},t("discontinue","Discontinue"))};var v=t(321),f=t.n(v),b=t(1195),h=t.n(b),E=t(3275),y=t.n(E),P=t(7162),w=t.n(P),O=t(2094),k=t.n(O),C=t(757),_=t.n(C),S=t(6983),j={};j.styleTagTransform=_(),j.setAttributes=w(),j.insert=y().bind(null,"head"),j.domAPI=h(),j.insertStyleElement=k(),f()(S.Z,j);const T=S.Z&&S.Z.locals?S.Z.locals:void 0;function D(){return D=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},D.apply(this,arguments)}const Z=function(e){var r,t,n=e.basePath,m=e.patientUuid,p=(0,o.useTranslation)().t,v=(0,c.useConfig)(),f=p("programs","Program enrollments"),b=p("carePrograms","Care Programs"),h=p("seeAll","See all"),E=window.spaBase+n+"/programs",y=!!v.customUrl,P=(0,u.b$)(m),w=P.activeEnrollments,O=P.availablePrograms,k=P.configurablePrograms,C=P.eligiblePrograms,_=P.enrollments,S=P.isError,j=P.isLoading,Z=P.isValidating,L=(0,c.usePagination)(y?k:null!=_?_:[],5),F=L.results,z=L.goTo,x=L.currentPage,A=a().useCallback((function(){return(0,d.launchPatientWorkspace)("programs-form-workspace")}),[]),U=[{key:"display",header:p("activePrograms","Active programs")},{key:"location",header:p("location","Location")},{key:"dateEnrolled",header:p("dateEnrolled","Date enrolled")},{key:"status",header:p("status","Status")},{key:"actions",header:p("actions","Actions")}],H=a().useMemo((function(){return null==F?void 0:F.map((function(e){var r;return{id:e.uuid,display:e.display,location:null===(r=e.location)||void 0===r?void 0:r.display,dateEnrolled:e.dateEnrolled?(0,c.formatDatetime)(new Date(e.dateEnrolled)):"--",status:y?(0,l.Z)(e.enrollmentStatus):e.dateCompleted?"".concat(p("completedOn","Completed On")," ").concat((0,c.formatDate)(new Date(e.dateCompleted))):p("active","Active"),actions:a().createElement(g,{enrollment:e})}}))}),[y,F,p]);return j?a().createElement(i.gqd,{role:"progressbar"}):S?a().createElement(d.ErrorState,{error:S,headerTitle:b}):(y?k.length:null==w?void 0:w.length)?a().createElement("div",{className:T.widgetCard},a().createElement(d.CardHeader,{title:b},a().createElement("span",null,Z?a().createElement(i.lSo,null):null),a().createElement(i.zxk,{kind:"ghost",renderIcon:function(e){return a().createElement(s.mm,D({size:16},e))},iconDescription:"Add programs",onClick:A,disabled:(null==O?void 0:O.length)&&0===(null==C?void 0:C.length)},p("add","Add"))),(null==O?void 0:O.length)&&0===(null==C?void 0:C.length)&&a().createElement(i.K0D,{style:{minWidth:"100%",margin:"0rem",padding:"0rem"},kind:"info",lowContrast:!0,subtitle:p("noEligibleEnrollments","There are no more programs left to enroll this patient in"),title:p("fullyEnrolled","Enrolled in all programs")}),a().createElement(i.wQF,{rows:H,headers:U,isSortable:!0,size:"sm",useZebraStyles:!0},(function(e){var n=e.rows,o=e.headers,l=e.getHeaderProps,s=e.getTableProps;return a().createElement(i.xJi,null,a().createElement(i.iA_,D({},s()),a().createElement(i.ssF,null,a().createElement(i.SCH,null,o.map((function(e){var t;return a().createElement(i.xDH,D({className:"".concat(T.productiveHeading01," ").concat(T.text02)},l({header:e,isSortable:e.isSortable})),null!==(r=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==r?r:e.header)})))),a().createElement(i.RMI,null,n.map((function(e){return a().createElement(i.SCH,{key:e.id},e.cells.map((function(e){var r;return a().createElement(i.pj1,{key:e.id},null!==(t=null===(r=e.value)||void 0===r?void 0:r.content)&&void 0!==t?t:e.value)})))})))))})),a().createElement(d.PatientChartPagination,{currentItems:F.length,onPageNumberChange:function(e){var r=e.page;return z(r)},pageNumber:x,pageSize:5,totalItems:y?k.length:null==_?void 0:_.length,dashboardLinkUrl:E,dashboardLinkLabel:h})):a().createElement(d.EmptyState,{displayText:f,headerTitle:b,launchForm:A})}},4076:(e,r,t)=>{t.d(r,{Bw:()=>u,YX:()=>g,b$:()=>v,df:()=>p,o9:()=>c,oI:()=>m});var n=t(9857),a=t(3066),o=t(4200),l=t(3863),i=t(8827),s=t(819);function d(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var c="custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display))";function u(e){var r,t=(0,n.ZP)("/ws/rest/v1/programenrollment?patient=".concat(e,"&v=").concat(c),a.openmrsFetch),l=t.data,i=t.error,s=t.isValidating,d=(null==l||null===(r=l.data)||void 0===r?void 0:r.results.length)>0?null==l?void 0:l.data.results.sort((function(e,r){return r.dateEnrolled>e.dateEnrolled?1:-1})):null,u=null==d?void 0:d.filter((function(e){return!e.dateCompleted}));return{data:l?(0,o.Z)(d,(function(e){var r;return null==e||null===(r=e.program)||void 0===r?void 0:r.uuid})):null,isError:i,isLoading:!l&&!i,isValidating:s,activeEnrollments:u}}function m(e){var r,t,o=(0,n.ZP)("/ws/rest/v1/program?v=custom:(uuid,display,allWorkflows,concept:(uuid,display))",a.openmrsFetch),d=o.data,c=o.error,u=null!==(t=null==d||null===(r=d.data)||void 0===r?void 0:r.results)&&void 0!==t?t:null;return{data:u,isError:c,isLoading:!d&&!c,eligiblePrograms:(0,l.Z)(u,(function(r){return!(0,i.Z)((0,s.Z)(e,"program.uuid"),r.uuid)}))}}function p(e,r){if(!e)return null;var t=e.program,n=e.patient,o=e.dateEnrolled,l=e.dateCompleted,i=e.location;return(0,a.openmrsObservableFetch)("/ws/rest/v1/programenrollment",{method:"POST",headers:{"Content-Type":"application/json"},body:{program:t,patient:n,dateEnrolled:o,dateCompleted:l,location:i},signal:r.signal})}function g(e,r,t){if(!r&&!r.program)return null;r.program;var n=r.dateEnrolled,o=r.dateCompleted,l=r.location;return(0,a.openmrsObservableFetch)("/ws/rest/v1/programenrollment/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:{dateEnrolled:n,dateCompleted:o,location:l},signal:t.signal})}var v=function(e){var r,t,o=(0,a.useConfig)().customUrl,l=u(e),i=l.data,s=l.isError,c=l.isLoading,p=l.isValidating,g=l.activeEnrollments,v=m(i),f=v.data,b=v.eligiblePrograms,h=function(e){var r,t=(0,a.useConfig)().customUrl,o=(0,n.ZP)(t?"".concat(t).concat(e):null,a.openmrsFetch),l=o.data,i=o.error;return{configurablePrograms:null!==(r=null==l?void 0:l.data)&&void 0!==r?r:[],isLoading:!l&&!i,error:i}}(e),E=h.configurablePrograms,y=h.isLoading,P=h.error;return r=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),n.forEach((function(r){d(e,r,t[r])}))}return e}({enrollments:i},o?{isLoading:y,isError:P}:{isLoading:c,isError:s}),t=null!=(t={isValidating:p,activeEnrollments:g,availablePrograms:f,eligiblePrograms:b,configurablePrograms:E})?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):function(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})),r}}}]);
|
package/dist/13.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_openmrs_esm_patient_programs_app=self.webpackChunk_openmrs_esm_patient_programs_app||[]).push([[13],{5351:(e,r,t)=>{t.d(r,{Z:()=>i});var n=t(9601),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-programs__programs-detailed-summary__widgetCard___q9_pO{border:1px solid #e0e0e0}",""]),l.locals={widgetCard:"-esm-patient-programs__programs-detailed-summary__widgetCard___q9_pO"};const i=l},6013:(e,r,t)=>{t.r(r),t.d(r,{default:()=>S});var n=t(7900),a=t.n(n),o=t(4924),l=t(7047),i=t(6759),s=t(7631),u=t(3066),c=t(3771),d=t(4076),m=t(321),p=t.n(m),g=t(1195),f=t.n(g),v=t(3275),b=t.n(v),h=t(7162),y=t.n(h),E=t(2094),O=t.n(E),P=t(757),Z=t.n(P),w=t(5351),C={};C.styleTagTransform=Z(),C.setAttributes=y(),C.insert=b().bind(null,"head"),C.domAPI=f(),C.insertStyleElement=O(),p()(w.Z,C);const k=w.Z&&w.Z.locals?w.Z.locals:void 0;function _(){return _=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},_.apply(this,arguments)}function j(e){var r=e.programEnrollmentId,t=a().useCallback((function(){return(0,c.launchPatientWorkspace)("programs-form-workspace",{programEnrollmentId:r})}),[r]);return a().createElement(l.zxk,{kind:"ghost",renderIcon:function(e){return a().createElement(s.I8,_({size:16},e))},iconDescription:"Edit Program",onClick:t,hasIconOnly:!0})}const S=function(e){var r,t,n=e.patientUuid,s=(0,o.useTranslation)().t,m=s("programEnrollments","Program enrollments"),p=s("carePrograms","Care Programs"),g=!!(0,u.useConfig)().customUrl,f=(0,d.b$)(n),v=f.enrollments,b=f.isLoading,h=f.isError,y=f.isValidating,E=f.availablePrograms,O=f.eligiblePrograms,P=f.configurablePrograms,Z=(0,u.usePagination)(g?P:null!=v?v:[],5),w=(Z.results,Z.goTo,Z.currentPage,a().useMemo((function(){return[{key:"display",header:s("activePrograms","Active programs")},{key:"location",header:s("location","Location")},{key:"dateEnrolled",header:s("dateEnrolled","Date enrolled")},{key:"status",header:s("status","Status")},{key:"actions",header:s("actions","Actions")}]}),[s])),C=a().useMemo((function(){return null==v?void 0:v.map((function(e){var r;return{id:e.uuid,display:e.display,location:null===(r=e.location)||void 0===r?void 0:r.display,dateEnrolled:(0,u.formatDatetime)(new Date(e.dateEnrolled)),status:e.dateCompleted?"".concat(s("completedOn","Completed On")," ").concat((0,u.formatDate)(new Date(e.dateCompleted))):s("active","Active"),actions:a().createElement(j,{programEnrollmentId:e.uuid})}}))}),[v,s]),S=a().useCallback((function(){return(0,c.launchPatientWorkspace)("programs-form-workspace")}),[]);return b?a().createElement(l.gqd,{role:"progressbar"}):h?a().createElement(c.ErrorState,{error:h,headerTitle:p}):(null==v?void 0:v.length)?a().createElement("div",{className:k.widgetCard},a().createElement(c.CardHeader,{title:p},a().createElement("span",null,y?a().createElement(l.lSo,null):null),a().createElement(l.zxk,{kind:"ghost",renderIcon:function(e){return a().createElement(i.mm,_({size:16},e))},iconDescription:"Add programs",onClick:S,disabled:(null==E?void 0:E.length)&&0===(null==O?void 0:O.length)},s("add","Add"))),(null==E?void 0:E.length)&&0===(null==O?void 0:O.length)?a().createElement(l.K0D,{style:{minWidth:"100%",margin:"0rem",padding:"0rem"},kind:"info",lowContrast:!0,subtitle:s("noEligibleEnrollments","There are no more programs left to enroll this patient in"),title:s("fullyEnrolled","Enrolled in all programs")}):null,a().createElement(l.wQF,{rows:C,headers:w,isSortable:!0,size:"xs",useZebraStyles:!0},(function(e){var n=e.rows,o=e.headers,i=e.getHeaderProps,s=e.getTableProps;return a().createElement(l.xJi,null,a().createElement(l.iA_,_({},s()),a().createElement(l.ssF,null,a().createElement(l.SCH,null,o.map((function(e){var t;return a().createElement(l.xDH,_({className:"".concat(k.productiveHeading01," ").concat(k.text02)},i({header:e,isSortable:e.isSortable})),null!==(r=null===(t=e.header)||void 0===t?void 0:t.content)&&void 0!==r?r:e.header)})))),a().createElement(l.RMI,null,n.map((function(e){return a().createElement(l.SCH,{key:e.id},e.cells.map((function(e){var r;return a().createElement(l.pj1,{key:e.id},null!==(t=null===(r=e.value)||void 0===r?void 0:r.content)&&void 0!==t?t:e.value)})))})))))}))):a().createElement(c.EmptyState,{displayText:m,headerTitle:p,launchForm:S})}},4076:(e,r,t)=>{t.d(r,{Bw:()=>d,YX:()=>g,b$:()=>f,df:()=>p,o9:()=>c,oI:()=>m});var n=t(9857),a=t(3066),o=t(4200),l=t(3863),i=t(8827),s=t(819);function u(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var c="custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display))";function d(e){var r,t=(0,n.ZP)("/ws/rest/v1/programenrollment?patient=".concat(e,"&v=").concat(c),a.openmrsFetch),l=t.data,i=t.error,s=t.isValidating,u=(null==l||null===(r=l.data)||void 0===r?void 0:r.results.length)>0?null==l?void 0:l.data.results.sort((function(e,r){return r.dateEnrolled>e.dateEnrolled?1:-1})):null,d=null==u?void 0:u.filter((function(e){return!e.dateCompleted}));return{data:l?(0,o.Z)(u,(function(e){var r;return null==e||null===(r=e.program)||void 0===r?void 0:r.uuid})):null,isError:i,isLoading:!l&&!i,isValidating:s,activeEnrollments:d}}function m(e){var r,t,o=(0,n.ZP)("/ws/rest/v1/program?v=custom:(uuid,display,allWorkflows,concept:(uuid,display))",a.openmrsFetch),u=o.data,c=o.error,d=null!==(t=null==u||null===(r=u.data)||void 0===r?void 0:r.results)&&void 0!==t?t:null;return{data:d,isError:c,isLoading:!u&&!c,eligiblePrograms:(0,l.Z)(d,(function(r){return!(0,i.Z)((0,s.Z)(e,"program.uuid"),r.uuid)}))}}function p(e,r){if(!e)return null;var t=e.program,n=e.patient,o=e.dateEnrolled,l=e.dateCompleted,i=e.location;return(0,a.openmrsObservableFetch)("/ws/rest/v1/programenrollment",{method:"POST",headers:{"Content-Type":"application/json"},body:{program:t,patient:n,dateEnrolled:o,dateCompleted:l,location:i},signal:r.signal})}function g(e,r,t){if(!r&&!r.program)return null;r.program;var n=r.dateEnrolled,o=r.dateCompleted,l=r.location;return(0,a.openmrsObservableFetch)("/ws/rest/v1/programenrollment/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:{dateEnrolled:n,dateCompleted:o,location:l},signal:t.signal})}var f=function(e){var r,t,o=(0,a.useConfig)().customUrl,l=d(e),i=l.data,s=l.isError,c=l.isLoading,p=l.isValidating,g=l.activeEnrollments,f=m(i),v=f.data,b=f.eligiblePrograms,h=function(e){var r,t=(0,a.useConfig)().customUrl,o=(0,n.ZP)(t?"".concat(t).concat(e):null,a.openmrsFetch),l=o.data,i=o.error;return{configurablePrograms:null!==(r=null==l?void 0:l.data)&&void 0!==r?r:[],isLoading:!l&&!i,error:i}}(e),y=h.configurablePrograms,E=h.isLoading,O=h.error;return r=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),n.forEach((function(r){u(e,r,t[r])}))}return e}({enrollments:i},o?{isLoading:E,isError:O}:{isLoading:c,isError:s}),t=null!=(t={isValidating:p,activeEnrollments:g,availablePrograms:v,eligiblePrograms:b,configurablePrograms:y})?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):function(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})),r}},1154:(e,r,t)=>{t.d(r,{Z:()=>l});const n=function(e,r,t){for(var n=-1,a=Object(e),o=t(e),l=o.length;l--;){var i=o[++n];if(!1===r(a[i],i,a))break}return e};var a=t(6892);var o=t(3282);const l=(i=function(e,r){return e&&n(e,r,a.Z)},function(e,r){if(null==e)return e;if(!(0,o.Z)(e))return i(e,r);for(var t=e.length,n=-1,a=Object(e);++n<t&&!1!==r(a[n],n,a););return e});var i},3863:(e,r,t)=>{t.d(r,{Z:()=>s});var n=t(2300),a=t(1154);const o=function(e,r){var t=[];return(0,a.Z)(e,(function(e,n,a){r(e,n,a)&&t.push(e)})),t};var l=t(7954),i=t(7885);const s=function(e,r){return((0,i.Z)(e)?n.Z:o)(e,(0,l.Z)(r,3))}},8827:(e,r,t)=>{t.d(r,{Z:()=>P});var n=t(1266),a=t(3282),o=t(9001),l=t(7885),i=t(3391);var s=/\s/;var u=/^\s+/;const c=function(e){return e?e.slice(0,function(e){for(var r=e.length;r--&&s.test(e.charAt(r)););return r}(e)+1).replace(u,""):e};var d=t(3122),m=t(2758),p=/^[-+]0x[0-9a-f]+$/i,g=/^0b[01]+$/i,f=/^0o[0-7]+$/i,v=parseInt;const b=function(e){return e?Infinity===(e=function(e){if("number"==typeof e)return e;if((0,m.Z)(e))return NaN;if((0,d.Z)(e)){var r="function"==typeof e.valueOf?e.valueOf():e;e=(0,d.Z)(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=c(e);var t=g.test(e);return t||f.test(e)?v(e.slice(2),t?2:8):p.test(e)?NaN:+e}(e))||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var h=t(5598);var y=t(6892);const E=function(e){return null==e?[]:function(e,r){return(0,h.Z)(r,(function(r){return e[r]}))}(e,(0,y.Z)(e))};var O=Math.max;const P=function(e,r,t,s){e=(0,a.Z)(e)?e:E(e),t=t&&!s?function(e){var r=b(e),t=r%1;return r==r?t?r-t:r:0}(t):0;var u=e.length;return t<0&&(t=O(u+t,0)),function(e){return"string"==typeof e||!(0,l.Z)(e)&&(0,i.Z)(e)&&"[object String]"==(0,o.Z)(e)}(e)?t<=u&&e.indexOf(r,t)>-1:!!u&&(0,n.Z)(e,r,t)>-1}},819:(e,r,t)=>{t.d(r,{Z:()=>u});var n=t(5598),a=t(7954),o=t(1154),l=t(3282);const i=function(e,r){var t=-1,n=(0,l.Z)(e)?Array(e.length):[];return(0,o.Z)(e,(function(e,a,o){n[++t]=r(e,a,o)})),n};var s=t(7885);const u=function(e,r){return((0,s.Z)(e)?n.Z:i)(e,(0,a.Z)(r,3))}}}]);
|
package/dist/145.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_openmrs_esm_patient_programs_app=self.webpackChunk_openmrs_esm_patient_programs_app||[]).push([[145],{1951:(e,t,r)=>{r.d(t,{Z:()=>l});var n=r(9601),o=r.n(n),a=r(2609),i=r.n(a)()(o());i.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{padding:0;border:0;margin:0;font:inherit;font-size:100%;vertical-align:baseline}button,select,input,textarea{border-radius:0;font-family:inherit}input[type=text]::-ms-clear{display:none}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section{display:block}body{line-height:1}sup{vertical-align:super}sub{vertical-align:sub}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote::before,blockquote::after,q::before,q::after{content:\"\"}table{border-collapse:collapse;border-spacing:0}*{box-sizing:border-box}button{margin:0}html{font-size:100%}body{font-weight:400;font-family:'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}code{font-family:'IBM Plex Mono', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Courier, monospace}strong{font-weight:600}@media screen and (-ms-high-contrast: active){svg{fill:ButtonText}}h1{font-size:2.625rem;font-weight:300;line-height:1.199;letter-spacing:0}h2{font-size:2rem;font-weight:400;line-height:1.25;letter-spacing:0}h3{font-size:1.75rem;font-weight:400;line-height:1.29;letter-spacing:0}h4{font-size:1.25rem;font-weight:400;line-height:1.4;letter-spacing:0}h5{font-size:1rem;font-weight:600;line-height:1.375;letter-spacing:0}h6{font-size:.875rem;font-weight:600;line-height:1.29;letter-spacing:.16px}p{font-size:1rem;font-weight:400;line-height:1.5;letter-spacing:0}a{color:#0f62fe}em{font-style:italic}@keyframes -esm-patient-programs__programs-form__skeleton____oCAx{0%{opacity:.3;transform:scaleX(0);transform-origin:left}20%{opacity:1;transform:scaleX(1);transform-origin:left}28%{transform:scaleX(1);transform-origin:right}51%{transform:scaleX(0);transform-origin:right}58%{transform:scaleX(0);transform-origin:right}82%{transform:scaleX(1);transform-origin:right}83%{transform:scaleX(1);transform-origin:left}96%{transform:scaleX(0);transform-origin:left}100%{opacity:.3;transform:scaleX(0);transform-origin:left}}.-esm-patient-programs__programs-form__selectContainer___SCnNW{display:flex;align-items:center}.-esm-patient-programs__programs-form__loading___KGmNP{margin-left:1rem;width:2rem;min-height:2.5rem}.-esm-patient-programs__programs-form__button___KPSt9{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-programs__programs-form__tablet___yw5Wr{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-programs__programs-form__desktop___RnK8C{padding:0rem}.-esm-patient-programs__programs-form__formContainer___lqbdm{margin:1rem}.-esm-patient-programs__programs-form__form___BLqPA{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - 6rem)}",""]),i.locals={selectContainer:"-esm-patient-programs__programs-form__selectContainer___SCnNW",loading:"-esm-patient-programs__programs-form__loading___KGmNP",button:"-esm-patient-programs__programs-form__button___KPSt9",tablet:"-esm-patient-programs__programs-form__tablet___yw5Wr",desktop:"-esm-patient-programs__programs-form__desktop___RnK8C",formContainer:"-esm-patient-programs__programs-form__formContainer___lqbdm",form:"-esm-patient-programs__programs-form__form___BLqPA",skeleton:"-esm-patient-programs__programs-form__skeleton____oCAx"};const l=i},8145:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var n=r(9902),o=r.n(n),a=r(3565),i=r.n(a),l=r(3863),s=r(8827),m=r(819),c=r(9857),u=r(4924),d=r(3066),p=r(7898),g=r(786),f=r(2810),b=r(5067),_=r(6642),h=r(182),v=r(6549),y=r(7030),w=r(4076),E=r(321),C=r.n(E),P=r(1195),k=r.n(P),O=r(3275),S=r.n(O),x=r(7162),Z=r.n(x),j=r(2094),T=r.n(j),D=r(757),q=r.n(D),L=r(1951),A={};A.styleTagTransform=q(),A.setAttributes=Z(),A.insert=S().bind(null,"head"),A.domAPI=k(),A.insertStyleElement=T(),C()(L.Z,A);const I=L.Z&&L.Z.locals?L.Z.locals:void 0;function N(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 z(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return N(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)?N(e,t):void 0}}(e,t)||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 B=function(e){var t,r,n,a,E=e.closeWorkspace,C=e.patientUuid,P=e.programEnrollmentId,k=(0,u.useTranslation)().t,O="tablet"===(0,d.useLayoutType)(),S=(0,d.useSession)(),x=(0,d.useLocations)(),Z=(0,c.kY)().mutate,j=(0,w.oI)().data,T=(0,w.Bw)(C).data,D=P&&T.filter((function(e){return e.uuid==P}))[0],q=D?function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){z(e,t,r[t])}))}return e}({display:D.program.name},D.program):null,L=q?[q]:(0,l.Z)(j,(function(e){return!(0,s.Z)((0,m.Z)(T,"program.uuid"),e.uuid)})),A=X(o().useState((null==D?void 0:D.dateCompleted)?(0,d.parseDate)(D.dateCompleted):null),2),N=A[0],B=A[1],V=X(o().useState((null==D?void 0:D.dateEnrolled)?(0,d.parseDate)(D.dateEnrolled):new Date),2),F=V[0],M=V[1],K=X(o().useState(null!==(r=null==D?void 0:D.program.uuid)&&void 0!==r?r:""),2),U=K[0],W=K[1],Y=X(o().useState(null!==(n=null==D?void 0:D.location.uuid)&&void 0!==n?n:""),2),R=Y[0],H=Y[1];!R&&(null==S||null===(t=S.sessionLocation)||void 0===t?void 0:t.uuid)&&H(null==S||null===(a=S.sessionLocation)||void 0===a?void 0:a.uuid);var G=o().useCallback((function(e){if(e.preventDefault(),U){var t={patient:C,program:U,dateEnrolled:F?i()(F).format():null,dateCompleted:N?i()(N).format():null,location:R},r=new AbortController,n=D?(0,w.YX)(D.uuid,t,r).subscribe((function(e){200===e.status&&(E(),(0,d.showToast)({critical:!0,kind:"success",description:k("enrollmentUpdatesNowVisible","Changes to the program are now visible in the Programs table"),title:k("enrollmentUpdated","Program enrollment updated")}),Z("/ws/rest/v1/programenrollment?patient=".concat(C,"&v=").concat(w.o9)))}),(function(e){(0,d.createErrorHandler)(),(0,d.showNotification)({title:k("programEnrollmentSaveError","Error saving program enrollment"),kind:"error",critical:!0,description:null==e?void 0:e.message})})):(0,w.df)(t,r).subscribe((function(e){201===e.status&&(E(),(0,d.showToast)({critical:!0,kind:"success",description:k("enrollmentNowVisible","It is now visible in the Programs table"),title:k("enrollmentSaved","Program enrollment saved")}),Z("/ws/rest/v1/programenrollment?patient=".concat(C,"&v=").concat(w.o9)))}),(function(e){(0,d.createErrorHandler)(),(0,d.showNotification)({title:k("programEnrollmentSaveError","Error saving program enrollment"),kind:"error",critical:!0,description:null==e?void 0:e.message})}));return function(){n.unsubscribe()}}}),[E,N,F,Z,C,U,k,R,D]);return o().createElement(p.Z,{className:I.form,onSubmit:G},o().createElement("div",{className:I.formContainer},o().createElement(g.Z,{style:{width:"50%"},legendText:k("program","Program")},o().createElement("div",{className:I.selectContainer},o().createElement(f.Z,{id:"program",invalidText:k("required","Required"),labelText:"",light:O,onChange:function(e){return W(e.target.value)}},U?null:o().createElement(b.Z,{text:k("chooseProgram","Choose a program"),value:""}),(null==L?void 0:L.length)>0&&L.map((function(e){return o().createElement(b.Z,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),o().createElement(g.Z,{legendText:k("dateEnrolled","Date enrolled")},o().createElement(_.Z,{id:"enrollmentDate",datePickerType:"single",dateFormat:"d/m/Y",light:O,maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=X(e,1)[0];return M(t)},value:F},o().createElement(h.Z,{id:"enrollmentDateInput",labelText:""}))),o().createElement(g.Z,{legendText:k("dateCompleted","Date completed")},o().createElement(_.Z,{id:"completionDate",datePickerType:"single",dateFormat:"d/m/Y",light:O,minDate:new Date(F).toISOString(),maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=X(e,1)[0];return B(t)},value:N},o().createElement(h.Z,{id:"completionDateInput",labelText:""}))),o().createElement(g.Z,{style:{width:"50%"},legendText:k("enrollmentLocation","Enrollment location")},o().createElement(f.Z,{id:"location",invalidText:"Required",labelText:"",light:O,onChange:function(e){return H(e.target.value)},value:R},R?null:o().createElement(b.Z,{text:k("chooseLocation","Choose a location"),value:""}),(null==x?void 0:x.length)>0&&x.map((function(e){return o().createElement(b.Z,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),o().createElement(v.Z,{className:O?I.tablet:I.desktop},o().createElement(y.Z,{className:I.button,kind:"secondary",onClick:function(){return E()}},k("cancel","Cancel")),o().createElement(y.Z,{className:I.button,kind:"primary",disabled:!U,type:"submit"},k("saveAndClose","Save and close"))))}},4076:(e,t,r)=>{r.d(t,{Bw:()=>u,YX:()=>g,b$:()=>f,df:()=>p,o9:()=>c,oI:()=>d});var n=r(9857),o=r(3066),a=r(4200),i=r(3863),l=r(8827),s=r(819);function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c="custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display))";function u(e){var t,r=(0,n.ZP)("/ws/rest/v1/programenrollment?patient=".concat(e,"&v=").concat(c),o.openmrsFetch),i=r.data,l=r.error,s=r.isValidating,m=(null==i||null===(t=i.data)||void 0===t?void 0:t.results.length)>0?null==i?void 0:i.data.results.sort((function(e,t){return t.dateEnrolled>e.dateEnrolled?1:-1})):null,u=null==m?void 0:m.filter((function(e){return!e.dateCompleted}));return{data:i?(0,a.Z)(m,(function(e){var t;return null==e||null===(t=e.program)||void 0===t?void 0:t.uuid})):null,isError:l,isLoading:!i&&!l,isValidating:s,activeEnrollments:u}}function d(e){var t,r,a=(0,n.ZP)("/ws/rest/v1/program?v=custom:(uuid,display,allWorkflows,concept:(uuid,display))",o.openmrsFetch),m=a.data,c=a.error,u=null!==(r=null==m||null===(t=m.data)||void 0===t?void 0:t.results)&&void 0!==r?r:null;return{data:u,isError:c,isLoading:!m&&!c,eligiblePrograms:(0,i.Z)(u,(function(t){return!(0,l.Z)((0,s.Z)(e,"program.uuid"),t.uuid)}))}}function p(e,t){if(!e)return null;var r=e.program,n=e.patient,a=e.dateEnrolled,i=e.dateCompleted,l=e.location;return(0,o.openmrsObservableFetch)("/ws/rest/v1/programenrollment",{method:"POST",headers:{"Content-Type":"application/json"},body:{program:r,patient:n,dateEnrolled:a,dateCompleted:i,location:l},signal:t.signal})}function g(e,t,r){if(!t&&!t.program)return null;t.program;var n=t.dateEnrolled,a=t.dateCompleted,i=t.location;return(0,o.openmrsObservableFetch)("/ws/rest/v1/programenrollment/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:{dateEnrolled:n,dateCompleted:a,location:i},signal:r.signal})}var f=function(e){var t,r,a=(0,o.useConfig)().customUrl,i=u(e),l=i.data,s=i.isError,c=i.isLoading,p=i.isValidating,g=i.activeEnrollments,f=d(l),b=f.data,_=f.eligiblePrograms,h=function(e){var t,r=(0,o.useConfig)().customUrl,a=(0,n.ZP)(r?"".concat(r).concat(e):null,o.openmrsFetch),i=a.data,l=a.error;return{configurablePrograms:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:[],isLoading:!i&&!l,error:l}}(e),v=h.configurablePrograms,y=h.isLoading,w=h.error;return t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){m(e,t,r[t])}))}return e}({enrollments:l},a?{isLoading:y,isError:w}:{isLoading:c,isError:s}),r=null!=(r={isValidating:p,activeEnrollments:g,availablePrograms:b,eligiblePrograms:_,configurablePrograms:v})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})),t}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_openmrs_esm_patient_programs_app=self.webpackChunk_openmrs_esm_patient_programs_app||[]).push([[145],{1951:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(9601),o=r.n(n),a=r(2609),l=r.n(a)()(o());l.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-programs__programs-form__loading___KGmNP{margin-left:1rem;width:2rem;min-height:2.5rem}.-esm-patient-programs__programs-form__button___KPSt9{height:4rem;display:flex;align-content:flex-start;align-items:baseline;min-width:50%}.-esm-patient-programs__programs-form__tablet___yw5Wr{padding:1.5rem 1rem;background-color:#fff}.-esm-patient-programs__programs-form__desktop___RnK8C{padding:0rem}.-esm-patient-programs__programs-form__formContainer___lqbdm{margin:1rem}.-esm-patient-programs__programs-form__form___BLqPA{display:flex;flex-direction:column;justify-content:space-between;height:calc(100vh - 6rem)}",""]),l.locals={loading:"-esm-patient-programs__programs-form__loading___KGmNP",button:"-esm-patient-programs__programs-form__button___KPSt9",tablet:"-esm-patient-programs__programs-form__tablet___yw5Wr",desktop:"-esm-patient-programs__programs-form__desktop___RnK8C",formContainer:"-esm-patient-programs__programs-form__formContainer___lqbdm",form:"-esm-patient-programs__programs-form__form___BLqPA"};const i=l},8145:(e,t,r)=>{r.r(t),r.d(t,{default:()=>N});var n=r(7900),o=r.n(n),a=r(4924),l=r(3565),i=r.n(l),u=r(3863),s=r(8827),c=r(819),m=r(9857),d=r(3066),p=r(7047),f=r(4076),g=r(321),v=r.n(g),b=r(1195),_=r.n(b),y=r(3275),h=r.n(y),E=r(7162),w=r.n(E),O=r(2094),P=r.n(O),Z=r(757),C=r.n(Z),S=r(1951),j={};j.styleTagTransform=C(),j.setAttributes=w(),j.insert=h().bind(null,"head"),j.domAPI=_(),j.insertStyleElement=P(),v()(S.Z,j);const k=S.Z&&S.Z.locals?S.Z.locals:void 0;function x(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 T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,o=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return x(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)?x(e,t):void 0}}(e,t)||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 N=function(e){var t,r,n,l,g=e.closeWorkspace,v=e.patientUuid,b=e.programEnrollmentId,_=(0,a.useTranslation)().t,y="tablet"===(0,d.useLayoutType)(),h=(0,d.useSession)(),E=(0,d.useLocations)(),w=(0,m.kY)().mutate,O=(0,f.oI)().data,P=(0,f.Bw)(v).data,Z=b&&P.filter((function(e){return e.uuid==b}))[0],C=Z?function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){T(e,t,r[t])}))}return e}({display:Z.program.name},Z.program):null,S=C?[C]:(0,u.Z)(O,(function(e){return!(0,s.Z)((0,c.Z)(P,"program.uuid"),e.uuid)})),j=D(o().useState((null==Z?void 0:Z.dateCompleted)?(0,d.parseDate)(Z.dateCompleted):null),2),x=j[0],N=j[1],A=D(o().useState((null==Z?void 0:Z.dateEnrolled)?(0,d.parseDate)(Z.dateEnrolled):new Date),2),I=A[0],L=A[1],F=D(o().useState(null!==(r=null==Z?void 0:Z.program.uuid)&&void 0!==r?r:""),2),q=F[0],K=F[1],V=D(o().useState(null!==(n=null==Z?void 0:Z.location.uuid)&&void 0!==n?n:""),2),H=V[0],U=V[1];!H&&(null==h||null===(t=h.sessionLocation)||void 0===t?void 0:t.uuid)&&U(null==h||null===(l=h.sessionLocation)||void 0===l?void 0:l.uuid);var W=o().useCallback((function(e){if(e.preventDefault(),q){var t={patient:v,program:q,dateEnrolled:I?i()(I).format():null,dateCompleted:x?i()(x).format():null,location:H},r=new AbortController,n=Z?(0,f.YX)(Z.uuid,t,r).subscribe((function(e){200===e.status&&(g(),(0,d.showToast)({critical:!0,kind:"success",description:_("enrollmentUpdatesNowVisible","Changes to the program are now visible in the Programs table"),title:_("enrollmentUpdated","Program enrollment updated")}),w("/ws/rest/v1/programenrollment?patient=".concat(v,"&v=").concat(f.o9)))}),(function(e){(0,d.createErrorHandler)(),(0,d.showNotification)({title:_("programEnrollmentSaveError","Error saving program enrollment"),kind:"error",critical:!0,description:null==e?void 0:e.message})})):(0,f.df)(t,r).subscribe((function(e){201===e.status&&(g(),(0,d.showToast)({critical:!0,kind:"success",description:_("enrollmentNowVisible","It is now visible in the Programs table"),title:_("enrollmentSaved","Program enrollment saved")}),w("/ws/rest/v1/programenrollment?patient=".concat(v,"&v=").concat(f.o9)))}),(function(e){(0,d.createErrorHandler)(),(0,d.showNotification)({title:_("programEnrollmentSaveError","Error saving program enrollment"),kind:"error",critical:!0,description:null==e?void 0:e.message})}));return function(){n.unsubscribe()}}}),[g,x,I,w,v,q,_,H,Z]);return o().createElement(p.l09,{className:k.form,onSubmit:W},o().createElement(p.Kqy,{className:k.formContainer,gap:7},o().createElement(p.cwH,{style:{maxWidth:"50%"},legendText:_("programName","Program name")},o().createElement("div",{className:k.selectContainer},o().createElement(p.PhF,{id:"program",invalidText:_("required","Required"),labelText:"",light:y,onChange:function(e){return K(e.target.value)}},q?null:o().createElement(p.QlF,{text:_("chooseProgram","Choose a program"),value:""}),(null==S?void 0:S.length)>0&&S.map((function(e){return o().createElement(p.QlF,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),o().createElement(p.cwH,{style:{maxWidth:"50%"},legendText:_("dateEnrolled","Date enrolled")},o().createElement(p.Mtg,{id:"enrollmentDate",datePickerType:"single",dateFormat:"d/m/Y",light:y,maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=D(e,1)[0];return L(t)},value:I},o().createElement(p.aj6,{id:"enrollmentDateInput",labelText:""}))),o().createElement(p.cwH,{style:{width:"50%"},legendText:_("dateCompleted","Date completed")},o().createElement(p.Mtg,{id:"completionDate",datePickerType:"single",dateFormat:"d/m/Y",light:y,minDate:new Date(I).toISOString(),maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=D(e,1)[0];return N(t)},value:x},o().createElement(p.aj6,{id:"completionDateInput",labelText:""}))),o().createElement(p.cwH,{style:{width:"50%"},legendText:_("enrollmentLocation","Enrollment location")},o().createElement(p.PhF,{id:"location",invalidText:"Required",labelText:"",light:y,onChange:function(e){return U(e.target.value)},value:H},H?null:o().createElement(p.QlF,{text:_("chooseLocation","Choose a location"),value:""}),(null==E?void 0:E.length)>0&&E.map((function(e){return o().createElement(p.QlF,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),o().createElement(p.uVA,{className:y?k.tablet:k.desktop},o().createElement(p.zxk,{className:k.button,kind:"secondary",onClick:function(){return g()}},_("cancel","Cancel")),o().createElement(p.zxk,{className:k.button,kind:"primary",disabled:!q,type:"submit"},_("saveAndClose","Save and close"))))}},4076:(e,t,r)=>{r.d(t,{Bw:()=>m,YX:()=>f,b$:()=>g,df:()=>p,o9:()=>c,oI:()=>d});var n=r(9857),o=r(3066),a=r(4200),l=r(3863),i=r(8827),u=r(819);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c="custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display))";function m(e){var t,r=(0,n.ZP)("/ws/rest/v1/programenrollment?patient=".concat(e,"&v=").concat(c),o.openmrsFetch),l=r.data,i=r.error,u=r.isValidating,s=(null==l||null===(t=l.data)||void 0===t?void 0:t.results.length)>0?null==l?void 0:l.data.results.sort((function(e,t){return t.dateEnrolled>e.dateEnrolled?1:-1})):null,m=null==s?void 0:s.filter((function(e){return!e.dateCompleted}));return{data:l?(0,a.Z)(s,(function(e){var t;return null==e||null===(t=e.program)||void 0===t?void 0:t.uuid})):null,isError:i,isLoading:!l&&!i,isValidating:u,activeEnrollments:m}}function d(e){var t,r,a=(0,n.ZP)("/ws/rest/v1/program?v=custom:(uuid,display,allWorkflows,concept:(uuid,display))",o.openmrsFetch),s=a.data,c=a.error,m=null!==(r=null==s||null===(t=s.data)||void 0===t?void 0:t.results)&&void 0!==r?r:null;return{data:m,isError:c,isLoading:!s&&!c,eligiblePrograms:(0,l.Z)(m,(function(t){return!(0,i.Z)((0,u.Z)(e,"program.uuid"),t.uuid)}))}}function p(e,t){if(!e)return null;var r=e.program,n=e.patient,a=e.dateEnrolled,l=e.dateCompleted,i=e.location;return(0,o.openmrsObservableFetch)("/ws/rest/v1/programenrollment",{method:"POST",headers:{"Content-Type":"application/json"},body:{program:r,patient:n,dateEnrolled:a,dateCompleted:l,location:i},signal:t.signal})}function f(e,t,r){if(!t&&!t.program)return null;t.program;var n=t.dateEnrolled,a=t.dateCompleted,l=t.location;return(0,o.openmrsObservableFetch)("/ws/rest/v1/programenrollment/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:{dateEnrolled:n,dateCompleted:a,location:l},signal:r.signal})}var g=function(e){var t,r,a=(0,o.useConfig)().customUrl,l=m(e),i=l.data,u=l.isError,c=l.isLoading,p=l.isValidating,f=l.activeEnrollments,g=d(i),v=g.data,b=g.eligiblePrograms,_=function(e){var t,r=(0,o.useConfig)().customUrl,a=(0,n.ZP)(r?"".concat(r).concat(e):null,o.openmrsFetch),l=a.data,i=a.error;return{configurablePrograms:null!==(t=null==l?void 0:l.data)&&void 0!==t?t:[],isLoading:!l&&!i,error:i}}(e),y=_.configurablePrograms,h=_.isLoading,E=_.error;return t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){s(e,t,r[t])}))}return e}({enrollments:i},a?{isLoading:h,isError:E}:{isLoading:c,isError:u}),r=null!=(r={isValidating:p,activeEnrollments:f,availablePrograms:v,eligiblePrograms:b,configurablePrograms:y})?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})),t}},1154:(e,t,r)=>{r.d(t,{Z:()=>l});const n=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),l=a.length;l--;){var i=a[++n];if(!1===t(o[i],i,o))break}return e};var o=r(6892);var a=r(3282);const l=(i=function(e,t){return e&&n(e,t,o.Z)},function(e,t){if(null==e)return e;if(!(0,a.Z)(e))return i(e,t);for(var r=e.length,n=-1,o=Object(e);++n<r&&!1!==t(o[n],n,o););return e});var i},3863:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(2300),o=r(1154);const a=function(e,t){var r=[];return(0,o.Z)(e,(function(e,n,o){t(e,n,o)&&r.push(e)})),r};var l=r(7954),i=r(7885);const u=function(e,t){return((0,i.Z)(e)?n.Z:a)(e,(0,l.Z)(t,3))}},8827:(e,t,r)=>{r.d(t,{Z:()=>w});var n=r(1266),o=r(3282),a=r(9001),l=r(7885),i=r(3391);var u=/\s/;var s=/^\s+/;const c=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&u.test(e.charAt(t)););return t}(e)+1).replace(s,""):e};var m=r(3122),d=r(2758),p=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,g=/^0o[0-7]+$/i,v=parseInt;const b=function(e){return e?Infinity===(e=function(e){if("number"==typeof e)return e;if((0,d.Z)(e))return NaN;if((0,m.Z)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=(0,m.Z)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=c(e);var r=f.test(e);return r||g.test(e)?v(e.slice(2),r?2:8):p.test(e)?NaN:+e}(e))||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var _=r(5598);var y=r(6892);const h=function(e){return null==e?[]:function(e,t){return(0,_.Z)(t,(function(t){return e[t]}))}(e,(0,y.Z)(e))};var E=Math.max;const w=function(e,t,r,u){e=(0,o.Z)(e)?e:h(e),r=r&&!u?function(e){var t=b(e),r=t%1;return t==t?r?t-r:t:0}(r):0;var s=e.length;return r<0&&(r=E(s+r,0)),function(e){return"string"==typeof e||!(0,l.Z)(e)&&(0,i.Z)(e)&&"[object String]"==(0,a.Z)(e)}(e)?r<=s&&e.indexOf(t,r)>-1:!!s&&(0,n.Z)(e,t,r)>-1}},819:(e,t,r)=>{r.d(t,{Z:()=>s});var n=r(5598),o=r(7954),a=r(1154),l=r(3282);const i=function(e,t){var r=-1,n=(0,l.Z)(e)?Array(e.length):[];return(0,a.Z)(e,(function(e,o,a){n[++r]=t(e,o,a)})),n};var u=r(7885);const s=function(e,t){return((0,u.Z)(e)?n.Z:i)(e,(0,o.Z)(t,3))}}}]);
|