@sasindi/ward-discharge 1.0.3 → 1.0.4

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/76.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_sasindi_ward_discharge=globalThis.webpackChunk_sasindi_ward_discharge||[]).push([[76],{44076(e,t,n){n.r(t),n.d(t,{default:()=>N});var r=n(16072),l=n(98445),a=n(72102),o=n(75107),i=n(89369),c=n(48852),s=n(48697),d=n(94948),u=n.n(d),p=(n(49336),n(41371)),m=n(20354),g=n.n(m);function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,l,a,o){try{var i=e[a](o),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,l)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){f(a,r,l,o,i,"next",e)}function i(e){f(a,r,l,o,i,"throw",e)}o(void 0)})}}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){b(e,t,n[t])})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){i=!0,l=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw l}}return a}}(e,t)||C(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 S(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(e)||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.")}()}function C(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function k(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:c(0)}),i(o,"throw",{value:c(1)}),i(o,"return",{value:c(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&i[0]?r.return:i[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,i[1])).done)return l;switch(r=0,l&&(i=[2&i[0],l.value]),i[0]){case 0:case 1:l=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!l||i[1]>l[0]&&i[1]<l[3])){a.label=i[1];break}if(6===i[0]&&a.label<l[1]){a.label=l[1],l=i;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(i);break}l[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=l=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}const w=function(){var e,t,n,d,m,y,f,C,w,N,A,T,D,B,z,P=(0,r.useRef)(null),I=(0,r.useRef)(null),R=v((0,r.useState)(""),2),O=(R[0],R[1]),W=v((0,r.useState)(null),2),L=W[0],j=W[1],M=v((0,r.useState)([]),2),G=M[0],_=M[1],H=v((0,r.useState)("0"),2),F=H[0],q=H[1],U=v((0,r.useState)(""),2),V=U[0],Y=U[1],J=v((0,r.useState)(""),2),K=J[0],X=J[1],$=v((0,r.useState)("0"),2),Q=$[0],Z=$[1],ee=v((0,r.useState)("0"),2),te=ee[0],ne=ee[1],re=v((0,r.useState)(""),2),le=re[0],ae=re[1],oe=v((0,r.useState)([]),2),ie=oe[0],ce=oe[1],se=v((0,r.useState)(""),2),de=(se[0],se[1]),ue=v((0,r.useState)("0"),2),pe=ue[0],me=ue[1],ge=v((0,r.useState)(""),2),ye=ge[0],fe=ge[1],he=v((0,r.useState)([]),2),be=he[0],xe=he[1],Ee=v((0,r.useState)(""),2),ve=Ee[0],Se=Ee[1],Ce=v((0,r.useState)(!1),2),ke=Ce[0],we=Ce[1],Ne=v((0,r.useState)(null),2),Ae=Ne[0],Te=Ne[1],De=v((0,r.useState)(!1),2),Be=De[0],ze=De[1],Pe=v((0,r.useState)([]),2),Ie=Pe[0],Re=Pe[1],Oe=v((0,r.useState)(""),2),We=Oe[0],Le=Oe[1],je=v((0,r.useState)(""),2),Me=je[0],Ge=je[1],_e=v((0,r.useState)(""),2),He=(_e[0],_e[1]),Fe=v((0,r.useState)(""),2),qe=Fe[0],Ue=Fe[1],Ve=v((0,r.useState)(!1),2),Ye=Ve[0],Je=Ve[1],Ke=v((0,r.useState)(0),2),Xe=Ke[0],$e=Ke[1],Qe=v((0,r.useState)([]),2),Ze=Qe[0],et=Qe[1],tt=v((0,r.useState)(null),2),nt=tt[0],rt=tt[1],lt=v((0,r.useState)([]),2),at=lt[0],ot=lt[1],it=v((0,r.useState)({druguuid:"",drugName:"",drugtype:"",dosage:"",frequency:"",period:"",periodType:"",comment:"",markasoutdoor:"no"}),2),ct=it[0],st=it[1],dt=v((0,r.useState)(!1),2),ut=dt[0],pt=dt[1],mt=v((0,r.useState)([]),2),gt=mt[0],yt=mt[1],ft=v((0,r.useState)(""),2),ht=ft[0],bt=ft[1],xt=v((0,r.useState)([]),2),Et=xt[0],vt=xt[1],St=v((0,r.useState)(null),2),Ct=St[0],kt=St[1],wt=v((0,r.useState)([]),2),Nt=wt[0],At=wt[1],Tt=v((0,r.useState)([]),2),Dt=Tt[0],Bt=Tt[1];(0,r.useEffect)(function(){Ae&&zt(Ae)},[Ae]);var zt=function(e){return h(function(){var t,n,r;return k(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),[4,fetch("/openmrs/ws/rest/v1/warddischarge/clinic/".concat(e))];case 1:return(t=l.sent()).ok?[4,t.json()]:[3,3];case 2:n=l.sent(),Array.isArray(n)&&xe(n.map(function(e){return{uuid:e[0],name:e[1]}})),l.label=3;case 3:return[3,5];case 4:return r=l.sent(),console.error("Error fetching clinics:",r),[3,5];case 5:return[2]}})})()},Pt=(0,r.useMemo)(function(){return be.filter(function(e){return e.name.toLowerCase().includes(ve.toLowerCase())})},[be,ve]),It=v((0,r.useState)(""),2),Rt=It[0],Ot=It[1],Wt=v((0,r.useState)(1),2),Lt=Wt[0],jt=Wt[1],Mt=v((0,r.useState)(10),1)[0],Gt=v((0,r.useState)(null),2),_t=Gt[0],Ht=Gt[1];(0,r.useEffect)(function(){var e=new Date,t=e.toISOString().split("T")[0],n="".concat(String(e.getHours()).padStart(2,"0"),":").concat(String(e.getMinutes()).padStart(2,"0"));Y(t),X(n),h(function(){var e,t,n,r,l,a,o;return k(this,function(i){switch(i.label){case 0:return i.trys.push([0,8,,9]),[4,fetch("/openmrs/ws/rest/v1/session")];case 1:return[4,i.sent().json()];case 2:return t=i.sent(),n=t.user.person.uuid,r=(null===(e=t.sessionLocation)||void 0===e?void 0:e.uuid)||null,Te(r),r?[4,fetch("/openmrs/ws/rest/v1/location/".concat(r))]:[3,5];case 3:return[4,i.sent().json()];case 4:l=i.sent(),Ue(l.display||l.name||"Unknown Hospital"),i.label=5;case 5:return[4,fetch("/openmrs/ws/rest/v1/wardmanagement/loadwardbyperson/".concat(n))];case 6:return[4,i.sent().json()];case 7:return a=i.sent(),_(a||[]),[3,9];case 8:return o=i.sent(),console.error("Error fetching wards:",o),[3,9];case 9:return[2]}})})()},[]);var Ft=function(e,t,n){et(function(r){var l=S(r);if(t.startsWith("checklist.")){var a=t.split(".")[1];l[e]=E(x({},l[e]),{checklist:E(x({},l[e].checklist),b({},a,n))})}else l[e]=E(x({},l[e]),b({},t,n));return l})},qt=function(e,t,n){Ft(e,"checklist.".concat(t),n)},Ut=function(e){return h(function(){var t,n,r,l,a;return k(this,function(o){switch(o.label){case 0:if(t=e.target.value,q(t),"0"===t)return Re([]),[2];o.label=1;case 1:return o.trys.push([1,7,8,9]),ze(!0),[4,fetch("/openmrs/ws/rest/v1/wardmanagement/loadwardperson?wardUuids=".concat(t,"&locationUuid=").concat(Ae))];case 2:if(!(n=o.sent()).ok)throw new Error("Failed to fetch ward patients");return[4,n.json()];case 3:return(r=o.sent())&&r.length>0?[4,Promise.all(r.map(function(e){return h(function(){var t,n,r,l,a,o,i;return k(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),[4,fetch("/openmrs/ws/rest/v1/opd/phn/".concat(e.phn))];case 1:case 3:return[4,c.sent().json()];case 2:return t=c.sent(),[4,fetch("/openmrs/ws/rest/v1/patient/".concat(t.patientuuid))];case 4:return n=c.sent(),r=n.person,l={M:"Male",F:"Female",O:"Other"}[r.gender]||r.gender,a=r.age,o=e.remarks&&"null"!==e.remarks&&""!==e.remarks?e.remarks:"",[2,{id:e.id,phn:e.phn,encounteruuid:e.encounteruuid,bht_No:e.bht_No,remarks:o,guardian_name:e.guardian_name||"",patientName:t.fullName||"N/A",gender:l||"N/A",age:a||"N/A",admission_type:e.admission_type||"N/A",admission_date:e.admission_date||"N/A",admission_time:e.admission_time||"N/A",patientuuid:t.patientuuid}];case 5:return i=c.sent(),console.error("Error fetching patient data for PHN ".concat(e.phn,":"),i),[2,{id:e.id,phn:e.phn,encounteruuid:e.encounteruuid,bht_No:e.bht_No,remarks:e.remarks||"",guardian_name:e.guardian_name||"",patientName:"Error loading",gender:"N/A",age:"N/A",patientuuid:""}];case 6:return[2]}})})()}))]:[3,5];case 4:return l=o.sent(),Re(l),[3,6];case 5:Re([]),o.label=6;case 6:return[3,9];case 7:return a=o.sent(),console.error("Error fetching ward patients:",a),Re([]),[3,9];case 8:return ze(!1),[7];case 9:return[2]}})})()},Vt=function(){O(""),j(null),de(""),ce([]),ae(""),ne("0"),Z("0"),me("0"),fe(""),Je(!1),$e(0),et([]),ot([]),kt(null),At([]),Bt([]),bt(""),vt([]);var e=new Date,t=e.toISOString().split("T")[0],n="".concat(String(e.getHours()).padStart(2,"0"),":").concat(String(e.getMinutes()).padStart(2,"0"));Y(t),X(n)},Yt=function(){"0"!==F&&Ut({target:{value:F}})},Jt=function(e){var t="asc";_t&&_t.key===e&&"asc"===_t.direction&&(t="desc"),Ht({key:e,direction:t})},Kt=(0,r.useMemo)(function(){var e=Ie.filter(function(e){return e.patientName&&e.patientName.toLowerCase().includes(Rt.toLowerCase())||e.phn&&e.phn.toLowerCase().includes(Rt.toLowerCase())||e.bht_No&&e.bht_No.toLowerCase().includes(Rt.toLowerCase())});return null!==_t&&e.sort(function(e,t){var n=e[_t.key],r=t[_t.key];return n<r?"asc"===_t.direction?-1:1:n>r?"asc"===_t.direction?1:-1:0}),e},[Ie,Rt,_t]),Xt=Lt*Mt,$t=Xt-Mt,Qt=Kt.slice($t,Xt),Zt=Math.ceil(Kt.length/Mt),en={mainContainer:{width:"100%",backgroundColor:"#f5f5f5",padding:"20px",minHeight:"100vh",fontFamily:'"Open Sans", sans-serif'},card:{backgroundColor:"#ffffff",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)",padding:"20px",marginBottom:"20px"},sectionTitle:{fontSize:"18px",fontWeight:"bold",color:"#28a745",marginBottom:"20px",paddingBottom:"10px",borderBottom:"2px solid #28a745",marginTop:0},gridTwoColumn:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"20px"},inputGroup:{display:"flex",flexDirection:"column"},label:{fontSize:"14px",fontWeight:"bold",color:"#333",marginBottom:"10px"},input:{padding:"10px",border:"1px solid #ccc",borderRadius:"4px",width:"100%",boxSizing:"border-box",fontSize:"14px"},select:{padding:"10px",border:"1px solid #ccc",borderRadius:"4px",width:"100%",boxSizing:"border-box",fontSize:"14px",backgroundColor:"white"},buttonContainer:{display:"flex",justifyContent:"center",gap:"15px",marginTop:"30px"},buttonPrimary:{backgroundColor:"#28a745",color:"white",border:"none",padding:"10px 30px",borderRadius:"5px",cursor:"pointer",fontSize:"16px",fontWeight:"bold"},buttonSecondary:{backgroundColor:"#007bff",color:"white",border:"none",padding:"10px 30px",borderRadius:"5px",cursor:"pointer",fontSize:"16px",fontWeight:"bold"},buttonDanger:{backgroundColor:"#dc3545",color:"white",border:"none",padding:"10px 30px",borderRadius:"5px",cursor:"pointer",fontSize:"16px",fontWeight:"bold"},printTemplateWrapper:{position:"fixed",left:"-9999px",top:"0",zIndex:-1,pointerEvents:"none"},printTemplate:{width:"1000px",backgroundColor:"white",padding:"40px",color:"black"},table:{width:"100%",borderCollapse:"collapse",backgroundColor:"white",borderRadius:"8px",overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},th:{backgroundColor:"#f8f9fa",color:"#333",fontWeight:"bold",fontSize:"14px",padding:"12px",textAlign:"left",borderBottom:"2px solid #dee2e6",cursor:"pointer",userSelect:"none"},td:{fontSize:"14px",padding:"12px",color:"#555",borderBottom:"1px solid #eee"},tr:{transition:"background-color 0.2s"}};return r.createElement("div",{style:en.mainContainer},Be&&r.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3}},r.createElement("div",{style:{color:"white",fontSize:"18px"}},"Loading...")),r.createElement("div",{style:en.card},r.createElement("h2",{style:{fontSize:"24px",fontWeight:"bold",color:"#28a745",marginBottom:"20px",paddingBottom:"10px",borderBottom:"2px solid #28a745",marginTop:0}},"Ward Discharge",r.createElement("span",{style:{fontSize:"10px",color:"#912013",marginLeft:"16px",fontWeight:"bold"}},"PATIENT DISCHARGE MANAGEMENT"),r.createElement("button",{onClick:Yt,style:{marginLeft:"20px",backgroundColor:"#17a2b8",color:"white",border:"none",padding:"8px 16px",borderRadius:"4px",cursor:"pointer",fontSize:"14px",float:"right"}},"Refresh Patient List")),r.createElement("div",{style:{backgroundColor:"#f8f9fa",padding:"10px",marginBottom:"20px",border:"1px solid #dee2e6",borderRadius:"4px",fontSize:"12px"}},r.createElement("strong",null,"Hospital:")," ",qe," | ",r.createElement("strong",null,"Admitted Patients:")," ",Ie.length),r.createElement("div",{style:{marginBottom:"30px"}},r.createElement("h2",{style:en.sectionTitle},"Select Ward"),r.createElement("select",{style:en.select,value:F,onChange:Ut},r.createElement("option",{value:"0"},"-- Select Ward --"),G.map(function(e,t){return r.createElement("option",{key:t,value:e[0]},e[1])}))),"0"!==F&&r.createElement("div",{style:{marginBottom:"30px"}},r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"15px"}},r.createElement("h3",{style:{color:"#495057",fontSize:"24px",fontWeight:"bold",margin:0}},"Ward Patients for Discharge"),r.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},r.createElement("span",{style:{fontSize:"14px",fontWeight:"bold"}},"Search:"),r.createElement("input",{type:"text",placeholder:"Search by Name, PHN or BHT...",style:E(x({},en.input),{width:"300px",marginBottom:0}),value:Rt,onChange:function(e){Ot(e.target.value),jt(1)}}))),r.createElement("div",{style:{overflowX:"auto"}},r.createElement("table",{style:en.table},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",{style:en.th,onClick:function(){return Jt("id")}},"No ","id"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("phn")}},"PHN ","phn"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("bht_No")}},"BHT No ","bht_No"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("patientName")}},"Patient Name ","patientName"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("gender")}},"Gender ","gender"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("age")}},"Age ","age"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th},"Remarks"),r.createElement("th",{style:en.th},"Action"))),r.createElement("tbody",null,Be&&0===Ie.length?r.createElement("tr",null,r.createElement("td",{colSpan:8,style:E(x({},en.td),{textAlign:"center",padding:"20px"})},"Loading ward patients...")):0===Qt.length?r.createElement("tr",null,r.createElement("td",{colSpan:8,style:E(x({},en.td),{textAlign:"center",padding:"20px"})},"No patients found in this ward.")):Qt.map(function(e,t){return r.createElement("tr",{key:e.id,style:en.tr,onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f1f8e9"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="white"}},r.createElement("td",{style:en.td},$t+t+1),r.createElement("td",{style:E(x({},en.td),{color:"#28a745",fontWeight:"bold"})},e.phn||"No Data"),r.createElement("td",{style:E(x({},en.td),{fontWeight:"bold"})},e.bht_No||"No Data"),r.createElement("td",{style:en.td},e.patientName),r.createElement("td",{style:en.td},e.gender),r.createElement("td",{style:en.td},e.age),r.createElement("td",{style:en.td},e.remarks||"-"),r.createElement("td",{style:en.td},r.createElement("button",{style:{backgroundColor:"#ffc107",color:"#212529",border:"none",padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontSize:"12px",fontWeight:"bold"},onClick:function(){return function(e){return h(function(){var t,n,r,l,a,o,i;return k(this,function(c){switch(c.label){case 0:if(j({phn:e.phn,fullName:e.patientName||"N/A",bhtNo:e.bht_No||"N/A",gender:e.gender||"N/A",dateOfBirth:"N/A",age:e.age||"N/A",nicNo:"N/A",address:"N/A",admissionType:e.admission_type||"N/A",admissionDate:e.admission_date||"N/A",admissionTime:e.admission_time||"N/A",ward:"N/A",guardianName:e.guardian_name||"N/A",guardianContact:"N/A",guardianNIC:"N/A",guardianRelation:"N/A",guardianAddress:"N/A"}),Le(e.encounteruuid),Ge(e.patientuuid||""),He(e.bht_No||""),!e.encounteruuid||!Ae)return[3,12];c.label=1;case 1:return c.trys.push([1,11,,12]),[4,fetch("/openmrs/ws/rest/v1/warddischarge/loadinvestigations/".concat(Ae,"/").concat(e.encounteruuid))];case 2:return(t=c.sent()).ok?[4,t.json()]:[3,4];case 3:(n=c.sent())&&n.length>0?kt(n[0]):kt(null),c.label=4;case 4:return[4,fetch("/openmrs/ws/rest/v1/warddischarge/getlabtests/".concat(e.encounteruuid))];case 5:return(r=c.sent()).ok?[4,r.json()]:[3,7];case 6:l=c.sent(),At(l||[]),c.label=7;case 7:return[4,fetch("/openmrs/ws/rest/v1/warddischarge/getradiologytests/".concat(e.encounteruuid))];case 8:return(a=c.sent()).ok?[4,a.json()]:[3,10];case 9:o=c.sent(),Bt(o||[]),c.label=10;case 10:return[3,12];case 11:return i=c.sent(),console.error("Error fetching clinical data:",i),[3,12];case 12:return[2]}})})()}(e)}},"Select")))})))),Zt>1&&r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"20px"}},r.createElement("div",{style:{fontSize:"14px",color:"#555"}},"Showing ",$t+1," to ",Math.min(Xt,Kt.length)," of ",Kt.length," entries"),r.createElement("div",{style:{display:"flex",gap:"5px"}},r.createElement("button",{onClick:function(){return jt(function(e){return Math.max(e-1,1)})},disabled:1===Lt,style:{padding:"6px 12px",border:"1px solid #dee2e6",backgroundColor:1===Lt?"#f8f9fa":"white",cursor:1===Lt?"not-allowed":"pointer",borderRadius:"4px"}},"Previous"),Array.from({length:Zt},function(e,t){return t+1}).map(function(e){return r.createElement("button",{key:e,onClick:function(){return jt(e)},style:{padding:"6px 12px",border:"1px solid #dee2e6",backgroundColor:Lt===e?"#28a745":"white",color:Lt===e?"white":"#333",cursor:"pointer",borderRadius:"4px",fontWeight:Lt===e?"bold":"normal"}},e)}),r.createElement("button",{onClick:function(){return jt(function(e){return Math.min(e+1,Zt)})},disabled:Lt===Zt,style:{padding:"6px 12px",border:"1px solid #dee2e6",backgroundColor:Lt===Zt?"#f8f9fa":"white",cursor:Lt===Zt?"not-allowed":"pointer",borderRadius:"4px"}},"Next")))),L&&r.createElement(r.Fragment,null,r.createElement("h2",{style:en.sectionTitle},"Patient Information"),r.createElement("div",{style:{backgroundColor:"#f9f9f9",padding:"15px",borderRadius:"4px",border:"1px solid #e0e0e0",marginBottom:"30px"}},r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",null,r.createElement("strong",null,"Full Name:")," ",L.fullName||"No Data"),r.createElement("div",null,r.createElement("strong",null,"Gender:")," ",L.gender||"No Data"),r.createElement("div",null,r.createElement("strong",null,"BHT No:")," ",L.bhtNo||"No Data"),r.createElement("div",null,r.createElement("strong",null,"Age:")," ",L.age||"No Data"),r.createElement("div",null,r.createElement("strong",null,"Admission Date:")," ",L.admissionDate||"No Data"),r.createElement("div",null,r.createElement("strong",null,"Admission Time:")," ",L.admissionTime||"No Data"),r.createElement("div",{style:{gridColumn:"span 2"}},r.createElement("strong",null,"Admission Type:")," ",L.admissionType||"No Data"))),(Ct||Nt.length>0||Dt.length>0)&&r.createElement("div",{style:{marginBottom:"30px",padding:"15px",backgroundColor:"#fff3cd",borderRadius:"4px",border:"1px solid #ffeeba"}},r.createElement("h2",{style:E(x({},en.sectionTitle),{color:"#856404",borderBottomColor:"#856404",marginTop:0})},"Clinical Investigations"),r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",null,Dt.length>0&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Radiology Tests:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Dt.map(function(e,t){return r.createElement("li",{key:t},e.codeDisplay)}))),(null==Ct?void 0:Ct.investigations)&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Investigations:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Ct.investigations.split("\n").filter(Boolean).map(function(e,t){return r.createElement("li",{key:t},e.trim())}))),(null==Ct?void 0:Ct.patientConditions)&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Patient Condition:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Ct.patientConditions.split("\n").filter(Boolean).map(function(e,t){return r.createElement("li",{key:t},e.trim())})))),r.createElement("div",null,Nt.length>0&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Lab Tests:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Nt.map(function(e,t){return r.createElement("li",{key:t},e.value)}))),(null==Ct?void 0:Ct.specialInvestigations)&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Special Investigations:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Ct.specialInvestigations.split("\n").filter(Boolean).map(function(e,t){return r.createElement("li",{key:t},e.trim())}))),((null==Ct?void 0:Ct.presentingComplains)||(null==Ct?void 0:Ct.history)||(null==Ct?void 0:Ct.examinationfindings)||(null==Ct?void 0:Ct.tratments))&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"History & Findings:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},[null==Ct?void 0:Ct.presentingComplains,null==Ct?void 0:Ct.history,null==Ct?void 0:Ct.examinationfindings,null==Ct?void 0:Ct.tratments].filter(Boolean).map(function(e){return null==e?void 0:e.split("\n").filter(Boolean).map(function(t,n){return r.createElement("li",{key:n+e},t.trim())})})))))),r.createElement("h2",{style:en.sectionTitle},"Discharge Details"),r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Discharge Date ",r.createElement("span",{style:{color:"red"}},"*")),r.createElement("input",{type:"date",style:en.input,value:V,onChange:function(e){return Y(e.target.value)},required:!0})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Discharge Time ",r.createElement("span",{style:{color:"red"}},"*")),r.createElement("input",{type:"time",style:en.input,value:K,onChange:function(e){return X(e.target.value)},required:!0})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Discharge Type ",r.createElement("span",{style:{color:"red"}},"*")),r.createElement("select",{style:en.select,value:Q,onChange:function(e){return Z(e.target.value)},required:!0},r.createElement("option",{value:"0"},"-- Select Discharge Type --"),r.createElement("option",{value:"alive"},"Alive"),r.createElement("option",{value:"death"},"Death"),r.createElement("option",{value:"missing"},"Missing"),r.createElement("option",{value:"lama"},"LAMA (Left Against Medical Advice)"))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Medical-Legal Case"),r.createElement("select",{style:en.select,value:te,onChange:function(e){return ne(e.target.value)}},r.createElement("option",{value:"0"},"-- Select --"),r.createElement("option",{value:"yes"},"Yes"),r.createElement("option",{value:"no"},"No")))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("h2",{style:en.sectionTitle},"Diagnosis"),r.createElement("div",{style:E(x({},en.inputGroup),{position:"relative"})},r.createElement("label",{style:en.label},"Search and Add Diagnosis (ICD-10)"),r.createElement("input",{type:"text",style:en.input,placeholder:"Type diagnosis to search...",value:ht,onChange:function(e){return t=e.target.value,h(function(){var e,n,r;return k(this,function(l){switch(l.label){case 0:if(bt(t),!(t.length>2))return[3,7];l.label=1;case 1:return l.trys.push([1,5,,6]),[4,fetch("/openmrs/ws/rest/v1/warddischarge/geticdlist/".concat(t))];case 2:return(e=l.sent()).ok?[4,e.json()]:[3,4];case 3:n=l.sent(),vt(n),l.label=4;case 4:return[3,6];case 5:return r=l.sent(),console.error("Error fetching ICD list:",r),[3,6];case 6:return[3,8];case 7:vt([]),l.label=8;case 8:return[2]}})})();var t}}),Et.length>0&&r.createElement("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 8px rgba(0,0,0,0.1)"}},Et.map(function(e,t){return r.createElement("div",{key:t,style:{padding:"10px",cursor:"pointer",borderBottom:"1px solid #eee"},onClick:function(){return(t=e.disease_name||e[2]).trim()&&!ie.includes(t.trim())&&ce(S(ie).concat([t.trim()])),bt(""),void vt([]);var t},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f0f9ff"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="white"}},e.disease_name||e[2]," - ",e.disease_code||e[1])}))),r.createElement("div",{style:{marginTop:"15px",padding:"15px",backgroundColor:"#f9f9f9",border:"1px dashed #ccc",borderRadius:"4px",minHeight:"80px"}},0===ie.length?r.createElement("p",{style:{textAlign:"center",color:"#999",fontStyle:"italic"}},"Added diagnoses will appear here"):r.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px"}},ie.map(function(e,t){return r.createElement("span",{key:t,style:{backgroundColor:"#28a745",color:"white",padding:"8px 12px",borderRadius:"20px",fontSize:"14px",display:"inline-flex",alignItems:"center",gap:"8px"}},e,r.createElement("button",{onClick:function(){return function(e){ce(ie.filter(function(t,n){return n!==e}))}(t)},style:{background:"none",border:"none",color:"white",cursor:"pointer",fontSize:"16px",padding:0}},"×"))})))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Medical Remarks"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"80px",resize:"vertical"}),placeholder:"Enter any additional medical remarks...",value:le,onChange:function(e){return ae(e.target.value)}}))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",borderBottom:"2px solid #007bff",paddingBottom:"10px"}},r.createElement("h2",{style:E(x({},en.sectionTitle),{borderBottom:"none",marginBottom:0,paddingBottom:0,color:"#007bff"})},"Prescriptions"),r.createElement("button",{onClick:function(){return pt(!ut)},style:en.buttonSecondary},ut?"Close Prescribing":"+ Add Prescription")),ut&&r.createElement("div",{style:{backgroundColor:"#f0f8ff",padding:"20px",borderRadius:"8px",border:"1px solid #cce5ff",marginBottom:"20px"}},r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",{style:E(x({},en.inputGroup),{position:"relative"})},r.createElement("label",{style:en.label},"Search Drug"),r.createElement("input",{type:"text",style:en.input,placeholder:"Type drug name to search...",value:ct.drugName,onChange:function(e){return t=e.target.value,h(function(){var e,n,r;return k(this,function(l){switch(l.label){case 0:if(st(E(x({},ct),{drugName:t})),!(t.length>2))return[3,7];l.label=1;case 1:return l.trys.push([1,5,,6]),[4,fetch("/openmrs/ws/rest/v1/concept?q=".concat(t))];case 2:return(e=l.sent()).ok?[4,e.json()]:[3,4];case 3:n=l.sent(),yt(n.results||[]),l.label=4;case 4:return[3,6];case 5:return r=l.sent(),console.error("Error fetching drugs:",r),[3,6];case 6:return[3,8];case 7:yt([]),l.label=8;case 8:return[2]}})})();var t}}),gt.length>0&&r.createElement("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 8px rgba(0,0,0,0.1)"}},gt.map(function(e,t){return r.createElement("div",{key:t,style:{padding:"10px",cursor:"pointer",borderBottom:"1px solid #eee"},onClick:function(){st(E(x({},ct),{drugName:e.display,druguuid:e.uuid})),yt([])},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f0f9ff"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="white"}},e.display)}))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Dosage"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g. 500mg",value:ct.dosage,onChange:function(e){return st(E(x({},ct),{dosage:e.target.value}))}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Frequency"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g. bd, tds",value:ct.frequency,onChange:function(e){return st(E(x({},ct),{frequency:e.target.value}))}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Duration / Period"),r.createElement("div",{style:{display:"flex",gap:"10px"}},r.createElement("input",{type:"text",style:E(x({},en.input),{flex:1}),placeholder:"e.g. 5",value:ct.period,onChange:function(e){return st(E(x({},ct),{period:e.target.value}))}}),r.createElement("select",{style:E(x({},en.select),{flex:1}),value:ct.periodType,onChange:function(e){return st(E(x({},ct),{periodType:e.target.value}))}},r.createElement("option",{value:""},"--Type--"),r.createElement("option",{value:"Days"},"Days"),r.createElement("option",{value:"Weeks"},"Weeks"),r.createElement("option",{value:"Months"},"Months")))),r.createElement("div",{style:E(x({},en.inputGroup),{gridColumn:"span 2"})},r.createElement("label",{style:en.label},"Comment / Instructions"),r.createElement("input",{type:"text",style:en.input,value:ct.comment,onChange:function(e){return st(E(x({},ct),{comment:e.target.value}))}}))),r.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"15px"}},r.createElement("button",{onClick:function(){ct.drugName&&(ot(S(at).concat([ct])),st({druguuid:"",drugName:"",drugtype:"",dosage:"",frequency:"",period:"",periodType:"",comment:"",markasoutdoor:"no"}),yt([]))},style:en.buttonSecondary},"Add to List"))),at.length>0&&r.createElement("div",{style:{overflowX:"auto",marginBottom:"20px"}},r.createElement("table",{style:en.table},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",{style:en.th},"Drug"),r.createElement("th",{style:en.th},"Dosage"),r.createElement("th",{style:en.th},"Frequency"),r.createElement("th",{style:en.th},"Duration"),r.createElement("th",{style:en.th},"Instructions"),r.createElement("th",{style:en.th},"Action"))),r.createElement("tbody",null,at.map(function(e,t){return r.createElement("tr",{key:t},r.createElement("td",{style:en.td},r.createElement("strong",null,e.drugName)),r.createElement("td",{style:en.td},e.dosage),r.createElement("td",{style:en.td},e.frequency),r.createElement("td",{style:en.td},e.period," ",e.periodType),r.createElement("td",{style:en.td},e.comment),r.createElement("td",{style:en.td},r.createElement("button",{onClick:function(){return ot(at.filter(function(e,n){return n!==t}))},style:{background:"none",border:"none",color:"#dc3545",cursor:"pointer",fontSize:"14px",fontWeight:"bold"}},"Remove")))}))))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("h2",{style:en.sectionTitle},"Clinic Referral"),r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",{style:E(x({},en.inputGroup),{position:"relative"})},r.createElement("label",{style:en.label},"Referring Clinic"),r.createElement("div",{style:{position:"relative"}},r.createElement("input",{type:"text",style:en.input,placeholder:"Search and select clinic...",value:ve||(null===(e=be.find(function(e){return e.uuid===pe}))||void 0===e?void 0:e.name)||"",onChange:function(e){Se(e.target.value),we(!0),""===e.target.value&&me("0")},onFocus:function(){return we(!0)}}),r.createElement(l.A,{size:18,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",color:"#999"}})),ke&&r.createElement("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:100,backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",marginTop:"5px"}},Pt.length>0?Pt.map(function(e,t){return r.createElement("div",{key:t,style:{padding:"12px 15px",cursor:"pointer",borderBottom:"1px solid #eee",backgroundColor:pe===e.uuid?"#e8f5e9":"transparent",fontWeight:pe===e.uuid?"bold":"normal"},onClick:function(){me(e.uuid),Se(e.name),we(!1)},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f1f8e9"},onMouseLeave:function(t){return t.currentTarget.style.backgroundColor=pe===e.uuid?"#e8f5e9":"white"}},e.name)}):r.createElement("div",{style:{padding:"15px",textAlign:"center",color:"#999"}},"No clinics found"))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Referral Remarks"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"80px",resize:"vertical"}),placeholder:"Enter referral notes...",value:ye,onChange:function(e){return fe(e.target.value)}})))),r.createElement("div",{style:{marginTop:"30px",padding:"20px",border:"1px dashed #17a2b8",borderRadius:"4px",backgroundColor:"#f0f9ff"}},r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"},onClick:function(){return Je(!Ye)}},r.createElement("h2",{style:E(x({},en.sectionTitle),{marginBottom:0,borderBottom:"none"})},"New Born Baby Details"),Ye?r.createElement(a.A,{size:24}):r.createElement(o.A,{size:24})),Ye&&r.createElement("div",{style:{marginTop:"20px"}},r.createElement("div",{style:{display:"flex",gap:"20px",marginBottom:"20px"}},r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Number of Babies"),r.createElement("input",{type:"number",style:en.input,min:"0",max:"5",value:Xe,onChange:function(e){return $e(parseInt(e.target.value)||0)}})),r.createElement("div",{style:{display:"flex",alignItems:"flex-end"}},r.createElement("button",{onClick:function(){for(var e=[],t=1;t<=Xe;t++)e.push({babyNumber:t,birthChitNo:"",discNo:"",fatherName:"",gender:"0",birthWeight:"",poa:"",apgarScore:"",apgar1:"",apgar5:"",apgar10:"",motherBloodGroup:"",babyBloodGroup:"",sourceOfPatient:"",indicationForAdmission:"",weightOnAdmission:"",ageOnAdmission:"",eed:"",length:"",ofc:"",growthStatus:"",motherAge:"",parity:"",antenatalProblems:"",maternalMedications:"",prom:"",liquor:"",maternalFever:!1,resuscitationRequired:!1,intubationAge:"",totalVentilatorySupport:"",pip:"",peep:"",o2Concentration:"",phototherapy:{fromDay:"",toDay:""},ivFluids:{fromDay:"",toDay:""},enteralFeeds:{startedDay:"",dischargeTolerating:"",hourly:""},inotropes:{requiredDay:"",omittedDay:""},o2Therapy:{requiredDay:"",omittedDay:""},hematology:{wbc:"",n:"",plt:"",hb:"",sbr_i:"",sbr_d:"",crp:""},microbiological:"",radiological:"",antibiotics:[],otherFindings:"",dischargeWeight:"",dischargeOfc:"",vitaminK:"",bcgGiven:!1,dischargeExaminationDone:"",ropScreeningDate:"",cranialUsScanDate:"",hearingAssessmentDate:"",referredToMohWeeks:"",referredToLocalHospital:"",referredToSpecialist:"",medicalOfficerName:"",deliveryDate:"",modeOfDelivery:"0",deliveredBy:"",maternalComplications:"",abnormalities:"",other:"",checklist:{episiotomy:"",bodyTemperature:"",prePregnancyScreening:"",vaginalExamination:"",infection:"",familyPlanning:"",dangerSignals:"",breastFeeding:"",vitAMegadose:"",rubellaImmunization:"",antiDAntibodies:"",diagnosisCard:"",chdrCompleted:"",prescription:"",referredToMidwife:""}});et(e)},style:en.buttonSecondary},"Add Babies"))),Ze.map(function(e,t){return r.createElement("div",{key:t,style:{backgroundColor:"white",padding:"20px",marginBottom:"20px",border:"1px solid #dee2e6",borderRadius:"4px"}},r.createElement("h3",{style:{fontSize:"18px",fontWeight:"bold",color:"#17a2b8",marginBottom:"20px",paddingBottom:"10px",borderBottom:"2px solid #17a2b8"}},"Baby ",e.babyNumber),r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Birth Chit No"),r.createElement("input",{type:"text",style:en.input,value:e.birthChitNo,onChange:function(e){return Ft(t,"birthChitNo",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Disc No"),r.createElement("input",{type:"text",style:en.input,value:e.discNo,onChange:function(e){return Ft(t,"discNo",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Name of the Father"),r.createElement("input",{type:"text",style:en.input,value:e.fatherName,onChange:function(e){return Ft(t,"fatherName",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Baby Gender"),r.createElement("select",{style:en.select,value:e.gender,onChange:function(e){return Ft(t,"gender",e.target.value)}},r.createElement("option",{value:"0"},"--Select--"),r.createElement("option",{value:"male"},"Male"),r.createElement("option",{value:"female"},"Female"))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Birth Weight (kg)"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g., 3.2",value:e.birthWeight,onChange:function(e){return Ft(t,"birthWeight",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"POA (Weeks)"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g., 38",value:e.poa,onChange:function(e){return Ft(t,"poa",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Apgar Score"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g., 9/10",value:e.apgarScore,onChange:function(e){return Ft(t,"apgarScore",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Date of Delivery"),r.createElement("input",{type:"date",style:en.input,value:e.deliveryDate,onChange:function(e){return Ft(t,"deliveryDate",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Mode of Delivery"),r.createElement("select",{style:en.select,value:e.modeOfDelivery,onChange:function(e){return Ft(t,"modeOfDelivery",e.target.value)}},r.createElement("option",{value:"0"},"--Select--"),r.createElement("option",{value:"VD"},"VD (Vaginal Delivery)"),r.createElement("option",{value:"Forceps"},"Forceps"),r.createElement("option",{value:"Vacuum"},"Vacuum"),r.createElement("option",{value:"LSCS"},"LSCS (C-Section)"))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Delivered By"),r.createElement("input",{type:"text",style:en.input,placeholder:"Doctor/Midwife name",value:e.deliveredBy,onChange:function(e){return Ft(t,"deliveredBy",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Maternal Complications"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"60px",resize:"vertical"}),placeholder:"Any complications...",value:e.maternalComplications,onChange:function(e){return Ft(t,"maternalComplications",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Abnormalities Detected"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"60px",resize:"vertical"}),placeholder:"Any abnormalities...",value:e.abnormalities,onChange:function(e){return Ft(t,"abnormalities",e.target.value)}}))),r.createElement("div",{style:x({marginTop:"20px"},en.inputGroup)},r.createElement("label",{style:en.label},"Any Other Information"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"60px",resize:"vertical"}),placeholder:"Additional notes...",value:e.other,onChange:function(e){return Ft(t,"other",e.target.value)}})),r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",color:"#28a745",marginTop:"30px",marginBottom:"15px"}},"Discharge Checklist"),r.createElement("div",{style:{overflowX:"auto"}},r.createElement("table",{style:{width:"100%",borderCollapse:"collapse",border:"1px solid #dee2e6"}},r.createElement("thead",null,r.createElement("tr",{style:{backgroundColor:"#f8f9fa"}},r.createElement("th",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"left",fontWeight:"bold",width:"60%"}},"Item"),r.createElement("th",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"center",fontWeight:"bold",width:"20%"}},"Yes"),r.createElement("th",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"center",fontWeight:"bold",width:"20%"}},"No"))),r.createElement("tbody",null,[{key:"episiotomy",label:"Episiotomy"},{key:"bodyTemperature",label:"Body Temperature Normal for last 2 Days"},{key:"prePregnancyScreening",label:"Pre-pregnancy screening done"},{key:"vaginalExamination",label:"Vaginal examination done to check packs"},{key:"infection",label:"Epis/Tear/LSCS infection check"},{key:"familyPlanning",label:"Family planning discussed"},{key:"dangerSignals",label:"Post partum danger signals explained"},{key:"breastFeeding",label:"Breast feeding established"},{key:"vitAMegadose",label:"Vit.A Megadose given"},{key:"rubellaImmunization",label:"Rubella Immunization given"},{key:"antiDAntibodies",label:"Anti-D antibodies given if indicated"},{key:"diagnosisCard",label:"Diagnosis card given if indicated"},{key:"chdrCompleted",label:"CHDR completed and handed over"},{key:"prescription",label:"Prescription given if needed"},{key:"referredToMidwife",label:"Referred to the field public health midwife"}].map(function(n){return r.createElement("tr",{key:n.key},r.createElement("td",{style:{border:"1px solid #dee2e6",padding:"12px",fontWeight:"500"}},n.label),r.createElement("td",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"center"}},r.createElement("input",{type:"checkbox",checked:"yes"===e.checklist[n.key],onChange:function(e){return qt(t,n.key,e.target.checked?"yes":"")},style:{transform:"scale(1.2)",cursor:"pointer"}})),r.createElement("td",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"center"}},r.createElement("input",{type:"checkbox",checked:"no"===e.checklist[n.key],onChange:function(e){return qt(t,n.key,e.target.checked?"no":"")},style:{transform:"scale(1.2)",cursor:"pointer"}})))})))),r.createElement("div",{style:{textAlign:"right",marginTop:"20px"}},r.createElement("button",{style:E(x({},en.buttonSecondary),{backgroundColor:"#17a2b8"}),onClick:function(){return function(e){return h(function(){return k(this,function(t){return rt(e),setTimeout(function(){return h(function(){var e,t,n,r,l,a,o,i;return k(this,function(c){switch(c.label){case 0:return I.current?(e=new p.uE({orientation:"portrait",unit:"mm",format:"a4"}),[4,g()(I.current,{scale:2,useCORS:!0,logging:!1,backgroundColor:"#ffffff"})]):[2];case 1:return t=c.sent(),n=t.toDataURL("image/png"),r=e.getImageProperties(n),l=e.internal.pageSize.getWidth(),a=r.height*l/r.width,e.addImage(n,"PNG",0,0,l,a),o=e.output("blob"),i=URL.createObjectURL(o),window.open(i,"_blank"),rt(null),[2]}})})()},100),[2]})})()}(e)}},r.createElement(i.A,{size:18,style:{marginRight:"8px",verticalAlign:"middle"}}),"Print Neonatal Card")))}))),r.createElement("div",{style:en.buttonContainer},r.createElement("button",{onClick:function(){return h(function(){var e,t,n,r,l,a,o,i,c,s,d,p,m,g,y,f,h,b,v,S;return k(this,function(C){switch(C.label){case 0:if(!V||!K)return u().fire({title:"Validation Error!",text:"Please fill in all required fields!",icon:"error",confirmButtonColor:"#dc3545"}),[2];if(!L)return u().fire({title:"Validation Error!",text:"Please search for a patient first!",icon:"error",confirmButtonColor:"#dc3545"}),[2];if("0"===Q)return u().fire({title:"Validation Error!",text:"Please select a discharge type!",icon:"error",confirmButtonColor:"#dc3545"}),[2];C.label=1;case 1:return C.trys.push([1,22,23,24]),ze(!0),e="demo-user",t=0,"0"===pe?[3,4]:[4,fetch("/openmrs/ws/rest/v1/warddischarge/saveclinic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phn:L.phn,clinic_uuid:pe,remarks:ye,cby:e})})];case 2:return(n=C.sent()).ok?[4,n.json()]:[3,4];case 3:r=C.sent(),t=r.id||0,C.label=4;case 4:return l=ie.length>0?encodeURIComponent(ie.join("@@@@")):"null",a=le?encodeURIComponent(le):"null",[4,fetch("/openmrs/ws/rest/v1/warddischarge/savedischarge/".concat("0"===te?"no":te,"/").concat(Q,"/").concat(a,"/").concat(l,"/").concat(K,"/").concat(V,"/").concat(e,"/").concat(t,"/").concat(L.bhtNo,"/").concat(L.phn))];case 5:if(!C.sent().ok)throw new Error("Failed to save discharge record");o=!0,i=!1,c=void 0,C.label=6;case 6:C.trys.push([6,11,12,13]),s=at[Symbol.iterator](),C.label=7;case 7:return(o=(d=s.next()).done)?[3,10]:(p=d.value,[4,fetch("/openmrs/ws/rest/v1/warddischarge/prescribesave",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E(x({},p),{phn:L.phn,patientuuid:Me,encounteruuid:We,creator:e}))})]);case 8:C.sent(),C.label=9;case 9:return o=!0,[3,7];case 10:return[3,13];case 11:return v=C.sent(),i=!0,c=v,[3,13];case 12:try{o||null==s.return||s.return()}finally{if(i)throw c}return[7];case 13:m=!0,g=!1,y=void 0,C.label=14;case 14:C.trys.push([14,19,20,21]),f=Ze[Symbol.iterator](),C.label=15;case 15:return(m=(h=f.next()).done)?[3,18]:(b=h.value,[4,fetch("/openmrs/ws/rest/v1/warddischarge/savebabydetails",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E(x({},b),{phn:b.birthChitNo,motherphn:L.phn,encounteruuid:We,cby:e,location:Ae||"",episiotomy:b.checklist.episiotomy,bodytemperaturenormal:b.checklist.bodyTemperature,prepregnancyscreeningdone:b.checklist.prePregnancyScreening,vaginaldonecheck:b.checklist.vaginalExamination,infection:b.checklist.infection,familyplanningdiscussed:b.checklist.familyPlanning,postparturndangersignals:b.checklist.dangerSignals,breastfeeding:b.checklist.breastFeeding,vitAmegadose:b.checklist.vitAMegadose,rubella:b.checklist.rubellaImmunization,antidantibodies:b.checklist.antiDAntibodies,diagnosiscardgiven:b.checklist.diagnosisCard,chdrcompleted:b.checklist.chdrCompleted,prescription:b.checklist.prescription,referredtothefield:b.checklist.referredToMidwife}))})]);case 16:C.sent(),C.label=17;case 17:return m=!0,[3,15];case 18:return[3,21];case 19:return v=C.sent(),g=!0,y=v,[3,21];case 20:try{m||null==f.return||f.return()}finally{if(g)throw y}return[7];case 21:return u().fire({title:"Success!",text:"Patient discharge saved successfully!",icon:"success",confirmButtonColor:"#28a745"}),Vt(),Yt(),[3,24];case 22:return S=C.sent(),console.error("Save failed",S),u().fire({title:"Error!",text:"Failed to save discharge data.",icon:"error",confirmButtonColor:"#dc3545"}),[3,24];case 23:return ze(!1),[7];case 24:return[2]}})})()},style:en.buttonPrimary},r.createElement(c.A,{size:20,style:{marginRight:"8px",verticalAlign:"middle"}}),"Save Discharge"),r.createElement("button",{onClick:Vt,style:en.buttonDanger},r.createElement(s.A,{size:20,style:{marginRight:"8px",verticalAlign:"middle"}}),"Cancel"),r.createElement("button",{onClick:function(){return h(function(){var e,t,n,r,l,a,o,i;return k(this,function(c){switch(c.label){case 0:return L?P.current?(e=new p.uE({orientation:"portrait",unit:"mm",format:"a4"}),[4,g()(P.current,{scale:2,useCORS:!0,logging:!1,backgroundColor:"#ffffff"})]):[2]:(u().fire({title:"Error!",text:"Please select a patient first",icon:"error"}),[2]);case 1:return t=c.sent(),n=t.toDataURL("image/png"),r=e.getImageProperties(n),l=e.internal.pageSize.getWidth(),a=r.height*l/r.width,e.addImage(n,"PNG",0,0,l,a),o=e.output("blob"),i=URL.createObjectURL(o),window.open(i,"_blank"),[2]}})})()},style:en.buttonSecondary},r.createElement(i.A,{size:20,style:{marginRight:"8px",verticalAlign:"middle"}}),"Print Discharge Card")))),r.createElement("div",{style:en.printTemplateWrapper},r.createElement("div",{style:en.printTemplate,ref:P},r.createElement("div",{style:{maxWidth:"650px",margin:"0 auto",backgroundColor:"white",padding:"30px",border:"1px solid #000",minHeight:"900px",color:"black",fontFamily:"serif"}},r.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"10px"}},r.createElement("label",{style:{fontSize:"10px",textAlign:"left",lineHeight:"1.4"}},"වෛද්‍යවරයා හමුවීමට මෙම කාඩ් පත රැගෙන යන්න.",r.createElement("br",null),"வைத்தியரைச் சந்திக்கப் போகும்பொழுது මෙම அட்டையை எடுத்துச் செல்லவும்.",r.createElement("br",null),"Take this card when you visit the Doctor"),r.createElement("div",{style:{textAlign:"right",fontSize:"9px",fontWeight:"bold"}},"සෞඛ්‍ය 383අ",r.createElement("br",null),"சுகாதாரம் 383අ ",r.createElement("br",null),"Health 383A")),r.createElement("div",{style:{textAlign:"center",marginBottom:"20px"}},r.createElement("div",{style:{fontSize:"18px",fontWeight:"bold",margin:"2px 0"}},"රෝගීන් නිර්දේශන ලකුණු"),r.createElement("div",{style:{fontSize:"15px",margin:"2px 0"}},"நோய் නிருணய අட்டை"),r.createElement("div",{style:{fontSize:"13px",fontWeight:"bold",letterSpacing:"1px",margin:"2px 0"}},"DIAGNOSIS TICKET")),r.createElement("div",{style:{borderTop:"2px solid #000",paddingTop:"15px"}},r.createElement("div",{style:{display:"flex",marginBottom:"15px",borderBottom:"1px solid #000"}},r.createElement("div",{style:{width:"120px",fontSize:"10px",lineHeight:"1.2"}},"ප්‍රතිකාරයට පත්වන",r.createElement("br",null),"Name of Patient"),r.createElement("div",{style:{fontSize:"16px",flex:1,paddingLeft:"10px",fontWeight:"bold"}},null==L?void 0:L.fullName),r.createElement("div",{style:{width:"80px",borderLeft:"1px solid #000",paddingLeft:"10px"}},r.createElement("div",{style:{fontSize:"9px"}},"වයස/Age"),r.createElement("div",{style:{fontSize:"14px"}},null==L?void 0:L.age))),r.createElement("div",{style:{display:"flex",gap:"0",marginBottom:"15px"}},r.createElement("div",{style:{flex:1,display:"flex",borderBottom:"1px solid #000",paddingRight:"10px"}},r.createElement("div",{style:{width:"100px",fontSize:"10px"}},"ප්‍රදේශ/Ward"),r.createElement("div",{style:{fontSize:"14px",flex:1}},(null===(t=G.find(function(e){return e[0]===F}))||void 0===t?void 0:t[1])||"N/A")),r.createElement("div",{style:{flex:1,display:"flex",borderBottom:"1px solid #000",borderLeft:"1px solid #000",paddingLeft:"10px"}},r.createElement("div",{style:{width:"100px",fontSize:"10px"}},"ප්‍රමාණයන් අංකය/Reg. No."),r.createElement("div",{style:{fontSize:"14px",flex:1,fontWeight:"bold"}},null==L?void 0:L.bhtNo))),r.createElement("div",{style:{display:"flex",gap:"0",marginBottom:"25px"}},r.createElement("div",{style:{flex:1,display:"flex",borderBottom:"1px solid #000",paddingRight:"10px"}},r.createElement("div",{style:{width:"100px",fontSize:"10px"}},"ඇතුළත් කළ දිනය/Admission"),r.createElement("div",{style:{fontSize:"14px",flex:1}},null==L?void 0:L.admissionDate)),r.createElement("div",{style:{flex:1,display:"flex",borderBottom:"1px solid #000",borderLeft:"1px solid #000",paddingLeft:"10px"}},r.createElement("div",{style:{width:"100px",fontSize:"10px"}},"පිට වූ දිනය/Discharge"),r.createElement("div",{style:{fontSize:"14px",flex:1}},V)))),r.createElement("div",{style:{margin:"20px 0"}},r.createElement("div",{style:{fontSize:"11px",fontWeight:"bold",marginBottom:"5px"}},"රෝගීන් පරීක්ෂණයන් සහ ප්‍රතිකාර / Investigations and Treatments"),r.createElement("div",{style:{border:"2px solid #000",padding:"15px",minHeight:"300px",fontSize:"13px",lineHeight:"1.6"}},r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",null,"DIAGNOSIS:")," ",ie.join(", ")||"N/A"),r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",null,"CLINICAL NOTES & REMARKS:"),r.createElement("br",null),le||"None recorded."),r.createElement("div",null,r.createElement("strong",null,"MEDICATIONS:")),at.map(function(e,t){return r.createElement("div",{key:t,style:{marginLeft:"10px"}},"• ",e.drugName," - ",e.dosage," ",e.frequency," (",e.period," ",e.periodType,")")}))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("div",{style:{marginBottom:"15px",fontSize:"12px"}},"Referred to ",r.createElement("span",{style:{borderBottom:"1px solid #000",padding:"0 30px",fontWeight:"bold"}},"0"!==pe?(null===(n=be.find(function(e){return e.uuid===pe}))||void 0===n?void 0:n.name)||pe:"..........................")," Clinic"),r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"}},r.createElement("div",{style:{border:"1px solid #000",padding:"5px"}},r.createElement("table",{style:{borderCollapse:"collapse",fontSize:"10px",textAlign:"center"}},r.createElement("tbody",null,r.createElement("tr",null,["M","TU","WD","TH","FR","SA","SU"].map(function(e){return r.createElement("td",{key:e,style:{border:"1px solid #000",padding:"4px",width:"25px"}},e)})),r.createElement("tr",null,["ස.","අ.","බ.","බ්‍ර.","සි.","සෙ.","ඉ."].map(function(e){return r.createElement("td",{key:e,style:{border:"1px solid #000",padding:"4px"}},e)}))))),r.createElement("div",{style:{textAlign:"center",marginTop:"10px"}},r.createElement("div",{style:{borderBottom:"1px solid #000",width:"220px",marginBottom:"5px"}}),r.createElement("div",{style:{fontSize:"10px",fontWeight:"bold"}},"Physician / Surgeon Signature")))))),nt&&r.createElement("div",{style:en.printTemplate,ref:I},r.createElement("div",{style:{maxWidth:"800px",margin:"0 auto",backgroundColor:"white",padding:"40px",border:"2px solid #000",color:"black",fontFamily:"serif"}},r.createElement("h1",{style:{fontSize:"24px",textAlign:"center",textDecoration:"underline",marginBottom:"30px",fontWeight:"bold"}},"NEONATAL DIAGNOSIS CARD"),r.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"20px",marginBottom:"20px"}},r.createElement("div",{style:{fontSize:"14px",lineHeight:"2"}},r.createElement("div",null,r.createElement("strong",null,"Hospital:")," ",qe),r.createElement("div",null,r.createElement("strong",null,"Mother's Name:")," ",null==L?void 0:L.fullName),r.createElement("div",null,r.createElement("strong",null,"Baby BHT No:")," ",nt.discNo),r.createElement("div",null,r.createElement("strong",null,"Sex:")," ",null===(d=nt.gender)||void 0===d?void 0:d.toUpperCase())),r.createElement("div",{style:{fontSize:"14px",lineHeight:"2"}},r.createElement("div",null,r.createElement("strong",null,"Date of Birth:")," ",nt.deliveryDate),r.createElement("div",null,r.createElement("strong",null,"Birth Weight:")," ",nt.birthWeight," g"),r.createElement("div",null,r.createElement("strong",null,"POA:")," ",nt.poa," weeks"),r.createElement("div",null,r.createElement("strong",null,"Discharge Date:")," ",V))),r.createElement("div",{style:{marginBottom:"25px"}},r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",borderBottom:"1px solid #000",marginBottom:"10px"}},"Apgar Score"),r.createElement("table",{style:{width:"300px",borderCollapse:"collapse",textAlign:"center"}},r.createElement("thead",null,r.createElement("tr",{style:{backgroundColor:"#eee"}},r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"1 min"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"5 min"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"10 min"))),r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:{border:"1px solid #000",padding:"10px",fontSize:"18px"}},nt.apgar1||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"10px",fontSize:"18px"}},nt.apgar5||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"10px",fontSize:"18px"}},nt.apgar10||"-"))))),r.createElement("div",{style:{marginBottom:"25px"}},r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",borderBottom:"1px solid #000",marginBottom:"10px"}},"Obstetric Details"),r.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"15px",fontSize:"13px"}},r.createElement("div",null,r.createElement("strong",null,"Mother's Age:")," ",nt.motherAge||"N/A"),r.createElement("div",null,r.createElement("strong",null,"Parity:")," ",nt.parity||"N/A"),r.createElement("div",{style:{gridColumn:"span 2"}},r.createElement("strong",null,"Antenatal Problems:")," ",nt.antenatalProblems||"None"),r.createElement("div",null,r.createElement("strong",null,"PROM:")," ",nt.prom||"No"),r.createElement("div",null,r.createElement("strong",null,"Liquor:")," ",nt.liquor||"Clear"))),r.createElement("div",{style:{marginBottom:"25px"}},r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",borderBottom:"1px solid #000",marginBottom:"10px"}},"Investigations (Haematology)"),r.createElement("table",{style:{width:"100%",borderCollapse:"collapse",textAlign:"center",fontSize:"12px"}},r.createElement("thead",null,r.createElement("tr",{style:{backgroundColor:"#eee"}},r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"WBC"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"N%"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"Plt"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"Hb"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"CRP"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"SBR (I/D)"))),r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(m=nt.hematology)||void 0===m?void 0:m.wbc)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(y=nt.hematology)||void 0===y?void 0:y.n)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(f=nt.hematology)||void 0===f?void 0:f.plt)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(C=nt.hematology)||void 0===C?void 0:C.hb)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(w=nt.hematology)||void 0===w?void 0:w.crp)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(N=nt.hematology)||void 0===N?void 0:N.sbr_i)||"-","/",(null===(A=nt.hematology)||void 0===A?void 0:A.sbr_d)||"-"))))),r.createElement("div",{style:{marginBottom:"25px"}},r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",borderBottom:"1px solid #000",marginBottom:"10px"}},"Supportive Care & Medications"),r.createElement("div",{style:{fontSize:"13px",lineHeight:"1.8"}},r.createElement("div",null,r.createElement("strong",null,"Ventilatory Support:")," ",nt.totalVentilatorySupport||"0"," hrs (PIP: ",nt.pip||"-",", PEEP: ",nt.peep||"-",", O2: ",nt.o2Concentration||"-","%)"),r.createElement("div",null,r.createElement("strong",null,"Phototherapy:")," From Day ",(null===(T=nt.phototherapy)||void 0===T?void 0:T.fromDay)||"-"," to Day ",(null===(D=nt.phototherapy)||void 0===D?void 0:D.toDay)||"-"),r.createElement("div",null,r.createElement("strong",null,"IV Fluids:")," From Day ",(null===(B=nt.ivFluids)||void 0===B?void 0:B.fromDay)||"-"," to Day ",(null===(z=nt.ivFluids)||void 0===z?void 0:z.toDay)||"-"))),r.createElement("div",{style:{marginTop:"60px",display:"flex",justifyContent:"space-between"}},r.createElement("div",{style:{fontSize:"12px"}},"Printed Date: ",(new Date).toLocaleDateString()),r.createElement("div",{style:{textAlign:"center"}},r.createElement("div",{style:{borderBottom:"1px solid #000",width:"250px",marginBottom:"5px"}}),r.createElement("div",{style:{fontSize:"12px",fontWeight:"bold"}},"Medical Officer Signature")))))))},N=function(){return r.createElement(w,null)}}}]);
1
+ "use strict";(globalThis.webpackChunk_sasindi_ward_discharge=globalThis.webpackChunk_sasindi_ward_discharge||[]).push([[76],{44076(e,t,n){n.r(t),n.d(t,{default:()=>N});var r=n(16072),l=n(98445),a=n(72102),o=n(75107),i=n(89369),c=n(48852),s=n(48697),d=n(94948),u=n.n(d),p=(n(49336),n(41371)),m=n(20354),g=n.n(m);function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,l,a,o){try{var i=e[a](o),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,l)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){f(a,r,l,o,i,"next",e)}function i(e){f(a,r,l,o,i,"throw",e)}o(void 0)})}}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){b(e,t,n[t])})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,a=[],o=!0,i=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){i=!0,l=e}finally{try{o||null==n.return||n.return()}finally{if(i)throw l}}return a}}(e,t)||C(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 S(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(e)||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.")}()}function C(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function k(e,t){var n,r,l,a={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:c(0)}),i(o,"throw",{value:c(1)}),i(o,"return",{value:c(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(a=0)),a;)try{if(n=1,r&&(l=2&i[0]?r.return:i[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,i[1])).done)return l;switch(r=0,l&&(i=[2&i[0],l.value]),i[0]){case 0:case 1:l=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((l=(l=a.trys).length>0&&l[l.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!l||i[1]>l[0]&&i[1]<l[3])){a.label=i[1];break}if(6===i[0]&&a.label<l[1]){a.label=l[1],l=i;break}if(l&&a.label<l[2]){a.label=l[2],a.ops.push(i);break}l[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=l=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}const w=function(){var e,t,n,d,m,y,f,C,w,N,A,T,D,B,z,P=(0,r.useRef)(null),I=(0,r.useRef)(null),R=v((0,r.useState)(""),2),O=(R[0],R[1]),W=v((0,r.useState)(null),2),L=W[0],j=W[1],M=v((0,r.useState)([]),2),G=M[0],_=M[1],H=v((0,r.useState)("0"),2),F=H[0],q=H[1],U=v((0,r.useState)(""),2),V=U[0],Y=U[1],J=v((0,r.useState)(""),2),K=J[0],X=J[1],$=v((0,r.useState)("0"),2),Q=$[0],Z=$[1],ee=v((0,r.useState)("0"),2),te=ee[0],ne=ee[1],re=v((0,r.useState)(""),2),le=re[0],ae=re[1],oe=v((0,r.useState)([]),2),ie=oe[0],ce=oe[1],se=v((0,r.useState)(""),2),de=(se[0],se[1]),ue=v((0,r.useState)("0"),2),pe=ue[0],me=ue[1],ge=v((0,r.useState)(""),2),ye=ge[0],fe=ge[1],he=v((0,r.useState)([]),2),be=he[0],xe=he[1],Ee=v((0,r.useState)(""),2),ve=Ee[0],Se=Ee[1],Ce=v((0,r.useState)(!1),2),ke=Ce[0],we=Ce[1],Ne=v((0,r.useState)(null),2),Ae=Ne[0],Te=Ne[1],De=v((0,r.useState)(!1),2),Be=De[0],ze=De[1],Pe=v((0,r.useState)([]),2),Ie=Pe[0],Re=Pe[1],Oe=v((0,r.useState)(""),2),We=Oe[0],Le=Oe[1],je=v((0,r.useState)(""),2),Me=je[0],Ge=je[1],_e=v((0,r.useState)(""),2),He=(_e[0],_e[1]),Fe=v((0,r.useState)(""),2),qe=Fe[0],Ue=Fe[1],Ve=v((0,r.useState)(!1),2),Ye=Ve[0],Je=Ve[1],Ke=v((0,r.useState)(0),2),Xe=Ke[0],$e=Ke[1],Qe=v((0,r.useState)([]),2),Ze=Qe[0],et=Qe[1],tt=v((0,r.useState)(null),2),nt=tt[0],rt=tt[1],lt=v((0,r.useState)([]),2),at=lt[0],ot=lt[1],it=v((0,r.useState)({druguuid:"",drugName:"",drugtype:"",dosage:"",frequency:"",period:"",periodType:"",comment:"",markasoutdoor:"no"}),2),ct=it[0],st=it[1],dt=v((0,r.useState)(!1),2),ut=dt[0],pt=dt[1],mt=v((0,r.useState)([]),2),gt=mt[0],yt=mt[1],ft=v((0,r.useState)(""),2),ht=ft[0],bt=ft[1],xt=v((0,r.useState)([]),2),Et=xt[0],vt=xt[1],St=v((0,r.useState)(null),2),Ct=St[0],kt=St[1],wt=v((0,r.useState)([]),2),Nt=wt[0],At=wt[1],Tt=v((0,r.useState)([]),2),Dt=Tt[0],Bt=Tt[1];(0,r.useEffect)(function(){Ae&&zt(Ae)},[Ae]);var zt=function(e){return h(function(){var t,n,r;return k(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),[4,fetch("/openmrs/ws/rest/v1/warddischarge/clinic/".concat(e))];case 1:return(t=l.sent()).ok?[4,t.json()]:[3,3];case 2:n=l.sent(),Array.isArray(n)&&xe(n.map(function(e){return{uuid:e[0],name:e[1]}})),l.label=3;case 3:return[3,5];case 4:return r=l.sent(),console.error("Error fetching clinics:",r),[3,5];case 5:return[2]}})})()},Pt=(0,r.useMemo)(function(){return be.filter(function(e){return e.name.toLowerCase().includes(ve.toLowerCase())})},[be,ve]),It=v((0,r.useState)(""),2),Rt=It[0],Ot=It[1],Wt=v((0,r.useState)(1),2),Lt=Wt[0],jt=Wt[1],Mt=v((0,r.useState)(10),1)[0],Gt=v((0,r.useState)(null),2),_t=Gt[0],Ht=Gt[1];(0,r.useEffect)(function(){var e=new Date,t=e.toISOString().split("T")[0],n="".concat(String(e.getHours()).padStart(2,"0"),":").concat(String(e.getMinutes()).padStart(2,"0"));Y(t),X(n),h(function(){var e,t,n,r,l,a,o;return k(this,function(i){switch(i.label){case 0:return i.trys.push([0,8,,9]),[4,fetch("/openmrs/ws/rest/v1/session")];case 1:return[4,i.sent().json()];case 2:return t=i.sent(),n=t.user.person.uuid,r=(null===(e=t.sessionLocation)||void 0===e?void 0:e.uuid)||null,Te(r),r?[4,fetch("/openmrs/ws/rest/v1/location/".concat(r))]:[3,5];case 3:return[4,i.sent().json()];case 4:l=i.sent(),Ue(l.display||l.name||"Unknown Hospital"),i.label=5;case 5:return[4,fetch("/openmrs/ws/rest/v1/wardmanagement/loadwardbyperson/".concat(n))];case 6:return[4,i.sent().json()];case 7:return a=i.sent(),_(a||[]),[3,9];case 8:return o=i.sent(),console.error("Error fetching wards:",o),[3,9];case 9:return[2]}})})()},[]);var Ft=function(e,t,n){et(function(r){var l=S(r);if(t.startsWith("checklist.")){var a=t.split(".")[1];l[e]=E(x({},l[e]),{checklist:E(x({},l[e].checklist),b({},a,n))})}else l[e]=E(x({},l[e]),b({},t,n));return l})},qt=function(e,t,n){Ft(e,"checklist.".concat(t),n)},Ut=function(e){return h(function(){var t,n,r,l,a;return k(this,function(o){switch(o.label){case 0:if(t=e.target.value,q(t),"0"===t)return Re([]),[2];o.label=1;case 1:return o.trys.push([1,7,8,9]),ze(!0),[4,fetch("/openmrs/ws/rest/v1/wardmanagement/loadwardperson?wardUuids=".concat(t,"&locationUuid=").concat(Ae))];case 2:if(!(n=o.sent()).ok)throw new Error("Failed to fetch ward patients");return[4,n.json()];case 3:return(r=o.sent())&&r.length>0?[4,Promise.all(r.map(function(e){return h(function(){var t,n,r,l,a,o,i;return k(this,function(c){switch(c.label){case 0:return c.trys.push([0,5,,6]),[4,fetch("/openmrs/ws/rest/v1/opd/phn/".concat(e.phn))];case 1:case 3:return[4,c.sent().json()];case 2:return t=c.sent(),[4,fetch("/openmrs/ws/rest/v1/patient/".concat(t.patientuuid))];case 4:return n=c.sent(),r=n.person,l={M:"Male",F:"Female",O:"Other"}[r.gender]||r.gender,a=r.age,o=e.remarks&&"null"!==e.remarks&&""!==e.remarks?e.remarks:"",[2,{id:e.id,phn:e.phn,encounteruuid:e.encounteruuid,bht_No:e.bht_No,remarks:o,guardian_name:e.guardian_name||"",patientName:t.fullName||"N/A",gender:l||"N/A",age:a||"N/A",admission_type:e.admission_type||"N/A",admission_date:e.admission_date||"N/A",admission_time:e.admission_time||"N/A",patientuuid:t.patientuuid}];case 5:return i=c.sent(),console.error("Error fetching patient data for PHN ".concat(e.phn,":"),i),[2,{id:e.id,phn:e.phn,encounteruuid:e.encounteruuid,bht_No:e.bht_No,remarks:e.remarks||"",guardian_name:e.guardian_name||"",patientName:"Error loading",gender:"N/A",age:"N/A",patientuuid:""}];case 6:return[2]}})})()}))]:[3,5];case 4:return l=o.sent(),Re(l),[3,6];case 5:Re([]),o.label=6;case 6:return[3,9];case 7:return a=o.sent(),console.error("Error fetching ward patients:",a),Re([]),[3,9];case 8:return ze(!1),[7];case 9:return[2]}})})()},Vt=function(){O(""),j(null),de(""),ce([]),ae(""),ne("0"),Z("0"),me("0"),fe(""),Je(!1),$e(0),et([]),ot([]),kt(null),At([]),Bt([]),bt(""),vt([]);var e=new Date,t=e.toISOString().split("T")[0],n="".concat(String(e.getHours()).padStart(2,"0"),":").concat(String(e.getMinutes()).padStart(2,"0"));Y(t),X(n)},Yt=function(){"0"!==F&&Ut({target:{value:F}})},Jt=function(e){var t="asc";_t&&_t.key===e&&"asc"===_t.direction&&(t="desc"),Ht({key:e,direction:t})},Kt=(0,r.useMemo)(function(){var e=Ie.filter(function(e){return e.patientName&&e.patientName.toLowerCase().includes(Rt.toLowerCase())||e.phn&&e.phn.toLowerCase().includes(Rt.toLowerCase())||e.bht_No&&e.bht_No.toLowerCase().includes(Rt.toLowerCase())});return null!==_t&&e.sort(function(e,t){var n=e[_t.key],r=t[_t.key];return n<r?"asc"===_t.direction?-1:1:n>r?"asc"===_t.direction?1:-1:0}),e},[Ie,Rt,_t]),Xt=Lt*Mt,$t=Xt-Mt,Qt=Kt.slice($t,Xt),Zt=Math.ceil(Kt.length/Mt),en={mainContainer:{width:"100%",backgroundColor:"#f5f5f5",padding:"20px",minHeight:"100vh",fontFamily:'"Open Sans", sans-serif'},card:{backgroundColor:"#ffffff",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)",padding:"20px",marginBottom:"20px"},sectionTitle:{fontSize:"18px",fontWeight:"bold",color:"#28a745",marginBottom:"20px",paddingBottom:"10px",borderBottom:"2px solid #28a745",marginTop:0},gridTwoColumn:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"20px"},inputGroup:{display:"flex",flexDirection:"column"},label:{fontSize:"14px",fontWeight:"bold",color:"#333",marginBottom:"10px"},input:{padding:"10px",border:"1px solid #ccc",borderRadius:"4px",width:"100%",boxSizing:"border-box",fontSize:"14px"},select:{padding:"10px",border:"1px solid #ccc",borderRadius:"4px",width:"100%",boxSizing:"border-box",fontSize:"14px",backgroundColor:"white"},buttonContainer:{display:"flex",justifyContent:"center",gap:"15px",marginTop:"30px"},buttonPrimary:{backgroundColor:"#28a745",color:"white",border:"none",padding:"10px 30px",borderRadius:"5px",cursor:"pointer",fontSize:"16px",fontWeight:"bold"},buttonSecondary:{backgroundColor:"#007bff",color:"white",border:"none",padding:"10px 30px",borderRadius:"5px",cursor:"pointer",fontSize:"16px",fontWeight:"bold"},buttonDanger:{backgroundColor:"#dc3545",color:"white",border:"none",padding:"10px 30px",borderRadius:"5px",cursor:"pointer",fontSize:"16px",fontWeight:"bold"},printTemplateWrapper:{position:"fixed",left:"-9999px",top:"0",zIndex:-1,pointerEvents:"none"},printTemplate:{width:"1000px",backgroundColor:"white",padding:"40px",color:"black"},table:{width:"100%",borderCollapse:"collapse",backgroundColor:"white",borderRadius:"8px",overflow:"hidden",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},th:{backgroundColor:"#f8f9fa",color:"#333",fontWeight:"bold",fontSize:"14px",padding:"12px",textAlign:"left",borderBottom:"2px solid #dee2e6",cursor:"pointer",userSelect:"none"},td:{fontSize:"14px",padding:"12px",color:"#555",borderBottom:"1px solid #eee"},tr:{transition:"background-color 0.2s"}};return r.createElement("div",{style:en.mainContainer},Be&&r.createElement("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3}},r.createElement("div",{style:{color:"white",fontSize:"18px"}},"Loading...")),r.createElement("div",{style:en.card},r.createElement("h2",{style:{fontSize:"24px",fontWeight:"bold",color:"#28a745",marginBottom:"20px",paddingBottom:"10px",borderBottom:"2px solid #28a745",marginTop:0}},"Ward Discharge",r.createElement("span",{style:{fontSize:"10px",color:"#912013",marginLeft:"16px",fontWeight:"bold"}},"PATIENT DISCHARGE MANAGEMENT"),r.createElement("button",{onClick:Yt,style:{marginLeft:"20px",backgroundColor:"#17a2b8",color:"white",border:"none",padding:"8px 16px",borderRadius:"4px",cursor:"pointer",fontSize:"14px",float:"right"}},"Refresh Patient List")),r.createElement("div",{style:{backgroundColor:"#f8f9fa",padding:"10px",marginBottom:"20px",border:"1px solid #dee2e6",borderRadius:"4px",fontSize:"12px"}},r.createElement("strong",null,"Hospital:")," ",qe," | ",r.createElement("strong",null,"Admitted Patients:")," ",Ie.length),r.createElement("div",{style:{marginBottom:"30px"}},r.createElement("h2",{style:en.sectionTitle},"Select Ward"),r.createElement("select",{style:en.select,value:F,onChange:Ut},r.createElement("option",{value:"0"},"-- Select Ward --"),G.map(function(e,t){return r.createElement("option",{key:t,value:e[1]},e[0])}))),"0"!==F&&r.createElement("div",{style:{marginBottom:"30px"}},r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"15px"}},r.createElement("h3",{style:{color:"#495057",fontSize:"24px",fontWeight:"bold",margin:0}},"Ward Patients for Discharge"),r.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},r.createElement("span",{style:{fontSize:"14px",fontWeight:"bold"}},"Search:"),r.createElement("input",{type:"text",placeholder:"Search by Name, PHN or BHT...",style:E(x({},en.input),{width:"300px",marginBottom:0}),value:Rt,onChange:function(e){Ot(e.target.value),jt(1)}}))),r.createElement("div",{style:{overflowX:"auto"}},r.createElement("table",{style:en.table},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",{style:en.th,onClick:function(){return Jt("id")}},"No ","id"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("phn")}},"PHN ","phn"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("bht_No")}},"BHT No ","bht_No"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("patientName")}},"Patient Name ","patientName"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("gender")}},"Gender ","gender"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th,onClick:function(){return Jt("age")}},"Age ","age"===(null==_t?void 0:_t.key)&&("asc"===_t.direction?"↑":"↓")),r.createElement("th",{style:en.th},"Remarks"),r.createElement("th",{style:en.th},"Action"))),r.createElement("tbody",null,Be&&0===Ie.length?r.createElement("tr",null,r.createElement("td",{colSpan:8,style:E(x({},en.td),{textAlign:"center",padding:"20px"})},"Loading ward patients...")):0===Qt.length?r.createElement("tr",null,r.createElement("td",{colSpan:8,style:E(x({},en.td),{textAlign:"center",padding:"20px"})},"No patients found in this ward.")):Qt.map(function(e,t){return r.createElement("tr",{key:e.id,style:en.tr,onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f1f8e9"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="white"}},r.createElement("td",{style:en.td},$t+t+1),r.createElement("td",{style:E(x({},en.td),{color:"#28a745",fontWeight:"bold"})},e.phn||"No Data"),r.createElement("td",{style:E(x({},en.td),{fontWeight:"bold"})},e.bht_No||"No Data"),r.createElement("td",{style:en.td},e.patientName),r.createElement("td",{style:en.td},e.gender),r.createElement("td",{style:en.td},e.age),r.createElement("td",{style:en.td},e.remarks||"-"),r.createElement("td",{style:en.td},r.createElement("button",{style:{backgroundColor:"#ffc107",color:"#212529",border:"none",padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontSize:"12px",fontWeight:"bold"},onClick:function(){return function(e){return h(function(){var t,n,r,l,a,o,i;return k(this,function(c){switch(c.label){case 0:if(j({phn:e.phn,fullName:e.patientName||"N/A",bhtNo:e.bht_No||"N/A",gender:e.gender||"N/A",dateOfBirth:"N/A",age:e.age||"N/A",nicNo:"N/A",address:"N/A",admissionType:e.admission_type||"N/A",admissionDate:e.admission_date||"N/A",admissionTime:e.admission_time||"N/A",ward:"N/A",guardianName:e.guardian_name||"N/A",guardianContact:"N/A",guardianNIC:"N/A",guardianRelation:"N/A",guardianAddress:"N/A"}),Le(e.encounteruuid),Ge(e.patientuuid||""),He(e.bht_No||""),!e.encounteruuid||!Ae)return[3,12];c.label=1;case 1:return c.trys.push([1,11,,12]),[4,fetch("/openmrs/ws/rest/v1/warddischarge/loadinvestigations/".concat(Ae,"/").concat(e.encounteruuid))];case 2:return(t=c.sent()).ok?[4,t.json()]:[3,4];case 3:(n=c.sent())&&n.length>0?kt(n[0]):kt(null),c.label=4;case 4:return[4,fetch("/openmrs/ws/rest/v1/warddischarge/getlabtests/".concat(e.encounteruuid))];case 5:return(r=c.sent()).ok?[4,r.json()]:[3,7];case 6:l=c.sent(),At(l||[]),c.label=7;case 7:return[4,fetch("/openmrs/ws/rest/v1/warddischarge/getradiologytests/".concat(e.encounteruuid))];case 8:return(a=c.sent()).ok?[4,a.json()]:[3,10];case 9:o=c.sent(),Bt(o||[]),c.label=10;case 10:return[3,12];case 11:return i=c.sent(),console.error("Error fetching clinical data:",i),[3,12];case 12:return[2]}})})()}(e)}},"Select")))})))),Zt>1&&r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"20px"}},r.createElement("div",{style:{fontSize:"14px",color:"#555"}},"Showing ",$t+1," to ",Math.min(Xt,Kt.length)," of ",Kt.length," entries"),r.createElement("div",{style:{display:"flex",gap:"5px"}},r.createElement("button",{onClick:function(){return jt(function(e){return Math.max(e-1,1)})},disabled:1===Lt,style:{padding:"6px 12px",border:"1px solid #dee2e6",backgroundColor:1===Lt?"#f8f9fa":"white",cursor:1===Lt?"not-allowed":"pointer",borderRadius:"4px"}},"Previous"),Array.from({length:Zt},function(e,t){return t+1}).map(function(e){return r.createElement("button",{key:e,onClick:function(){return jt(e)},style:{padding:"6px 12px",border:"1px solid #dee2e6",backgroundColor:Lt===e?"#28a745":"white",color:Lt===e?"white":"#333",cursor:"pointer",borderRadius:"4px",fontWeight:Lt===e?"bold":"normal"}},e)}),r.createElement("button",{onClick:function(){return jt(function(e){return Math.min(e+1,Zt)})},disabled:Lt===Zt,style:{padding:"6px 12px",border:"1px solid #dee2e6",backgroundColor:Lt===Zt?"#f8f9fa":"white",cursor:Lt===Zt?"not-allowed":"pointer",borderRadius:"4px"}},"Next")))),L&&r.createElement(r.Fragment,null,r.createElement("h2",{style:en.sectionTitle},"Patient Information"),r.createElement("div",{style:{backgroundColor:"#f9f9f9",padding:"15px",borderRadius:"4px",border:"1px solid #e0e0e0",marginBottom:"30px"}},r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",null,r.createElement("strong",null,"Full Name:")," ",L.fullName||"No Data"),r.createElement("div",null,r.createElement("strong",null,"Gender:")," ",L.gender||"No Data"),r.createElement("div",null,r.createElement("strong",null,"BHT No:")," ",L.bhtNo||"No Data"),r.createElement("div",null,r.createElement("strong",null,"Age:")," ",L.age||"No Data"),r.createElement("div",null,r.createElement("strong",null,"Admission Date:")," ",L.admissionDate||"No Data"),r.createElement("div",null,r.createElement("strong",null,"Admission Time:")," ",L.admissionTime||"No Data"),r.createElement("div",{style:{gridColumn:"span 2"}},r.createElement("strong",null,"Admission Type:")," ",L.admissionType||"No Data"))),(Ct||Nt.length>0||Dt.length>0)&&r.createElement("div",{style:{marginBottom:"30px",padding:"15px",backgroundColor:"#fff3cd",borderRadius:"4px",border:"1px solid #ffeeba"}},r.createElement("h2",{style:E(x({},en.sectionTitle),{color:"#856404",borderBottomColor:"#856404",marginTop:0})},"Clinical Investigations"),r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",null,Dt.length>0&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Radiology Tests:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Dt.map(function(e,t){return r.createElement("li",{key:t},e.codeDisplay)}))),(null==Ct?void 0:Ct.investigations)&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Investigations:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Ct.investigations.split("\n").filter(Boolean).map(function(e,t){return r.createElement("li",{key:t},e.trim())}))),(null==Ct?void 0:Ct.patientConditions)&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Patient Condition:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Ct.patientConditions.split("\n").filter(Boolean).map(function(e,t){return r.createElement("li",{key:t},e.trim())})))),r.createElement("div",null,Nt.length>0&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Lab Tests:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Nt.map(function(e,t){return r.createElement("li",{key:t},e.value)}))),(null==Ct?void 0:Ct.specialInvestigations)&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"Special Investigations:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},Ct.specialInvestigations.split("\n").filter(Boolean).map(function(e,t){return r.createElement("li",{key:t},e.trim())}))),((null==Ct?void 0:Ct.presentingComplains)||(null==Ct?void 0:Ct.history)||(null==Ct?void 0:Ct.examinationfindings)||(null==Ct?void 0:Ct.tratments))&&r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",{style:{color:"#856404"}},"History & Findings:"),r.createElement("ul",{style:{margin:"5px 0",paddingLeft:"20px"}},[null==Ct?void 0:Ct.presentingComplains,null==Ct?void 0:Ct.history,null==Ct?void 0:Ct.examinationfindings,null==Ct?void 0:Ct.tratments].filter(Boolean).map(function(e){return null==e?void 0:e.split("\n").filter(Boolean).map(function(t,n){return r.createElement("li",{key:n+e},t.trim())})})))))),r.createElement("h2",{style:en.sectionTitle},"Discharge Details"),r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Discharge Date ",r.createElement("span",{style:{color:"red"}},"*")),r.createElement("input",{type:"date",style:en.input,value:V,onChange:function(e){return Y(e.target.value)},required:!0})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Discharge Time ",r.createElement("span",{style:{color:"red"}},"*")),r.createElement("input",{type:"time",style:en.input,value:K,onChange:function(e){return X(e.target.value)},required:!0})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Discharge Type ",r.createElement("span",{style:{color:"red"}},"*")),r.createElement("select",{style:en.select,value:Q,onChange:function(e){return Z(e.target.value)},required:!0},r.createElement("option",{value:"0"},"-- Select Discharge Type --"),r.createElement("option",{value:"alive"},"Alive"),r.createElement("option",{value:"death"},"Death"),r.createElement("option",{value:"missing"},"Missing"),r.createElement("option",{value:"lama"},"LAMA (Left Against Medical Advice)"))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Medical-Legal Case"),r.createElement("select",{style:en.select,value:te,onChange:function(e){return ne(e.target.value)}},r.createElement("option",{value:"0"},"-- Select --"),r.createElement("option",{value:"yes"},"Yes"),r.createElement("option",{value:"no"},"No")))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("h2",{style:en.sectionTitle},"Diagnosis"),r.createElement("div",{style:E(x({},en.inputGroup),{position:"relative"})},r.createElement("label",{style:en.label},"Search and Add Diagnosis (ICD-10)"),r.createElement("input",{type:"text",style:en.input,placeholder:"Type diagnosis to search...",value:ht,onChange:function(e){return t=e.target.value,h(function(){var e,n,r;return k(this,function(l){switch(l.label){case 0:if(bt(t),!(t.length>2))return[3,7];l.label=1;case 1:return l.trys.push([1,5,,6]),[4,fetch("/openmrs/ws/rest/v1/warddischarge/geticdlist/".concat(t))];case 2:return(e=l.sent()).ok?[4,e.json()]:[3,4];case 3:n=l.sent(),vt(n),l.label=4;case 4:return[3,6];case 5:return r=l.sent(),console.error("Error fetching ICD list:",r),[3,6];case 6:return[3,8];case 7:vt([]),l.label=8;case 8:return[2]}})})();var t}}),Et.length>0&&r.createElement("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 8px rgba(0,0,0,0.1)"}},Et.map(function(e,t){return r.createElement("div",{key:t,style:{padding:"10px",cursor:"pointer",borderBottom:"1px solid #eee"},onClick:function(){return(t=e.disease_name||e[2]).trim()&&!ie.includes(t.trim())&&ce(S(ie).concat([t.trim()])),bt(""),void vt([]);var t},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f0f9ff"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="white"}},e.disease_name||e[2]," - ",e.disease_code||e[1])}))),r.createElement("div",{style:{marginTop:"15px",padding:"15px",backgroundColor:"#f9f9f9",border:"1px dashed #ccc",borderRadius:"4px",minHeight:"80px"}},0===ie.length?r.createElement("p",{style:{textAlign:"center",color:"#999",fontStyle:"italic"}},"Added diagnoses will appear here"):r.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px"}},ie.map(function(e,t){return r.createElement("span",{key:t,style:{backgroundColor:"#28a745",color:"white",padding:"8px 12px",borderRadius:"20px",fontSize:"14px",display:"inline-flex",alignItems:"center",gap:"8px"}},e,r.createElement("button",{onClick:function(){return function(e){ce(ie.filter(function(t,n){return n!==e}))}(t)},style:{background:"none",border:"none",color:"white",cursor:"pointer",fontSize:"16px",padding:0}},"×"))})))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Medical Remarks"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"80px",resize:"vertical"}),placeholder:"Enter any additional medical remarks...",value:le,onChange:function(e){return ae(e.target.value)}}))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px",borderBottom:"2px solid #007bff",paddingBottom:"10px"}},r.createElement("h2",{style:E(x({},en.sectionTitle),{borderBottom:"none",marginBottom:0,paddingBottom:0,color:"#007bff"})},"Prescriptions"),r.createElement("button",{onClick:function(){return pt(!ut)},style:en.buttonSecondary},ut?"Close Prescribing":"+ Add Prescription")),ut&&r.createElement("div",{style:{backgroundColor:"#f0f8ff",padding:"20px",borderRadius:"8px",border:"1px solid #cce5ff",marginBottom:"20px"}},r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",{style:E(x({},en.inputGroup),{position:"relative"})},r.createElement("label",{style:en.label},"Search Drug"),r.createElement("input",{type:"text",style:en.input,placeholder:"Type drug name to search...",value:ct.drugName,onChange:function(e){return t=e.target.value,h(function(){var e,n,r;return k(this,function(l){switch(l.label){case 0:if(st(E(x({},ct),{drugName:t})),!(t.length>2))return[3,7];l.label=1;case 1:return l.trys.push([1,5,,6]),[4,fetch("/openmrs/ws/rest/v1/concept?q=".concat(t))];case 2:return(e=l.sent()).ok?[4,e.json()]:[3,4];case 3:n=l.sent(),yt(n.results||[]),l.label=4;case 4:return[3,6];case 5:return r=l.sent(),console.error("Error fetching drugs:",r),[3,6];case 6:return[3,8];case 7:yt([]),l.label=8;case 8:return[2]}})})();var t}}),gt.length>0&&r.createElement("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:10,backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 8px rgba(0,0,0,0.1)"}},gt.map(function(e,t){return r.createElement("div",{key:t,style:{padding:"10px",cursor:"pointer",borderBottom:"1px solid #eee"},onClick:function(){st(E(x({},ct),{drugName:e.display,druguuid:e.uuid})),yt([])},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f0f9ff"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="white"}},e.display)}))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Dosage"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g. 500mg",value:ct.dosage,onChange:function(e){return st(E(x({},ct),{dosage:e.target.value}))}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Frequency"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g. bd, tds",value:ct.frequency,onChange:function(e){return st(E(x({},ct),{frequency:e.target.value}))}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Duration / Period"),r.createElement("div",{style:{display:"flex",gap:"10px"}},r.createElement("input",{type:"text",style:E(x({},en.input),{flex:1}),placeholder:"e.g. 5",value:ct.period,onChange:function(e){return st(E(x({},ct),{period:e.target.value}))}}),r.createElement("select",{style:E(x({},en.select),{flex:1}),value:ct.periodType,onChange:function(e){return st(E(x({},ct),{periodType:e.target.value}))}},r.createElement("option",{value:""},"--Type--"),r.createElement("option",{value:"Days"},"Days"),r.createElement("option",{value:"Weeks"},"Weeks"),r.createElement("option",{value:"Months"},"Months")))),r.createElement("div",{style:E(x({},en.inputGroup),{gridColumn:"span 2"})},r.createElement("label",{style:en.label},"Comment / Instructions"),r.createElement("input",{type:"text",style:en.input,value:ct.comment,onChange:function(e){return st(E(x({},ct),{comment:e.target.value}))}}))),r.createElement("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"15px"}},r.createElement("button",{onClick:function(){ct.drugName&&(ot(S(at).concat([ct])),st({druguuid:"",drugName:"",drugtype:"",dosage:"",frequency:"",period:"",periodType:"",comment:"",markasoutdoor:"no"}),yt([]))},style:en.buttonSecondary},"Add to List"))),at.length>0&&r.createElement("div",{style:{overflowX:"auto",marginBottom:"20px"}},r.createElement("table",{style:en.table},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",{style:en.th},"Drug"),r.createElement("th",{style:en.th},"Dosage"),r.createElement("th",{style:en.th},"Frequency"),r.createElement("th",{style:en.th},"Duration"),r.createElement("th",{style:en.th},"Instructions"),r.createElement("th",{style:en.th},"Action"))),r.createElement("tbody",null,at.map(function(e,t){return r.createElement("tr",{key:t},r.createElement("td",{style:en.td},r.createElement("strong",null,e.drugName)),r.createElement("td",{style:en.td},e.dosage),r.createElement("td",{style:en.td},e.frequency),r.createElement("td",{style:en.td},e.period," ",e.periodType),r.createElement("td",{style:en.td},e.comment),r.createElement("td",{style:en.td},r.createElement("button",{onClick:function(){return ot(at.filter(function(e,n){return n!==t}))},style:{background:"none",border:"none",color:"#dc3545",cursor:"pointer",fontSize:"14px",fontWeight:"bold"}},"Remove")))}))))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("h2",{style:en.sectionTitle},"Clinic Referral"),r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",{style:E(x({},en.inputGroup),{position:"relative"})},r.createElement("label",{style:en.label},"Referring Clinic"),r.createElement("div",{style:{position:"relative"}},r.createElement("input",{type:"text",style:en.input,placeholder:"Search and select clinic...",value:ve||(null===(e=be.find(function(e){return e.uuid===pe}))||void 0===e?void 0:e.name)||"",onChange:function(e){Se(e.target.value),we(!0),""===e.target.value&&me("0")},onFocus:function(){return we(!0)}}),r.createElement(l.A,{size:18,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",color:"#999"}})),ke&&r.createElement("div",{style:{position:"absolute",top:"100%",left:0,right:0,zIndex:100,backgroundColor:"white",border:"1px solid #ccc",borderRadius:"4px",maxHeight:"200px",overflowY:"auto",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",marginTop:"5px"}},Pt.length>0?Pt.map(function(e,t){return r.createElement("div",{key:t,style:{padding:"12px 15px",cursor:"pointer",borderBottom:"1px solid #eee",backgroundColor:pe===e.uuid?"#e8f5e9":"transparent",fontWeight:pe===e.uuid?"bold":"normal"},onClick:function(){me(e.uuid),Se(e.name),we(!1)},onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f1f8e9"},onMouseLeave:function(t){return t.currentTarget.style.backgroundColor=pe===e.uuid?"#e8f5e9":"white"}},e.name)}):r.createElement("div",{style:{padding:"15px",textAlign:"center",color:"#999"}},"No clinics found"))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Referral Remarks"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"80px",resize:"vertical"}),placeholder:"Enter referral notes...",value:ye,onChange:function(e){return fe(e.target.value)}})))),r.createElement("div",{style:{marginTop:"30px",padding:"20px",border:"1px dashed #17a2b8",borderRadius:"4px",backgroundColor:"#f0f9ff"}},r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"},onClick:function(){return Je(!Ye)}},r.createElement("h2",{style:E(x({},en.sectionTitle),{marginBottom:0,borderBottom:"none"})},"New Born Baby Details"),Ye?r.createElement(a.A,{size:24}):r.createElement(o.A,{size:24})),Ye&&r.createElement("div",{style:{marginTop:"20px"}},r.createElement("div",{style:{display:"flex",gap:"20px",marginBottom:"20px"}},r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Number of Babies"),r.createElement("input",{type:"number",style:en.input,min:"0",max:"5",value:Xe,onChange:function(e){return $e(parseInt(e.target.value)||0)}})),r.createElement("div",{style:{display:"flex",alignItems:"flex-end"}},r.createElement("button",{onClick:function(){for(var e=[],t=1;t<=Xe;t++)e.push({babyNumber:t,birthChitNo:"",discNo:"",fatherName:"",gender:"0",birthWeight:"",poa:"",apgarScore:"",apgar1:"",apgar5:"",apgar10:"",motherBloodGroup:"",babyBloodGroup:"",sourceOfPatient:"",indicationForAdmission:"",weightOnAdmission:"",ageOnAdmission:"",eed:"",length:"",ofc:"",growthStatus:"",motherAge:"",parity:"",antenatalProblems:"",maternalMedications:"",prom:"",liquor:"",maternalFever:!1,resuscitationRequired:!1,intubationAge:"",totalVentilatorySupport:"",pip:"",peep:"",o2Concentration:"",phototherapy:{fromDay:"",toDay:""},ivFluids:{fromDay:"",toDay:""},enteralFeeds:{startedDay:"",dischargeTolerating:"",hourly:""},inotropes:{requiredDay:"",omittedDay:""},o2Therapy:{requiredDay:"",omittedDay:""},hematology:{wbc:"",n:"",plt:"",hb:"",sbr_i:"",sbr_d:"",crp:""},microbiological:"",radiological:"",antibiotics:[],otherFindings:"",dischargeWeight:"",dischargeOfc:"",vitaminK:"",bcgGiven:!1,dischargeExaminationDone:"",ropScreeningDate:"",cranialUsScanDate:"",hearingAssessmentDate:"",referredToMohWeeks:"",referredToLocalHospital:"",referredToSpecialist:"",medicalOfficerName:"",deliveryDate:"",modeOfDelivery:"0",deliveredBy:"",maternalComplications:"",abnormalities:"",other:"",checklist:{episiotomy:"",bodyTemperature:"",prePregnancyScreening:"",vaginalExamination:"",infection:"",familyPlanning:"",dangerSignals:"",breastFeeding:"",vitAMegadose:"",rubellaImmunization:"",antiDAntibodies:"",diagnosisCard:"",chdrCompleted:"",prescription:"",referredToMidwife:""}});et(e)},style:en.buttonSecondary},"Add Babies"))),Ze.map(function(e,t){return r.createElement("div",{key:t,style:{backgroundColor:"white",padding:"20px",marginBottom:"20px",border:"1px solid #dee2e6",borderRadius:"4px"}},r.createElement("h3",{style:{fontSize:"18px",fontWeight:"bold",color:"#17a2b8",marginBottom:"20px",paddingBottom:"10px",borderBottom:"2px solid #17a2b8"}},"Baby ",e.babyNumber),r.createElement("div",{style:en.gridTwoColumn},r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Birth Chit No"),r.createElement("input",{type:"text",style:en.input,value:e.birthChitNo,onChange:function(e){return Ft(t,"birthChitNo",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Disc No"),r.createElement("input",{type:"text",style:en.input,value:e.discNo,onChange:function(e){return Ft(t,"discNo",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Name of the Father"),r.createElement("input",{type:"text",style:en.input,value:e.fatherName,onChange:function(e){return Ft(t,"fatherName",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Baby Gender"),r.createElement("select",{style:en.select,value:e.gender,onChange:function(e){return Ft(t,"gender",e.target.value)}},r.createElement("option",{value:"0"},"--Select--"),r.createElement("option",{value:"male"},"Male"),r.createElement("option",{value:"female"},"Female"))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Birth Weight (kg)"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g., 3.2",value:e.birthWeight,onChange:function(e){return Ft(t,"birthWeight",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"POA (Weeks)"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g., 38",value:e.poa,onChange:function(e){return Ft(t,"poa",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Apgar Score"),r.createElement("input",{type:"text",style:en.input,placeholder:"e.g., 9/10",value:e.apgarScore,onChange:function(e){return Ft(t,"apgarScore",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Date of Delivery"),r.createElement("input",{type:"date",style:en.input,value:e.deliveryDate,onChange:function(e){return Ft(t,"deliveryDate",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Mode of Delivery"),r.createElement("select",{style:en.select,value:e.modeOfDelivery,onChange:function(e){return Ft(t,"modeOfDelivery",e.target.value)}},r.createElement("option",{value:"0"},"--Select--"),r.createElement("option",{value:"VD"},"VD (Vaginal Delivery)"),r.createElement("option",{value:"Forceps"},"Forceps"),r.createElement("option",{value:"Vacuum"},"Vacuum"),r.createElement("option",{value:"LSCS"},"LSCS (C-Section)"))),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Delivered By"),r.createElement("input",{type:"text",style:en.input,placeholder:"Doctor/Midwife name",value:e.deliveredBy,onChange:function(e){return Ft(t,"deliveredBy",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Maternal Complications"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"60px",resize:"vertical"}),placeholder:"Any complications...",value:e.maternalComplications,onChange:function(e){return Ft(t,"maternalComplications",e.target.value)}})),r.createElement("div",{style:en.inputGroup},r.createElement("label",{style:en.label},"Abnormalities Detected"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"60px",resize:"vertical"}),placeholder:"Any abnormalities...",value:e.abnormalities,onChange:function(e){return Ft(t,"abnormalities",e.target.value)}}))),r.createElement("div",{style:x({marginTop:"20px"},en.inputGroup)},r.createElement("label",{style:en.label},"Any Other Information"),r.createElement("textarea",{style:E(x({},en.input),{minHeight:"60px",resize:"vertical"}),placeholder:"Additional notes...",value:e.other,onChange:function(e){return Ft(t,"other",e.target.value)}})),r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",color:"#28a745",marginTop:"30px",marginBottom:"15px"}},"Discharge Checklist"),r.createElement("div",{style:{overflowX:"auto"}},r.createElement("table",{style:{width:"100%",borderCollapse:"collapse",border:"1px solid #dee2e6"}},r.createElement("thead",null,r.createElement("tr",{style:{backgroundColor:"#f8f9fa"}},r.createElement("th",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"left",fontWeight:"bold",width:"60%"}},"Item"),r.createElement("th",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"center",fontWeight:"bold",width:"20%"}},"Yes"),r.createElement("th",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"center",fontWeight:"bold",width:"20%"}},"No"))),r.createElement("tbody",null,[{key:"episiotomy",label:"Episiotomy"},{key:"bodyTemperature",label:"Body Temperature Normal for last 2 Days"},{key:"prePregnancyScreening",label:"Pre-pregnancy screening done"},{key:"vaginalExamination",label:"Vaginal examination done to check packs"},{key:"infection",label:"Epis/Tear/LSCS infection check"},{key:"familyPlanning",label:"Family planning discussed"},{key:"dangerSignals",label:"Post partum danger signals explained"},{key:"breastFeeding",label:"Breast feeding established"},{key:"vitAMegadose",label:"Vit.A Megadose given"},{key:"rubellaImmunization",label:"Rubella Immunization given"},{key:"antiDAntibodies",label:"Anti-D antibodies given if indicated"},{key:"diagnosisCard",label:"Diagnosis card given if indicated"},{key:"chdrCompleted",label:"CHDR completed and handed over"},{key:"prescription",label:"Prescription given if needed"},{key:"referredToMidwife",label:"Referred to the field public health midwife"}].map(function(n){return r.createElement("tr",{key:n.key},r.createElement("td",{style:{border:"1px solid #dee2e6",padding:"12px",fontWeight:"500"}},n.label),r.createElement("td",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"center"}},r.createElement("input",{type:"checkbox",checked:"yes"===e.checklist[n.key],onChange:function(e){return qt(t,n.key,e.target.checked?"yes":"")},style:{transform:"scale(1.2)",cursor:"pointer"}})),r.createElement("td",{style:{border:"1px solid #dee2e6",padding:"12px",textAlign:"center"}},r.createElement("input",{type:"checkbox",checked:"no"===e.checklist[n.key],onChange:function(e){return qt(t,n.key,e.target.checked?"no":"")},style:{transform:"scale(1.2)",cursor:"pointer"}})))})))),r.createElement("div",{style:{textAlign:"right",marginTop:"20px"}},r.createElement("button",{style:E(x({},en.buttonSecondary),{backgroundColor:"#17a2b8"}),onClick:function(){return function(e){return h(function(){return k(this,function(t){return rt(e),setTimeout(function(){return h(function(){var e,t,n,r,l,a,o,i;return k(this,function(c){switch(c.label){case 0:return I.current?(e=new p.uE({orientation:"portrait",unit:"mm",format:"a4"}),[4,g()(I.current,{scale:2,useCORS:!0,logging:!1,backgroundColor:"#ffffff"})]):[2];case 1:return t=c.sent(),n=t.toDataURL("image/png"),r=e.getImageProperties(n),l=e.internal.pageSize.getWidth(),a=r.height*l/r.width,e.addImage(n,"PNG",0,0,l,a),o=e.output("blob"),i=URL.createObjectURL(o),window.open(i,"_blank"),rt(null),[2]}})})()},100),[2]})})()}(e)}},r.createElement(i.A,{size:18,style:{marginRight:"8px",verticalAlign:"middle"}}),"Print Neonatal Card")))}))),r.createElement("div",{style:en.buttonContainer},r.createElement("button",{onClick:function(){return h(function(){var e,t,n,r,l,a,o,i,c,s,d,p,m,g,y,f,h,b,v,S;return k(this,function(C){switch(C.label){case 0:if(!V||!K)return u().fire({title:"Validation Error!",text:"Please fill in all required fields!",icon:"error",confirmButtonColor:"#dc3545"}),[2];if(!L)return u().fire({title:"Validation Error!",text:"Please search for a patient first!",icon:"error",confirmButtonColor:"#dc3545"}),[2];if("0"===Q)return u().fire({title:"Validation Error!",text:"Please select a discharge type!",icon:"error",confirmButtonColor:"#dc3545"}),[2];C.label=1;case 1:return C.trys.push([1,22,23,24]),ze(!0),e="demo-user",t=0,"0"===pe?[3,4]:[4,fetch("/openmrs/ws/rest/v1/warddischarge/saveclinic",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phn:L.phn,clinic_uuid:pe,remarks:ye,cby:e})})];case 2:return(n=C.sent()).ok?[4,n.json()]:[3,4];case 3:r=C.sent(),t=r.id||0,C.label=4;case 4:return l=ie.length>0?encodeURIComponent(ie.join("@@@@")):"null",a=le?encodeURIComponent(le):"null",[4,fetch("/openmrs/ws/rest/v1/warddischarge/savedischarge/".concat("0"===te?"no":te,"/").concat(Q,"/").concat(a,"/").concat(l,"/").concat(K,"/").concat(V,"/").concat(e,"/").concat(t,"/").concat(L.bhtNo,"/").concat(L.phn))];case 5:if(!C.sent().ok)throw new Error("Failed to save discharge record");o=!0,i=!1,c=void 0,C.label=6;case 6:C.trys.push([6,11,12,13]),s=at[Symbol.iterator](),C.label=7;case 7:return(o=(d=s.next()).done)?[3,10]:(p=d.value,[4,fetch("/openmrs/ws/rest/v1/warddischarge/prescribesave",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E(x({},p),{phn:L.phn,patientuuid:Me,encounteruuid:We,creator:e}))})]);case 8:C.sent(),C.label=9;case 9:return o=!0,[3,7];case 10:return[3,13];case 11:return v=C.sent(),i=!0,c=v,[3,13];case 12:try{o||null==s.return||s.return()}finally{if(i)throw c}return[7];case 13:m=!0,g=!1,y=void 0,C.label=14;case 14:C.trys.push([14,19,20,21]),f=Ze[Symbol.iterator](),C.label=15;case 15:return(m=(h=f.next()).done)?[3,18]:(b=h.value,[4,fetch("/openmrs/ws/rest/v1/warddischarge/savebabydetails",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E(x({},b),{phn:b.birthChitNo,motherphn:L.phn,encounteruuid:We,cby:e,location:Ae||"",episiotomy:b.checklist.episiotomy,bodytemperaturenormal:b.checklist.bodyTemperature,prepregnancyscreeningdone:b.checklist.prePregnancyScreening,vaginaldonecheck:b.checklist.vaginalExamination,infection:b.checklist.infection,familyplanningdiscussed:b.checklist.familyPlanning,postparturndangersignals:b.checklist.dangerSignals,breastfeeding:b.checklist.breastFeeding,vitAmegadose:b.checklist.vitAMegadose,rubella:b.checklist.rubellaImmunization,antidantibodies:b.checklist.antiDAntibodies,diagnosiscardgiven:b.checklist.diagnosisCard,chdrcompleted:b.checklist.chdrCompleted,prescription:b.checklist.prescription,referredtothefield:b.checklist.referredToMidwife}))})]);case 16:C.sent(),C.label=17;case 17:return m=!0,[3,15];case 18:return[3,21];case 19:return v=C.sent(),g=!0,y=v,[3,21];case 20:try{m||null==f.return||f.return()}finally{if(g)throw y}return[7];case 21:return u().fire({title:"Success!",text:"Patient discharge saved successfully!",icon:"success",confirmButtonColor:"#28a745"}),Vt(),Yt(),[3,24];case 22:return S=C.sent(),console.error("Save failed",S),u().fire({title:"Error!",text:"Failed to save discharge data.",icon:"error",confirmButtonColor:"#dc3545"}),[3,24];case 23:return ze(!1),[7];case 24:return[2]}})})()},style:en.buttonPrimary},r.createElement(c.A,{size:20,style:{marginRight:"8px",verticalAlign:"middle"}}),"Save Discharge"),r.createElement("button",{onClick:Vt,style:en.buttonDanger},r.createElement(s.A,{size:20,style:{marginRight:"8px",verticalAlign:"middle"}}),"Cancel"),r.createElement("button",{onClick:function(){return h(function(){var e,t,n,r,l,a,o,i;return k(this,function(c){switch(c.label){case 0:return L?P.current?(e=new p.uE({orientation:"portrait",unit:"mm",format:"a4"}),[4,g()(P.current,{scale:2,useCORS:!0,logging:!1,backgroundColor:"#ffffff"})]):[2]:(u().fire({title:"Error!",text:"Please select a patient first",icon:"error"}),[2]);case 1:return t=c.sent(),n=t.toDataURL("image/png"),r=e.getImageProperties(n),l=e.internal.pageSize.getWidth(),a=r.height*l/r.width,e.addImage(n,"PNG",0,0,l,a),o=e.output("blob"),i=URL.createObjectURL(o),window.open(i,"_blank"),[2]}})})()},style:en.buttonSecondary},r.createElement(i.A,{size:20,style:{marginRight:"8px",verticalAlign:"middle"}}),"Print Discharge Card")))),r.createElement("div",{style:en.printTemplateWrapper},r.createElement("div",{style:en.printTemplate,ref:P},r.createElement("div",{style:{maxWidth:"650px",margin:"0 auto",backgroundColor:"white",padding:"30px",border:"1px solid #000",minHeight:"900px",color:"black",fontFamily:"serif"}},r.createElement("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"10px"}},r.createElement("label",{style:{fontSize:"10px",textAlign:"left",lineHeight:"1.4"}},"වෛද්‍යවරයා හමුවීමට මෙම කාඩ් පත රැගෙන යන්න.",r.createElement("br",null),"வைத்தியரைச் சந்திக்கப் போகும்பொழுது මෙම அட்டையை எடுத்துச் செல்லவும்.",r.createElement("br",null),"Take this card when you visit the Doctor"),r.createElement("div",{style:{textAlign:"right",fontSize:"9px",fontWeight:"bold"}},"සෞඛ්‍ය 383අ",r.createElement("br",null),"சுகாதாரம் 383අ ",r.createElement("br",null),"Health 383A")),r.createElement("div",{style:{textAlign:"center",marginBottom:"20px"}},r.createElement("div",{style:{fontSize:"18px",fontWeight:"bold",margin:"2px 0"}},"රෝගීන් නිර්දේශන ලකුණු"),r.createElement("div",{style:{fontSize:"15px",margin:"2px 0"}},"நோய் නிருணய අட்டை"),r.createElement("div",{style:{fontSize:"13px",fontWeight:"bold",letterSpacing:"1px",margin:"2px 0"}},"DIAGNOSIS TICKET")),r.createElement("div",{style:{borderTop:"2px solid #000",paddingTop:"15px"}},r.createElement("div",{style:{display:"flex",marginBottom:"15px",borderBottom:"1px solid #000"}},r.createElement("div",{style:{width:"120px",fontSize:"10px",lineHeight:"1.2"}},"ප්‍රතිකාරයට පත්වන",r.createElement("br",null),"Name of Patient"),r.createElement("div",{style:{fontSize:"16px",flex:1,paddingLeft:"10px",fontWeight:"bold"}},null==L?void 0:L.fullName),r.createElement("div",{style:{width:"80px",borderLeft:"1px solid #000",paddingLeft:"10px"}},r.createElement("div",{style:{fontSize:"9px"}},"වයස/Age"),r.createElement("div",{style:{fontSize:"14px"}},null==L?void 0:L.age))),r.createElement("div",{style:{display:"flex",gap:"0",marginBottom:"15px"}},r.createElement("div",{style:{flex:1,display:"flex",borderBottom:"1px solid #000",paddingRight:"10px"}},r.createElement("div",{style:{width:"100px",fontSize:"10px"}},"ප්‍රදේශ/Ward"),r.createElement("div",{style:{fontSize:"14px",flex:1}},(null===(t=G.find(function(e){return e[1]===F}))||void 0===t?void 0:t[0])||"N/A")),r.createElement("div",{style:{flex:1,display:"flex",borderBottom:"1px solid #000",borderLeft:"1px solid #000",paddingLeft:"10px"}},r.createElement("div",{style:{width:"100px",fontSize:"10px"}},"ප්‍රමාණයන් අංකය/Reg. No."),r.createElement("div",{style:{fontSize:"14px",flex:1,fontWeight:"bold"}},null==L?void 0:L.bhtNo))),r.createElement("div",{style:{display:"flex",gap:"0",marginBottom:"25px"}},r.createElement("div",{style:{flex:1,display:"flex",borderBottom:"1px solid #000",paddingRight:"10px"}},r.createElement("div",{style:{width:"100px",fontSize:"10px"}},"ඇතුළත් කළ දිනය/Admission"),r.createElement("div",{style:{fontSize:"14px",flex:1}},null==L?void 0:L.admissionDate)),r.createElement("div",{style:{flex:1,display:"flex",borderBottom:"1px solid #000",borderLeft:"1px solid #000",paddingLeft:"10px"}},r.createElement("div",{style:{width:"100px",fontSize:"10px"}},"පිට වූ දිනය/Discharge"),r.createElement("div",{style:{fontSize:"14px",flex:1}},V)))),r.createElement("div",{style:{margin:"20px 0"}},r.createElement("div",{style:{fontSize:"11px",fontWeight:"bold",marginBottom:"5px"}},"රෝගීන් පරීක්ෂණයන් සහ ප්‍රතිකාර / Investigations and Treatments"),r.createElement("div",{style:{border:"2px solid #000",padding:"15px",minHeight:"300px",fontSize:"13px",lineHeight:"1.6"}},r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",null,"DIAGNOSIS:")," ",ie.join(", ")||"N/A"),r.createElement("div",{style:{marginBottom:"15px"}},r.createElement("strong",null,"CLINICAL NOTES & REMARKS:"),r.createElement("br",null),le||"None recorded."),r.createElement("div",null,r.createElement("strong",null,"MEDICATIONS:")),at.map(function(e,t){return r.createElement("div",{key:t,style:{marginLeft:"10px"}},"• ",e.drugName," - ",e.dosage," ",e.frequency," (",e.period," ",e.periodType,")")}))),r.createElement("div",{style:{marginTop:"30px"}},r.createElement("div",{style:{marginBottom:"15px",fontSize:"12px"}},"Referred to ",r.createElement("span",{style:{borderBottom:"1px solid #000",padding:"0 30px",fontWeight:"bold"}},"0"!==pe?(null===(n=be.find(function(e){return e.uuid===pe}))||void 0===n?void 0:n.name)||pe:"..........................")," Clinic"),r.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"}},r.createElement("div",{style:{border:"1px solid #000",padding:"5px"}},r.createElement("table",{style:{borderCollapse:"collapse",fontSize:"10px",textAlign:"center"}},r.createElement("tbody",null,r.createElement("tr",null,["M","TU","WD","TH","FR","SA","SU"].map(function(e){return r.createElement("td",{key:e,style:{border:"1px solid #000",padding:"4px",width:"25px"}},e)})),r.createElement("tr",null,["ස.","අ.","බ.","බ්‍ර.","සි.","සෙ.","ඉ."].map(function(e){return r.createElement("td",{key:e,style:{border:"1px solid #000",padding:"4px"}},e)}))))),r.createElement("div",{style:{textAlign:"center",marginTop:"10px"}},r.createElement("div",{style:{borderBottom:"1px solid #000",width:"220px",marginBottom:"5px"}}),r.createElement("div",{style:{fontSize:"10px",fontWeight:"bold"}},"Physician / Surgeon Signature")))))),nt&&r.createElement("div",{style:en.printTemplate,ref:I},r.createElement("div",{style:{maxWidth:"800px",margin:"0 auto",backgroundColor:"white",padding:"40px",border:"2px solid #000",color:"black",fontFamily:"serif"}},r.createElement("h1",{style:{fontSize:"24px",textAlign:"center",textDecoration:"underline",marginBottom:"30px",fontWeight:"bold"}},"NEONATAL DIAGNOSIS CARD"),r.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"20px",marginBottom:"20px"}},r.createElement("div",{style:{fontSize:"14px",lineHeight:"2"}},r.createElement("div",null,r.createElement("strong",null,"Hospital:")," ",qe),r.createElement("div",null,r.createElement("strong",null,"Mother's Name:")," ",null==L?void 0:L.fullName),r.createElement("div",null,r.createElement("strong",null,"Baby BHT No:")," ",nt.discNo),r.createElement("div",null,r.createElement("strong",null,"Sex:")," ",null===(d=nt.gender)||void 0===d?void 0:d.toUpperCase())),r.createElement("div",{style:{fontSize:"14px",lineHeight:"2"}},r.createElement("div",null,r.createElement("strong",null,"Date of Birth:")," ",nt.deliveryDate),r.createElement("div",null,r.createElement("strong",null,"Birth Weight:")," ",nt.birthWeight," g"),r.createElement("div",null,r.createElement("strong",null,"POA:")," ",nt.poa," weeks"),r.createElement("div",null,r.createElement("strong",null,"Discharge Date:")," ",V))),r.createElement("div",{style:{marginBottom:"25px"}},r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",borderBottom:"1px solid #000",marginBottom:"10px"}},"Apgar Score"),r.createElement("table",{style:{width:"300px",borderCollapse:"collapse",textAlign:"center"}},r.createElement("thead",null,r.createElement("tr",{style:{backgroundColor:"#eee"}},r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"1 min"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"5 min"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"10 min"))),r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:{border:"1px solid #000",padding:"10px",fontSize:"18px"}},nt.apgar1||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"10px",fontSize:"18px"}},nt.apgar5||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"10px",fontSize:"18px"}},nt.apgar10||"-"))))),r.createElement("div",{style:{marginBottom:"25px"}},r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",borderBottom:"1px solid #000",marginBottom:"10px"}},"Obstetric Details"),r.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"15px",fontSize:"13px"}},r.createElement("div",null,r.createElement("strong",null,"Mother's Age:")," ",nt.motherAge||"N/A"),r.createElement("div",null,r.createElement("strong",null,"Parity:")," ",nt.parity||"N/A"),r.createElement("div",{style:{gridColumn:"span 2"}},r.createElement("strong",null,"Antenatal Problems:")," ",nt.antenatalProblems||"None"),r.createElement("div",null,r.createElement("strong",null,"PROM:")," ",nt.prom||"No"),r.createElement("div",null,r.createElement("strong",null,"Liquor:")," ",nt.liquor||"Clear"))),r.createElement("div",{style:{marginBottom:"25px"}},r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",borderBottom:"1px solid #000",marginBottom:"10px"}},"Investigations (Haematology)"),r.createElement("table",{style:{width:"100%",borderCollapse:"collapse",textAlign:"center",fontSize:"12px"}},r.createElement("thead",null,r.createElement("tr",{style:{backgroundColor:"#eee"}},r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"WBC"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"N%"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"Plt"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"Hb"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"CRP"),r.createElement("th",{style:{border:"1px solid #000",padding:"5px"}},"SBR (I/D)"))),r.createElement("tbody",null,r.createElement("tr",null,r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(m=nt.hematology)||void 0===m?void 0:m.wbc)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(y=nt.hematology)||void 0===y?void 0:y.n)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(f=nt.hematology)||void 0===f?void 0:f.plt)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(C=nt.hematology)||void 0===C?void 0:C.hb)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(w=nt.hematology)||void 0===w?void 0:w.crp)||"-"),r.createElement("td",{style:{border:"1px solid #000",padding:"8px"}},(null===(N=nt.hematology)||void 0===N?void 0:N.sbr_i)||"-","/",(null===(A=nt.hematology)||void 0===A?void 0:A.sbr_d)||"-"))))),r.createElement("div",{style:{marginBottom:"25px"}},r.createElement("h3",{style:{fontSize:"16px",fontWeight:"bold",borderBottom:"1px solid #000",marginBottom:"10px"}},"Supportive Care & Medications"),r.createElement("div",{style:{fontSize:"13px",lineHeight:"1.8"}},r.createElement("div",null,r.createElement("strong",null,"Ventilatory Support:")," ",nt.totalVentilatorySupport||"0"," hrs (PIP: ",nt.pip||"-",", PEEP: ",nt.peep||"-",", O2: ",nt.o2Concentration||"-","%)"),r.createElement("div",null,r.createElement("strong",null,"Phototherapy:")," From Day ",(null===(T=nt.phototherapy)||void 0===T?void 0:T.fromDay)||"-"," to Day ",(null===(D=nt.phototherapy)||void 0===D?void 0:D.toDay)||"-"),r.createElement("div",null,r.createElement("strong",null,"IV Fluids:")," From Day ",(null===(B=nt.ivFluids)||void 0===B?void 0:B.fromDay)||"-"," to Day ",(null===(z=nt.ivFluids)||void 0===z?void 0:z.toDay)||"-"))),r.createElement("div",{style:{marginTop:"60px",display:"flex",justifyContent:"space-between"}},r.createElement("div",{style:{fontSize:"12px"}},"Printed Date: ",(new Date).toLocaleDateString()),r.createElement("div",{style:{textAlign:"center"}},r.createElement("div",{style:{borderBottom:"1px solid #000",width:"250px",marginBottom:"5px"}}),r.createElement("div",{style:{fontSize:"12px",fontWeight:"bold"}},"Medical Officer Signature")))))))},N=function(){return r.createElement(w,null)}}}]);
@@ -39,7 +39,7 @@
39
39
  "55.js"
40
40
  ],
41
41
  "auxiliaryFiles": [],
42
- "hash": "3d204a79d579a3ac",
42
+ "hash": "dead830e8ce3e66d",
43
43
  "childrenByOrder": {}
44
44
  },
