import{a as be,b as Me,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 P}from"./chunk-PLGG4SLB.js";import{a as ge,b as _e}from"./chunk-5H5B6BD4.js";import{Aa as $,Ab as de,Bb as ce,Cb as pe,Db as fe,E as R,Eb as ue,F as I,Fa as Y,Fb as he,G as A,Ga as J,H as N,Ha as U,Ia as Z,Ja as ee,M as V,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 M,rb as S,sb as oe,ua as B,ub as v,vb as ae,wb as re,xa as G,xb as le,ya as W,yb as me,zb as se}from"./chunk-HTHXT33L.js";import"./chunk-27NP7QR4.js";import{Ac as F,Db as c,Kb as u,Mb as b,Tb as o,Ub as a,Vb as m,Wb as p,Xb as f,Zb as E,dc as C,kc as y,lb as d,lc as x,mc as w,pc as k,qc as s,rb as T,rc as O,wa as g,xa as _,xb as D}from"./chunk-N3UOAVVW.js";import{h as we,j as L}from"./chunk-TWZW5B45.js";Me();var ye=we(Se());var ve=()=>[5,10,20];function Pe(e,n){e&1&&(o(0,"th",38),s(1,"S.No"),a())}function Te(e,n){if(e&1&&(o(0,"td",39),s(1),a()),e&2){let l=n.$implicit;d(),O(l.i)}}function ke(e,n){e&1&&(o(0,"th",38),s(1,"Truck Number"),a())}function Le(e,n){e&1&&m(0,"td",39)}function De(e,n){e&1&&(o(0,"th",38),s(1,"Product Name"),a())}function Ee(e,n){e&1&&m(0,"td",39)}function Oe(e,n){e&1&&(o(0,"th",38),s(1,"Tons"),a())}function Fe(e,n){e&1&&m(0,"td",39)}function Re(e,n){e&1&&(o(0,"th",38),s(1,"Load Order"),a())}function Ie(e,n){e&1&&m(0,"td",39)}function Ae(e,n){e&1&&(o(0,"th",38),s(1,"Destination"),a())}function Ne(e,n){e&1&&m(0,"td",39)}function Ve(e,n){e&1&&(o(0,"th",38),s(1,"Truck Reached"),a())}function He(e,n){e&1&&m(0,"td",39)}function Xe(e,n){e&1&&(o(0,"th",38),s(1,"Comments"),a())}function Ke(e,n){e&1&&m(0,"td",39)}function ze(e,n){e&1&&(o(0,"th",38),s(1,"Status"),a())}function Qe(e,n){e&1&&m(0,"td",39)}function je(e,n){e&1&&m(0,"tr",40)}function qe(e,n){e&1&&m(0,"tr",41)}var ht=(()=>{class e{constructor(l,r){this.modelService=l,this.fb=r,this.activeExport="pdf",this.displayedColumns=["#","trucknum","prod_name","ton","order","destination","reached","comments","status"],this.dataSource=new ue,this.appLogistics=this.fb.group({date:["",[I.required]]}),this.orders=[{id:"item001",name:"Item A"},{id:"item002",name:"Item B"}]}addLogistic(){this.appLogistics.invalid?alert("Fill Required Fields"):(alert("Successfully submitted."),this.appLogistics.reset())}setActive(l){this.activeExport=l}exportToExcel(l){return L(this,null,function*(){this.dataSource.paginator=null,yield new Promise(h=>setTimeout(h,0));let r=l._elementRef.nativeElement,i=P.table_to_sheet(r),t=P.book_new();P.book_append_sheet(t,i,"Employees"),Ce(t,"approval_logistics.xlsx"),this.dataSource.paginator=this.paginator})}exportToPDF(){let l=new be,r=[{header:"S.No",dataKey:"i"},{header:"Truck Number",dataKey:this.displayedColumns[1]},{header:"Product Name",dataKey:this.displayedColumns[2]},{header:"Tson",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]}],i=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,ye.default)(l,{columns:r,body:i,headStyles:{fillColor:[23,140,120]},startY:20,styles:{fontSize:8}}),l.save("approval_logistics.pdf")}printTable(){let l=document.getElementById("tableToPrint")?.innerHTML;if(l){let r=window.open("","_blank","width=900,height=600");r.document.open(),r.document.write(`
      <html>
        <head>
          <title>Approval Logistics</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;
            }
              
            /* Hide Angular Material sort arrows */
            .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();">
          ${l}
        </body>
      </html>
    `),r.document.close()}}static{this.\u0275fac=function(r){return new(r||e)(T(j),T(K))}}static{this.\u0275cmp=D({type:e,selectors:[["app-logistics"]],viewQuery:function(r,i){if(r&1&&(y(v,5),y(M,5),y(S,5)),r&2){let t;x(t=w())&&(i.table=t.first),x(t=w())&&(i.paginator=t.first),x(t=w())&&(i.sort=t.first)}},decls:66,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","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(r,i){if(r&1){let t=E();o(0,"mat-card",2)(1,"form",3)(2,"div",4)(3,"div",5)(4,"mat-form-field",6)(5,"mat-label"),s(6,"Ordered Date"),a(),m(7,"input",7)(8,"mat-datepicker-toggle",8)(9,"mat-datepicker",null,0),a()(),o(11,"div",5)(12,"div",9)(13,"button",10),C("click",function(){return g(t),_(i.addLogistic())}),s(14,"Submit"),a()()()(),m(15,"br")(16,"br"),a()(),o(17,"mat-card",11)(18,"div",12)(19,"div",13)(20,"mat-form-field",14),m(21,"input",15),o(22,"mat-icon",16),m(23,"i-tabler",17),a()()(),o(24,"div",18)(25,"button",19),C("click",function(){return g(t),i.setActive("pdf"),_(i.exportToPDF())}),s(26,"PDF"),a(),o(27,"button",19),C("click",function(){g(t);let xe=k(36);return i.setActive("excel"),_(i.exportToExcel(xe))}),s(28,"Excel"),a(),o(29,"button",19),C("click",function(){return g(t),i.setActive("print"),_(i.printTable())}),s(30,"Print"),a()()()(),o(31,"mat-card",11)(32,"mat-card-content",20)(33,"div",21),m(34,"mat-paginator",22),o(35,"table",23,1),p(37,24),c(38,Pe,2,0,"th",25)(39,Te,2,1,"td",26),f(),p(40,27),c(41,ke,2,0,"th",28)(42,Le,1,0,"td",26),f(),p(43,29),c(44,De,2,0,"th",28)(45,Ee,1,0,"td",26),f(),p(46,30),c(47,Oe,2,0,"th",28)(48,Fe,1,0,"td",26),f(),p(49,31),c(50,Re,2,0,"th",28)(51,Ie,1,0,"td",26),f(),p(52,32),c(53,Ae,2,0,"th",28)(54,Ne,1,0,"td",26),f(),p(55,33),c(56,Ve,2,0,"th",28)(57,He,1,0,"td",26),f(),p(58,34),c(59,Xe,2,0,"th",28)(60,Ke,1,0,"td",26),f(),p(61,35),c(62,ze,2,0,"th",28)(63,Qe,1,0,"td",26),f(),c(64,je,1,0,"tr",36)(65,qe,1,0,"tr",37),a()()()()}if(r&2){let t=k(10);d(),u("formGroup",i.appLogistics),d(6),u("matDatepicker",t),d(),u("for",t),d(5),u("disabled",!i.appLogistics.valid),d(12),b("active",i.activeExport==="pdf"),d(2),b("active",i.activeExport==="excel"),d(2),b("active",i.activeExport==="print"),d(5),u("pageSizeOptions",F(15,ve))("pageSize",5),d(),u("dataSource",i.dataSource),d(29),u("matHeaderRowDef",i.displayedColumns),d(),u("matRowDefColumns",i.displayedColumns)}},dependencies:[he,J,U,Z,W,B,G,Y,te,ie,$,ne,M,S,oe,v,re,de,le,ae,ce,me,se,pe,fe,z,V,R,A,N,Q,H,X,_e,ge,ee,q],styles:[".raise-order[_ngcontent-%COMP%]{margin-left:84%;width:150px}.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}.export-btn[_ngcontent-%COMP%]:hover{background-color:#72f1dc;color:#fff}.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%]: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 LogisticsComponent};
