"use strict";(self.webpackChunkmy_app=self.webpackChunkmy_app||[]).push([[128],{7128:(e,a,t)=>{t.r(a),t.d(a,{default:()=>j});var s=t(5043),l=(t(3910),t(6775),t(8258)),n=t(1072),r=t(8602),i=t(3722),o=t(3495),d=t(1137),c=(t(1747),t(3908),t(9837),t(7400),t(3519)),p=t(9397),m=t(7994),u=t(4282),h=(t(4693),t(3023)),x=t.n(h),g=t(8207),S=t(579);const j=e=>{let{props:a}=e;const h=(0,s.useRef)(null),{t:j,i18n:f}=(0,d.Bd)(),[A,N]=(0,s.useState)(),[v,b]=(0,s.useState)(!1),[y,k]=(0,s.useState)(),[D,w]=(0,s.useState)(!1),[C,F]=(0,s.useState)(!1),[I,J]=(0,s.useState)([]),[O,_]=(0,s.useState)(!1),[T,U]=(0,s.useState)(),[B,H]=(0,s.useState)(JSON.parse(sessionStorage.getItem("userData")).organisationUnits),[Y,z]=(0,s.useState)(),[E,M]=(0,s.useState)("Yearly"),[P,G]=(0,s.useState)(!1),L=new Date,[R,q]=(L.getFullYear(),L.getMonth(),L.getMonth(),(0,s.useState)({})),[K,Q]=(0,s.useState)(L.getFullYear().toString()),[V,W]=(0,s.useState)(j("Select File")),[X,Z]=(0,s.useState)(null);return(0,s.useEffect)((()=>{F(!0);O||(k(JSON.parse(sessionStorage.getItem("userData")).orguid),U(B))}),[y,K]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g.A,{isLoading:v}),(0,S.jsxs)("div",{className:"mainContainer",children:[(0,S.jsx)("div",{className:"headerfixedcontainer subnavheaderfixedcontainer",children:(0,S.jsx)(c.A,{fluid:!0,children:(0,S.jsx)("div",{className:"headerbarcontainer",children:(0,S.jsx)("div",{className:"mr-2",children:(0,S.jsxs)(p.A,{children:[(0,S.jsx)(p.A.Item,{href:"#",children:j("Data Upload")}),T?T.map((e=>(0,S.jsx)(p.A.Item,{href:"#",children:e.displayName},e.id))):""]})})})})}),(0,S.jsx)("div",{class:"container-fluid pl-1 pr-1 mt-110px",style:{"margin-top":"160px"},children:(0,S.jsxs)(l.A,{className:"fixHeight data-uploadSection",id:"dataSection",children:[(0,S.jsx)(l.A.Header,{className:"pt-3",children:j("Data Upload")}),(0,S.jsx)(l.A.Body,{children:(0,S.jsxs)(l.A.Text,{children:[(0,S.jsx)(n.A,{children:(0,S.jsx)(r.A,{lg:12,children:(0,S.jsx)(n.A,{children:(0,S.jsx)(r.A,{children:(0,S.jsxs)(i.A.Group,{controlId:"formFileSm",className:"mb-3",children:[(0,S.jsxs)(m.A,{size:"sm",children:[(0,S.jsx)(i.A.Control,{ref:h,"data-title":V,accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",onChange:e=>(e=>{W(e.target.files[0].name);var a=e.target.files[0];Z(a)})(e),type:"file"}),V&&(0,S.jsx)(u.A,{variant:"outline-secondary",onClick:()=>{W(""),Z(""),h.current&&(h.current.value="")},className:"position-absolute end-0 top-0",style:{border:"none",marginTop:"7px",background:"#e5e5e5",fontSize:"1rem",padding:"0.375rem",lineHeight:"1",cursor:"pointer"},children:"\u2716"})]}),V&&(0,S.jsxs)("small",{className:"text-muted mt-2",children:["Selected: ",V]})]})})})})}),(0,S.jsx)(u.A,{onClick:()=>(()=>{b(!0);let e={programuid:JSON.parse(sessionStorage.getItem("userData")).programuid};o.Ay.post("rtmpro/template/generatetemplate",e).then((e=>{b(!1),console.log(e.data.url);var a=document.createElement("a");a.target="_blank",a.download="Download_Template_"+new Date+".xlsx",a.href=e.data.url,a.click()}))})(),className:"nextbtn ml-2",children:j("Download Template")}),(0,S.jsx)(u.A,{disabled:!X,onClick:()=>(()=>{var e=new FormData;e.append("file",X);var a={programid:JSON.parse(sessionStorage.getItem("userData")).programuid};e.append("inputjson",JSON.stringify(a)),(0,o.pk)("uploadfiletest/uploadexceldata",e).then((e=>{console.log(e)})).catch((e=>{console.log(e)})),x()({title:"",text:"File sent for processing, Please check data upload logs",icon:"success",button:"Close"})})(),className:"nextbtn ml-2 ",children:j("Upload")})]})})]})}),(0,S.jsxs)("footer",{className:"footer",children:[(0,S.jsx)("p",{children:"Powered By"}),(0,S.jsx)("img",{src:t(585),alt:"gallary",className:"ml-2"})]})]})]})}}}]);
//# sourceMappingURL=128.4e72946d.chunk.js.map