45
45
  {
@@ -84,7 +84,7 @@
84
84
  "auxiliaryFiles": [
85
85
  "76.js.map"
86
86
  ],
87
- "hash": "f823b9963dfcea23",
87
+ "hash": "5e6ec416d0fa2bc3",
88
88
  "childrenByOrder": {}
89
89
  },
90
90
  {
@@ -111,7 +111,7 @@
111
111
  "auxiliaryFiles": [
112
112
  "79.js.map"
113
113
  ],
114
- "hash": "429c41939b811b27",
114
+ "hash": "ca9033e2465b1062",
115
115
  "childrenByOrder": {}
116
116
  },
117
117
  {
@@ -133,7 +133,7 @@
133
133
  "99.js"
134
134
  ],
135
135
  "auxiliaryFiles": [],
136
- "hash": "40be65aa39bf4bc0",
136
+ "hash": "d513587db585e219",
137
137
  "childrenByOrder": {}
138
138
  },
139
139
  {
@@ -160,7 +160,7 @@
160
160
  "auxiliaryFiles": [
161
161
  "184.js.map"
162
162
  ],
163
- "hash": "96a3b5f4640c8189",
163
+ "hash": "f44112c38461ccb5",
164
164
  "childrenByOrder": {}
165
165
  },
166
166
  {
@@ -182,7 +182,7 @@
182
182
  "197.js"
183
183
  ],
