"use strict";(self.webpackChunkmy_app=self.webpackChunkmy_app||[]).push([[158],{1158:(e,a,t)=>{t.r(a),t.d(a,{default:()=>h});var s=t(5043),r=(t(3910),t(6775),t(8258)),i=t(3495),l=t(1137),n=(t(1747),t(3908)),d=t(9837),o=(t(7400),t(3519)),c=t(4282),m=t(9397),u=(t(4693),t(3023),t(8207)),x=t(579);const h=function(){const{t:e,i18n:a}=(0,l.Bd)(),[h,p]=(0,s.useState)(),[g,j]=(0,s.useState)(!1),[S,f]=(0,s.useState)(),[A,N]=(0,s.useState)(!1),[b,y]=(0,s.useState)(!1),[v,D]=(0,s.useState)([]),[w,I]=(0,s.useState)(!1),[k,C]=(0,s.useState)(),[E,F]=(0,s.useState)(JSON.parse(sessionStorage.getItem("userData")).organisationUnits),[O,H]=(0,s.useState)(),[B,J]=(0,s.useState)("Yearly"),[P,M]=(0,s.useState)(!1),Y=new Date,[T,_]=(Y.getFullYear(),Y.getMonth(),Y.getMonth(),(0,s.useState)({})),[L,U]=(0,s.useState)(Y.getFullYear().toString()),V=()=>{M(!0!==P)},z=()=>{M(!1)},[R,q]=(0,s.useState)(e("Select File")),[G,K]=(0,s.useState)(null),Q=e=>{console.log(O,B,L),j(!0);let a={programuid:JSON.parse(sessionStorage.getItem("userData")).programuid,orguid:JSON.parse(sessionStorage.getItem("userData")).orguid,fromdate:L?L.split(";")[0]:"202408;202409;202410;",todate:"Date Range"==B?L.split(";")[1]:"",filtertype:B||"Monthly",protected:e?"true":"false"};i.Ay.post("dashboardIndicator/dataexport",a).then((e=>{j(!1);var a=document.createElement("a");a.href=e.data.success,a.click()}))};return(0,s.useEffect)((()=>{y(!0);w||(f(JSON.parse(sessionStorage.getItem("userData")).orguid),C(E))}),[S,L]),(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(u.A,{isLoading:g}),(0,x.jsx)(n.A,{sidebar:(0,x.jsx)(d.A,{closeSidebar:z,defaultOrg:E,latestPeriod:L,applyFilter:(e,a,t)=>{I(!0),H(a),J(t),U(e),z()},resetFilter:()=>{U(Y.getFullYear().toString()),H(""),f(E[0].id),C(E),I(!1),z()},tab:"dataExport"}),open:P,onSetOpen:()=>V(),styles:{sidebar:{background:"white",zIndex:99999}},sidebarClassName:"custom-sidebar-class",touch:!0,shadow:!0,transitions:!0,children:(0,x.jsx)("b",{children:"Main content"})}),(0,x.jsxs)("div",{className:"mainContainer",children:[(0,x.jsx)("div",{className:"headerfixedcontainer subnavheaderfixedcontainer",children:(0,x.jsx)(o.A,{fluid:!0,children:(0,x.jsxs)("div",{className:"headerbarcontainer",children:[(0,x.jsx)("div",{className:"mr-2",children:(0,x.jsxs)(c.A,{variant:"primary",className:"selectfilterbtn",onClick:()=>V(),children:[e("Select Filter")," ",(0,x.jsx)("i",{className:"fa fa-caret-down"})]})}),(0,x.jsx)("div",{className:"mr-2",children:(0,x.jsxs)(m.A,{children:[(0,x.jsx)(m.A.Item,{href:"#",children:e("Data Export")}),k?k.map((e=>(0,x.jsx)(m.A.Item,{href:"#",children:e.displayName},e.id))):""]})})]})})}),(0,x.jsxs)("div",{class:"container-fluid pl-1 pr-1 mt-110px d-flex justify-content-around",style:{"margin-top":"150px"},children:[(0,x.jsxs)(r.A,{className:"fixHeight m-2",id:"dataSection",children:[(0,x.jsx)(r.A.Header,{className:"pt-3",children:e("Variable List Export")}),(0,x.jsx)(r.A.Body,{children:(0,x.jsx)(r.A.Text,{children:(0,x.jsx)(c.A,{onClick:()=>(async()=>{const e=JSON.parse(sessionStorage.getItem("userData")),a=(null===e||void 0===e?void 0:e.programuid)||"";if(a)try{var t;const e=await i.Ay.post("rtmpro/template/generateVariableSheet",{programuid:a});if(null!==(t=e.data)&&void 0!==t&&t.url){const a=document.createElement("a");a.href=e.data.url,a.setAttribute("download","Program_Data.xlsx"),document.body.appendChild(a),a.click(),document.body.removeChild(a)}else console.error("Invalid response format:",e.data)}catch(s){console.error("Error downloading Excel file:",s)}else console.warn("Program UID is missing")})(),className:"nextbtn ml-2",children:e("Download")})})})]}),(0,x.jsxs)(r.A,{className:"fixHeight m-2",id:"dataSection",children:[(0,x.jsx)(r.A.Header,{className:"pt-3",children:e("Patient Data Export")}),(0,x.jsx)(r.A.Body,{children:(0,x.jsx)(r.A.Text,{children:(0,x.jsx)(c.A,{onClick:()=>Q(!1),className:"nextbtn ml-2",children:e("Download")})})})]}),(0,x.jsxs)(r.A,{className:"fixHeight m-2",id:"dataSection",children:[(0,x.jsx)(r.A.Header,{className:"pt-3",children:e("De-Identified data export")}),(0,x.jsx)(r.A.Body,{children:(0,x.jsx)(r.A.Text,{children:(0,x.jsx)(c.A,{onClick:()=>Q(!0),className:"nextbtn ml-2",children:e("Download")})})})]})]}),(0,x.jsxs)("footer",{className:"footer",children:[(0,x.jsx)("p",{children:"Powered By"}),(0,x.jsx)("img",{src:t(585),alt:"gallary",className:"ml-2"})]})]})]})}}}]);
//# sourceMappingURL=158.21ca27f6.chunk.js.map