@openmrs/esm-patient-programs-app 3.2.1-pre.119 → 3.2.1-pre.124
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 +35 -36
- package/dist/145.js +1 -1
- package/dist/186.js +1 -1
- package/dist/252.js +1 -1
- package/dist/294.js +1 -1
- package/dist/336.js +2 -0
- package/dist/{337.js.LICENSE.txt → 336.js.LICENSE.txt} +0 -0
- package/dist/373.js +1 -1
- package/dist/45.js +1 -0
- package/dist/574.js +1 -1
- package/dist/692.js +1 -1
- package/dist/701.js +1 -1
- package/dist/76.js +1 -1
- package/dist/93.js +1 -1
- package/dist/932.js +1 -1
- package/dist/openmrs-esm-patient-programs-app.js +1 -1
- package/dist/openmrs-esm-patient-programs-app.js.buildmanifest.json +31 -76
- package/dist/openmrs-esm-patient-programs-app.old +1 -1
- package/package.json +3 -3
- package/src/programs/programs-detailed-summary.component.tsx +27 -0
- package/src/programs/programs-detailed-summary.test.tsx +13 -4
- package/src/programs/programs-form.component.tsx +80 -35
- package/src/programs/programs-form.test.tsx +119 -24
- package/src/programs/programs.resource.tsx +2 -2
- package/src/types/index.ts +6 -2
- package/translations/en.json +4 -1
- package/dist/13.js +0 -1
- package/dist/337.js +0 -2
- package/dist/622.js +0 -1
- package/dist/817.js +0 -2
- package/dist/817.js.LICENSE.txt +0 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
@openmrs/esm-patient-programs-app:build: cache hit, replaying output [
|
|
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
|
-
[
|
|
36
|
-
[32m@openmrs/esm-patient-programs-app:build: [0mwebpack 5.73.0 compiled with [1m[33m1 warning[39m[22m in 236187 ms
|
|
1
|
+
@openmrs/esm-patient-programs-app:build: cache hit, replaying output [2mff9ee631970614f2[0m
|
|
2
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m$ webpack --mode production
|
|
3
|
+
[34m@openmrs/esm-patient-programs-app:build: [0massets by chunk 1.34 MiB (id hint: vendors)
|
|
4
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m asset [1m[33m858.js[39m[22m [1m[33m474 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
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m252.js[39m[22m 243 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
6
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m635.js[39m[22m 228 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
7
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m186.js[39m[22m 124 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
8
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m294.js[39m[22m 114 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
9
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m402.js[39m[22m 85.5 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors)
|
|
10
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m336.js[39m[22m 56.7 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors) 1 related asset
|
|
11
|
+
[34m@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
|
|
12
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m asset [1m[32m701.js[39m[22m 4.92 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors)
|
|
13
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m+ 13 assets
|
|
14
|
+
[34m@openmrs/esm-patient-programs-app:build: [0morphan modules 9.18 MiB (javascript) 42 bytes (consume-shared) [1m[33m[orphan][39m[22m 834 modules
|
|
15
|
+
[34m@openmrs/esm-patient-programs-app:build: [0mruntime modules 19.5 KiB 15 modules
|
|
16
|
+
[34m@openmrs/esm-patient-programs-app:build: [0mbuilt modules 5.41 MiB (javascript) 336 bytes (share-init) 336 bytes (consume-shared) [1m[33m[built][39m[22m
|
|
17
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m../../node_modules/[39m[22m 5.28 MiB 149 modules
|
|
18
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m./[39m[22m 50.8 KiB 11 modules
|
|
19
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m provide-module modules 336 bytes
|
|
20
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m modules by path [1mprovide shared module (default) @openmrs/[39m[22m 84 bytes 2 modules
|
|
21
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m + 6 modules
|
|
22
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m consume-shared-module modules 336 bytes
|
|
23
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m modules by path [1mconsume shared module (default) @openmrs/[39m[22m 126 bytes 3 modules
|
|
24
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m + 5 modules
|
|
25
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m modules by path [1m../esm-patient-common-lib/src/[39m[22m 80.9 KiB
|
|
26
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m [1m../esm-patient-common-lib/src/index.ts + 31 modules[39m[22m 59.6 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
27
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m + 5 modules
|
|
28
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m [1mcontainer entry[39m[22m 42 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
29
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m
|
|
30
|
+
[34m@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).
|
|
31
|
+
[34m@openmrs/esm-patient-programs-app:build: [0mThis can impact web performance.
|
|
32
|
+
[34m@openmrs/esm-patient-programs-app:build: [0mAssets:
|
|
33
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m 858.js (474 KiB)[39m[22m
|
|
34
|
+
[34m@openmrs/esm-patient-programs-app:build: [0m
|
|
35
|
+
[34m@openmrs/esm-patient-programs-app:build: [0mwebpack 5.73.0 compiled with [1m[33m1 warning[39m[22m in 137009 ms
|
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),a=r.n(n),o=r(2609),i=r.n(o)()(a());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:()=>j});var n=r(9902),a=r.n(n),o=r(3565),i=r.n(o),l=r(3863),s=r(8827),m=r(819),d=r(9857),u=r(4924),c=r(3066),p=r(7898),g=r(786),f=r(2810),_=r(5067),h=r(6642),b=r(182),v=r(6549),y=r(7030),w=r(4076),E=r(321),k=r.n(E),C=r(1195),x=r.n(C),S=r(3275),Z=r.n(S),T=r(7162),P=r.n(T),q=r(2094),A=r.n(q),D=r(757),I=r.n(D),N=r(1951),z={};z.styleTagTransform=I(),z.setAttributes=P(),z.insert=Z().bind(null,"head"),z.domAPI=x(),z.insertStyleElement=A(),k()(N.Z,z);const L=N.Z&&N.Z.locals?N.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 B(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=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw a}}return o}}(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 j=function(e){var t,r,n=e.closeWorkspace,o=e.patientUuid,E=(0,u.useTranslation)().t,k="tablet"===(0,c.useLayoutType)(),C=(0,c.useSession)(),x=(0,c.useLocations)(),S=(0,d.kY)().mutate,Z=(0,w.oI)().data,T=(0,w.Bw)(o).data,P=(0,l.Z)(Z,(function(e){return!(0,s.Z)((0,m.Z)(T,"program.uuid"),e.uuid)})),q=B(a().useState(null),2),A=q[0],D=q[1],I=B(a().useState(new Date),2),N=I[0],z=I[1],X=B(a().useState(""),2),j=X[0],M=X[1],O=B(a().useState(""),2),K=O[0],W=O[1];!K&&(null==C||null===(t=C.sessionLocation)||void 0===t?void 0:t.uuid)&&W(null==C||null===(r=C.sessionLocation)||void 0===r?void 0:r.uuid);var F=a().useCallback((function(e){if(e.preventDefault(),j){var t={patient:o,program:j,dateEnrolled:N?i()(N).format():null,dateCompleted:A?i()(A).format():null,location:K},r=new AbortController,a=(0,w.df)(t,r).subscribe((function(e){201===e.status&&(n(),(0,c.showToast)({critical:!0,kind:"success",description:E("enrollmentNowVisible","It is now visible on the Programs page"),title:E("enrollmentSaved","Program enrollment saved")}),S("/ws/rest/v1/programenrollment?patient=".concat(o,"&v=").concat(w.o9)))}),(function(e){(0,c.createErrorHandler)(),(0,c.showNotification)({title:E("programEnrollmentSaveError","Error saving program enrollment"),kind:"error",critical:!0,description:null==e?void 0:e.message})}));return function(){a.unsubscribe()}}}),[n,A,N,S,o,j,E,K]);return a().createElement(p.Z,{className:L.form,onSubmit:F},a().createElement("div",{className:L.formContainer},a().createElement(g.Z,{style:{width:"50%"},legendText:E("program","Program")},a().createElement("div",{className:L.selectContainer},a().createElement(f.Z,{id:"program",invalidText:E("required","Required"),labelText:"",light:k,onChange:function(e){return M(e.target.value)}},j?null:a().createElement(_.Z,{text:E("chooseProgram","Choose a program"),value:""}),(null==P?void 0:P.length)>0&&P.map((function(e){return a().createElement(_.Z,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),a().createElement(g.Z,{legendText:E("dateEnrolled","Date enrolled")},a().createElement(h.Z,{id:"enrollmentDate",datePickerType:"single",dateFormat:"d/m/Y",light:k,maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=B(e,1)[0];return z(t)},value:N},a().createElement(b.Z,{id:"enrollmentDateInput",labelText:""}))),a().createElement(g.Z,{legendText:E("dateCompleted","Date completed")},a().createElement(h.Z,{id:"completionDate",datePickerType:"single",dateFormat:"d/m/Y",light:k,minDate:new Date(N).toISOString(),maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=B(e,1)[0];return D(t)},value:A},a().createElement(b.Z,{id:"completionDateInput",labelText:""}))),a().createElement(g.Z,{style:{width:"50%"},legendText:E("enrollmentLocation","Enrollment location")},a().createElement(f.Z,{id:"location",invalidText:"Required",labelText:"",light:k,onChange:function(e){return W(e.target.value)},value:K},K?null:a().createElement(_.Z,{text:E("chooseLocation","Choose a location"),value:""}),(null==x?void 0:x.length)>0&&x.map((function(e){return a().createElement(_.Z,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),a().createElement(v.Z,{className:k?L.tablet:L.desktop},a().createElement(y.Z,{className:L.button,kind:"secondary",onClick:function(){return n()}},E("cancel","Cancel")),a().createElement(y.Z,{className:L.button,kind:"primary",disabled:!j,type:"submit"},E("saveAndClose","Save and close"))))}},4076:(e,t,r)=>{r.d(t,{Bw:()=>l,df:()=>m,o9:()=>i,oI:()=>s});var n=r(9857),a=r(3066),o=r(4200),i="custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display))";function l(e){var t,r=(0,n.ZP)("/ws/rest/v1/programenrollment?patient=".concat(e,"&v=").concat(i),a.openmrsFetch),l=r.data,s=r.error,m=r.isValidating,d=(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;return{data:l?(0,o.Z)(d,(function(e){var t;return null==e||null===(t=e.program)||void 0===t?void 0:t.uuid})):null,isError:s,isLoading:!l&&!s,isValidating:m}}function s(){var e,t,r=(0,n.ZP)("/ws/rest/v1/program?v=custom:(uuid,display,allWorkflows,concept:(uuid,display))",a.openmrsFetch),o=r.data,i=r.error;return{data:(null==o||null===(e=o.data)||void 0===e||null===(t=e.results)||void 0===t?void 0:t.length)?o.data.results:null,isError:i,isLoading:!o&&!i}}function m(e,t){if(!e)return null;var r=e.program,n=e.patient,o=e.dateEnrolled,i=e.dateCompleted,l=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:i,location:l},signal:t.signal})}}}]);
|
|
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}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)}",""]),l.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 i=l},8145:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var n=r(9902),o=r.n(n),a=r(3565),l=r.n(a),i=r(3863),s=r(8827),m=r(819),d=r(9857),u=r(4924),c=r(3066),p=r(7898),g=r(786),f=r(2810),_=r(5067),h=r(6642),b=r(182),v=r(6549),y=r(7030),w=r(4076),E=r(321),C=r.n(E),k=r(1195),x=r.n(k),S=r(3275),Z=r.n(S),P=r(7162),T=r.n(P),D=r(2094),O=r.n(D),q=r(757),A=r.n(q),I=r(1951),N={};N.styleTagTransform=A(),N.setAttributes=T(),N.insert=Z().bind(null,"head"),N.domAPI=x(),N.insertStyleElement=O(),C()(I.Z,N);const j=I.Z&&I.Z.locals?I.Z.locals:void 0;function z(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 L(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=[],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 z(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)?z(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,k=e.programEnrollmentId,x=(0,u.useTranslation)().t,S="tablet"===(0,c.useLayoutType)(),Z=(0,c.useSession)(),P=(0,c.useLocations)(),T=(0,d.kY)().mutate,D=(0,w.oI)().data,O=(0,w.Bw)(C).data,q=k&&O.filter((function(e){return e.uuid==k}))[0],A=q?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){L(e,t,r[t])}))}return e}({display:q.program.name},q.program):null,I=A?[A]:(0,i.Z)(D,(function(e){return!(0,s.Z)((0,m.Z)(O,"program.uuid"),e.uuid)})),N=X(o().useState((null==q?void 0:q.dateCompleted)?(0,c.parseDate)(q.dateCompleted):null),2),z=N[0],B=N[1],M=X(o().useState((null==q?void 0:q.dateEnrolled)?(0,c.parseDate)(q.dateEnrolled):new Date),2),F=M[0],K=M[1],V=X(o().useState(null!==(r=null==q?void 0:q.program.uuid)&&void 0!==r?r:""),2),W=V[0],Y=V[1],R=X(o().useState(null!==(n=null==q?void 0:q.location.uuid)&&void 0!==n?n:""),2),U=R[0],H=R[1];!U&&(null==Z||null===(t=Z.sessionLocation)||void 0===t?void 0:t.uuid)&&H(null==Z||null===(a=Z.sessionLocation)||void 0===a?void 0:a.uuid);var G=o().useCallback((function(e){if(e.preventDefault(),W){var t={patient:C,program:W,dateEnrolled:F?l()(F).format():null,dateCompleted:z?l()(z).format():null,location:U},r=new AbortController,n=q?(0,w.YX)(q.uuid,t,r).subscribe((function(e){200===e.status&&(E(),(0,c.showToast)({critical:!0,kind:"success",description:x("enrollmentUpdatesNowVisible","Changes to the program are now visible in the Programs table"),title:x("enrollmentUpdated","Program enrollment updated")}),T("/ws/rest/v1/programenrollment?patient=".concat(C,"&v=").concat(w.o9)))}),(function(e){(0,c.createErrorHandler)(),(0,c.showNotification)({title:x("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,c.showToast)({critical:!0,kind:"success",description:x("enrollmentNowVisible","It is now visible in the Programs table"),title:x("enrollmentSaved","Program enrollment saved")}),T("/ws/rest/v1/programenrollment?patient=".concat(C,"&v=").concat(w.o9)))}),(function(e){(0,c.createErrorHandler)(),(0,c.showNotification)({title:x("programEnrollmentSaveError","Error saving program enrollment"),kind:"error",critical:!0,description:null==e?void 0:e.message})}));return function(){n.unsubscribe()}}}),[E,z,F,T,C,W,x,U]);return o().createElement(p.Z,{className:j.form,onSubmit:G},o().createElement("div",{className:j.formContainer},o().createElement(g.Z,{style:{width:"50%"},legendText:x("program","Program")},o().createElement("div",{className:j.selectContainer},o().createElement(f.Z,{id:"program",invalidText:x("required","Required"),labelText:"",light:S,onChange:function(e){return Y(e.target.value)}},W?null:o().createElement(_.Z,{text:x("chooseProgram","Choose a program"),value:""}),(null==I?void 0:I.length)>0&&I.map((function(e){return o().createElement(_.Z,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),o().createElement(g.Z,{legendText:x("dateEnrolled","Date enrolled")},o().createElement(h.Z,{id:"enrollmentDate",datePickerType:"single",dateFormat:"d/m/Y",light:S,maxDate:(new Date).toISOString(),placeholder:"dd/mm/yyyy",onChange:function(e){var t=X(e,1)[0];return K(t)},value:F},o().createElement(b.Z,{id:"enrollmentDateInput",labelText:""}))),o().createElement(g.Z,{legendText:x("dateCompleted","Date completed")},o().createElement(h.Z,{id:"completionDate",datePickerType:"single",dateFormat:"d/m/Y",light:S,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:z},o().createElement(b.Z,{id:"completionDateInput",labelText:""}))),o().createElement(g.Z,{style:{width:"50%"},legendText:x("enrollmentLocation","Enrollment location")},o().createElement(f.Z,{id:"location",invalidText:"Required",labelText:"",light:S,onChange:function(e){return H(e.target.value)},value:U},U?null:o().createElement(_.Z,{text:x("chooseLocation","Choose a location"),value:""}),(null==P?void 0:P.length)>0&&P.map((function(e){return o().createElement(_.Z,{key:e.uuid,text:e.display,value:e.uuid},e.display)}))))),o().createElement(v.Z,{className:S?j.tablet:j.desktop},o().createElement(y.Z,{className:j.button,kind:"secondary",onClick:function(){return E()}},x("cancel","Cancel")),o().createElement(y.Z,{className:j.button,kind:"primary",disabled:!W,type:"submit"},x("saveAndClose","Save and close"))))}},4076:(e,t,r)=>{r.d(t,{Bw:()=>i,YX:()=>d,df:()=>m,o9:()=>l,oI:()=>s});var n=r(9857),o=r(3066),a=r(4200),l="custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display))";function i(e){var t,r=(0,n.ZP)("/ws/rest/v1/programenrollment?patient=".concat(e,"&v=").concat(l),o.openmrsFetch),i=r.data,s=r.error,m=r.isValidating,d=(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;return{data:i?(0,a.Z)(d,(function(e){var t;return null==e||null===(t=e.program)||void 0===t?void 0:t.uuid})):null,isError:s,isLoading:!i&&!s,isValidating:m}}function s(){var e,t,r=(0,n.ZP)("/ws/rest/v1/program?v=custom:(uuid,display,allWorkflows,concept:(uuid,display))",o.openmrsFetch),a=r.data,l=r.error;return{data:(null==a||null===(e=a.data)||void 0===e||null===(t=e.results)||void 0===t?void 0:t.length)?a.data.results:null,isError:l,isLoading:!a&&!l}}function m(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 d(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})}}}]);
|