1import{a as P}from"./chunk-WVBX2HI2.js";import{Pa as u,Vb as ke,o as Oe}from"./chunk-D2DXWN37.js";import{a as ie}from"./chunk-E4RNTLEE.js";import{b as F}from"./chunk-UTIROFZB.js";import{V as Pe,_ as Ve,b as Z,g as K,ga as we}from"./chunk-STQRMAKW.js";import{$ as W,B as _e,Ba as Q,C as be,D as j,E as $,Ha as U,W as Me,Wa as Ne,Ya as X,Z as H,Za as Y,_ as q,_a as ee,aa as J,ab as Se,b as V,cb as te,d as ae,g as w,h as O,jb as Te,m as k,mb as Le,ob as Ee,p as G,s as R,sb as De,tb as Fe,vb as xe,wb as Ae,yb as Ie,z as B}from"./chunk-E6SPOSAE.js";import{$a as h,Ab as s,Ba as c,Bb as re,Cb as M,Cc as fe,Ga as S,Ha as T,Hf as ye,J as f,Jc as ze,Jf as x,Kf as A,Ma as L,Mf as I,Pa as m,Pb as pe,Qb as de,Vb as ce,X as N,Ya as E,Yb as ue,_a as z,ab as C,ba as v,bb as i,ca as y,cb as r,db as p,hb as _,he,kb as g,ke as Ce,le as ge,mb as b,ne,pb as D,xa as n,xf as ve,zb as le}from"./chunk-CECBUGKR.js";import{h as oe}from"./chunk-O7S4L63H.js";var Ye=()=>["/app/modelos/cadastrar"],et=t=>[t];function tt(t,d){if(t&1){let e=_();i(0,"nz-col",5)(1,"nz-alert",16),g("nzOnClose",function(){let a=v(e).$implicit,l=b();return y(l.closeErrorAlert(a))}),r()()}if(t&2){let e=d.$implicit;n(),D("nzMessage",e)}}function it(t,d){if(t&1&&p(0,"nz-option",10),t&2){let e=d.$implicit;m("nzLabel",e)("nzValue",e)}}function ot(t,d){t&1&&(i(0,"nz-tag",17),p(1,"span",22),r()),t&2&&(m("nzColor","orange"),n(),m("nzType","pushpin"))}function rt(t,d){if(t&1){let e=_();i(0,"tr")(1,"td"),s(2),L(3,ot,2,2,"nz-tag",17),r(),i(4,"td"),s(5),r(),i(6,"td"),s(7),ce(8,"date"),r(),i(9,"td",15)(10,"a",18),p(11,"span",19),r(),i(12,"a",20),g("nzOnConfirm",function(){let a=v(e).$implicit,l=b();return y(l.removeModel(a.uuid))}),p(13,"span",21),r()()()}if(t&2){let e=d.$implicit;n(2),M(" ",e.nome," "),n(),E(e.padrao?3:-1),n(2),re(e.tipo),n(2),re(ue(8,5,e.created_at,"dd/MM/yyyy","utc")),n(3),m("routerLink",de(9,et,"/app/modelos/editar/"+e.uuid))}}var Ge=(()=>{class t{constructor(e,o){this.fb=e,this.api=o,this.isLoading=!1,this.modelsList=[],this.errorList=[],this.typeList=[u.CONFISSAO_DIVIDA],this.modelsForm=this.fb.group({busca:[null],tipo:[null]})}ngOnInit(){this.getModelsList()}getModelsList(){this.isLoading=!0,this.api.post("/models-pdf/list",{nome:this.modelsForm.value.busca,tipo:this.modelsForm.value.tipo}).pipe(f(()=>{this.isLoading=!1})).subscribe({next:e=>{this.modelsList=e.data},error:e=>{Array.isArray(e.error.message)?this.errorList=e.error.message:this.errorList=[e.error.message]}})}removeModel(e){this.isLoading=!0,this.api.delete(`/models-pdf/${e}`).subscribe({next:()=>{this.getModelsList()},error:o=>{Array.isArray(o.error.message)?this.errorList=o.error.message:this.errorList=[o.error.message]}})}closeErrorAlert(e){this.errorList=this.errorList.filter(o=>o!==e)}static{this.\u0275fac=function(o){return new(o||t)(c(B),c(F))}}static{this.\u0275cmp=S({type:t,selectors:[["app-models-pdf"]],standalone:!1,decls:48,vars:6,consts:[["dynamicTable",""],["nzBackIcon","",3,"nzGhost"],["nz-button","","nzType","primary",3,"routerLink"],["nz-icon","","nzType","plus","nzTheme","outline"],["nz-row","","nzGutter","16","nzAlign","bottom","nz-form","","nzLayout","vertical",3,"ngSubmit","formGroup"],["nzSpan","24"],["nz-col","","nzSpan","6"],["nz-input","","formControlName","busca","placeholder","Digite o nome do modelo"],["nz-col","","nzSpan","4"],["formControlName","tipo","nzShowSearch",""],[3,"nzLabel","nzValue"],["nz-col","","nzSpan","3"],["nz-button","","nzType","primary"],["nz-icon","","nzType","search"],[3,"nzData","nzLoading"],["nzAlign","center"],["nzShowIcon","","nzType","error","nzCloseable","",2,"margin-bottom","12px",3,"nzOnClose","nzMessage"],["nz-tooltip","","nzTooltipTitle","Modelo Padr\xE3o",2,"display","inline-block",3,"nzColor"],["z-button","","nzType","link",3,"routerLink"],["nz-icon","","nzType","edit","nzTheme","outline"],["nz-button","","nzType","text","nzDanger","","nz-tooltip","","nzTooltipTitle","Clique para remover","nz-popconfirm","","nzPopconfirmTitle","Voc\xEA deseja realmente excluir esse registro?",3,"nzOnConfirm"],["nz-icon","","nzType","delete","nzTheme","outline"],["nz-icon","",3,"nzType"]],template:function(o,a){if(o&1){let l=_();i(0,"nz-page-header",1)(1,"nz-page-header-title"),s(2,"Modelos de Documentos"),r(),i(3,"nz-page-header-subtitle"),s(4,"Verifique ou crie novos modelos de documentos"),r(),i(5,"nz-page-header-extra")(6,"nz-space")(7,"button",2),p(8,"span",3),s(9,"Cadastrar"),r()()(),i(10,"nz-page-header-content")(11,"form",4),g("ngSubmit",function(){return v(l),y(a.getModelsList())}),h(12,tt,2,1,"nz-col",5,z),i(14,"div",6)(15,"nz-form-item")(16,"nz-form-label"),s(17,"Busca"),r(),i(18,"nz-form-control"),p(19,"input",7),r()()(),i(20,"div",8)(21,"nz-form-item")(22,"nz-form-label"),s(23,"Tipo"),r(),i(24,"nz-form-control")(25,"nz-select",9),h(26,it,1,2,"nz-option",10,z),r()()()(),i(28,"div",11)(29,"nz-form-item")(30,"button",12),p(31,"span",13),s(32," Buscar "),r()()()(),i(33,"nz-table",14,0)(35,"thead")(36,"tr")(37,"th"),s(38,"Nome"),r(),i(39,"th"),s(40,"Tipo"),r(),i(41,"th"),s(42,"Data cria\xE7\xE3o"),r(),i(43,"th",15),s(44,"A\xE7\xF5es"),r()()(),i(45,"tbody"),h(46,rt,14,11,"tr",null,z),r()()()()}if(o&2){let l=le(34);m("nzGhost",!1),n(7),m("routerLink",pe(5,Ye)),n(4),m("formGroup",a.modelsForm),n(),C(a.errorList),n(14),C(a.typeList),n(7),m("nzData",a.modelsList)("nzLoading",a.isLoading),n(13),C(l.data)}},dependencies:[ge,k,V,w,O,G,R,K,I,x,A,$,j,q,H,J,W,ve,Z,te,X,Y,ee,Se,Q,U,ye,Fe,Te,Le,Ae,De,xe,Ee,Pe,Me,Ve,fe],encapsulation:2})}}return t})();function nt(t,d){if(t&1){let e=_();i(0,"nz-col",3)(1,"nz-alert",16),g("nzOnClose",function(){let a=v(e).$implicit,l=b();return y(l.closeErrorAlert(a))}),r()()}if(t&2){let e=d.$implicit;n(),D("nzMessage",e)}}function at(t,d){if(t&1&&p(0,"nz-option",10),t&2){let e=d.$implicit;m("nzValue",e)("nzLabel",e)}}function st(t,d){if(t&1&&(i(0,"nz-form-item")(1,"nz-form-label",17),s(2,"Template"),r(),i(3,"nz-form-control"),p(4,"app-editor",18),r()()),t&2){let e=b();n(4),m("editorVars",e.layoutVars)}}var me=(()=>{class t{constructor(e,o,a,l){this.fb=e,this.api=o,this.activeRoute=a,this.router=l,this.isLoading=!1,this.isEdit=!1,this.model_uuid="",this.errorList=[],this.layoutVars=[],this.typeList=[u.CONFISSAO_DIVIDA,u.CONTRATO,u.NOTA_FISCAL,u.RECIBO,u.EMAIL],this.createModelsForm=this.fb.group({nome:[null,ae.required],modelo:[null,ae.required],tipo:[null],padrao:[!1]})}ngOnInit(){this.createModelsForm.get("tipo")?.valueChanges.subscribe(e=>{this.getConsts(e)}),this.activeRoute.params.subscribe(e=>{e.uuid&&(this.isEdit=!0,this.model_uuid=e.uuid,this.getModel())})}handleSubmit(){return oe(this,null,function*(){if(this.isEdit){this.updateModels();return}this.createModels()})}getModel(){this.isLoading=!0,this.api.get(`/models-pdf/${this.model_uuid}`).pipe(f(()=>this.isLoading=!1)).subscribe({next:e=>{e.data&&this.createModelsForm.patchValue(e.data)},error:e=>{Array.isArray(e.error.message)?this.errorList=e.error.message:this.errorList=[e.error.message]}})}createModels(){this.isLoading=!0,this.api.post("/models-pdf",this.createModelsForm.value).pipe(f(()=>this.isLoading=!1)).subscribe({next:e=>{this.router.navigate(["/app/modelos/"])},error:e=>{Array.isArray(e.error.message)?this.errorList=e.error.message:this.errorList=[e.error.message]}})}updateModels(){this.isLoading=!0,this.api.patch(`/models-pdf/${this.model_uuid}`,this.createModelsForm.value).pipe(f(()=>this.isLoading=!1)).subscribe({next:e=>{this.router.navigate(["/app/modelos/"])},error:e=>{Array.isArray(e.error.message)?this.errorList=e.error.message:this.errorList=[e.error.message]}})}getConsts(e){return oe(this,null,function*(){this.layoutVars=[],this.isLoading=!0,this.api.post("/models-pdf/consts",{tipo:e}).pipe(f(()=>this.isLoading=!1)).subscribe({next:o=>{this.layoutVars=o.data},error:o=>{Array.isArray(o.error.message)?this.errorList=o.error.message:this.errorList=[o.error.message]}})})}closeErrorAlert(e){this.errorList=this.errorList.filter(o=>o!==e)}static{this.\u0275fac=function(o){return new(o||t)(c(B),c(F),c(he),c(Ce))}}static{this.\u0275cmp=S({type:t,selectors:[["app-models-pdf-create"]],standalone:!1,decls:37,vars:7,consts:[[1,"site-page-header-ghost-wrapper"],["nzBackIcon","",3,"nzGhost"],["nz-row","","nzGutter","16","nzAlign","bottom","nz-form","","nzLayout","vertical",3,"ngSubmit","formGroup"],["nzSpan","24"],["nz-col","","nzSpan","8"],["for","nome","nzRequired",""],["nz-input","","formControlName","nome","placeholder","Insira o
1nome do modelo"],["nz-col","","nzSpan","6"],["for","tipo","nzRequired",""],["formControlName","tipo","nzShowSearch","",3,"nzDisabled"],[3,"nzValue","nzLabel"],["nz-checkbox","","formControlName","padrao"],["nz-col","","nzSpan","24"],["nz-row","","nzGutter","0","nzJustify","end"],["nz-col","","nzSpan","3"],["nz-button","","nzType","primary","type","submit",3,"disabled"],["nzShowIcon","","nzType","error","nzCloseable","",2,"margin-bottom","12px",3,"nzOnClose","nzMessage"],["for","modelo","nzRequired",""],["formControlName","modelo",3,"editorVars"]],template:function(o,a){o&1&&(i(0,"div",0)(1,"nz-page-header",1)(2,"nz-page-header-title"),s(3),r(),i(4,"nz-page-header-subtitle"),s(5," Voc\xEA pode cadastrar ou editar os dados de um modelo "),r(),i(6,"nz-page-header-content")(7,"form",2),g("ngSubmit",function(){return a.handleSubmit()}),h(8,nt,2,1,"nz-col",3,z),i(10,"div",4)(11,"nz-form-item")(12,"nz-form-label",5),s(13,"Nome"),r(),i(14,"nz-form-control"),p(15,"input",6),r()()(),i(16,"div",7)(17,"nz-form-item")(18,"nz-form-label",8),s(19,"Tipo"),r(),i(20,"nz-form-control")(21,"nz-select",9),h(22,at,1,2,"nz-option",10,z),r()()()(),i(24,"div",4)(25,"nz-form-item")(26,"nz-form-control")(27,"label",11),s(28,"Padr\xE3o"),r()()()(),i(29,"div",12),L(30,st,5,1,"nz-form-item"),r(),i(31,"div",12)(32,"div",13)(33,"div",14)(34,"nz-form-item")(35,"button",15),s(36),r()()()()()()()()()),o&2&&(n(),m("nzGhost",!1),n(2),M("",a.isEdit?"Editar":"Cadastrar"," Modelo"),n(4),m("formGroup",a.createModelsForm),n(),C(a.errorList),n(13),m("nzDisabled",a.isEdit),n(),C(a.typeList),n(8),E(a.layoutVars.length?30:-1),n(5),m("disabled",a.createModelsForm.invalid),n(),M(" ",a.isEdit?"Atualizar":"Salvar"," "))},dependencies:[k,V,w,O,G,R,K,I,x,A,Ne,$,j,q,H,J,W,Z,te,X,Y,ee,Q,U,Oe],encapsulation:2})}}return t})();var mt=[{path:"",pathMatch:"full",redirectTo:"buscar"},{path:"buscar",component:Ge,data:{role:ie.ListarModelos},canActivate:[P]},{path:"cadastrar",component:me,data:{role:ie.CriarModelos},canActivate:[P]},{path:"editar/:uuid",component:me,data:{role:ie.EditarModelos},canActivate:[P]}],Re=(()=>{class t{static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275mod=T({type:t})}static{this.\u0275inj=N({imports:[ne.forChild(mt),ne]})}}return t})();var $t=(()=>{class t{static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275mod=T({type:t})}static{this.\u0275inj=N({imports:[ze,Re,be,_e,we,ke,Ie]})}}return t})();export{$t as a};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.