1"use strict";(self.webpackChunkdemo1=self.webpackChunkdemo1||[]).push([[350],{4995:(U,T,i)=>{i.d(T,{n:()=>p});var f=i(520),n=i(2340),A=i(5e3);let p=(()=>{class d{constructor(s){this.apiUrl=`${n.N.apiUrl}/containers/storage/download`,this.http=new f.eN(s)}downloadFileWithContainer(s){return this.http.get(`${this.apiUrl}/${s}`,{responseType:"blob"})}}return d.\u0275fac=function(s){return new(s||d)(A.LFG(f.jN))},d.\u0275prov=A.Yz7({token:d,factory:d.\u0275fac,providedIn:"root"}),d})()},2867:(U,T,i)=>{i.d(T,{U:()=>p});var f=i(520),n=i(2340),A=i(5e3);let p=(()=>{class d{constructor(s){this.apiUrl=`${n.N.apiUrl}/phiReportings`,this.http=new f.eN(s)}getPhiChoAhcData(s){return this.http.post(`${this.apiUrl}/getDashboardAyurvedicPPReport`,s)}getPhiExcel(s){return this.http.post(`${this.apiUrl}/getPhiReportingPost`,s)}getCummulativePhiChoAhc(s){return this.http.post(`${this.apiUrl}/getCummulativeData`,s)}getMonthlyReferralData(s){return this.http.post(`${this.apiUrl}/getMonthlyReferralData`,s)}getWeeklyReferralData(s){return this.http.post(`${this.apiUrl}/getWeeklyReferralData`,s)}getChemistMonthlyReferralData(s){return this.http.post(`${this.apiUrl}/getDashboardChemistReport`,s)}getAHCMonthlyReferralData(s){return this.http.post(`${this.apiUrl}/getDashboardAHC`,s)}getRHPMonthlyReferralData(s){return this.http.post(`${this.apiUrl}/getDashboardRHP`,s)}getPHIWeeklyReferralData(s){return this.http.post(`${this.apiUrl}/getRawData`,s)}getHSC_HWCWeeklyReferralData(s){return this.http.post(`${this.apiUrl}/getDashboardHSC_HWC`,s)}getAllopathyMonthlyReferralData(s){return this.http.post(`${this.apiUrl}/getDashboardAllopathyPPReport`,s)}}return d.\u0275fac=function(s){return new(s||d)(A.LFG(f.jN))},d.\u0275prov=A.Yz7({token:d,factory:d.\u0275fac,providedIn:"root"}),d})()},2271:(U,T,i)=>{i.d(T,{m:()=>O});var f=i(9808),n=i(2042),A=i(3075),p=i(4107),d=i(6856),D=i(7531),s=i(7423),m=i(508),v=i(7621),_=i(5245),N=i(5899),R=i(9943),Z=i(5e3);let O=(()=>{class C{}return C.\u0275fac=function(E){return new(E||C)},C.\u0275mod=Z.oAB({type:C}),C.\u0275inj=Z.cJS({imports:[f.ez,n.mH,R.q,A.UX,A.u5,p.LD,d.FA,D.c,s.ot,m.XK,v.M,_.Ps,N.Cv]}),C})()},3350:(U,T,i)=>{i.r(T),i.d(T,{AchReferralModule:()=>Gt});var f=i(7621),n=i(3075),A=i(7442),p=i(4107),d=i(6856),D=i(7531),s=i(7423),m=i(508),v=i(9808),_=i(8279),N=i(5245),R=i(6087),Z=i(5899),O=i(4847),C=i(9943),y=i(4946),E=i(9826),J=i(7120),k=i(1227),Q=i(5226),x=i.n(Q),H=i(5439),M=i.n(H),B=i(9667),F=i(574),t=i(5e3),L=i(89),W=i(2867),j=i(4995),w=i(6115),P=i(7665),I=i(7322),Y=i(9814),K=i(9783);function z(r,a){1&r&&(t.TgZ(0,"div")(1,"mat-error"),t._uU(2,"Please Select report type "),t.qZA()())}function G(r,a){if(1&r&&(t.TgZ(0,"mat-option",30),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.Q6J("value",e.id),t.xp6(1),t.hij(" ",e.districtName," ")}}function X(r,a){1&r&&(t.TgZ(0,"mat-error"),t._uU(1,"District is required!!!"),t.qZA())}function V(r,a){if(1&r&&(t.TgZ(0,"mat-option",30),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.Q6J("value",e.id),t.xp6(1),t.hij(" ",e.blockName," ")}}function tt(r,a){if(1&r){const e=t.EpF();t.TgZ(0,"mat-option",33),t.NdJ("click",function(){const c=t.CHM(e).$implicit,u=t.oxw(2);return t.KtG(u.designationHandler(c))}),t._uU(1),t.qZA()}if(2&r){const e=a.$implicit;t.Q6J("value",e.value),t.xp6(1),t.hij(" ",e.label," ")}}function et(r,a){1&r&&(t.TgZ(0,"div")(1,"mat-error"),t._uU(2,"Please Select designation for cumulative report "),t.qZA()())}function rt(r,a){if(1&r&&(t.TgZ(0,"div",11)(1,"mat-form-field",12)(2,"mat-label"),t._uU(3,"Designation"),t.qZA(),t.TgZ(4,"mat-select",31),t.YNc(5,tt,2,2,"mat-option",32),t.qZA()(),t.YNc(6,et,3,0,"div",10),t.qZA()),2&r){const e=t.oxw();let o;t.xp6(5),t.Q6J("ngForOf",e.rolesHirechie),t.xp6(1),t.Q6J("ngIf",(null==(o=e.form.get("roleBy"))?null:o.hasError("required"))&&(null==(o=e.form.get("actionType"))?null:o.touched))}}function ot(r,a){1&r&&t._UZ(0,"mat-error")}function at(r,a){if(1&r){const e=t.EpF();t.TgZ(0,"button",34),t.NdJ("click",function(){t.CHM(e);const l=t.oxw();return t.KtG(l.filterCoughReport())}),t._uU(1,"View Report"),t.qZA()}if(2&r){const e=t.oxw();
1t.Q6J("disableRipple",!1)("disabled",e.form.invalid)}}function it(r,a){if(1&r){const e=t.EpF();t.TgZ(0,"button",34),t.NdJ("click",function(){t.CHM(e);const l=t.oxw();return t.KtG(l.generateCoughReport())}),t._uU(1,"Download Report"),t.qZA()}if(2&r){const e=t.oxw();t.Q6J("disableRipple",!1)("disabled",e.form.invalid)}}function lt(r,a){if(1&r&&(t.TgZ(0,"th"),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.header," ")}}function nt(r,a){if(1&r&&(t.TgZ(0,"tr"),t.YNc(1,lt,2,1,"th",35),t.qZA()),2&r){const e=t.oxw();t.xp6(1),t.Q6J("ngForOf",e.cols)}}function ct(r,a){if(1&r&&t._UZ(0,"p-treeTableToggler",38),2&r){const e=t.oxw(2).$implicit;t.Q6J("rowNode",e)}}function st(r,a){if(1&r&&(t.TgZ(0,"td"),t.YNc(1,ct,1,1,"p-treeTableToggler",37),t._uU(2),t.qZA()),2&r){const e=a.$implicit,o=a.index,l=t.oxw().rowData;t.xp6(1),t.Q6J("ngIf",0===o),t.xp6(1),t.hij(" ",l[e.field]," ")}}function mt(r,a){if(1&r&&(t.TgZ(0,"tr",36),t.YNc(1,st,3,2,"td",35),t.qZA()),2&r){const e=a.$implicit,o=t.oxw();t.Q6J("ttRow",e),t.xp6(1),t.Q6J("ngForOf",o.cols)}}const dt=function(){return{"min-width":"50rem"}};let ut=(()=>{class r{constructor(e,o,l,c,u,h,g){this._auth=e,this.fb=o,this.phiReportingServices=l,this.fileLibraryServices=c,this.districtService=u,this.blockService=h,this.changeDetectedRef=g,this.cols=[{field:"level",header:"Activity Month"},{field:"totalNewAdult",header:"Total New Adult* OPD(**age 15 and above)"},{field:"dmcDiagnosisReferral",header:"Total presumptive TB referral to DMC for diagnosis[A]"},{field:"microscopyDmc",header:"Out of A, microscopy conducted in a DMC [B=Out of A]"},{field:"tbDetectedDMC",header:"Out of B, No. of TB cases detected [C=Out of B]"},{field:"naatDiagnosisReferral",header:"Total presumptive TB referral to NAAT for diagnosis[D]"},{field:"naatExamination",header:"Out of D, NAAT examination conducted [E=Out of D]"},{field:"tbCastesDetectedNAAT",header:"Out of E, No. of TB cases detected in [F=Out of E]"}],this.roleWiseDesignation="",this.disableBlock=!1,this.disableDistrict=!1,this.rolesHirechie=[],this.currentUser=this._auth.currentUserValue}ngOnInit(){var e,o,l,c,u,h,g,b;!(null===(e=this.currentUser)||void 0===e)&&e.stateId&&(this.districts$=this.districtService.getDistricts({stateId:null===(o=this.currentUser)||void 0===o?void 0:o.stateId})),this.form=this.createCoughForm();const q=B.U.find($=>{if($.name==B.s.allopathy_pp_referral)return $.hierarchy});this.rolesHirechie=q?q.hierarchy:[],this.getTableData(),((null===(l=this.currentUser)||void 0===l?void 0:l.districtId)||(null===(c=this.currentUser)||void 0===c?void 0:c.blockId)||(null===(u=this.currentUser)||void 0===u?void 0:u.phiId))&&(this.getBlocks(null,null===(h=this.currentUser)||void 0===h?void 0:h.districtId),this.disableDistrict=!(null===(g=this.currentUser)||void 0===g||!g.districtId),this.disableBlock=!(null===(b=this.currentUser)||void 0===b||!b.blockId)),this.updatedHierarchy()}updatedHierarchy(){this.form.value.districtId&&this.form.value.blockId?this.rolesHirechie=this.rolesHirechie.filter(e=>"districtId"!==e.value&&"blockId"!==e.value):this.form.value.districtId?this.rolesHirechie=this.rolesHirechie.filter(e=>"districtId"!==e.value):this.form.value.blockId&&(this.rolesHirechie=this.rolesHirechie.filter(e=>"blockId"!==e.value)),this.changeDetectedRef.detectChanges()}createCoughForm(){var e,o,l;return this.fb.group({districtId:[{value:null!==(e=this.currentUser)&&void 0!==e&&e.districtId?this.currentUser.districtId:"",disabled:this.disableDistrict}],blockId:[{value:null!==(o=this.currentUser)&&void 0!==o&&o.blockId?null===(l=this.currentUser)||void 0===l?void 0:l.blockId:"",disabled:this.disableBlock}],roleBy:["",n.kI.required],actionType:["download",n.kI.required],startDate:[""],endDate:[""]})}getBlocks(e,o){var l,c;this.form.value.blockId="";const u=B.U.find(h=>{if(h.name==B.s.allopathy_pp_referral)return h.hierarchy});this.rolesHirechie=u?u.hierarchy:[],this.rolesHirechie=this.rolesHirechie.filter(h=>"districtId"!==h.value),this.changeDetectedRef.detectChanges(),o=null!==(c=null===(l=null==this?void 0:this.form)||void 0===l?void 0:l.value)&&void 0!==c&&c.hasOwnProperty("districtId")?this.form.value.districtId:this.currentUser.districtId,this.blocks$=this.blockService.getBlocks({districtId:o})}filterCoughReport(){this.phiReportingServices.getMonthlyReferralData({fromDate:this.form.value.startDate,toDate:this.form.value.endDate,districtId:this.form.value.districtId,blockId:this.form.value.blockId}).subscribe(o=>{const l=(0,k.J)(o);this.dataSource=l,this.changeDetectedRef.detectChanges()})}blockChangeHandler(e){this.rolesHirechie=this.rolesHirechie.filter(o=>"blockId"!==o.value)}designationHandler(e){["District","Block"].includes(e.label)||("Private Practitioner"===e.label?this.roleWiseDesignation="privatePractioner":"Rural Practitioner"===e.label&&(this.roleWiseDesignation="ruralPractioner"),this.roleWiseDesignation=e.label)}generateCoughReport(){const e={fromDate:this.form.value.startDate?M()(this.form.value.startDate).format("YYYY-MM-DD"):"",toDate:this.form.value.endDate?M()(this.form.value.endDate).format("YYYY-MM-DD"):""};this.form.value.districtId&&(e.districtId=this.form.value.districtId),this.form.value.blockId&&(e.blockId=this.form.value.blockId),"download"===this.form.value.actionType&&(e.roleBy=this.form.value.roleBy,e.formType="Allopathy_referral",e.designation=this.roleWiseDesignation),console.log("Download params:",e),this.phiReportingServices.getMonthlyReferralData(e).subscribe(o=>{console.log("API response:",o),o&&Array.isArray(o)&&o.length>0?x().fire({title:"Download The Report!",showConfirmButton:!0,confirmButtonText:"Download",showCancelButton:!0}).then(l=>{if(l.isConfirmed){const c=o.map(b=>({"Activity Month":b.level||"","Total New Adult OPD (age 15 and above)":b.totalNewAdult||0,"Total presumptive TB referral to DMC for diagnosis [A]":b.dmcDiagnosisReferral||0,"Out of A, microscopy conducted in a DMC [B=Out of A]":b.microscopyDmc||0,"Out of B, No. of TB cases detected [C=Out of B]":b.tbDetectedDMC||0,"Total presumptive TB referral to NAAT for diagnosis [D]":b.naatDiagnosisReferral||0,"Out of D, NAAT examination conducted [E=Out of D]":b.naatExamination||0,"Out of E, No. of TB cases detected [F=Out of E]":b.tbCastesDetectedNAAT||0})),u=F.P6.json_to_sheet(c),h=F.P6.book_new();F.P6.book_append_sheet(h,u,"AHC Referral Report");const g=`AHC_Monthly_Referral_Report_${M()(this.form.value.startDate).format("DD-MM-YYYY")}_to_${M()(this.form.value.endDate).format("DD-MM-YYYY")}.xlsx`;F.NC(h,g)}}):o&&o.filename?x().fire({title:"Download The Report!",showConfirmButton:!0,confirmButtonText:"Download",showCancelButton:!0}).then(l=>{l.isConfirmed&&this.fileLibraryServices.downloadFileWithContainer(o.filename).subscribe(c=>
1{const u=new Blob([c],{type:c.type||"application/octet-stream"}),h=window.URL.createObjectURL(u),g=document.createElement("a");g.href=h,g.download=o.filename,document.body.appendChild(g),g.click(),document.body.removeChild(g),window.URL.revokeObjectURL(h)},c=>{console.error("Download error:",c),x().fire({title:"Download Failed",text:"Failed to download the file. Please try again.",icon:"error",showConfirmButton:!0,confirmButtonText:"OK"})})}):x().fire({title:"No Data Found",text:"There is no data available to download.",icon:"warning",showConfirmButton:!0,confirmButtonText:"OK"})},o=>{console.error("API error:",o),x().fire({title:"Error",text:"Failed to fetch report data. Please try again.",icon:"error",showConfirmButton:!0,confirmButtonText:"OK"})})}getTableData(){let e={};this.currentUser.districtId&&(e.districtId=this.currentUser.districtId),this.currentUser.blockId&&(e.blockId=this.currentUser.blockId),this.currentUser.designation===J.K.TU&&(e.userId=this.currentUser.id,e.designation=this.currentUser.designation),this.phiReportingServices.getMonthlyReferralData(e).subscribe(o=>{const l=(0,k.J)(o);this.dataSource=l,this.changeDetectedRef.detectChanges()})}}return r.\u0275fac=function(e){return new(e||r)(t.Y36(L.e8),t.Y36(n.qu),t.Y36(W.U),t.Y36(j.n),t.Y36(w.R),t.Y36(P.g),t.Y36(t.sBO))},r.\u0275cmp=t.Xpm({type:r,selectors:[["app-ach-referral-report"]],decls:55,vars:20,consts:[[1,"card-body"],[1,"card-title"],[1,"card-text"],[3,"formGroup"],[1,"row"],[1,"col-lg-12","readonly-wrapper"],[1,"mb-2"],["aria-label","actionType","formControlName","actionType",1,""],["value","download",1,"px-2"],["value","filterReport",1,"px-2"],[4,"ngIf"],[1,"my-2","col-xs-12","col-sm-12","col-md-3"],["appearance","outline",2,"width","100%"],["placeholder","Select District","formControlName","districtId",3,"selectionChange"],[3,"value",4,"ngFor","ngForOf"],["placeholder","Select Block","formControlName","blockId",3,"selectionChange"],["class","my-2 col-xs-12 col-sm-12 col-md-3",4,"ngIf"],[1,"flex","justify-items-center"],[1,"date-range-container"],[3,"rangePicker"],["matStartDate","","formControlName","startDate","placeholder","Start date"],["matEndDate","","formControlName","endDate","placeholder","End date"],["matIconSuffix","",3,"for"],["picker",""],[1,"d-flex","align-items-center","justify-content-between"],["mat-raised-button","","color","primary","style","margin-top: 0.5rem;",3,"disableRipple","disabled","click",4,"ngIf"],[1,"card","w-full"],["sortMode","multiple",3,"value","columns","scrollable","tableStyle"],["pTemplate","header"],["pTemplate","body"],[3,"value"],["placeholder","Select Roles","formControlName","roleBy"],[3,"value","click",4,"ngFor","ngForOf"],[3,"value","click"],["mat-raised-button","","color","primary",2,"margin-top","0.5rem",3,"disableRipple","disabled","click"],[4,"ngFor","ngForOf"],[3,"ttRow"],[3,"rowNode",4,"ngIf"],[3,"rowNode"]],template:function(e,o){if(1&e&&(t.TgZ(0,"div",0)(1,"h1",1),t._uU(2," AHC ( monthly referral) Dashboard"),t.qZA(),t.TgZ(3,"p",2),t._uU(4,"Download the raw data report"),t.qZA(),t.TgZ(5,"form",3)(6,"div",4)(7,"div",5)(8,"div",6)(9,"mat-label"),t._uU(10,"Report Type"),t.qZA()(),t.TgZ(11,"mat-radio-group",7)(12,"mat-radio-button",8),t._uU(13,"Download"),t.qZA(),t.TgZ(14,"mat-radio-button",9),t._uU(15,"Filter View Report"),t.qZA()(),t.YNc(16,z,3,0,"div",10),t.qZA(),t.TgZ(17,"div",11)(18,"mat-form-field",12)(19,"mat-label"),t._uU(20,"District"),t.qZA(),t.TgZ(21,"mat-select",13),t.NdJ("selectionChange",function(c){return o.getBlocks(c,"")}),t.YNc(22,G,2,2,"mat-option",14),t.ALo(23,"async"),t.qZA(),t.YNc(24,X,2,0,"mat-error",10),t.qZA()(),t.TgZ(25,"div",11)(26,"mat-form-field",12)(27,"mat-label"),t._uU(28,"Block"),t.qZA(),t.TgZ(29,"mat-select",15),t.NdJ("selectionChange",function(c){return o.blockChangeHandler(c)}),t.YNc(30,V,2,2,"mat-option",14),t.ALo(31,"async"),t.qZA()()(),t.YNc(32,rt,7,2,"div",16),t.TgZ(33,"div",11)(34,"mat-form-field",12)(35,"mat-label"),t._uU(36,"Date Range"),t.qZA(),t.TgZ(37,"div",17)(38,"div",18)(39,"mat-date-range-input",19),t._UZ(40,"input",20)(41,"input",21),t.qZA(),t._UZ(42,"mat-datepicker-toggle",22),t.qZA(),t._UZ(43,"mat-date-range-picker",null,23),t.qZA(),t.YNc(45,ot,1,0,"mat-error",10),t.qZA()(),t.TgZ(46,"div",11)(47,"div",24),t.YNc(48,at,2,2,"button",25),t.YNc(49,it,2,2,"button",25),t.qZA()()()()(),t.TgZ(50,"div",26)(51,"div",26)(52,"p-treeTable",27),t.YNc(53,nt,2,1,"ng-template",28),t.YNc(54,mt,2,2,"ng-template",29),t.qZA()()()),2&e){const l=t.MAs(44);let c,u,h,g;t.xp6(5),t.Q6J("formGroup",o.form),t.xp6(11),t.Q6J("ngIf",(null==(c=o.form.get("actionType"))?null:c.hasError("required"))&&(null==(c=o.form.get("actionType"))?null:c.touched)),t.xp6(6),t.Q6J("ngForOf",t.lcZ(23,15,o.districts$)),t.xp6(2),t.Q6J("ngIf",o.form.controls.districtId.invalid),t.xp6(6),t.Q6J("ngForOf",t.lcZ(31,17,o.blocks$)),t.xp6(2),t.Q6J("ngIf","download"===(null==(u=o.form.get("actionType"))?null:u.value)),t.xp6(7),t.Q6J("rangePicker",l),t.xp6(3),t.Q6J("for",l),t.xp6(3),t.Q6J("ngIf",o.form.controls.startDate.invali
1d),t.xp6(3),t.Q6J("ngIf","filterReport"===(null==(h=o.form.get("actionType"))?null:h.value)),t.xp6(1),t.Q6J("ngIf","download"===(null==(g=o.form.get("actionType"))?null:g.value)),t.xp6(3),t.Q6J("value",o.dataSource)("columns",o.cols)("scrollable",!0)("tableStyle",t.DdM(19,dt))}},dependencies:[v.sg,v.O5,m.ey,s.lW,d.nW,d.wx,d.zY,d.By,d._g,I.TO,I.KE,I.hX,Y.VQ,Y.U0,p.gD,n._Y,n.Fj,n.JJ,n.JL,n.sg,n.u,y.iw,K.jx,y.gc,y.V4,v.Ov]}),r})();var ht=i(2271),ft=i(9646),S=i(520),pt=i(2340);let _t=(()=>{class r{constructor(e){this.http=e,this.apiUrl=`${pt.N.apiUrl}/phiReportings`}addAchReport(e){return this.http.post(`${this.apiUrl}`,e)}getAchAllData(e){const o=(new S.LE).set("filter",JSON.stringify(e));return this.http.get(`${this.apiUrl}`,{params:o})}}return r.\u0275fac=function(e){return new(e||r)(t.LFG(S.eN))},r.\u0275prov=t.Yz7({token:r,factory:r.\u0275fac,providedIn:"root"}),r})();var gt=i(5714);function vt(r,a){if(1&r&&(t.TgZ(0,"mat-option",10),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.Q6J("value",e.id),t.xp6(1),t.hij(" ",e.districtName," ")}}function At(r,a){1&r&&(t.TgZ(0,"mat-error"),t._uU(1," District is required!!! "),t.qZA())}function Dt(r,a){1&r&&(t.TgZ(0,"mat-error"),t._uU(1,"This field is required"),t.qZA())}function Tt(r,a){1&r&&(t.TgZ(0,"mat-error"),t._uU(1,"This field is required"),t.qZA())}function bt(r,a){1&r&&(t.TgZ(0,"mat-error"),t._uU(1,"Enter a valid 10-digit number"),t.qZA())}function Ct(r,a){1&r&&(t.TgZ(0,"mat-error"),t._uU(1,"This field is required"),t.qZA())}function Rt(r,a){if(1&r&&(t.TgZ(0,"mat-option",10),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.Q6J("value",e.id),t.xp6(1),t.hij(" ",e.blockName," ")}}function Zt(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," MO Name ID "),t.qZA())}function yt(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.moNameId," ")}}function It(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," MO Mobile No "),t.qZA())}function Ut(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.moMobileNo," ")}}function Nt(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," Month "),t.qZA())}function xt(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.month," ")}}function Mt(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," Total New Adult "),t.qZA())}function Bt(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.totalNewAdult," ")}}function Ft(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," DMC Referral "),t.qZA())}function Ot(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.dmcDiagnosisReferral," ")}}function Et(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," Microscopy DMC "),t.qZA())}function kt(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.microscopyDmc," ")}}function wt(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," TB Detected DMC "),t.qZA())}function Pt(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.tbDetectedDMC," ")}}function Yt(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," NAAT Diagnosis "),t.qZA())}function St(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.naatDiagnosisReferral," ")}}function qt(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," NAAT Examination "),t.qZA())}function $t(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.naatExamination," ")}}function Jt(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," TB Cases NAAT "),t.qZA())}function Qt(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",e.tbCastesDetectedNAAT," ")}}function Ht(r,a){1&r&&(t.TgZ(0,"th",43),t._uU(1," Submission Date "),t.qZA())}function Lt(r,a){if(1&r&&(t.TgZ(0,"td",44),t._uU(1),t.ALo(2,"date"),t.qZA()),2&r){const e=a.$implicit;t.xp6(1),t.hij(" ",t.xi3(2,1,e.submissionDate,"MMM d, y")," ")}}function Wt(r,a){1&r&&t._UZ(0,"tr",45)}function jt(r,a){1&r&&t._UZ(0,"tr",46)}const Kt=function(){return[5,10,20]};let zt=(()=>{class r{constructor(e,o,l,c,u){this.formBuilder=e,this.achService=o,this._auth=l,this.districtService=c,this.blockService=u,this.displayedColumns=["moNameId","moMobileNo","month","totalNewAdult","dmcDiagnosisReferral","microscopyDmc","tbDetectedDMC","naatDiagnosisReferral","naatExamination","tbCastesDetectedNAAT","submissionDate"],this.dataSource=new _.by,this.currentUser=this._auth.currentUserValue}ngOnInit(){var e,o,l,c;this.initializeForm(),this.currentUser&&this.currentUser.stateId&&(this.districts$=this.districtService.getDistricts({stateId:this.currentUser.stateId})),((null===(e=this.currentUser)||void 0===e?void 0:e.districtId)||(null===(o=this.currentUser)||void 0===o?void 0:o.blockId)||(null===(l=this.currentUser)||void 0===l?void 0:l.phiId))&&this.getBlocks(null===(c=this.currentUser)||void 0===c?void 0:c.districtId),this.loadTableData()}ngAfterViewInit(){this.dataSource.paginator=this.paginator}loadDistricts(){var e;this.districts$=this.districtService.getDistricts({stateId:null===(e=this.currentUser)||void 0===e?void 0:e.stateId})}onDistrictChange(e){const o=e.value;this.achForm.patchValue({districtId:o,blockId:""}),this.getBlocks(o)}getBlocks(e){var o,l;!(null===(l=null===(o=null==this?void 0:this.achForm)||void 0===o?void 0:o.value)||void 0===l)&&l.hasOwnProperty("districtId")||this.achForm.patchValue({districtId:e}),this.blocks$="Outside Himachal Pradesh"===e?(0,ft.of)([{blockName:"NA",id:"NA"}]):this.blockService.getBlocks({districtId:e})}initializeForm(){this.getFromLocal$=this._auth.currentUserSubject.asObservable(),this.getFromLocal$.subscribe(e=>{this.achForm=this.formBuilder.group({moNameId:["",n.kI.required],moMobileNo:["",[n.kI.required,n.kI.pattern(/^[0-9]{10}$/)]],month:["",n.kI.required],totalNewAdult:["",[n.kI.required,n.kI.min(1)]],dmcDiagnosisReferral:["",[n.kI.required,n.kI.min(0)]],microscopyDmc:["",[n.kI.required,n.kI.min(0)]],tbDetectedDMC:["",[n.kI.required,n.kI.min(0)]],naatDiagnosisReferral:["",[n.kI.required,n.kI.min(0)]],naatExamination:["",[n.kI.required,n.kI.min(0)]],tbCastesDetectedNAAT:["",[n.kI.required,n.kI.min(0)]],createdBy:[this.currentUser.id||""],submissionDate:[Date.now()],stateId:[(null==e?void 0:e.stateId)||""],districtId:["",n.kI.required],blockId:["",n.kI.required]})})}onSubmit(){if(this.achForm.valid){const e=Object.assign({},this.achForm.value);e.month=this.extractMonthNumber(e.month),this.insertAchData(e),this.loadTableData()}
1else console.error("Form is invalid. Please fill all required fields correctly.")}insertAchData(e){this.achService.addAchReport(e).subscribe(o=>{console.log("Data Inserted Successfully",o),alert("Data saved successfully!"),this.achForm.reset()},o=>{console.error("Error while inserting data:",o),alert("Failed to save data. Please try again.")})}isNumberField(e){return["totalNewAdult","dmcDiagnosisReferral","microscopyDmc","tbDetectedDMC","naatDiagnosisReferral","naatExamination","tbCastesDetectedNAAT"].includes(e)}extractMonthNumber(e){return e?parseInt(e.split("-")[1],10):null}getFinancialYearDates(){const e=new Date,o=e.getFullYear();let c,u;return e.getMonth()>=3?(c=new Date(o,3,1),u=new Date(o+1,2,31,23,59,59)):(c=new Date(o-1,3,1),u=new Date(o,2,31,23,59,59)),{fromDate:c.getTime(),toDate:u.getTime()}}loadTableData(){const{fromDate:e,toDate:o}=this.getFinancialYearDates();this.achService.getAchAllData({where:{createdBy:this.currentUser.id,submissionDate:{between:[e,o]}}}).subscribe({next:c=>{c&&Array.isArray(c)?this.dataSource.data=c:(console.warn("Unexpected API response format:",c),this.dataSource.data=[])},error:c=>{console.error("Error fetching data:",c),this.dataSource.data=[]}})}}return r.\u0275fac=function(e){return new(e||r)(t.Y36(n.qu),t.Y36(_t),t.Y36(gt.e),t.Y36(w.R),t.Y36(P.g))},r.\u0275cmp=t.Xpm({type:r,selectors:[["app-ach-referral-form"]],viewQuery:function(e,o){if(1&e&&t.Gf(R.NW,5),2&e){let l;t.iGM(l=t.CRH())&&(o.paginator=l.first)}},decls:124,vars:19,consts:[[1,"container"],[1,"card","w-full",2,"margin-bottom","10px"],[1,"card-body"],[1,"w-full",3,"formGroup","ngSubmit"],[1,"flex","justify-evenly","gap-1"],[1,"row"],[1,"col-lg-3","readonly-wrapper"],["appearance","outline",2,"width","100%"],["placeholder","Select District","formControlName","districtId",3,"selectionChange"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],[4,"ngIf"],["matInput","","formControlName","moNameId","placeholder","Enter MO Name ID","required",""],["matInput","","type","tel","formControlName","moMobileNo","placeholder","Enter Mobile Number"],["matInput","","type","month","formControlName","month"],["placeholder","Select Block","formControlName","blockId"],["matInput","","type","number","formControlName","totalNewAdult"],["matInput","","type","number","formControlName","dmcDiagnosisReferral"],["matInput","","type","number","formControlName","microscopyDmc"],["matInput","","type","number","formControlName","tbDetectedDMC"],["matInput","","type","number","formControlName","naatDiagnosisReferral"],["matInput","","type","number","formControlName","naatExamination"],["matInput","","type","number","formControlName","tbCastesDetectedNAAT"],[1,"d-flex","justify-content-center"],["mat-raised-button","","color","primary","type","submit",3,"disabled"],[1,"card","w-full"],["mat-table","",1,"shadow-xl","w-full","h-full",3,"dataSource"],["matColumnDef","moNameId"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","moMobileNo"],["matColumnDef","month"],["matColumnDef","totalNewAdult"],["matColumnDef","dmcDiagnosisReferral"],["matColumnDef","microscopyDmc"],["matColumnDef","tbDetectedDMC"],["matColumnDef","naatDiagnosisReferral"],["matColumnDef","naatExamination"],["matColumnDef","tbCastesDetectedNAAT"],["matColumnDef","submissionDate"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["showFirstLastButtons","",3,"pageSizeOptions"],["mat-header-cell",""],["mat-cell",""],["mat-header-row",""],["mat-row",""]],template:function(e,o){if(1&e&&(t.TgZ(0,"div",0)(1,"h3")(2,"b"),t._uU(3,"ACH Referral Monthly Form"),t.qZA()(),t.TgZ(4,"div",1)(5,"div",2)(6,"form",3),t.NdJ("ngSubmit",function(){return o.onSubmit()}),t.TgZ(7,"div",4)(8,"div",5)(9,"div",6)(10,"mat-form-field",7)(11,"mat-label"),t._uU(12,"District Name"),t.qZA(),t.TgZ(13,"mat-select",8),t.NdJ("selectionChange",function(c){return o.onDistrictChange(c)}),t.YNc(14,vt,2,2,"mat-option",9),t.ALo(15,"async"),t.TgZ(16,"mat-option",10),t._uU(17,"Outside Himachal Pradesh"),t.qZA()(),t.YNc(18,At,2,0,"mat-error",11),t.qZA()(),t.TgZ(19,"div",6)(20,"mat-form-field",7)(21,"mat-label"),t._uU(22,"MO Name ID"),t.qZA(),t._UZ(23,"input",12),t.YNc(24,Dt,2,0,"mat-error",11),t.qZA()(),t.TgZ(25,"div",6)(26,"mat-form-field",7)(27,"mat-label"),t._uU(28,"MO Mobile No"),t.qZA(),t._UZ(29,"input",13),t.YNc(30,Tt,2,0,"mat-error",11),t.YNc(31,bt,2,0,"mat-error",11),t.qZA()(),t.TgZ(32,"div",6)(33,"mat-form-field",7)(34,"mat-label"),t._uU(35,"Month"),t.qZA(),t._UZ(36,"input",14),t.YNc(37,Ct,2,0,"mat-error",11),t.qZA()()(),t.TgZ(38,"div",5)(39,"div",6)(40,"mat-form-field",7)(41,"mat-label"),t._uU(42,"Current Health Block Name"),t.qZA(),t.TgZ(43,"mat-select",15),t.YNc(44,Rt,2,2,"mat-option",9),t.ALo(45,"async"),t.qZA()()(),t.TgZ(46,"div",6)(47,"mat-form-field",7)(48,"mat-label"),t._uU(49,"Total New Adult"),t.qZA(),t._UZ(50,"input",16),t.qZA()(),t.TgZ(51,"div",6)(52,"mat-form-field",7)(53,"mat-label"),t._uU(54,"DMC Diagnosis Referral"),t.qZA(),t._UZ(55,"input",17),t.qZA()(),t.TgZ(56,"div",6)(57,"mat-form-field",7)(58,"mat-label"),t._uU(59,"Microscopy DMC"),t.qZA(),t._UZ(60,"input",18),t.qZA()()(),t.TgZ(61,"div",5)(62,"div",6)(63,"mat-form-field",7)(64,"mat-label"),t._uU(65,"TB Detected DMC"),t.qZA(),t._UZ(66,"input",19),t.qZA()(),t.TgZ(67,"div",6)(68,"mat-form-field",7)(69,"mat-label"),t._uU(70,"NAAT Diagnosis Referral"),t.qZA(),t._UZ(71,"input",20),t.qZA()(),t.TgZ(72,"div",6)(73,"mat-form-field",7)(74,"mat-label"),t._uU(75,"NAAT Examination"),t.qZA(),t._UZ(76,"input",21),t.qZA()(),t.TgZ(77,"div",6)(78,"mat-form-field",7)(79,"mat-label"),t._uU(80,"TB Cases Detected NAAT"),t.qZA(),t._UZ(81,"input",22),t.qZA()()(),t.TgZ(82,"div",23)(83,"button",24),t._uU(84,"Submit"),t.qZA()()()()()()(),t.TgZ(85,"div",25)(86,"div",2)(87,"table",26),t.ynx(88,27),t.YNc(89,Zt,2,0,"th",28),t.YNc(90,yt,2,1,"td",29),t.BQk(),t.ynx(91,30),t.YNc(92,It,2,0,"th",28),t.YNc(93,Ut,2,1,"td",29),t.BQk(),t.ynx(94,31),t.YNc(95,Nt,2,0,"th",28),t.YNc(96,xt,2,1,"td",29),t.BQk(),t.ynx(97,32),t.YNc(98,Mt,2,0,"th",28),t.YNc(99,Bt,2,1,"td",29),t.BQk(),t.ynx(100,33),t.YNc(101,Ft,2,0,"th",28),t.YNc(102,Ot,2,1,"td",29),t.BQk(),t.ynx(103,34),t.YNc(104,Et,2,0,"th",28),t.YNc(105,kt,2,1,"td",29),t.BQk(),t.ynx(106,35),t.YNc(107,wt,2,0,"th",28),t.YNc(108,Pt,2,1,"td",29),t.BQk(),t.ynx(109,36),t.YNc(110,Yt,2,0,"th",28),t.YNc(111,St,2,1,"td",29),t.BQk(),t.ynx(112,37),t.YNc(113,qt,2,0,"th",28),t.YNc(114,$t,2,1,"td",29),t.BQk(),t.ynx(115,38),t.YNc(116,Jt,2,0,"th",28),t.YNc(117,Qt,2,1,"td",29),t.BQk(),t.ynx(118,39),t.YNc(119,Ht,2,0,"th",28),t.YNc(120,Lt,3,4,"td",29),t.BQk(),t.YNc(121,Wt,1,0,"tr",40),t.YNc(122,jt,1,0,"tr",41),t.qZA(),t._UZ(123,"mat-paginator",42),t.qZA()()),2&e){let l,c,u,h,g;t.xp6(6),t.Q6J("formGroup",o.achForm),t.xp6(8),t.Q6J("ngForOf",t.lcZ(1
15,14,o.districts$)),t.xp6(2),t.Q6J("value","Outside Himachal Pradesh"),t.xp6(2),t.Q6J("ngIf",null==(l=o.achForm.get("districtId"))?null:l.hasError("required")),t.xp6(6),t.Q6J("ngIf",null==(c=o.achForm.get("moNameId"))?null:c.hasError("required")),t.xp6(6),t.Q6J("ngIf",null==(u=o.achForm.get("moMobileNo"))?null:u.hasError("required")),t.xp6(1),t.Q6J("ngIf",null==(h=o.achForm.get("moMobileNo"))?null:h.hasError("pattern")),t.xp6(6),t.Q6J("ngIf",null==(g=o.achForm.get("month"))?null:g.hasError("required")),t.xp6(7),t.Q6J("ngForOf",t.lcZ(45,16,o.blocks$)),t.xp6(39),t.Q6J("disabled",o.achForm.invalid),t.xp6(4),t.Q6J("dataSource",o.dataSource),t.xp6(34),t.Q6J("matHeaderRowDef",o.displayedColumns),t.xp6(1),t.Q6J("matRowDefColumns",o.displayedColumns),t.xp6(1),t.Q6J("pageSizeOptions",t.DdM(18,Kt))}},dependencies:[v.sg,v.O5,m.ey,s.lW,I.TO,I.KE,I.hX,D.Nt,R.NW,p.gD,_.BZ,_.fO,_.as,_.w1,_.Dz,_.nj,_.ge,_.ev,_.XQ,_.Gk,n._Y,n.Fj,n.wV,n.JJ,n.JL,n.Q7,n.sg,n.u,v.Ov,v.uU],styles:[".mat-row:nth-child(even){background-color:#f0f5ef} mat-footer-row, mat-header-row, mat-row, td.mat-cell, td.mat-footer-cell, th.mat-header-cell{border:1px solid #ccc;padding:5px!important} th.mat-header-cell{background-color:#7393b3;color:#fff;font-size:14px} .mat-header-row, .mat-row{height:30px!important;min-height:0px!important} .mat-sort-header-arrow{color:#fff}"]}),r})(),Gt=(()=>{class r{}return r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=t.oAB({type:r}),r.\u0275inj=t.cJS({imports:[v.ez,ht.m,A.m,C.q,n.UX,n.u5,p.LD,d.FA,D.c,s.ot,m.XK,f.M,N.Ps,R.TU,Z.Cv,O.JX,_.p0,y.dp,E.Bz.forChild([{path:"report",component:ut},{path:"form",component:zt}])]}),r})()},9667:(U,T,i)=>{i.d(T,{U:()=>n,s:()=>f});const f={allopathy_pp_referral:"allopathy_pp_referral",ayurvedic_pp_referral:"ayurvedic_pp_referral",rural_hp_referral:"rural_hp_referral",ahc_referral:"ahc_referral",phi_weekly_referral:"phi_weekly_referral",indoor_ward_report:"indoor_ward_report"},n=[{name:f.allopathy_pp_referral,hierarchy:[{label:"District",value:"districtId"},{label:"Block",value:"blockId"},{label:"PHI",value:"createdBy"},{label:"Private Practitioner",value:"createdBy"}]},{name:f.ayurvedic_pp_referral,hierarchy:[{label:"District",value:"districtId"},{label:"Block",value:"blockId"},{label:"PHI",value:"createdBy"},{label:"Rural Practitioner",value:"createdBy"}]},{name:f.rural_hp_referral,hierarchy:[{label:"District",value:"districtId"},{label:"Block",value:"blockId"},{label:"PHI",value:"createdBy"},{label:"Private Practitioner",value:"createdBy"}]},{name:f.ahc_referral,hierarchy:[{label:"District",value:"districtId"},{label:"Block",value:"blockId"},{label:"AHC ",value:"createdBy"},{label:"AHC ayuveda",value:"createdBy"}]},{name:f.phi_weekly_referral,hierarchy:[{label:"District",value:"districtId"},{label:"Block",value:"blockId"},{label:"PHI",value:"createdBy"}]},{name:f.indoor_ward_report,hierarchy:[{label:"District",value:"districtId"},{label:"Block",value:"blockId"},{label:"PHI",value:"createdBy"}]}]},1227:(U,T,i)=>{i.d(T,{J:()=>f});const f=n=>{const A=(p,d)=>{const D={key:d,data:Object.assign({},p),children:[]};return p.districts?D.children=p.districts.map((s,m)=>{const v=`${d}-${m}`,_=A(s,v);return s.blocks&&(_.children=s.blocks.map((N,R)=>A(N,`${v}-${R}`))),_}):p.blocks?D.children=p.blocks.map((s,m)=>A(s,`${d}-${m}`)):p.phis&&(D.children=p.phis.map((s,m)=>A(s,`${d}-${m}`))),D};return n.map((p,d)=>A(p,d.toString()))}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.