"use strict";(globalThis.webpackChunk_openmrs_esm_ward_app=globalThis.webpackChunk_openmrs_esm_ward_app||[]).push([["4425"],{95479:function(e,t,n){n.r(t),n.d(t,{default:()=>F});var i=n(27350),a=n.n(i),r=n(93798),l=n(66954),s=n(28854),u=n(32515),d=n(78184),o=n(21196),p=n(61597),c=n(94806),m=n(16709),v=n.n(m),w=n(99382),E=n(95705),P=n(51562),Z=n(7467),f=n(78956),g=n(8031),A=n(67909);let b=function(e){var t=e.wardPatient,n=t.patient,i=t.bed,r=t.inpatientAdmission,l=null!=r?r:{},s=l.encounterAssigningToCurrentInpatientLocation,u=l.firstAdmissionOrTransferEncounter;return a().createElement("div",{className:v()(c.Z.wardPatientCardRow,c.Z.wardPatientCardHeader)},i?a().createElement(E.Z,{bed:i}):null,a().createElement(Z.Z,{patient:n}),a().createElement(P.Z,{id:"patient-identifier",patient:n}),a().createElement(A.Z,{patient:n}),a().createElement(w.Z,{patient:n}),a().createElement(g.Z,{firstAdmissionOrTransferEncounter:u}),a().createElement(f.Z,{encounterAssigningToCurrentInpatientLocation:s}))};var q=n(94127);let R=function(e){var t=e.wardPatient,n=t.bed,i=a().createElement(p.Z,{wardPatient:t},a().createElement(b,{wardPatient:t}),a().createElement(q.Z,{wardPatient:t}),a().createElement(o.Z,{id:"pending-items",wardPatient:t}),a().createElement(d.Z,{id:"admission-request-note",wardPatient:t}));return n?i:a().createElement("div",{className:c.Z.unassignedPatient},a().createElement("div",{key:"unassigned-bed-pt-"+t.patient.uuid},i))},C=function(){var e,t=(null!=(e=(0,r.useAppContext)("ward-view-context"))?e:{}).wardPatientGroupDetails,n=null!=t?t:{},i=n.bedLayouts,l=n.wardAdmittedPatientsWithBed,d=n.inpatientAdmissionsByPatientUuid,o=null==i?void 0:i.map(function(e){var t=e.patients,n=(0,u.i)(e),i=t.map(function(e){var t=null==l?void 0:l.get(e.uuid);if(t){var i=t.patient,a=t.visit,r=t.currentInpatientRequest;return{patient:i,visit:a,bed:n,inpatientAdmission:t,inpatientRequest:r||null}}var s=d.get(e.uuid);return{patient:e,visit:null==s?void 0:s.visit,bed:n,inpatientAdmission:s,inpatientRequest:null}}).map(function(e){return a().createElement(R,{key:e.patient.uuid,wardPatient:e})});return a().createElement(s.Z,{key:n.uuid,bed:n,patientCards:i})});return a().createElement(a().Fragment,null,o)};var k=n(68892),x=n(70418),T=n(86587);let _=function(){var e,t=(null!=(e=(0,r.useAppContext)("ward-view-context"))?e:{}).wardPatientGroupDetails,n=(0,k.useTranslation)().t,i=(null!=t?t:{}).inpatientRequestResponse,l=null!=i?i:{},s=l.inpatientRequests,u=l.isLoading,o=l.error;return u?a().createElement(T.Z,null):o?a().createElement(r.ErrorState,{headerTitle:n("admissionRequests","Admission requests"),error:o}):a().createElement(a().Fragment,null,null==s?void 0:s.map(function(e,t){var n={patient:e.patient,visit:e.visit,bed:null,inpatientRequest:e,inpatientAdmission:null};return a().createElement(x.Z,{key:"admission-request-card-".concat(t),wardPatient:{patient:e.patient,visit:e.visit,bed:null,inpatientRequest:e,inpatientAdmission:null}},a().createElement(d.Z,{id:"admission-request-note",wardPatient:n}))}))},h=function(){var e,t=(null!=(e=(0,r.useAppContext)("ward-view-context"))?e:{}).wardPatientGroupDetails,n=(null!=t?t:{}).wardUnassignedPatientsList,i=null==n?void 0:n.map(function(e){return a().createElement(R,{wardPatient:{patient:e.patient,visit:e.visit,bed:null,inpatientAdmission:e,inpatientRequest:e.currentInpatientRequest},key:e.patient.uuid})});return a().createElement(a().Fragment,null,i)};var y=n(45019),D=n(29398),L=n(7632);let F=function(){var e=(0,l.v)();(0,r.useDefineAppContext)("ward-view-context",{wardPatientGroupDetails:e,WardPatientHeader:b});var t=a().createElement(C,null),n=a().createElement(L.Z,null),i=a().createElement(h,null),s=a().createElement(_,null);return a().createElement(a().Fragment,null,a().createElement(D.Z,{wardPendingPatients:s,wardMetrics:n}),a().createElement(y.Z,{wardBeds:t,wardUnassignedPatients:i}))}}}]);