184
184
  "auxiliaryFiles": [],
185
- "hash": "3d460cf445353156",
185
+ "hash": "18798626485fa5da",
186
186
  "childrenByOrder": {}
187
187
  },
188
188
  {
@@ -209,7 +209,7 @@
209
209
  "auxiliaryFiles": [
210
210
  "282.js.map"
211
211
  ],
212
- "hash": "99f0b38fce99c39b",
212
+ "hash": "13f58a0766b96271",
213
213
  "childrenByOrder": {}
214
214
  },
215
215
  {
@@ -231,7 +231,7 @@
231
231
  "300.js"
232
232
  ],
233
233
  "auxiliaryFiles": [],
234
- "hash": "53172a2e983c0556",
234
+ "hash": "b37500bc69fa62a9",
235
235
  "childrenByOrder": {}
236
236
  },
237
237
  {
@@ -258,7 +258,7 @@
258
258
  "auxiliaryFiles": [
259
259
  "311.js.map"
260
260
  ],
261
- "hash": "af113dd734f97d9f",
261
+ "hash": "b87d9314edc0cda9",
262
262
  "childrenByOrder": {}
263
263
  },
264
264
  {
@@ -282,7 +282,7 @@
282
282
  "auxiliaryFiles": [
283
283
  "319.js.map"
284
284
  ],
285
- "hash": "143469f9afd54c8e",
285
+ "hash": "99a3f23fd2ea4df3",
286
286
  "childrenByOrder": {}
287
287
  },
