"use strict";(globalThis.webpackChunk_kenyaemr_esm_ward_app=globalThis.webpackChunk_kenyaemr_esm_ward_app||[]).push([["7263"],{92839:function(n,e,t){t.d(e,{Z:()=>a});var i=t(10558),r=t(31262);let a=function(n){var e=(0,i.useVisit)(n),t=e.activeVisit,a=e.error,o=e.isLoading,u=e.mutate,s=(0,i.useEmrConfiguration)(),d=s.emrConfiguration,l=s.isLoadingEmrConfiguration,c=s.errorFetchingEmrConfiguration,p=(0,r.useMemo)(function(){var n;return null==t||null==(n=t.encounters)?void 0:n.find(function(n){var e,t;return n.encounterType.uuid===(null==d||null==(e=d.admissionEncounterType)?void 0:e.uuid)||n.encounterType.uuid===(null==d||null==(t=d.transferWithinHospitalEncounterType)?void 0:t.uuid)})},[t,d]),m=(0,r.useMemo)(function(){var n;return null==t||null==(n=t.encounters)?void 0:n.find(function(n){var e;return n.encounterType.uuid===(null==d||null==(e=d.exitFromInpatientEncounterType)?void 0:e.uuid)})},[t,d]),g=(0,r.useMemo)(function(){return p&&!m},[p,m]);return{admissionEncounter:p,isLoading:o||l,error:a||c,mutate:u,currentVisit:t,dischargeEncounter:m,isPatientAdmitted:g}}},44546:function(n,e,t){t.d(e,{Dg:()=>s,Xg:()=>d,je:()=>u});var i=t(10558),r=t(93498),a=t(92839),o=t(31262),u=function(n){var e,t,a=new URLSearchParams;a.set("dispositionType","ADMIT"),a.set("patients",[n].join(",")),a.set("v","custom:(dispositionLocation,dispositionType,disposition,dispositionEncounter:full,patient:(uuid,identifiers,voided,person:(uuid,display,gender,age,birthdate,birthtime,preferredName,preferredAddress,dead,deathDate)),dispositionObsGroup,visit)");var o="".concat(i.restBaseUrl,"/emrapi/inpatient/request?").concat(a.toString()),u=(0,r.ZP)(o,i.openmrsFetch),s=u.data,d=u.isLoading,l=u.error,c=u.mutate;return{admissionRequest:null!=(e=null==s||null==(t=s.data)?void 0:t.results)?e:[],isLoading:d,error:l,mutate:c}},s=function(n){var e,t,a="".concat(i.restBaseUrl,"/location/").concat(n,"?v=").concat("custom:(tags:(uuid,display,name,description))"),o=(0,r.ZP)(n?a:null,i.openmrsFetch),u=o.data,s=o.error,d=o.isLoading,l=o.mutate;return{tags:null!=(e=null==u||null==(t=u.data)?void 0:t.tags)?e:[],isLoading:d,error:s,mutate:l}},d=function(n){var e,t,r=(null==n||null==(e=n.gender)?void 0:e.toLowerCase())==="female",u=(0,a.Z)(null==n?void 0:n.id),d=u.admissionEncounter,l=u.error,c=u.isLoading,p=u.isPatientAdmitted,m=s(null==d||null==(t=d.location)?void 0:t.uuid),g=m.error,f=m.isLoading,v=m.tags,h=(0,i.useConfig)().inpatientLocationTags,y=(0,o.useMemo)(function(){return Object.values(h).every(function(n){return v.some(function(e){return e.uuid===n})})},[h,v]);return{isLoading:c||f,error:null!=l?l:g,showPartography:r&&p&&y}}},80495:function(n,e,t){t.r(e),t.d(e,{default:()=>d});var i=t(10558),r=t(31262),a=t.n(r),o=t(44546),u=t(56717),s=t(66002);let d=function(n){var e=n.patient,t=n.patientUuid,r=(0,o.Xg)(e),d=r.isLoading,l=r.showPartography,c=(0,s.useTranslation)().t;return d?a().createElement(u.gqd,null):l?a().createElement(i.ExtensionSlot,{name:"maternal-and-child-health-partograph-slot",state:{patientUuid:t,patient:e}}):a().createElement(u.K0D,{kind:"warning",title:c("partograph","Partograph"),subtitle:c("partographReason","Can only show partograph for female patients in Labour Ward")})}}}]);