1"use strict";(self.webpackChunkdemo1=self.webpackChunkdemo1||[]).push([[909],{4995:(k,b,s)=>{s.d(b,{n:()=>Z});var U=s(520),u=s(2340),T=s(5e3);let Z=(()=>{class h{constructor(f){this.apiUrl=`${u.N.apiUrl}/containers/storage/download`,this.http=new U.eN(f)}downloadFileWithContainer(f){return this.http.get(`${this.apiUrl}/${f}`,{responseType:"blob"})}}return h.\u0275fac=function(f){return new(f||h)(T.LFG(U.jN))},h.\u0275prov=T.Yz7({token:h,factory:h.\u0275fac,providedIn:"root"}),h})()},6909:(k,b,s)=>{s.r(b),s.d(b,{ExpiryDrugModule:()=>Kt});var U=s(7621),u=s(3075),T=s(7442),Z=s(9826),h=s(4107),p=s(6856),f=s(7531),N=s(7423),E=s(508),D=s(9808),l=s(8279),q=s(5245),_=s(6087),S=s(5899),y=s(4847),R=s(9943),t=s(5e3),O=s(727),Q=s(5226),w=s.n(Q),M=s(5439),v=s.n(M),C=s(7120),B=s(4995),J=s(2340),P=s(520);let Y=(()=>{class e{constructor(r){this.http=r,this.apiUrl=`${J.N.apiUrl}/ExpiryDrugReportings`}getExpiredDrugReport(r){return this.http.post(`${this.apiUrl}/getRawData`,r)}getExpiredDrugCount(r){return this.http.post(`${this.apiUrl}/getExpiredDrugCount`,r)}createExpiredDrug(r){return this.http.post(this.apiUrl,r)}getExpiredDrug(r){const i=`${this.apiUrl}?filter=${JSON.stringify(r)}`;return this.http.get(i)}}return e.\u0275fac=function(r){return new(r||e)(t.LFG(P.eN))},e.\u0275prov=t.Yz7({token:e,factory:e.\u0275fac,providedIn:"root"}),e})();var F=s(89),$=s(6115),L=s(7665),j=s(1225),x=s(7322);function W(e,o){if(1&e&&(t.TgZ(0,"mat-option",39),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.Q6J("value",r.id),t.xp6(1),t.hij(" ",r.districtName," ")}}function G(e,o){1&e&&(t.TgZ(0,"mat-error"),t._uU(1,"District is required!!"),t.qZA())}function H(e,o){if(1&e&&(t.TgZ(0,"mat-option",39),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.Q6J("value",r.id),t.xp6(1),t.hij(" ",r.blockName," ")}}function z(e,o){1&e&&t._UZ(0,"mat-error")}function K(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"District Name "),t.qZA())}function X(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.district)}}function V(e,o){1&e&&(t.ynx(0,40),t.YNc(1,K,2,0,"th",27),t.YNc(2,X,2,1,"td",28),t.BQk())}function tt(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"TU Store "),t.qZA())}function et(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.block)}}function rt(e,o){1&e&&(t.ynx(0,43),t.YNc(1,tt,2,0,"th",27),t.YNc(2,et,2,1,"td",28),t.BQk())}function it(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"User"),t.qZA())}function ot(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.user)}}function nt(e,o){1&e&&(t.ynx(0,44),t.YNc(1,it,2,0,"th",27),t.YNc(2,ot,2,1,"td",28),t.BQk())}function at(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"Month "),t.qZA())}function st(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.month)}}function lt(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"Name of Expiry Drug"),t.qZA())}function ut(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.productName)}}function ct(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"Unit Of Measurement"),t.qZA())}function mt(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.UOM)}}function dt(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"Quantity"),t.qZA())}function pt(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.quantity)}}function ht(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"Batch Number"),t.qZA())}function gt(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.batchNumber)}}function ft(e,o){1&e&&(t.TgZ(0,"th",41),t._uU(1,"Expiry Date"),t.qZA())}function Dt(e,o){if(1&e&&(t.TgZ(0,"td",42),t._uU(1),t.ALo(2,"date"),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(t.lcZ(2,1,r.expiryDate))}}function yt(e,o){1&e&&t._UZ(0,"tr",45)}function xt(e,o){1&e&&t._UZ(0,"tr",46)}function _t(e,o){1&e&&(t.TgZ(0,"tr",47)(1,"td",48),t._uU(2,"No data matching the filter"),t.qZA()())}const vt=function(){return[10,25,100]};let bt=(()=>{class e{constructor(r,i,n,a,c,d,m){this.fb=r,this.fileLibraryServices=i,this.expirydrugreportingService=n,this._auth=a,this.districtService=c,this.blockService=d,this.PhiService=m,this.subscription=new O.w0,this.disableBlock=!1,this.disableDistrict=!1,this.showDistrictTable=!0,this.showBlockTable=!0,this.showTuTable=!0,this.showPhiChoTable=!0,this.displayedColumns=[],this.paginator=new t.n_E,this.sort=new t.n_E,this.currentUser=this._auth.currentUserValue,this.displayedColumns=this.currentUser.designation===C.K.STATE?["month","productName","UOM","quantity","batchNumber","expiryDate"]:this.currentUser.designation===C.K.DISTRICT?["district","month","productName","UOM","quantity","batchNumber","expiryDate"]:["district","block","user","month","productName","UOM","quantity","batchNumber","expiryDate"]}ngOnInit(){var r,i,n,a,c,d,m,g,I,A;!(null===(r=this.currentUser)||void 0===r)&&r.stateId&&(this.districts$=this.districtService.getDistricts({stateId:null===(i=this.currentUser)||void 0===i?void 0:i.stateId})),((null===(n=this.currentUser)||void 0===n?void 0:n.districtId)||(null===(a=this.currentUser)||void 0===a?void 0:a.blockId)||(null===(c=this.currentUser)||void 0===c?void 0:c.phiId))&&(this.getBlocks(null,null===(d=this.currentUser)||void 0===d?void 0:d.districtId),this.getPhis(null,null===(m=this.currentUser)||void 0===m?void 0:m.districtId,null===(g=this.currentUser)||void 0===g?void 0:g.blockId),this.disableDistrict=!(null===(I=this.currentUser)||void 0===I||!I.districtId),this.disableBlock=!(null===(A=this.currentUser)||void 0===A||!A.blockId)),this.form=this.createForm(),this.getTableData();let Xt=v()().month()+1;this.currentUser.designation===C.K.PHI&&(this.titleName="PHI Name"),this.currentUser.designation===C.K.ANM&&(this.titleName="HWC Name"),Xt>3?(this.fromDate=v()().month(3).startOf("month").format("YYYY-MM-DD"),this.toDate=v()().month(2).endOf("month").add(1,"years").format("YYYY-MM-DD")):(this.fromDate=v()().month(3).startOf("month").subtract(1,"years").format("YYYY-MM-DD"),this.toDate=v()().month(2).endOf("month").format("YYYY-MM-DD")),"State"===this.currentUser.designation?this.get
1StateTable():"District"===this.currentUser.designation?(this.showDistrictTable=!1,this.getDistrictTable(this.currentUser)):"Block"===this.currentUser.designation?(this.showBlockTable=!1,this.getBlockTable(this.currentUser)):"TU"===this.currentUser.designation?(this.showTuTable=!1,this.getTuTable(this.currentUser)):(this.showPhiChoTable=!1,this.getPhiChoTable(this.currentUser))}getTableData(){let r={};this.currentUser.districtId&&(r.districtId=this.currentUser.districtId),this.currentUser.blockId&&(r.blockId=this.currentUser.blockId),this.expirydrugreportingService.getExpiredDrugCount(r).subscribe(i=>{this.dataSource=new l.by(i),this.dataSource.paginator=this.paginator.toArray()[0],this.dataSource.sort=this.sort.toArray()[0]})}createForm(){var r,i,n;return this.fb.group({districtId:[{value:null!==(r=this.currentUser)&&void 0!==r&&r.districtId?this.currentUser.districtId:"",disabled:this.disableDistrict},[u.kI.required]],blockId:[{value:null!==(i=this.currentUser)&&void 0!==i&&i.blockId?null===(n=this.currentUser)||void 0===n?void 0:n.blockId:"",disabled:this.disableBlock}],startDate:[""],endDate:[""]})}getStateTable(){const r=this.displayedColumns.filter(n=>"district"!==n&&"block"!==n&&"tu"!==n&&"phiCho"!==n);this.displayedColumnsStateWise=r,this.expirydrugreportingService.getExpiredDrugCount({designation:this.currentUser.designation,fromDate:this.fromDate,toDate:this.toDate}).subscribe(n=>{this.statedataSource=new l.by(n)})}getDistrictTable(r){const i=this.displayedColumns.filter(a=>"state"!==a&&"block"!==a&&"tu"!==a&&"phiCho"!==a);this.displayedColumnsDistrictWise=i,this.showDistrictTable=!1,this.expirydrugreportingService.getExpiredDrugCount({fromDate:this.fromDate,toDate:this.toDate,stateId:this.currentUser.stateId?this.currentUser.stateId:r.stateId,districtId:this.currentUser.districtId?this.currentUser.districtId:r.districtId,designation:"District"}).subscribe(a=>{this.districtdataSource=new l.by(a)})}getBlockTable(r){const i=this.displayedColumns.filter(a=>"state"!==a&&"district"!==a&&"tu"!==a&&"phiCho"!==a);this.displayedColumnsBlocktWise=i,this.showBlockTable=!1,this.expirydrugreportingService.getExpiredDrugCount({fromDate:this.fromDate,toDate:this.toDate,stateId:this.currentUser.stateId,districtId:this.currentUser.districtId?this.currentUser.districtId:r._id,blockId:this.currentUser.blockId?this.currentUser.blockId:r.blockId,designation:"Block"}).subscribe(a=>{this.blockdataSource=new l.by(a)})}getTuTable(r){const i=this.displayedColumns.filter(a=>"state"!==a&&"district"!==a&&"block"!==a&&"phiCho"!==a);this.showTuTable=!1,this.displayedColumnTuWise=i,this.expirydrugreportingService.getExpiredDrugCount({fromDate:this.fromDate,toDate:this.toDate,stateId:this.currentUser.stateId,districtId:r._id,blockId:this.currentUser.blockId,designation:"TU"}).subscribe(a=>{this.tudataSource=new l.by(a)})}getPhiChoTable(r){this.showPhiChoTable=!1;const i=this.displayedColumns.filter(a=>"state"!==a&&"district"!==a&&"block"!==a&&"tu"!==a);this.displayedColumnUser=i,this.expirydrugreportingService.getExpiredDrugCount({fromDate:this.fromDate,toDate:this.toDate,stateId:this.currentUser.stateId,districtId:this.currentUser.districtId,blockId:this.currentUser.blockId,tuId:r._id,designation:["PHI","CHO"]}).subscribe(a=>{this.phiChodataSource=new l.by(a)})}getBlocks(r,i){var n,a;i=null!==(a=null===(n=null==this?void 0:this.form)||void 0===n?void 0:n.value)&&void 0!==a&&a.hasOwnProperty("districtId")?this.form.value.districtId:this.currentUser.districtId,this.blocks$=this.blockService.getBlocks({districtId:i})}getPhis(r,i,n){}generateReport(){this.expirydrugreportingService.getExpiredDrugReport({fromDate:this.form.value.startDate,toDate:this.form.value.endDate,districtId:this.currentUser.districtId?this.currentUser.districtId:this.form.value.districtId,blockId:this.currentUser.blockId?this.currentUser.blockId:this.form.value.blockId,designation:this.currentUser.designation}).subscribe(i=>{w().fire({title:"Download The Report!",showConfirmButton:!0,confirmButtonText:"Download",showCancelButton:!0}).then(n=>{n.value&&this.fileLibraryServices.downloadFileWithContainer(i).subscribe(a=>{const c=new Blob([a],{type:a.type}),d=window.URL.createObjectURL(c),m=document.createElement("a");m.href=d,m.download=i,document.body.appendChild(m),m.click(),document.body.removeChild(m),window.URL.revokeObjectURL(d)})})})}ngOnDestroy(){this.subscription.unsubscribe()}}return e.\u0275fac=function(r){return new(r||e)(t.Y36(u.qu),t.Y36(B.n),t.Y36(Y),t.Y36(F.e8),t.Y36($.R),t.Y36(L.g),t.Y36(j.B))},e.\u0275cmp=t.Xpm({type:e,selectors:[["app-expiry-drug-reporting"]],viewQuery:function(r,i){if(1&r&&(t.Gf(_.NW,5),t.Gf(y.YE,5)),2&r){let n;t.iGM(n=t.CRH())&&(i.paginator=n),t.iGM(n=t.CRH())&&(i.sort=n)}},decls:69,vars:21,consts:[[1,"card","w-full",2,"margin-bottom","10px","margin-top","-2.5rem"],[1,"card-body"],[1,"card-title"],[1,"card-text"],[3,"formGroup"],[1,"row"],[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"],[4,"ngIf"],["placeholder","Select Block","formControlName","blockId"],[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",""],["mat-raised-button","","color","primary",2,"margin-top","0.5rem",3,"disableRipple","disabled","click"],[1,"card","w-full"],[1,"table-responsive"],["mat-table","","matSort","",1,"shadow-xl","w-full","h-full",3,"dataSource"],["matColumnDef","district",4,"ngIf"],["matColumnDef","block",4,"ngIf"],["matColumnDef","user",4,"ngIf"],["matColumnDef","month"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","productName"],["matColumnDef","UOM"],["matColumnDef","quantity"],["matColumnDef","batchNumber"],["matColumnDef","expiryDate"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],["showFirstLastButtons","",3,"pageSizeOptions"],["paginator",""],[3,"value"],["matColumnDef","district"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["matColumnDef","block"],["matColumnDef","user"],["mat-header-row",""],["mat-row",""],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(r,i){if(1&r&&(t.TgZ(0,"div",0)(1,"div",1)(2,"h3",2),t._uU(3," Expired Drug Report"),t.qZA(),t.TgZ(4,"p",3),t._uU(5,"Download the raw data report"),t.qZA(),t.TgZ(6,"form",4)(7,"div",5)(8,"div",6)(9,"mat-form-field",7)(10,"mat-label"),t._uU(11,"District"),t.qZA(),t.TgZ(12,"mat-select",8),t.NdJ("selectionChange",function(a){return i.getBlocks(a,"")}),t.YNc(13,W,2,2,"mat-option",9),t.ALo(14,"async"),t.qZA(),t.YNc(15,G,2,0,"mat-error",10),t.qZA()(),t.TgZ(16,"div",6)(17,"mat-form-field",7)(18,"mat-label"),t._uU(19,"Block"),t.qZA(),t.TgZ(20,"mat-select",11),t.YNc(21,H,2,2,"mat-option",9),t.ALo(22,"async"),t.qZA()()(),t.TgZ(23,"div",6)(24,"mat-form-field",7)(25,"mat-label"),t._uU(26,"Date range"),t.qZA(),t.TgZ(27,"div",12)(28,"div",13)(29,"mat-date-range-input",14),t._UZ(30,"input",15)(31,"input",16),t.qZA(),t._UZ(32,"mat-datepicker-toggle",17),t.qZA(),t._UZ(33,"mat-date-range-picker",null,18),t.qZA(),t.YNc(35,z,1,0,"mat-error",10),t.qZA()(),t.TgZ(36,"div",6)(37,"button",19),t.NdJ("click",function(){return i.generateReport()}),t._uU(38,"Download Report"),t.qZA()()()()()(),t.TgZ(39,"div",20)(40,"div",1)(41,"div",21)(42,"table",22),t.YNc(43,V,3,0,"ng-container",23),t.YNc(44,rt,3,0,"ng-container",24),t.YNc(45,nt,3,0,"ng-container",25),t.ynx(46,26),t.YNc(47,at,2,0,"th",27),t.YNc(48,st,2,1,"td",28),t.BQk(),t.ynx(49,29),t.YNc(50,lt,2,0,"th",27),t.YNc(51,ut,2,1,"td",28),t.BQk(),t.ynx(52,30),t.YNc(53,ct,2,0,"th",27),t.YNc(54,mt,2,1,"td",28),t.BQk(),t.ynx(55,31),t.YNc(56,dt,2,0,"th",27),t.YNc(57,pt,2,1,"td",28),t.BQk(),t.ynx(58,32),t.YNc(59,ht,2,0,"th",27),t.YNc(60,gt,2,1,"td",28),t.BQk(),t.ynx(61,33),t.YNc(62,ft,2,0,"th",27),t.YNc(63,Dt,3,3,"td",28),t.BQk(),t.YNc(64,yt,1,0,"tr",34),t.YNc(65,xt,1,0,"tr",35),t.YNc(66,_t,3,0,"tr",36),t.qZA()(),t._UZ(67,"mat-paginator",37,38),t.qZA()()),2&r){const n=t.MAs(34);t.xp6(6),t.Q6J("formGroup",i.form),t.xp6(7),t.Q6J("ngForOf",t.lcZ(14,16,i.districts$)),t.xp6(2),t.Q6J("ngIf",i.form.controls.districtId.invalid),t.xp6(6),t.Q6J("ngForOf",t.lcZ(22,18,i.blocks$)),t.xp6(8),t.Q6J("rangePicker",n),t.xp6(3),t.Q6J("for",n),t.xp6(3),t.Q6J("ngIf",i.form.controls.startDate.invali
1d),t.xp6(2),t.Q6J("disableRipple",!1)("disabled",i.form.invalid),t.xp6(5),t.Q6J("dataSource",i.dataSource),t.xp6(1),t.Q6J("ngIf","State"!==i.currentUser.designation),t.xp6(1),t.Q6J("ngIf","State"!==i.currentUser.designation||"District"!==i.currentUser.designation),t.xp6(1),t.Q6J("ngIf","State"!==i.currentUser.designation||"District"!==i.currentUser.designation||"TU"!==i.currentUser.designation),t.xp6(19),t.Q6J("matHeaderRowDef",i.displayedColumns),t.xp6(1),t.Q6J("matRowDefColumns",i.displayedColumns),t.xp6(2),t.Q6J("pageSizeOptions",t.DdM(20,vt))}},dependencies:[D.sg,D.O5,E.ey,N.lW,p.nW,p.wx,p.zY,p.By,p._g,x.TO,x.KE,x.hX,_.NW,h.gD,y.YE,y.nU,l.BZ,l.fO,l.as,l.w1,l.Dz,l.nj,l.ge,l.ev,l.XQ,l.Gk,l.Ee,u._Y,u.Fj,u.JJ,u.JL,u.sg,u.u,D.Ov,D.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}.mat-datepicker-toggle[_ngcontent-%COMP%]{position:absolute;right:.5rem;top:50%;transform:translateY(-50%)}table[_ngcontent-%COMP%]{width:50%}"]}),e})();var Ut=s(1586),Tt=s(3788);function Ct(e,o){if(1&e&&(t.TgZ(0,"mat-option",36),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.Q6J("value",r),t.xp6(1),t.AsE(" ",r.name," - ",r.type," ")}}function Zt(e,o){1&e&&(t.TgZ(0,"div")(1,"mat-error"),t._uU(2,"Please Select Product Name"),t.qZA()())}function Nt(e,o){if(1&e&&(t.TgZ(0,"mat-option",36),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.Q6J("value",r.value),t.xp6(1),t.Oqu(r.name)}}function Et(e,o){1&e&&(t.TgZ(0,"mat-error"),t._uU(1,"Please select month"),t.qZA())}function It(e,o){1&e&&(t.TgZ(0,"mat-error"),t._uU(1,"Please enter the Quantity"),t.qZA())}function At(e,o){1&e&&(t.TgZ(0,"div")(1,"mat-error"),t._uU(2,"Please enter the Batch Number"),t.qZA()())}function wt(e,o){1&e&&(t.TgZ(0,"div")(1,"mat-error"),t._uU(2,"Please enter the Date"),t.qZA()())}function Yt(e,o){1&e&&(t.TgZ(0,"th",37),t._uU(1," Sr. No. "),t.qZA())}function Ft(e,o){if(1&e&&(t.TgZ(0,"td",38),t._uU(1),t.qZA()),2&e){const r=o.index;t.oxw();const i=t.MAs(74);t.xp6(1),t.hij(" ",r+1+i.pageIndex*i.pageSize," ")}}function kt(e,o){1&e&&(t.TgZ(0,"th",37),t._uU(1,"UOM "),t.qZA())}function qt(e,o){if(1&e&&(t.TgZ(0,"td",38),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.UOM)}}function St(e,o){1&e&&(t.TgZ(0,"th",37),t._uU(1," Product Name "),t.qZA())}function Rt(e,o){if(1&e&&(t.TgZ(0,"td",38),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.productName)}}function Ot(e,o){1&e&&(t.TgZ(0,"th",37),t._uU(1,"Month"),t.qZA())}function Qt(e,o){if(1&e&&(t.TgZ(0,"td",38),t._uU(1),t.qZA()),2&e){const r=o.$implicit,i=t.oxw();t.xp6(1),t.Oqu(i.getMonthName(r.month))}}function Mt(e,o){1&e&&(t.TgZ(0,"th",37),t._uU(1,"Quantity"),t.qZA())}function Bt(e,o){if(1&e&&(t.TgZ(0,"td",38),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.Quantity)}}function Jt(e,o){1&e&&(t.TgZ(0,"th",37),t._uU(1,"Batch Number"),t.qZA())}function Pt(e,o){if(1&e&&(t.TgZ(0,"td",38),t._uU(1),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(r.batchNumber)}}function $t(e,o){1&e&&(t.TgZ(0,"th",37),t._uU(1,"Expiry Date"),t.qZA())}function Lt(e,o){if(1&e&&(t.TgZ(0,"td",38),t._uU(1),t.ALo(2,"date"),t.qZA()),2&e){const r=o.$implicit;t.xp6(1),t.Oqu(t.xi3(2,1,r.formattedexpiryDate,"dd/MM/yyyy"))}}function jt(e,o){1&e&&t._UZ(0,"tr",39)}function Wt(e,o){1&e&&t._UZ(0,"tr",40)}function Gt(e,o){1&e&&(t.TgZ(0,"tr",41)(1,"td",42),t._uU(2,"No data matching the filter"),t.qZA()())}const Ht=function(){return[5,10,25,100]};let zt=(()=>{class e{constructor(r,i,n,a,c){this.fb=r,this.productService=i,this.expirydrugreportingService=n,this.formService=a,this._auth=c,this.displayedColumns=["sn","UOM","productName","month","Quantity","batchNumber","expiryDate"],this.paginator=new t.n_E,this.sort=new t.n_E,this.druglist=[],this.months=[{name:"January",value:1},{name:"February",value:2},{name:"March",value:3},{name:"April",value:4},{name:"May",value:5},{name:"June",value:6},{name:"July",value:7},{name:"August",value:8},{name:"September",value:9},{name:"October",value:10},{name:"November",value:11},{name:"December",value:12}],this.currentUser=this._auth.currentUserValue}ngOnInit(){this.expiryDrugForm=this.initForm(),this.getAllProduct(),this.getTableData(),this.getFormId()}initForm(){return this.fb.group({productId:[""],productName:["",u.kI.required],UOM:[""],month:["",u.kI.required],Quantity:["",u.kI.required],batchNumber:["",u.kI.required],expiryDate:[new Date,u.kI.required]})}getAllProduct(){this.productService.getProducts({}).subscribe(r=>{this.druglist=r})}getFormId(){this.formService.getForms({formName:"Drug Expiry Form"}).subscribe(i=>{this.formId=i[0].id})}getMonthName(r){return!r||r<1||r>12?"Invalid Month":["January","February","March","April","May","June","July","August","September","October","November","December"][r-1]}getFinancialYearDates(){const r=new Date,i=r.getFullYear();let a,c;return r.getMonth()>=3?(a=new Date(i,3,1),c=new Date(i+1,2,31,23,59,59)):(a=new Date(i-1,3,1),c=new Date(i,2,31,23,59,59)),{fromDate:a.getTime(),toDate:c.getTime()}}getTableData(){const{fromDate:r,toDate:i}=this.getFinancialYearDates();this.expirydrugreportingService.getExpiredDrug({where:{createdBy:this.currentUser.id,submissionDate:{between:[r,i]}}}).subscribe(a=>{a.forEach(c=>{c.formattedexpiryDate=new Date(c.expiryDate)}),this.dataSource=new l.by(a),this.dataSource.paginator=this.paginator.toArray()[0],this.dataSource.sort=this.sort.toArray()[0]})}view(){const r=this.expiryDrugForm.value,i=r.expiryDate?r.expiryDate.getTime():null,n=r.productName,a=n&&"object"==typeof n?n.name:"";let c=n&&"object"==typeof n?n.type:null,d=n&&"object"==typeof n?n.id:null;c||(console.warn("UOM is null or undefined, assigning 'No Type'"),c="No Type"),this.expiryDrugForm.patchValue({UOM:c});const m=Object.assign(Object.assign({},r),{productId:d,productName:a,UOM:c,expiryDate:i,formId:this.formId,submissionDate:(new Date).getTime(),year:(new Date).getFullYear(),stateId:void 0!==this.currentUser.stateId?this.currentUser.stateId:void 0,districtId:void 0!==this.currentUser.districtId?this.currentUser.districtId:void 0,blockId:void 0!==this.currentUser.blockId?this.currentUser.blockId:void 0,createdBy:this.currentUser.id});this.expiryDrugForm.valid?(this.expirydrugreportingService.createExpiredDrug(m).subscribe(g=>{g&&(w().fire({title:"Success!",text:"Forms added successfully",icon:"success",showConfirmButton:!0,confirmButtonText:"OK"}),this.getTableData())}
1),this.expiryDrugForm.reset()):console.error("Form is invalid, please check the required fields.")}}return e.\u0275fac=function(r){return new(r||e)(t.Y36(u.qu),t.Y36(Ut.M),t.Y36(Y),t.Y36(Tt.o),t.Y36(F.e8))},e.\u0275cmp=t.Xpm({type:e,selectors:[["app-expiry-drug-form"]],viewQuery:function(r,i){if(1&r&&(t.Gf(_.NW,5),t.Gf(y.YE,5)),2&r){let n;t.iGM(n=t.CRH())&&(i.paginator=n),t.iGM(n=t.CRH())&&(i.sort=n)}},decls:75,vars:17,consts:[[1,"container"],[1,"card","w-full",2,"margin-bottom","10px"],[1,"card-body"],[1,"w-full",3,"formGroup"],[1,"flex","justify-evenly","gap-1"],[1,"row"],[1,"col-lg-4","readonly-wrapper"],["appearance","outline",1,"readonly-block",2,"width","100%"],["placeholder","Select Company","formControlName","productName"],[3,"value",4,"ngFor","ngForOf"],[4,"ngIf"],["formControlName","month","placeholder","Select a month"],["matInput","","formControlName","Quantity","placeholder","Quantity","type","number","required","","min","0","max","1000000000"],["matInput","","formControlName","batchNumber","placeholder","batchNumber"],["appearance","outline",2,"width","100%"],["matInput","","formControlName","expiryDate","placeholder","ExpiryDate",3,"matDatepicker"],["matSuffix","",3,"for"],["picker",""],[1,"d-flex","justify-content-center"],["mat-raised-button","","color","primary",3,"disableRipple","disabled","click"],[1,"card","w-full"],["mat-table","","matSort","",1,"shadow-xl","w-full","h-full",3,"dataSource"],["matColumnDef","sn"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","UOM"],["matColumnDef","productName"],["matColumnDef","month"],["matColumnDef","Quantity"],["matColumnDef","batchNumber"],["matColumnDef","expiryDate"],["mat-header-row","",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],["showFirstLastButtons","",3,"pageSizeOptions"],["paginator",""],[3,"value"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["mat-header-row",""],["mat-row",""],[1,"mat-row"],["colspan","4",1,"mat-cell"]],template:function(r,i){if(1&r&&(t.TgZ(0,"div",0)(1,"h1")(2,"b"),t._uU(3,"Expiry Drug Form"),t.qZA()(),t.TgZ(4,"div",1)(5,"div",2)(6,"form",3)(7,"div",4)(8,"div",5)(9,"div",6)(10,"mat-form-field",7)(11,"mat-label"),t._uU(12,"TB Drug"),t.qZA(),t.TgZ(13,"mat-select",8),t.YNc(14,Ct,2,3,"mat-option",9),t.qZA()(),t.YNc(15,Zt,3,0,"div",10),t.qZA(),t.TgZ(16,"div",6)(17,"mat-form-field",7)(18,"mat-label"),t._uU(19,"Reporting Month"),t.qZA(),t.TgZ(20,"mat-select",11),t.YNc(21,Nt,2,2,"mat-option",9),t.qZA()(),t.YNc(22,Et,2,0,"mat-error",10),t.qZA(),t.TgZ(23,"div",6)(24,"mat-form-field",7)(25,"mat-label"),t._uU(26,"Quantity"),t.qZA(),t._UZ(27,"input",12),t.qZA(),t.YNc(28,It,2,0,"mat-error",10),t.qZA()(),t.TgZ(29,"div",5)(30,"div",6)(31,"mat-form-field",7)(32,"mat-label"),t._uU(33,"Batch Number"),t.qZA(),t._UZ(34,"input",13),t.qZA(),t.YNc(35,At,3,0,"div",10),t.qZA(),t.TgZ(36,"div",6)(37,"mat-form-field",14),t._UZ(38,"input",15)(39,"mat-datepicker-toggle",16)(40,"mat-datepicker",null,17),t.qZA(),t.YNc(42,wt,3,0,"div",10),t.qZA()(),t.TgZ(43,"div",18)(44,"button",19),t.NdJ("click",function(){return i.view()}),t._uU(45,"Add Data"),t.qZA()()()()()(),t.TgZ(46,"div",20)(47,"div",2)(48,"table",21),t.ynx(49,22),t.YNc(50,Yt,2,0,"th",23),t.YNc(51,Ft,2,1,"td",24),t.BQk(),t.ynx(52,25),t.YNc(53,kt,2,0,"th",23),t.YNc(54,qt,2,1,"td",24),t.BQk(),t.ynx(55,26),t.YNc(56,St,2,0,"th",23),t.YNc(57,Rt,2,1,"td",24),t.BQk(),t.ynx(58,27),t.YNc(59,Ot,2,0,"th",23),t.YNc(60,Qt,2,1,"td",24),t.BQk(),t.ynx(61,28),t.YNc(62,Mt,2,0,"th",23),t.YNc(63,Bt,2,1,"td",24),t.BQk(),t.ynx(64,29),t.YNc(65,Jt,2,0,"th",23),t.YNc(66,Pt,2,1,"td",24),t.BQk(),t.ynx(67,30),t.YNc(68,$t,2,0,"th",23),t.YNc(69,Lt,3,4,"td",24),t.BQk(),t.YNc(70,jt,1,0,"tr",31),t.YNc(71,Wt,1,0,"tr",32),t.YNc(72,Gt,3,0,"tr",33),t.qZA(),t._UZ(73,"mat-paginator",34,35),t.qZA()()()),2&r){const n=t.MAs(41);let a,c,d,m,g;t.xp6(6),t.Q6J("formGroup",i.expiryDrugForm),t.xp6(8),t.Q6J("ngForOf",i.druglist),t.xp6(1),t.Q6J("ngIf",(null==(a=i.expiryDrugForm.get("productName"))?null:a.hasError("required"))&&(null==(a=i.expiryDrugForm.get("productName"))?null:a.touched)),t.xp6(6),t.Q6J("ngForOf",i.months),t.xp6(1),t.Q6J("ngIf",(null==(c=i.expiryDrugForm.get("month"))?null:c.hasError("required"))&&(null==(c=i.expiryDrugForm.get("month"))?null:c.touched)),t.xp6(6),t.Q6J("ngIf",(null==(d=i.expiryDrugForm.get("Quantity"))?null:d.hasError("required"))&&(null==(d=i.expiryDrugForm.get("Quantity"))?null:d.touched)),t.xp6(7),t.Q6J("ngIf",(null==(m=i.expiryDrugForm.get("batchNumber"))?null:m.hasError("required"))&&(null==(m=i.expiryDrugForm.get("batchNumber"))?null:m.touched)),t.xp6(3),t.Q6J("matDatepicker",n),t.xp6(1),t.Q6J("for",n),t.xp6(3),t.Q6J("ngIf",(null==(g=i.expiryDrugForm.get("expiryDate"))?null:g.hasError("required"))&&(null==(g=i.expiryDrugForm.get("expiryDate"))?null:g.touched)),t.xp6(2),t.Q6J("disableRipple",!1)("disabled",i.expiryDrugForm.invali
1d),t.xp6(4),t.Q6J("dataSource",i.dataSource),t.xp6(22),t.Q6J("matHeaderRowDef",i.displayedColumns),t.xp6(1),t.Q6J("matRowDefColumns",i.displayedColumns),t.xp6(2),t.Q6J("pageSizeOptions",t.DdM(16,Ht))}},dependencies:[D.sg,D.O5,E.ey,N.lW,p.Mq,p.hl,p.nW,x.TO,x.KE,x.hX,x.R9,f.Nt,_.NW,h.gD,y.YE,y.nU,l.BZ,l.fO,l.as,l.w1,l.Dz,l.nj,l.ge,l.ev,l.XQ,l.Gk,l.Ee,u._Y,u.Fj,u.wV,u.JJ,u.JL,u.Q7,u.qQ,u.Fd,u.sg,u.u,D.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}table[_ngcontent-%COMP%]{width:100%}"]}),e})(),Kt=(()=>{class e{}return e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=t.oAB({type:e}),e.\u0275inj=t.cJS({imports:[D.ez,T.m,R.q,u.UX,u.u5,h.LD,p.FA,f.c,N.ot,E.XK,U.M,q.Ps,_.TU,S.Cv,y.JX,l.p0,Z.Bz.forChild([{path:"report",component:bt},{path:"form",component:zt}])]}),e})()}}]);
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.