288
288
  {
@@ -309,7 +309,7 @@
309
309
  "auxiliaryFiles": [
310
310
  "332.js.map"
311
311
  ],
312
- "hash": "76a985e21fa507a0",
312
+ "hash": "448e31c1dc6fef6c",
313
313
  "childrenByOrder": {}
314
314
  },
315
315
  {
@@ -331,7 +331,7 @@
331
331
  "335.js"
332
332
  ],
333
333
  "auxiliaryFiles": [],
334
- "hash": "0bcffe261eb4826e",
334
+ "hash": "5fcfd96672a1f41e",
335
335
  "childrenByOrder": {}
336
336
  },
337
337
  {
@@ -355,7 +355,7 @@
355
355
  "auxiliaryFiles": [
356
356
  "353.js.map"
357
357
  ],
358
- "hash": "51c76291c36c65c2",
358
+ "hash": "792dd8021d0291b6",
359
359
  "childrenByOrder": {}
360
360
  },
361
361
  {
@@ -382,7 +382,7 @@
382
382
  "auxiliaryFiles": [
383
383
  "418.js.map"
384
384
  ],
385
- "hash": "4255b6e5606dc784",
385
+ "hash": "2b229876ff75e174",
386
386
  "childrenByOrder": {}
387
387
  },
388
388
  {
@@ -409,7 +409,7 @@
409
409
  "auxiliaryFiles": [
410
410
  "478.js.map"
411
411
  ],
412
- "hash": "58ba547c8029f7db",
412
+ "hash": "d96f685c34a8d3e2",
413
413
  "childrenByOrder": {}
414
414
  },
