@openmrs/esm-fast-data-entry-app 1.0.1-pre.57 → 1.0.1-pre.59
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/dist/132.js +1 -1
- package/dist/168.js +1 -1
- package/dist/229.js +1 -1
- package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +8 -8
- package/package.json +1 -1
- package/src/context/GroupFormWorkflowContext.tsx +3 -2
- package/src/context/GroupFormWorkflowReducer.ts +9 -7
- package/src/group-form-entry-workflow/GroupSessionWorkspace.tsx +76 -64
package/dist/132.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[]).push([[132],{8132:(e,o,t)=>{"use strict";t.r(o),t.d(o,{backendDependencies:()=>i,importTranslation:()=>n,setupOpenMRS:()=>p,version:()=>s});var a=t(1132),r={formCategories:{_type:a.Type.Array,_description:"Organize forms into categories. A form can belong to multiple categories.",_elements:{name:{_type:a.Type.String,_description:"Category name"},forms:{_type:a.Type.Array,_description:"List of forms for this category.",_elements:{formUUID:{_type:a.Type.UUID,_description:"UUID of form"},name:{_type:a.Type.String,_description:"Name of form"}}}},_default:[{name:"ICRC Forms",forms:[{formUUID:"0cefb866-110c-4f16-af58-560932a1db1f",name:"Adult Triage"}]},{name:"Distress Scales",forms:[{formUUID:"9f26aad4-244a-46ca-be49-1196df1a8c9a",name:"POC Sample Form 1"}]}]},formCategoriesToShow:{_type:a.Type.Array,_description:"Forms to show by default on the forms app home page.",_elements:{_type:a.Type.String,_description:"Name of category"},_default:["ICRC Forms","Distress Scales"]},groupSessionConcepts:{sessionName:{_type:a.Type.UUID,_description:"UUID of concept for Session Name",_default:"e2559620-900b-4f66-ae41-0b9c4adfb654"},sessionDate:{_type:a.Type.UUID,_description:"UUID of concept for Session Date",_default:"ceaca505-6dff-4940-8a43-8c060a0924d7"},practitionerName:{_type:a.Type.UUID,_description:"UUID of concept for Practitioner Name",_default:"f1a2d58c-1a0e-4148-931a-aac224649fdc"},sessionNotes:{_type:a.Type.UUID,_description:"UUID of concept for Session Notes",_default:"fa8fedc0-c066-4da3-8dc1-2ad8621fc480"}}},s="1.0.1-pre.
|
|
1
|
+
(self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[]).push([[132],{8132:(e,o,t)=>{"use strict";t.r(o),t.d(o,{backendDependencies:()=>i,importTranslation:()=>n,setupOpenMRS:()=>p,version:()=>s});var a=t(1132),r={formCategories:{_type:a.Type.Array,_description:"Organize forms into categories. A form can belong to multiple categories.",_elements:{name:{_type:a.Type.String,_description:"Category name"},forms:{_type:a.Type.Array,_description:"List of forms for this category.",_elements:{formUUID:{_type:a.Type.UUID,_description:"UUID of form"},name:{_type:a.Type.String,_description:"Name of form"}}}},_default:[{name:"ICRC Forms",forms:[{formUUID:"0cefb866-110c-4f16-af58-560932a1db1f",name:"Adult Triage"}]},{name:"Distress Scales",forms:[{formUUID:"9f26aad4-244a-46ca-be49-1196df1a8c9a",name:"POC Sample Form 1"}]}]},formCategoriesToShow:{_type:a.Type.Array,_description:"Forms to show by default on the forms app home page.",_elements:{_type:a.Type.String,_description:"Name of category"},_default:["ICRC Forms","Distress Scales"]},groupSessionConcepts:{sessionName:{_type:a.Type.UUID,_description:"UUID of concept for Session Name",_default:"e2559620-900b-4f66-ae41-0b9c4adfb654"},sessionDate:{_type:a.Type.UUID,_description:"UUID of concept for Session Date",_default:"ceaca505-6dff-4940-8a43-8c060a0924d7"},practitionerName:{_type:a.Type.UUID,_description:"UUID of concept for Practitioner Name",_default:"f1a2d58c-1a0e-4148-931a-aac224649fdc"},sessionNotes:{_type:a.Type.UUID,_description:"UUID of concept for Session Notes",_default:"fa8fedc0-c066-4da3-8dc1-2ad8621fc480"}}},s="1.0.1-pre.59",n=t(3979),i={fhir2:"^1.2.0","webservices.rest":"^2.2.0"};function p(){var e="@openmrs/esm-fast-data-entry-app",o={featureName:"fast-data-entry-app",moduleName:e};return(0,a.defineConfigSchema)(e,r),(0,a.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/forms"),title:"Forms",parent:"".concat(window.spaBase,"/home")}]),{pages:[{load:(0,a.getAsyncLifecycle)((function(){return Promise.all([t.e(672),t.e(804)]).then(t.bind(t,9804))}),o),route:"forms"}],extensions:[{name:"forms-app-link",slot:"app-menu-slot",load:(0,a.getAsyncLifecycle)((function(){return Promise.all([t.e(672),t.e(397),t.e(776)]).then(t.bind(t,5776))}),o),online:!0,offline:!0}]}}},3979:(e,o,t)=>{var a={"./en.json":[3574,574],"./fr.json":[2757,757]};function r(e){if(!t.o(a,e))return Promise.resolve().then((()=>{var o=new Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}));var o=a[e],r=o[0];return t.e(o[1]).then((()=>t(r)))}r.keys=()=>Object.keys(a),r.id=3979,e.exports=r}}]);
|
package/dist/168.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[]).push([[168],{5168:(e,t,r)=>{r.r(t),r.d(t,{default:()=>ut});var n=r(1132),a=r(1672),o=r.n(a),s=r(4422),i=r(2327),l=r(3133),c=r(3379),u=r.n(c),d=r(7795),m=r.n(d),_=r(569),p=r.n(_),f=r(3565),y=r.n(f),h=r(9216),g=r.n(h),v=r(4589),b=r.n(v),E=r(8914),w={};w.styleTagTransform=b(),w.setAttributes=y(),w.insert=p().bind(null,"head"),w.domAPI=m(),w.insertStyleElement=g(),u()(E.Z,w);const S=E.Z&&E.Z.locals?E.Z.locals:void 0;var O=r(3397),N=r(2504),x=r(1338),T=r(7612);function P(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 A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C(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){A(e,t,r[t])}))}return e}var k={setGroup:function(e){},unsetGroup:function(){},setSessionMeta:function(e){},openPatientSearch:function(){},saveEncounter:function(e){},editEncounter:function(e){},validateForNext:function(){},validateForComplete:function(){},updateVisitUuid:function(e){},submitForNext:function(){},submitForReview:function(){},submitForComplete:function(){},addPatientUuid:function(e){},removePatientUuid:function(e){},goToReview:function(){},destroySession:function(){},closeSession:function(){}},I={activeFormUuid:null,forms:{},workflowState:null,activePatientUuid:null,activeEncounterUuid:null,activeVisitUuid:null,patientUuids:[],encounters:{},visits:{},activeGroupUuid:null,activeGroupName:null,activeGroupMembers:[],activeSessionMeta:{sessionName:null,practitionerName:null,sessionDate:null,sessionNotes:null},groupVisitTypeUuid:null},j=o().createContext(C({},I,k)),U=function(e){var t,r,n,s,i,l,c,u,d,m,_,p,f,y,h,g,v,b,E,w,S,O,A,U,R,G,M,D,F,z,Z,L,B,V,W,q,K,Q,X=e.children,H=(0,x.useParams)().formUuid.split("&")[0],$=(0,T.Z)("@openmrs/esm-fast-data-entry-app.groupSessionVisitTypeUuid"),J=null==$||null===(t=$.result)||void 0===t||null===(r=t.data)||void 0===r||null===(n=r.results)||void 0===n||null===(s=n[0])||void 0===s?void 0:s.value,Y=(W=(0,a.useReducer)(N.ZP,C({},I,k)),q=2,function(e){if(Array.isArray(e))return e}(W)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(W,q)||function(e,t){if(e){if("string"==typeof e)return P(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)?P(e,t):void 0}}(W,q)||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.")}()),ee=Y[0],te=Y[1],re=(0,a.useMemo)((function(){return{initializeWorkflowState:function(e){var t=e.activeFormUuid;return te({type:"INITIALIZE_WORKFLOW_STATE",activeFormUuid:t})},setGroup:function(e){return te({type:"SET_GROUP",group:e})},unsetGroup:function(){return te({type:"UNSET_GROUP"})},setSessionMeta:function(e){return te({type:"SET_SESSION_META",meta:e})},addPatientUuid:function(e){return te({type:"ADD_PATIENT_UUID",patientUuid:e})},removePatientUuid:function(e){return te({type:"REMOVE_PATIENT_UUID",patientUuid:e})},openPatientSearch:function(){return te({type:"OPEN_PATIENT_SEARCH"})},saveEncounter:function(e){return te({type:"SAVE_ENCOUNTER",encounterUuid:e})},validateForNext:function(){return te({type:"VALIDATE_FOR_NEXT"})},validateForComplete:function(){return te({type:"VALIDATE_FOR_COMPLETE"})},updateVisitUuid:function(e){return te({type:"UPDATE_VISIT_UUID",visitUuid:e})},submitForNext:function(){return te({type:"SUBMIT_FOR_NEXT"})},submitForComplete:function(){return te({type:"SUBMIT_FOR_COMPLETE"})},editEncounter:function(e){return te({type:"EDIT_ENCOUNTER",patientUuid:e})},goToReview:function(){return te({type:"GO_TO_REVIEW"})},destroySession:function(){return te({type:"DESTROY_SESSION"})},closeSession:function(){return te({type:"CLOSE_SESSION"})}}}),[]);return(0,a.useEffect)((function(){null===(null==ee?void 0:ee.workflowState)&&H&&re.initializeWorkflowState({activeFormUuid:H})}),[H,null==ee?void 0:ee.workflowState,re]),o().createElement(j.Provider,{value:(K=C({groupVisitTypeUuid:J},ee,re),Q={workflowState:null!==(R=null===(i=ee.forms)||void 0===i||null===(l=i[ee.activeFormUuid])||void 0===l?void 0:l.workflowState)&&void 0!==R?R:I.workflowState,activePatientUuid:null!==(G=null===(c=ee.forms)||void 0===c||null===(u=c[ee.activeFormUuid])||void 0===u?void 0:u.activePatientUuid)&&void 0!==G?G:I.activePatientUuid,activeEncounterUuid:null!==(M=null===(d=ee.forms)||void 0===d||null===(m=d[ee.activeFormUuid])||void 0===m?void 0:m.activeEncounterUuid)&&void 0!==M?M:I.activeEncounterUuid,activeVisitUuid:null!==(D=null===(_=ee.forms)||void 0===_||null===(p=_[ee.activeFormUuid])||void 0===p?void 0:p.activeVisitUuid)&&void 0!==D?D:I.activeVisitUuid,patientUuids:null!==(F=null===(f=ee.forms)||void 0===f||null===(y=f[ee.activeFormUuid])||void 0===y?void 0:y.patientUuids)&&void 0!==F?F:I.patientUuids,encounters:null!==(z=null===(h=ee.forms)||void 0===h||null===(g=h[ee.activeFormUuid])||void 0===g?void 0:g.encounters)&&void 0!==z?z:I.encounters,activeGroupUuid:null!==(Z=null===(v=ee.forms)||void 0===v||null===(b=v[ee.activeFormUuid])||void 0===b?void 0:b.groupUuid)&&void 0!==Z?Z:I.activeGroupUuid,activeGroupName:null!==(L=null===(E=ee.forms)||void 0===E||null===(w=E[ee.activeFormUuid])||void 0===w?void 0:w.groupName)&&void 0!==L?L:I.activeGroupName,activeGroupMembers:null!==(B=null===(S=ee.forms)||void 0===S||null===(O=S[ee.activeFormUuid])||void 0===O?void 0:O.groupMembers)&&void 0!==B?B:I.activeGroupMembers,activeSessionMeta:null!==(V=null===(A=ee.forms)||void 0===A||null===(U=A[ee.activeFormUuid])||void 0===U?void 0:U.sessionMeta)&&void 0!==V?V:I.activeSessionMeta},Q=null!=Q?Q:{},Object.getOwnPropertyDescriptors?Object.defineProperties(K,Object.getOwnPropertyDescriptors(Q)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(Q)).forEach((function(e){Object.defineProperty(K,e,Object.getOwnPropertyDescriptor(Q,e))})),K)},X)};const R=j,G=function(){var e=(0,a.useContext)(R),t=e.activeGroupName,r=e.activeGroupUuid,n=e.patientUuids,c=e.activeSessionMeta,u=e.unsetGroup,d=e.destroySession,m=(0,O.useTranslation)().t;return r?o().createElement("div",{className:S.container},o().createElement("div",{className:S.groupAvatar,role:"img"},o().createElement(i.zW,{size:48})),o().createElement("div",{className:S.groupInfoContent},o().createElement("div",{className:S.groupInfoRow},o().createElement("span",{className:S.groupName},t)),o().createElement("div",{className:S.groupInfoRow},o().createElement("span",null,n.length," ",m("members","members")))),(null==c?void 0:c.sessionNotes)&&o().createElement("div",{className:S.groupMeataContent},o().createElement("div",{className:"".concat(S.groupInfoRow," ").concat(S.sessionNotesLabel)},m("sessionNotes","Session Notes")),o().createElement("div",{className:S.groupInfoRow},c.sessionNotes)),o().createElement("span",{style:{flexGrow:1}}),o().createElement("span",null,o().createElement(s.Button,{kind:"ghost",onClick:function(){return u()}},m("changeGroup","Choose a different group")," ",o().createElement(l.x8,{size:20}))),o().createElement("span",null,o().createElement(s.Button,{kind:"ghost",onClick:function(){return d()}},m("cancel","Cancel")," ",o().createElement(l.x8,{size:20})))):null};var M=r(7159),D={};D.styleTagTransform=b(),D.setAttributes=y(),D.insert=p().bind(null,"head"),D.domAPI=m(),D.insertStyleElement=g(),u()(M.Z,D);const F=M.Z&&M.Z.locals?M.Z.locals:void 0;var z=r(5443),Z={};Z.styleTagTransform=b(),Z.setAttributes=y(),Z.insert=p().bind(null,"head"),Z.domAPI=m(),Z.insertStyleElement=g(),u()(z.Z,Z);const L=z.Z&&z.Z.locals?z.Z.locals:void 0;var B=r(68),V={};V.styleTagTransform=b(),V.setAttributes=y(),V.insert=p().bind(null,"head"),V.domAPI=m(),V.insertStyleElement=g(),u()(B.Z,V);const W=B.Z&&B.Z.locals?B.Z.locals:void 0;var q=r(9370),K={};K.styleTagTransform=b(),K.setAttributes=y(),K.insert=p().bind(null,"head"),K.domAPI=m(),K.insertStyleElement=g(),u()(q.Z,K);const Q=q.Z&&q.Z.locals?q.Z.locals:void 0;var X=r(2619),H=r(9423),$={};$.styleTagTransform=b(),$.setAttributes=y(),$.insert=p().bind(null,"head"),$.domAPI=m(),$.insertStyleElement=g(),u()(H.Z,$);const J=H.Z&&H.Z.locals?H.Z.locals:void 0;function Y(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}const ee=function(e){var t,r,n=(t=(0,a.useState)(!1),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(t,r)||function(e,t){if(e){if("string"==typeof e)return Y(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)?Y(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],s=n[1];return(0,a.useEffect)((function(){var t=function(t){t.key===e&&s(!0)},r=function(t){t.key===e&&s(!1)};return window.addEventListener("keydown",t),window.addEventListener("keyup",r),function(){window.removeEventListener("keydown",t),window.removeEventListener("keyup",r)}}),[e]),o};function te(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 re(){return re=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},re.apply(this,arguments)}var ne=function(e,t){switch(t.type){case"arrowUp":return{selectedIndex:Math.max(e.selectedIndex-1,0)};case"arrowDown":return{selectedIndex:Math.min(e.selectedIndex+1,t.listLength-1)};case"select":return{selectedIndex:t.payload};default:return e}},ae={behavior:"smooth",block:"nearest"},oe=function(e){var t,r,n=e.index,s=e.selectGroupAction,l=e.group,c=e.dispatch,u=e.state,d=e.totalGroups,m=e.lastRef,_=(0,a.useRef)(null),p=(0,O.useTranslation)().t;return(0,a.useEffect)((function(){u.selectedIndex===d-1?m.current.scrollIntoView(ae):u.selectedIndex===n&&_.current.scrollIntoView(ae)}),[u,n,d,m]),o().createElement("div",{onClick:function(){c({type:"select",payload:n}),s(l)},className:"".concat(J.patientSearchResult," ").concat(n===u.selectedIndex&&J.patientSearchResultSelected),role:"button","aria-pressed":n===u.selectedIndex,tabIndex:0,ref:_},o().createElement("div",{className:J.patientAvatar,role:"img"},o().createElement(i.zW,{size:24})),o().createElement("div",null,o().createElement("h2",{className:J.patientName},l.name),o().createElement("p",{className:J.demographics},null!==(r=null===(t=l.cohortMembers)||void 0===t?void 0:t.length)&&void 0!==r?r:0," ",p("members","members"),o().createElement("span",{className:J.middot},"·")," ",l.description)))},se=function(){return o().createElement("div",{className:J.patientSearchResult},o().createElement("div",{className:J.patientAvatar,role:"img"},o().createElement(s.SkeletonIcon,{style:{height:"3rem",width:"3rem"}})),o().createElement("div",null,o().createElement("h2",{className:J.patientName},o().createElement(s.SkeletonText,null)),o().createElement("span",{className:J.demographics},o().createElement(s.SkeletonIcon,null)," ",o().createElement("span",{className:J.middot},"·")," ",o().createElement(s.SkeletonIcon,null)," ",o().createElement("span",{className:J.middot},"·")," ",o().createElement(s.SkeletonIcon,null))))};const ie=function(e){var t,r,n=e.groups,s=e.selectGroupAction,i=e.lastRef,l=ee("ArrowUp"),c=ee("ArrowDown"),u=ee("Enter"),d=(t=(0,a.useReducer)(ne,{selectedIndex:0}),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(t,r)||function(e,t){if(e){if("string"==typeof e)return te(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)?te(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=d[0],_=d[1];return(0,a.useEffect)((function(){l&&_({type:"arrowUp"})}),[l]),(0,a.useEffect)((function(){c&&_({type:"arrowDown",listLength:n.length})}),[c,n.length]),(0,a.useEffect)((function(){u&&n.length&&s(n[m.selectedIndex])}),[u,s,n,m.selectedIndex]),o().createElement(o().Fragment,null,n.map((function(e,t){return o().createElement(oe,re({key:t,totalGroups:n.length},{lastRef:i,index:t,selectGroupAction:s,group:e,dispatch:_,state:m}))})))};var le=r(958);function ce(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 ue(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function de(){return de=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},de.apply(this,arguments)}function me(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){ue(e,t,r[t])}))}return e}function _e(e,t){if(e){if("string"==typeof e)return ce(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)?ce(e,t):void 0}}var pe=function(e){var t,r,o,s,i,l,c,u,d,m,_,p,f,y,h,g,v;return t=me({baseUrl:"/ws/rest/v1/cohortm/cohort",resultsToFetch:10},de({},e)),o=t.baseUrl,s=t.searchTerm,i=t.parameters,c=void 0===(l=t.searching)||l,u=t.resultsToFetch,d=void 0===u?10:u,m=(0,a.useCallback)((function(e,t){var r;if(t&&!(null==t||null===(r=t.data)||void 0===r?void 0:r.links.some((function(e){return"next"===e.rel}))))return null;var n="".concat(o,"?q=").concat(s),a=me({totalCount:!0,limit:d},i);return Object.entries(a).forEach((function(e){var t,r,a=(r=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(t,r)||_e(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],s=a[1];null!=s&&(n+="&".concat(o,"=").concat(s))})),e&&(n+="&startIndex=".concat(e*d)),n}),[o,s,i,d]),_=(0,le.ZP)(c?m:null,n.openmrsFetch),p=_.data,f=_.isValidating,y=_.setSize,h=_.error,g=_.size,v=(0,a.useMemo)((function(){var e,t,n,a,o,s;return{data:p?(e=[]).concat.apply(e,(s=null!==(r=null==p?void 0:p.map((function(e){var t;return null==e||null===(t=e.data)||void 0===t?void 0:t.results})))&&void 0!==r?r:[],function(e){if(Array.isArray(e))return ce(e)}(s)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(s)||_e(s)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())):null,isLoading:!p&&!h,error:h,hasMore:!!(null==p?void 0:p.length)&&!!(null===(t=p[p.length-1].data)||void 0===t||null===(n=t.links)||void 0===n?void 0:n.some((function(e){return"next"===e.rel}))),loadingNewData:f,setPage:y,currentPage:g,totalResults:null==p||null===(a=p[0])||void 0===a||null===(o=a.data)||void 0===o?void 0:o.totalCount}}),[p,f,h,y,g]),v};const fe=function(e){var t=e.query,r=void 0===t?"":t,n=e.selectGroupAction,i=(0,O.useTranslation)().t,l=pe({searchTerm:r,searching:!!r,parameters:{v:"full"}}),c=l.isLoading,u=l.data,d=l.error,m=l.loadingNewData,_=l.setPage,p=l.hasMore,f=l.totalResults,y=(0,a.useRef)(null),h=(0,a.useRef)(null),g=(0,a.useCallback)((function(e){m||(h.current&&h.current.disconnect(),h.current=new IntersectionObserver((function(e){e[0].isIntersecting&&p&&_((function(e){return e+1}))}),{threshold:.75}),e&&h.current.observe(e))}),[m,p,_]);return d?o().createElement("div",{className:Q.searchResults},o().createElement(s.Layer,null,o().createElement(s.Tile,{className:Q.emptySearchResultsTile},o().createElement(X.N,null),o().createElement("div",null,o().createElement("p",{className:Q.errorMessage},i("error","Error")),o().createElement("p",{className:Q.errorCopy},i("errorCopy","Sorry, there was an error. You can try to reload this page, or contact the site administrator and quote the error code above.")))))):c?o().createElement("div",{className:Q.searchResultsContainer},o().createElement(se,null),o().createElement(se,null),o().createElement(se,null),o().createElement(se,null),o().createElement(se,null)):0===(null==u?void 0:u.length)?o().createElement("div",{className:Q.searchResults},o().createElement(s.Layer,null,o().createElement(s.Tile,{className:Q.emptySearchResultsTile},o().createElement(X.N,null),o().createElement("p",{className:Q.emptyResultText},i("noGroupsFoundMessage","Sorry, no groups have been found")),o().createElement("p",{className:Q.actionText},o().createElement("span",null,i("trySearchWithPatientUniqueID","Try searching with the cohort's description")),o().createElement("br",null),o().createElement("span",null,i("orLabelName","OR label name")))))):o().createElement("div",{className:Q.searchResultsContainer},o().createElement("div",{className:Q.searchResults,style:{maxHeight:"22rem"}},o().createElement("p",{className:Q.resultsText},f," ",i("searchResultsText","search result(s)")),o().createElement(ie,{groups:u,selectGroupAction:n,lastRef:y}),o().createElement("div",{ref:y},o().createElement("div",{className:Q.lastItem,ref:g},p&&o().createElement(s.Loading,{withOverlay:!1,small:!0}),!p&&o().createElement("p",null,i("noMoreResults","End of search results"))))))};var ye=r(7518);function he(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 ge(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=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return he(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)?he(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 ve=function(e){var t=e.selectGroupAction,r=(0,O.useTranslation)().t,n=ge((0,a.useState)(""),2),i=n[0],l=n[1],c=ge((0,a.useState)(!1),2),u=c[0],d=c[1];return o().createElement("div",{className:W.patientSearchBar},o().createElement("div",{className:W.searchArea},o().createElement(s.Search,{autoFocus:!0,className:W.patientSearchInput,closeButtonLabelText:r("clearSearch","Clear"),labelText:"",onChange:function(e){var t;t=e.target.value,(0,ye.Z)((function(e){d(!!t.length),l(e)}),300),l(t),t.length?d(!0):d(!1)},onClear:function(){},placeholder:r("searchForGroup","Search for a group by name"),size:"sm",value:i}),o().createElement(s.Button,{kind:"secondary",size:"sm"},r("search","Search"))),u&&o().createElement("div",{className:W.floatingSearchResultsContainer},o().createElement(fe,{query:i,selectGroupAction:function(e){t(e),d(!1),l("")}})))};var be=r(8808),Ee=r(8115),we=r(8034),Se={};Se.styleTagTransform=b(),Se.setAttributes=y(),Se.insert=p().bind(null,"head"),Se.domAPI=m(),Se.insertStyleElement=g(),u()(we.Z,Se);const Oe=we.Z&&we.Z.locals?we.Z.locals:void 0;var Ne=r(282);function xe(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 Te(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pe(){return Pe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Pe.apply(this,arguments)}function Ae(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){Te(e,t,r[t])}))}return e}function Ce(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function ke(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=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||Ie(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.")}()}function Ie(e,t){if(e){if("string"==typeof e)return xe(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)?xe(e,t):void 0}}var je=o().memo(n.ExtensionSlot),Ue=function(e){var t=e.patient,r=e.removePatient,n=(0,O.useTranslation)().t;return o().createElement("li",{key:t.uuid,className:Oe.patientRow},o().createElement("span",null,o().createElement(s.Button,{kind:"tertiary",size:"sm",hasIconOnly:!0,onClick:function(){return r(t.uuid)},renderIcon:be.ZN,tooltipAlignment:"start",tooltipPosition:"top",iconDescription:n("remove","Remove")})),o().createElement("span",{className:Oe.patientName},null==t?void 0:t.display))},Re=function(e){var t=e.name,r=e.setName,n=e.patientList,a=e.updatePatientList,i=e.errors,l=e.validate,c=e.removePatient,u=(0,O.useTranslation)().t;return o().createElement("div",{style:{display:"flex",flexDirection:"column",rowGap:"1rem"}},o().createElement(s.TextInput,{labelText:u("newGroupName","New Group Name"),value:t,onChange:function(e){return r(e.target.value)},onBlur:function(){return l("name")}}),(null==i?void 0:i.name)&&o().createElement("p",{className:Oe.formError},"required"===i.name?u("groupNameError","Please enter a group name."):i.name),o().createElement(s.FormLabel,null,n.length," ",u("patientsInGroup","Patients in group")),(null==i?void 0:i.patientList)&&o().createElement("p",{className:Oe.formError},u("noPatientError","Please enter at least one patient.")),!(null==i?void 0:i.patientList)&&o().createElement("ul",{className:Oe.patientList},null==n?void 0:n.map((function(e,t){return o().createElement(Ue,{patient:e,removePatient:c,key:t})}))),o().createElement(s.FormLabel,null,"Search for patients to add to group"),o().createElement("div",{className:Oe.searchBar},o().createElement(je,{extensionSlotName:"patient-search-bar-slot",state:{selectPatientAction:a,buttonProps:{kind:"secondary"}}})))};const Ge=function(){var e=(0,a.useContext)(R).setGroup,t=(0,O.useTranslation)().t,r=ke((0,a.useState)(!1),2),i=r[0],l=r[1],c=ke((0,a.useState)({}),2),u=c[0],d=c[1],m=ke((0,a.useState)(""),2),_=m[0],p=m[1],f=ke((0,a.useState)([]),2),y=f[0],h=f[1],g=(0,Ne.zg)(),v=g.post,b=g.result,E=g.isPosting,w=g.error,S=(0,a.useCallback)((function(e){return h((function(t){return t.filter((function(t){return t.uuid!==e}))}))}),[h]),N=(0,a.useCallback)((function(e){var t=!0;return e?(t="name"===e?!!_:!!y.length,d((function(r){return Ce(Ae({},r),Te({},e,t?null:"required"))}))):(_?d((function(e){return Ce(Ae({},e),{name:null})})):(d((function(e){return Ce(Ae({},e),{name:"required"})})),t=!1),y.length?d((function(e){return Ce(Ae({},e),{patientList:null})})):(d((function(e){return Ce(Ae({},e),{patientList:"required"})})),t=!1)),t}),[_,y.length]),x=(0,a.useCallback)((function(e){h((function(t){return t.find((function(t){return t.uuid===e.uuid}))?t:(r=t,function(e){if(Array.isArray(e))return xe(e)}(r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||Ie(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([e]);var r})),d((function(e){return Ce(Ae({},e),{patientList:null})}))}),[h]);return(0,a.useEffect)((function(){b&&e(Ce(Ae({},b),{cohortMembers:y.map((function(e){return{patient:{uuid:e.uuid}}}))}))}),[b,e,y]),(0,a.useEffect)((function(){var e;w&&((0,n.showToast)({kind:"error",title:t("postError","POST Error"),description:null!==(e=w.message)&&void 0!==e?e:t("unknownPostError","An unknown error occured while saving data")}),w.fieldErrors&&d(Object.fromEntries(Object.entries(w.fieldErrors).map((function(e){var t,r=ke(e,2),n=r[0],a=r[1];return[n,null==a||null===(t=a[0])||void 0===t?void 0:t.message]})))))}),[w,t]),o().createElement("div",{className:Oe.modal},o().createElement(s.Button,{onClick:function(){return l(!0)},renderIcon:Ee.mm,iconDescription:"Add"},t("createNewGroup","Create New Group")),o().createElement(s.ComposedModal,{open:i,onClose:function(){return l(!1)}},o().createElement(s.ModalHeader,null,t("createNewGroup","Create New Group")),o().createElement(s.ModalBody,null,b?o().createElement("p",null,"Group saved succesfully"):E?o().createElement("div",{className:Oe.loading},o().createElement(s.Loading,{withOverlay:!1}),o().createElement("span",null,"Saving new group...")):o().createElement(Re,Pe({},{name:_,setName:p,patientList:y,updatePatientList:x,errors:u,validate:N,removePatient:S}))),o().createElement(s.ModalFooter,null,o().createElement(s.Button,{kind:"secondary",onClick:function(){l(!1)},disabled:E},t("cancel","Cancel")),o().createElement(s.Button,{kind:"primary",onClick:function(){N()&&v({name:_,cohortMembers:y.map((function(e){return{patient:e.uuid}}))})},disabled:E},t("createGroup","Create Group")))))},Me=function(){var e=(0,O.useTranslation)().t,t=(0,a.useContext)(R),r=t.activeGroupUuid,n=t.setGroup,i=t.destroySession;return r?null:o().createElement("div",{className:L.searchHeaderContainer},o().createElement("span",{className:L.padded},e("findGroup","Find group"),":"),o().createElement("span",{className:L.searchBarWrapper},o().createElement(ve,{selectGroupAction:function(e){n(e)}})),o().createElement("span",{className:L.padded},e("or","or")),o().createElement("span",null,o().createElement(Ge,null)),o().createElement("span",{style:{flexGrow:1}}),o().createElement("span",null,o().createElement(s.Button,{kind:"ghost",onClick:function(){i()}},e("cancel","Cancel")," ",o().createElement(l.x8,{size:20}))))};var De=r(7536),Fe=r(4211);function ze(){return ze=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ze.apply(this,arguments)}var Ze=function(e){var t,r,n,i,l,c,u,d=e.patientUuid,m=(0,Ne.Eu)(d),_=(0,a.useContext)(R),p=_.patientUuids,f=_.addPatientUuid,y=_.removePatientUuid,h=null==m||null===(t=m.name)||void 0===t||null===(r=t[0])||void 0===r||null===(n=r.given)||void 0===n?void 0:n[0],g=null==m||null===(i=m.name)||void 0===i||null===(l=i[0])||void 0===l?void 0:l.family,v=null==m||null===(c=m.identifier)||void 0===c||null===(u=c[0])||void 0===u?void 0:u.value;return m?o().createElement(s.TableRow,null,o().createElement(s.TableCell,null,m.display||m.displayName||[h,g].join(" ")),o().createElement(s.TableCell,null,v),o().createElement(s.TableCell,null,o().createElement(s.Checkbox,{checked:p.includes(d),labelText:d,hideLabel:!0,id:"".concat(v,"-attendance-checkbox"),onChange:function(e,t){t.checked?f(d):y(d)}}))):o().createElement(s.TableRow,null,o().createElement(s.TableCell,null,o().createElement(s.SkeletonText,null)),o().createElement(s.TableCell,null,o().createElement(s.SkeletonText,null)),o().createElement(s.TableCell,null,o().createElement(s.Checkbox,{diabled:!0})))};const Le=function(){var e=(0,O.useTranslation)().t,t=(0,a.useContext)(R),r=t.activeGroupUuid,n=t.activeGroupMembers,i=[e("name","Name"),e("identifier","Patient ID"),e("patientIsPresent","Patient is present")];return r?o().createElement(s.Table,null,o().createElement(s.TableHead,null,o().createElement(s.TableRow,null,i.map((function(e,t){return o().createElement(s.TableHeader,{key:t},e)})))),o().createElement(s.TableBody,null,n.map((function(e,t){return o().createElement(Ze,ze({},{patientUuid:e},{key:t}))})))):o().createElement("div",null,e("selectGroupFirst","Please select a group first"))};function Be(){return Be=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Be.apply(this,arguments)}const Ve=function(){var e=(0,O.useTranslation)().t,t=(0,De.Gc)(),r=t.register,n=t.formState.errors,a=t.control;return o().createElement("div",{className:F.formSection},o().createElement("h4",null,e("sessionDetails","1. Session details")),o().createElement("div",null,o().createElement("p",null,e("allFieldsRequired","All fields are required unless marked optional"))),o().createElement(s.Layer,null,o().createElement(s.Tile,{className:F.formSectionTile},o().createElement(s.Layer,null,o().createElement("div",{style:{display:"flex",flexDirection:"column",rowGap:"1.5rem"}},o().createElement(s.TextInput,Be({id:"text",type:"text",labelText:e("sessionName","Session Name")},r("sessionName",{required:!0}),{invalid:n.sessionName,invalidText:"This field is required"})),o().createElement(s.TextInput,Be({id:"text",type:"text",labelText:e("practitionerName","Practitioner Name")},r("practitionerName",{required:!0}),{invalid:n.practitionerName,invalidText:"This field is required"})),o().createElement(De.Qr,{name:"sessionDate",control:a,rules:{required:!0},render:function(t){var r=t.field;return o().createElement(s.DatePicker,Be({datePickerType:"single",size:"md",maxDate:new Date},r),o().createElement(s.DatePickerInput,{id:"session-date",labelText:e("sessionDate","Session Date"),placeholder:"mm/dd/yyyy",size:"md",invalid:n.sessionDate,invalidText:"This field is required"}))}}),o().createElement(s.TextArea,Be({id:"text",type:"text",labelText:e("sessionNotes","Session Notes")},r("sessionNotes",{required:!0}),{invalid:n.sessionNotes,invalidText:"This field is required"})))))),o().createElement("h4",null,e("sessionParticipants","2. Session participants")),o().createElement("div",null,o().createElement("p",null,e("markAbsentPatients","The patients in this group. Patients that are not present in the session should be marked as absent."))),o().createElement(s.Layer,null,o().createElement(s.Tile,{className:F.formSectionTile},o().createElement(s.Layer,null,o().createElement("div",{style:{display:"flex",flexDirection:"column",rowGap:"1.5rem"}},o().createElement(Le,null))))))};function We(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 qe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ke(){return Ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ke.apply(this,arguments)}var Qe=function(){var e,t,r=(0,O.useTranslation)().t,n=(0,a.useContext)(R),i=n.workflowState,l=n.patientUuids,c=(e=(0,a.useState)(!1),t=2,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=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return We(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)?We(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.")}()),u=c[0],d=c[1];return"NEW_GROUP_SESSION"!==i?null:o().createElement(o().Fragment,null,o().createElement("div",{className:F.rightPanelActionButtons},o().createElement(s.Button,{kind:"secondary",type:"submit",disabled:!l.length},r("createNewSession","Create New Session")),o().createElement(s.Button,{kind:"tertiary",onClick:function(){d(!0)}},r("cancel","Cancel"))),o().createElement(Fe.Z,{open:u,setOpen:d,context:n}))},Xe=function(){var e=(0,O.useTranslation)().t,t=(0,De.Gc)(),r=t.register,n=t.formState.errors,s=t.setValue,i=(0,a.useContext)(R).activeGroupUuid;return(0,a.useEffect)((function(){i&&s("groupUuid",i)}),[i,s]),o().createElement(o().Fragment,null,o().createElement("input",Ke({hidden:!0},r("groupUuid",{value:i,required:e("chooseGroupError","Please choose a group.")}))),n.groupUuid&&!i&&o().createElement("div",{className:F.formError},n.groupUuid.message))};const He=function(){var e=(0,O.useTranslation)().t,t=(0,a.useContext)(R),r=t.setSessionMeta,n=t.workflowState,s=(0,De.cI)();return"NEW_GROUP_SESSION"!==n?null:o().createElement(De.RV,Ke({},s),o().createElement("form",{onSubmit:s.handleSubmit((function(e){var t,n,a=e.sessionDate,o=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,["sessionDate"]);r((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){qe(e,t,r[t])}))}return e}({},o),n=null!=(n={sessionDate:a[0]})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t))}))},o().createElement("div",{className:F.workspace},o().createElement("div",{className:F.formMainContent},o().createElement("div",{className:F.formContainer},o().createElement(Ve,null)),o().createElement("div",{className:F.rightPanel},o().createElement("h4",null,e("newGroupSession","New Group Session")),o().createElement(Xe,null),o().createElement("hr",{style:{width:"100%"}}),o().createElement(Qe,null))))))};var $e=r(1671),Je=r(611),Ye=r(9688),et=r(2223);function tt(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 rt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nt(){return nt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nt.apply(this,arguments)}function at(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){rt(e,t,r[t])}))}return e}function ot(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function st(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=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tt(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)?tt(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.")}()}var it=(0,n.getGlobalStore)("ampath-form-state"),lt=function(){var e=(0,a.useContext)(R),t=e.activeFormUuid,r=e.validateForNext,i=e.patientUuids,l=e.activePatientUuid,c=e.workflowState,u="ready"!==(0,n.useStore)(it)[t]||"EDIT_FORM"!==c,d=st((0,a.useState)(!1),2),m=d[0],_=d[1],p=st((0,a.useState)(!1),2),f=p[0],y=p[1],h=(0,O.useTranslation)().t,g=l===i[i.length-1];return o().createElement(o().Fragment,null,o().createElement("div",{className:F.rightPanelActionButtons},o().createElement(s.Button,{kind:"primary",onClick:function(){"EDIT_FORM"===c&&r()},disabled:u},g?h("saveForm","Save Form"):h("nextPatient","Next Patient")),o().createElement(s.Button,{kind:"secondary",onClick:function(){return y(!0)}},h("saveAndComplete","Save & Complete")),o().createElement(s.Button,{kind:"tertiary",onClick:function(){return _(!0)}},h("cancel","Cancel"))),o().createElement(Fe.Z,{open:m,setOpen:_,context:e}),o().createElement(et.Z,{open:f,setOpen:y,context:e,validateFirst:!0}))};const ct=function(){var e=(0,n.useConfig)().groupSessionConcepts,t=(0,O.useTranslation)().t,r=(0,a.useContext)(R),s=r.patientUuids,i=r.activePatientUuid,l=r.editEncounter,c=r.encounters,u=r.activeEncounterUuid,d=r.activeVisitUuid,m=r.activeFormUuid,_=r.saveEncounter,p=r.activeSessionMeta,f=r.groupVisitTypeUuid,y=r.updateVisitUuid,h=r.submitForNext,g=r.workflowState,v=r.submitForComplete,b=(0,Ye.Z)({showSuccessNotification:!1,showErrorNotification:!0}),E=b.saveVisit,w=b.success,S=(0,a.useCallback)((function(e){if(e&&!d){var t=new Date(p.sessionDate);t.setHours(t.getHours()+1),E({patientUuid:i,startDatetime:p.sessionDate,stopDatetime:t.toISOString(),visitType:f})}else e&&d&&h()}),[i,p,f,E,d,h]);(0,a.useEffect)((function(){if(w){var e,t=null==w||null===(e=w.data)||void 0===e?void 0:e.uuid;d||y(t),"VALIDATE_FOR_NEXT"===g&&h(),"VALIDATE_FOR_COMPLETE"===g&&v()}}),[w,y,h,g,d,v]);var N=(0,a.useCallback)((function(t){var r=new Date(p.sessionDate);r.setMinutes(r.getMinutes()+1),t.obs.forEach((function(e,n){var a;t.obs[n]=ot(at({},e),{groupMembers:null===(a=e.groupMembers)||void 0===a?void 0:a.map((function(e){return ot(at({},e),{obsDatetime:r.toISOString()})})),obsDatetime:r.toISOString()})})),Object.entries(e).forEach((function(e){var r=st(e,2),n=r[0],a=r[1];t.obs.push({concept:a,value:null==p?void 0:p[n]})})),t.visit=d,t.encounterDatetime=r.toISOString()}),[d,p,e]),x=(0,a.useCallback)((function(e){e&&e.uuid&&_(e.uuid)}),[_]);return"NEW_GROUP_SESSION"===g?null:o().createElement("div",{className:F.workspace},o().createElement("div",{className:F.formMainContent},o().createElement("div",{className:F.formContainer},o().createElement(Je.Z,nt({patientUuid:i,encounterUuid:u},{formUuid:m,handlePostResponse:x,handleOnValidate:S,handleEncounterCreate:N}))),o().createElement("div",{className:F.rightPanel},o().createElement("h4",null,t("formsFilled","Forms filled")),o().createElement("div",{className:F.patientCardsSection},null==s?void 0:s.map((function(e){return o().createElement($e.Z,nt({key:e},{patientUuid:e,activePatientUuid:i,editEncounter:l,encounters:c}))}))),o().createElement(lt,null))))},ut=function(){return o().createElement(U,null,o().createElement("div",{className:F.breadcrumbsContainer},o().createElement(n.ExtensionSlot,{extensionSlotName:"breadcrumbs-slot"})),o().createElement(Me,null),o().createElement(G,null),o().createElement("div",{className:F.workspaceWrapper},o().createElement(He,null),o().createElement(ct,null)))}},8034:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,'.-esm-fast-data-entry__styles__modal___xdlE9 .cds--modal{z-index:90}.-esm-fast-data-entry__styles__modal___xdlE9 .cds--modal-container{height:600px}.-esm-fast-data-entry__styles__modal___xdlE9 .cds--modal-content{height:100%}.-esm-fast-data-entry__styles__searchBar___eK\\+Us>div>div>div{width:100%}.-esm-fast-data-entry__styles__formError___0VO-V{color:red}.-esm-fast-data-entry__styles__patientRow___tNveQ{display:flex;align-items:center;width:"100%"}.-esm-fast-data-entry__styles__patientRow___tNveQ:nth-child(odd){background-color:#e0e0e0}.-esm-fast-data-entry__styles__patientName___1dVPc{flex-grow:1;padding-left:1rem}.-esm-fast-data-entry__styles__loading___Iz1NP{display:flex;height:100%;flex-direction:column;justify-content:center;align-items:center;row-gap:1rem}',""]),a.locals={modal:"-esm-fast-data-entry__styles__modal___xdlE9",searchBar:"-esm-fast-data-entry__styles__searchBar___eK+Us",formError:"-esm-fast-data-entry__styles__formError___0VO-V",patientRow:"-esm-fast-data-entry__styles__patientRow___tNveQ",patientName:"-esm-fast-data-entry__styles__patientName___1dVPc",loading:"-esm-fast-data-entry__styles__loading___Iz1NP"};const o=a},8914:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__styles__container___9Vn3g{height:5rem;display:flex;align-items:center;background-color:#fff;border-top:.0125rem solid #e0e0e0;border-bottom:.0125rem solid #e0e0e0;padding:0 1rem}.-esm-fast-data-entry__styles__photoPlaceholder___mRAQO{height:3rem;width:3rem}.-esm-fast-data-entry__styles__groupAvatar___qCLlZ{width:3rem;height:3rem;margin:.5rem 1rem .5rem 0;border-radius:1px}.-esm-fast-data-entry__styles__groupName___XRVMQ{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);font-weight:600}.-esm-fast-data-entry__styles__groupInfoContent___GMqli{margin-left:1rem;margin-right:4rem}.-esm-fast-data-entry__styles__groupInfoRow___WXABV{display:flex;align-items:center;font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;column-gap:.8rem}.-esm-fast-data-entry__styles__groupInfoRow___WXABV>button{min-height:2rem}.-esm-fast-data-entry__styles__sessionNotesLabel___eE69Z{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-bottom:.125rem}.-esm-fast-data-entry__styles__groupEditBtn___dagwZ{color:#161616;margin:.5rem}.-esm-fast-data-entry__styles__groupMetaContent___OMT76{flex-grow:1}",""]),a.locals={container:"-esm-fast-data-entry__styles__container___9Vn3g",photoPlaceholder:"-esm-fast-data-entry__styles__photoPlaceholder___mRAQO",groupAvatar:"-esm-fast-data-entry__styles__groupAvatar___qCLlZ",groupName:"-esm-fast-data-entry__styles__groupName___XRVMQ",groupInfoContent:"-esm-fast-data-entry__styles__groupInfoContent___GMqli",groupInfoRow:"-esm-fast-data-entry__styles__groupInfoRow___WXABV",sessionNotesLabel:"-esm-fast-data-entry__styles__sessionNotesLabel___eE69Z",groupEditBtn:"-esm-fast-data-entry__styles__groupEditBtn___dagwZ",groupMetaContent:"-esm-fast-data-entry__styles__groupMetaContent___OMT76"};const o=a},5443:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__styles__searchHeaderContainer___3ZMXh{height:5rem;display:flex;align-items:center;background-color:#fff;border-top:.0125rem solid #e0e0e0;border-bottom:.0125rem solid #e0e0e0;padding:0 1rem}.-esm-fast-data-entry__styles__searchBarWrapper___dRAl4{min-width:35rem}.-esm-fast-data-entry__styles__padded___8E3A9{padding:1rem}",""]),a.locals={searchHeaderContainer:"-esm-fast-data-entry__styles__searchHeaderContainer___3ZMXh",searchBarWrapper:"-esm-fast-data-entry__styles__searchBarWrapper___dRAl4",padded:"-esm-fast-data-entry__styles__padded___8E3A9"};const o=a},9423:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__compact-group-result__patientSearchResult___i7AGA{text-decoration:none;display:flex;align-items:center;border-bottom:1px solid #e0e0e0;padding:0 .75rem}.-esm-fast-data-entry__compact-group-result__patientSearchResult___i7AGA:hover,.-esm-fast-data-entry__compact-group-result__patientSearchResult___i7AGA:focus{background-color:#f4f4f4}.-esm-fast-data-entry__compact-group-result__patientSearchResultSelected___NKBck{background-color:#e0e0e0}.-esm-fast-data-entry__compact-group-result__patientBanner___hohFI{display:flex}.-esm-fast-data-entry__compact-group-result__patientName___Bm1nd{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-fast-data-entry__compact-group-result__patientAvatar___ekNKL{width:3rem;height:3rem;margin:.5rem 1rem .5rem 0;border-radius:1px}.-esm-fast-data-entry__compact-group-result__patientInfo___aPztL{width:100%;display:flex;flex-flow:column wrap;margin:1rem;cursor:pointer}.-esm-fast-data-entry__compact-group-result__demographics___ZX2gk{margin-top:.5rem;font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252}.-esm-fast-data-entry__compact-group-result__identifiers___nO-LM{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#8d8d8d}.-esm-fast-data-entry__compact-group-result__actionsContainer___GtQQe{padding-top:.5rem;margin-top:1rem}.-esm-fast-data-entry__compact-group-result__middot___K0huB{margin:0 .5rem}",""]),a.locals={patientSearchResult:"-esm-fast-data-entry__compact-group-result__patientSearchResult___i7AGA",patientSearchResultSelected:"-esm-fast-data-entry__compact-group-result__patientSearchResultSelected___NKBck",patientBanner:"-esm-fast-data-entry__compact-group-result__patientBanner___hohFI",patientName:"-esm-fast-data-entry__compact-group-result__patientName___Bm1nd",patientAvatar:"-esm-fast-data-entry__compact-group-result__patientAvatar___ekNKL",patientInfo:"-esm-fast-data-entry__compact-group-result__patientInfo___aPztL",demographics:"-esm-fast-data-entry__compact-group-result__demographics___ZX2gk",identifiers:"-esm-fast-data-entry__compact-group-result__identifiers___nO-LM",actionsContainer:"-esm-fast-data-entry__compact-group-result__actionsContainer___GtQQe",middot:"-esm-fast-data-entry__compact-group-result__middot___K0huB"};const o=a},68:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__compact-group-search__patientSearchBar___DDD\\+\\+{width:50vw;position:relative}.-esm-fast-data-entry__compact-group-search__floatingSearchResultsContainer___Qw-70{position:absolute;overflow-y:auto;box-shadow:0 .5rem 1rem #e0e0e0;z-index:99;border:0 1px 1px 1px solid #e0e0e0;width:100%;background-color:#fff}.-esm-fast-data-entry__compact-group-search__searchArea___\\+uJny{width:inherit;display:flex;justify-content:center;align-items:center;border:1px solid #8d8d8d}.-esm-fast-data-entry__compact-group-search__patientSearchInput___FLVTr{border:none}.-esm-fast-data-entry__compact-group-search__patientSearchInput___FLVTr input:focus{outline:1px solid 1px solid #ff832b}",""]),a.locals={patientSearchBar:"-esm-fast-data-entry__compact-group-search__patientSearchBar___DDD++",floatingSearchResultsContainer:"-esm-fast-data-entry__compact-group-search__floatingSearchResultsContainer___Qw-70",searchArea:"-esm-fast-data-entry__compact-group-search__searchArea___+uJny",patientSearchInput:"-esm-fast-data-entry__compact-group-search__patientSearchInput___FLVTr"};const o=a},9370:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5{width:100%;background-color:#fff}.-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5 a{text-decoration:none;font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0);color:#525252;margin:0rem}.omrs-breakpoint-lt-desktop .-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5{top:6.25rem}.omrs-breakpoint-gt-tablet .-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5{padding:0;top:3rem}.-esm-fast-data-entry__group-search__searchResults___waz\\+y{width:100%}.-esm-fast-data-entry__group-search__searchTerm___nyCGc{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);margin-top:.375rem}.-esm-fast-data-entry__group-search__resultsText___tut0N{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252;line-height:1rem;margin:.5rem 1rem}.-esm-fast-data-entry__group-search__helperText___DxXca{color:var(--omrs-color-ink-medium-contrast);margin-left:2.375rem}.-esm-fast-data-entry__group-search__emptyResultText___mWUlV{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);color:#525252;margin-top:1rem;margin-bottom:.313rem}.-esm-fast-data-entry__group-search__actionText___pfkSN{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px);color:#525252}.-esm-fast-data-entry__group-search__pagination___RfffN{display:flex;justify-content:space-evenly;padding:4.688rem 0 1.5rem}.-esm-fast-data-entry__group-search__emptySearchResultsTile___JGNyK{text-align:center;margin-top:1rem;padding:3rem 0rem}.omrs-breakpoint-gt-tablet .-esm-fast-data-entry__group-search__emptySearchResultsTile___JGNyK{margin:1rem}.-esm-fast-data-entry__group-search__errorMessage___c4zp4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);margin-top:2.25rem;margin-bottom:.5rem}.-esm-fast-data-entry__group-search__errorCopy___EjmNT{margin-bottom:.5rem;font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px);color:#525252}.-esm-fast-data-entry__group-search__lastItem___48nGL{padding:1rem;display:flex;justify-content:center;align-items:center}",""]),a.locals={searchResultsContainer:"-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5",searchResults:"-esm-fast-data-entry__group-search__searchResults___waz+y",searchTerm:"-esm-fast-data-entry__group-search__searchTerm___nyCGc",resultsText:"-esm-fast-data-entry__group-search__resultsText___tut0N",helperText:"-esm-fast-data-entry__group-search__helperText___DxXca",emptyResultText:"-esm-fast-data-entry__group-search__emptyResultText___mWUlV",actionText:"-esm-fast-data-entry__group-search__actionText___pfkSN",pagination:"-esm-fast-data-entry__group-search__pagination___RfffN",emptySearchResultsTile:"-esm-fast-data-entry__group-search__emptySearchResultsTile___JGNyK",errorMessage:"-esm-fast-data-entry__group-search__errorMessage___c4zp4",errorCopy:"-esm-fast-data-entry__group-search__errorCopy___EjmNT",lastItem:"-esm-fast-data-entry__group-search__lastItem___48nGL"};const o=a},7159:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__styles__breadcrumbsContainer___sgb6T>div>div>nav{background-color:#fff;padding:.75rem 1rem;height:2.5rem}.-esm-fast-data-entry__styles__workspaceWrapper___KeE2D{display:flex;justify-content:center}.-esm-fast-data-entry__styles__workspace___e3uV4{width:1100px}.omrs-breakpoint-lt-large-desktop .-esm-fast-data-entry__styles__workspace___e3uV4{width:1000px}.omrs-breakpoint-lt-small-desktop .-esm-fast-data-entry__styles__workspace___e3uV4{width:100vw;padding:0 .75rem}.-esm-fast-data-entry__styles__selectPatientMessage___kmuRr{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0);margin:2rem;text-align:center}.-esm-fast-data-entry__styles__formMainContent___l0zj8{display:flex;text-align:center;margin-top:1rem;column-gap:1rem}.-esm-fast-data-entry__styles__formContainer___cM3g8{flex-grow:1;max-height:calc(100vh - 14rem);overflow-y:scroll}.-esm-fast-data-entry__styles__formContainer___cM3g8 .cds--form-item .question-area{max-width:100%}.-esm-fast-data-entry__styles__rightPanel___iBUBP{width:13rem;text-align:left;overflow-y:scroll;display:flex;flex-direction:column;row-gap:1rem}.-esm-fast-data-entry__styles__patientCardsSection___2IKZo{margin:1rem 0;border-bottom:1px solid #f4f4f4}.-esm-fast-data-entry__styles__rightPanelActionButtons___P38yA{display:flex;flex-direction:column;row-gap:.5rem}.-esm-fast-data-entry__styles__rightPanelActionButtons___P38yA button{width:100%;text-decoration:"none"}.-esm-fast-data-entry__styles__formSection___XvWDb{display:flex;flex-direction:column;row-gap:1rem;justify-content:flex-start;align-items:flex-start;text-align:left}.-esm-fast-data-entry__styles__formSectionTile___Kv\\+-Q{width:500px}.-esm-fast-data-entry__styles__formError___ljPPl{font-size:var(--cds-helper-text-02-font-size, carbon--type-scale(2));font-weight:var(--cds-helper-text-02-font-weight, carbon--font-weight("regular"));line-height:var(--cds-helper-text-02-line-height, 1.28572);letter-spacing:var(--cds-helper-text-02-letter-spacing, 0.16px);color:#da1e28}',""]),a.locals={breadcrumbsContainer:"-esm-fast-data-entry__styles__breadcrumbsContainer___sgb6T",workspaceWrapper:"-esm-fast-data-entry__styles__workspaceWrapper___KeE2D",workspace:"-esm-fast-data-entry__styles__workspace___e3uV4",selectPatientMessage:"-esm-fast-data-entry__styles__selectPatientMessage___kmuRr",formMainContent:"-esm-fast-data-entry__styles__formMainContent___l0zj8",formContainer:"-esm-fast-data-entry__styles__formContainer___cM3g8",rightPanel:"-esm-fast-data-entry__styles__rightPanel___iBUBP",patientCardsSection:"-esm-fast-data-entry__styles__patientCardsSection___2IKZo",rightPanelActionButtons:"-esm-fast-data-entry__styles__rightPanelActionButtons___P38yA",formSection:"-esm-fast-data-entry__styles__formSection___XvWDb",formSectionTile:"-esm-fast-data-entry__styles__formSectionTile___Kv+-Q",formError:"-esm-fast-data-entry__styles__formError___ljPPl"};const o=a}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[]).push([[168],{5168:(e,t,r)=>{r.r(t),r.d(t,{default:()=>ut});var n=r(1132),a=r(1672),o=r.n(a),s=r(4422),i=r(2327),l=r(3133),c=r(3379),u=r.n(c),d=r(7795),m=r.n(d),_=r(569),p=r.n(_),f=r(3565),y=r.n(f),h=r(9216),g=r.n(h),v=r(4589),b=r.n(v),E=r(8914),w={};w.styleTagTransform=b(),w.setAttributes=y(),w.insert=p().bind(null,"head"),w.domAPI=m(),w.insertStyleElement=g(),u()(E.Z,w);const S=E.Z&&E.Z.locals?E.Z.locals:void 0;var O=r(3397),N=r(2504),x=r(1338),T=r(7612);function P(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 A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C(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){A(e,t,r[t])}))}return e}var k={setGroup:function(e){},unsetGroup:function(){},setSessionMeta:function(e){},openPatientSearch:function(){},saveEncounter:function(e){},editEncounter:function(e){},validateForNext:function(){},validateForComplete:function(){},updateVisitUuid:function(e){},submitForNext:function(){},submitForReview:function(){},submitForComplete:function(){},addPatientUuid:function(e){},removePatientUuid:function(e){},goToReview:function(){},destroySession:function(){},closeSession:function(){}},I={activeFormUuid:null,forms:{},workflowState:null,activePatientUuid:null,activeEncounterUuid:null,activeVisitUuid:null,patientUuids:[],encounters:{},visits:{},activeGroupUuid:null,activeGroupName:null,activeGroupMembers:[],activeSessionMeta:{sessionName:null,practitionerName:null,sessionDate:null,sessionNotes:null},groupVisitTypeUuid:null},j=o().createContext(C({},I,k)),U=function(e){var t,r,n,s,i,l,c,u,d,m,_,p,f,y,h,g,v,b,E,w,S,O,A,U,R,G,M,D,F,z,Z,B,L,V,W,q,K,Q,X=e.children,H=(0,x.useParams)().formUuid.split("&")[0],$=(0,T.Z)("@openmrs/esm-fast-data-entry-app.groupSessionVisitTypeUuid"),J=null==$||null===(t=$.result)||void 0===t||null===(r=t.data)||void 0===r||null===(n=r.results)||void 0===n||null===(s=n[0])||void 0===s?void 0:s.value,Y=(W=(0,a.useReducer)(N.ZP,C({},I,k)),q=2,function(e){if(Array.isArray(e))return e}(W)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(W,q)||function(e,t){if(e){if("string"==typeof e)return P(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)?P(e,t):void 0}}(W,q)||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.")}()),ee=Y[0],te=Y[1],re=(0,a.useMemo)((function(){return{initializeWorkflowState:function(e){var t=e.activeFormUuid;return te({type:"INITIALIZE_WORKFLOW_STATE",activeFormUuid:t})},setGroup:function(e){return te({type:"SET_GROUP",group:e})},unsetGroup:function(){return te({type:"UNSET_GROUP"})},setSessionMeta:function(e){return te({type:"SET_SESSION_META",meta:e})},addPatientUuid:function(e){return te({type:"ADD_PATIENT_UUID",patientUuid:e})},removePatientUuid:function(e){return te({type:"REMOVE_PATIENT_UUID",patientUuid:e})},openPatientSearch:function(){return te({type:"OPEN_PATIENT_SEARCH"})},saveEncounter:function(e){return te({type:"SAVE_ENCOUNTER",encounterUuid:e})},validateForNext:function(){return te({type:"VALIDATE_FOR_NEXT"})},validateForComplete:function(){return te({type:"VALIDATE_FOR_COMPLETE"})},updateVisitUuid:function(e){return te({type:"UPDATE_VISIT_UUID",visitUuid:e})},submitForNext:function(e){return te({type:"SUBMIT_FOR_NEXT",nextPatientUuid:e})},submitForComplete:function(){return te({type:"SUBMIT_FOR_COMPLETE"})},editEncounter:function(e){return te({type:"EDIT_ENCOUNTER",patientUuid:e})},goToReview:function(){return te({type:"GO_TO_REVIEW"})},destroySession:function(){return te({type:"DESTROY_SESSION"})},closeSession:function(){return te({type:"CLOSE_SESSION"})}}}),[]);return(0,a.useEffect)((function(){null===(null==ee?void 0:ee.workflowState)&&H&&re.initializeWorkflowState({activeFormUuid:H})}),[H,null==ee?void 0:ee.workflowState,re]),o().createElement(j.Provider,{value:(K=C({groupVisitTypeUuid:J},ee,re),Q={workflowState:null!==(R=null===(i=ee.forms)||void 0===i||null===(l=i[ee.activeFormUuid])||void 0===l?void 0:l.workflowState)&&void 0!==R?R:I.workflowState,activePatientUuid:null!==(G=null===(c=ee.forms)||void 0===c||null===(u=c[ee.activeFormUuid])||void 0===u?void 0:u.activePatientUuid)&&void 0!==G?G:I.activePatientUuid,activeEncounterUuid:null!==(M=null===(d=ee.forms)||void 0===d||null===(m=d[ee.activeFormUuid])||void 0===m?void 0:m.activeEncounterUuid)&&void 0!==M?M:I.activeEncounterUuid,activeVisitUuid:null!==(D=null===(_=ee.forms)||void 0===_||null===(p=_[ee.activeFormUuid])||void 0===p?void 0:p.activeVisitUuid)&&void 0!==D?D:I.activeVisitUuid,patientUuids:null!==(F=null===(f=ee.forms)||void 0===f||null===(y=f[ee.activeFormUuid])||void 0===y?void 0:y.patientUuids)&&void 0!==F?F:I.patientUuids,encounters:null!==(z=null===(h=ee.forms)||void 0===h||null===(g=h[ee.activeFormUuid])||void 0===g?void 0:g.encounters)&&void 0!==z?z:I.encounters,activeGroupUuid:null!==(Z=null===(v=ee.forms)||void 0===v||null===(b=v[ee.activeFormUuid])||void 0===b?void 0:b.groupUuid)&&void 0!==Z?Z:I.activeGroupUuid,activeGroupName:null!==(B=null===(E=ee.forms)||void 0===E||null===(w=E[ee.activeFormUuid])||void 0===w?void 0:w.groupName)&&void 0!==B?B:I.activeGroupName,activeGroupMembers:null!==(L=null===(S=ee.forms)||void 0===S||null===(O=S[ee.activeFormUuid])||void 0===O?void 0:O.groupMembers)&&void 0!==L?L:I.activeGroupMembers,activeSessionMeta:null!==(V=null===(A=ee.forms)||void 0===A||null===(U=A[ee.activeFormUuid])||void 0===U?void 0:U.sessionMeta)&&void 0!==V?V:I.activeSessionMeta},Q=null!=Q?Q:{},Object.getOwnPropertyDescriptors?Object.defineProperties(K,Object.getOwnPropertyDescriptors(Q)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(Q)).forEach((function(e){Object.defineProperty(K,e,Object.getOwnPropertyDescriptor(Q,e))})),K)},X)};const R=j,G=function(){var e=(0,a.useContext)(R),t=e.activeGroupName,r=e.activeGroupUuid,n=e.patientUuids,c=e.activeSessionMeta,u=e.unsetGroup,d=e.destroySession,m=(0,O.useTranslation)().t;return r?o().createElement("div",{className:S.container},o().createElement("div",{className:S.groupAvatar,role:"img"},o().createElement(i.zW,{size:48})),o().createElement("div",{className:S.groupInfoContent},o().createElement("div",{className:S.groupInfoRow},o().createElement("span",{className:S.groupName},t)),o().createElement("div",{className:S.groupInfoRow},o().createElement("span",null,n.length," ",m("members","members")))),(null==c?void 0:c.sessionNotes)&&o().createElement("div",{className:S.groupMeataContent},o().createElement("div",{className:"".concat(S.groupInfoRow," ").concat(S.sessionNotesLabel)},m("sessionNotes","Session Notes")),o().createElement("div",{className:S.groupInfoRow},c.sessionNotes)),o().createElement("span",{style:{flexGrow:1}}),o().createElement("span",null,o().createElement(s.Button,{kind:"ghost",onClick:function(){return u()}},m("changeGroup","Choose a different group")," ",o().createElement(l.x8,{size:20}))),o().createElement("span",null,o().createElement(s.Button,{kind:"ghost",onClick:function(){return d()}},m("cancel","Cancel")," ",o().createElement(l.x8,{size:20})))):null};var M=r(7159),D={};D.styleTagTransform=b(),D.setAttributes=y(),D.insert=p().bind(null,"head"),D.domAPI=m(),D.insertStyleElement=g(),u()(M.Z,D);const F=M.Z&&M.Z.locals?M.Z.locals:void 0;var z=r(5443),Z={};Z.styleTagTransform=b(),Z.setAttributes=y(),Z.insert=p().bind(null,"head"),Z.domAPI=m(),Z.insertStyleElement=g(),u()(z.Z,Z);const B=z.Z&&z.Z.locals?z.Z.locals:void 0;var L=r(68),V={};V.styleTagTransform=b(),V.setAttributes=y(),V.insert=p().bind(null,"head"),V.domAPI=m(),V.insertStyleElement=g(),u()(L.Z,V);const W=L.Z&&L.Z.locals?L.Z.locals:void 0;var q=r(9370),K={};K.styleTagTransform=b(),K.setAttributes=y(),K.insert=p().bind(null,"head"),K.domAPI=m(),K.insertStyleElement=g(),u()(q.Z,K);const Q=q.Z&&q.Z.locals?q.Z.locals:void 0;var X=r(2619),H=r(9423),$={};$.styleTagTransform=b(),$.setAttributes=y(),$.insert=p().bind(null,"head"),$.domAPI=m(),$.insertStyleElement=g(),u()(H.Z,$);const J=H.Z&&H.Z.locals?H.Z.locals:void 0;function Y(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}const ee=function(e){var t,r,n=(t=(0,a.useState)(!1),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(t,r)||function(e,t){if(e){if("string"==typeof e)return Y(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)?Y(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],s=n[1];return(0,a.useEffect)((function(){var t=function(t){t.key===e&&s(!0)},r=function(t){t.key===e&&s(!1)};return window.addEventListener("keydown",t),window.addEventListener("keyup",r),function(){window.removeEventListener("keydown",t),window.removeEventListener("keyup",r)}}),[e]),o};function te(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 re(){return re=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},re.apply(this,arguments)}var ne=function(e,t){switch(t.type){case"arrowUp":return{selectedIndex:Math.max(e.selectedIndex-1,0)};case"arrowDown":return{selectedIndex:Math.min(e.selectedIndex+1,t.listLength-1)};case"select":return{selectedIndex:t.payload};default:return e}},ae={behavior:"smooth",block:"nearest"},oe=function(e){var t,r,n=e.index,s=e.selectGroupAction,l=e.group,c=e.dispatch,u=e.state,d=e.totalGroups,m=e.lastRef,_=(0,a.useRef)(null),p=(0,O.useTranslation)().t;return(0,a.useEffect)((function(){u.selectedIndex===d-1?m.current.scrollIntoView(ae):u.selectedIndex===n&&_.current.scrollIntoView(ae)}),[u,n,d,m]),o().createElement("div",{onClick:function(){c({type:"select",payload:n}),s(l)},className:"".concat(J.patientSearchResult," ").concat(n===u.selectedIndex&&J.patientSearchResultSelected),role:"button","aria-pressed":n===u.selectedIndex,tabIndex:0,ref:_},o().createElement("div",{className:J.patientAvatar,role:"img"},o().createElement(i.zW,{size:24})),o().createElement("div",null,o().createElement("h2",{className:J.patientName},l.name),o().createElement("p",{className:J.demographics},null!==(r=null===(t=l.cohortMembers)||void 0===t?void 0:t.length)&&void 0!==r?r:0," ",p("members","members"),o().createElement("span",{className:J.middot},"·")," ",l.description)))},se=function(){return o().createElement("div",{className:J.patientSearchResult},o().createElement("div",{className:J.patientAvatar,role:"img"},o().createElement(s.SkeletonIcon,{style:{height:"3rem",width:"3rem"}})),o().createElement("div",null,o().createElement("h2",{className:J.patientName},o().createElement(s.SkeletonText,null)),o().createElement("span",{className:J.demographics},o().createElement(s.SkeletonIcon,null)," ",o().createElement("span",{className:J.middot},"·")," ",o().createElement(s.SkeletonIcon,null)," ",o().createElement("span",{className:J.middot},"·")," ",o().createElement(s.SkeletonIcon,null))))};const ie=function(e){var t,r,n=e.groups,s=e.selectGroupAction,i=e.lastRef,l=ee("ArrowUp"),c=ee("ArrowDown"),u=ee("Enter"),d=(t=(0,a.useReducer)(ne,{selectedIndex:0}),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(t,r)||function(e,t){if(e){if("string"==typeof e)return te(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)?te(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=d[0],_=d[1];return(0,a.useEffect)((function(){l&&_({type:"arrowUp"})}),[l]),(0,a.useEffect)((function(){c&&_({type:"arrowDown",listLength:n.length})}),[c,n.length]),(0,a.useEffect)((function(){u&&n.length&&s(n[m.selectedIndex])}),[u,s,n,m.selectedIndex]),o().createElement(o().Fragment,null,n.map((function(e,t){return o().createElement(oe,re({key:t,totalGroups:n.length},{lastRef:i,index:t,selectGroupAction:s,group:e,dispatch:_,state:m}))})))};var le=r(958);function ce(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 ue(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function de(){return de=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},de.apply(this,arguments)}function me(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){ue(e,t,r[t])}))}return e}function _e(e,t){if(e){if("string"==typeof e)return ce(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)?ce(e,t):void 0}}var pe=function(e){var t,r,o,s,i,l,c,u,d,m,_,p,f,y,h,g,v;return t=me({baseUrl:"/ws/rest/v1/cohortm/cohort",resultsToFetch:10},de({},e)),o=t.baseUrl,s=t.searchTerm,i=t.parameters,c=void 0===(l=t.searching)||l,u=t.resultsToFetch,d=void 0===u?10:u,m=(0,a.useCallback)((function(e,t){var r;if(t&&!(null==t||null===(r=t.data)||void 0===r?void 0:r.links.some((function(e){return"next"===e.rel}))))return null;var n="".concat(o,"?q=").concat(s),a=me({totalCount:!0,limit:d},i);return Object.entries(a).forEach((function(e){var t,r,a=(r=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(t,r)||_e(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],s=a[1];null!=s&&(n+="&".concat(o,"=").concat(s))})),e&&(n+="&startIndex=".concat(e*d)),n}),[o,s,i,d]),_=(0,le.ZP)(c?m:null,n.openmrsFetch),p=_.data,f=_.isValidating,y=_.setSize,h=_.error,g=_.size,v=(0,a.useMemo)((function(){var e,t,n,a,o,s;return{data:p?(e=[]).concat.apply(e,(s=null!==(r=null==p?void 0:p.map((function(e){var t;return null==e||null===(t=e.data)||void 0===t?void 0:t.results})))&&void 0!==r?r:[],function(e){if(Array.isArray(e))return ce(e)}(s)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(s)||_e(s)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())):null,isLoading:!p&&!h,error:h,hasMore:!!(null==p?void 0:p.length)&&!!(null===(t=p[p.length-1].data)||void 0===t||null===(n=t.links)||void 0===n?void 0:n.some((function(e){return"next"===e.rel}))),loadingNewData:f,setPage:y,currentPage:g,totalResults:null==p||null===(a=p[0])||void 0===a||null===(o=a.data)||void 0===o?void 0:o.totalCount}}),[p,f,h,y,g]),v};const fe=function(e){var t=e.query,r=void 0===t?"":t,n=e.selectGroupAction,i=(0,O.useTranslation)().t,l=pe({searchTerm:r,searching:!!r,parameters:{v:"full"}}),c=l.isLoading,u=l.data,d=l.error,m=l.loadingNewData,_=l.setPage,p=l.hasMore,f=l.totalResults,y=(0,a.useRef)(null),h=(0,a.useRef)(null),g=(0,a.useCallback)((function(e){m||(h.current&&h.current.disconnect(),h.current=new IntersectionObserver((function(e){e[0].isIntersecting&&p&&_((function(e){return e+1}))}),{threshold:.75}),e&&h.current.observe(e))}),[m,p,_]);return d?o().createElement("div",{className:Q.searchResults},o().createElement(s.Layer,null,o().createElement(s.Tile,{className:Q.emptySearchResultsTile},o().createElement(X.N,null),o().createElement("div",null,o().createElement("p",{className:Q.errorMessage},i("error","Error")),o().createElement("p",{className:Q.errorCopy},i("errorCopy","Sorry, there was an error. You can try to reload this page, or contact the site administrator and quote the error code above.")))))):c?o().createElement("div",{className:Q.searchResultsContainer},o().createElement(se,null),o().createElement(se,null),o().createElement(se,null),o().createElement(se,null),o().createElement(se,null)):0===(null==u?void 0:u.length)?o().createElement("div",{className:Q.searchResults},o().createElement(s.Layer,null,o().createElement(s.Tile,{className:Q.emptySearchResultsTile},o().createElement(X.N,null),o().createElement("p",{className:Q.emptyResultText},i("noGroupsFoundMessage","Sorry, no groups have been found")),o().createElement("p",{className:Q.actionText},o().createElement("span",null,i("trySearchWithPatientUniqueID","Try searching with the cohort's description")),o().createElement("br",null),o().createElement("span",null,i("orLabelName","OR label name")))))):o().createElement("div",{className:Q.searchResultsContainer},o().createElement("div",{className:Q.searchResults,style:{maxHeight:"22rem"}},o().createElement("p",{className:Q.resultsText},f," ",i("searchResultsText","search result(s)")),o().createElement(ie,{groups:u,selectGroupAction:n,lastRef:y}),o().createElement("div",{ref:y},o().createElement("div",{className:Q.lastItem,ref:g},p&&o().createElement(s.Loading,{withOverlay:!1,small:!0}),!p&&o().createElement("p",null,i("noMoreResults","End of search results"))))))};var ye=r(7518);function he(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 ge(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=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return he(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)?he(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 ve=function(e){var t=e.selectGroupAction,r=(0,O.useTranslation)().t,n=ge((0,a.useState)(""),2),i=n[0],l=n[1],c=ge((0,a.useState)(!1),2),u=c[0],d=c[1];return o().createElement("div",{className:W.patientSearchBar},o().createElement("div",{className:W.searchArea},o().createElement(s.Search,{autoFocus:!0,className:W.patientSearchInput,closeButtonLabelText:r("clearSearch","Clear"),labelText:"",onChange:function(e){var t;t=e.target.value,(0,ye.Z)((function(e){d(!!t.length),l(e)}),300),l(t),t.length?d(!0):d(!1)},onClear:function(){},placeholder:r("searchForGroup","Search for a group by name"),size:"sm",value:i}),o().createElement(s.Button,{kind:"secondary",size:"sm"},r("search","Search"))),u&&o().createElement("div",{className:W.floatingSearchResultsContainer},o().createElement(fe,{query:i,selectGroupAction:function(e){t(e),d(!1),l("")}})))};var be=r(8808),Ee=r(8115),we=r(8034),Se={};Se.styleTagTransform=b(),Se.setAttributes=y(),Se.insert=p().bind(null,"head"),Se.domAPI=m(),Se.insertStyleElement=g(),u()(we.Z,Se);const Oe=we.Z&&we.Z.locals?we.Z.locals:void 0;var Ne=r(282);function xe(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 Te(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pe(){return Pe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Pe.apply(this,arguments)}function Ae(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){Te(e,t,r[t])}))}return e}function Ce(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function ke(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=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||Ie(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.")}()}function Ie(e,t){if(e){if("string"==typeof e)return xe(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)?xe(e,t):void 0}}var je=o().memo(n.ExtensionSlot),Ue=function(e){var t=e.patient,r=e.removePatient,n=(0,O.useTranslation)().t;return o().createElement("li",{key:t.uuid,className:Oe.patientRow},o().createElement("span",null,o().createElement(s.Button,{kind:"tertiary",size:"sm",hasIconOnly:!0,onClick:function(){return r(t.uuid)},renderIcon:be.ZN,tooltipAlignment:"start",tooltipPosition:"top",iconDescription:n("remove","Remove")})),o().createElement("span",{className:Oe.patientName},null==t?void 0:t.display))},Re=function(e){var t=e.name,r=e.setName,n=e.patientList,a=e.updatePatientList,i=e.errors,l=e.validate,c=e.removePatient,u=(0,O.useTranslation)().t;return o().createElement("div",{style:{display:"flex",flexDirection:"column",rowGap:"1rem"}},o().createElement(s.TextInput,{labelText:u("newGroupName","New Group Name"),value:t,onChange:function(e){return r(e.target.value)},onBlur:function(){return l("name")}}),(null==i?void 0:i.name)&&o().createElement("p",{className:Oe.formError},"required"===i.name?u("groupNameError","Please enter a group name."):i.name),o().createElement(s.FormLabel,null,n.length," ",u("patientsInGroup","Patients in group")),(null==i?void 0:i.patientList)&&o().createElement("p",{className:Oe.formError},u("noPatientError","Please enter at least one patient.")),!(null==i?void 0:i.patientList)&&o().createElement("ul",{className:Oe.patientList},null==n?void 0:n.map((function(e,t){return o().createElement(Ue,{patient:e,removePatient:c,key:t})}))),o().createElement(s.FormLabel,null,"Search for patients to add to group"),o().createElement("div",{className:Oe.searchBar},o().createElement(je,{extensionSlotName:"patient-search-bar-slot",state:{selectPatientAction:a,buttonProps:{kind:"secondary"}}})))};const Ge=function(){var e=(0,a.useContext)(R).setGroup,t=(0,O.useTranslation)().t,r=ke((0,a.useState)(!1),2),i=r[0],l=r[1],c=ke((0,a.useState)({}),2),u=c[0],d=c[1],m=ke((0,a.useState)(""),2),_=m[0],p=m[1],f=ke((0,a.useState)([]),2),y=f[0],h=f[1],g=(0,Ne.zg)(),v=g.post,b=g.result,E=g.isPosting,w=g.error,S=(0,a.useCallback)((function(e){return h((function(t){return t.filter((function(t){return t.uuid!==e}))}))}),[h]),N=(0,a.useCallback)((function(e){var t=!0;return e?(t="name"===e?!!_:!!y.length,d((function(r){return Ce(Ae({},r),Te({},e,t?null:"required"))}))):(_?d((function(e){return Ce(Ae({},e),{name:null})})):(d((function(e){return Ce(Ae({},e),{name:"required"})})),t=!1),y.length?d((function(e){return Ce(Ae({},e),{patientList:null})})):(d((function(e){return Ce(Ae({},e),{patientList:"required"})})),t=!1)),t}),[_,y.length]),x=(0,a.useCallback)((function(e){h((function(t){return t.find((function(t){return t.uuid===e.uuid}))?t:(r=t,function(e){if(Array.isArray(e))return xe(e)}(r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||Ie(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([e]);var r})),d((function(e){return Ce(Ae({},e),{patientList:null})}))}),[h]);return(0,a.useEffect)((function(){b&&e(Ce(Ae({},b),{cohortMembers:y.map((function(e){return{patient:{uuid:e.uuid}}}))}))}),[b,e,y]),(0,a.useEffect)((function(){var e;w&&((0,n.showToast)({kind:"error",title:t("postError","POST Error"),description:null!==(e=w.message)&&void 0!==e?e:t("unknownPostError","An unknown error occured while saving data")}),w.fieldErrors&&d(Object.fromEntries(Object.entries(w.fieldErrors).map((function(e){var t,r=ke(e,2),n=r[0],a=r[1];return[n,null==a||null===(t=a[0])||void 0===t?void 0:t.message]})))))}),[w,t]),o().createElement("div",{className:Oe.modal},o().createElement(s.Button,{onClick:function(){return l(!0)},renderIcon:Ee.mm,iconDescription:"Add"},t("createNewGroup","Create New Group")),o().createElement(s.ComposedModal,{open:i,onClose:function(){return l(!1)}},o().createElement(s.ModalHeader,null,t("createNewGroup","Create New Group")),o().createElement(s.ModalBody,null,b?o().createElement("p",null,"Group saved succesfully"):E?o().createElement("div",{className:Oe.loading},o().createElement(s.Loading,{withOverlay:!1}),o().createElement("span",null,"Saving new group...")):o().createElement(Re,Pe({},{name:_,setName:p,patientList:y,updatePatientList:x,errors:u,validate:N,removePatient:S}))),o().createElement(s.ModalFooter,null,o().createElement(s.Button,{kind:"secondary",onClick:function(){l(!1)},disabled:E},t("cancel","Cancel")),o().createElement(s.Button,{kind:"primary",onClick:function(){N()&&v({name:_,cohortMembers:y.map((function(e){return{patient:e.uuid}}))})},disabled:E},t("createGroup","Create Group")))))},Me=function(){var e=(0,O.useTranslation)().t,t=(0,a.useContext)(R),r=t.activeGroupUuid,n=t.setGroup,i=t.destroySession;return r?null:o().createElement("div",{className:B.searchHeaderContainer},o().createElement("span",{className:B.padded},e("findGroup","Find group"),":"),o().createElement("span",{className:B.searchBarWrapper},o().createElement(ve,{selectGroupAction:function(e){n(e)}})),o().createElement("span",{className:B.padded},e("or","or")),o().createElement("span",null,o().createElement(Ge,null)),o().createElement("span",{style:{flexGrow:1}}),o().createElement("span",null,o().createElement(s.Button,{kind:"ghost",onClick:function(){i()}},e("cancel","Cancel")," ",o().createElement(l.x8,{size:20}))))};var De=r(7536),Fe=r(4211);function ze(){return ze=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ze.apply(this,arguments)}var Ze=function(e){var t,r,n,i,l,c,u,d=e.patientUuid,m=(0,Ne.Eu)(d),_=(0,a.useContext)(R),p=_.patientUuids,f=_.addPatientUuid,y=_.removePatientUuid,h=null==m||null===(t=m.name)||void 0===t||null===(r=t[0])||void 0===r||null===(n=r.given)||void 0===n?void 0:n[0],g=null==m||null===(i=m.name)||void 0===i||null===(l=i[0])||void 0===l?void 0:l.family,v=null==m||null===(c=m.identifier)||void 0===c||null===(u=c[0])||void 0===u?void 0:u.value;return m?o().createElement(s.TableRow,null,o().createElement(s.TableCell,null,m.display||m.displayName||[h,g].join(" ")),o().createElement(s.TableCell,null,v),o().createElement(s.TableCell,null,o().createElement(s.Checkbox,{checked:p.includes(d),labelText:d,hideLabel:!0,id:"".concat(v,"-attendance-checkbox"),onChange:function(e,t){t.checked?f(d):y(d)}}))):o().createElement(s.TableRow,null,o().createElement(s.TableCell,null,o().createElement(s.SkeletonText,null)),o().createElement(s.TableCell,null,o().createElement(s.SkeletonText,null)),o().createElement(s.TableCell,null,o().createElement(s.Checkbox,{diabled:!0})))};const Be=function(){var e=(0,O.useTranslation)().t,t=(0,a.useContext)(R),r=t.activeGroupUuid,n=t.activeGroupMembers,i=[e("name","Name"),e("identifier","Patient ID"),e("patientIsPresent","Patient is present")];return r?o().createElement(s.Table,null,o().createElement(s.TableHead,null,o().createElement(s.TableRow,null,i.map((function(e,t){return o().createElement(s.TableHeader,{key:t},e)})))),o().createElement(s.TableBody,null,n.map((function(e,t){return o().createElement(Ze,ze({},{patientUuid:e},{key:t}))})))):o().createElement("div",null,e("selectGroupFirst","Please select a group first"))};function Le(){return Le=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Le.apply(this,arguments)}const Ve=function(){var e=(0,O.useTranslation)().t,t=(0,De.Gc)(),r=t.register,n=t.formState.errors,a=t.control;return o().createElement("div",{className:F.formSection},o().createElement("h4",null,e("sessionDetails","1. Session details")),o().createElement("div",null,o().createElement("p",null,e("allFieldsRequired","All fields are required unless marked optional"))),o().createElement(s.Layer,null,o().createElement(s.Tile,{className:F.formSectionTile},o().createElement(s.Layer,null,o().createElement("div",{style:{display:"flex",flexDirection:"column",rowGap:"1.5rem"}},o().createElement(s.TextInput,Le({id:"text",type:"text",labelText:e("sessionName","Session Name")},r("sessionName",{required:!0}),{invalid:n.sessionName,invalidText:"This field is required"})),o().createElement(s.TextInput,Le({id:"text",type:"text",labelText:e("practitionerName","Practitioner Name")},r("practitionerName",{required:!0}),{invalid:n.practitionerName,invalidText:"This field is required"})),o().createElement(De.Qr,{name:"sessionDate",control:a,rules:{required:!0},render:function(t){var r=t.field;return o().createElement(s.DatePicker,Le({datePickerType:"single",size:"md",maxDate:new Date},r),o().createElement(s.DatePickerInput,{id:"session-date",labelText:e("sessionDate","Session Date"),placeholder:"mm/dd/yyyy",size:"md",invalid:n.sessionDate,invalidText:"This field is required"}))}}),o().createElement(s.TextArea,Le({id:"text",type:"text",labelText:e("sessionNotes","Session Notes")},r("sessionNotes",{required:!0}),{invalid:n.sessionNotes,invalidText:"This field is required"})))))),o().createElement("h4",null,e("sessionParticipants","2. Session participants")),o().createElement("div",null,o().createElement("p",null,e("markAbsentPatients","The patients in this group. Patients that are not present in the session should be marked as absent."))),o().createElement(s.Layer,null,o().createElement(s.Tile,{className:F.formSectionTile},o().createElement(s.Layer,null,o().createElement("div",{style:{display:"flex",flexDirection:"column",rowGap:"1.5rem"}},o().createElement(Be,null))))))};function We(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 qe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ke(){return Ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ke.apply(this,arguments)}var Qe=function(){var e,t,r=(0,O.useTranslation)().t,n=(0,a.useContext)(R),i=n.workflowState,l=n.patientUuids,c=(e=(0,a.useState)(!1),t=2,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=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return We(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)?We(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.")}()),u=c[0],d=c[1];return"NEW_GROUP_SESSION"!==i?null:o().createElement(o().Fragment,null,o().createElement("div",{className:F.rightPanelActionButtons},o().createElement(s.Button,{kind:"secondary",type:"submit",disabled:!l.length},r("createNewSession","Create New Session")),o().createElement(s.Button,{kind:"tertiary",onClick:function(){d(!0)}},r("cancel","Cancel"))),o().createElement(Fe.Z,{open:u,setOpen:d,context:n}))},Xe=function(){var e=(0,O.useTranslation)().t,t=(0,De.Gc)(),r=t.register,n=t.formState.errors,s=t.setValue,i=(0,a.useContext)(R).activeGroupUuid;return(0,a.useEffect)((function(){i&&s("groupUuid",i)}),[i,s]),o().createElement(o().Fragment,null,o().createElement("input",Ke({hidden:!0},r("groupUuid",{value:i,required:e("chooseGroupError","Please choose a group.")}))),n.groupUuid&&!i&&o().createElement("div",{className:F.formError},n.groupUuid.message))};const He=function(){var e=(0,O.useTranslation)().t,t=(0,a.useContext)(R),r=t.setSessionMeta,n=t.workflowState,s=(0,De.cI)();return"NEW_GROUP_SESSION"!==n?null:o().createElement(De.RV,Ke({},s),o().createElement("form",{onSubmit:s.handleSubmit((function(e){var t,n,a=e.sessionDate,o=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,["sessionDate"]);r((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){qe(e,t,r[t])}))}return e}({},o),n=null!=(n={sessionDate:a[0]})?n:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})),t))}))},o().createElement("div",{className:F.workspace},o().createElement("div",{className:F.formMainContent},o().createElement("div",{className:F.formContainer},o().createElement(Ve,null)),o().createElement("div",{className:F.rightPanel},o().createElement("h4",null,e("newGroupSession","New Group Session")),o().createElement(Xe,null),o().createElement("hr",{style:{width:"100%"}}),o().createElement(Qe,null))))))};var $e=r(1671),Je=r(611),Ye=r(9688),et=r(2223);function tt(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 rt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nt(){return nt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},nt.apply(this,arguments)}function at(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){rt(e,t,r[t])}))}return e}function ot(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})),e}function st(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=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tt(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)?tt(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.")}()}var it=(0,n.getGlobalStore)("ampath-form-state"),lt=function(){var e=(0,a.useContext)(R),t=e.activeFormUuid,r=e.submitForNext,i=e.patientUuids,l=e.activePatientUuid,c=e.workflowState,u="ready"!==(0,n.useStore)(it)[t]||"EDIT_FORM"!==c,d=st((0,a.useState)(!1),2),m=d[0],_=d[1],p=st((0,a.useState)(!1),2),f=p[0],y=p[1],h=(0,O.useTranslation)().t,g=l===i[i.length-1];return o().createElement(o().Fragment,null,o().createElement("div",{className:F.rightPanelActionButtons},o().createElement(s.Button,{kind:"primary",onClick:function(){"EDIT_FORM"===c&&r()},disabled:u},g?h("saveForm","Save Form"):h("nextPatient","Next Patient")),o().createElement(s.Button,{kind:"secondary",onClick:function(){return y(!0)}},h("saveAndComplete","Save & Complete")),o().createElement(s.Button,{kind:"tertiary",onClick:function(){return _(!0)}},h("cancel","Cancel"))),o().createElement(Fe.Z,{open:m,setOpen:_,context:e}),o().createElement(et.Z,{open:f,setOpen:y,context:e,validateFirst:!1}))};const ct=function(){var e=(0,n.useConfig)().groupSessionConcepts,t=(0,O.useTranslation)().t,r=(0,a.useContext)(R),s=r.patientUuids,i=r.activePatientUuid,l=r.encounters,c=r.activeEncounterUuid,u=r.activeVisitUuid,d=r.activeFormUuid,m=r.saveEncounter,_=r.activeSessionMeta,p=r.groupVisitTypeUuid,f=r.updateVisitUuid,y=r.submitForNext,h=r.workflowState,g=(0,n.useSession)().sessionLocation,v=st((0,a.useState)(null),2),b=v[0],E=v[1],w=st((0,a.useState)(null),2),S=w[0],N=w[1],x=(0,Ye.Z)({showSuccessNotification:!1,showErrorNotification:!0}),T=x.saveVisit,P=x.updateEncounter,A=x.success;(0,a.useEffect)((function(){A&&A.data.patient.uuid===i&&(N(A.data),f(A.data.uuid))}),[A,f,u,i,S,N]);var C=(0,a.useCallback)((function(t){u||T({patientUuid:i,startDatetime:_.sessionDate,stopDatetime:_.sessionDate,visitType:p,location:null==g?void 0:g.uuid});var r=new Date(_.sessionDate);t.obs.forEach((function(e,n){var a;t.obs[n]=ot(at({},e),{groupMembers:null===(a=e.groupMembers)||void 0===a?void 0:a.map((function(e){return ot(at({},e),{obsDatetime:r.toISOString()})})),obsDatetime:r.toISOString()})})),u||Object.entries(e).forEach((function(e){var r=st(e,2),n=r[0],a=r[1];t.obs.push({concept:a,value:null==_?void 0:_[n]})})),t.location=null==g?void 0:g.uuid,t.encounterDatetime=r.toISOString()}),[i,u,_,e,p,T,g]);(0,a.useEffect)((function(){b&&S&&P({uuid:b.uuid,visit:S.uuid})}),[b,P,S]);var k=(0,a.useCallback)((function(e){e&&e.uuid&&(m(e.uuid),E(e))}),[m]),I=(0,a.useCallback)((function(e){y(e)}),[y]);return"NEW_GROUP_SESSION"===h?null:o().createElement("div",{className:F.workspace},o().createElement("div",{className:F.formMainContent},o().createElement("div",{className:F.formContainer},o().createElement(Je.Z,nt({patientUuid:i,encounterUuid:c},{formUuid:d,handlePostResponse:k,handleEncounterCreate:C}))),o().createElement("div",{className:F.rightPanel},o().createElement("h4",null,t("formsFilled","Forms filled")),o().createElement("div",{className:F.patientCardsSection},null==s?void 0:s.map((function(e){return o().createElement($e.Z,nt({key:e},{patientUuid:e,activePatientUuid:i,editEncounter:I,encounters:l}))}))),o().createElement(lt,null))))},ut=function(){return o().createElement(U,null,o().createElement("div",{className:F.breadcrumbsContainer},o().createElement(n.ExtensionSlot,{extensionSlotName:"breadcrumbs-slot"})),o().createElement(Me,null),o().createElement(G,null),o().createElement("div",{className:F.workspaceWrapper},o().createElement(He,null),o().createElement(ct,null)))}},8034:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,'.-esm-fast-data-entry__styles__modal___xdlE9 .cds--modal{z-index:90}.-esm-fast-data-entry__styles__modal___xdlE9 .cds--modal-container{height:600px}.-esm-fast-data-entry__styles__modal___xdlE9 .cds--modal-content{height:100%}.-esm-fast-data-entry__styles__searchBar___eK\\+Us>div>div>div{width:100%}.-esm-fast-data-entry__styles__formError___0VO-V{color:red}.-esm-fast-data-entry__styles__patientRow___tNveQ{display:flex;align-items:center;width:"100%"}.-esm-fast-data-entry__styles__patientRow___tNveQ:nth-child(odd){background-color:#e0e0e0}.-esm-fast-data-entry__styles__patientName___1dVPc{flex-grow:1;padding-left:1rem}.-esm-fast-data-entry__styles__loading___Iz1NP{display:flex;height:100%;flex-direction:column;justify-content:center;align-items:center;row-gap:1rem}',""]),a.locals={modal:"-esm-fast-data-entry__styles__modal___xdlE9",searchBar:"-esm-fast-data-entry__styles__searchBar___eK+Us",formError:"-esm-fast-data-entry__styles__formError___0VO-V",patientRow:"-esm-fast-data-entry__styles__patientRow___tNveQ",patientName:"-esm-fast-data-entry__styles__patientName___1dVPc",loading:"-esm-fast-data-entry__styles__loading___Iz1NP"};const o=a},8914:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__styles__container___9Vn3g{height:5rem;display:flex;align-items:center;background-color:#fff;border-top:.0125rem solid #e0e0e0;border-bottom:.0125rem solid #e0e0e0;padding:0 1rem}.-esm-fast-data-entry__styles__photoPlaceholder___mRAQO{height:3rem;width:3rem}.-esm-fast-data-entry__styles__groupAvatar___qCLlZ{width:3rem;height:3rem;margin:.5rem 1rem .5rem 0;border-radius:1px}.-esm-fast-data-entry__styles__groupName___XRVMQ{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);font-weight:600}.-esm-fast-data-entry__styles__groupInfoContent___GMqli{margin-left:1rem;margin-right:4rem}.-esm-fast-data-entry__styles__groupInfoRow___WXABV{display:flex;align-items:center;font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252;column-gap:.8rem}.-esm-fast-data-entry__styles__groupInfoRow___WXABV>button{min-height:2rem}.-esm-fast-data-entry__styles__sessionNotesLabel___eE69Z{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);margin-bottom:.125rem}.-esm-fast-data-entry__styles__groupEditBtn___dagwZ{color:#161616;margin:.5rem}.-esm-fast-data-entry__styles__groupMetaContent___OMT76{flex-grow:1}",""]),a.locals={container:"-esm-fast-data-entry__styles__container___9Vn3g",photoPlaceholder:"-esm-fast-data-entry__styles__photoPlaceholder___mRAQO",groupAvatar:"-esm-fast-data-entry__styles__groupAvatar___qCLlZ",groupName:"-esm-fast-data-entry__styles__groupName___XRVMQ",groupInfoContent:"-esm-fast-data-entry__styles__groupInfoContent___GMqli",groupInfoRow:"-esm-fast-data-entry__styles__groupInfoRow___WXABV",sessionNotesLabel:"-esm-fast-data-entry__styles__sessionNotesLabel___eE69Z",groupEditBtn:"-esm-fast-data-entry__styles__groupEditBtn___dagwZ",groupMetaContent:"-esm-fast-data-entry__styles__groupMetaContent___OMT76"};const o=a},5443:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__styles__searchHeaderContainer___3ZMXh{height:5rem;display:flex;align-items:center;background-color:#fff;border-top:.0125rem solid #e0e0e0;border-bottom:.0125rem solid #e0e0e0;padding:0 1rem}.-esm-fast-data-entry__styles__searchBarWrapper___dRAl4{min-width:35rem}.-esm-fast-data-entry__styles__padded___8E3A9{padding:1rem}",""]),a.locals={searchHeaderContainer:"-esm-fast-data-entry__styles__searchHeaderContainer___3ZMXh",searchBarWrapper:"-esm-fast-data-entry__styles__searchBarWrapper___dRAl4",padded:"-esm-fast-data-entry__styles__padded___8E3A9"};const o=a},9423:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__compact-group-result__patientSearchResult___i7AGA{text-decoration:none;display:flex;align-items:center;border-bottom:1px solid #e0e0e0;padding:0 .75rem}.-esm-fast-data-entry__compact-group-result__patientSearchResult___i7AGA:hover,.-esm-fast-data-entry__compact-group-result__patientSearchResult___i7AGA:focus{background-color:#f4f4f4}.-esm-fast-data-entry__compact-group-result__patientSearchResultSelected___NKBck{background-color:#e0e0e0}.-esm-fast-data-entry__compact-group-result__patientBanner___hohFI{display:flex}.-esm-fast-data-entry__compact-group-result__patientName___Bm1nd{font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0)}.-esm-fast-data-entry__compact-group-result__patientAvatar___ekNKL{width:3rem;height:3rem;margin:.5rem 1rem .5rem 0;border-radius:1px}.-esm-fast-data-entry__compact-group-result__patientInfo___aPztL{width:100%;display:flex;flex-flow:column wrap;margin:1rem;cursor:pointer}.-esm-fast-data-entry__compact-group-result__demographics___ZX2gk{margin-top:.5rem;font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#525252}.-esm-fast-data-entry__compact-group-result__identifiers___nO-LM{font-size:var(--cds-body-compact-02-font-size, 1rem);font-weight:var(--cds-body-compact-02-font-weight, 400);line-height:var(--cds-body-compact-02-line-height, 1.375);letter-spacing:var(--cds-body-compact-02-letter-spacing, 0);color:#8d8d8d}.-esm-fast-data-entry__compact-group-result__actionsContainer___GtQQe{padding-top:.5rem;margin-top:1rem}.-esm-fast-data-entry__compact-group-result__middot___K0huB{margin:0 .5rem}",""]),a.locals={patientSearchResult:"-esm-fast-data-entry__compact-group-result__patientSearchResult___i7AGA",patientSearchResultSelected:"-esm-fast-data-entry__compact-group-result__patientSearchResultSelected___NKBck",patientBanner:"-esm-fast-data-entry__compact-group-result__patientBanner___hohFI",patientName:"-esm-fast-data-entry__compact-group-result__patientName___Bm1nd",patientAvatar:"-esm-fast-data-entry__compact-group-result__patientAvatar___ekNKL",patientInfo:"-esm-fast-data-entry__compact-group-result__patientInfo___aPztL",demographics:"-esm-fast-data-entry__compact-group-result__demographics___ZX2gk",identifiers:"-esm-fast-data-entry__compact-group-result__identifiers___nO-LM",actionsContainer:"-esm-fast-data-entry__compact-group-result__actionsContainer___GtQQe",middot:"-esm-fast-data-entry__compact-group-result__middot___K0huB"};const o=a},68:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__compact-group-search__patientSearchBar___DDD\\+\\+{width:50vw;position:relative}.-esm-fast-data-entry__compact-group-search__floatingSearchResultsContainer___Qw-70{position:absolute;overflow-y:auto;box-shadow:0 .5rem 1rem #e0e0e0;z-index:99;border:0 1px 1px 1px solid #e0e0e0;width:100%;background-color:#fff}.-esm-fast-data-entry__compact-group-search__searchArea___\\+uJny{width:inherit;display:flex;justify-content:center;align-items:center;border:1px solid #8d8d8d}.-esm-fast-data-entry__compact-group-search__patientSearchInput___FLVTr{border:none}.-esm-fast-data-entry__compact-group-search__patientSearchInput___FLVTr input:focus{outline:1px solid 1px solid #ff832b}",""]),a.locals={patientSearchBar:"-esm-fast-data-entry__compact-group-search__patientSearchBar___DDD++",floatingSearchResultsContainer:"-esm-fast-data-entry__compact-group-search__floatingSearchResultsContainer___Qw-70",searchArea:"-esm-fast-data-entry__compact-group-search__searchArea___+uJny",patientSearchInput:"-esm-fast-data-entry__compact-group-search__patientSearchInput___FLVTr"};const o=a},9370:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5{width:100%;background-color:#fff}.-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5 a{text-decoration:none;font-size:var(--cds-heading-02-font-size, 1rem);font-weight:var(--cds-heading-02-font-weight, 600);line-height:var(--cds-heading-02-line-height, 1.5);letter-spacing:var(--cds-heading-02-letter-spacing, 0);color:#525252;margin:0rem}.omrs-breakpoint-lt-desktop .-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5{top:6.25rem}.omrs-breakpoint-gt-tablet .-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5{padding:0;top:3rem}.-esm-fast-data-entry__group-search__searchResults___waz\\+y{width:100%}.-esm-fast-data-entry__group-search__searchTerm___nyCGc{font-size:var(--cds-heading-03-font-size, 1.25rem);font-weight:var(--cds-heading-03-font-weight, 400);line-height:var(--cds-heading-03-line-height, 1.4);letter-spacing:var(--cds-heading-03-letter-spacing, 0);margin-top:.375rem}.-esm-fast-data-entry__group-search__resultsText___tut0N{font-size:var(--cds-label-01-font-size, 0.75rem);font-weight:var(--cds-label-01-font-weight, 400);line-height:var(--cds-label-01-line-height, 1.33333);letter-spacing:var(--cds-label-01-letter-spacing, 0.32px);color:#525252;line-height:1rem;margin:.5rem 1rem}.-esm-fast-data-entry__group-search__helperText___DxXca{color:var(--omrs-color-ink-medium-contrast);margin-left:2.375rem}.-esm-fast-data-entry__group-search__emptyResultText___mWUlV{font-size:var(--cds-heading-compact-01-font-size, 0.875rem);font-weight:var(--cds-heading-compact-01-font-weight, 600);line-height:var(--cds-heading-compact-01-line-height, 1.28572);letter-spacing:var(--cds-heading-compact-01-letter-spacing, 0.16px);color:#525252;margin-top:1rem;margin-bottom:.313rem}.-esm-fast-data-entry__group-search__actionText___pfkSN{font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px);color:#525252}.-esm-fast-data-entry__group-search__pagination___RfffN{display:flex;justify-content:space-evenly;padding:4.688rem 0 1.5rem}.-esm-fast-data-entry__group-search__emptySearchResultsTile___JGNyK{text-align:center;margin-top:1rem;padding:3rem 0rem}.omrs-breakpoint-gt-tablet .-esm-fast-data-entry__group-search__emptySearchResultsTile___JGNyK{margin:1rem}.-esm-fast-data-entry__group-search__errorMessage___c4zp4{font-size:var(--cds-heading-compact-02-font-size, 1rem);font-weight:var(--cds-heading-compact-02-font-weight, 600);line-height:var(--cds-heading-compact-02-line-height, 1.375);letter-spacing:var(--cds-heading-compact-02-letter-spacing, 0);margin-top:2.25rem;margin-bottom:.5rem}.-esm-fast-data-entry__group-search__errorCopy___EjmNT{margin-bottom:.5rem;font-size:var(--cds-body-01-font-size, 0.875rem);font-weight:var(--cds-body-01-font-weight, 400);line-height:var(--cds-body-01-line-height, 1.42857);letter-spacing:var(--cds-body-01-letter-spacing, 0.16px);color:#525252}.-esm-fast-data-entry__group-search__lastItem___48nGL{padding:1rem;display:flex;justify-content:center;align-items:center}",""]),a.locals={searchResultsContainer:"-esm-fast-data-entry__group-search__searchResultsContainer___o8N-5",searchResults:"-esm-fast-data-entry__group-search__searchResults___waz+y",searchTerm:"-esm-fast-data-entry__group-search__searchTerm___nyCGc",resultsText:"-esm-fast-data-entry__group-search__resultsText___tut0N",helperText:"-esm-fast-data-entry__group-search__helperText___DxXca",emptyResultText:"-esm-fast-data-entry__group-search__emptyResultText___mWUlV",actionText:"-esm-fast-data-entry__group-search__actionText___pfkSN",pagination:"-esm-fast-data-entry__group-search__pagination___RfffN",emptySearchResultsTile:"-esm-fast-data-entry__group-search__emptySearchResultsTile___JGNyK",errorMessage:"-esm-fast-data-entry__group-search__errorMessage___c4zp4",errorCopy:"-esm-fast-data-entry__group-search__errorCopy___EjmNT",lastItem:"-esm-fast-data-entry__group-search__lastItem___48nGL"};const o=a},7159:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(3645),a=r.n(n)()((function(e){return e[1]}));a.push([e.id,':root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-fast-data-entry__styles__breadcrumbsContainer___sgb6T>div>div>nav{background-color:#fff;padding:.75rem 1rem;height:2.5rem}.-esm-fast-data-entry__styles__workspaceWrapper___KeE2D{display:flex;justify-content:center}.-esm-fast-data-entry__styles__workspace___e3uV4{width:1100px}.omrs-breakpoint-lt-large-desktop .-esm-fast-data-entry__styles__workspace___e3uV4{width:1000px}.omrs-breakpoint-lt-small-desktop .-esm-fast-data-entry__styles__workspace___e3uV4{width:100vw;padding:0 .75rem}.-esm-fast-data-entry__styles__selectPatientMessage___kmuRr{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0);margin:2rem;text-align:center}.-esm-fast-data-entry__styles__formMainContent___l0zj8{display:flex;text-align:center;margin-top:1rem;column-gap:1rem}.-esm-fast-data-entry__styles__formContainer___cM3g8{flex-grow:1;max-height:calc(100vh - 14rem);overflow-y:scroll}.-esm-fast-data-entry__styles__formContainer___cM3g8 .cds--form-item .question-area{max-width:100%}.-esm-fast-data-entry__styles__rightPanel___iBUBP{width:13rem;text-align:left;overflow-y:scroll;display:flex;flex-direction:column;row-gap:1rem}.-esm-fast-data-entry__styles__patientCardsSection___2IKZo{margin:1rem 0;border-bottom:1px solid #f4f4f4}.-esm-fast-data-entry__styles__rightPanelActionButtons___P38yA{display:flex;flex-direction:column;row-gap:.5rem}.-esm-fast-data-entry__styles__rightPanelActionButtons___P38yA button{width:100%;text-decoration:"none"}.-esm-fast-data-entry__styles__formSection___XvWDb{display:flex;flex-direction:column;row-gap:1rem;justify-content:flex-start;align-items:flex-start;text-align:left}.-esm-fast-data-entry__styles__formSectionTile___Kv\\+-Q{width:500px}.-esm-fast-data-entry__styles__formError___ljPPl{font-size:var(--cds-helper-text-02-font-size, carbon--type-scale(2));font-weight:var(--cds-helper-text-02-font-weight, carbon--font-weight("regular"));line-height:var(--cds-helper-text-02-line-height, 1.28572);letter-spacing:var(--cds-helper-text-02-letter-spacing, 0.16px);color:#da1e28}',""]),a.locals={breadcrumbsContainer:"-esm-fast-data-entry__styles__breadcrumbsContainer___sgb6T",workspaceWrapper:"-esm-fast-data-entry__styles__workspaceWrapper___KeE2D",workspace:"-esm-fast-data-entry__styles__workspace___e3uV4",selectPatientMessage:"-esm-fast-data-entry__styles__selectPatientMessage___kmuRr",formMainContent:"-esm-fast-data-entry__styles__formMainContent___l0zj8",formContainer:"-esm-fast-data-entry__styles__formContainer___cM3g8",rightPanel:"-esm-fast-data-entry__styles__rightPanel___iBUBP",patientCardsSection:"-esm-fast-data-entry__styles__patientCardsSection___2IKZo",rightPanelActionButtons:"-esm-fast-data-entry__styles__rightPanelActionButtons___P38yA",formSection:"-esm-fast-data-entry__styles__formSection___XvWDb",formSectionTile:"-esm-fast-data-entry__styles__formSectionTile___Kv+-Q",formError:"-esm-fast-data-entry__styles__formError___ljPPl"};const o=a}}]);
|
package/dist/229.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[]).push([[229],{2504:(t,e,i)=>{i.d(e,{ZP:()=>p,_u:()=>d,gQ:()=>v});var r=i(1132),o=i(5672);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function u(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter((function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})))),r.forEach((function(e){n(t,e,i[e])}))}return t}function c(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);i.push.apply(i,r)}return i}(Object(e)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})),t}function l(t,e){if(null==t)return{};var i,r,o=function(t,e){if(null==t)return{};var i,r,o={},a=Object.keys(t);for(r=0;r<a.length;r++)i=a[r],e.indexOf(i)>=0||(o[i]=t[i]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)i=a[r],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}function m(t){var e=function(t,e){if("object"!==s(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e);if("object"!==s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"===s(e)?e:String(e)}var s=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},d="1.0.5",v="openmrs:fastDataEntryGroupWorkflowState",f=function(t){localStorage.setItem(v,JSON.stringify(t))},U={workflowState:"NEW_GROUP_SESSION",groupUuid:null,groupName:null,groupMembers:[],activePatientUuid:null,activeEncounterUuid:null,activeVisitUuid:null,patientUuids:[],encounters:{},visits:{}};const p=function(t,e){switch(e.type){case"INITIALIZE_WORKFLOW_STATE":var i=localStorage.getItem(v),s=i?JSON.parse(i):{},p={};if(i&&s._storageVersion===d){var E,F,O,S,w=null===(E=s.forms)||void 0===E?void 0:E[e.activeFormUuid],_=(null==w?void 0:w.activePatientUuid)||(null==w||null===(F=w.patientUuids)||void 0===F?void 0:F[0])||null;p=c(u({},s),{activeFormUuid:e.activeFormUuid,forms:c(u({},s.forms),n({},e.activeFormUuid,c(u({},U,w),{activePatientUuid:_,activeEncounterUuid:(null==w||null===(O=w.encounters)||void 0===O?void 0:O[_])||null,activeVisitUuid:(null==w||null===(S=w.visits)||void 0===S?void 0:S[_])||null})))})}else p=c(u({},o.ol),{_storageVersion:d,forms:n({},e.activeFormUuid,U),activeFormUuid:e.activeFormUuid});return f(p),p;case"SET_GROUP":var y,b,g,h,T=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{groupUuid:e.group.uuid,groupName:e.group.name,patientUuids:null!==(g=null===(y=e.group.cohortMembers)||void 0===y?void 0:y.map((function(t){var e;return null==t||null===(e=t.patient)||void 0===e?void 0:e.uuid})))&&void 0!==g?g:[],groupMembers:null!==(h=null===(b=e.group.cohortMembers)||void 0===b?void 0:b.map((function(t){var e;return null==t||null===(e=t.patient)||void 0===e?void 0:e.uuid})))&&void 0!==h?h:[],activePatientUuid:null,activeEncounterUuid:null,activeVisitUuid:null})))});return f(T),T;case"UNSET_GROUP":var P=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{groupUuid:null,groupName:null,patientUuids:[],groupMembers:[],activePatientUuid:null,activeEncounterUuid:null,activeVisitUuid:null})))});return f(P),P;case"SET_SESSION_META":var I,M,R,C=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{sessionMeta:e.meta,activePatientUuid:null===(I=t.forms[t.activeFormUuid].patientUuids)||void 0===I?void 0:I[0],activeEncounterUuid:t.forms[t.activeFormUuid].encounters[null===(M=t.forms[t.activeFormUuid].patientUuids)||void 0===M?void 0:M[0]]||null,activeVisitUuid:t.forms[t.activeFormUuid].visits[null===(R=t.forms[t.activeFormUuid].patientUuids)||void 0===R?void 0:R[0]]||null,workflowState:"EDIT_FORM"})))});return f(C),C;case"ADD_PATIENT_UUID":if(t.forms[t.activeFormUuid].patientUuids.includes(e.patientUuid))return t;var V=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{patientUuids:(K=t.forms[t.activeFormUuid].patientUuids,function(t){if(Array.isArray(t))return a(t)}(K)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(K)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}(K)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([e.patientUuid])})))});return f(V),V;case"REMOVE_PATIENT_UUID":var D,A=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{patientUuids:null===(D=t.forms[t.activeFormUuid].patientUuids)||void 0===D?void 0:D.filter((function(t){return e.patientUuid!==t}))})))});return f(A),A;case"SAVE_ENCOUNTER":var N=t.forms[t.activeFormUuid];if("SUBMIT_FOR_COMPLETE"===N.workflowState){var j=t.forms,k=t.activeFormUuid,L=(j[k],l(j,[k].map(m))),B=c(u({},t),{forms:L,activeFormUuid:null});return f(B),(0,r.navigate)({to:"${openmrsSpaBase}/forms"}),B}if("SUBMIT_FOR_NEXT"===N.workflowState){var z=N.patientUuids[Math.min(N.patientUuids.indexOf(N.activePatientUuid)+1,N.patientUuids.length-1)],H=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},N),{encounters:c(u({},N.encounters),n({},N.activePatientUuid,e.encounterUuid)),activePatientUuid:z,activeEncounterUuid:N.encounters[z]||null,activeVisitUuid:N.visits[z]||null,workflowState:"EDIT_FORM"})))});return f(H),H}return t;case"EDIT_ENCOUNTER":var x=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{activeEncounterUuid:t.forms[t.activeFormUuid].encounters[e.patientUuid],activeVisitUuid:t.forms[t.activeFormUuid].visits[e.patientUuid],activePatientUuid:e.patientUuid,workflowState:"EDIT_FORM"})))});return f(x),x;case"VALIDATE_FOR_NEXT":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"validateForm"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"VALIDATE_FOR_NEXT"})))});case"UPDATE_VISIT_UUID":return c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{visits:c(u({},t.forms[t.activeFormUuid].visits),n({},t.forms[t.activeFormUuid].activePatientUuid,e.visitUuid)),activeVisitUuid:e.visitUuid})))});case"SUBMIT_FOR_NEXT":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_NEXT"})))});case"SUBMIT_FOR_REVIEW":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_REVIEW"})))});case"VALIDATE_FOR_COMPLETE":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"validateForm"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"VALIDATE_FOR_COMPLETE"})))});case"SUBMIT_FOR_COMPLETE":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_COMPLETE"})))});case"GO_TO_REVIEW":var W=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{activeEncounterUuid:null,activVisitUuid:null,activePatientUuid:null,workflowState:"REVIEW"})))});return f(W),W;case"DESTROY_SESSION":var G=t.forms,X=t.activeFormUuid,$=(G[X],l(G,[X].map(m))),J=c(u({},t),{forms:$,activeFormUuid:null});return f(J),(0,r.navigate)({to:"${openmrsSpaBase}/forms"}),c(u({},J),{formDestroyed:!0});case"CLOSE_SESSION":var Z=c(u({},t),{activeFormUuid:null});return f(Z),(0,r.navigate)({to:"${openmrsSpaBase}/forms"}),Z;default:return t}var K}},2619:(t,e,i)=>{i.d(e,{N:()=>a});var r=i(1672),o=i.n(r),a=function(t){var e=t.width,i=void 0===e?"64":e,r=t.height,a=void 0===r?"64":r;return o().createElement("svg",{width:i,height:a,viewBox:"0 0 64 64"},o().createElement("title",null,"Empty data illustration"),o().createElement("g",{fill:"none",fillRule:"evenodd"},o().createElement("path",{d:"M38.133 13.186H21.947c-.768.001-1.39.623-1.39 1.391V50.55l-.186.057-3.97 1.216a.743.743 0 01-.927-.493L3.664 12.751a.742.742 0 01.492-.926l6.118-1.874 17.738-5.43 6.119-1.873a.741.741 0 01.926.492L38.076 13l.057.186z",fill:"#F4F4F4"}),o().createElement("path",{d:"M41.664 13L38.026 1.117A1.576 1.576 0 0036.056.07l-8.601 2.633-17.737 5.43-8.603 2.634a1.578 1.578 0 00-1.046 1.97l12.436 40.616a1.58 1.58 0 001.969 1.046l5.897-1.805.185-.057v-.194l-.185.057-5.952 1.822a1.393 1.393 0 01-1.737-.923L.247 12.682a1.39 1.39 0 01.923-1.738L9.772 8.31 27.51 2.881 36.112.247a1.393 1.393 0 011.737.923L41.47 13l.057.186h.193l-.057-.185z",fill:"#8D8D8D"}),o().createElement("path",{d:"M11.378 11.855a.836.836 0 01-.798-.59L9.385 7.361a.835.835 0 01.554-1.042l16.318-4.996a.836.836 0 011.042.554l1.195 3.902a.836.836 0 01-.554 1.043l-16.318 4.995a.831.831 0 01-.244.037z",fill:"#C6C6C6"}),o().createElement("circle",{fill:"#C6C6C6",cx:17.636,cy:2.314,r:1.855}),o().createElement("circle",{fill:"#FFF",fillRule:"nonzero",cx:17.636,cy:2.314,r:1.175}),o().createElement("path",{d:"M55.893 53.995H24.544a.79.79 0 01-.788-.789V15.644a.79.79 0 01.788-.788h31.349a.79.79 0 01.788.788v37.562a.79.79 0 01-.788.789z",fill:"#F4F4F4"}),o().createElement("path",{d:"M41.47 13H21.948a1.579 1.579 0 00-1.576 1.577V52.4l.185-.057V14.577c.001-.768.623-1.39 1.391-1.39h19.581L41.471 13zm17.02 0H21.947a1.579 1.579 0 00-1.576 1.577v42.478c0 .87.706 1.576 1.576 1.577H58.49a1.579 1.579 0 001.576-1.577V14.577a1.579 1.579 0 00-1.576-1.576zm1.39 44.055c0 .768-.622 1.39-1.39 1.392H21.947c-.768-.001-1.39-.624-1.39-1.392V14.577c0-.768.622-1.39 1.39-1.39H58.49c.768 0 1.39.622 1.39 1.39v42.478z",fill:"#8D8D8D"}),o().createElement("path",{d:"M48.751 17.082H31.686a.836.836 0 01-.835-.835v-4.081c0-.46.374-.834.835-.835H48.75c.461 0 .834.374.835.835v4.08c0 .462-.374.835-.835.836z",fill:"#C6C6C6"}),o().createElement("circle",{fill:"#C6C6C6",cx:40.218,cy:9.755,r:1.855}),o().createElement("circle",{fill:"#FFF",fillRule:"nonzero",cx:40.218,cy:9.755,r:1.13})))}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_openmrs_esm_fast_data_entry_app=self.webpackChunk_openmrs_esm_fast_data_entry_app||[]).push([[229],{2504:(t,e,i)=>{i.d(e,{ZP:()=>p,_u:()=>s,gQ:()=>v});var r=i(1132),o=i(5672);function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function u(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter((function(t){return Object.getOwnPropertyDescriptor(i,t).enumerable})))),r.forEach((function(e){n(t,e,i[e])}))}return t}function c(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);i.push.apply(i,r)}return i}(Object(e)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})),t}function l(t,e){if(null==t)return{};var i,r,o=function(t,e){if(null==t)return{};var i,r,o={},a=Object.keys(t);for(r=0;r<a.length;r++)i=a[r],e.indexOf(i)>=0||(o[i]=t[i]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)i=a[r],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}function m(t){var e=function(t,e){if("object"!==d(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e);if("object"!==d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"===d(e)?e:String(e)}var d=function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},s="1.0.5",v="openmrs:fastDataEntryGroupWorkflowState",f=function(t){localStorage.setItem(v,JSON.stringify(t))},U={workflowState:"NEW_GROUP_SESSION",groupUuid:null,groupName:null,groupMembers:[],activePatientUuid:null,activeEncounterUuid:null,activeVisitUuid:null,patientUuids:[],encounters:{},visits:{}};const p=function(t,e){switch(e.type){case"INITIALIZE_WORKFLOW_STATE":var i=localStorage.getItem(v),d=i?JSON.parse(i):{},p={};if(i&&d._storageVersion===s){var E,F,O,S,w=null===(E=d.forms)||void 0===E?void 0:E[e.activeFormUuid],_=(null==w?void 0:w.activePatientUuid)||(null==w||null===(F=w.patientUuids)||void 0===F?void 0:F[0])||null;p=c(u({},d),{activeFormUuid:e.activeFormUuid,forms:c(u({},d.forms),n({},e.activeFormUuid,c(u({},U,w),{activePatientUuid:_,activeEncounterUuid:(null==w||null===(O=w.encounters)||void 0===O?void 0:O[_])||null,activeVisitUuid:(null==w||null===(S=w.visits)||void 0===S?void 0:S[_])||null})))})}else p=c(u({},o.ol),{_storageVersion:s,forms:n({},e.activeFormUuid,U),activeFormUuid:e.activeFormUuid});return f(p),p;case"SET_GROUP":var y,b,g,P,h=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{groupUuid:e.group.uuid,groupName:e.group.name,patientUuids:null!==(g=null===(y=e.group.cohortMembers)||void 0===y?void 0:y.map((function(t){var e;return null==t||null===(e=t.patient)||void 0===e?void 0:e.uuid})))&&void 0!==g?g:[],groupMembers:null!==(P=null===(b=e.group.cohortMembers)||void 0===b?void 0:b.map((function(t){var e;return null==t||null===(e=t.patient)||void 0===e?void 0:e.uuid})))&&void 0!==P?P:[],activePatientUuid:null,activeEncounterUuid:null,activeVisitUuid:null})))});return f(h),h;case"UNSET_GROUP":var T=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{groupUuid:null,groupName:null,patientUuids:[],groupMembers:[],activePatientUuid:null,activeEncounterUuid:null,activeVisitUuid:null})))});return f(T),T;case"SET_SESSION_META":var I,M,R,C=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{sessionMeta:e.meta,activePatientUuid:null===(I=t.forms[t.activeFormUuid].patientUuids)||void 0===I?void 0:I[0],activeEncounterUuid:t.forms[t.activeFormUuid].encounters[null===(M=t.forms[t.activeFormUuid].patientUuids)||void 0===M?void 0:M[0]]||null,activeVisitUuid:t.forms[t.activeFormUuid].visits[null===(R=t.forms[t.activeFormUuid].patientUuids)||void 0===R?void 0:R[0]]||null,workflowState:"EDIT_FORM"})))});return f(C),C;case"ADD_PATIENT_UUID":if(t.forms[t.activeFormUuid].patientUuids.includes(e.patientUuid))return t;var V=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{patientUuids:(K=t.forms[t.activeFormUuid].patientUuids,function(t){if(Array.isArray(t))return a(t)}(K)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(K)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(t,e):void 0}}(K)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([e.patientUuid])})))});return f(V),V;case"REMOVE_PATIENT_UUID":var D,A=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{patientUuids:null===(D=t.forms[t.activeFormUuid].patientUuids)||void 0===D?void 0:D.filter((function(t){return e.patientUuid!==t}))})))});return f(A),A;case"SAVE_ENCOUNTER":var N=t.forms[t.activeFormUuid];if("SUBMIT_FOR_COMPLETE"===N.workflowState){var j=t.forms,k=t.activeFormUuid,L=(j[k],l(j,[k].map(m))),x=c(u({},t),{forms:L,activeFormUuid:null});return f(x),(0,r.navigate)({to:"${openmrsSpaBase}/forms"}),x}if("SUBMIT_FOR_NEXT"===N.workflowState){var B=t.nextPatientUuid?t.nextPatientUuid:N.patientUuids[Math.min(N.patientUuids.indexOf(N.activePatientUuid)+1,N.patientUuids.length-1)],z=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},N),{encounters:c(u({},N.encounters),n({},N.activePatientUuid,e.encounterUuid)),activePatientUuid:B,activeEncounterUuid:N.encounters[B]||null,activeVisitUuid:N.visits[B]||null,workflowState:"EDIT_FORM"})))});return f(z),z}return t;case"EDIT_ENCOUNTER":var H=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{activeEncounterUuid:t.forms[t.activeFormUuid].encounters[e.patientUuid],activeVisitUuid:t.forms[t.activeFormUuid].visits[e.patientUuid],activePatientUuid:e.patientUuid,workflowState:"EDIT_FORM"})))});return f(H),H;case"VALIDATE_FOR_NEXT":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"validateForm"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"VALIDATE_FOR_NEXT"})))});case"UPDATE_VISIT_UUID":return c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{visits:c(u({},t.forms[t.activeFormUuid].visits),n({},t.forms[t.activeFormUuid].activePatientUuid,e.visitUuid)),activeVisitUuid:e.visitUuid})))});case"SUBMIT_FOR_NEXT":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_NEXT"}))),nextPatientUuid:e.nextPatientUuid});case"SUBMIT_FOR_REVIEW":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_REVIEW"})))});case"VALIDATE_FOR_COMPLETE":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"validateForm"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"VALIDATE_FOR_COMPLETE"})))});case"SUBMIT_FOR_COMPLETE":return window.dispatchEvent(new CustomEvent("ampath-form-action",{detail:{formUuid:t.activeFormUuid,patientUuid:t.forms[t.activeFormUuid].activePatientUuid,action:"onSubmit"}})),c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{workflowState:"SUBMIT_FOR_COMPLETE"})))});case"GO_TO_REVIEW":var W=c(u({},t),{forms:c(u({},t.forms),n({},t.activeFormUuid,c(u({},t.forms[t.activeFormUuid]),{activeEncounterUuid:null,activVisitUuid:null,activePatientUuid:null,workflowState:"REVIEW"})))});return f(W),W;case"DESTROY_SESSION":var G=t.forms,X=t.activeFormUuid,$=(G[X],l(G,[X].map(m))),J=c(u({},t),{forms:$,activeFormUuid:null});return f(J),(0,r.navigate)({to:"${openmrsSpaBase}/forms"}),c(u({},J),{formDestroyed:!0});case"CLOSE_SESSION":var Z=c(u({},t),{activeFormUuid:null});return f(Z),(0,r.navigate)({to:"${openmrsSpaBase}/forms"}),Z;default:return t}var K}},2619:(t,e,i)=>{i.d(e,{N:()=>a});var r=i(1672),o=i.n(r),a=function(t){var e=t.width,i=void 0===e?"64":e,r=t.height,a=void 0===r?"64":r;return o().createElement("svg",{width:i,height:a,viewBox:"0 0 64 64"},o().createElement("title",null,"Empty data illustration"),o().createElement("g",{fill:"none",fillRule:"evenodd"},o().createElement("path",{d:"M38.133 13.186H21.947c-.768.001-1.39.623-1.39 1.391V50.55l-.186.057-3.97 1.216a.743.743 0 01-.927-.493L3.664 12.751a.742.742 0 01.492-.926l6.118-1.874 17.738-5.43 6.119-1.873a.741.741 0 01.926.492L38.076 13l.057.186z",fill:"#F4F4F4"}),o().createElement("path",{d:"M41.664 13L38.026 1.117A1.576 1.576 0 0036.056.07l-8.601 2.633-17.737 5.43-8.603 2.634a1.578 1.578 0 00-1.046 1.97l12.436 40.616a1.58 1.58 0 001.969 1.046l5.897-1.805.185-.057v-.194l-.185.057-5.952 1.822a1.393 1.393 0 01-1.737-.923L.247 12.682a1.39 1.39 0 01.923-1.738L9.772 8.31 27.51 2.881 36.112.247a1.393 1.393 0 011.737.923L41.47 13l.057.186h.193l-.057-.185z",fill:"#8D8D8D"}),o().createElement("path",{d:"M11.378 11.855a.836.836 0 01-.798-.59L9.385 7.361a.835.835 0 01.554-1.042l16.318-4.996a.836.836 0 011.042.554l1.195 3.902a.836.836 0 01-.554 1.043l-16.318 4.995a.831.831 0 01-.244.037z",fill:"#C6C6C6"}),o().createElement("circle",{fill:"#C6C6C6",cx:17.636,cy:2.314,r:1.855}),o().createElement("circle",{fill:"#FFF",fillRule:"nonzero",cx:17.636,cy:2.314,r:1.175}),o().createElement("path",{d:"M55.893 53.995H24.544a.79.79 0 01-.788-.789V15.644a.79.79 0 01.788-.788h31.349a.79.79 0 01.788.788v37.562a.79.79 0 01-.788.789z",fill:"#F4F4F4"}),o().createElement("path",{d:"M41.47 13H21.948a1.579 1.579 0 00-1.576 1.577V52.4l.185-.057V14.577c.001-.768.623-1.39 1.391-1.39h19.581L41.471 13zm17.02 0H21.947a1.579 1.579 0 00-1.576 1.577v42.478c0 .87.706 1.576 1.576 1.577H58.49a1.579 1.579 0 001.576-1.577V14.577a1.579 1.579 0 00-1.576-1.576zm1.39 44.055c0 .768-.622 1.39-1.39 1.392H21.947c-.768-.001-1.39-.624-1.39-1.392V14.577c0-.768.622-1.39 1.39-1.39H58.49c.768 0 1.39.622 1.39 1.39v42.478z",fill:"#8D8D8D"}),o().createElement("path",{d:"M48.751 17.082H31.686a.836.836 0 01-.835-.835v-4.081c0-.46.374-.834.835-.835H48.75c.461 0 .834.374.835.835v4.08c0 .462-.374.835-.835.836z",fill:"#C6C6C6"}),o().createElement("circle",{fill:"#C6C6C6",cx:40.218,cy:9.755,r:1.855}),o().createElement("circle",{fill:"#FFF",fillRule:"nonzero",cx:40.218,cy:9.755,r:1.13})))}}}]);
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"132.js"
|
|
90
90
|
],
|
|
91
91
|
"auxiliaryFiles": [],
|
|
92
|
-
"hash": "
|
|
92
|
+
"hash": "12597d9d99e805e05d3d",
|
|
93
93
|
"childrenByOrder": {}
|
|
94
94
|
},
|
|
95
95
|
{
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
"initial": false,
|
|
98
98
|
"entry": false,
|
|
99
99
|
"recorded": false,
|
|
100
|
-
"size":
|
|
100
|
+
"size": 117929,
|
|
101
101
|
"sizes": {
|
|
102
|
-
"javascript":
|
|
102
|
+
"javascript": 117929
|
|
103
103
|
},
|
|
104
104
|
"names": [],
|
|
105
105
|
"idHints": [],
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"168.js"
|
|
112
112
|
],
|
|
113
113
|
"auxiliaryFiles": [],
|
|
114
|
-
"hash": "
|
|
114
|
+
"hash": "9e431822d8383f0fceec",
|
|
115
115
|
"childrenByOrder": {}
|
|
116
116
|
},
|
|
117
117
|
{
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"main.js"
|
|
138
138
|
],
|
|
139
139
|
"auxiliaryFiles": [],
|
|
140
|
-
"hash": "
|
|
140
|
+
"hash": "f50a782bddac19258cb3",
|
|
141
141
|
"childrenByOrder": {}
|
|
142
142
|
},
|
|
143
143
|
{
|
|
@@ -167,9 +167,9 @@
|
|
|
167
167
|
"entry": false,
|
|
168
168
|
"recorded": false,
|
|
169
169
|
"reason": "split chunk (cache group: default)",
|
|
170
|
-
"size":
|
|
170
|
+
"size": 25736,
|
|
171
171
|
"sizes": {
|
|
172
|
-
"javascript":
|
|
172
|
+
"javascript": 25736
|
|
173
173
|
},
|
|
174
174
|
"names": [],
|
|
175
175
|
"idHints": [],
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
"229.js"
|
|
182
182
|
],
|
|
183
183
|
"auxiliaryFiles": [],
|
|
184
|
-
"hash": "
|
|
184
|
+
"hash": "1108e8e71402c2a20153",
|
|
185
185
|
"childrenByOrder": {}
|
|
186
186
|
},
|
|
187
187
|
{
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@ const initialActions = {
|
|
|
29
29
|
validateForNext: () => undefined,
|
|
30
30
|
validateForComplete: () => undefined,
|
|
31
31
|
updateVisitUuid: (visitUuid: string) => undefined,
|
|
32
|
-
submitForNext: () => undefined,
|
|
32
|
+
submitForNext: (nextPatientUuid: string = null) => undefined,
|
|
33
33
|
submitForReview: () => undefined,
|
|
34
34
|
submitForComplete: () => undefined,
|
|
35
35
|
addPatientUuid: (patientUuid: string) => undefined,
|
|
@@ -106,7 +106,8 @@ const GroupFormWorkflowProvider = ({ children }) => {
|
|
|
106
106
|
validateForComplete: () => dispatch({ type: "VALIDATE_FOR_COMPLETE" }),
|
|
107
107
|
updateVisitUuid: (visitUuid) =>
|
|
108
108
|
dispatch({ type: "UPDATE_VISIT_UUID", visitUuid }),
|
|
109
|
-
submitForNext: () =>
|
|
109
|
+
submitForNext: (nextPatientUuid) =>
|
|
110
|
+
dispatch({ type: "SUBMIT_FOR_NEXT", nextPatientUuid }),
|
|
110
111
|
submitForComplete: () => dispatch({ type: "SUBMIT_FOR_COMPLETE" }),
|
|
111
112
|
editEncounter: (patientUuid) =>
|
|
112
113
|
dispatch({ type: "EDIT_ENCOUNTER", patientUuid }),
|
|
@@ -203,13 +203,14 @@ const reducer = (state, action) => {
|
|
|
203
203
|
navigate({ to: "${openmrsSpaBase}/forms" });
|
|
204
204
|
return newState;
|
|
205
205
|
} else if (thisForm.workflowState === "SUBMIT_FOR_NEXT") {
|
|
206
|
-
const nextPatientUuid =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
206
|
+
const nextPatientUuid = state.nextPatientUuid
|
|
207
|
+
? state.nextPatientUuid
|
|
208
|
+
: thisForm.patientUuids[
|
|
209
|
+
Math.min(
|
|
210
|
+
thisForm.patientUuids.indexOf(thisForm.activePatientUuid) + 1,
|
|
211
|
+
thisForm.patientUuids.length - 1
|
|
212
|
+
)
|
|
213
|
+
];
|
|
213
214
|
const newState = {
|
|
214
215
|
...state,
|
|
215
216
|
forms: {
|
|
@@ -310,6 +311,7 @@ const reducer = (state, action) => {
|
|
|
310
311
|
workflowState: "SUBMIT_FOR_NEXT",
|
|
311
312
|
},
|
|
312
313
|
},
|
|
314
|
+
nextPatientUuid: action.nextPatientUuid,
|
|
313
315
|
};
|
|
314
316
|
case "SUBMIT_FOR_REVIEW":
|
|
315
317
|
// this state should not be persisted
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getGlobalStore,
|
|
3
|
+
useConfig,
|
|
4
|
+
useSession,
|
|
5
|
+
useStore,
|
|
6
|
+
} from "@openmrs/esm-framework";
|
|
2
7
|
import { Button } from "@carbon/react";
|
|
3
8
|
import React, { useCallback, useContext, useEffect, useState } from "react";
|
|
4
9
|
import PatientCard from "../patient-card/PatientCard";
|
|
@@ -16,7 +21,7 @@ const WorkflowNavigationButtons = () => {
|
|
|
16
21
|
const context = useContext(GroupFormWorkflowContext);
|
|
17
22
|
const {
|
|
18
23
|
activeFormUuid,
|
|
19
|
-
|
|
24
|
+
submitForNext,
|
|
20
25
|
patientUuids,
|
|
21
26
|
activePatientUuid,
|
|
22
27
|
workflowState,
|
|
@@ -34,7 +39,7 @@ const WorkflowNavigationButtons = () => {
|
|
|
34
39
|
|
|
35
40
|
const handleClickNext = () => {
|
|
36
41
|
if (workflowState === "EDIT_FORM") {
|
|
37
|
-
|
|
42
|
+
submitForNext();
|
|
38
43
|
}
|
|
39
44
|
};
|
|
40
45
|
|
|
@@ -66,7 +71,7 @@ const WorkflowNavigationButtons = () => {
|
|
|
66
71
|
open={completeModalOpen}
|
|
67
72
|
setOpen={setCompleteModalOpen}
|
|
68
73
|
context={context}
|
|
69
|
-
validateFirst={
|
|
74
|
+
validateFirst={false}
|
|
70
75
|
/>
|
|
71
76
|
</>
|
|
72
77
|
);
|
|
@@ -78,7 +83,6 @@ const GroupSessionWorkspace = () => {
|
|
|
78
83
|
const {
|
|
79
84
|
patientUuids,
|
|
80
85
|
activePatientUuid,
|
|
81
|
-
editEncounter,
|
|
82
86
|
encounters,
|
|
83
87
|
activeEncounterUuid,
|
|
84
88
|
activeVisitUuid,
|
|
@@ -89,77 +93,57 @@ const GroupSessionWorkspace = () => {
|
|
|
89
93
|
updateVisitUuid,
|
|
90
94
|
submitForNext,
|
|
91
95
|
workflowState,
|
|
92
|
-
submitForComplete,
|
|
93
96
|
} = useContext(GroupFormWorkflowContext);
|
|
94
97
|
|
|
95
|
-
const {
|
|
98
|
+
const { sessionLocation } = useSession();
|
|
99
|
+
const [encounter, setEncounter] = useState(null);
|
|
100
|
+
const [visit, setVisit] = useState(null);
|
|
101
|
+
|
|
102
|
+
const {
|
|
103
|
+
saveVisit,
|
|
104
|
+
updateEncounter,
|
|
105
|
+
success: visitSaveSuccess,
|
|
106
|
+
} = useStartVisit({
|
|
96
107
|
showSuccessNotification: false,
|
|
97
108
|
showErrorNotification: true,
|
|
98
109
|
});
|
|
99
110
|
|
|
100
111
|
// 0. user clicks "next patient" in WorkflowNavigationButtons
|
|
101
|
-
// which triggers
|
|
102
|
-
|
|
103
|
-
// 1. validate the form
|
|
104
|
-
// if the form is valid, save a visit for the user
|
|
105
|
-
// handleOnValidate is a callback passed to the form engine.
|
|
106
|
-
const handleOnValidate = useCallback(
|
|
107
|
-
(valid) => {
|
|
108
|
-
if (valid && !activeVisitUuid) {
|
|
109
|
-
// make a visit
|
|
110
|
-
// we will not persist this state or update the reducer
|
|
111
|
-
const date = new Date(activeSessionMeta.sessionDate);
|
|
112
|
-
date.setHours(date.getHours() + 1);
|
|
113
|
-
saveVisit({
|
|
114
|
-
patientUuid: activePatientUuid,
|
|
115
|
-
startDatetime: activeSessionMeta.sessionDate,
|
|
116
|
-
stopDatetime: date.toISOString(),
|
|
117
|
-
visitType: groupVisitTypeUuid,
|
|
118
|
-
});
|
|
119
|
-
} else if (valid && activeVisitUuid) {
|
|
120
|
-
// there is already a visit for this form
|
|
121
|
-
submitForNext();
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
[
|
|
125
|
-
activePatientUuid,
|
|
126
|
-
activeSessionMeta,
|
|
127
|
-
groupVisitTypeUuid,
|
|
128
|
-
saveVisit,
|
|
129
|
-
activeVisitUuid,
|
|
130
|
-
submitForNext,
|
|
131
|
-
]
|
|
132
|
-
);
|
|
112
|
+
// which triggers submitForNext() if workflowState === "EDIT_FORM"
|
|
133
113
|
|
|
134
|
-
//
|
|
114
|
+
// 1. save the new visit uuid and start form submission
|
|
135
115
|
useEffect(() => {
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
if (workflowState === "VALIDATE_FOR_COMPLETE") {
|
|
145
|
-
submitForComplete();
|
|
146
|
-
}
|
|
116
|
+
if (
|
|
117
|
+
visitSaveSuccess &&
|
|
118
|
+
visitSaveSuccess.data.patient.uuid === activePatientUuid
|
|
119
|
+
) {
|
|
120
|
+
setVisit(visitSaveSuccess.data);
|
|
121
|
+
// Update visit UUID on workflow
|
|
122
|
+
updateVisitUuid(visitSaveSuccess.data.uuid);
|
|
147
123
|
}
|
|
148
124
|
}, [
|
|
149
125
|
visitSaveSuccess,
|
|
150
126
|
updateVisitUuid,
|
|
151
|
-
submitForNext,
|
|
152
|
-
workflowState,
|
|
153
127
|
activeVisitUuid,
|
|
154
|
-
|
|
128
|
+
activePatientUuid,
|
|
129
|
+
visit,
|
|
130
|
+
setVisit,
|
|
155
131
|
]);
|
|
156
132
|
|
|
157
|
-
//
|
|
133
|
+
// 2. If there's no active visit, trigger the creation of a new one
|
|
158
134
|
const handleEncounterCreate = useCallback(
|
|
159
135
|
(payload) => {
|
|
136
|
+
// Create a visit with the same date as the encounter being saved
|
|
137
|
+
if (!activeVisitUuid) {
|
|
138
|
+
saveVisit({
|
|
139
|
+
patientUuid: activePatientUuid,
|
|
140
|
+
startDatetime: activeSessionMeta.sessionDate,
|
|
141
|
+
stopDatetime: activeSessionMeta.sessionDate,
|
|
142
|
+
visitType: groupVisitTypeUuid,
|
|
143
|
+
location: sessionLocation?.uuid,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
160
146
|
const obsTime = new Date(activeSessionMeta.sessionDate);
|
|
161
|
-
obsTime.setMinutes(obsTime.getMinutes() + 1);
|
|
162
|
-
|
|
163
147
|
payload.obs.forEach((item, index) => {
|
|
164
148
|
payload.obs[index] = {
|
|
165
149
|
...item,
|
|
@@ -170,25 +154,54 @@ const GroupSessionWorkspace = () => {
|
|
|
170
154
|
obsDatetime: obsTime.toISOString(),
|
|
171
155
|
};
|
|
172
156
|
});
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
157
|
+
// If this is a newly created encounter and visit, add session concepts to encounter payload.
|
|
158
|
+
if (!activeVisitUuid) {
|
|
159
|
+
Object.entries(groupSessionConcepts).forEach(([field, uuid]) => {
|
|
160
|
+
payload.obs.push({
|
|
161
|
+
concept: uuid,
|
|
162
|
+
value: activeSessionMeta?.[field],
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
payload.location = sessionLocation?.uuid;
|
|
177
167
|
payload.encounterDatetime = obsTime.toISOString();
|
|
178
168
|
},
|
|
179
|
-
[
|
|
169
|
+
[
|
|
170
|
+
activePatientUuid,
|
|
171
|
+
activeVisitUuid,
|
|
172
|
+
activeSessionMeta,
|
|
173
|
+
groupSessionConcepts,
|
|
174
|
+
groupVisitTypeUuid,
|
|
175
|
+
saveVisit,
|
|
176
|
+
sessionLocation,
|
|
177
|
+
]
|
|
180
178
|
);
|
|
181
179
|
|
|
180
|
+
// 3. Update encounter so that it belongs to the created visit
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (encounter && visit) {
|
|
183
|
+
updateEncounter({ uuid: encounter.uuid, visit: visit.uuid });
|
|
184
|
+
}
|
|
185
|
+
}, [encounter, updateEncounter, visit]);
|
|
186
|
+
|
|
182
187
|
// 4. Once form has been posted, save the new encounter uuid so we can edit it later
|
|
183
188
|
const handlePostResponse = useCallback(
|
|
184
189
|
(encounter) => {
|
|
185
190
|
if (encounter && encounter.uuid) {
|
|
186
191
|
saveEncounter(encounter.uuid);
|
|
192
|
+
setEncounter(encounter);
|
|
187
193
|
}
|
|
188
194
|
},
|
|
189
195
|
[saveEncounter]
|
|
190
196
|
);
|
|
191
197
|
|
|
198
|
+
const switchPatient = useCallback(
|
|
199
|
+
(patientUuid) => {
|
|
200
|
+
submitForNext(patientUuid);
|
|
201
|
+
},
|
|
202
|
+
[submitForNext]
|
|
203
|
+
);
|
|
204
|
+
|
|
192
205
|
if (workflowState === "NEW_GROUP_SESSION") return null;
|
|
193
206
|
|
|
194
207
|
return (
|
|
@@ -201,7 +214,6 @@ const GroupSessionWorkspace = () => {
|
|
|
201
214
|
{...{
|
|
202
215
|
formUuid: activeFormUuid,
|
|
203
216
|
handlePostResponse,
|
|
204
|
-
handleOnValidate,
|
|
205
217
|
handleEncounterCreate,
|
|
206
218
|
}}
|
|
207
219
|
/>
|
|
@@ -215,7 +227,7 @@ const GroupSessionWorkspace = () => {
|
|
|
215
227
|
{...{
|
|
216
228
|
patientUuid,
|
|
217
229
|
activePatientUuid,
|
|
218
|
-
editEncounter,
|
|
230
|
+
editEncounter: switchPatient,
|
|
219
231
|
encounters,
|
|
220
232
|
}}
|
|
221
233
|
/>
|