import{a as be,b as Te,c as Se}from"./chunk-OM4YA5AS.js";import{a as j}from"./chunk-U7XLAMIO.js";import"./chunk-3ENMYILF.js";import{a as Ce,b as v}from"./chunk-PLGG4SLB.js";import{a as ge,b as _e}from"./chunk-5H5B6BD4.js";import{Aa as $,Ab as de,Bb as se,Cb as pe,Db as fe,E as R,Eb as ue,F as T,Fa as Y,Fb as he,G as I,Ga as J,H as V,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 q,qb as S,rb as w,sb as oe,ua as B,ub as M,vb as ae,wb as re,xa as G,xb as le,ya as W,yb as me,zb as ce}from"./chunk-HTHXT33L.js";import"./chunk-27NP7QR4.js";import{Ac as N,Db as s,Kb as u,Mb as b,Tb as o,Ub as i,Vb as r,Wb as p,Xb as f,Zb as O,dc as C,kc as k,lb as d,lc as y,mc as x,pc as E,qc as l,rb as P,rc as F,wa as g,xa as _,xb as L}from"./chunk-N3UOAVVW.js";import{h as xe,j as D}from"./chunk-TWZW5B45.js";Te();var ke=xe(Se());var we=()=>[5,10,20];function Me(e,a){e&1&&(o(0,"th",40),l(1,"S.No"),i())}function ve(e,a){if(e&1&&(o(0,"td",41),l(1),i()),e&2){let c=a.$implicit;d(),F(c.i)}}function Pe(e,a){e&1&&(o(0,"th",40),l(1,"Truck Number"),i())}function Ee(e,a){e&1&&r(0,"td",41)}function De(e,a){e&1&&(o(0,"th",40),l(1,"Product Name"),i())}function Le(e,a){e&1&&r(0,"td",41)}function Oe(e,a){e&1&&(o(0,"th",40),l(1,"Tons"),i())}function Fe(e,a){e&1&&r(0,"td",41)}function Ne(e,a){e&1&&(o(0,"th",40),l(1,"Load Order"),i())}function Re(e,a){e&1&&r(0,"td",41)}function Ie(e,a){e&1&&(o(0,"th",40),l(1,"Destination"),i())}function Ve(e,a){e&1&&r(0,"td",41)}function Ae(e,a){e&1&&(o(0,"th",40),l(1,"Truck Reached"),i())}function He(e,a){e&1&&r(0,"td",41)}function Xe(e,a){e&1&&(o(0,"th",40),l(1,"Comments"),i())}function Ke(e,a){e&1&&r(0,"td",41)}function ze(e,a){e&1&&(o(0,"th",40),l(1,"Status"),i())}function Qe(e,a){e&1&&r(0,"td",41)}function je(e,a){e&1&&r(0,"tr",42)}function qe(e,a){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","prod_name","ton","order","destination","reached","comments","status"],this.trackingFrom=this.fb.group({cust_name:["",[T.required]],truckNum:["",[T.required]],date:["",[T.required]]})}trackLogistic(){this.trackingFrom.invalid?alert("Fill Required Fields"):(alert("Successfully submitted."),this.trackingFrom.reset())}setActive(c){this.activeExport=c}exportToExcel(c){return D(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"),Ce(t,"logistics_tracking.xlsx"),this.dataSource.paginator=this.paginator})}exportToPDF(){let c=new be,m=[{header:"S.No",dataKey:"i"},{header:"Truck Number",dataKey:this.displayedColumns[1]},{header:"Product Name",dataKey:this.displayedColumns[2]},{header:"Tons",dataKey:this.displayedColumns[3]},{header:"Load Order",dataKey:this.displayedColumns[4]},{header:"Destination",dataKey:this.displayedColumns[5]},{header:"Truck Reached",dataKey:this.displayedColumns[6]},{header:"Comments",dataKey:this.displayedColumns[7]},{header:"Status",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("logistics_tracking.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>Logistics Tracking</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)(P(j),P(K))}}static{this.\u0275cmp=L({type:e,selectors:[["app-track-logistics"]],viewQuery:function(m,n){if(m&1&&(k(M,5),k(S,5),k(w,5)),m&2){let t;y(t=x())&&(n.table=t.first),y(t=x())&&(n.paginator=t.first),y(t=x())&&(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","cust_name",1,"rounded-field"],["matInput","","formControlName","truckNum",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","prod_name"],["matColumnDef","ton"],["matColumnDef","order"],["matColumnDef","destination"],["matColumnDef","reached"],["matColumnDef","comments"],["matColumnDef","status"],["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=O();o(0,"mat-card",2)(1,"form",3)(2,"div",4)(3,"div",5)(4,"mat-form-field",6)(5,"mat-label"),l(6,"Customer Name"),i(),r(7,"input",7),i()(),o(8,"div",5)(9,"mat-form-field",6)(10,"mat-label"),l(11,"Truck Number"),i(),r(12,"input",8),i()(),o(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()(),o(21,"div",11)(22,"button",12),C("click",function(){return g(t),_(n.trackLogistic())}),l(23,"Submit"),i()()(),r(24,"br")(25,"br"),i()(),o(26,"mat-card",13)(27,"div",14)(28,"div",15)(29,"mat-form-field",16),r(30,"input",17),o(31,"mat-icon",18),r(32,"i-tabler",19),i()()(),o(33,"div",20)(34,"button",21),C("click",function(){return g(t),n.setActive("pdf"),_(n.exportToPDF())}),l(35,"PDF"),i(),o(36,"button",21),C("click",function(){g(t);let ye=E(45);return n.setActive("excel"),_(n.exportToExcel(ye))}),l(37,"Excel"),i(),o(38,"button",21),C("click",function(){return g(t),n.setActive("print"),_(n.printTable())}),l(39,"Print"),i()()()(),o(40,"mat-card",13)(41,"mat-card-content",22)(42,"div",23),r(43,"mat-paginator",24),o(44,"table",25,1),p(46,26),s(47,Me,2,0,"th",27)(48,ve,2,1,"td",28),f(),p(49,29),s(50,Pe,2,0,"th",30)(51,Ee,1,0,"td",28),f(),p(52,31),s(53,De,2,0,"th",30)(54,Le,1,0,"td",28),f(),p(55,32),s(56,Oe,2,0,"th",30)(57,Fe,1,0,"td",28),f(),p(58,33),s(59,Ne,2,0,"th",30)(60,Re,1,0,"td",28),f(),p(61,34),s(62,Ie,2,0,"th",30)(63,Ve,1,0,"td",28),f(),p(64,35),s(65,Ae,2,0,"th",30)(66,He,1,0,"td",28),f(),p(67,36),s(68,Xe,2,0,"th",30)(69,Ke,1,0,"td",28),f(),p(70,37),s(71,ze,2,0,"th",30)(72,Qe,1,0,"td",28),f(),s(73,je,1,0,"tr",38)(74,qe,1,0,"tr",39),i()()()()}if(m&2){let t=E(20);d(),u("formGroup",n.trackingFrom),d(16),u("matDatepicker",t),d(),u("for",t),d(4),u("disabled",!n.trackingFrom.valid),d(12),b("active",n.activeExport==="pdf"),d(2),b("active",n.activeExport==="excel"),d(2),b("active",n.activeExport==="print"),d(5),u("pageSizeOptions",N(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,W,B,G,Y,te,ie,$,ne,S,w,oe,M,re,de,le,ae,se,me,ce,pe,fe,z,A,R,I,V,Q,H,X,_e,ge,ee,q],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}.export-btn[_ngcontent-%COMP%]:hover{background-color:#72f1dc;color:#fff}.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%]: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 TrackLogisticsComponent};