415
415
  {
@@ -433,7 +433,7 @@
433
433
  "auxiliaryFiles": [
434
434
  "537.js.map"
435
435
  ],
436
- "hash": "ddcb18c4478d13ec",
436
+ "hash": "ce5c7340e2e01351",
437
437
  "childrenByOrder": {}
438
438
  },
439
439
  {
@@ -457,7 +457,7 @@
457
457
  "auxiliaryFiles": [
458
458
  "540.js.map"
459
459
  ],
460
- "hash": "59867075041bca26",
460
+ "hash": "2b1c7f54d9002426",
461
461
  "childrenByOrder": {}
462
462
  },
463
463
  {
@@ -479,7 +479,7 @@
479
479
  "652.js"
480
480
  ],
481
481
  "auxiliaryFiles": [],
482
- "hash": "09efe9f83b0d647f",
482
+ "hash": "e7332eec854bfb9d",
483
483
  "childrenByOrder": {}
484
484
  },
485
485
  {
@@ -506,7 +506,7 @@
506
506
  "auxiliaryFiles": [
507
507
  "691.js.map"
508
508
  ],
509
- "hash": "9a94bc2748f6e20a",
509
+ "hash": "f5c40e61cacd6a84",
510
510
  "childrenByOrder": {}
511
511
  },
