@openmrs/esm-patient-programs-app 4.0.1-pre.263 → 4.0.1-pre.269
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
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
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
|
-
[
|
|
1
|
+
[32m@openmrs/esm-patient-programs-app:build[0m: cache hit, replaying output [2m0b593cc2c8f970a4[0m
|
|
2
|
+
[32m@openmrs/esm-patient-programs-app:build: [0massets by chunk 919 KiB (id hint: vendors)
|
|
3
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m assets by status [1m[33m842 KiB[39m[22m [1m[33m[big][39m[22m
|
|
4
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m asset [1m[33m734.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
|
|
5
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m asset [1m[33m858.js[39m[22m [1m[33m407 KiB[39m[22m [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m [1m[33m[big][39m[22m (id hint: vendors) 1 related asset
|
|
6
|
+
[32m@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
|
|
7
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m709.js[39m[22m 19 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors)
|
|
8
|
+
[32m@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
|
|
9
|
+
[32m@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)
|
|
10
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m+ 12 assets
|
|
11
|
+
[32m@openmrs/esm-patient-programs-app:build: [0morphan modules 3.88 MiB [1m[33m[orphan][39m[22m 734 modules
|
|
12
|
+
[32m@openmrs/esm-patient-programs-app:build: [0mruntime modules 40.1 KiB 28 modules
|
|
13
|
+
[32m@openmrs/esm-patient-programs-app:build: [0mbuilt modules 3.08 MiB (javascript) 294 bytes (consume-shared) 252 bytes (share-init) [1m[33m[built][39m[22m
|
|
14
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m../../node_modules/[39m[22m 2.96 MiB 87 modules
|
|
15
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m./[39m[22m 52.4 KiB 11 modules
|
|
16
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m consume-shared-module modules 294 bytes
|
|
17
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m modules by path [1mconsume shared module (default) @openmrs/[39m[22m 126 bytes 3 modules
|
|
18
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m + 4 modules
|
|
19
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m provide-module modules 252 bytes
|
|
20
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m modules by path [1mprovide shared module (default) @openmrs/[39m[22m 84 bytes 2 modules
|
|
21
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m + 4 modules
|
|
22
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m../esm-patient-common-lib/src/[39m[22m 75.2 KiB
|
|
23
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m [1m../esm-patient-common-lib/src/index.ts + 31 modules[39m[22m 64.4 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
24
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m + 5 modules
|
|
25
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m [1mcontainer entry[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
26
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m
|
|
27
|
+
[32m@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).
|
|
28
|
+
[32m@openmrs/esm-patient-programs-app:build: [0mThis can impact web performance.
|
|
29
|
+
[32m@openmrs/esm-patient-programs-app:build: [0mAssets:
|
|
30
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m 858.js (407 KiB)
|
|
31
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m 734.js (435 KiB)[39m[22m
|
|
32
|
+
[32m@openmrs/esm-patient-programs-app:build: [0m
|
|
33
|
+
[32m@openmrs/esm-patient-programs-app:build: [0mwebpack 5.74.0 compiled with [1m[33m1 warning[39m[22m in 33679 ms
|
package/dist/574.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_openmrs_esm_patient_programs_app=self.webpackChunk_openmrs_esm_patient_programs_app||[]).push([[574],{3574:e=>{e.exports=JSON.parse('{"actions":"Actions","active":"Active","activePrograms":"Active programs","add":"Add","cancel":"Cancel","carePrograms":"Care Programs","chooseLocation":"Choose a location","chooseProgram":"Choose a program","completedOn":"Completed on","dateCompleted":"Date completed","dateEnrolled":"Date enrolled","discontinue":"Discontinue","enroll":"Enroll","enrollment":"Enrollment","enrollmentLocation":"Enrollment location","enrollmentNowVisible":"It is now visible in the Programs table","enrollmentSaved":"Program enrollment saved","enrollmentUpdated":"Program enrollment updated","enrollmentUpdatesNowVisible":"Changes to the program are now visible in the Programs table","fullyEnrolled":"Enrolled in all programs","location":"Location","noEligibleEnrollments":"There are no more programs left to enroll this patient in","programEnrollments":"Program enrollments","programEnrollmentSaveError":"Error saving program enrollment","programName":"Program name","programs":"programs","required":"Required","saveAndClose":"Save and close","seeAll":"See all","status":"Status"}')}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_openmrs_esm_patient_programs_app=self.webpackChunk_openmrs_esm_patient_programs_app||[]).push([[574],{3574:e=>{e.exports=JSON.parse('{"actions":"Actions","active":"Active","activePrograms":"Active programs","add":"Add","cancel":"Cancel","carePrograms":"Care Programs","chooseLocation":"Choose a location","chooseProgram":"Choose a program","completedOn":"Completed on","dateCompleted":"Date completed","dateEnrolled":"Date enrolled","discontinue":"Discontinue","enroll":"Enroll","enrollment":"Enrollment","enrollmentLocation":"Enrollment location","enrollmentNowVisible":"It is now visible in the Programs table","enrollmentSaved":"Program enrollment saved","enrollmentUpdated":"Program enrollment updated","enrollmentUpdatesNowVisible":"Changes to the program are now visible in the Programs table","fullyEnrolled":"Enrolled in all programs","location":"Location","noEligibleEnrollments":"There are no more programs left to enroll this patient in","noProgramsConfigured":"No programs configured","programEnrollments":"Program enrollments","programEnrollmentSaveError":"Error saving program enrollment","programName":"Program name","programs":"programs","required":"Required","saveAndClose":"Save and close","seeAll":"See all","status":"Status"}')}}]);
|
package/dist/733.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_openmrs_esm_patient_programs_app=self.webpackChunk_openmrs_esm_patient_programs_app||[]).push([[733],{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},5733:(e,t,r)=>{r.r(t),r.d(t,{default:()=>N});var n=r(268),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(906),p=r(7047),f=r(4076),g=r(6062),v=r.n(g),b=r(4036),_=r.n(b),y=r(6793),h=r.n(y),E=r(7892),w=r.n(E),O=r(1173),P=r.n(O),Z=r(2464),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(906),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))}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_openmrs_esm_patient_programs_app=self.webpackChunk_openmrs_esm_patient_programs_app||[]).push([[733],{1951:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(9601),a=r.n(n),o=r(2609),l=r.n(o)()(a());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},5733:(e,t,r)=>{r.r(t),r.d(t,{default:()=>F});var n=r(268),a=r.n(n),o=r(4924),l=r(9857),i=r(3565),u=r.n(i),s=r(3863),c=r(8827),m=r(819),d=r(7047),p=r(906),g=r(4076),f=r(6062),v=r.n(f),b=r(4036),y=r.n(b),_=r(6793),h=r.n(_),E=r(7892),w=r.n(E),P=r(1173),O=r.n(P),C=r(2464),x=r.n(C),Z=r(1951),S={};S.styleTagTransform=x(),S.setAttributes=w(),S.insert=h().bind(null,"head"),S.domAPI=y(),S.insertStyleElement=O(),v()(Z.Z,S);const k=Z.Z&&Z.Z.locals?Z.Z.locals:void 0;function j(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 D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function T(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,a,o=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return j(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)?j(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 F=function(e){var t,r,n,i,f=e.closeWorkspace,v=e.patientUuid,b=e.programEnrollmentId,y=(0,o.useTranslation)().t,_="tablet"===(0,p.useLayoutType)(),h=(0,p.useSession)(),E=(0,p.useLocations)(),w=(0,l.kY)().mutate,P=(0,g.oI)().data,O=(0,g.Bw)(v).data,C=b&&O.filter((function(e){return e.uuid==b}))[0],x=C?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){D(e,t,r[t])}))}return e}({display:C.program.name},C.program):null,Z=x?[x]:(0,s.Z)(P,(function(e){return!(0,c.Z)((0,m.Z)(O,"program.uuid"),e.uuid)})),S=T(a().useState((null==C?void 0:C.dateCompleted)?(0,p.parseDate)(C.dateCompleted):null),2),j=S[0],F=S[1],I=T(a().useState((null==C?void 0:C.dateEnrolled)?(0,p.parseDate)(C.dateEnrolled):new Date),2),N=I[0],L=I[1],A=T(a().useState(null!==(r=null==C?void 0:C.program.uuid)&&void 0!==r?r:""),2),q=A[0],K=A[1],Q=T(a().useState(null!==(n=null==C?void 0:C.location.uuid)&&void 0!==n?n:""),2),V=Q[0],W=Q[1];!V&&(null==h||null===(t=h.sessionLocation)||void 0===t?void 0:t.uuid)&&W(null==h||null===(i=h.sessionLocation)||void 0===i?void 0:i.uuid);var Y=a().useCallback((function(e){if(e.preventDefault(),q){var t={patient:v,program:q,dateEnrolled:N?u()(N).format():null,dateCompleted:j?u()(j).format():null,location:V},r=new AbortController,n=C?(0,g.YX)(C.uuid,t,r).subscribe((function(e){200===e.status&&(f(),(0,p.showToast)({critical:!0,kind:"success",description:y("enrollmentUpdatesNowVisible","Changes to the program are now visible in the Programs table"),title:y("enrollmentUpdated","Program enrollment updated")}),w("/ws/rest/v1/programenrollment?patient=".concat(v,"&v=").concat(g.o9)))}),(function(e){(0,p.createErrorHandler)(),(0,p.showNotification)({title:y("programEnrollmentSaveError","Error saving program enrollment"),kind:"error",critical:!0,description:null==e?void 0:e.message})})):(0,g.df)(t,r).subscribe((function(e){201===e.status&&(f(),(0,p.showToast)({critical:!0,kind:"success",description:y("enrollmentNowVisible","It is now visible in the Programs table"),title:y("enrollmentSaved","Program enrollment saved")}),w("/ws/rest/v1/programenrollment?patient=".concat(v,"&v=").concat(g.o9)))}),(function(e){(0,p.createErrorHandler)(),(0,p.showNotification)({title:y("programEnrollmentSaveError","Error saving program enrollment"),kind:"error",critical:!0,description:null==e?void 0:e.message})}));return function(){n.unsubscribe()}}}),[f,j,N,w,v,q,y,V,C]);return a().createElement(d.l09,{className:k.form,onSubmit:Y},a().createElement(d.Kqy,{className:k.formContainer,gap:7},Z.length?null:a().createElement(d.K0D,{style:{minWidth:"100%",margin:"0rem",padding:"0rem"},kind:"error",lowContrast:!0,subtitle:y("configurePrograms","Please configure programs to continue."),title:y("noProgramsConfigured","No programs configured")}),a().createElement(d.cwH,{style:{maxWidth:"50%"},legendText:y("programName","Program name")},a().createElement("div",{className:k.selectContainer},_?a().createElement(d.mh4,null,a().createElement(d.PhF,{id:"program",invalidText:y("required","Required"),labelText:"",onChange:function(e){return K(e.target.value)}},q?null:a().createElement(d.QlF,{text:y("chooseProgram","Choose a program"),value:""}),(null==Z?void 0:Z.length)>0&&Z.map((function(e){return a().createElement(d.QlF,{key:e.uuid,text:e.display,value:e.uuid},e.display)})))):a().createElement(d.PhF,{id:"program",invalidText:y("required","Required"),labelText:"",onChange:function(e){return K(e.target.value)}},q?null:a().createElement(d.QlF,{text:y("chooseProgram","Choose a program"),value:""}),(null==Z?void 0:Z.length)>0&&Z.map((function(e){return a().createElement(d.QlF,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),a().createElement(d.cwH,{style:{maxWidth:"50%"},legendText:y("dateEnrolled","Date enrolled")},_?a().createElement(d.mh4,null,a().createElement(d.Mtg,{id:"enrollmentDate",datePickerType:"single",dateFormat:"d/m/Y",maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=T(e,1)[0];return L(t)},value:N},a().createElement(d.aj6,{id:"enrollmentDateInput",labelText:""}))):a().createElement(d.Mtg,{id:"enrollmentDate",datePickerType:"single",dateFormat:"d/m/Y",maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=T(e,1)[0];return L(t)},value:N},a().createElement(d.aj6,{id:"enrollmentDateInput",labelText:""}))),a().createElement(d.cwH,{style:{width:"50%"},legendText:y("dateCompleted","Date completed")},_?a().createElement(d.mh4,null,a().createElement(d.Mtg,{id:"completionDate",datePickerType:"single",dateFormat:"d/m/Y",minDate:new Date(N).toISOString(),maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=T(e,1)[0];return F(t)},value:j},a().createElement(d.aj6,{id:"completionDateInput",labelText:""}))):a().createElement(d.Mtg,{id:"completionDate",datePickerType:"single",dateFormat:"d/m/Y",minDate:new Date(N).toISOString(),maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=T(e,1)[0];return F(t)},value:j},a().createElement(d.aj6,{id:"completionDateInput",labelText:""}))),a().createElement(d.cwH,{style:{width:"50%"},legendText:y("enrollmentLocation","Enrollment location")},_?a().createElement(d.mh4,null,a().createElement(d.PhF,{id:"location",invalidText:"Required",labelText:"",onChange:function(e){return W(e.target.value)},value:V},V?null:a().createElement(d.QlF,{text:y("chooseLocation","Choose a location"),value:""}),(null==E?void 0:E.length)>0&&E.map((function(e){return a().createElement(d.QlF,{key:e.uuid,text:e.display,value:e.uuid},e.display)})))):a().createElement(d.PhF,{id:"location",invalidText:"Required",labelText:"",onChange:function(e){return W(e.target.value)},value:V},V?null:a().createElement(d.QlF,{text:y("chooseLocation","Choose a location"),value:""}),(null==E?void 0:E.length)>0&&E.map((function(e){return a().createElement(d.QlF,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),a().createElement(d.uVA,{className:_?k.tablet:k.desktop},a().createElement(d.zxk,{className:k.button,kind:"secondary",onClick:function(){return f()}},y("cancel","Cancel")),a().createElement(d.zxk,{className:k.button,kind:"primary",disabled:!q,type:"submit"},y("saveAndClose","Save and close"))))}},4076:(e,t,r)=>{r.d(t,{Bw:()=>m,YX:()=>g,b$:()=>f,df:()=>p,o9:()=>c,oI:()=>d});var n=r(9857),a=r(906),o=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),a.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,o.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,o=(0,n.ZP)("/ws/rest/v1/program?v=custom:(uuid,display,allWorkflows,concept:(uuid,display))",a.openmrsFetch),s=o.data,c=o.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,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:r,patient:n,dateEnrolled:o,dateCompleted:l,location:i},signal:t.signal})}function g(e,t,r){if(!t&&!t.program)return null;t.program;var n=t.dateEnrolled,o=t.dateCompleted,l=t.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:r.signal})}var f=function(e){var t,r,o=(0,a.useConfig)().customUrl,l=m(e),i=l.data,u=l.isError,c=l.isLoading,p=l.isValidating,g=l.activeEnrollments,f=d(i),v=f.data,b=f.eligiblePrograms,y=function(e){var t,r=(0,a.useConfig)().customUrl,o=(0,n.ZP)(r?"".concat(r).concat(e):null,a.openmrsFetch),l=o.data,i=o.error;return{configurablePrograms:null!==(t=null==l?void 0:l.data)&&void 0!==t?t:[],isLoading:!l&&!i,error:i}}(e),_=y.configurablePrograms,h=y.isLoading,E=y.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},o?{isLoading:h,isError:E}:{isLoading:c,isError:u}),r=null!=(r={isValidating:p,activeEnrollments:g,availablePrograms:v,eligiblePrograms:b,configurablePrograms:_})?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,a=Object(e),o=r(e),l=o.length;l--;){var i=o[++n];if(!1===t(a[i],i,a))break}return e};var a=r(6892);var o=r(3282);const l=(i=function(e,t){return e&&n(e,t,a.Z)},function(e,t){if(null==e)return e;if(!(0,o.Z)(e))return i(e,t);for(var r=e.length,n=-1,a=Object(e);++n<r&&!1!==t(a[n],n,a););return e});var i},3863:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(2300),a=r(1154);const o=function(e,t){var r=[];return(0,a.Z)(e,(function(e,n,a){t(e,n,a)&&r.push(e)})),r};var l=r(7954),i=r(7885);const u=function(e,t){return((0,i.Z)(e)?n.Z:o)(e,(0,l.Z)(t,3))}},8827:(e,t,r)=>{r.d(t,{Z:()=>w});var n=r(1266),a=r(3282),o=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,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,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=g.test(e);return r||f.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 y=r(5598);var _=r(6892);const h=function(e){return null==e?[]:function(e,t){return(0,y.Z)(t,(function(t){return e[t]}))}(e,(0,_.Z)(e))};var E=Math.max;const w=function(e,t,r,u){e=(0,a.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,o.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),a=r(7954),o=r(1154),l=r(3282);const i=function(e,t){var r=-1,n=(0,l.Z)(e)?Array(e.length):[];return(0,o.Z)(e,(function(e,a,o){n[++r]=t(e,a,o)})),n};var u=r(7885);const s=function(e,t){return((0,u.Z)(e)?n.Z:i)(e,(0,a.Z)(t,3))}}}]);
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"main.js"
|
|
49
49
|
],
|
|
50
50
|
"auxiliaryFiles": [],
|
|
51
|
-
"hash": "
|
|
51
|
+
"hash": "17437efa05d870821eaf",
|
|
52
52
|
"childrenByOrder": {}
|
|
53
53
|
},
|
|
54
54
|
{
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"435.js"
|
|
166
166
|
],
|
|
167
167
|
"auxiliaryFiles": [],
|
|
168
|
-
"hash": "
|
|
168
|
+
"hash": "bc6393de0f65f4fa5938",
|
|
169
169
|
"childrenByOrder": {}
|
|
170
170
|
},
|
|
171
171
|
{
|
|
@@ -198,9 +198,9 @@
|
|
|
198
198
|
"initial": false,
|
|
199
199
|
"entry": false,
|
|
200
200
|
"recorded": false,
|
|
201
|
-
"size":
|
|
201
|
+
"size": 1122,
|
|
202
202
|
"sizes": {
|
|
203
|
-
"javascript":
|
|
203
|
+
"javascript": 1122
|
|
204
204
|
},
|
|
205
205
|
"names": [],
|
|
206
206
|
"idHints": [],
|
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
"574.js"
|
|
213
213
|
],
|
|
214
214
|
"auxiliaryFiles": [],
|
|
215
|
-
"hash": "
|
|
215
|
+
"hash": "451d31e4b5062ef2b521",
|
|
216
216
|
"childrenByOrder": {}
|
|
217
217
|
},
|
|
218
218
|
{
|
|
@@ -287,9 +287,9 @@
|
|
|
287
287
|
"initial": false,
|
|
288
288
|
"entry": false,
|
|
289
289
|
"recorded": false,
|
|
290
|
-
"size":
|
|
290
|
+
"size": 41884,
|
|
291
291
|
"sizes": {
|
|
292
|
-
"javascript":
|
|
292
|
+
"javascript": 41842,
|
|
293
293
|
"consume-shared": 42
|
|
294
294
|
},
|
|
295
295
|
"names": [],
|
|
@@ -302,7 +302,7 @@
|
|
|
302
302
|
"733.js"
|
|
303
303
|
],
|
|
304
304
|
"auxiliaryFiles": [],
|
|
305
|
-
"hash": "
|
|
305
|
+
"hash": "8e0205ddb8738e0758d4",
|
|
306
306
|
"childrenByOrder": {}
|
|
307
307
|
},
|
|
308
308
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-patient-programs-app",
|
|
3
|
-
"version": "4.0.1-pre.
|
|
3
|
+
"version": "4.0.1-pre.269",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Patient programs microfrontend for the OpenMRS SPA",
|
|
6
6
|
"browser": "dist/openmrs-esm-patient-programs-app.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@carbon/react": "^1.9.0",
|
|
38
|
-
"@openmrs/esm-patient-common-lib": "^4.0.1-pre.
|
|
38
|
+
"@openmrs/esm-patient-common-lib": "^4.0.1-pre.269",
|
|
39
39
|
"d3": "^7.0.3",
|
|
40
40
|
"lodash-es": "^4.17.15"
|
|
41
41
|
},
|
|
@@ -48,5 +48,8 @@
|
|
|
48
48
|
"react-router-dom": "6.x",
|
|
49
49
|
"rxjs": "6.x"
|
|
50
50
|
},
|
|
51
|
-
"
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"webpack": "^5.74.0"
|
|
53
|
+
},
|
|
54
|
+
"gitHead": "27790bfbf1871dd1b9837298c55c8acd821af9e6"
|
|
52
55
|
}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import React, { SyntheticEvent } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { useSWRConfig } from 'swr';
|
|
3
4
|
import dayjs from 'dayjs';
|
|
4
5
|
import filter from 'lodash-es/filter';
|
|
5
6
|
import includes from 'lodash-es/includes';
|
|
6
7
|
import map from 'lodash-es/map';
|
|
7
|
-
import { useSWRConfig } from 'swr';
|
|
8
|
-
import {
|
|
9
|
-
createErrorHandler,
|
|
10
|
-
showNotification,
|
|
11
|
-
showToast,
|
|
12
|
-
useSession,
|
|
13
|
-
useLocations,
|
|
14
|
-
useLayoutType,
|
|
15
|
-
parseDate,
|
|
16
|
-
} from '@openmrs/esm-framework';
|
|
17
8
|
import {
|
|
18
9
|
Button,
|
|
19
10
|
ButtonSet,
|
|
@@ -21,10 +12,22 @@ import {
|
|
|
21
12
|
DatePickerInput,
|
|
22
13
|
Form,
|
|
23
14
|
FormGroup,
|
|
15
|
+
InlineNotification,
|
|
16
|
+
Layer,
|
|
24
17
|
Select,
|
|
25
18
|
SelectItem,
|
|
26
19
|
Stack,
|
|
27
20
|
} from '@carbon/react';
|
|
21
|
+
import {
|
|
22
|
+
createErrorHandler,
|
|
23
|
+
showNotification,
|
|
24
|
+
showToast,
|
|
25
|
+
useSession,
|
|
26
|
+
useLocations,
|
|
27
|
+
useLayoutType,
|
|
28
|
+
parseDate,
|
|
29
|
+
} from '@openmrs/esm-framework';
|
|
30
|
+
import { DefaultWorkspaceProps } from '@openmrs/esm-patient-common-lib';
|
|
28
31
|
import {
|
|
29
32
|
createProgramEnrollment,
|
|
30
33
|
useAvailablePrograms,
|
|
@@ -32,7 +35,6 @@ import {
|
|
|
32
35
|
customRepresentation,
|
|
33
36
|
updateProgramEnrollment,
|
|
34
37
|
} from './programs.resource';
|
|
35
|
-
import { DefaultWorkspaceProps } from '@openmrs/esm-patient-common-lib';
|
|
36
38
|
import styles from './programs-form.scss';
|
|
37
39
|
|
|
38
40
|
interface ProgramsFormProps extends DefaultWorkspaceProps {
|
|
@@ -48,6 +50,7 @@ const ProgramsForm: React.FC<ProgramsFormProps> = ({ closeWorkspace, patientUuid
|
|
|
48
50
|
|
|
49
51
|
const { data: availablePrograms } = useAvailablePrograms();
|
|
50
52
|
const { data: enrollments } = useEnrollments(patientUuid);
|
|
53
|
+
|
|
51
54
|
const currentEnrollment = programEnrollmentId && enrollments.filter((e) => e.uuid == programEnrollmentId)[0];
|
|
52
55
|
const currentProgram = currentEnrollment
|
|
53
56
|
? {
|
|
@@ -59,6 +62,7 @@ const ProgramsForm: React.FC<ProgramsFormProps> = ({ closeWorkspace, patientUuid
|
|
|
59
62
|
const eligiblePrograms = currentProgram
|
|
60
63
|
? [currentProgram]
|
|
61
64
|
: filter(availablePrograms, (program) => !includes(map(enrollments, 'program.uuid'), program.uuid));
|
|
65
|
+
|
|
62
66
|
const [completionDate, setCompletionDate] = React.useState<Date>(
|
|
63
67
|
currentEnrollment?.dateCompleted ? parseDate(currentEnrollment.dateCompleted) : null,
|
|
64
68
|
);
|
|
@@ -163,71 +167,148 @@ const ProgramsForm: React.FC<ProgramsFormProps> = ({ closeWorkspace, patientUuid
|
|
|
163
167
|
return (
|
|
164
168
|
<Form className={styles.form} onSubmit={handleSubmit}>
|
|
165
169
|
<Stack className={styles.formContainer} gap={7}>
|
|
170
|
+
{!eligiblePrograms.length ? (
|
|
171
|
+
<InlineNotification
|
|
172
|
+
style={{ minWidth: '100%', margin: '0rem', padding: '0rem' }}
|
|
173
|
+
kind={'error'}
|
|
174
|
+
lowContrast
|
|
175
|
+
subtitle={t('configurePrograms', 'Please configure programs to continue.')}
|
|
176
|
+
title={t('noProgramsConfigured', 'No programs configured')}
|
|
177
|
+
/>
|
|
178
|
+
) : null}
|
|
166
179
|
<FormGroup style={{ maxWidth: '50%' }} legendText={t('programName', 'Program name')}>
|
|
167
180
|
<div className={styles.selectContainer}>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
{isTablet ? (
|
|
182
|
+
<Layer>
|
|
183
|
+
<Select
|
|
184
|
+
id="program"
|
|
185
|
+
invalidText={t('required', 'Required')}
|
|
186
|
+
labelText=""
|
|
187
|
+
onChange={(event) => setSelectedProgram(event.target.value)}
|
|
188
|
+
>
|
|
189
|
+
{!selectedProgram ? <SelectItem text={t('chooseProgram', 'Choose a program')} value="" /> : null}
|
|
190
|
+
{eligiblePrograms?.length > 0 &&
|
|
191
|
+
eligiblePrograms.map((program) => (
|
|
192
|
+
<SelectItem key={program.uuid} text={program.display} value={program.uuid}>
|
|
193
|
+
{program.display}
|
|
194
|
+
</SelectItem>
|
|
195
|
+
))}
|
|
196
|
+
</Select>
|
|
197
|
+
</Layer>
|
|
198
|
+
) : (
|
|
199
|
+
<Select
|
|
200
|
+
id="program"
|
|
201
|
+
invalidText={t('required', 'Required')}
|
|
202
|
+
labelText=""
|
|
203
|
+
onChange={(event) => setSelectedProgram(event.target.value)}
|
|
204
|
+
>
|
|
205
|
+
{!selectedProgram ? <SelectItem text={t('chooseProgram', 'Choose a program')} value="" /> : null}
|
|
206
|
+
{eligiblePrograms?.length > 0 &&
|
|
207
|
+
eligiblePrograms.map((program) => (
|
|
208
|
+
<SelectItem key={program.uuid} text={program.display} value={program.uuid}>
|
|
209
|
+
{program.display}
|
|
210
|
+
</SelectItem>
|
|
211
|
+
))}
|
|
212
|
+
</Select>
|
|
213
|
+
)}
|
|
183
214
|
</div>
|
|
184
215
|
</FormGroup>
|
|
185
216
|
<FormGroup style={{ maxWidth: '50%' }} legendText={t('dateEnrolled', 'Date enrolled')}>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
217
|
+
{isTablet ? (
|
|
218
|
+
<Layer>
|
|
219
|
+
<DatePicker
|
|
220
|
+
id="enrollmentDate"
|
|
221
|
+
datePickerType="single"
|
|
222
|
+
dateFormat="d/m/Y"
|
|
223
|
+
maxDate={new Date().toISOString()}
|
|
224
|
+
placeholder="dd/mm/yyyy"
|
|
225
|
+
onChange={([date]) => setEnrollmentDate(date)}
|
|
226
|
+
value={enrollmentDate}
|
|
227
|
+
>
|
|
228
|
+
<DatePickerInput id="enrollmentDateInput" labelText="" />
|
|
229
|
+
</DatePicker>
|
|
230
|
+
</Layer>
|
|
231
|
+
) : (
|
|
232
|
+
<DatePicker
|
|
233
|
+
id="enrollmentDate"
|
|
234
|
+
datePickerType="single"
|
|
235
|
+
dateFormat="d/m/Y"
|
|
236
|
+
maxDate={new Date().toISOString()}
|
|
237
|
+
placeholder="dd/mm/yyyy"
|
|
238
|
+
onChange={([date]) => setEnrollmentDate(date)}
|
|
239
|
+
value={enrollmentDate}
|
|
240
|
+
>
|
|
241
|
+
<DatePickerInput id="enrollmentDateInput" labelText="" />
|
|
242
|
+
</DatePicker>
|
|
243
|
+
)}
|
|
198
244
|
</FormGroup>
|
|
199
245
|
<FormGroup style={{ width: '50%' }} legendText={t('dateCompleted', 'Date completed')}>
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
246
|
+
{isTablet ? (
|
|
247
|
+
<Layer>
|
|
248
|
+
<DatePicker
|
|
249
|
+
id="completionDate"
|
|
250
|
+
datePickerType="single"
|
|
251
|
+
dateFormat="d/m/Y"
|
|
252
|
+
minDate={new Date(enrollmentDate).toISOString()}
|
|
253
|
+
maxDate={new Date().toISOString()}
|
|
254
|
+
placeholder="dd/mm/yyyy"
|
|
255
|
+
onChange={([date]) => setCompletionDate(date)}
|
|
256
|
+
value={completionDate}
|
|
257
|
+
>
|
|
258
|
+
<DatePickerInput id="completionDateInput" labelText="" />
|
|
259
|
+
</DatePicker>
|
|
260
|
+
</Layer>
|
|
261
|
+
) : (
|
|
262
|
+
<DatePicker
|
|
263
|
+
id="completionDate"
|
|
264
|
+
datePickerType="single"
|
|
265
|
+
dateFormat="d/m/Y"
|
|
266
|
+
minDate={new Date(enrollmentDate).toISOString()}
|
|
267
|
+
maxDate={new Date().toISOString()}
|
|
268
|
+
placeholder="dd/mm/yyyy"
|
|
269
|
+
onChange={([date]) => setCompletionDate(date)}
|
|
270
|
+
value={completionDate}
|
|
271
|
+
>
|
|
272
|
+
<DatePickerInput id="completionDateInput" labelText="" />
|
|
273
|
+
</DatePicker>
|
|
274
|
+
)}
|
|
213
275
|
</FormGroup>
|
|
214
276
|
<FormGroup style={{ width: '50%' }} legendText={t('enrollmentLocation', 'Enrollment location')}>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
277
|
+
{isTablet ? (
|
|
278
|
+
<Layer>
|
|
279
|
+
<Select
|
|
280
|
+
id="location"
|
|
281
|
+
invalidText="Required"
|
|
282
|
+
labelText=""
|
|
283
|
+
onChange={(event) => setUserLocation(event.target.value)}
|
|
284
|
+
value={userLocation}
|
|
285
|
+
>
|
|
286
|
+
{!userLocation ? <SelectItem text={t('chooseLocation', 'Choose a location')} value="" /> : null}
|
|
287
|
+
{availableLocations?.length > 0 &&
|
|
288
|
+
availableLocations.map((location) => (
|
|
289
|
+
<SelectItem key={location.uuid} text={location.display} value={location.uuid}>
|
|
290
|
+
{location.display}
|
|
291
|
+
</SelectItem>
|
|
292
|
+
))}
|
|
293
|
+
</Select>
|
|
294
|
+
</Layer>
|
|
295
|
+
) : (
|
|
296
|
+
<Select
|
|
297
|
+
id="location"
|
|
298
|
+
invalidText="Required"
|
|
299
|
+
labelText=""
|
|
300
|
+
onChange={(event) => setUserLocation(event.target.value)}
|
|
301
|
+
value={userLocation}
|
|
302
|
+
>
|
|
303
|
+
{!userLocation ? <SelectItem text={t('chooseLocation', 'Choose a location')} value="" /> : null}
|
|
304
|
+
{availableLocations?.length > 0 &&
|
|
305
|
+
availableLocations.map((location) => (
|
|
306
|
+
<SelectItem key={location.uuid} text={location.display} value={location.uuid}>
|
|
307
|
+
{location.display}
|
|
308
|
+
</SelectItem>
|
|
309
|
+
))}
|
|
310
|
+
</Select>
|
|
311
|
+
)}
|
|
231
312
|
</FormGroup>
|
|
232
313
|
</Stack>
|
|
233
314
|
<ButtonSet className={isTablet ? styles.tablet : styles.desktop}>
|
package/translations/en.json
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"fullyEnrolled": "Enrolled in all programs",
|
|
22
22
|
"location": "Location",
|
|
23
23
|
"noEligibleEnrollments": "There are no more programs left to enroll this patient in",
|
|
24
|
+
"noProgramsConfigured": "No programs configured",
|
|
24
25
|
"programEnrollments": "Program enrollments",
|
|
25
26
|
"programEnrollmentSaveError": "Error saving program enrollment",
|
|
26
27
|
"programName": "Program name",
|