import{a as ge,b as xe,c as Te}from"./chunk-OM4YA5AS.js";import{a as W}from"./chunk-U7XLAMIO.js";import"./chunk-3ENMYILF.js";import{a as be,b as v}from"./chunk-PLGG4SLB.js";import{a as _e,b as Ce}from"./chunk-5H5B6BD4.js";import{Aa as $,Ab as de,Bb as pe,Cb as se,Db as fe,E as R,Eb as ue,F as x,Fa as Y,Fb as he,G as V,Ga as J,H as L,Ha as U,Ia as Z,Ja as ee,M as A,P as H,Q as X,U as K,V as z,Va as te,W as Q,Xa as ie,db as ne,na as j,qb as T,rb as w,sb as ae,ua as q,ub as M,vb as oe,wb as re,xa as B,xb as le,ya as G,yb as me,zb as ce}from"./chunk-HTHXT33L.js";import"./chunk-27NP7QR4.js";import{Ac as I,Db as p,Kb as u,Mb as g,Tb as a,Ub as i,Vb as r,Wb as s,Xb as f,Zb as F,dc as b,kc as k,lb as d,lc as y,mc as D,pc as P,qc as l,rb as S,rc as N,wa as _,xa as C,xb as O}from"./chunk-N3UOAVVW.js";import{h as De,j as E}from"./chunk-TWZW5B45.js";xe();var ke=De(Te());var we=()=>[5,10,20];function Me(e,o){e&1&&(a(0,"th",40),l(1,"S.No"),i())}function ve(e,o){if(e&1&&(a(0,"td",41),l(1),i()),e&2){let c=o.$implicit;d(),N(c.i)}}function Se(e,o){e&1&&(a(0,"th",40),l(1,"Truck Number"),i())}function Pe(e,o){e&1&&r(0,"td",41)}function Ee(e,o){e&1&&(a(0,"th",40),l(1,"Dispatch Date"),i())}function Oe(e,o){e&1&&r(0,"td",41)}function Fe(e,o){e&1&&(a(0,"th",40),l(1,"Driver Name"),i())}function Ne(e,o){e&1&&r(0,"td",41)}function Ie(e,o){e&1&&(a(0,"th",40),l(1,"Mobile Number"),i())}function Re(e,o){e&1&&r(0,"td",41)}function Ve(e,o){e&1&&(a(0,"th",40),l(1,"Vehicle Capacity"),i())}function Le(e,o){e&1&&r(0,"td",41)}function Ae(e,o){e&1&&(a(0,"th",40),l(1,"Before Load Weight"),i())}function He(e,o){e&1&&r(0,"td",41)}function Xe(e,o){e&1&&(a(0,"th",40),l(1,"After Load Weight"),i())}function Ke(e,o){e&1&&r(0,"td",41)}function ze(e,o){e&1&&(a(0,"th",40),l(1,"Orders List"),i())}function Qe(e,o){e&1&&r(0,"td",41)}function We(e,o){e&1&&r(0,"tr",42)}function je(e,o){e&1&&r(0,"tr",43)}var ht=(()=>{class e{constructor(c,m){this.modelService=c,this.fb=m,this.dataSource=new ue,this.activeExport="pdf",this.displayedColumns=["#","trucknum","dispatch_date","driver_name","mobile_num","capacity","before","after","list"],this.trackDispatchForm=this.fb.group({truckNum:["",[x.required]],track_Id:["",[x.required]],date:["",[x.required]]})}trackDispatch(){this.trackDispatchForm.invalid?alert("Fill Required Fields"):(alert("Successfully submitted."),this.trackDispatchForm.reset())}setActive(c){this.activeExport=c}exportToExcel(c){return E(this,null,function*(){this.dataSource.paginator=null,yield new Promise(h=>setTimeout(h,0));let m=c._elementRef.nativeElement,n=v.table_to_sheet(m),t=v.book_new();v.book_append_sheet(t,n,"Employees"),be(t,"track_dispatches.xlsx"),this.dataSource.paginator=this.paginator})}exportToPDF(){let c=new ge,m=[{header:"S.No",dataKey:"i"},{header:"Truck Number",dataKey:this.displayedColumns[1]},{header:"Dispatch Date",dataKey:this.displayedColumns[2]},{header:"Driver Name",dataKey:this.displayedColumns[3]},{header:"Mobile Number",dataKey:this.displayedColumns[4]},{header:"Vehicle Capacity",dataKey:this.displayedColumns[5]},{header:"Before Load Weight",dataKey:this.displayedColumns[6]},{header:"After Load Weight",dataKey:this.displayedColumns[7]},{header:"Orders List",dataKey:this.displayedColumns[8]}],n=this.dataSource.filteredData.map((t,h)=>({i:h+1,cateroey_name:t.cateroey_name||"",custId:t.custId||"",ordernum:t.ordernum||"",check:t.check||"",paymentmethod:t.paymentmethod||"",purchase:t.purchase||"",delivery:t.delivery||"",comments:t.comments||"",lot:t.lot||""}));(0,ke.default)(c,{columns:m,body:n,headStyles:{fillColor:[23,140,120]},startY:20,styles:{fontSize:8}}),c.save("track_dispatches.pdf")}printTable(){let c=document.getElementById("tableToPrint")?.innerHTML;if(c){let m=window.open("","_blank","width=900,height=600");m.document.open(),m.document.write(`
            <html>
              <head>
                <title>Tracking Dispatches</title>
                <style>
                  table {
                    width: 100%;
                    border-collapse: collapse;
                    font-family: Arial, sans-serif;
                    font-size: 12px;
                  }
                  th, td {
                    border: 1px solid #ccc;
                    padding: 8px;
                    text-align: left;
                  }
                  th {
                    background-color: #f5f5f5;
                  }
            .mat-sort-header-arrow,
            .mat-icon,
            .mat-sort-header-pointer-left,
            .mat-sort-header-pointer-right,
            .mat-mdc-paginator {
              display: none !important;
              visibility: hidden !important;
                </style>
              </head>
              <body onload="window.print(); window.close();">
                ${c}
              </body>
            </html>
          `),m.document.close()}}static{this.\u0275fac=function(m){return new(m||e)(S(W),S(K))}}static{this.\u0275cmp=O({type:e,selectors:[["app-track-dispatch"]],viewQuery:function(m,n){if(m&1&&(k(M,5),k(T,5),k(w,5)),m&2){let t;y(t=D())&&(n.table=t.first),y(t=D())&&(n.paginator=t.first),y(t=D())&&(n.sort=t.first)}},decls:75,vars:16,consts:[["picker",""],["emptable",""],[1,"mb-4","cardWithShadow"],[3,"formGroup"],[1,"row"],[1,"col-md-4","mb-3"],["appearance","outline",1,"w-100"],["matInput","","formControlName","truckNum",1,"rounded-field"],["matInput","","formControlName","track_Id",1,"rounded-field"],["matInput","","formControlName","date","readonly","",1,"rounded-field",3,"matDatepicker"],["matSuffix","",3,"for"],[1,"d-flex","justify-content-center","mt-2"],["mat-raised-button","","type","submit",1,"raise-btn",3,"click","disabled"],[1,"cardWithShadow"],[1,"row","justify-content-start"],[1,"col-sm-4"],["appearance","outline",1,"w-100","hide-hint"],["matInput","","placeholder","Search here..."],["matSuffix",""],["name","search",1,"icon-20"],[1,"export-button-group",2,"height","36px"],[1,"export-btn",3,"click"],[1,"p-24"],["id","tableToPrint",1,"table-responsive"],["showFirstLastButtons","",3,"pageSizeOptions","pageSize"],["mat-table","","matSort","",1,"w-100",3,"dataSource"],["matColumnDef","#"],["mat-header-cell","","class","f-s-16 f-w-600","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","trucknum"],["mat-header-cell","","mat-sort-header","","class","f-s-16 f-w-600",4,"matHeaderCellDef"],["matColumnDef","dispatch_date"],["matColumnDef","driver_name"],["matColumnDef","mobile_num"],["matColumnDef","capacity"],["matColumnDef","before"],["matColumnDef","after"],["matColumnDef","list"],["mat-header-row","","style","background-color:#5d87ff;color:white;",4,"matHeaderRowDef"],["mat-row","",4,"matRowDef","matRowDefColumns"],["mat-header-cell","","mat-sort-header","",1,"f-s-16","f-w-600"],["mat-cell",""],["mat-header-row","",2,"background-color","#5d87ff","color","white"],["mat-row",""]],template:function(m,n){if(m&1){let t=F();a(0,"mat-card",2)(1,"form",3)(2,"div",4)(3,"div",5)(4,"mat-form-field",6)(5,"mat-label"),l(6,"Truck Number"),i(),r(7,"input",7),i()(),a(8,"div",5)(9,"mat-form-field",6)(10,"mat-label"),l(11,"Tracking ID"),i(),r(12,"input",8),i()(),a(13,"div",5)(14,"mat-form-field",6)(15,"mat-label"),l(16,"Ordered Date"),i(),r(17,"input",9)(18,"mat-datepicker-toggle",10)(19,"mat-datepicker",null,0),i()(),a(21,"div",11)(22,"button",12),b("click",function(){return _(t),C(n.trackDispatch())}),l(23,"Submit"),i()()(),r(24,"br")(25,"br"),i()(),a(26,"mat-card",13)(27,"div",14)(28,"div",15)(29,"mat-form-field",16),r(30,"input",17),a(31,"mat-icon",18),r(32,"i-tabler",19),i()()(),a(33,"div",20)(34,"button",21),b("click",function(){return _(t),n.setActive("pdf"),C(n.exportToPDF())}),l(35,"PDF"),i(),a(36,"button",21),b("click",function(){_(t);let ye=P(45);return n.setActive("excel"),C(n.exportToExcel(ye))}),l(37,"Excel"),i(),a(38,"button",21),b("click",function(){return _(t),n.setActive("print"),C(n.printTable())}),l(39,"Print"),i()()()(),a(40,"mat-card",13)(41,"mat-card-content",22)(42,"div",23),r(43,"mat-paginator",24),a(44,"table",25,1),s(46,26),p(47,Me,2,0,"th",27)(48,ve,2,1,"td",28),f(),s(49,29),p(50,Se,2,0,"th",30)(51,Pe,1,0,"td",28),f(),s(52,31),p(53,Ee,2,0,"th",30)(54,Oe,1,0,"td",28),f(),s(55,32),p(56,Fe,2,0,"th",30)(57,Ne,1,0,"td",28),f(),s(58,33),p(59,Ie,2,0,"th",30)(60,Re,1,0,"td",28),f(),s(61,34),p(62,Ve,2,0,"th",30)(63,Le,1,0,"td",28),f(),s(64,35),p(65,Ae,2,0,"th",30)(66,He,1,0,"td",28),f(),s(67,36),p(68,Xe,2,0,"th",30)(69,Ke,1,0,"td",28),f(),s(70,37),p(71,ze,2,0,"th",30)(72,Qe,1,0,"td",28),f(),p(73,We,1,0,"tr",38)(74,je,1,0,"tr",39),i()()()()}if(m&2){let t=P(20);d(),u("formGroup",n.trackDispatchForm),d(16),u("matDatepicker",t),d(),u("for",t),d(4),u("disabled",!n.trackDispatchForm.valid),d(12),g("active",n.activeExport==="pdf"),d(2),g("active",n.activeExport==="excel"),d(2),g("active",n.activeExport==="print"),d(5),u("pageSizeOptions",I(15,we))("pageSize",5),d(),u("dataSource",n.dataSource),d(29),u("matHeaderRowDef",n.displayedColumns),d(),u("matRowDefColumns",n.displayedColumns)}},dependencies:[he,J,U,Z,G,q,B,Y,te,ie,$,ne,T,w,ae,M,re,de,le,oe,pe,me,ce,se,fe,z,A,R,V,L,Q,H,X,Ce,_e,ee,j],styles:[".raise-btn[_ngcontent-%COMP%]{background-image:linear-gradient(90deg,#178c78,#00c4a3)!important;border:none;color:#fff;border-radius:8px;width:130px;height:32px;font-family:Poppins,sans-serif;text-align:center;justify-content:center;white-space:nowrap;transition:#00C4A3 .3s ease}.raise-btn[_ngcontent-%COMP%]:hover{background-color:#00c4a3;color:#fff}span[_ngcontent-%COMP%]{background-color:#fff;border-radius:50%;padding:4px;font-weight:700;margin:6px;color:#178c78;justify-content:center}.multi-btn[_ngcontent-%COMP%]{background-image:linear-gradient(90deg,#178c78,#00c4a3)!important;border:none;color:#fff;font-family:Poppins,sans-serif}.cardWithShadow[_ngcontent-%COMP%]{border:none;font-family:Poppins,sans-serif;box-shadow:none}.p-4[_ngcontent-%COMP%]{padding:1.5rem!important;font-family:Poppins,sans-serif}.rounded-field[_ngcontent-%COMP%]{border-radius:8px;border-color:#000;font-family:Poppins,sans-serif}input.form-control[_ngcontent-%COMP%]:focus, input.rounded-field[_ngcontent-%COMP%]:focus{border-color:#00c4a3;outline:#00C4A3;box-shadow:none}.hide-hint[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]::placeholder{color:#aaa;opacity:1}.modal[_ngcontent-%COMP%]{position:fixed;z-index:1050;left:0;top:0;width:100%;height:100%;overflow-x:hidden;overflow-y:auto;background-color:#00000080;display:none;font-family:Poppins,sans-serif}.modal-dialog[_ngcontent-%COMP%]{margin:5rem auto;font-family:Poppins,sans-serif}.modal-content[_ngcontent-%COMP%]{border-radius:6px;overflow:hidden;font-family:Poppins,sans-serif}.modal-header[_ngcontent-%COMP%]   .close[_ngcontent-%COMP%]{border:none;background:transparent;font-size:2rem;line-height:1;cursor:pointer}.multi-btn[_ngcontent-%COMP%]{padding:6px 12px;border:none;background-image:linear-gradient(90deg,#178c78,#00c4a3)!important;color:#333;transition:#00C4A3 .3s ease;font-family:Poppins,sans-serif}.multi-btn[_ngcontent-%COMP%]:hover{background-color:#00c4a3}.export-button-group[_ngcontent-%COMP%]{display:flex;border:1px solid #00C4A3;border-radius:8px;overflow:hidden;width:160px;margin-left:580px}.mat-mdc-table[_ngcontent-%COMP%]   .mat-mdc-header-cell[_ngcontent-%COMP%]{background-color:#00c4a3;font-family:Poppins,sans-serif}.export-btn[_ngcontent-%COMP%]{padding:6px;border:none;border-right:1px solid #00C4A3;color:#00c4a3;width:50px;white-space:nowrap;cursor:pointer;background-color:#fff}.export-btn[_ngcontent-%COMP%]:hover{background-color:#72f1dc;color:#fff}.export-btn[_ngcontent-%COMP%]:last-child{border-right:none}.export-btn.active[_ngcontent-%COMP%]{background-image:linear-gradient(90deg,#178c78,#00c4a3)!important;color:#fff}"]})}}return e})();export{ht as TrackDispatchComponent};