512
512
  {
@@ -530,7 +530,7 @@
530
530
  "auxiliaryFiles": [
531
531
  "729.js.map"
532
532
  ],
533
- "hash": "03b6a6c9acab2707",
533
+ "hash": "cc36660c5b338ecc",
534
534
  "childrenByOrder": {}
535
535
  },
536
536
  {
@@ -558,7 +558,7 @@
558
558
  "auxiliaryFiles": [
559
559
  "main.js.map"
560
560
  ],
561
- "hash": "0a79c2ccb81ea852",
561
+ "hash": "2b43229d69650c52",
562
562
  "childrenByOrder": {}
563
563
  },
564
564
  {
@@ -585,7 +585,7 @@
585
585
  "auxiliaryFiles": [
586
586
  "961.js.map"
587
587
  ],
588
- "hash": "d6c9658cd4baf775",
588
+ "hash": "d7195f622d4eea08",
589
589
  "childrenByOrder": {}
590
590
  },
591
591
  {
@@ -609,7 +609,7 @@
609
609
  "auxiliaryFiles": [
610
610
  "966.js.map"
611
611
  ],
612
- "hash": "45a46e8697308a89",
612
+ "hash": "76c6991d9ab8d945",
613
613
  "childrenByOrder": {}
614
614
  },
615
615
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"extensions":[{"name":"Red box","component":"redBox","slot":"Boxes"},{"name":"Blue box","component":"blueBox","slot":"Boxes"},{"name":"Brand box","component":"blueBox","slot":"Boxes"}],"pages":[{"component":"root","route":"ward-discharge"}],"version":"1.0.3"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"extensions":[{"name":"Red box","component":"redBox","slot":"Boxes"},{"name":"Blue box","component":"blueBox","slot":"Boxes"},{"name":"Brand box","component":"blueBox","slot":"Boxes"}],"pages":[{"component":"root","route":"ward-discharge"}],"version":"1.0.4"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@sasindi/ward-discharge",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Customizable OpenMRS microfrontend for discharging patients from wards.",
6
6
  "browser": "dist/openmrs-esm-ward-discharge.js",
7
7
  "main": "src/index.ts",
8
8
  "resolutions": {
9
9
  "open": "8.4.0",
10
- "webpack": "5.106.2"
10
+ "webpack": "5.105.3"
11
11
  },
12
12
  "source": true,
13
13
  "scripts": {