%PDF- %PDF-
Direktori : /home/vacivi36/www2]/app/ |
Current File : /home/vacivi36/www2]/app/657.7a3a55dd98118934.js |
"use strict";(self.webpackChunkmaterial=self.webpackChunkmaterial||[]).push([[657],{3657:(rt,g,r)=>{r.r(g),r.d(g,{CompaniesModule:()=>it});var p=r(9808),C=r(6696),m=r(8279),_=r(6087),d=r(4847),l=r(3075),u=r(8966),t=r(5e3),y=r(7261),Z=r(6966),h=r(3737),v=r(7423),x=r(4834),T=r(5899),U=r(2368),A=r(79);function b(e,a){1&e&&t._UZ(0,"mat-progress-bar",25)}const N=function(){return{person:!0}},S=function(){return{phone:!0}};let f=(()=>{class e{constructor(n,o,i,s,c){this.formBuilder=n,this._snackBar=o,this.companyService=i,this.dialog=s,this.data=c,this.loading=!1,this.savedChange=!1,this.company=this.data.company}ngOnInit(){this.initForm(),this.populateForm(this.company)}initForm(){this.form=this.formBuilder.group({name:[null,[l.kI.required]],cnpj:[null,[l.kI.required]],address:[null,[l.kI.required]],phone:[null,[l.kI.required]],name_responsible:[null],number_employees:[null],notes:[null],status:[!0]})}save(n){if(this.form.valid){this.loading=!0;let o=this.form.value;this.company?this.companyService.update(this.company.id,o).then(i=>{this.company=i,this.savedChange=!0,this.openSnackBar("Salvo com sucesso!","Fechar","success"),n&&this.closeDialog()}).catch(i=>{this.openSnackBar(i.error.message,"Fechar","danger")}).finally(()=>{this.loading=!1}):this.companyService.create(o).then(i=>{this.company=i,this.savedChange=!0,this.openSnackBar("Salvo com sucesso!","Fechar","success"),n&&this.closeDialog()}).catch(i=>{this.openSnackBar(i.error.message,"Fechar","danger")}).finally(()=>{this.loading=!1})}}populateForm(n){this.form.patchValue(n)}canSave(){return this.form.valid&&!this.loading}closeDialog(){this.savedChange?this.dialog.close(this.company):this.dialog.close()}openSnackBar(n,o,i){this._snackBar.open(n,o,{horizontalPosition:"right",verticalPosition:"bottom",duration:4e3,panelClass:"snackBar-"+i})}}return e.\u0275fac=function(n){return new(n||e)(t.Y36(l.qu),t.Y36(y.ux),t.Y36(Z.J),t.Y36(u.so),t.Y36(u.WI))},e.\u0275cmp=t.Xpm({type:e,selectors:[["app-company-form-dialog"]],decls:54,vars:8,consts:[[3,"formGroup"],["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","",1,"d-flex","align-items-center","justify-content-between","cursor-pointer","p-2","mt-2","mx-2"],[1,"mdi","mdi-close","mb-2",3,"click"],["style","height: 3px;","color","accent","mode","indeterminate",4,"ngIf"],[1,"mat-typography","p-4","background-color-form"],[1,"row","mb-3","d-flex","align-items-center"],[1,"col-md-6"],[1,"form-label"],[1,"required"],["type","text","formControlName","name",1,"form-control"],["type","text","formControlName","cnpj",1,"form-control",3,"brmasker"],[1,"col-md-12","mt-3"],["type","text","formControlName","address",1,"form-control"],[1,"col-md-5","mt-3"],["type","text","formControlName","name_responsible",1,"form-control"],[1,"col-md-4","mt-3"],["type","text","formControlName","phone",1,"form-control",3,"brmasker"],[1,"col-md-3","mt-3"],["type","number","formControlName","number_employees",1,"form-control"],["formControlName","notes","rows","4",1,"form-control"],[1,"d-flex","align-items-center"],[1,"mt-3","d-flex","flex-column"],["color","accent","formControlName","status",1,"small-toggle"],["cdkDrag","","cdkDragRootElement",".cdk-overlay-pane","cdkDragHandle","","align","end",1,"cursor-pointer","p-2","mt-1","mx-2","mb-1"],["mat-button","","color","accent",3,"disabled","click"],["color","accent","mode","indeterminate",2,"height","3px"]],template:function(n,o){1&n&&(t.TgZ(0,"form",0)(1,"div",1)(2,"h6"),t._uU(3),t.qZA(),t.TgZ(4,"i",2),t.NdJ("click",function(){return o.closeDialog()}),t.qZA()(),t._UZ(5,"mat-divider"),t.YNc(6,b,1,0,"mat-progress-bar",3),t.TgZ(7,"div",4)(8,"div",5)(9,"div",6)(10,"label",7),t._uU(11,"Nome"),t.qZA(),t.TgZ(12,"span",8),t._uU(13,"*"),t.qZA(),t._UZ(14,"input",9),t.qZA(),t.TgZ(15,"div",6)(16,"label",7),t._uU(17,"CNPJ"),t.qZA(),t.TgZ(18,"span",8),t._uU(19,"*"),t.qZA(),t._UZ(20,"input",10),t.qZA(),t.TgZ(21,"div",11)(22,"label",7),t._uU(23,"Endere\xe7o"),t.qZA(),t.TgZ(24,"span",8),t._uU(25,"*"),t.qZA(),t._UZ(26,"input",12),t.qZA(),t.TgZ(27,"div",13)(28,"label",7),t._uU(29,"Nome do Respons\xe1vel"),t.qZA(),t._UZ(30,"input",14),t.qZA(),t.TgZ(31,"div",15)(32,"label",7),t._uU(33,"Telefone/Celular"),t.qZA(),t.TgZ(34,"span",8),t._uU(35,"*"),t.qZA(),t._UZ(36,"input",16),t.qZA(),t.TgZ(37,"div",17)(38,"label",7),t._uU(39,"N\xba Funcion\xe1rios"),t.qZA(),t._UZ(40,"input",18),t.qZA(),t.TgZ(41,"div",11)(42,"label",7),t._uU(43,"Observa\xe7\xf5es"),t.qZA(),t._UZ(44,"textarea",19),t.qZA(),t.TgZ(45,"div",20)(46,"div",21)(47,"label",7),t._uU(48,"Status"),t.qZA(),t._UZ(49,"mat-slide-toggle",22),t.qZA()()()(),t._UZ(50,"mat-divider"),t.TgZ(51,"div",23)(52,"button",24),t.NdJ("click",function(){return o.save(!0)}),t._uU(53,"Salvar e Fechar"),t.qZA()()()),2&n&&(t.Q6J("formGroup",o.form),t.xp6(3),t.Oqu(o.company?"Editar Empresa #"+o.company.id:"Adicionar Empresa"),t.xp6(3),t.Q6J("ngIf",o.loading),t.xp6(14),t.Q6J("brmasker",t.DdM(6,N)),t.xp6(16),t.Q6J("brmasker",t.DdM(7,S)),t.xp6(16),t.Q6J("disabled",!o.canSave()))},dependencies:[p.O5,h.Zt,h.Bh,v.lW,x.d,T.pW,U.Rr,l._Y,l.Fj,l.wV,l.JJ,l.JL,l.sg,l.u,A.bS],styles:[".required[_ngcontent-%COMP%]{color:#ea0505;margin-left:5px}.small-toggle[_ngcontent-%COMP%]{transform:scale(.75);margin:0}.small-toggle[_ngcontent-%COMP%] .mat-slide-toggle-thumb[_ngcontent-%COMP%]{width:12px;height:12px}.small-toggle[_ngcontent-%COMP%] .mat-slide-toggle-bar[_ngcontent-%COMP%]{height:14px}"]}),e})();var k=r(4854),D=r(5664),w=r(6030),L=r(5245),Y=r(7531),q=r(7238);function B(e,a){1&e&&t._UZ(0,"mat-progress-bar",26)}function F(e,a){1&e&&(t.TgZ(0,"th",27),t._uU(1," Nome"),t.qZA())}function J(e,a){if(1&e&&(t.TgZ(0,"td",28),t._uU(1),t.qZA()),2&e){const n=a.$implicit;t.xp6(1),t.hij(" ",n.name,"")}}function E(e,a){1&e&&(t.TgZ(0,"th",27),t._uU(1," CNPJ"),t.qZA())}function M(e,a){if(1&e&&(t.TgZ(0,"td",28),t._uU(1),t.qZA()),2&e){const n=a.$implicit;t.xp6(1),t.hij(" ",n.cnpj,"")}}function Q(e,a){1&e&&(t.TgZ(0,"th",27),t._uU(1," Endere\xe7o"),t.qZA())}function O(e,a){if(1&e&&(t.TgZ(0,"td",28),t._uU(1),t.qZA()),2&e){const n=a.$implicit;t.xp6(1),t.hij(" ",n.address,"")}}function I(e,a){1&e&&(t.TgZ(0,"th",27),t._uU(1," Telefone / Celular"),t.qZA())}function P(e,a){if(1&e){const n=t.EpF();t.TgZ(0,"td",28)(1,"span"),t._uU(2),t.qZA(),t.TgZ(3,"i",29),t.NdJ("click",function(){const s=t.CHM(n).$implicit,c=t.oxw();return t.KtG(c.redirectToWhatsapp(s.phone))}),t.qZA()()}if(2&e){const n=a.$implicit,o=t.oxw();t.xp6(2),t.Oqu(o.formatarCellPhone(n.phone))}}function j(e,a){1&e&&(t.TgZ(0,"th",27),t._uU(1," N\xba Funcion\xe1rios"),t.qZA())}function R(e,a){if(1&e&&(t.TgZ(0,"td",28),t._uU(1),t.qZA()),2&e){const n=a.$implicit;t.xp6(1),t.hij(" ",n.number_employees,"")}}function H(e,a){1&e&&t._UZ(0,"th",30)}function $(e,a){if(1&e){const n=t.EpF();t.TgZ(0,"td",28)(1,"div",31)(2,"button",32),t.NdJ("click",function(){const s=t.CHM(n).$implicit,c=t.oxw();return t.KtG(c.openDialog(s))}),t._UZ(3,"i",33),t.qZA(),t.TgZ(4,"button",34),t.NdJ("click",function(){const s=t.CHM(n).$implicit,c=t.oxw();return t.KtG(c.delete(s.id,s.name))}),t._UZ(5,"i",35),t.qZA()()()}}function z(e,a){1&e&&(t.TgZ(0,"th",27),t._uU(1," Ativo"),t.qZA())}function G(e,a){1&e&&(t.TgZ(0,"mat-icon",38),t._uU(1,"check_circle"),t.qZA())}function W(e,a){1&e&&(t.TgZ(0,"mat-icon",39),t._uU(1,"cancel"),t.qZA())}function V(e,a){if(1&e&&(t.TgZ(0,"td",28),t.YNc(1,G,2,0,"mat-icon",36),t.YNc(2,W,2,0,"mat-icon",37),t.qZA()),2&e){const n=a.$implicit,o=t.oxw();t.xp6(1),t.Q6J("ngIf",n.status==o.STATUS.ACTIVE),t.xp6(1),t.Q6J("ngIf",n.status==o.STATUS.INACTIVE)}}function K(e,a){1&e&&t._UZ(0,"tr",40)}function X(e,a){1&e&&t._UZ(0,"tr",41)}function tt(e,a){if(1&e&&(t.TgZ(0,"tr",42)(1,"td",43)(2,"p",44),t._uU(3,"Nenhum registro encontrado."),t.qZA()()()),2&e){const n=t.oxw();t.xp6(1),t.uIk("colspan",n.displayedColumns.length)}}const et=function(){return[25,50,100]},nt=[{path:"",component:(()=>{class e{constructor(n,o,i,s,c){this._liveAnnouncer=n,this.dialog=o,this.confirmService=i,this._snackBar=s,this.companyService=c,this.STATUS=k.Q,this.loading=!1,this.companies=[],this.displayedColumns=["name","cnpj","address","phone","number_employees","status","options"],this.dataSource=new m.by}ngOnInit(){this.downloadCompanies()}ngAfterViewInit(){this.dataSource.sort=this.sort,this.dataSource.paginator=this.paginator}applyFilter(n){this.dataSource.filter=n.target.value.trim().toLowerCase()}sortChange(n){this._liveAnnouncer.announce(n.direction?`Sorted ${n.direction}ending`:"Sorting cleared")}openDialog(n){this.dialog.open(f,{width:"800px",maxHeight:"100vh",panelClass:"dialog",autoFocus:!1,data:{company:n}}).afterClosed().subscribe(i=>{i&&this.downloadCompanies()})}downloadCompanies(){this.loading=!0,this.companyService.list().then(n=>{this.dataSource.data=n,this.companies=n}).catch(n=>{this.openSnackBar("Erro ao listar empresas","Fechar","danger")}).finally(()=>{this.loading=!1})}delete(n,o){this.confirmService.openConfirmDialog("Excluir","Tem certeza que deseja excluir a empresa "+o+" ?","Cancelar","Excluir").afterClosed().subscribe(i=>{i&&(this.loading=!0,this.companyService.delete(n).then(()=>{this.downloadCompanies(),this.openSnackBar("Exclu\xeddo com sucesso!","Fechar","success")}).catch(s=>{this.openSnackBar(s.error.message,"Fechar","danger")}).finally(()=>{this.loading=!1}))})}openSnackBar(n,o,i){this._snackBar.open(n,o,{horizontalPosition:"right",verticalPosition:"bottom",duration:3e3,panelClass:"snackBar-"+i})}redirectToWhatsapp(n){const i=`https://api.whatsapp.com/send/?phone=${n.replace(/\D/g,"")}`;window.open(i,"_blank")}formatarCellPhone(n){return n.replace(/(\d{2})(\d{5})(\d{4})/,"($1) $2-$3")}}return e.\u0275fac=function(n){return new(n||e)(t.Y36(D.Kd),t.Y36(u.uw),t.Y36(w.x),t.Y36(y.ux),t.Y36(Z.J))},e.\u0275cmp=t.Xpm({type:e,selectors:[["app-company-list"]],viewQuery:function(n,o){if(1&n&&(t.Gf(_.NW,5),t.Gf(d.YE,5)),2&n){let i;t.iGM(i=t.CRH())&&(o.paginator=i.first),t.iGM(i=t.CRH())&&(o.sort=i.first)}},decls:41,vars:7,consts:[[1,"d-flex","align-items-center","justify-content-between","p-2"],["mat-raised-button","","color","accent",1,"style-button-add",3,"click"],[1,"mt-3"],["style","height: 3px;","color","accent","mode","indeterminate",4,"ngIf"],[1,"header-table"],[1,"d-flex","align-items-center","justify-content-between"],[1,"search_input_group","search-table","w-25","mt-4","mb-4"],[1,"mdi","mdi-magnify"],["matInput","","placeholder","Pesquisar",1,"search_input",3,"input"],["input",""],[1,"table-responsive"],["mat-table","","matSort","",3,"dataSource","matSortChange"],["matColumnDef","name"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["matColumnDef","cnpj"],["matColumnDef","address"],["matColumnDef","phone"],["matColumnDef","number_employees"],["matColumnDef","options"],["mat-header-cell","",4,"matHeaderCellDef"],["matColumnDef","status"],["mat-header-row","",4,"matHeaderRowDef","matHeaderRowDefSticky"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],[1,"mat-paginator",3,"pageSizeOptions"],["color","accent","mode","indeterminate",2,"height","3px"],["mat-header-cell","","mat-sort-header",""],["mat-cell",""],["matTooltip","WhatsApp",1,"mdi","mdi-whatsapp","icon-whatsapp",3,"click"],["mat-header-cell",""],[1,"mat-icon-no-color"],["matTooltip","Editar",1,"icon-options",3,"click"],[1,"mdi","mdi-pencil-outline"],["matTooltip","Excluir",1,"icon-options-delete",3,"click"],[1,"mdi","mdi-trash-can-outline"],["class","status-icon",4,"ngIf"],["class","status-icon-error",4,"ngIf"],[1,"status-icon"],[1,"status-icon-error"],["mat-header-row",""],["mat-row",""],[1,"mat-row"],[1,"mat-cell"],[1,"d-flex","align-items-center","justify-content-center","mt-3"]],template:function(n,o){1&n&&(t.TgZ(0,"div",0)(1,"h3"),t._uU(2,"Empresas"),t.qZA(),t.TgZ(3,"button",1),t.NdJ("click",function(){return o.openDialog()}),t._uU(4,"Adicionar Empresa"),t.qZA()(),t._UZ(5,"mat-divider",2),t.YNc(6,B,1,0,"mat-progress-bar",3),t.TgZ(7,"div",4)(8,"div",5)(9,"div",6),t._UZ(10,"i",7),t._uU(11,"\xa0 "),t.TgZ(12,"input",8,9),t.NdJ("input",function(s){return o.applyFilter(s)}),t.qZA()()(),t.TgZ(14,"div",10)(15,"table",11),t.NdJ("matSortChange",function(s){return o.sortChange(s)}),t.ynx(16,12),t.YNc(17,F,2,0,"th",13),t.YNc(18,J,2,1,"td",14),t.BQk(),t.ynx(19,15),t.YNc(20,E,2,0,"th",13),t.YNc(21,M,2,1,"td",14),t.BQk(),t.ynx(22,16),t.YNc(23,Q,2,0,"th",13),t.YNc(24,O,2,1,"td",14),t.BQk(),t.ynx(25,17),t.YNc(26,I,2,0,"th",13),t.YNc(27,P,4,1,"td",14),t.BQk(),t.ynx(28,18),t.YNc(29,j,2,0,"th",13),t.YNc(30,R,2,1,"td",14),t.BQk(),t.ynx(31,19),t.YNc(32,H,1,0,"th",20),t.YNc(33,$,6,0,"td",14),t.BQk(),t.ynx(34,21),t.YNc(35,z,2,0,"th",13),t.YNc(36,V,3,2,"td",14),t.BQk(),t.YNc(37,K,1,0,"tr",22),t.YNc(38,X,1,0,"tr",23),t.YNc(39,tt,4,1,"tr",24),t.qZA()(),t._UZ(40,"mat-paginator",25),t.qZA()),2&n&&(t.xp6(6),t.Q6J("ngIf",o.loading),t.xp6(9),t.Q6J("dataSource",o.dataSource),t.xp6(22),t.Q6J("matHeaderRowDef",o.displayedColumns)("matHeaderRowDefSticky",!0),t.xp6(1),t.Q6J("matRowDefColumns",o.displayedColumns),t.xp6(2),t.Q6J("pageSizeOptions",t.DdM(6,et)))},dependencies:[p.O5,v.lW,m.BZ,m.fO,m.as,m.w1,m.Dz,m.nj,m.ge,m.ev,m.XQ,m.Gk,m.Ee,L.Hw,Y.Nt,x.d,_.NW,T.pW,d.YE,d.nU,q.gM],styles:['table[_ngcontent-%COMP%]{width:100%}h3[_ngcontent-%COMP%]{font-size:23px}.status-icon[_ngcontent-%COMP%]{font-size:16px;display:flex;align-items:center;color:#0d8a0d}.status-icon-error[_ngcontent-%COMP%]{font-size:16px;display:flex;align-items:center;color:#d00808}.icon-whatsapp[_ngcontent-%COMP%]{color:#25d366;cursor:pointer;margin-left:5px}.mdi-whatsapp[_ngcontent-%COMP%]:before{content:"\\f05a3";font-size:16px} .mat-table .mat-row:nth-child(odd){background-color:#f8f8f8} .mat-table .mat-row:nth-child(even){background-color:#fff}']}),e})()},{path:"new",component:f},{path:":id/edit",component:f}];let ot=(()=>{class e{}return e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=t.oAB({type:e}),e.\u0275inj=t.cJS({imports:[C.Bz.forChild(nt),C.Bz]}),e})();var at=r(4540);let it=(()=>{class e{}return e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=t.oAB({type:e}),e.\u0275inj=t.cJS({imports:[p.ez,ot,h._t,at.m,l.UX,A.Tx]}),e})()}}]);