hplx-feature-library 1.0.231 → 1.0.233

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.
@@ -1 +0,0 @@
1
- "use strict";const t=require("./index-DQlbIHh3.cjs"),n=require("react"),W=require("./APIAction-DB6Ulkss.cjs"),J=require("./useMediaQuery-D4SIgdMW.cjs"),p=require("./common-utils-DrDXKNhv.cjs"),V=Math.abs(window.orientation||0)===90,X=P=>{const{addPatientHandler:k,disabled:x,manipulateExistingDOM:C,onPatientSelect:w,showSearchBar:D,setShowSearchBar:a,variable:T}=P,{window_var:o,token:y,envName:v}=T,[c,f]=n.useState(!1),d=n.useRef(null),u=n.useRef(null),[A,G]=n.useState(0),[L,l]=n.useState([]),U=6,[E,b]=n.useState(""),[F,B]=n.useState([]),[$,R]=n.useState(!0),[q,S]=n.useState([]),h=J.useMediaQuery("(max-width: 1024px)"),m=(e,s,r,i)=>{B([{id:1,title:e,description:s,type:r,duration:i}])},_=n.useCallback(async e=>{try{const s={branch_id:o?.org_branch_id_for_seg||"",doctor_id:o?.person_id_for_seg||"",doctor_role_id:o?.doctor_role_id_for_seg||"",term:encodeURIComponent(e),limit:30},r=await W.getPatientList(s,{envName:v,token:y});if(!r){l([]),m("Error","No response received from server","Error",3e3);return}const i=r,N=window.filteredUpcomingAppts||[];if(i.apiError){l([]),m("Error",i.apiError,"Error",3e3);return}i?.persons?.length?(l(i.persons),f(!0),G(Number(i.total_persons))):l([]),N?.length?(R(!1),S(N.slice(0,5))):(R(!0),S([]))}catch(s){console.error(s),m("Error","Something went wrong while fetching patients","Error",3e3)}},[v,y,o?.doctor_role_id_for_seg,o?.org_branch_id_for_seg,o?.person_id_for_seg]),z=n.useMemo(()=>p.debounceFn(e=>{_(e)},500),[_]),H=e=>{const s=e.currentTarget.value.trim();(!isNaN(Number(s.charAt(0)))||s.length>=2)&&z(s)},M=()=>{c||_(E)},O=()=>{x||f(e=>!e)},g=n.useCallback(e=>{u.current&&c&&!u.current.contains(e.target)&&(f(!1),l([]))},[c]);n.useEffect(()=>(document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)),[g,c]);const Q=e=>{window.location.href.includes("/frontdesk")?window.patientPopupHandlerFromFD(e.patient_role_id,e.patient_person_id):p.goToPage(`viewPatientDashboard.php?pid=${e.patient_role_id}`)},I=async e=>{let s=!0;if(typeof window.beforePatientChange=="function"&&window.location.pathname==p.EAPP_ROUTES.visitpad&&(s=window.beforePatientChange()),f(!1),l([]),!s)return;if(w){w(e);return}window.patient_role_id=e.person_role_id!=="0"?e.person_role_id.toString():"0",window.patient_person_id=e.person_id!=="0"?e.person_id.toString():"0";const r=(e.person_role_id==="0",e.person_role_id);if(r&&(C?.(),window.location.href.includes("/frontdesk"))){window.patientPopupHandlerFromFD(r,e.person_id);return}p.goToPage(`viewPatientDashboard.php?pid=${r}`)},K=()=>{O(),k(),b("")},j=n.useCallback(e=>{d.current&&!d.current.contains(e.target)&&h&&a(!1)},[h,a]);return n.useEffect(()=>(document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)),[j]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[D?t.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-items-center hfl-justify-center hfl-rounded-full hfl-bg-Blue-900 hfl-text-White ${x?"hfl-pointer-events-none hfl-opacity-60":""}`,title:x?"Low internet speed. Feature available only in online mode":"Search Patient",children:[t.jsxRuntimeExports.jsx("input",{ref:d,type:"text",placeholder:"Search Patient 🔍",className:`hfl-rounded-full hfl-border-none hfl-bg-Blue-900 hfl-py-2 hfl-pl-4 ${h&&!V?"xxs:hfl-w-[400px]":"hfl-min-w-[150px]"} sm:hfl-w-full`,"data-qa":"testid_patientSearch",value:E,onKeyUp:H,onChange:e=>b(e.target.value),onClick:M,onBlur:()=>h&&a(!1)}),h&&t.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-cursor-pointer hfl-pr-4",onClick:()=>a(e=>!e)})]}):t.jsxRuntimeExports.jsxs("div",{onClick:()=>a(e=>!e),className:"hfl-flex hfl-cursor-pointer hfl-flex-col hfl-items-center xs:hfl-mr-1 md:hfl-mr-0",children:[t.jsxRuntimeExports.jsx("i",{className:"hx_search",style:{fontSize:"18px"}}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",children:"Search"})]}),t.jsxRuntimeExports.jsx(t.qh,{toastList:F}),t.jsxRuntimeExports.jsxs("div",{ref:u,className:`hfl-absolute hfl-right-[255px] hfl-top-[50px] hfl-max-h-[400px] hfl-w-[430px] hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Gray-300 hfl-bg-White hfl-shadow-md ${c?"hfl-block":"hfl-hidden"}`,children:[!$&&t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col",children:[t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-py-[10px] ",children:[t.jsxRuntimeExports.jsx(t.bs,{className:"hfl-px-[12px] hfl-text-Gray-400",variant:"Semibold",type:"Text xs",children:"Upcoming Appointments"}),t.jsxRuntimeExports.jsx("a",{href:"viewPatientAppointments.php",children:t.jsxRuntimeExports.jsx("i",{className:"hx_r-open hfl-text-Primary-700"})})]}),q.map((e,s)=>t.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-cursor-pointer hfl-justify-between hfl-px-[12px] hfl-py-[4px] hover:hfl-bg-Blue_gray-200 ${s%2===1?"":"hfl-bg-Gray-100"}`,onClick:()=>Q(e),children:[t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-min-w-[92px] hfl-items-center hfl-justify-center hfl-rounded-lg hfl-border hfl-border-Gray-100 hfl-bg-White_20 hfl-p-2",children:t.jsxRuntimeExports.jsx(t.bs,{className:"hfl-whitespace-nowrap hfl-text-Gray-500",variant:"Regular",type:"Text lg",children:e.appnt_time})}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-px-3",children:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text md",className:"hfl-text-Gray-700",children:e.org_person_name}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-500",children:e.org_person_phone})]}),t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:t.jsxRuntimeExports.jsx("i",{className:"hx_play-filled hfl-text-Gray-300"})})]},e.patient_role_id))]}),t.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col",children:[t.jsxRuntimeExports.jsx(t.bs,{style:{fontSize:"14px"},variant:"Semibold",type:"Text sm",className:"hfl-px-[12px] hfl-py-[8px] hfl-text-Primary-600",children:"Patients List"}),t.jsxRuntimeExports.jsx("div",{className:"hfl-max-h-[40vh] hfl-overflow-y-auto scrollbar-hide",children:L.map((e,s)=>t.jsxRuntimeExports.jsxs("div",{className:`hfl-cursor-pointer hfl-px-[11px] hfl-py-[12px] hfl-leading-9 hover:hfl-bg-Blue_gray-200 ${s%2===1?"":"hfl-bg-Gray-100"}`,onClick:()=>I(e),children:[t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text sm",className:"hfl-inline hfl-uppercase hfl-text-Gray-700",style:{fontSize:"14px"},children:e.org_person_bid_str?e.org_person_bid_str+": ":""}),t.jsxRuntimeExports.jsxs(t.bs,{variant:"Medium",type:"Text sm",className:" hfl-inline hfl-capitalize hfl-text-Gray-700",style:{fontSize:"14px"},children:[e.org_person_name," ",t.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-block",children:["(",e.ageStr.split(" ")[0],", ",p.getGender(Number(e.org_person_gender)),")"]})," "]}),t.jsxRuntimeExports.jsx(t.bs,{variant:"Regular",type:"Text sm",className:"hfl-inline-block hfl-text-Gray-700",style:{fontSize:"14px"},children:e.org_person_phone?`Ph: ${e.org_person_phone}`:""})]},e.person_role_id))})]}),A<U&&t.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-center",id:"newPatientAdd",children:t.jsxRuntimeExports.jsx(t.Ku,{hierarchy:"Secondary",icon:"Left",iconFile:"hx_add",onClick:K,size:"lg",textField:"Create New Patient",className:"hfl-flex hfl-w-full hfl-justify-center"})})]})]})};exports.SearchPatients=X;