import{a as we,b as Pe,c as Ee}from"./chunk-OM4YA5AS.js";import{a as $,b as W}from"./chunk-U7XLAMIO.js";import"./chunk-3ENMYILF.js";import{a as Me,b as P}from"./chunk-PLGG4SLB.js";import{a as xe,b as ye}from"./chunk-5H5B6BD4.js";import{Aa as te,Ab as ue,Bb as ge,Cb as he,Db as _e,E as H,Eb as be,F as w,Fa as ie,Fb as Ce,G as X,H as z,Ja as ne,Ka as oe,M as L,N as Q,P as j,Q as q,U as B,V as K,Va as ae,W as G,Xa as re,db as le,i as I,na as U,pa as Y,qb as S,rb as v,sb as me,ua as J,ub as D,vb as de,wb as pe,xa as Z,xb as se,ya as ee,yb as ce,zb as fe}from"./chunk-HTHXT33L.js";import"./chunk-27NP7QR4.js";import{Ac as A,Db as s,Ic as F,Kb as g,Mb as C,Tb as t,Ub as i,Vb as d,Wb as h,Xb as _,Zb as R,dc as b,fc as O,kc as x,lb as p,lc as y,mc as M,pc as N,qc as r,rb as E,rc as V,wa as f,xa as u,xb as k}from"./chunk-N3UOAVVW.js";import{h as De,j as T}from"./chunk-TWZW5B45.js";Pe();var Se=De(Ee());var Re=()=>[5,10,20];function Te(e,m){e&1&&(t(0,"th",27),r(1,"S.No"),i())}function ke(e,m){if(e&1&&(t(0,"td",28),r(1),i()),e&2){let o=m.$implicit;p(),V(o.i)}}function Oe(e,m){e&1&&(t(0,"th",27),r(1,"Name"),i())}function Ne(e,m){e&1&&d(0,"td",28)}function Ve(e,m){e&1&&(t(0,"th",27),r(1,"Mobile Number"),i())}function Ae(e,m){e&1&&d(0,"td",28)}function Fe(e,m){e&1&&(t(0,"th",27),r(1,"Department"),i())}function Ie(e,m){e&1&&d(0,"td",28)}function He(e,m){e&1&&(t(0,"th",27),r(1,"Date"),i())}function Xe(e,m){e&1&&d(0,"td",28)}function ze(e,m){e&1&&d(0,"tr",29)}function Le(e,m){e&1&&d(0,"tr",30)}function Qe(e,m){if(e&1){let o=R();t(0,"div",31)(1,"button",32),b("click",function(){let n=f(o).$implicit;return u(n.dismiss("Cross click"))}),t(2,"span",33),r(3,"\xD7"),i()()(),t(4,"div",34)(5,"form",35)(6,"div",36)(7,"div",37)(8,"mat-form-field",38)(9,"mat-label"),r(10,"Name"),i(),d(11,"input",39),i()(),t(12,"div",37)(13,"mat-form-field",38)(14,"mat-label"),r(15,"Mobile Number"),i(),d(16,"input",40),i()(),t(17,"div",37)(18,"mat-form-field",38)(19,"mat-label"),r(20,"Department"),i(),t(21,"mat-select",41)(22,"mat-option",42),r(23,"--Select Department--"),i(),t(24,"mat-option",43),r(25,"Sales Executive Officer"),i(),t(26,"mat-option",44),r(27,"Asst. Manager"),i(),t(28,"mat-option",45),r(29,"Logistics"),i(),t(30,"mat-option",46),r(31,"Dispach"),i()()()()()()(),t(32,"div",47)(33,"button",48),r(34,"Add"),i(),t(35,"button",49),b("click",function(){let n=f(o).$implicit;return u(n.dismiss("Cross click"))}),r(36,"Cancel"),i()()}if(e&2){let o=O();p(5),g("formGroup",o.adduser)}}var gt=(()=>{class e{constructor(o,l){this.fb=o,this.modelService=l,this.activeExport="pdf",this.displayedColumns=["#","name","mobile_num","dept","date"],this.dataSource=new be,this.adduser=this.fb.group({name:["",[w.required]],mobile_num:["",[w.required]],dept:["",[w.required]]})}setActive(o){this.activeExport=o}openpopup(o){this.modelService.open(o,{centered:!0,size:"xl"})}closepopup(){document.getElementById("popupModal").style.display="none"}exportToExcel(o){return T(this,null,function*(){this.dataSource.paginator=null,yield new Promise(c=>setTimeout(c,0));let l=o._elementRef.nativeElement,n=P.table_to_sheet(l),a=P.book_new();P.book_append_sheet(a,n,"Employees"),Me(a,"departments.xlsx"),this.dataSource.paginator=this.paginator})}exportToPDF(){let o=new we,l=[{header:"S.No",dataKey:"i"},{header:"Name",dataKey:this.displayedColumns[1]},{header:"Mobile Number",dataKey:this.displayedColumns[2]},{header:"Department",dataKey:this.displayedColumns[3]},{header:"Date",dataKey:this.displayedColumns[4]}],n=this.dataSource.filteredData.map((a,c)=>({i:c+1,cateroey_name:a.cateroey_name||"",custId:a.custId||"",ordernum:a.ordernum||"",check:a.check||"",paymentmethod:a.paymentmethod||"",purchase:a.purchase||"",delivery:a.delivery||"",comments:a.comments||"",lot:a.lot||""}));(0,Se.default)(o,{columns:l,body:n,headStyles:{fillColor:[23,140,120]},startY:20,styles:{fontSize:8}}),o.save("departments.pdf")}printTable(){let o=document.getElementById("tableToPrint")?.innerHTML;if(o){let l=window.open("","_blank","width=900,height=600");l.document.open(),l.document.write(`
        <html>
          <head>
            <title>Department Details</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;
              }
            </style>
          </head>
          <body onload="window.print(); window.close();">
            ${o}
          </body>
        </html>
      `),l.document.close()}}getDeptDetails(){}static{this.\u0275fac=function(l){return new(l||e)(E(B),E($))}}static{this.\u0275cmp=k({type:e,selectors:[["app-dept-registration"]],viewQuery:function(l,n){if(l&1&&(x(D,5),x(S,5),x(v,5)),l&2){let a;y(a=M())&&(n.table=a.first),y(a=M())&&(n.paginator=a.first),y(a=M())&&(n.sort=a.first)}},decls:44,vars:12,consts:[["emptable",""],["popupTemplate",""],[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"],[1,"col-sm-4","d-flex","align-items-center","justify-content-end",2,"margin-left","60%"],["mat-raised-button","",1,"raise-btn"],["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","name"],["mat-header-cell","","mat-sort-header","","class","f-s-16 f-w-600",4,"matHeaderCellDef"],["matColumnDef","mobile_num"],["matColumnDef","dept"],["matColumnDef","date"],["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",""],[1,"modal-header"],["type","button","aria-label","Close",1,"close",2,"margin-left","1060px",3,"click"],["aria-hidden","true"],[1,"modal-body"],[3,"formGroup"],[1,"row"],[1,"col-md-4","mb-3"],["appearance","outline",1,"w-100"],["matInput","","placeholder","Name","type","number","formControlName","name"],["matInput","","placeholder","Number","type","mobile_num","formControlName","num"],["formControlName","dept"],["value","0"],["value","seo"],["value","asst"],["value","log"],["value","dis"],[1,"modal-footer"],["type","button",1,"raise-btn"],["type","button",1,"close",3,"click"]],template:function(l,n){if(l&1){let a=R();t(0,"mat-card",2)(1,"div",3)(2,"div",4)(3,"mat-form-field",5),d(4,"input",6),t(5,"mat-icon",7),d(6,"i-tabler",8),i()()(),t(7,"div",9)(8,"button",10),b("click",function(){return f(a),n.setActive("pdf"),u(n.exportToPDF())}),r(9,"PDF"),i(),t(10,"button",10),b("click",function(){f(a);let ve=N(24);return n.setActive("excel"),u(n.exportToExcel(ve))}),r(11,"Excel"),i(),t(12,"button",10),b("click",function(){return f(a),n.setActive("print"),u(n.printTable())}),r(13,"Print"),i()()()(),t(14,"mat-card",2)(15,"mat-card-content",11)(16,"div",12)(17,"button",13),r(18," Add User "),i()()()(),t(19,"mat-card",2)(20,"mat-card-content",11)(21,"div",14),d(22,"mat-paginator",15),t(23,"table",16,0),h(25,17),s(26,Te,2,0,"th",18)(27,ke,2,1,"td",19),_(),h(28,20),s(29,Oe,2,0,"th",21)(30,Ne,1,0,"td",19),_(),h(31,22),s(32,Ve,2,0,"th",21)(33,Ae,1,0,"td",19),_(),h(34,23),s(35,Fe,2,0,"th",21)(36,Ie,1,0,"td",19),_(),h(37,24),s(38,He,2,0,"th",21)(39,Xe,1,0,"td",19),_(),s(40,ze,1,0,"tr",25)(41,Le,1,0,"tr",26),i()()()(),s(42,Qe,37,1,"ng-template",null,1,F)}l&2&&(p(8),C("active",n.activeExport==="pdf"),p(2),C("active",n.activeExport==="excel"),p(2),C("active",n.activeExport==="print"),p(10),g("pageSizeOptions",A(11,Re))("pageSize",5),p(),g("dataSource",n.dataSource),p(17),g("matHeaderRowDef",n.displayedColumns),p(),g("matRowDefColumns",n.displayedColumns))},dependencies:[Ce,Y,ee,J,Z,ie,oe,ae,re,te,le,S,v,me,D,pe,ue,se,de,ge,ce,fe,he,_e,I,K,L,H,Q,X,z,G,j,q,ye,xe,ne,U,W],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}.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{gt as DeptRegistrationComponent};
