PageSourceSearch

https://app.rindegastos.com/chunk-KU3AOUQD.js

js rindegastos.com collected 2026-10-01 12:37:49 UTC 133,869 bytes, 1 lines download raw bytes

1import{c as si}from"./chunk-RRIPHZI5.js";import"./chunk-HGGKFJF6.js";import"./chunk-UJCXNWQ2.js";import"./chunk-YXA4VEK2.js";import{a as Tt}from"./chunk-5TOUUGQW.js";import{a as Pe}from"./chunk-3ACYLDO5.js";import{a as ai}from"./chunk-4KG5SEPP.js";import"./chunk-LU5UBUTO.js";import"./chunk-GU46FOPF.js";import{Ac as q,Bc as be,Dc as ti,Ec as ii,Fc as ni,Ge as ri,Jb as Zt,Lb as ct,O as st,Pb as j,Pd as oi,Qb as dt,Tb as le,Vd as mt,af as H,bc as ei,bd as re,da as zt,e as Ke,ec as L,fc as Ee,ga as Jt,h as ze,i as Je,j as Wt,k as jt,l as Ht,o as ot,p as at,s as lt,ta as pt,ua as Le,w as rt,x as Kt,ye as li}from"./chunk-6C4CBCUF.js";import{W as Xt,X as Z,Z as z,aa as ee,ba as me,fa as it,ga as nt,ja as Yt,ka as Qt,la as Te,ma as _e,sa as ue,wa as ae,xa as qt}from"./chunk-DXHUABIN.js";import"./chunk-XZ74KS5Z.js";import"./chunk-IVYEYCQW.js";import{c as O}from"./chunk-KTTR6PLX.js";import{$a as f,$b as J,Bc as k,Cb as K,Cd as Ze,Db as De,Ea as A,Eb as se,Gb as Ut,Gd as et,Hb as p,Hd as Q,Ia as F,Ib as _,Ja as Ve,Jb as g,Kb as Xe,La as Rt,Mc as W,Oa as Y,Ob as ge,Pb as xe,Pc as Gt,Pd as tt,Q as Ft,Qb as Ae,Qc as Qe,R as Ue,Rd as oe,U as I,Ud as xt,X as E,Y as C,Za as h,Zb as y,_b as x,_c as qe,ab as Ge,ac as Me,bb as U,bc as Vt,cb as P,db as N,eb as T,fb as a,ga as yt,gb as l,hb as u,hc as s,ic as c,jc as ce,ka as Dt,lb as kt,lc as Ye,mb as Bt,nb as We,ob as M,od as V,pd as D,pe as Ie,qb as v,sa as G,sb as d,se as B,ta as wt,te as de,ue as $t,wa as Ot,wb as je,xb as He,ya as n,yb as $e}from"./chunk-JGDGJZAH.js";import"./chunk-WFMAM73Y.js";import{a as ke,b as Be}from"./chunk-E5HSK5QB.js";var Pi=t=>({"border-2-s-red20-b":t}),Ni=(t,r)=>r.inputName;function Fi(t,r){t&1&&(a(0,"div",3),p(1),s(2,"translate"),l()),t&2&&(n(),g(" ",c(2,1,"ADMIN.RINDECONNECT.CARTOLAS.ADD_BANK_MODAL.COMPLETE_FIELDS")," "))}function yi(t,r){if(t&1&&(a(0,"div",4)(1,"div",5)(2,"b",6),p(3),l(),p(4),l()()),t&2){let e=d();n(3),_(e.errors[0].title),n(),g(" ",e.errors[0].message," ")}}function Di(t,r){if(t&1&&(a(0,"div",4)(1,"div",7)(2,"b"),p(3),l(),p(4),l()()),t&2){let e=r.$implicit;n(3),g("\u2022 ",e.title),n(),g(" ",e.message," ")}}function wi(t,r){if(t&1&&P(0,Di,5,2,"div",4,Ni),t&2){let e=d();N(e.errors)}}var _t=(()=>{class t{constructor(){this.errors=[]}ngOnInit(){}get hasErrors(){return this.errors&&this.errors.length>0}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-dynamic-alert"]],inputs:{errors:"errors"},decls:6,vars:6,consts:[[1,"wp-100","br-20","bg-red10"],[1,"flex","ai-c","gap-8","pd-16-tb","pd-24-sides",3,"ngClass"],[3,"type"],[1,"text-red","bold"],[1,"error-container"],[1,"flex","ai-c","gap-8"],[1,"text-red"],[1,"flex","ai-c","gap-8","pd-8-tb","pd-24-sides"]],template:function(i,o){i&1&&(a(0,"div",0)(1,"div",1),u(2,"icons-component",2),h(3,Fi,3,3,"div",3)(4,yi,5,2,"div",4),l(),h(5,wi,2,0),l()),i&2&&(n(),T("ngClass",x(4,Pi,o.errors.length>1)),n(),T("type","ERROR"),n(),f(o.errors.length>1?3:4),n(2),f(o.errors.length>1?5:-1))},dependencies:[H,W,O,D],encapsulation:2,changeDetection:0})}}return t})();var Ri=t=>({"trans-rot-180":t}),ki=t=>({"pos-f t-50 r-400":t}),Bi=(t,r)=>({"right.px":t,"top.px":r}),ci=t=>({"dis-n":t});function Ui(t,r){if(t&1&&(u(0,"icons-component",11),s(1,"translate")),t&2){let e=d(2).$implicit;T("tooltipText",c(1,2,e.info))("tooltipPosition","right")}}function Vi(t,r){if(t&1){let e=M();a(0,"span",10),v("click",function(){E(e);let o=d().$implicit,m=d(2);return C(m.handleClick(o.id))}),p(1),s(2,"translate"),h(3,Ui,2,4,"icons-component",11),l()}if(t&2){let e=d().$implicit;T("ngClass",x(5,ci,!e.visible)),n(),g(" ",c(2,3,e.label)," "),n(2),f(e.info?3:-1)}}function Gi(t,r){if(t&1){let e=M();a(0,"span",12),v("click",function(){E(e);let o=d().$implicit,m=d(2);return C(m.handleClick(o.id))}),p(1),s(2,"translate"),l()}if(t&2){let e=d().$implicit;T("ngClass",x(4,ci,!e.visible)),n(),g(" ",c(2,2,e.label)," ")}}function Wi(t,r){if(t&1&&h(0,Vi,4,7,"span",8)(1,Gi,3,6,"span",9),t&2){let e=r.$implicit;f(e.isOrange?1:0)}}function ji(t,r){if(t&1&&(a(0,"div",6)(1,"div",7,0),v("click",function(i){return i.stopPropagation()}
1),P(3,Wi,2,1,null,null,U),l()()),t&2){let e=d();n(),T("ngClass",x(2,ki,e.stylingService.stickyNavigationApprover))("ngStyle",J(4,Bi,e.optionsConfig.x,e.optionsConfig.y)),n(2),N(e.options)}}var ut=(()=>{class t{constructor(){this.cdr=I(k),this.stylingService=I(le),this.options=[],this.customClass="",this.isHovered=!1,this.optionsConfig={show:!1,x:0,y:0},this.handleClickOutside=e=>{this.btnOriginClick&&!this.btnOriginClick.contains(e.target)&&(this.closeOptions(),document.removeEventListener("click",this.handleClickOutside))}}toggleOptions(e){this.optionsConfig.show?this.closeOptions():this.setOptionsPositionConfig(e)}setOptionsPositionConfig(e){if(this.btnOriginClick=document.getElementById(e),!this.btnOriginClick)return;let{top:i,height:o}=this.btnOriginClick.getBoundingClientRect(),m=o+8;this.optionsConfig=Be(ke({},this.optionsConfig),{y:m,show:!0}),setTimeout(()=>{document.addEventListener("click",this.handleClickOutside),this.cdr.markForCheck()})}handleClick(e){this.options.find(i=>i.id===e).action(),this.closeOptions()}closeOptions(){this.optionsConfig={x:0,y:0,show:!1}}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-button-select"]],inputs:{mainClick:"mainClick",options:"options",customClass:"customClass"},decls:9,vars:10,consts:[["mainFilterBox",""],[1,"pos-r","w-fc",3,"ngClass"],[1,"flex","gap-0","text-blue","bold"],[1,"flex","text-blue","jc-c","ai-c","pd-8-tb","pd-8-r","pd-16-l","border-1-s-blue","br-100-l","hov-blue10","pointer",3,"click"],[1,"flex","jc-c","ai-c","pd-8-tb","pd-16-r","pd-8-l","border-1-s-blue-t","border-1-s-blue-r","border-1-s-blue-b","br-100-r","hov-blue10","pointer",3,"click","id"],[1,"transi-3",3,"ngClass","type"],[1,"overflowNone"],[1,"flex","fd-c","br-10","fadeInDown","pos-a","bg-white","min-w-240","w-mc","rg-shadow-soft","specialIndex-xl",3,"click","ngClass","ngStyle"],[1,"pd-10-tb","pd-16-sides","hov-blueSoft","hovFilter","hov-color-blue","flex","jc-sb","gap-8","ai-c","pointer",3,"ngClass"],[1,"text-orange","pd-10-tb","pd-16-sides","hov-orangeBg","hovFilter","hov-color-orange","flex","gap-8","ai-c","pointer",3,"ngClass"],[1,"pd-10-tb","pd-16-sides","hov-blueSoft","hovFilter","hov-color-blue","flex","jc-sb","gap-8","ai-c","pointer",3,"click","ngClass"],["rgTooltip","","type","infoTiny",3,"tooltipText","tooltipPosition"],[1,"text-orange","pd-10-tb","pd-16-sides","hov-orangeBg","hovFilter","hov-color-orange","flex","gap-8","ai-c","pointer",3,"click","ngClass"]],template:function(i,o){i&1&&(a(0,"div",1)(1,"div",2)(2,"div",3),v("click",function(){return o.mainClick()}),a(3,"div"),p(4),s(5,"translate"),l()(),a(6,"div",4),v("click",function(){return o.toggleOptions("columnOptionsButton")}),u(7,"icons-component",5),l()(),h(8,ji,5,7,"div",6),l()),i&2&&(T("ngClass",o.customClass),n(4),g("+ ",c(5,6,"BUTTONS.ADD_COLUMN")),n(2),T("id","columnOptionsButton"),n(),T("ngClass",x(8,Ri,o.optionsConfig.show))("type","chevronLookDown"),n(),f(o.optionsConfig.show?8:-1))},dependencies:[qe,W,Gt,H,Le,O,D],encapsulation:2,changeDetection:0})}}return t})();var Xi=()=>({"border-radius":"4",width:"50%",height:"50px"}),Yi=()=>({"border-radius":"4",width:"75%",height:"15px"}),Qi=()=>[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],qi=()=>({height:"40px",margin:"12px 0px 8px 0px"}),At=()=>({"border-radius":"10px",height:"40px",margin:"12px 0px 8px 0px"});function Ki(t,r){t&1&&(a(0,"tr",7)(1,"td",8),u(2,"ngx-skeleton-loader",9),l(),a(3,"td",10),u(4,"ngx-skeleton-loader",2),l(),a(5,"td",10),u(6,"ngx-skeleton-loader",2),l(),a(7,"td",11),u(8,"ngx-skeleton-loader",2),l()()),t&2&&(n(2),T("theme",y(4,qi)),n(2),T("theme",y(5,At)),n(2),T("theme",y(6,At)),n(2),T("theme",y(7,At)))}var Et=(()=>{class t{constructor(){this.skeletonRows=Array(3).fill(0)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-skeleton-table"]],decls:10,vars:5,consts:[[1,"px-[24px]","pt-[24px]"],[1,"bigger","bold"],[3,"theme"],[1,"sub-header-1"],[1,"flex","pd-24","fd-c","gap-24"],[1,"item"],[1,"tbl"],["lines","none"],[1,"slot","wNode-15","pl-24","w-auto"],["appearance","circle",3,"theme"],[1,"slot","wNode-1-4"],[1,"slot","wNode-2-4","pr-24"]],template:function(i,o){i&1&&(a(0,"div",0)(1,"div",1),u(2,"ngx-skeleton-loader",2),l(),a(3,"div",3),u(4,"ngx-skeleton-loader",2),l()(),a(5,"div",4)(6,"div",5)(7,"table",6),P(8,Ki,9,8,"tr",7,U),l()()()),i&2&&(n(2),T("theme",y(2,Xi)),n(2),T("theme",y(3,Yi)),n(4),N(y(4,Qi)))},dependencies:[Kt,rt],encapsulation:2,changeDetection:0})}}return t})();var fe=(function(t){return t.COPY_TEMPLATE="COPY_TEMPLATE",t.EDIT_TEMPLATE="EDIT_TEMPLATE",t.EDIT_TEMPLATE_NAME="EDIT_TEMPLATE_NAME",t.DELET
1E_TEMPLATE="DELETE_TEMPLATE",t})(fe||{});var R=(function(t){return t[t.PDF=2]="PDF",t[t.EXCEL=1]="EXCEL",t})(R||{});var Mt=t=>({"text-red":t}),Ct=t=>({restrictive:t}),tn=t=>({value:t,class:"rindeButton-o-t"}),nn=(t,r,e)=>({value:t,class:"rindeButton-g",loading:r,disabled:e});function on(t,r){t&1&&(u(0,"div",3),s(1,"translate")),t&2&&T("innerHTML",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.TITLE"),G)}function an(t,r){t&1&&(u(0,"div",3),s(1,"translate")),t&2&&T("innerHTML",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.TITLE_EDIT"),G)}function ln(t,r){t&1&&(a(0,"div",14),u(1,"icons-component",36),a(2,"div",37),p(3),s(4,"translate"),l()()),t&2&&(n(3),_(c(4,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.COLUMN_NAME_REQUIRED")))}function rn(t,r){if(t&1&&(p(0),s(1,"translate"),s(2,"translate")),t&2){let e=r.item;g(" ",e.type==="concat"?c(1,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.CONCATENATE_GROUP"):c(2,3,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.OPERATION_GROUP")," ")}}function sn(t,r){t&1&&(a(0,"div",14),u(1,"icons-component",36),a(2,"div",37),p(3),s(4,"translate"),l()()),t&2&&(n(3),_(c(4,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.SEPARATOR_INVALID")))}function pn(t,r){if(t&1){let e=M();a(0,"div",23)(1,"div",38)(2,"input",39),s(3,"translate"),v("focus",function(){E(e),d();let o=K(12),m=d();return C(m.stylingService.toggleBlueColor(o))})("blur",function(){E(e),d();let o=K(12),m=d();return C(m.stylingService.toggleBlueColor(o))})("input",function(){E(e);let o=d(2);return C(o.buildFormula())}),l()(),h(4,sn,5,3,"div",14),l()}if(t&2){let e=d(2);n(),T("ngClass",x(5,Ct,e.otherSeparatorInvalid)),n(),T("placeholder",c(3,3,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.SEPARATOR_PLACE_HOLDER")),n(2),f(e.otherSeparatorInvalid?4:-1)}}function cn(t,r){t&1&&(a(0,"div",14),u(1,"icons-component",36),a(2,"div",37),p(3),s(4,"translate"),l()()),t&2&&(n(3),_(c(4,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.OPERATION_REQUIRED")))}function dn(t,r){if(t&1&&p(0),t&2){let e=r.item,i=d(2);g(" ",i.groupTranslate(e.group)||"General"," ")}}function mn(t,r){if(t&1&&(a(0,"div",40)(1,"label",41),u(2,"input",42)(3,"span",43),l(),a(4,"div"),p(5),l()()),t&2){let e=r.item,i=d(2);n(2),T("checked",i.fieldsInFormula.includes(e)),n(3),_(e.name)}}function Tn(t,r){t&1&&(a(0,"div",14),u(1,"icons-component",36),a(2,"div",37),p(3),s(4,"translate"),l()()),t&2&&(n(3),_(c(4,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.FIELD_REQUIRED")))}function _n(t,r){if(t&1&&(a(0,"div",32),p(1),l()),t&2){let e=d(2);n(),_(e.formulaValues)}}function un(t,r){t&1&&(a(0,"div",33),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"Completa los campos anteriores para ver la f\xF3rmula.")))}function En(t,r){if(t&1){let e=M();a(0,"div",1)(1,"div",2),h(2,on,2,3,"div",3)(3,an,2,3,"div",3),u(4,"div",4),s(5,"translate"),l(),a(6,"div",5)(7,"div",6)(8,"form",7)(9,"div",8)(10,"div",9)(11,"div",10,0),p(13),s(14,"translate"),l(),a(15,"div",11)(16,"div",12)(17,"input",13),s(18,"translate"),v("focus",function(){E(e);let o=K(12),m=d();return C(m.stylingService.toggleBlueColor(o))})("blur",function(){E(e);let o=K(12),m=d();return C(m.stylingService.toggleBlueColor(o))})("change",function(){E(e);let o=d();return C(o.buildFormula())}),l()(),h(19,ln,5,3,"div",14),l()(),a(20,"div",9)(21,"div",15)(22,"div",16,0),p(24),s(25,"translate"),l(),a(26,"div",17),u(27,"icons-component",18),s(28,"translate"),l()(),a(29,"div",19)(30,"div",20)(31,"div",12)(32,"ng-select",21),s(33,"translate"),v("change",function(){E(e);let o=d();return C(o.buildFormula())}),Y(34,rn,3,5,"ng-template",22),l()(),h(35,pn,5,7,"div",23),l(),h(36,cn,5,3,"div",14),l()(),a(37,"div",9)(38,"div",24)(39,"div",16,0),p(41),s(42,"translate"),l()(),a(43,"div",25),p(44),s(45,"translate"),l(),a(46,"div",11)(47,"div",26)(48,"ng-select",27),s(49,"translate"),v("change",function(){E(e);let o=d();return C(o.addField())}),Y(50,dn,1,1,"ng-template",22)(51,mn,6,2,"ng-template",28),l()(),h(52,Tn,5,3,"div",14),l()(),a(53,"div",29)(54,"div",30)(55,"div",31),p(56),s(57,"translate"),l(),a(58,"div"),p(59),s(60,"translate"),l()(),h(61,_n,2,1,"div",32)(62,un,3,3,"div",33),l()()()()(),a(63,"div",34)(64,"btn-component",35),s(65,"translate"),v("click",function(){E(e);let o=d();return C(o.cancelEdit())}),l(),a(66,"btn-component",35),s(67,"translate"),s(68,"translate"),v("click",function(){E(e);let o=d();return C(o.addColumn())}),l()()()}if(t&2){let e=d();n(2),f(e.params.isEditing?3:2),n(2),T("innerHTML",c(5,39,"ADMIN.TEMPLATES.TE
1MPLATE.COLUMN_WITH_FORMULA.SUB_TITLE"),G),n(4),T("formGroup",e.columnForm),n(3),T("ngClass",x(67,Mt,e.columnNameRequired)),n(2),g(" 1. ",c(14,41,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.COLUMN_NAME")," "),n(3),T("ngClass",x(69,Ct,e.columnNameRequired)),n(),T("placeholder",c(18,43,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.COLUMN_NAME_PLACE_HOLDER")),n(2),f(e.columnNameRequired?19:-1),n(3),T("ngClass",x(71,Mt,e.operationRequired)),n(2),g("2. ",c(25,45,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.FORMULA_TYPE")),n(3),T("tooltipText",c(28,47,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.FORMULA_TYPE_TOOLTIP"))("tooltipPosition","right"),n(4),T("ngClass",x(73,Ct,e.operationRequired)),n(),T("searchable",!0)("items",e.selectControllerService.operationsInColumn)("bindValue","id")("bindLabel","name")("groupBy","type")("order","desc")("placeholder",c(33,49,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.FORMULA_TYPE_PLACEHOLDER")),n(3),f(e.columnForm.value.operation===9?35:-1),n(),f(e.operationRequired?36:-1),n(3),T("ngClass",x(75,Mt,e.fieldRequired)),n(2),g("3. ",c(42,51,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.FIELDS")),n(3),_(c(45,53,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.FIELD_DETAILS")),n(3),T("ngClass",x(77,Ct,e.fieldRequired)),n(),T("searchable",!0)("items",e.params.templateFields)("bindValue","value")("bindLabel","name")("placeholder",c(49,55,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.FIELD_PLACE_PLACEHOLDER"))("multiple",!0)("closeOnSelect",!1),n(4),f(e.fieldRequired?52:-1),n(4),g(" ",c(57,57,"ADMIN.VALIDATIONS.NEW_VALIDATION_STEP_THREE.INFO_ALERT_TITLE")," "),n(3),_(c(60,59,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.SUB_TIT
1LE")),n(2),f(e.formulaValues?61:62),n(3),T("buttonObject",x(79,tn,c(65,61,"ADMIN.TEMPLATES.NEW_TEMPLATE.CANCEL"))),n(2),T("buttonObject",Me(81,nn,e.params.isEditing?c(68,65,"ADMIN.VALIDATIONS.SAVE_CHANGES"):c(67,63,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.CREATE_FORMULA"),e.loadingButton,e.columnForm.invalid||!e.formulaValues))}}function Cn(t,r){t&1&&u(0,"app-simple-form-skeleton")}var Fe=(()=>{class t{constructor(e,i,o,m,S,w,b){this.formBuilder=e,this.globalModalService=i,this.selectControllerService=o,this.stylingService=m,this.translate=S,this.alertService=w,this.uiStateService=b,this.cdr=I(k),this.loadingButton=!1,this.column={},this.fieldsInFormula=[],this.warningAlert={}}ngOnInit(){this.params=this.globalModalService.params,this.selectControllerService.setOperationInColumn(),this.selectControllerService.setSeparators(),this.params.isEditing&&this.getOperation(),this.createColumnForm(),this.params.isEditing&&this.fieldsInFormula.length>0&&this.buildFormula()}get columnNameRequired(){return this.columnForm.get("columnName").invalid&&this.columnForm.get("columnName").touched}get operationRequired(){return this.columnForm.get("operation").invalid&&this.columnForm.get("operation").touched}get fieldRequired(){return this.columnForm.get("field").invalid&&this.columnForm.get("field").touched}get otherSeparatorInvalid(){let e=this.columnForm.get("otherSeparator");return e.invalid&&e.touched}createColumnForm(){this.columnForm=this.formBuilder.group({columnName:[this.params.isEditing&&this.params.column.name,[z.required]],field:[this.params.isEditing&&this.fieldsInFormula?this.fieldsInFormula.map(e=>e.value):null,[z.required]],operation:[this.params.isEditing&&this.operation?this.operation.id:null,[z.required]],separator:[null],otherSeparator:[this.params.isEditing&&this.separator,[z.pattern(/^[^|;{}]*$/)]]})}getOperation(){let e=this.params.column.formula||this.params.column.field;if(!e||!e.includes("function:")){console.error("Formula no v\xE1lida:",e);return}this.operation=e.split("function:")[1].split("{")[0];let i=e.split("{")[1].split("}")[0].split("|");if(this.operation==="concat"&&i.pop(),this.operation==="concat"){let m=e.split("{")[1].split("}")[0].split("|");this.separator=m[m.length-1];let S=this.selectControllerService.separators.find(b=>b.value===this.separator),w=this.selectControllerService.operationsInColumn.find(b=>b.name.includes(this.separator)&&b.type==="concat");w||(w=this.selectControllerService.operationsInColumn.find(b=>b.id===9)),S||(S=this.selectControllerService.separators.find(b=>b.id===6)),this.operation=w}else{let m=this.selectControllerService.operationsInColumn.find(S=>S.tag===this.operation);m?this.operation=m:console.error("Operaci\xF3n no encontrada:",this.operation)}let o=this.params.templateFields.filter(m=>i.includes(m.value));o=o.filter((m,S,w)=>w.findIndex(b=>b.value===m.value)===S),this.fieldsInFormula=o}closeModal(){this.globalModalService.closeModal()}async addColumn(){this.loadingButton=!0,this.cdr.markForCheck(),this.column.name=this.columnForm.value.columnName,this.column.value=this.formulaValues,this.column.formula=this.formula,this.globalModalService.loadEventsFromModals$.emit(this.column),this.loadingButton=!1,this.cdr.markForCheck(),this.closeModal()}addField(){this.fieldsInFormula=[],this.columnForm.value.field.forEach(e=>{let i=this.params.templateFields.find(o=>o.value===e);i&&this.fieldsInFormula.push(i)}),this.buildFormula()}buildFormula(){let e=this.columnForm.value.operation,i=this.selectControllerService.operationsInColumn.find(S=>S.id===e);if(!i)return;let o;if(e===9)o=this.columnForm.value.otherSeparator;else switch(e){case 1:o="+";break;case 2:o="-";break;case 3:o="x";break;case 4:o=":";break;case 5:o="-";break;case 6:o="_";break;case 7:o=".";break;case 8:o=" ";break}let m=this.fieldsInFormula.map((S,w)=>{let b=this.fieldsInFormula.map(ne=>ne.value).join("|"),$;return e>=5?this.formula=`function:${i.tag}{${b}|${o}}`:this.formula=`function:${i.tag}{${b}}`,w===this.fieldsInFormula.length-1?$=S.name:$=`${S.name} ${o}`,$});this.formulaValues=m.join(" ")}showAdviser(e,i){let o,m;
1i==="operation"&&(o="ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.ADVISER.OPERATION.TITLE",m="ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.ADVISER.OPERATION.CONTENT"),i==="field"&&(o="ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.ADVISER.FIELD.TITLE",m="ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.ADVISER.FIELD.CONTENT");let S=e.getBoundingClientRect(),w={header:this.translate.instant(o),text:this.translate.instant(m),url:i==="operation"&&"../../../../../../assets/animations/templatesOperationAdviser.webm",positionX:S.x+S.width+32,positionY:S.y-24,showAdviser:!0,isInContent:!1,type:"help",typePreview:i==="operation"&&"video"};this.uiStateService.setAdviser(w)}async closeAdviser(){this.uiStateService.fadeOutHelper(),setTimeout(()=>{this.uiStateService.unsetAdviser()},300)}async cancelEdit(){this.loadingButton=!0,this.cdr.markForCheck(),this.columnForm.dirty?await this.showCancelEditWarning():this.closeModal(),this.loadingButton=!1,this.cdr.markForCheck()}async showCancelEditWarning(){this.warningAlert.title=this.translate.instant("MESSAGE_ALERT.AWAIT"),this.warningAlert.message=this.translate.instant("ALERT.UNSAVED_CHANGES"),this.warningAlert.confirmButton=this.translate.instant("ALERT.KEEP_EDITING"),this.warningAlert.cancelButton=this.translate.instant("ALERT.EXIT"),this.warningAlert.wrappedButtons=!0,await this.alertService.warning(this.warningAlert),this.alertService.confirmedAlert||this.closeModal()}groupTranslate(e){switch(e){case"expenseFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.EXPENSE_FIELDS");case"expenseCustomField":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.EXPENSE_CUSTOM_FIELDS");case"reportFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.REPORT_FIELDS");case"reportCustomFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.REPORT_CUSTOM_FIELDS");case"fundFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.FUND_FIELDS");case"userInformationFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.USER_INFORMATION_FIELDS");case"SII":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.SII");case"DIAN":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.DIAN");case"RUES":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.RUES");case"SAT":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.SAT");case"CFDI":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.CFDI");case"SUNAT":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.SUNAT");case"xmlSUNAT":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.xmlSUNAT");case"SRI":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.SRI");case"ARCA":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.ARCA");case"integration":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.integration");case"extraField":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.extraField");case"multiTaxes":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.multiTaxes")}}static{this.\u0275fac=function(i){return new(i||t)(A(ae),A(B),A(be),A(le),A(V),A(Ie),A(et))}}static{this.\u0275cmp=F({type:t,selectors:[["app-column-with-formula"]],standalone:!1,decls:2,vars:1,consts:[["title",""],[1,"flex","fd-c","gap-40"],[1,"flex","fd-c","gap-24"],[1,"header-1","blue",3,"innerHTML"],[1,"sub-header-1",3,"innerHTML"],[1,"block","w-full","p-0"],[1,"container-rg","pd-0"],[3,"formGroup"],[1,"v-form"],[1,"v-form-group","n-1-1"],[1,"label-3",3,"ngClass"],[1,"flex","fd-c","gap-4"],[1,"input-container","br-8","wp-50",3,"ngClass"],["formControlName","columnName","width","100%","type","text","required","",1,"input-text",3,"focus","blur","change","placeholder"],[1,"flex","ai-c","gap-4"],[1,"flex","fd-r","gap-8","label-3"],[3,"ngClass"],[1,"flex","ai-c","jc-c"],["rgTooltip","","type","infoTiny",1,"flex","ai-c","jc-c",3,"tooltipText","tooltipPosition"],[1,"flex","fd-c","gap-4","wp-100"],[1,"flex","gap-8","wp-100"],["formControlName","operation",3,"change","searchable","items","bindValue","bindLabel","groupBy","order","placeholder"],["ng-optgroup-tmp",""],[1,"flex","fd-c","gap-4","wp-50"],[1,"flex","fd-r","gap-8","label-3","mb-4"],[1,"sub-label-1","mb-8"],[1,"input-container","h-init","min-h-40","br-8","wp-100",3,"ngClass"],["groupBy","group","formControlName","field",3,"change","searchable","items","bindValue","bindLabel","placeholder","multiple","closeOnSelect"],["ng-option-tmp",""],[1,"flex","fd-c","gap-16","br-10","border-1-s-blue","bg-blue10","pd-24"],[1,"flex","fd-c","gap-8"],[1,"bold","text-blue"],[1,"bold","fs-i"],[1,"fs-i"],[1,"ta-r"],[3,"click","buttonObject"],["type","infoRedTiny"],[1,"small"],[1,"input-container","br-8",3,"ngClass"],["formControlName","otherSeparator","type","text",1,"input-text",3,"focus","blur","input","placeholder"],[1,"flex","ai-c","justify-start","gap-8"],["for","item.value",1,"checkSquare"],["type","checkbox","hidden","",3,"checked"],[1,"checkmark","h-18","text-blue"]],template:function(i,o){i&1&&h(0,En,69,85,"div",1)(1,Cn,1,0,"app-simple-form-skeleton"),i&2&&f(o.loading?1:0)},dependencies:[W,nt,Z,ee,me,ue,_e,Te,lt,at,ot,Le,j,O,dt,D],encapsulation:2,changeDetection:0})}}return t})();var hn=t=>({restrictive:t}),fn=()=>({class:"rindeButton-o-t-first",value:"EXPENSES.EDIT_EXPENSE.CANCEL"}),vn=t=>({class:"rindeButton-g",loading:t,value:"AUTH.MY_ACCOUNT.SAVE_CHANGES"});function Sn(t,r){t&1&&(a(0,"div",7),u(1,"icons-component",10),a(2,"div",11),p(3),s(4,"translate"),l()()),t&2&&(n(3),_(c(4,1,"ADMIN.TEMPLATES.TE
1MPLATE.REQUIRED_NAME_TOOLTIP")))}function gn(t,r){if(t&1){let e=M();a(0,"div",0)(1,"div",1)(2,"div",2),p(3),s(4,"translate"),l(),a(5,"div"),p(6),s(7,"translate"),l()(),a(8,"div",3)(9,"div",4),p(10),s(11,"translate"),l(),a(12,"div",5),u(13,"input",6),s(14,"translate"),l(),h(15,Sn,5,3,"div",7),l(),a(16,"div",8)(17,"btn-component",9),v("click",function(){E(e);let o=d();return C(o.cancelEdit())}),l(),a(18,"btn-component",9),v("click",function(){E(e);let o=d();return C(o.updateTemplateName())}),l()()()}if(t&2){let e=d();n(3),_(c(4,9,"ADMIN.TEMPLATES.TEMPLATES.EDIT_TEMPLATE_NAME_TITLE")),n(3),_(c(7,11,"ADMIN.TEMPLATES.TEMPLATES.EDIT_TEMPLATE_NAME_DESCRIPTION")),n(2),T("formGroup",e.editTemplateNameForm),n(2),_(c(11,13,"ADMIN.TEMPLATES.NEW_TEMPLATE.TEMPLATE_NAME")),n(2),T("ngClass",x(17,hn,e.editTemplateNameForm.invalid&&e.editTemplateNameForm.touched)),n(),T("placeholder",c(14,15,"ADMIN.TEMPLATES.NEW_TEMPLATE.PLACEHOLDER")),n(2),f(e.editTemplateNameForm.invalid&&e.editTemplateNameForm.touched?15:-1),n(2),T("buttonObject",y(19,fn)),n(),T("buttonObject",x(20,vn,e.loadingButton))}}var ft=(()=>{class t{constructor(){this.cdr=I(k),this.globalModalService=I(B),this.formBuilder=I(ae),this.templateService=I(q),this.snackService=I(Q),this.translate=I(V),this.loading=!1,this.loadingButton=!1,this.filterDto={limit:20},this.offset=0,this.append=!1}ngOnInit(){this.loading=!0,this.cdr.markForCheck(),this.params=this.globalModalService.params,this.createForm(),this.loading=!1,this.cdr.markForCheck()}createForm(){this.editTemplateNameForm=this.formBuilder.group({templateName:[this.params.templateName,[z.required]]})}cancelEdit(){this.globalModalService.closeModal()}async updateTemplateName(){if(this.editTemplateNameForm.invalid){this.editTemplateNameForm.markAllAsTouched();return}this.loadingButton=!0,this.cdr.markForCheck();let e=await this.templateService.updateTemplateName({templateName:this.editTemplateNameForm.value.templateName,templateId:this.params.templateId});if(this.loadingButton=!1,this.cdr.markForCheck(),this.globalModalService.closeModal(),e.ok){let i={type:"success",message:this.translate.instant("ALERT.SAVE_SUCCESS_EXPENSE")};this.snackService.showSnackNotification(i),this.params.from==="templates"?await this.templateService.getCompanyTemplates(this.offset,this.append,this.filterDto):await this.templateService.getTemplate(this.params.templateId)}else{let i={type:"error",message:this.translate.instant("ALERT.SAVE_ERROR_EXPENSE")};this.snackService.showSnackNotification(i)}}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-edit-template-name"]],decls:1,vars:1,consts:[[1,"flex","fd-c","gap-40"],[1,"flex","fd-c","gap-24"],[1,"bold","text-blue","bigger"],[1,"flex","fd-c","gap-8",3,"formGroup"],[1,"bold"],[1,"input-container","br-8","max-w-300",3,"ngClass"],["formControlName","templateName","type","text","required","",1,"input-text",3,"placeholder"],[1,"flex","ai-c","gap-4"],[1,"flex","jc-fe"],[3,"click","buttonObject"],["type","infoRedTiny"],[1,"small"]],template:function(i,o){i&1&&h(0,gn,19,22,"div",0),i&2&&f(o.loading?-1:0)},dependencies:[qe,W,H,Z,ee,me,ue,_e,Te,j,O,D],encapsulation:2,changeDetection:0})}}return t})();function xn(t,r){if(t&1&&(a(0,"div",11)(1,"div",12),p(2),l(),a(3,"div"),p(4),s(5,"translate"),l()()),t&2){let e=r.$implicit;n(2),_(e.name),n(2),_(c(5,2,"ADMIN.TEMPLATES.TEMPLATE.EXAMPLE"))}}function An(t,r){if(t&1&&(a(0,"div",0)(1,"div",1)(2,"div",2),p(3),s(4,"translate"),l(),a(5,"div"),p(6),s(7,"translate"),l()(),u(8,"div",3),a(9,"div",4),u(10,"icons-component",5)(11,"icons-component",6),l(),a(12,"div",7),p(13),s(14,"translate"),l(),a(15,"div",8)(16,"div",9),p(17),s(18,"translate"),l()(),a(19,"div",10),P(20,xn,6,4,"div",11,U),l(),a(22,"div",8)(23,"div",9),p(24),s(25,"translate"),l()()()),t&2){let e=d();n(3),Xe("",c(4,6,"APPROVER.DOWNLOAD_FILES_MODAL.PREVIEW")," ",e.templateService.template.name),n(3),_(c(7,8,"ADMIN.TEMPLATES.TEMPLATE.PDF_PREVIEW.REFERENTIAL_INFO")),n(7),_(c(14,10,"ADMIN.TEMPLATES.TEMPLATE.PDF_PREVIEW.TITLE")),n(4),_(c(18,12,"ADMIN.TEMPLATES.TEMPLATE.PDF_PREVIEW.DATA_HEADER")),n(3),N(e.params.columns),n(4),_(c(25,14,"ADMIN.TEMPLATES.TE
1MPLATE.PDF_PREVIEW.DATA_FOOTER"))}}var Ti=(()=>{class t{constructor(){this.cdr=I(k),this.templateService=I(q),this.globalModalService=I(B),this.loading=!1}ngOnInit(){this.loading=!0,this.cdr.markForCheck(),this.params=this.globalModalService.params,this.loading=!1,this.cdr.markForCheck()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-pdf-preview-modal"]],decls:1,vars:1,consts:[[1,"pd-48","flex","fd-c","gap-24"],[1,"flex","fd-c","gap-16"],[1,"text-blue","bold","big"],[1,"hrDivider"],[1,"flex","gap-24"],["type","building"],["type","pdfPreview"],[1,"bigger","bold"],[1,"flex","jc-c","ai-c","pd-28","border-1-s-gray30","br-10"],[1,"text-black30","bold"],[1,"grid","gap-24",2,"--wd","150px"],[1,"flex","fd-c","gap-8"],[1,"bold"]],template:function(i,o){i&1&&h(0,An,26,16,"div",0),i&2&&f(o.loading?-1:0)},dependencies:[H,O,D],encapsulation:2,changeDetection:0})}}return t})();var Mn=()=>({class:"rindeButton-o-t nM",value:"COMPANY.CONTADOR.CANCEL"}),In=(t,r)=>({class:"rindeButton-g nM",value:"COMPANY.CONTADOR.REPLICATE_ACTION",disabled:t,loading:r}),Ln=t=>({"bg-blue10":t}),Pt=t=>({$implicit:t}),bn=()=>({class:"rindeButton-g nM",value:"COMPANY.CONTADOR.UNDERSTOOD"}),ui=t=>({count:t});function Pn(t,r){if(t&1&&(a(0,"span"),p(1),l()),t&2){let e=d(2);n(),g("(",e.selectedCount,")")}}function Nn(t,r){t&1&&We(0)}function Fn(t,r){if(t&1){let e=M();a(0,"label",25)(1,"input",29),Ae("ngModelChange",function(o){let m=E(e).$implicit;return xe(m.selected,o)||(m.selected=o),C(o)}),v("change",function(){E(e);let o=d(4);return C(o.onCompanyToggle())}),l(),Y(2,Nn,1,0,"ng-container",30),a(3,"span",28),p(4),l()()}if(t&2){let e=r.$implicit;d(4);let i=K(5);T("ngClass",x(5,Ln,e.selected)),n(),ge("ngModel",e.selected),n(),T("ngTemplateOutlet",i)("ngTemplateOutletContext",x(7,Pt,e)),n(2),_(e.name)}}function yn(t,r){if(t&1){let e=M();a(0,"div",16)(1,"div",17)(2,"input",18),s(3,"translate"),Ae("ngModelChange",function(o){E(e);let m=d(3);return xe(m.searchTerm,o)||(m.searchTerm=o),C(o)}),l(),u(4,"icons-component",19),l(),a(5,"div",20)(6,"label",21)(7,"input",22),v("change",function(){E(e);let o=d(3);return C(o.toggleAll())}),l(),a(8,"span",23),p(9),s(10,"translate"),l()(),a(11,"div",24),P(12,Fn,5,9,"label",25,U),l()()(),a(14,"div",26),u(15,"icons-component",27),a(16,"span",28),p(17),s(18,"translate"),l()()}if(t&2){let e=d(3);n(2),ge("ngModel",e.searchTerm),T("placeholder",c(3,5,"COMPANY.CONTADOR.SEARCH")),n(5),T("checked",e.allSelected),n(2),_(c(10,7,"COMPANY.CONTADOR.SELECT_ALL")),n(3),N(e.filteredCompanies),n(5),_(c(18,9,"COMPANY.CONTADOR.REPLICATE_NAME_NOTE"))}}function Dn(t,r){t&1&&(a(0,"div",15),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"COMPANY.CONTADOR.NO_COMPANIES")))}function wn(t,r){if(t&1&&h(0,yn,19,11)(1,Dn,3,3,"div",15),t&2){let e=d(2);f(e.companies.length>0?0:1)}}function On(t,r){t&1&&(a(0,"div",12),u(1,"div",31),l())}function Rn(t,r){if(t&1){let e=M();a(0,"div",3),p(1),s(2,"translate"),l(),a(3,"div",4),p(4),s(5,"translate"),a(6,"span",5),p(7),l()(),a(8,"div",6),p(9),s(10,"translate"),l(),a(11,"div",7),u(12,"icons-component",8),a(13,"span",9),p(14),l()(),a(15,"div",10),p(16),s(17,"translate"),h(18,Pn,2,1,"span"),l(),a(19,"div",11),p(20),s(21,"translate"),l(),h(22,wn,2,1)(23,On,2,0,"div",12),a(24,"div",13)(25,"btn-component",14),v("click",function(){E(e);let o=d();return C(o.close())}),l(),a(26,"btn-component",14),v("click",function(){E(e);let o=d();return C(o.replicate())}),l()()}if(t&2){let e=d();n(),_(c(2,11,"COMPANY.CONTADOR.REPLICATE_TEMPLATE_TITLE")),n(3),g(" ",c(5,13,"COMPANY.CONTADOR.TEMPLATE_NAME_LABEL")," "),n(3),_(e.templateName),n(2),_(c(10,15,"COMPANY.CONTADOR.SOURCE_COMPANY")),n(5),_(e.companyService.userCompany.name),n(2),g(" ",c(17,17,"COMPANY.CONTADOR.TARGET_COMPANIES")," "),n(2),f(e.selectedCount>0?18:-1),n(2),_(c(21,19,"COMPANY.CONTADOR.TARGET_COMPANIES_HINT")),n(2),f(e.loading?23:22),n(3),T("buttonObject",y(21,Mn)),n(),T("buttonObject",J(22,In,e.selectedCount===0,e.replicating))}}function kn(t,r){t&1&&We(0)}function Bn(t,r){if(t&1&&(a(0,"div",36),Y(1,kn,1,0,"ng-container",30),a(2,"span",28),p(3),l()()),t&2){let e=r.$implicit;d(3);let i=K(5);n(),T("ngTemplateOutlet",i)("ngTemplateOutletContext",x(3,Pt,e)),n(2),_(e.name)}
1}function Un(t,r){if(t&1&&(a(0,"div",32)(1,"div",34),p(2),s(3,"translate"),l(),a(4,"div",35),P(5,Bn,4,5,"div",36,U),l()()),t&2){let e=d(2);n(2),g(" ",ce(3,1,"COMPANY.CONTADOR.RESULT_REPLICATED_IN",x(4,ui,e.replicatedCompanies.length))," "),n(3),N(e.replicatedCompanies)}}function Vn(t,r){t&1&&We(0)}function Gn(t,r){if(t&1&&(a(0,"span",38),p(1),s(2,"translate"),l()),t&2){let e=d().$implicit;n(),g("\xB7 ",c(2,1,e.reason))}}function Wn(t,r){if(t&1&&(a(0,"div",36),Y(1,Vn,1,0,"ng-container",30),a(2,"span",28),p(3),l(),h(4,Gn,3,3,"span",38),l()),t&2){let e=r.$implicit;d(3);let i=K(5);n(),T("ngTemplateOutlet",i)("ngTemplateOutletContext",x(4,Pt,e)),n(2),_(e.name),n(),f(e.reason?4:-1)}}function jn(t,r){if(t&1&&(a(0,"div",32)(1,"div",34),p(2),s(3,"translate"),l(),a(4,"div",37),P(5,Wn,5,6,"div",36,U),l()()),t&2){let e=d(2);n(2),g(" ",ce(3,1,"COMPANY.CONTADOR.RESULT_NOT_REPLICATED_IN",x(4,ui,e.notReplicatedCompanies.length))," "),n(3),N(e.notReplicatedCompanies)}}function Hn(t,r){if(t&1){let e=M();a(0,"div",3),p(1),s(2,"translate"),l(),a(3,"div",4),p(4),s(5,"translate"),a(6,"span",5),p(7),l()(),h(8,Un,7,6,"div",32),h(9,jn,7,6,"div",32),a(10,"div",33)(11,"btn-component",14),v("click",function(){E(e);let o=d();return C(o.close())}),l()()}if(t&2){let e=d();n(),_(c(2,6,"COMPANY.CONTADOR.RESULT_TITLE")),n(3),g(" ",c(5,8,"COMPANY.CONTADOR.TEMPLATE_NAME_LABEL")," "),n(3),_(e.templateName),n(),f(e.replicatedCompanies.length>0?8:-1),n(),f(e.notReplicatedCompanies.length>0?9:-1),n(2),T("buttonObject",y(10,bn))}}function $n(t,r){if(t&1&&u(0,"img",39),t&2){let e=d().$implicit;T("src",e.logo,wt)}}function Xn(t,r){if(t&1&&(a(0,"span",40),p(1),l()),t&2){let e=d().$implicit,i=d();n(),_(i.avatarInitial(e.name))}}function Yn(t,r){if(t&1&&h(0,$n,1,1,"img",39)(1,Xn,2,1,"span",40),t&2){let e=r.$implicit,i=d();f(i.hasLogo(e)?0:1)}}var Qn="mismo nombre",qn="https://ppstatic.rindegastos.com/expenses/uploads/logos/default.jpg",we=(()=>{class t{constructor(e,i,o,m,S){this.contadorService=e,this.companyService=i,this.globalModalService=o,this.snackService=m,this.translate=S,this.cdr=I(k),this.step="select",this.loading=!1,this.replicating=!1,this.companies=[],this.allSelected=!1,this.searchTerm="",this.replicatedCompanies=[],this.notReplicatedCompanies=[]}async ngOnInit(){this.templateId=this.globalModalService.params?.templateId,this.templateName=this.globalModalService.params?.templateName,this.loading=!0,this.cdr.markForCheck(),await this.loadHoldingCompanies(),this.loading=!1,this.cdr.markForCheck()}async loadHoldingCompanies(){let e=await this.contadorService.getHoldingCompanies();if(!e){this.companies=[];return}this.companies=e.filter(i=>i.id!==this.companyService.userCompany.id).map(i=>({id:i.id,name:i.name,logo:i.logo,selected:!1}))}get stepsConfig(){return{current:this.step==="select"?0:1,steps:[{name:this.translate.instant("COMPANY.CONTADOR.STEP_COMPANIES"),completed:this.step==="result"},{name:this.translate.instant("COMPANY.CONTADOR.STEP_RESULT"),completed:!1}]}}get filteredCompanies(){let e=this.searchTerm.trim().toLowerCase();return e?this.companies.filter(i=>i.name.toLowerCase().includes(e)):this.companies}toggleAll(){this.allSelected=!this.allSelected,this.filteredCompanies.forEach(e=>e.selected=this.allSelected)}onCompanyToggle(){let e=this.filteredCompanies;this.allSelected=e.length>0&&e.every(i=>i.selected)}get selectedCompanies(){return this.companies.filter(e=>e.selected)}get selectedCount(){return this.selectedCompanies.length}avatarInitial(e){return(e?.trim().charAt(0)||"?").toUpperCase()}hasLogo(e){return!!e.logo&&!e.logo.includes("default")&&e.logo!==qn}async replicate(){let e=this.selectedCompanies;if(e.length===0||this.replicating)return;this.replicating=!0;let i=await this.contadorService.replicateTemplate({templateId:this.templateId,targetCompanyIds:e.map(o=>o.id)});if(this.replicating=!1,this.cdr.markForCheck(),!i){this.close(),this.snackService.showSnackNotification({type:"error",customTitle:this.translate.instant("COMPANY.CONTADOR.TOAST_ERROR_TITLE"),message:this.translate.instant("COMPANY.CONTADOR.TOAST_ERROR_MSG")});return}this.buildResultLists(e,i.details),this.step="result",this.cdr.markForCheck()}buildResultLists(e,i){if(i?.length){let o=new Set(i.filter(S=>S.status).map(S=>S.companyId)),m=new Map(i.filter(S=>!S.status).map(S=>[S.companyId,S.error]));this.replicatedCompanies=e.filter(S=>o.has(S.id)),this.notReplicatedCompanies=e.filter(S=>m.has(S.id)).map(S=>Be(ke({},S),{reason:this.reasonKey(m.get(S.id))}))}else this.replicatedCompanies=e,this.notReplicatedCompanies=[]}reasonKey(e){return e?.includes(Qn)?"COMPANY.CONTADOR.REASON_DUPLICATE_NAME":"COMPANY.CONTADOR.REASON_ERROR"}close(){this.globalModalService.params=null,this.globalModalService.show=!1}static{this.\u0275fac=function(i){return new(i||t)(A(re),A(de),A(B),A(Q),A(V))}}static{this.\u0275cmp=F({type:t,selectors:[["app-replicate-template"]],standalone:!1,decls:6,vars:3,consts:[["companyAvatar",""],[1,"flex","fd-c"],[3,"steps"],[1,"mt-32","text-bigger","bold","text-blue"],[1,"mt-24","text-cross"],[1,"bold"],[1,"mt-32","text-cross","bold","text-gray70"],[1,"mt-16","flex","ai-c","gap-8","pd-12","bg-blue10","br-8"],["type","checkBlue"],[1,"text-cross","bold"],[1,"mt-40","text-cross","bold","text-gray70"],[1,"mt-8","text-cross","text-gray70"],[1,"flex","jc-c","pd-24"],[1,"mt-32","flex","jc-fe","ai-c","gap-12"],[3,"click","buttonObject"],[1,"pd-12","text-cross","text-gray70"],[1,"mt-16","flex","fd-c","gap-12","br-8","pd-16","bg-lightGray"],[1,"input-container","br-8","flex","ai-c","gap-8","px-12","bg-white"],["type","text",1,"input-text","text-cross",3,"ngModelChange","ngModel","placeholder"],["type","search"],[1,"flex","fd-c","br-8","bg-white","overflow-hidden"],[1,"flex","ai-c","gap-8","pointer","pd-12","border-b","border-black10"],["type","checkbox",3,"change","checked"],[1,"text-cross","bold","text-blue"],[1,"flex","fd-c","max-h-[240px]","overflow-y-auto"],[1,"flex","ai-c","gap-8","pointer","pd-12",3,"ngClass"],[1,"mt-32","flex","ai-c","gap-8","pd-12","bg-blue10","br-8"],["type","alertInfoBlue19"],[1,"text-cross"],["type","checkbox",3,"ngModelChange","change","ngModel"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"spinner-b"],[1,"mt-32","flex","fd-c","gap-8"],[1,"mt-32","flex","jc-fe"],[1,"text-cross","bold","text-gray70"],[1,"flex","fd-c","gap-8","pd-12","bg-green10","br-8"],[1,"flex","ai-c","gap-8"],[1,"flex","fd-c","gap-8","pd-12","bg-red10","br-8"],[1,"small","text-gray70"],["alt","",1,"w-24","h-24","br-50",3,"src"],[1,"w-24","h-24","br-50","flex","ai-c","jc-c","small","bold","text-white","bg-blue"]],template:function(i,o){i&1&&(a(0,"div",1),u(1,"app-steps",2),h(2,Rn,27,25),h(3,Hn,12,11),l(),Y(4,Yn,2,1,"ng-template",null,0,Ye)),i&2&&(n(),T("steps",o.stepsConfig),n(),f(o.step==="select"?2:-1),n(),f(o.step==="result"?3:-1))},dependencies:[W,Qe,Z,Xt,ee,it,ni,j,O,D],encapsulation:2,changeDetection:0})}}return t})();var Ei=(()=>{class t{constructor(e){this.translate=e,this.operationTranslations={concat:"ADMIN.TEMPLATES.TE
1MPLATE.COLUMN_WITH_FORMULA.OPERATIONS.CONCATENATE",sum:"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.OPERATIONS.ADD",substract:"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.OPERATIONS.SUBTRACT",multiply:"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.OPERATIONS.MULTIPLY",divide:"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.OPERATIONS.DIVISION"}}transform(e,i){if(!e||!e.startsWith("function:"))return e;let o=e.match(/^function:(\w+)\{([^}]+)\}/);if(!o)return e;let[,m,S]=o,w=S.split("|"),b;e.includes("function:concat")?b=w.slice(0,-1):b=w;let $;m==="concat"?$=w[w.length-1]:m==="sum"?$="+":m==="substract"?$="-":m==="multiply"?$="x":m==="divide"&&($=":");let ne=this.operationTranslations[m],Oe=ne?this.translate.instant(ne):m,ye=[...i?.[1]||[],...i?.[2]||[],...i?.[3]||[]],Se=b.map(pe=>{let Re=ye.find(gt=>gt.value===pe);return Re?Re.name:pe});return $?`${Se.join(` ${$} `)}`:`${Se.join(", ")}`}static{this.\u0275fac=function(i){return new(i||t)(A(V,16))}}static{this.\u0275pipe=Rt({name:"formulaDisplay",type:t,pure:!0,standalone:!1})}}return t})();var to=["columnRow"],io=(t,r,e)=>({class:"rindeButton-g tiny nM",value:t,loading:r,disabled:e}),no=t=>({"trans-rot-180":t}),oo=(t,r)=>({"preview-visible":t,"preview-hidden":r}),fi=t=>({value:"COMPANY.CONTADOR.REPLICATE_TEMPLATE_BTN",class:"rindeButton-b-s tiny nM",disabled:t}),ao=t=>
1({"opacity-50":t}),lo=(t,r,e,i)=>({"border-1-s-gray20-b":t,"br-10-t":r,"br-10-b":e,"br-10":i}),Nt=t=>({restrictive:t}),ro=t=>({"flex jc-fs ai-c":t}),so=()=>({title:"ADMIN.TEMPLATES.TEMPLATES.NO_COLUMNS_TITLE",subtitle:"ADMIN.TEMPLATES.TEMPLATES.NO_COLUMNS_DESCRIPTION"});function po(t,r){t&1&&(p(0),s(1,"translate")),t&2&&g(" ",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.EXCEL_TEMPLATE"),": ")}function co(t,r){t&1&&(p(0),s(1,"translate")),t&2&&g(" ",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.PDF_TEMPLATE"),": ")}function mo(t,r){if(t&1){let e=M();a(0,"span",19),s(1,"translate"),a(2,"btn-component",2),v("click",function(){E(e);let o=d(3);return C(o.contadorService.hasReplicableCompanies&&o.openReplicateTemplateModal())}),l()()}if(t&2){let e=d(3);T("matTooltip",c(1,3,"COMPANY.CONTADOR.NO_COMPANIES_TOOLTIP"))("matTooltipDisabled",e.contadorService.hasReplicableCompanies),n(2),T("buttonObject",x(5,fi,!e.contadorService.hasReplicableCompanies))}}function To(t,r){if(t&1&&(a(0,"th",27),p(1),l()),t&2){let e=r.$index,i=d(4);n(),g(" ",i.getColumnLetter(e)," ")}}function _o(t,r){if(t&1&&(a(0,"th",28),p(1),l()),t&2){let e=r.$implicit;n(),g(" ",e.controls.name.value," ")}}function uo(t,r){t&1&&(a(0,"td",29),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"ADMIN.TEMPLATES.TEMPLATE.EXAMPLE")))}function Eo(t,r){if(t&1&&(a(0,"div",24)(1,"table",26)(2,"thead")(3,"tr"),u(4,"th"),P(5,To,2,1,"th",27,U),l(),a(7,"tr")(8,"th",27),p(9,"1"),l(),P(10,_o,2,1,"th",28,U),l()(),a(12,"tbody")(13,"tr")(14,"td",27),p(15,"2"),l(),P(16,uo,3,3,"td",29,U),l()()()()),t&2){let e=d(3);n(5),N(e.columnsFormArray.controls),n(5),N(e.columnsFormArray.controls),n(6),N(e.columnsFormArray.controls)}}function Co(t,r){t&1&&(a(0,"div",25)(1,"div",30),p(2),s(3,"translate"),l()()),t&2&&(n(2),_(c(3,1,"Agrega columnas a tu plantilla para ver la vista previa.")))}function ho(t,r){if(t&1){let e=M();a(0,"div",8)(1,"div",16)(2,"div",17),p(3),s(4,"translate"),s(5,"translate"),l(),a(6,"div",18),h(7,mo,3,7,"span",19),a(8,"div",20),v("click",function(){E(e);let o=d(2);return C(o.togglePreview())}),a(9,"div",21),p(10),s(11,"translate"),l(),u(12,"icons-component",22),l()()(),a(13,"div",23),h(14,Eo,18,0,"div",24)(15,Co,4,3,"div",25),l()()}if(t&2){let e=d(2);n(3),Xe("",c(4,7,"ADMIN.TEMPLATES.TEMPLATE.PREVIEW"),": ",c(5,9,"ADMIN.TEMPLATES.TEMPLATE.EXCEL_TEMPLATE")),n(4),f(e.contadorService.isContador?7:-1),n(3),_(c(11,11,e.showPreview?"ADMIN.TEMPLATES.TEMPLATE.HIDE_PREVIEW":"ADMIN.TEMPLATES.TEMPLATE.SEE_PREVIEW")),n(2),T("ngClass",x(13,no,e.showPreview)),n(),T("ngClass",J(15,oo,e.showPreview,!e.showPreview)),n(),f(e.columnsFormArray.length>0?14:15)}}function fo(t,r){}function vo(t,r){if(t&1&&Y(0,fo,0,0,"ng-template",9),t&2){let e=d(2);T("ngTemplateOutlet",e.templatePDF)}}function So(t,r){if(t&1&&(a(0,"div",11),u(1,"app-dynamic-alert",31),l()),t&2){let e=d(2);n(),T("errors",e.getInvalidFields())}}function go(t,r){if(t&1){let e=M();a(0,"span",19),s(1,"translate"),a(2,"btn-component",2),v("click",function(){E(e);let o=d(3);return C(o.contadorService.hasReplicableCompanies&&o.openReplicateTemplateModal())}),l()()}if(t&2){let e=d(3);T("matTooltip",c(1,3,"COMPANY.CONTADOR.NO_COMPANIES_TOOLTIP"))("matTooltipDisabled",e.contadorService.hasReplicableCompanies),n(2),T("buttonObject",x(5,fi,!e.contadorService.hasReplicableCompanies))}}function xo(t,r){if(t&1){let e=M();a(0,"div",13)(1,"div",32),h(2,go,3,7,"span",19),a(3,"div",33),v("click",function(){E(e);let o=d(2);return C(o.openPdfPreview())}),a(4,"div",34),p(5),s(6,"translate"),l(),u(7,"icons-component",35),l()()()}if(t&2){let e=d(2);n(2),f(e.contadorService.isContador?2:-1),n(),T("ngClass",x(5,ao,e.columnsFormArray.length===0)),n(2),_(c(6,3,"ADMIN.TEMPLATES.TEMPLATE.SEE_PREVIEW"))}}function Ao(t,r){t&1&&(u(0,"icons-component",41),s(1,"translate")),t&2&&T("tooltipText",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_TYPE_TOOLTIP_EXCEL"))}function Mo(t,r){t&1&&(u(0,"icons-component",41),s(1,"translate")),t&2&&T("tooltipText",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_TYPE_TOOLTIP_PDF"))}function Io(t,r){if(t&1){let e=M();a(0,"div",50)(1,"ng-select",59),s(2,"translate"),s(3,"translate"),v("change",function(o){E(e);let m=d().$index,S=d(3);return C(S.onFieldChange(o,m))}),l()()}if(t&2){let e=d().$implicit,i=d(3);T("ngClass",x(9,Nt,e.controls.fieldType.invalid&&e.controls.fieldType.touched)),n(),T("placeholder",c(2,5,"ADMIN.EXPORTS.SELECT"))("items",i.fieldTypesOptions)("searchable",!0)("notFoundText",c(3,7,"No se encontraron resultados"))}}function Lo(t,r){t&1&&(a(0,"div",53),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"EXPENSES.EDIT_MULTIPLE.EXPENSE")))}function bo(t,r){t&1&&(a(0,"div",53),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"ADMIN.TEMPLATES.TE
1MPLATE.COLUMN_WITH_FORMULA.FORMULA_FIELD")))}function Po(t,r){t&1&&(a(0,"div",53),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"ADMIN.TEMPLATES.TEMPLATE.FIXED_FIELD")))}function No(t,r){if(t&1&&p(0),t&2){let e=r.item,i=d(5);g(" ",i.groupTranslate(e.group)," ")}}function Fo(t,r){t&1&&(u(0,"icons-component",41),s(1,"translate")),t&2&&T("tooltipText",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.URL_FIELD_TOOLTIP"))}function yo(t,r){t&1&&(u(0,"icons-component",41),s(1,"translate")),t&2&&T("tooltipText",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.TAXES_FIELD_TOOLTIP"))}function Do(t,r){if(t&1&&h(0,Fo,2,3,"icons-component",41)(1,yo,2,3,"icons-component",41),t&2){let e=d().item;f(e.value==="exp:urlFile"||e.value==="rep:url"||e.value==="rep:fund:urlFile"||e.value==="rep:viatico:urlFile"?0:e.value==="exp:xmlsunat:taxes"||e.value==="exp:cfdi:impuestosSAT"?1:-1)}}function wo(t,r){t&1&&(u(0,"icons-component",41),s(1,"translate")),t&2&&T("tooltipText",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.URL_FIELD_TOOLTIP"))}function Oo(t,r){t&1&&(u(0,"icons-component",41),s(1,"translate")),t&2&&T("tooltipText",c(1,1,"ADMIN.TEMPLATES.TEMPLATE.TAXES_FIELD_TOOLTIP_PDF"))}function Ro(t,r){if(t&1&&h(0,wo,2,3,"icons-component",41)(1,Oo,2,3,"icons-component",41),t&2){let e=d().item;f(e.value==="exp:urlFile"||e.value==="rep:url"||e.value==="rep:fund:urlFile"||e.value==="rep:viatico:urlFile"?0:e.value==="exp:xmlsunat:taxes"||e.value==="exp:cfdi:impuestosSAT"?1:-1)}}function ko(t,r){if(t&1&&(a(0,"div",63)(1,"span"),p(2),l(),h(3,Do,2,1)(4,Ro,2,1),l()),t&2){let e=r.item,i=d(5);n(2),_(e.name),n(),f(i.templateService.template.fileType===i.TemplateType.EXCEL?3:4)}}function Bo(t,r){if(t&1){let e=M();a(0,"div",50)(1,"ng-select",60),s(2,"translate"),s(3,"translate"),v("change",function(o){E(e);let m=d().$implicit,S=d(3);return C(S.fillColumnName(m,o))}),Y(4,No,1,1,"ng-template",61)(5,ko,5,2,"ng-template",62),l()()}if(t&2){let e=d().$implicit,i=d(3);T("ngClass",x(10,Nt,e.controls.field.invalid&&e.controls.field.touched)),n(),T("placeholder",c(2,6,"ADMIN.VALIDATIONS.CONDITIONS.SELECT_FIELD"))("items",i.localTemplateFields[e.controls.fieldType.value])("groupBy","group")("searchable",!0)("notFoundText",c(3,8,"No se encontraron resultados"))}}function Uo(t,r){if(t&1){let e=M();a(0,"div",64)(1,"input",66),s(2,"translate"),v("focus",function(){E(e);let o=d(5);return C(o.stylingService.toggleBlueColor(o.name))})("blur",function(){E(e);let o=d(5);return C(o.stylingService.toggleBlueColor(o.name))}),l()()}t&2&&(n(),T("placeholder",c(2,1,"ADMIN.TEMPLATES.TEMPLATE.FIXED_FIELD_PLACEHOLDER")))}function Vo(t,r){if(t&1){let e=M();a(0,"div",65),p(1),s(2,"formulaDisplay"),a(3,"icons-component",67),v("click",function(){E(e);let o=d(2).$index,m=d(3);return C(m.editColumnWithFormula(o))}),l()()}if(t&2){let e=d(2).$implicit,i=d(3);n(),g(" ",ce(2,1,e.value.field,i.localTemplateFields)," ")}}function Go(t,r){if(t&1&&(h(0,Uo,3,3,"div",64),h(1,Vo,4,4,"div",65)),t&2){let e=d().$implicit,i=d(3);f(e.controls.columnType.value===i.TemplateColumnTypeEnum.FIXED?0:-1),n(),f(e.controls.columnType.value===i.TemplateColumnTypeEnum.FORMULA?1:-1)}}function Wo(t,r){t&1&&(a(0,"div",68),u(1,"div",69)(2,"div",70),l())}function jo(t,r){if(t&1&&(a(0,"div",36)(1,"div",71),u(2,"icons-component",72),l(),a(3,"div",73)(4,"div",74)(5,"div",75),p(6),l()(),a(7,"div",74)(8,"div",76),p(9),s(10,"translate"),s(11,"translate"),l()(),a(12,"div",74)(13,"div",77),p(14),s(15,"formulaDisplay"),l()(),a(16,"div",78),u(17,"icons-component",79),l()()()),t&2){let e=d().$implicit,i=d(3);n(4),De("width",i.getColumnWidths().name,"px"),n(2),g(" ",e.controls.name.value," "),n(),De("width",i.getColumnWidths().type,"px"),n(2),g(" ",e.controls.fieldType.value===i.TemplateFieldType.FIXED?c(10,11,"ADMIN.TEMPLATES.TEMPLATE.FIXED_FIELD"):e.controls.fieldType.value===i.TemplateFieldType.FORMULA?c(11,13,"ADMIN.TEMPLATES.TEMPLATE.COLUMN_WITH_FORMULA.FORMULA_FIELD"):i.getFieldTypeLabel(e.controls.fieldType.value)," "),n(3),De("width",i.getColumnWidths().field,"px"),n(2),g(" ",e.controls.fieldType.value===i.TemplateFieldType.FORMULA?ce(15,15,e.value.field,i.localTemplateFields):"Values"," "),n(2),De("width",i.getColumnWidths().action,"px")}}function Ho(t,r){if(t&1){let e=M();a(0,"div",45,0)(2,"div",46)(3,"div",47),p(4),l()(),a(5,"div",48)(6,"div",49)(7,"div",50)(8,"input",51),s(9,"translate"),v("focus",function(){E(e);let o=d(3);return C(o.stylingService.toggleBlueColor(o.name))})("blur",function(){E(e);let o=d(3);return C(o.stylingService.toggleBlueColor(o.name))}),l()()(),a(10,"div",52),h(11,Io,4,11,"div",50),h(12,Lo,3,3,"div",53),h(13,bo,3,3,"div",53),h(14,Po,3,3,"div",53),l(),a(15,"div",54),h(16,Bo,6,12,"div",50)(17,Go,2,2),l(),a(18,"div",55)(19,"icons-component",56),s(20,"translate"),v("click",function(){let o=E(e).$index,m=d(3);return C(m.deleteColumn(o))}
1),l()()(),Y(21,Wo,3,0,"div",57)(22,jo,18,18,"div",58),l()}if(t&2){let e=r.$implicit,i=r.$index,o=d(3);T("cdkDragDisabled",e.controls.field.value==="exp:urlFile"||e.controls.field.value==="rep:fund:urlFile"||e.controls.field.value==="rep:url"||e.controls.field.value==="rep:viatico:urlFile")("cdkDropListData",i)("formGroupName",i),n(4),g(" ",o.templateService.template.fileType===o.TemplateType.EXCEL?o.getColumnLetter(i):i+1," "),n(),T("ngClass",Vt(20,lo,i===o.columnsFormArray.length-1,i===0&&o.columnsFormArray.length>1,i===o.columnsFormArray.length-1&&o.columnsFormArray.length>1,o.columnsFormArray.length===1)),n(2),T("ngClass",x(25,Nt,e.controls.name.invalid&&e.controls.name.touched)),n(),T("placeholder",c(9,16,"ADMIN.TEMPLATES.TEMPLATE.FIELDS.COLUMN_NAME"))("value",e.name),n(2),T("ngClass",x(27,ro,e.controls.columnType.value===o.TemplateColumnTypeEnum.FIXED)),n(),f(e.controls.columnType.value===o.TemplateColumnTypeEnum.NORMAL&&o.templateService.template.fileType===o.TemplateType.EXCEL?11:-1),n(),f(e.controls.columnType.value===o.TemplateColumnTypeEnum.NORMAL&&o.templateService.template.fileType===o.TemplateType.PDF?12:-1),n(),f(e.controls.columnType.value===o.TemplateColumnTypeEnum.FORMULA?13:-1),n(),f(e.controls.columnType.value===o.TemplateColumnTypeEnum.FIXED?14:-1),n(2),f(e.controls.columnType.value===o.TemplateColumnTypeEnum.NORMAL?16:17),n(3),T("id","admin-templates-template-button-deleteColumn-"+i)("tooltipText",c(20,18,"MESSAGE_ALERT.DELETE_COLUMN.ACTION"))}}function $o(t,r){if(t&1){let e=M();a(0,"div",36),u(1,"div",37),a(2,"div",38)(3,"div",39),p(4),s(5,"translate"),l(),a(6,"div",40),p(7),s(8,"translate"),h(9,Ao,2,3,"icons-component",41)(10,Mo,2,3,"icons-component",41),l(),a(11,"div",42),p(12),s(13,"translate"),l(),u(14,"div",43),l()(),a(15,"div",44),v("cdkDropListDropped",function(o){E(e);let m=d(2);return C(m.drop(o))}),P(16,Ho,23,29,"div",45,U),l()}if(t&2){let e=d(2);n(4),_(c(5,4,"ADMIN.TEMPLATES.TEMPLATE.FIELDS.COLUMN_NAME")),n(3),g(" ",c(8,6,"ADMIN.TEMPLATES.TEMPLATE.FIELDS.FIELD_TYPE")," "),n(2),f(e.templateService.template.fileType===e.TemplateType.EXCEL?9:10),n(3),_(c(13,8,"ADMIN.TEMPLATES.TEMPLATE.FIELDS.SELECT_A_FIELD_PLACE_HOLDER")),n(4),N(e.columnsFormArray.controls)}}function Xo(t,r){if(t&1&&(a(0,"div",14)(1,"app-empty-views",80),u(2,"icons-component",81),l(),u(3,"app-button-select",15),l()),t&2){let e=d(2);n(),T("emptyViewObject",y(5,so)),n(),T("type","noTemplates"),n(),T("mainClick",e.addNewColumn)("customClass","mx-auto")("options",e.columnOptions)}}function Yo(t,r){if(t&1&&u(0,"app-button-select",15),t&2){let e=d(2);T("mainClick",e.addNewColumn)("customClass","mg-40-l mg-16-t")("options",e.columnOptions)}}function Qo(t,r){if(t&1){let e=M();a(0,"div",3)(1,"div",4),h(2,po,2,3),h(3,co,2,3),a(4,"app-editable-info",5),v("newValue",function(o){E(e);let m=d();return C(m.updateTemplateName(o))}),l()(),a(5,"div",6)(6,"span"),p(7),s(8,"translate"),l()()(),a(9,"div",7),h(10,ho,16,18,"div",8)(11,vo,1,1,null,9),a(12,"div",10),h(13,So,2,1,"div",11),a(14,"div",12),h(15,xo,8,7,"div",13),h(16,$o,18,10)(17,Xo,4,6,"div",14),l(),h(18,Yo,1,3,"app-button-select",15),l()()}if(t&2){let e=d();n(2),f(e.templateService.template.fileType===e.TemplateType.EXCEL?2:-1),n(),f(e.templateService.template.fileType===e.TemplateType.PDF?3:-1),n(),Ut("bigger bold text-blue"),T("currentValue",e.templateService.template==null?null:e.templateService.template.name)("inputType",e.inputTypeEnum.TEXT),n(3),_(c(8,13,"ADMIN.TEMPLATES.TEMPLATE.DESCRIPTION")),n(3),f(e.templateService.template.fileType===e.TemplateType.EXCEL?10:11),n(2),T("formGroup",e.columnsForm),n(),f(e.columnsForm.controls.columns.invalid&&e.columnsForm.controls.columns.touched?13:-1),n(2),f(e.templateService.template.fileType===e.TemplateType.PDF?15:-1),n(),f(e.columnsFormArray.length>0?16:17),n(2),f(e.columnsFormArray.length>0?18:-1)}}function qo(t,r){t&1&&u(0,"app-skeleton-table")}var vi=(()=>
1{class t{constructor(e,i,o,m,S,w,b,$,ne,Oe,ye,Se){this.formBuilder=e,this.globalModalService=i,this.templateService=o,this.activatedRoute=m,this.router=S,this.alertService=w,this.translate=b,this.selectControllerService=$,this.stylingService=ne,this.snackService=Oe,this.companyService=ye,this.contadorService=Se,this.cdr=I(k),this.columns=[],this.originalColumnsData=null,this.loading=!1,this.loadingButton=!1,this.loadingRedirect=!1,this.enableSaveButton=yt(!1),this.TemplateType=R,this.TemplateFieldType=L,this.templateFieldType=L.EXPENSE,this.localTemplateFields={0:[],[L.EXPENSE]:[],[L.REPORT]:[],[L.FUND]:[],[L.VIATICO]:[]},this.TemplateOptionsEnum=fe,this.TemplateColumnTypeEnum=Ee,this.warningAlert={},this.showPreview=!0,this.filterDto={limit:20},this.offset=0,this.append=!1,this.optionsConfig={x:0,y:0,show:!1},this.isHovered=!1,this.options=[{id:fe.EDIT_TEMPLATE_NAME,label:"ADMIN.TEMPLATES.TEMPLATES.EDIT_TEMPLATE_NAME",visible:!0,action:()=>this.openEditTemplateNameModal()},{id:fe.DELETE_TEMPLATE,label:"ADMIN.TEMPLATES.TEMPLATES.DELETE_TEMPLATE",visible:!0,isOrange:!0,action:()=>this.openDeleteTemplateModal()}],this.columnOptions=[{id:fe.EDIT_TEMPLATE_NAME,label:"BUTTONS.ADD_COLUMN_WITH_FORMULA",visible:!0,action:()=>this.createColumnWithFormula(),info:"ADMIN.TEMPLATES.TEMPLATE.TOOLTIP_FORMULA"},{id:fe.DELETE_TEMPLATE,label:"BUTTONS.ADD_FIXED_COLUMN",visible:!0,action:()=>this.addFixedColumn(),info:"ADMIN.TEMPLATES.TEMPLATE.TOOLTIP_FIXED_COLUMN"}],this.fieldTypesOptions=[],this.columnsForm=this.formBuilder.group({columns:this.formBuilder.array([])}),this.checkFieldsRequired=!1,this.addNewColumn=()=>{let pe=this.createColumnForm(this.columnsFormArray.length);this.columnsFormArray.push(pe),this.moveUrlFieldsToLastPosition(),setTimeout(()=>this.checkForChanges(),0)},this.cachedWidths={},m.params.subscribe(pe=>{this.templateId=pe.id,this.cdr.markForCheck()}),this.navigation=this.router.getCurrentNavigation()}async ngOnInit(){this.loading=!0,this.cdr.markForCheck(),await this.getTemplate(),await this.setTemplateFields(),this.setColumnsForm(),this.evaluateFieldsTypeOptions(),this.loading=!1,this.cdr.markForCheck(),this.verifyFiscalOptions(this.selectControllerService.templateFieldsForModal),this.updateTemplateServiceState(!1),this.contadorService.isContador&&(await this.contadorService.loadReplicableCompanies(),this.options.unshift({id:"replicateTemplate",label:"COMPANY.CONTADOR.REPLICATE_TEMPLATE_BTN",visible:!0,disabled:!this.contadorService.hasReplicableCompanies,tooltip:"COMPANY.CONTADOR.NO_COMPANIES_TOOLTIP",action:()=>this.openReplicateTemplateModal()})),this.showEditWarningIfContador(),this.cdr.markForCheck()}async ngOnChanges(){}get inputTypeEnum(){return oi}get columnsFormArray(){return this.columnsForm.controls.columns}getFieldTypeLabel(e){return this.fieldTypesOptions.find(i=>i.id===e)?.label}getFieldLabel(e){if(e)return this.localTemplateFields[this.getFieldType(e)].find(i=>i.value===e)?.name}setColumnsForm(){this.columns.forEach((e,i)=>{this.columnsFormArray.push(this.createColumnForm(i,this.getFieldType(e.value)===L.FORMULA?Ee.FORMULA:this.getFieldType(e.value)===L.FIXED?Ee.FIXED:Ee.NORMAL,e.name,this.getFieldType(e.value),e.value))}),this.originalColumnsData=JSON.parse(JSON.stringify(this.columnsForm.value)),this.columnsForm&&this.columnsForm.valueChanges.subscribe(()=>{this.checkForChanges(),this.cdr.markForCheck()})}createColumnForm(e,i,o,m,S,w){return this.formBuilder.group({name:[o,[z.required]],fieldType:[this.templateService.template.fileType===R.EXCEL?m||0:L.EXPENSE,[z.required]],field:[S,[z.required]],index:[e],columnType:[i||Ee.NORMAL],formula:[w]})}getFieldType(e){return e==null||typeof e!="string"?0:this.localTemplateFields[L.EXPENSE].find(b=>b.value===e)?L.EXPENSE:this.localTemplateFields[L.REPORT].find(b=>b.value===e)?L.REPORT:this.localTemplateFields[L.FUND].find(b=>b.value===e)?L.FUND:this.localTemplateFields[L.VIATICO].find(b=>b.value===e)?L.VIATICO:typeof e=="string"&&e.includes("function:")?L.FORMULA:0}async setTemplateFields(){let e;if(this.templateService.template.fileType===R.EXCEL?e=this.templateFieldType:this.templateService.template.fileType===R.PDF&&(e=L.EXPENSE),this.localTemplateFields[L.EXPENSE].length===0&&this.localTemplateFields[L.REPORT].length===0){let i=await this.templateService.getTemplateFields(e);this.localTemplateFields[0]=i,this.localTemplateFields[L.EXPENSE]=this.selectControllerService.filterTemplateFields(L.EXPENSE,i),this.localTemplateFields[L.REPORT]=this.selectControllerService.filterTemplateFields(L.REPORT,i),this.localTemplateFields[L.FUND]=this.selectControllerService.filterTemplateFields(L.FUND,i),this.localTemplateFields[L.VIATICO]=this.selectControllerService.filterTemplateFields(L.VIATICO,i)}this.verifyFiscalOptions(this.localTemplateFields[e])}groupTranslate(e){switch(e){case"expenseFields":return this.translate.instant("ADMIN.TEMPLATES.TE
1MPLATE.GROUP_FIELDS.EXPENSE_FIELDS");case"expenseCustomField":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.EXPENSE_CUSTOM_FIELDS");case"reportFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.REPORT_FIELDS");case"reportCustomFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.REPORT_CUSTOM_FIELDS");case"fundFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.FUND_FIELDS");case"viaticoFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.VIATICO_FIELDS");case"userInformationFields":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.USER_INFORMATION_FIELDS");case"SII":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.SII");case"DIAN":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.DIAN");case"RUES":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.RUES");case"SAT":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.SAT");case"CFDI":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.CFDI");case"SUNAT":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.SUNAT");case"xmlSUNAT":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.xmlSUNAT");case"SRI":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.SRI");case"ARCA":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.ARCA");case"integration":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.integration");case"extraField":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.extraField");case"multiTaxes":return this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.GROUP_FIELDS.multiTaxes")}}verifyFiscalOptions(e){this.templateFieldType!==2&&e.forEach(i=>{i.value.toLowerCase().includes("cfdi")?i.groupName="CFDI \u{1F1F2}\u{1F1FD}":i.value.toLowerCase().includes("sat")?i.groupName="SAT \u{1F1F2}\u{1F1FD}":i.value.toLowerCase().includes("sii")?i.groupName="SII \u{1F1E8}\u{1F1F1}":i.value.toLowerCase().includes("arca")?i.groupName="ARCA \u{1F1E6}\u{1F1F7}":i.value.toLowerCase().includes("sunat")?i.groupName="SUNAT \u{1F1F5}\u{1F1EA}":i.value.toLowerCase().includes("dian")?i.groupName="Dian \u{1F1E8}\u{1F1F4}":i.value.toLowerCase().includes("rues")?i.groupName="RUES \u{1F1E8}\u{1F1F4}":i.value.toLowerCase().includes("multitaxes")?i.groupName="Campos de impuesto":i.value.toLowerCase().includes("sri")?i.groupName="SRI \u{1F1EA}\u{1F1E8}":i.groupName="General"})}async getTemplate(){await this.templateService.getTemplate(this.templateId),this.setColumns()}setColumns(){let e=this.templateService.template.headers.split(";"),i=this.templateService.template.values.split(";");this.columns=e.map((o,m)=>({name:o,value:i[m],index:m}))}getColumnLetter(e){let i="";for(;e>-1;)i=String.fromCharCode(65+e%26)+i,e=Math.floor(e/26)-1;return i}async selectFieldsType(e){this.templateFieldType=e,await this.setTemplateFields()}createColumnWithFormula(){this.templateService.template.fileType===R.EXCEL?this.globalModalService.params={type:"newColumnWithFormula",templateFields:[...this.localTemplateFields[L.EXPENSE],...this.localTemplateFields[L.REPORT],...this.localTemplateFields[L.FUND]],styles:"modal-background",component:Fe}:this.globalModalService.params={type:"newColumnWithFormula",templateFields:[...this.localTemplateFields[L.EXPENSE]],styles:"modal-background",component:Fe},this.globalModalService.showModal(),this.loadActionsFromModals$&&this.loadActionsFromModals$.unsubscribe(),this.loadActionsFromModals$=this.globalModalService.loadEventsFromModals$.subscribe(async e=>{this.addColumnWithFormula(e),this.cdr.markForCheck()})}editColumnWithFormula(e){this.templateService.template.fileType===R.EXCEL?this.globalModalService.params={type:"editColumnWithFormula",column:this.columnsFormArray.controls[e].value,columnIndex:e,templateFields:[...this.localTemplateFields[L.EXPENSE],...this.localTemplateFields[L.REPORT],...this.localTemplateFields[L.FUND]],isEditing:!0,styles:"modal-background",component:Fe}:this.globalModalService.params={type:"editColumnWithFormula",column:this.columnsFormArray.controls[e].value,columnIndex:e,templateFields:[...this.localTemplateFields[L.EXPENSE]],isEditing:!0,styles:"modal-background",component:Fe},this.globalModalService.showModal(),this.loadActionsFromModals$&&this.loadActionsFromModals$.unsubscribe(),this.loadActionsFromModals$=this.globalModalService.loadEventsFromModals$.subscribe(async i=>{this.updateColumnWithFormula(e,i),this.cdr.markForCheck()})}async drop(e){e.previousIndex!==e.currentIndex&&(Ke(this.columnsFormArray.controls,e.previousIndex,e.currentIndex),this.enableSaveButton.set(!0),this.updateTemplateServiceState(!0),this.moveUrlFieldsToLastPosition())}resetColumnsForm(){this.columnsForm.reset()}async addColumn(e){this.loadingButton=!0,this.cdr.markForCheck();let i=this.columns.length,o={};e?o={name:e.name,value:e.value,index:i}:o={name:this.columnsForm.value.columnName,value:this.columnsForm.value.field.value,index:i},this.columns.push(o),this.resetColumnsForm(),this.loadingButton=!1,this.cdr.markForCheck()}async deleteColumn(e){this.columnsFormArray.removeAt(e),setTimeout(()=>this.checkForChanges(),0)}addFixedColumn(){let e=this.createColumnForm(this.columnsFormArray.length,Ee.FIXED);this.columnsFormArray.push(e),this.moveUrlFieldsToLastPosition(),setTimeout(()=>this.checkForChanges(),0)}addColumnWithFormula(e){let i=this.createColumnForm(this.columnsFormArray.length,Ee.FORMULA,e.name,e.fieldType,e.value,e.formula);this.columnsFormArray.push(i),this.moveUrlFieldsToLastPosition(),setTimeout(()=>this.checkForChanges(),0)}updateColumnWithFormula(e,i){this.columnsFormArray.controls[e].patchValue({name:i.name,field:i.formula,formula:i.formula}),setTimeout(()=>this.checkForChanges(),0)}async updateTemplate(){if(this.columnsFormArray.length===0||this.columnsFormArray.controls.some(S=>["",null,void 0].includes(S.value.name))){this.columnsFormArray.controls.forEac
1h(S=>{S.get("name").markAsTouched()});return}if(this.contadorService.isContador&&!this.isNewTemplateFlow&&!await this.alertService.warning({title:this.translate.instant("COMPANY.CONTADOR.WARNING_SAVE_TEMPLATE_TITLE"),message:this.translate.instant("COMPANY.CONTADOR.WARNING_SAVE_TEMPLATE_MSG"),confirmButton:this.translate.instant("COMPANY.CONTADOR.CANCEL"),cancelButton:this.translate.instant("COMPANY.CONTADOR.SAVE_CHANGES")}))return;let e=[],i=[];this.columnsFormArray.controls.forEach(S=>{e.push(S.value.name),i.push(S.value.formula?S.value.formula:S.value.field)});let o={headers:e.join(";"),values:i.join(";")};this.loadingRedirect=!0,this.cdr.markForCheck(),await this.templateService.updateTemplate(o)&&(this.snackService.showSnackNotification({type:"success",message:this.translate.instant("SNACK.TEMPLATE_UPDATED_SUCCESSFULLY")}),this.setColumns(),this.originalColumnsData=JSON.parse(JSON.stringify(this.columnsForm.value)),this.enableSaveButton.set(!1),this.updateTemplateServiceState(!1),this.loadingRedirect=!1,this.cdr.markForCheck())}async updateTemplateName(e){await this.templateService.updateTemplateName({templateId:this.templateService.template.id,templateName:e}),await this.getTemplate()}goToTemplates(){this.router.navigate(["/admin/templates"])}togglePreview(){this.showPreview=!this.showPreview}openEditTemplateNameModal(){this.globalModalService.params={type:"editTemplateName",styles:"modal-background",templateName:this.templateService.template.name,templateId:this.templateId,component:ft,from:"template"},this.globalModalService.showModal()}async openDeleteTemplateModal(){this.warningAlert.title=this.translate.instant("MESSAGE_ALERT.WAIT"),this.warningAlert.message=this.translate.instant("MESSAGE_ALERT.DELETE_TEMPLATE.MESSAGE",{templateName:this.templateService.template.name}),this.warningAlert.confirmButton=this.translate.instant("TOOLTIP.DELETE_FILE"),this.warningAlert.cancelButton=this.translate.instant("MESSAGE_ALERT.CANCEL_BUTTON"),this.warningAlert.rowButtons=!0,await this.alertService.warning(this.warningAlert),this.alertService.confirmedAlert&&await this.templateService.deleteTemplate(this.templateService.template.id)&&(this.snackService.showSnackNotification({type:"success",message:this.translate.instant("SNACK.TEMPLATE_DELETED_SUCCESSFULLY")}),await this.templateService.getCompanyTemplates(this.offset,this.append,this.filterDto),this.router.navigate(["/admin/templates"]))}openPdfPreview(){this.columnsFormArray.length!==0&&(this.globalModalService.params={type:"pdfPreview",styles:"modal-popUp widthAdd",columns:this.columnsFormArray.value,component:Ti},this.globalModalService.showModal())}checkForChanges(){if(!this.originalColumnsData){this.enableSaveButton.set(!1),this.updateTemplateServiceState(!1);return}if(!this.columnsFormArray.controls.every(o=>{let m=o.get("name").valid,S=o.get("field").valid;return m&&S})){this.enableSaveButton.set(!1),this.updateTemplateServiceState(!1);return}let i=this.columnsForm.value;if(i.columns.length!==this.originalColumnsData.columns.length){this.enableSaveButton.set(!0),this.updateTemplateServiceState(!0);return}for(let o=0;o<i.columns.length;o++){let m=i.columns[o],S=this.originalColumnsData.columns[o];if(m.name!==S.name||m.fieldType!==S.fieldType||m.field!==S.field||m.columnType!==S.columnType||m.formula!==S.formula){this.enableSaveButton.set(!0),this.updateTemplateServiceState(!0);return}}this.enableSaveButton.set(!1),this.updateTemplateServiceState(!1)}updateTemplateServiceState(e){this.templateService.templateHasChanges=e}onFieldChange(e,i){this.columnsFormArray.controls[i].get("field").reset(),this.columnsFormArray.controls[i].get("field").markAsTouched()}fillColumnName(e,i){this.moveUrlFieldsToLastPosition(),!e.controls.name.value&&e.controls.name.setValue(i.name)}moveUrlFieldsToLastPosition(){let e=[];for(let i=this.columnsFormArray.controls.length-1;i>=0;i--){let o=this.columnsFormArray.controls[i];(o.value.field==="exp:urlFile"||o.value.field==="rep:url"||o.value.field==="rep:fund:urlFile"||o.value.field==="rep:viatico:urlFile")&&(e.unshift(o),this.columnsFormArray.removeAt(i))}for(let i of e)this.columnsFormArray.push(i)}getColumnWidths(){let e=this.columnRows?.first?.nativeElement;return this.measureColumns(e??document),{name:this.cachedWidths.name||200,type:this.cachedWidths.type||180,field:this.cachedWidths.field||250,action:this.cachedWidths.action||40}}
1measureColumns(e){let i={name:".column-name",type:".column-type",field:".column-field",action:".max-w-38.min-w-38"};for(let[o,m]of Object.entries(i)){let S=e.querySelector(m);S&&(this.cachedWidths[o]=S.offsetWidth-12)}}evaluateFieldsTypeOptions(){this.templateService.template.fileType===R.EXCEL?this.fieldTypesOptions=[{id:0,label:"Todos los campos"},{id:L.EXPENSE,label:"Gasto"},{id:L.REPORT,label:"Informe"},{id:L.FUND,label:"Fondo"},{id:L.VIATICO,label:"Vi\xE1tico"}]:this.fieldTypesOptions=[{id:L.EXPENSE,label:"Gasto"}]}getInvalidFields(){let e=new Map;return this.columnsFormArray.controls.forEach((o,m)=>{let S=this.templateService.template.fileType===R.EXCEL?this.getColumnLetter(m):(m+1).toString();o.get("name").invalid&&(e.has("name")||e.set("name",{inputName:"name",rows:[],baseTitle:this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.FIELDS.COLUMN_NAME"),message:this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.MUST_FILL_NAME")}),e.get("name").rows.push(S)),o.get("fieldType").invalid&&(e.has("fieldType")||e.set("fieldType",{inputName:"fieldType",rows:[],baseTitle:this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.FIELDS.FIELD_TYPE"),message:this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.MUST_SELECT_FIELD_TYPE")}),e.get("fieldType").rows.push(S)),o.get("field").invalid&&(e.has("field")||e.set("field",{inputName:"field",rows:[],baseTitle:this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.FIELDS.SELECT_A_FIELD_PLACE_HOLDER"),message:this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.MUST_SELECT_FIELD")}),e.get("field").rows.push(S))}),Array.from(e.values()).map(o=>{let m=o.rows.length>1?this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.ROWS")+" "+o.rows.join(", "):this.translate.instant("ADMIN.TEMPLATES.TEMPLATE.ROW")+" "+o.rows[0];return{inputName:o.inputName,title:`${m} - ${o.baseTitle}`,message:o.message}})}openReplicateTemplateModal(){this.globalModalService.params={type:"replicateTemplate",styles:"modal-background",templateId:this.templateId,templateName:this.templateService.template?.name,component:we},this.globalModalService.showModal()}get isFromNewTemplate(){let e=this.activatedRoute.snapshot.queryParams.fromNewTemplate;return e===!0||e==="true"}get isNewTemplateFlow(){return this.isFromNewTemplate||this.contadorService.isTemplateJustCreated(this.templateId)}showEditWarningIfContador(){this.isNewTemplateFlow||this.contadorService.isContador&&this.isReplicatedTemplate&&this.alertService.warning({title:this.translate.instant("COMPANY.CONTADOR.WARNING_EDIT_TEMPLATE_TITLE"),message:this.translate.instant("COMPANY.CONTADOR.WARNING_EDIT_TEMPLATE_MSG"),confirmButton:this.translate.instant("COMPANY.CONTADOR.UNDERSTOOD")})}get isReplicatedTemplate(){return!!this.templateService.template?.isReplicatedByAccountant}ngOnDestroy(){this.contadorService.clearJustCreatedTemplate(),this.loadActionsFromModals$&&this.loadActionsFromModals$.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)(A(ae),A(B),A(q),A(tt),A(oe),A(Ie),A(V),A(be),A(le),A(Q),A(de),A(re))}}static{this.\u0275cmp=F({type:t,selectors:[["app-template"]],viewQuery:function(i,o){if(i&1&&je(to,5),i&2){let m;He(m=$e())&&(o.columnRows=m)}},standalone:!1,features:[Dt],decls:5,vars:8,consts:[["columnRow",""],[3,"options"],[3,"click","buttonObject"],[1,"px-[24px]","pt-[24px]"],[1,"bigger","bold","flex","ai-c","gap-6"],[3,"newValue","currentValue","inputType"],[1,"sub-header-1"],[1,"flex","pd-24","fd-c","gap-24"],[1,"br-10","bg-white","pd-24","of-a","flex","fd-c"],[3,"ngTemplateOutlet"],[1,"br-10","bg-white","pd-24",3,"formGroup"],[1,"mg-24-b"],[1,"flex","fd-c","wp-100","template-columns-container"],[1,"pos-r"],[1,"fullEmptyComponent","py-96"],[3,"mainClick","customClass","options"],[1,"flex","ai-c","jc-sb"],[1,"big","bold","text-blue"],[1,"flex","ai-c","gap-8"],["matTooltipPosition","above",3,"matTooltip","matTooltipDisabled"],[1,"pd-12-tb","pd-28-sides","flex","ai-c","gap-8","br-50","hov-blue10",3,"click"],[1,"text-blue","bold"],["type","chevronDown",1,"transi-3","chevronTemplate",3,"ngClass"],[1,"rightContainer",3,"ngClass"],[1,"tableContainer","mg-24-t","mg-8-b"],[1,"flex","jc-fs","ai-c","mg-24-t","mg-24-b"],[1,"excelTable"],[1,"reference"],[1,"headerTable"],[1,"bodyTable"],[1,"italic"],[3,"errors"],[1,"pos-a","t--12","r-0","flex","ai-c","gap-8"],[1,"pointer","pd-12-tb","pd-28-sides","flex","ai-c","gap-8","br-10","hover:bg-blue10","br-50",3,"click","ngClass"],[1,"bold","text-blue"],["type","playBlueCircle"],[1,"flex","ai-c","wp-100"],[1,"min-w-40","max-w-40","box-bb"],[1,"flex","wp-100"],[1,"pd-8","column-name","bold"],[1,"pd-8","column-type","bold","flex","items-center","gap-8"],["rgTooltip","","type","infoTiny",3,"tooltipText"],[1,"pd-8","column-field","bold"],[1,"box-bb","max-w-40","min-w-40"],["cdkDropList","","formArrayName","columns",1,"flex","fd-c","wp-100",3,"cdkDropListDropped"],["cdkDrag","",1,"flex","ai-c","wp-100",3,"cdkDragDisabled","cdkDropListData","formGroupName"],[1,"min-w-38","max-w-38","box-bb","flex","jc-c","ai-c","move"],[1,"bg-blue10","text-blue","bold","w-22","h-22","flex","jc-c","ai-c","br-100"],[1,"flex","wp-100","border-1-s-gray20-l","border-1-s-gray20-r","border-1-s-gray20-t",3,"ngClass"],[1,"pd-8","border-1-s-gray20-r","column-name"],[1,"input-container","br-8","wp-100",3,"ngClass"],["formControlName","name","type","text","required","",1,"input-text",3,"focus","blur","placeholder","value"],[1,"pd-8","border-1-s-gray20-r","column-type",3,"ngClass"],[1,"pd-10"],[1,"pd-8","flex","jc-c","ai-c","border-1-s-gray20-r","column-field"],[1,"pd-8","max-w-38","min-w-38","flex","jc-c","ai-c"],["rgTooltip","","type","deleteOption",3,"click","id","tooltipText"],["class","cdk-drag-placeholder",4,"cdkDragPlaceholder"],["class","flex ai-c wp-100",4,"cdkDragPreview"],["appendTo","body","formControlName","fieldType","bindLabel","label","bindValue","id","width","100%",3,"change","placeholder","items","searchable","notFoundText"],["appendTo","body","formControlName","field","bindLabel","name","bindValue","value","width","100%",3,"change","placeholder","items","groupBy","
1searchable","notFoundText"],["ng-optgroup-tmp",""],["ng-option-tmp",""],[1,"flex","ai-c","justify-between"],[1,"input-container","br-8","wp-100"],[1,"pd-4-tb","pd-10-sides","flex","jc-sb","ai-c","wp-100","italic"],["formControlName","field","type","text","required","",1,"input-text",3,"focus","blur","placeholder"],["id","edit-pencil-column","type","edit-pencil-32",1,"pointer",3,"click"],[1,"cdk-drag-placeholder"],[1,"columnLeft"],[1,"columnRight","dashed"],[1,"min-w-38","max-w-38","box-bb","flex","jc-c","ai-c"],["type","move"],[1,"flex","bg-white","br-10","border-1-s-blue","move","m-h-58"],[1,"pd-8","border-1-s-gray20-r"],[1,"pd-10-tb","pd-16-sides","bg-defaultInput","br-10"],[1,"pd-10-tb","pd-16-sides","bg-white","br-10"],[1,"pd-10-tb","pd-16-sides","bg-white"],[1,"pd-8","flex","jc-c","ai-c"],["type","deleteOption"],[3,"emptyViewObject"],[3,"type"]],template:function(i,o){i&1&&(a(0,"app-breadcrumbs"),u(1,"app-options-button",1),a(2,"btn-component",2),v("click",function(){return o.updateTemplate()}),l()(),h(3,Qo,19,15),h(4,qo,1,0,"app-skeleton-table")),i&2&&(n(),T("options",o.options),n(),T("buttonObject",Me(4,io,(o.navigation==null||o.navigation.extras==null||o.navigation.extras.state==null?null:o.navigation.extras.state.from)==="newTemplate"?"WORKFLOWS.WORKFLOW.EDIT_WORKFLOW_DATA.SAVE":"ADM_POLICY.SAVE_CHANGES",o.loadingRedirect,o.loadingRedirect||!o.enableSaveButton())),n(),f(o.loading?-1:3),n(),f(o.loading?4:-1))},dependencies:[Pe,W,Qe,Z,ee,me,ue,_e,Te,Yt,Qt,lt,at,ot,st,Je,ze,Wt,jt,Le,ct,j,mt,O,Tt,ut,Et,_t,D,Ei],styles:["icons-component#edit-pencil-column[_ngcontent-%COMP%]  svg{width:30px;height:30px}.preview-visible[_ngcontent-%COMP%]{max-height:2000px;transition:max-height .6s ease-in-out;overflow-y:hidden}.preview-hidden[_ngcontent-%COMP%]{max-height:0;transition:max-height .4s ease-out;overflow-y:hidden}  icons-component.chevronTemplate svg path{stroke:#066bf1}.template-columns-container[_ngcontent-%COMP%]{table-layout:fixed;width:100%}.template-columns-container[_ngcontent-%COMP%]   .column-name[_ngcontent-%COMP%]{width:32%!important}.template-columns-container[_ngcontent-%COMP%]   .column-type[_ngcontent-%COMP%]{width:18%!important;min-width:18%!important;max-width:18%!important;flex:0 0 18%!important}.template-columns-container[_ngcontent-%COMP%]   .column-field[_ngcontent-%COMP%]{width:50%!important}"],changeDetection:0})}}return t})();var Ko=t=>({restrictive:t}),Si=t=>({selected:t}),zo=()=>({text:"ADMIN.TEMPLATES.NEW_TEMPLATE.NEXT_STEP_INFO"}),Jo=t=>[t],Zo=t=>({type:"INFO",headerTitle:!1,msgInlineBlock:t,withoutSpacer:!0}),ea=t=>({value:t,class:"rindeButton-o-t"}),ta=(t,r)=>({value:t,class:"rindeButton-g",loading:r});function ia(t,r){t&1&&(a(0,"div",14),u(1,"icons-component",23),a(2,"div",24),p(3),s(4,"translate"),l()()),t&2&&(n(3),_(c(4,1,"ADMIN.TEMPLATES.TEMPLATE.REQUIRED_NAME_TOOLTIP")))}function na(t,r){if(t&1){let e=M();a(0,"div",2)(1,"div",3),p(2),s(3,"translate"),l(),u(4,"div",4),a(5,"div",5),p(6),s(7,"translate"),l(),u(8,"div",6),l(),a(9,"div",2)(10,"div",7)(11,"form",8)(12,"div",9)(13,"div",10)(14,"div",11,0),p(16),s(17,"translate"),l(),a(18,"div",12)(19,"input",13),s(20,"translate"),v("focus",function(){E(e);let o=K(15),m=d();return C(m.stylingService.toggleBlueColor(o))})("blur",function(){E(e);let o=K(15),m=d();return C(m.stylingService.toggleBlueColor(o))}),l()(),h(21,ia,5,3,"div",14),l(),a(22,"div",2)(23,"div",9)(24,"div",15)(25,"div",9)(26,"div",16)(27,"div",11),p(28),s(29,"translate"),l(),a(30,"div",17,1),v("mouseover",function(){E(e);let o=K(31),m=d();return C(m.showAdviser(o))})("mouseleave",function(){E(e);let o=d();return C(o.closeAdviser())}),u(32,"icons-component",18),l()(),a(33,"div",16)(34,"div",19),v("click",function(){E(e);let o=d();return C(o.selectTemplateType(o.TemplateType.EXCEL))}),p(35),s(36,"translate"),l(),a(37,"div",19),v("click",function(){E(e);let o=d();return C(o.selectTemplateType(o.TemplateType.PDF))}),p(38),s(39,"translate"),l()()()()()(),u(40,"app-alert-component",20),l()()()(),u(41,"div",6),a(42,"div",21)(43,"btn-component",22),s(44,"translate"),v("click",function(){E(e);let o=d();return C(o.closeModal())}),l(),a(45,"btn-component",22),s(46,"translate"),v("click",function(){E(e);let o=d();return C(o.createTemplate())}),l()()}if(t&2){let e=d();n(2),g(" ",c(3,15,"ADMIN.TEMPLATES.NEW_TEMPLATE.TITLE")," "),n(4),_(c(7,17,"ADMIN.TEMPLATES.NEW_TEMPLATE.DESCRIPTION")),n(5),T("formGroup",e.newTemplateForm),n(2),T("ngClass",x(33,Ko,e.newTemplateForm.controls.name.invali
1d&&e.checkFieldsRequired)),n(3),_(c(17,19,"ADMIN.TEMPLATES.NEW_TEMPLATE.TEMPLATE_NAME")),n(3),T("placeholder",c(20,21,"ADMIN.TEMPLATES.NEW_TEMPLATE.PLACEHOLDER")),n(2),f(e.newTemplateForm.controls.name.invalid&&e.checkFieldsRequired?21:-1),n(7),_(c(29,23,"ADMIN.TEMPLATES.NEW_TEMPLATE.TEMPLATE_TYPE")),n(6),T("ngClass",x(35,Si,e.templateType===e.TemplateType.EXCEL)),n(),g(" ",c(36,25,"ADMIN.TEMPLATES.NEW_TEMPLATE.EXCEL_TEMPLATE")," "),n(2),T("ngClass",x(37,Si,e.templateType===e.TemplateType.PDF)),n(),g(" ",c(39,27,"ADMIN.TEMPLATES.NEW_TEMPLATE.PDF_TEMPLATE")," "),n(2),T("params",x(42,Zo,x(40,Jo,y(39,zo)))),n(3),T("buttonObject",x(44,ea,c(44,29,"ADMIN.TEMPLATES.NEW_TEMPLATE.CANCEL"))),n(2),T("buttonObject",J(46,ta,c(46,31,"ADMIN.TEMPLATES.NEW_TEMPLATE.CREATE_TEMPLATE"),e.loadingButton))}}function oa(t,r){t&1&&u(0,"app-simple-form-skeleton")}var ve=(()=>{class t{constructor(e,i,o,m,S,w,b,$,ne){this.globalModalService=e,this.formBuilder=i,this.router=o,this.templateService=m,this.stylingService=S,this.snackService=w,this.translate=b,this.uiStateService=$,this.contadorService=ne,this.cdr=I(k),this.loading=!1,this.loadingButton=!1,this.TemplateType=R,this.templateType=R.EXCEL,this.checkFieldsRequired=!1}async ngOnInit(){this.loading=!0,this.cdr.markForCheck(),await this.createNewTemplateForm(),this.loading=!1,this.cdr.markForCheck()}async createNewTemplateForm(){this.newTemplateForm=this.formBuilder.group({name:[null,[z.required]]})}selectTemplateType(e){this.templateType=e}closeModal(){this.globalModalService.closeModal()}async createTemplate(){if(this.loadingButton=!0,this.cdr.markForCheck(),this.newTemplateForm.invalid){this.loadingButton=!1,this.cdr.markForCheck(),this.checkFieldsRequired=!0;return}let e=this.templateType.toString(),i=this.newTemplateForm.value.name,o={type:e,name:i},m=await this.templateService.createTemplate(o);this.loadingButton=!1,this.cdr.markForCheck(),m&&(this.globalModalService.closeModal(),this.snackService.showSnackNotification({type:"success",message:this.translate.instant("SNACK.TEMPLATE_CREATED_SUCCESSFULLY")}),this.contadorService.markTemplateAsJustCreated(this.templateService.template.id),this.router.navigate(["admin/templates/template",this.templateService.template.id],{queryParams:{fromNewTemplate:!0}}))}showAdviser(e){let i=e.getBoundingClientRect(),o={title:"asdf",header:"asdfsdf",text:"asdfasdfsfasd",positionX:i.x+i.width+16,positionY:i.y-24,showAdviser:!0,type:"custom",typePreview:"svg",url:"templatesHowWorks3",modalParams:{custom:"newTemplate"},openLeftBefCentered:!0};this.uiStateService.setAdviser(o)}async closeAdviser(){this.uiStateService.fadeOutHelper(),setTimeout(()=>{this.uiStateService.unsetAdviser(),this.cdr.markForCheck()},300)}static{this.\u0275fac=function(i){return new(i||t)(A(B),A(ae),A(oe),A(q),A(le),A(Q),A(V),A(et),A(re))}}static{this.\u0275cmp=F({type:t,selectors:[["app-new-template"]],standalone:!1,decls:2,vars:1,consts:[["title",""],["helper",""],[1,"block","w-full","p-0"],[1,"header-1","text-blue"],[1,"h-24"],[1,"sub-header-1"],[1,"h-40"],[1,"container-rg","pd-0"],[3,"formGroup"],[1,"v-form"],[1,"v-form-group","n-1-2",3,"ngClass"],[1,"label-3"],[1,"input-container","br-8"],["formControlName","name","width","100%","type","text","required","",1,"input-text",3,"focus","blur","placeholder"],[1,"flex","ai-c","gap-4","mg-4-t"],[1,"v-form-group","n-1-1"],[1,"flex","gap-8"],[3,"mouseover","mouseleave"],["type","infoTiny"],[1,"button","OptionSelector","blue",3,"click","ngClass"],[3,"params"],[1,"ta-r"],[3,"click","buttonObject"],["type","infoRedTiny"],[1,"small"]],template:function(i,o){i&1&&h(0,na,47,49)(1,oa,1,0,"app-simple-form-skeleton"),i&2&&f(o.loading?1:0)},dependencies:[W,nt,Z,ee,me,ue,_e,Te,j,Zt,O,dt,D],encapsulation:2,changeDetection:0})}}return t})();var gi=(()=>{class t{constructor(){}ngOnInit(){}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-how-works-modal"]],decls:38,vars:30,consts:[[1,"flex","fd-c","gap-40","pd-48"],[1,"flex","fd-c","gap-24"],[1,"bigger","bold"],[1,"bg-white","flex","fx-1","br-10","border-1-s-gray20"],[1,"flex","fd-c","gap-8","jc-c","ai-c","ta-c","pd-8"],[1,"text-blue","bold"],[3,"innerHTML"],[1,"flex","jc-c","ai-c","br-10-r",2,"background-color","#e0f5ff"],[3,"type"]],template:function(i,o){i&1&&(a(0,"div",0)(1,"div",1)(2,"div",2),p(3),s(4,"translate"),l(),a(5,"div"),p(6),s(7,"translate"),l()(),a(8,"div",1)(9,"div",3)(10,"div",4)(11,"div",5),p(12),s(13,"translate"),l(),u(14,"div",6),s(15,"translate"),l(),a(16,"div",7),u(17,"icons-component",8),l()(),a(18,"div",3)(19,"div",4)(20,"div",5),p(21),s(22,"translate"),l(),u(23,"div",6),s(24,"translate"),l(),a(25,"div",7),u(26,"icons-component",8),l()(),a(27,"div",3)(28,"div",4)(29,"div",5),p(30),s(31,"translate"),l(),u(32,"div",6),s(33,"translate"),u(34,"div",6),s(35,"translate"),l(),a(36,"div",7),u(37,"icons-component",8),l()()()()),i&2&&(n(3),_(c(4,12,"ADMIN.TEMPLATES.TE
1MPLATES.HOW_WORKS_TEMPLATE")),n(3),_(c(7,14,"ADMIN.TEMPLATES.TEMPLATES.HOW_WORKS_TEMPLATE_DESCRIPTION")),n(6),_(c(13,16,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.TITLE")),n(2),T("innerHTML",c(15,18,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.DESCRIPTION"),G),n(3),T("type","templatesHowWorks1"),n(4),_(c(22,20,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.CREATE_TEMPLATE")),n(2),T("innerHTML",c(24,22,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.CREATE_TEMPLATE_DESCRIPTION"),G),n(3),T("type","templatesHowWorks2"),n(4),_(c(31,24,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.TEMPLATE_TYPES")),n(2),T("innerHTML",c(33,26,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.EXCEL_TEMPLATE_DESCRIPTION"),G),n(2),T("innerHTML",c(35,28,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.PDF_TEMPLATE_DESCRIPTION"),G),n(3),T("type","templatesHowWorks3"))},dependencies:[H,O,D],encapsulation:2,changeDetection:0})}}return t})();var aa=()=>({value:"USERS.NEW_USER.CANCEL",class:"rindeButton-o-t nM"}),la=(t,r)=>({value:"ADMIN.TEMPLATES.QUICK_TEMPLATE.SAVE_BUTTON",class:"rindeButton-g nM",loading:t,disabled:r}),ra=()=>({value:"ADMIN.TEMPLATES.QUICK_TEMPLATE.FINISH_BUTTON",class:"rindeButton-o-t nM"}),sa=()=>({value:"ADMIN.TEMPLATES.QUICK_TEMPLATE.VIEW_PLANS_BUTTON",class:"rindeButton-g nM"}),pa=()=>["A","B","C","D","E","F","G","H","I","J"],ca=(t,r)=>r.value;function da(t,r){t&1&&(a(0,"div",4),u(1,"div",13),a(2,"span",14),p(3),s(4,"translate"),l()()),t&2&&(n(3),_(c(4,1,"ADMIN.TEMPLATES.QUICK_TEMPLATE.LOADING")))}function ma(t,r){if(t&1){let e=M();a(0,"div",5)(1,"span",15),p(2,"\u{1F451}"),l(),a(3,"div",16),p(4),s(5,"translate"),l(),a(6,"div",17),p(7),s(8,"translate"),l(),a(9,"div",10)(10,"btn-component",12),v("click",function(){E(e);let o=d();return C(o.finishWithoutTemplate())}),l(),a(11,"btn-component",12),v("click",function(){E(e);let o=d();return C(o.goToBilling())}),l()()()}t&2&&(n(4),_(c(5,4,"ADMIN.TEMPLATES.QUICK_TEMPLATE.UPSELL_TITLE")),n(3),_(c(8,6,"ADMIN.TEMPLATES.QUICK_TEMPLATE.UPSELL_DESCRIPTION")),n(3),T("buttonObject",y(8,ra)),n(),T("buttonObject",y(9,sa)))}function Ta(t,r){t&1&&(a(0,"div",6),p(1),s(2,"translate"),l()),t&2&&(n(),g(" ",c(2,1,"ADMIN.TEMPLATES.QUICK_TEMPLATE.NO_SUGGESTION")," "))}function _a(t,r){if(t&1&&(a(0,"div",18)(1,"span",26),p(2,"\u2728"),l(),a(3,"div",14)(4,"span",27),p(5),s(6,"translate"),l(),p(7),l()()),t&2){let e=d(2);n(5),_(c(6,2,"ADMIN.TEMPLATES.QUICK_TEMPLATE.AGENT_SUGGESTION")),n(2),g(" ",e.reason," ")}}function ua(t,r){if(t&1){let e=M();a(0,"div",25)(1,"span",28),p(2,"\u22EE"),l(),a(3,"span",29),p(4),l(),a(5,"div",30)(6,"input",31),Ae("ngModelChange",function(o){let m=E(e).$implicit;return xe(m.header,o)||(m.header=o),C(o)}),l(),a(7,"div",32),p(8),l()(),a(9,"button",33),v("click",function(){let o=E(e).$index,m=d(2);return C(m.removeColumn(o))}),p(10,"\u2715"),l()()}if(t&2){let e=r.$implicit,i=r.$index;n(4),_(y(3,pa)[i]||i+1),n(2),ge("ngModel",e.header),n(2),_(e.value)}}function Ea(t,r){if(t&1){let e=M();a(0,"div",7),h(1,_a,8,4,"div",18),a(2,"div",19),p(3),s(4,"translate"),l(),a(5,"div",20)(6,"button",21),v("click",function(){E(e);let o=d();return C(o.selectTemplateType(o.TemplateType.EXCEL))}),p(7," Excel "),l(),a(8,"button",21),v("click",function(){E(e);let o=d();return C(o.selectTemplateType(o.TemplateType.PDF))}),p(9," PDF "),l()(),a(10,"div",22),p(11),s(12,"translate"),l(),a(13,"input",23),Ae("ngModelChange",function(o){E(e);let m=d();return xe(m.templateName,o)||(m.templateName=o),C(o)}),l(),u(14,"div",3),a(15,"div",19),p(16),s(17,"translate"),l(),a(18,"div",24),v("cdkDropListDropped",function(o){E(e);let m=d();return C(m.drop(o))}),P(19,ua,11,4,"div",25,ca),l(),a(21,"div",2),p(22),s(23,"translate"),l()()}if(t&2){let e=d();n(),f(e.reason?1:-1),n(2),_(c(4,30,"ADMIN.TEMPLATES.QUICK_TEMPLATE.TYPE_LABEL")),n(3),se("border-blue",e.selectedTemplateType===e.TemplateType.EXCEL)("bg-blue",e.selectedTemplateType===e.TemplateType.EXCEL)("text-white",e.selectedTemplateType===e.TemplateType.EXCEL)("border-blueLight",e.selectedTemplateType!==e.TemplateType.EXCEL)("bg-white",e.selectedTemplateType!==e.TemplateType.EXCEL)("text-blue",e.selectedTemplateType!==e.TemplateType.EXCEL),n(2),se("border-blue",e.selectedTemplateType===e.TemplateType.PDF)("bg-blue",e.selectedTemplateType===e.TemplateType.PDF)("text-white",e.selectedTemplateType===e.TemplateType.PDF)("border-blueLight",e.selectedTemplateType!==e.TemplateType.PDF)("bg-white",e.selectedTemplateType!==e.TemplateType.PDF)("text-blue",e.selectedTemplateType!==e.TemplateType.PDF),n(3),_(c(12,32,"ADMIN.TEMPLATES.QUICK_TEMPLATE.NAME_LABEL")),n(2),ge("ngModel",e.templateName),n(3),_(c(17,34,"ADMIN.TEMPLATES.QUICK_TEMPLATE.COLUMNS_LABEL")),n(3),N(e.columns),n(3),_(c(23,36,"ADMIN.TEMPLATES.QUICK_TEMPLATE.DRAG_HINT"))}}var xi=(()=>{class t{constructor(){this.cdr=I(k),this.globalModalService=I(B),this.snackService=I(Q),this.templateService=I(q),this.companyService=I(de),this.onboardingAgentService=I(ai),this.translate=I(V),this.router=I(oe),this.params=null,this.loadingSuggestion=!0,this.loadingButton=!1,this.templateName="",this.columns=[],this.reason=null,this.selectedTemplateType=R.EXCEL,this.canCreateTemplates=!1,this.originalReason=null,this.TemplateType=R}async ngOnInit(){if(this.canCreateTemplates=this.companyService.hasCorporateOrEnterprisePlan(),this.canCreateTemplates)try{let e=await this.onboardingAgentService.getTemplateSuggestion();this.templateName=e?.suggestion?.name||"",this.columns=(e?.suggestion?.columns||[]).map(i=>({header:i.header,value:i.value})),this.reason=e?.suggestion?.reason||null,this.originalReason=this.reason}catch{this.reason=null}this.loadingSuggestion=!1,this.cdr.markForCheck()}get canSave(){return!!this.templateName.trim()&&this.columns.length>0&&!this.loadingButton}drop(e){Ke(this.columns,e.previousIndex,e.currentIndex)}
1removeColumn(e){this.columns.splice(e,1)}async selectTemplateType(e){if(this.selectedTemplateType===e)return;this.selectedTemplateType=e;let i=await this.templateService.getTemplateFields(e);this.columns=(i||[]).map(o=>({header:o.columnName||o.name||o.type||"",value:o.name||""})),this.reason=e===R.EXCEL?this.originalReason:null}openAdvancedSettings(){this.globalModalService.replaceModal({type:"newTemplate",styles:"modal-background banner-anchored",component:ve})}closeModal(){this.globalModalService.closeModal()}goToBilling(){this.globalModalService.closeModal(),this.router.navigate(["/admin/billing"])}async skipTemplate(){await this.onboardingAgentService.skipStepAndAdvance("template")}async finishWithoutTemplate(){await this.onboardingAgentService.completeStepAndAdvance("template")}async saveTemplate(){if(this.canSave){this.loadingButton=!0,this.cdr.markForCheck();try{if(!await this.templateService.createTemplate({name:this.templateName.trim(),type:this.selectedTemplateType.toString()})){this.showError(),this.loadingButton=!1,this.cdr.markForCheck();return}if(!await this.templateService.updateTemplate({headers:this.columns.map(m=>m.header).join(";"),values:this.columns.map(m=>m.value).join(";")})){this.showError(),this.loadingButton=!1,this.cdr.markForCheck();return}let o={type:"success",message:this.translate.instant("ADMIN.TEMPLATES.QUICK_TEMPLATE.SUCCESS")};this.snackService.showSnackNotification(o),this.loadingButton=!1,this.cdr.markForCheck(),await this.onboardingAgentService.completeStepAndAdvance("template")}catch{this.showError(),this.loadingButton=!1,this.cdr.markForCheck()}}}showError(){let e={type:"error",message:this.translate.instant("ADMIN.TEMPLATES.QUICK_TEMPLATE.ERROR")};this.snackService.showSnackNotification(e)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-quick-template"]],decls:24,vars:19,consts:[[1,"block","w-full","p-0"],[1,"header-1","text-blue"],[1,"text-smaller","text-black60","mt-8"],[1,"h-16"],[1,"flex","items-center","gap-8","py-16"],[1,"text-center","p-24","rounded-8","border","border-blueLight","bg-white","flex","flex-col","items-center"],[1,"p-12","rounded-8","border","border-blueLight","bg-blue10","text-smaller","text-black60"],[1,"flex","flex-col","max-h-[70vh]","overflow-y-auto","pr-8","-mr-8"],[1,"h-24"],[1,"flex","items-center","justify-between","w-full"],[1,"flex","items-center","gap-12"],["type","button",1,"text-smaller","text-blue","underline","bg-transparent","border-0","cursor-pointer","p-0",3,"click"],[3,"click","buttonObject"],[1,"w-16","h-16","border-2","border-purple","border-t-transparent","rounded-full","animate-spin"],[1,"text-smaller","text-black60"],[1,"text-32","text-purple","mb-8"],[1,"header-2","text-black","mb-8"],[1,"text-smaller","text-black60","mb-16","max-w-[400px]"],[1,"flex","items-start","gap-8","p-10","rounded-8","bg-blue10","mb-12"],[1,"label-3","mb-8"],[1,"flex","items-center","gap-8","mb-16"],["type","button",1,"text-smaller","px-16","py-6","rounded-8","border","font-bold","cursor-pointer",3,"click"],[1,"label-3","mb-4"],["type","text",1,"w-full","border","border-blueLight","rounded-8","px-10","py-8","text-smaller","outline-none",3,"ngModelChange","ngModel"],["cdkDropList","",1,"flex","flex-col","gap-8",3,"cdkDropListDropped"],["cdkDrag","",1,"grid","grid-cols-[auto_auto_1fr_auto]","items-center","gap-12","p-10","rounded-8","border","border-blueLight","bg-white","cursor-grab"],[1,"text-smaller","text-purple"],[1,"label-3","text-blue"],[1,"text-black40","select-none","text-smaller"],[1,"flex","items-center","justify-center","w-24","h-24","rounded-full","bg-blue10","text-blue","text-smallest","font-bold","shrink-0"],[1,"flex-1","min-w-0"],["type","text",1,"w-full","border-0","bg-transparent","text-smaller","font-bold","outline-none","p-0",3,"ngModelChange","ngModel"],[1,"text-smaller","text-black60","truncate"],["type","button",1,"text-orange","hover:text-orangeDark","bg-transparent","border-0","cursor-pointer","text-smaller","shrink-0","p-0",3,"click"]],template:function(i,o){i&1&&(a(0,"div",0)(1,"div",1),p(2),s(3,"translate"),l(),a(4,"div",2),p(5),s(6,"translate"),l()(),u(7,"div",3),h(8,da,5,3,"div",4)(9,ma,12,10,"div",5)(10,Ta,3,3,"div",6)(11,Ea,24,38,"div",7),u(12,"div",8),a(13,"div",9)(14,"div",10)(15,"button",11),v("click",function(){return o.skipTemplate()}),p(16),s(17,"translate"),l(),a(18,"button",11),v("click",function(){return o.openAdvancedSettings()}),p(19),s(20,"translate"),l()(),a(21,"div",10)(22,"btn-component",12),v("click",function(){return o.closeModal()}),l(),a(23,"btn-component",12),v("click",function(){return o.saveTemplate()}),l()()()),i&2&&(n(2),g(" ",c(3,7,"ADMIN.TEMPLATES.QUICK_TEMPLATE.TITLE")," "),n(3),g(" ",c(6,9,"ADMIN.TEMPLATES.QUICK_TEMPLATE.SUBTITLE")," "),n(3),f(o.loadingSuggestion?8:o.canCreateTemplates?o.columns.length===0?10:11:9),n(8),g(" ",c(17,11,"ADMIN.TEMPLATES.QUICK_TEMPLATE.SKIP")," "),n(3),g(" ",c(20,13,"ADMIN.TEMPLATES.QUICK_TEMPLATE.ADVANCED_SETTINGS")," "),n(3),T("buttonObject",y(15,aa)),n(),T("buttonObject",J(16,la,o.loadingButton,!o.c
1anSave)))},dependencies:[qt,Z,ee,it,Ht,Je,ze,H,j,D],encapsulation:2,changeDetection:0})}}return t})();var vt=(()=>{class t{constructor(){this.translate=I(V),this.templateService=I(q),this.snackService=I(Q),this.router=I(oe),this.contadorService=I(re),this.suggestedTemplates=[],this.usingKey=null}buildCatalog(){this.suggestedTemplates=[{key:"reimbursement",name:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.REIMBURSEMENT.NAME"),description:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.REIMBURSEMENT.DESCRIPTION"),country:"ALL",tags:[this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.REIMBURSEMENT")],fileType:R.EXCEL,headers:["N\xB0","Fecha","Colaborador","Identificaci\xF3n","Categor\xEDa","Proveedor","Detalle","Monto","Informe"].join(";"),values:["exp:id","exp:date","exp:user:name","exp:user:identification","exp:category","exp:merchant","exp:note","exp:amount","rep:title"].join(";")},{key:"anid",name:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.ANID.NAME"),description:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.ANID.DESCRIPTION"),country:"CL",tags:[this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.PUBLIC_FUNDS"),this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.RENDITION")],fileType:R.EXCEL,headers:["N\xB0","Proyecto","\xCDtem","Sub\xEDtem","RUT proveedor","Nombre proveedor","Detalle","Tipo de documento","N\xB0 documento","Fecha","Neto","IVA","Monto total","Monto rendido","Categor\xEDa","Informe"].join(";"),values:["exp:id","exp:extraField:Proyecto","exp:extraField:\xCDtem","exp:extraField:Sub\xEDtem","exp:extraField:RUT proveedor","exp:merchant","exp:note","exp:extraField:Tipo de documento","exp:extraField:N\xB0 documento","exp:date","exp:net","exp:tax","exp:amount","exp:amount","exp:category","rep:title"].join(";")},{key:"corfo",name:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.CORFO.NAME"),description:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.CORFO.DESCRIPTION"),country:"CL",tags:[this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.PUBLIC_FUNDS"),this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.RENDITION")],fileType:R.EXCEL,headers:["N\xB0","Cuenta presupuestaria/\xCDtem","Fecha","Tipo de documento","N\xB0 documento","Proveedor","RUT proveedor","Glosa/Detalle","Forma de pago","N\xB0 comprobante de pago","Fuente","Neto","Monto total","Proyecto","Informe"].join(";"),values:["exp:id","exp:extraField:\xCDtem","exp:date","exp:extraField:Tipo de documento","exp:extraField:N\xB0 documento","exp:merchant","exp:extraField:RUT proveedor","exp:note","exp:extraField:Forma de pago","exp:extraField:N\xB0 comprobante de pago","exp:extraField:Fuente","exp:net","exp:amount","exp:extraField:Proyecto","rep:title"].join(";")},{key:"mobility_pe",name:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.MOBILITY_PE.NAME"),description:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.MOBILITY_PE.DESCRIPTION"),country:"PE",tags:[this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.MOBILITY")],fileType:R.EXCEL,headers:["N\xB0","Fecha","Colaborador","Identificaci\xF3n","Motivo/Destino","Categor\xEDa","Monto","Informe"].join(";"),values:["exp:id","exp:date","exp:user:name","exp:user:identification","exp:note","exp:category","exp:amount","rep:title"].join(";")},{key:"servel",name:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.SERVEL.NAME"),description:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.SERVEL.DESCRIPTION"),country:"CL",tags:[this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.PUBLIC_FUNDS"),this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.ELECTORAL")],fileType:R.EXCEL,headers:["N\xB0 L\xEDnea","N\xB0 Hoja","RUT","Nombre proveedor","Fecha","Tipo documento","N\xB0 de documento","Cuenta contable","Reembolso","Glosa documento","Monto","Informe"].join(";"),values:["exp:id","exp:extraField:N\xB0 Hoja","exp:extraField:RUT proveedor","exp:merchant","exp:date","exp:extraField:Tipo de documento","exp:extraField:N\xB0 documento","exp:extraField:Cuenta contable","exp:extraField:Reembolso","exp:note","exp:amount","rep:title"].join(";")},{key:"cgr",name:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.CGR.NAME"),description:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.CGR.DESCRIPTION"),country:"CL",tags:[this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.PUBLIC_FUNDS"),this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.TAGS.RENDITION")],fileType:R.EXCEL,headers:["N\xB0","Fecha","Tipo documento","N\xB0 documento","Proveedor/Beneficiario","RUT","Detalle/Glosa","\xCDtem/Objetivo convenio","N\xB0 comprobante de egreso","Neto","Monto total","Informe"].join(";
1"),values:["exp:id","exp:date","exp:extraField:Tipo de documento","exp:extraField:N\xB0 documento","exp:merchant","exp:extraField:RUT proveedor","exp:note","exp:extraField:\xCDtem","exp:extraField:N\xB0 comprobante de egreso","exp:net","exp:amount","rep:title"].join(";")}]}async useTemplate(e){if(!this.usingKey){this.usingKey=e.key;try{await this.createFromSuggestedTemplate(e)}finally{this.usingKey=null}}}async createFromSuggestedTemplate(e){if(!(await this.templateService.createTemplate({name:e.name,type:e.fileType.toString()})&&await this.templateService.updateTemplate({headers:e.headers,values:e.values}))){this.snackService.showSnackNotification({type:"error",message:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.ERROR_USE")});return}this.snackService.showSnackNotification({type:"success",message:this.translate.instant("ADMIN.TEMPLATES.SUGGESTED.SUCCESS_USE")}),this.contadorService.markTemplateAsJustCreated(this.templateService.template.id),this.router.navigate(["admin/templates/template",this.templateService.template.id],{queryParams:{fromNewTemplate:!0}})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=Ft({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Ca=["tableWrapper"],ha=t=>({total:t}),Ai=t=>({"opacity-40 pointer-events-none":t}),fa=(t,r)=>({value:t,class:"rindeButton-b nM",loading:r}),va=t=>({"shadow-[-15px_0_12px_-4px_rgba(0,0,0,0.40)_inset]":t});function Sa(t,r){if(t&1&&(a(0,"span",16),p(1),l()),t&2){let e=r.$implicit;n(),_(e)}}function ga(t,r){if(t&1&&(a(0,"th",31),p(1),l()),t&2){let e=r.$index,i=r.$index,o=r.$count,m=d(2);se("border-r",i!==o-1),n(),_(m.columnLetter(e))}}function xa(t,r){if(t&1&&(a(0,"td",32),p(1),l()),t&2){let e=r.$implicit,i=r.$index,o=r.$count;se("border-r",i!==o-1),n(),_(e)}}function Aa(t,r){if(t&1&&(a(0,"td",33),p(1),s(2,"translate"),l()),t&2){let e=r.$index,i=r.$count;se("border-r",e!==i-1),n(),g(" ",c(2,3,"ADMIN.TEMPLATES.SUGGESTED.PREVIEW_EXAMPLE")," ")}}function Ma(t,r){if(t&1){let e=M();a(0,"div",1)(1,"div",2)(2,"div",3),u(3,"icons-component",4),a(4,"div",5),p(5),s(6,"translate"),l()(),a(7,"div",6)(8,"div")(9,"span",7),p(10),l(),p(11),s(12,"translate"),l(),a(13,"div",8),v("click",function(){E(e);let o=d();return C(o.goTo(-1))}),u(14,"icons-component",9),l(),a(15,"div",8),v("click",function(){E(e);let o=d();return C(o.goTo(1))}),u(16,"icons-component",10),l()(),a(17,"btn-component",11),s(18,"translate"),v("click",function(){E(e);let o=d();return C(o.useTemplate())}),l()(),a(19,"div",12)(20,"div",13),p(21),l(),a(22,"div",14)(23,"span",15),p(24),s(25,"translate"),l(),P(26,Sa,2,1,"span",16,U),l(),a(28,"div",17),p(29),l(),a(30,"div",18,0),v("scroll",function(){E(e);let o=d();return C(o.updateScrollShadow())}),a(32,"table",19)(33,"thead")(34,"tr",20),u(35,"th",21),P(36,ga,2,3,"th",22,Ge),l()(),a(38,"tbody")(39,"tr")(40,"td",23),p(41,"1"),l(),P(42,xa,2,3,"td",24,Ge),l(),a(44,"tr")(45,"td",25),p(46,"2"),l(),P(47,Aa,3,5,"td",26,Ge),l()()()(),a(49,"div",27),u(50,"icons-component",28),a(51,"div",29)(52,"div",5),p(53),s(54,"translate"),l(),a(55,"div",30),p(56),s(57,"translate"),l()()()()()}if(t&2){let e=d();n(5),_(c(6,12,"ADMIN.TEMPLATES.SUGGESTED.PREVIEW_PANEL_TITLE")),n(5),_(e.currentIndex+1),n(),g(" ",ce(12,14,"ADMIN.TEMPLATES.SUGGESTED.PREVIEW_NAV",x(25,ha,e.templates.length))," "),n(2),T("ngClass",x(27,Ai,e.currentIndex===0)),n(2),T("ngClass",x(29,Ai,e.currentIndex===e.templates.length-1)),n(2),T("buttonObject",J(31,fa,c(18,17,"ADMIN.TEMPLATES.SUGGESTED.USE_TEMPLATE"),e.suggestedTemplatesService.usingKey===e.suggestedTemplate.key)),n(4),_(e.suggestedTemplate.name),n(3),_(c(25,19,"ADMIN.TEMPLATES.SUGGESTED.COUNTRIES."+e.suggestedTemplate.country)),n(2),N(e.suggestedTemplate.tags),n(3),_(e.suggestedTemplate.description),n(),T("ngClass",x(34,va,e.showScrollShadow)),n(6),N(e.columns),n(6),N(e.columns),n(5),N(e.columns),n(6),_(c(54,21,"ADMIN.TEMPLATES.SUGGESTED.INFO_TITLE")),n(3),_(c(57,23,"ADMIN.TEMPLATES.SUGGESTED.INFO_DESCRIPTION"))}}var Mi=(()=>{class t{constructor(){this.cdr=I(k),this.globalModalService=I(B),this.suggestedTemplatesService=I(vt),this.showScrollShadow=!1}ngAfterViewInit(){this.updateScrollShadow()}updateScrollShadow(){setTimeout(()=>{let e=this.tableWrapper?.nativeElement;this.showScrollShadow=!!e&&e.scrollWidth-e.clientWidth-e.scrollLeft>1,this.cdr.markForCheck()})}get suggestedTemplate(){return this.globalModalService.params?.data}get templates(){return this.suggestedTemplatesService.suggestedTemplates}get currentIndex(){return this.templates.findIndex(e=>e.key===this.suggestedTemplate.key)}goTo(e){let i=this.currentIndex+e;i<0||i>=this.templates.length||(this.globalModalService.params.data=this.templates[i],this.updateScrollShadow())}columnLetter(e){let i="",o=e;do i=String.fromCharCode(65+o%26)+i,o=Math.floor(o/26)-1;while(o>=0);return i}get columns(){return this.suggestedTemplate.headers.split(";")}async useTemplate(){await this.suggestedTemplatesService.useTemplate(this.suggestedTemplate),this.globalModalService.closeModal()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-suggested-template-preview"]],viewQuery:function(i,o){if(i&1&&je(Ca,5),i&2){let m;
1He(m=$e())&&(o.tableWrapper=m.first)}},hostBindings:function(i,o){i&1&&v("resize",function(){return o.updateScrollShadow()},Ot)},decls:1,vars:1,consts:[["tableWrapper",""],[1,"flex","fd-c","min-h-screen","bg-white"],[1,"bg-blueCloud","pd-16-tb","pd-48-sides","flex","ai-c","jc-sb","c-g-24"],[1,"flex","ai-c","c-g-12"],["type","excel",1,"bg-clouds","br-10"],[1,"bold","text-blue"],[1,"flex","ai-c","c-g-8","text-black"],[1,"bold"],[1,"pointer",3,"click","ngClass"],["type","arrowLeft"],["type","arrowRight2"],[3,"click","buttonObject"],[1,"pd-40-tb","pd-48-sides","flex","fd-c","fx-1","of-y-a"],[1,"text-biggest","bold","text-black"],[1,"mg-24-t","flex","fw-w","gap-8"],[1,"rgChip-static-b","bold"],[1,"rgChip-static-gray","bold","!text-black"],[1,"mg-24-t","text-black70"],[1,"mg-40-t","br-10","border","border-solid","border-black20","overflow-x-auto",3,"scroll","ngClass"],[1,"w-max","min-w-full","border-collapse","whitespace-nowrap"],[1,"bg-clouds","text-black50"],[1,"w-40","pd-4-tb","pd-8-sides","border-r","border-b","border-solid","border-black20"],[1,"pd-4-tb","pd-16-sides","ta-c","border-b","border-solid","border-black20",3,"border-r"],[1,"bg-clouds","text-black50","ta-c","pd-8-tb","pd-8-sides","border-r","border-b","border-solid","border-black20"],[1,"pd-8-tb","pd-16-sides","ta-c","bold","text-black","border-b","border-solid","border-black20",3,"border-r"],[1,"bg-clouds","text-black50","ta-c","pd-8-tb","pd-8-sides","border-r","border-solid","border-black20"],[1,"pd-8-tb","pd-16-sides","ta-c","text-black70","border-solid","border-black20",3,"border-r"],[1,"mg-40-t","br-10","bg-blue10","pd-24","flex","c-g-16"],["type","alertInfo24"],[1,"flex","fd-c","gap-8"],[1,"text-black"],[1,"pd-4-tb","pd-16-sides","ta-c","border-b","border-solid","border-black20"],[1,"pd-8-tb","pd-16-sides","ta-c","bold","text-black","border-b","border-solid","border-black20"],[1,"pd-8-tb","pd-16-sides","ta-c","text-black70","border-solid","border-black20"]],template:function(i,o){i&1&&h(0,Ma,58,36,"div",1),i&2&&f(o.suggestedTemplate?0:-1)},dependencies:[H,W,j,O,D],encapsulation:2,changeDetection:0})}}return t})();var La=t=>({value:t,class:"rindeButton-g nM"}),ba=(t,r,e)=>({value:t,class:"rindeButton-b-s nM",loading:r,disabled:e}),Pa=(t,r)=>r.key;function Na(t,r){if(t&1&&(a(0,"span",17),p(1),l()),t&2){let e=r.$implicit;n(),_(e)}}function Fa(t,r){if(t&1){let e=M();a(0,"div",4)(1,"div",11),u(2,"icons-component",12),a(3,"div",13),p(4),l()(),a(5,"div",14)(6,"div",15)(7,"span",16),p(8),s(9,"translate"),l(),P(10,Na,2,1,"span",17,U),l(),a(12,"div",18),p(13),l(),a(14,"div",19),v("click",function(){let o=E(e).$implicit,m=d();return C(m.openPreview(o))}),p(15),s(16,"translate"),l()(),a(17,"div",20)(18,"btn-component",10),s(19,"translate"),v("click",function(){let o=E(e).$implicit,m=d();return C(m.useTemplate(o))}),l()()()}if(t&2){let e=r.$implicit,i=d();n(4),_(e.name),n(4),_(c(9,5,"ADMIN.TEMPLATES.SUGGESTED.COUNTRIES."+e.country)),n(2),N(e.tags),n(3),_(e.description),n(2),g(" ",c(16,7,"ADMIN.TEMPLATES.SUGGESTED.SEE_PREVIEW")," "),n(3),T("buttonObject",Me(11,ba,c(19,9,"ADMIN.TEMPLATES.SUGGESTED.USE_TEMPLATE"),i.suggestedTemplatesService.usingKey===e.key,i.suggestedTemplatesService.usingKey&&i.suggestedTemplatesService.usingKey!==e.key))}}var St=(()=>{class t{constructor(){this.suggestedTemplatesService=I(vt),this.globalModalService=I(B)}ngOnInit(){this.suggestedTemplatesService.buildCatalog()}openPreview(e){this.globalModalService.params={type:"suggestedTemplatePreview",styles:"modal-popUp widthActivity",width:1081,component:Mi,data:e},this.globalModalService.showModal()}newTemplate(){this.globalModalService.params={type:"newTemplate",styles:"modal-background",component:ve},this.globalModalService.showModal()}useTemplate(e){return this.suggestedTemplatesService.useTemplate(e)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=F({type:t,selectors:[["app-suggested-templates"]],decls:20,vars:17,consts:[[1,"pd-0-b","pd-24-sides","pd-24-t","flex","fd-c","gap-8"],[1,"bigger","bold"],[1,"sub-header-1"],[1,"pd-24","grid","grid-cols-1","md:grid-cols-2","xl:grid-cols-3","gap-24"],[1,"br-10","border","border-solid","border-(black20)","flex","fd-c","bg-white"],[1,"br-10","border-2","border-dashed","border-(black30)","bg-blueLight","flex","fd-c","ai-c","jc-c","gap-16","pd-24"],["type","templateFromCero"],[1,"flex","fd-c","ai-c","gap-4"],[1,"ta-c","bold",3,"innerHTML"],[1,"ta-c"],[3,"click","buttonObject"],[1,"border-b","border-solid","border-(black20)","pd-8-tb","pd-24-sides","flex","ai-c","c-g-8"],["type","excel",1,"bg-clouds","br-10","flex-shrink-0"],["isEllipsis","",1,"bold","text-blue","truncate","min-w-0"],[1,"pd-24","flex","fd-c","jc-sb","gap-16","fx-1"],[1,"flex","fw-w","gap-8"],[1,"rgChip-static-b","bold"],[1,"rgChip-static-gray","bold","!text-black"],[1,"fx-1","text-black70"],[1,"text-blue","decoration-blue","bold","pointer","td-under",3,"click"],[1,"pd-16-tb","pd-24-sides","flex","jc-c","gap-8","bg-blueLight","border-t","border-solid","border-(black20)"]],template:function(i,o){i&1&&(a(0,"div",0)(1,"div",1),p(2),s(3,"translate"),l(),a(4,"div",2),p(5),s(6,"translate"),l()(),a(7,"div",3),P(8,Fa,20,15,"div",4,Pa),a(10,"div",5),u(11,"icons-component",6),a(12,"div",7),u(13,"div",8),s(14,"translate"),a(15,"div",9),p(16),s(17,"translate"),l()(),a(18,"btn-component",10),s(19,"translate"),v("click",function(){return o.newTemplate()}),l()()()),i&2&&(n(2),_(c(3,5,"ADMIN.TEMPLATES.SUGGESTED.TITLE")),n(3),_(c(6,7,"ADMIN.TEMPLATES.SUGGESTED.DESCRIPTION")),n(3),N(o.suggestedTemplatesService.suggestedTemplates),n(5),T("innerHTML",c(14,9,"ADMIN.TEMPLATES.SUGGESTED.NOT_FOUND_TIT
1LE"),G),n(3),_(c(17,11,"ADMIN.TEMPLATES.SUGGESTED.NOT_FOUND_SUBTITLE")),n(2),T("buttonObject",x(15,La,c(19,13,"ADMIN.TEMPLATES.TEMPLATES.CREATE_TEMPLATE"))))},dependencies:[H,pt,j,O,D],encapsulation:2,changeDetection:0})}}return t})();var Ii=t=>({"active blue-imp":t}),Da=t=>({class:"rindeButton-g tiny nM",value:t}),wa=t=>({class:"rindeButton-b-s nM tiny",value:"FILTER.APPLY_LAST_FILTERS",disabled:t}),Oa=()=>({width:"220px",height:"42px","border-radius":"10px",margin:"0",display:"block"}),Ra=()=>({width:"168px",height:"42px","border-radius":"50px",margin:"0",display:"block"}),ka=t=>({shadow:t}),Ba=t=>({class:"rindeButton-g nM",value:t}),Ua=()=>({title:"EMPTY_FILTERS_GLOBAL.SEARCH",subtitle:"ADMIN.TEMPLATES.TEMPLATES.FILTER.SEARCH_NO_MATCH",suggest:"EXPENSES.NEW_EXPENSE.SUGGESTION"}),Va=t=>({value:"EMPTY_FILTERS_GLOBAL.CLEAR_FILTERS",class:"rindeButton-o-t nM",loading:t}),Ga=(t,r)=>r.id;function Wa(t,r){if(t&1){let e=M();a(0,"btn-component",11),s(1,"translate"),v("click",function(){E(e);let o=d();return C(o.newTemplate())}),a(2,"span",12),p(3,"+"),l()()}t&2&&T("buttonObject",x(3,Da,c(1,1,"ADMIN.TEMPLATES.TEMPLATES.CREATE_TEMPLATE")))}function ja(t,r){t&1&&(a(0,"div",9)(1,"div",13),u(2,"app-suggested-templates"),l()())}function Ha(t,r){if(t&1){let e=M();a(0,"span",21),v("click",function(){E(e);let o=d(2);return C(o.openHowWorksModal())}),p(1),s(2,"translate"),l()}t&2&&(n(),_(c(2,1,"WORKFLOWS.WORKFLOW.EMPTY_VIEWS.HOW_WORKS")))}function $a(t,r){if(t&1){let e=M();a(0,"btn-component",11),v("click",function(){E(e);let o=d(4);return C(o.retrieveLastFilterDto())}),l()}if(t&2){let e=d(4);T("buttonObject",x(1,wa,e.loading))}}function Xa(t,r){if(t&1){let e=M();a(0,"div")(1,"div",19)(2,"app-filter",22),v("filterElementsOutput",function(o){E(e);let m=d(3);return C(m.filterElements(o))}),a(3,"div",23)(4,"div",24),h(5,$a,1,3,"btn-component",3),l()()()()()}if(t&2){let e=d(3);n(2),T("componentFilterParameters",e.filterParameters),n(3),f(e.filterService.isRestoringFilterOn?5:-1)}}function Ya(t,r){t&1&&(a(0,"div",19)(1,"div",25),u(2,"ngx-skeleton-loader",26)(3,"ngx-skeleton-loader",26),l()()),t&2&&(n(2),T("theme",y(2,Oa)),n(),T("theme",y(3,Ra)))}function Qa(t,r){if(t&1&&h(0,Xa,6,2,"div")(1,Ya,4,4,"div",19),t&2){let e=d(2);f(e.loadingFilter?1:0)}}function qa(t,r){t&1&&u(0,"icons-component",36)}function Ka(t,r){t&1&&u(0,"icons-component",37)}function za(t,r){if(t&1&&(a(0,"div",39),p(1),l()),t&2){let e=d().$implicit;n(),_(e.name)}}function Ja(t,r){t&1&&(a(0,"span",40),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"NO_DATA")))}function Za(t,r){t&1&&(a(0,"span",42),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"COMPANY.CONTADOR.TEMPLATE_BADGE_CONTADOR")))}function el(t,r){if(t&1&&(a(0,"div",44),p(1),l()),t&2){let e=d().$implicit;n(),_(e.fullname)}}function tl(t,r){t&1&&(a(0,"span",40),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"NO_DATA")))}function il(t,r){if(t&1&&(p(0),s(1,"formatDate")),t&2){let e=d().$implicit;g(" ",c(1,1,e.updateTemplateAt)," ")}}function nl(t,r){t&1&&(a(0,"span",40),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"NO_DATA")))}function ol(t,r){if(t&1&&p(0),t&2){let e=d().$implicit;g(" ",e.updateTemplateByUser," ")}}function al(t,r){t&1&&(a(0,"span",40),p(1),s(2,"translate"),l()),t&2&&(n(),_(c(2,1,"NO_DATA")))}function ll(t,r){if(t&1){let e=M();a(0,"div",54),s(1,"translate"),v("click",function(){E(e);let o=d(2).$implicit,m=d(4);return C(m.contadorService.hasReplicableCompanies&&m.openReplicateTemplateModal(o))}),p(2),s(3,"translate"),l()}if(t&2){let e=d(6);se("disabled",!e.contadorService.hasReplicableCompanies),T("matTooltip",c(1,5,"COMPANY.CONTADOR.NO_COMPANIES_TOOLTIP"))("matTooltipDisabled",e.contadorService.hasReplicableCompanies),n(2),g(" ",c(3,7,"COMPANY.CONTADOR.REPLICATE_TEMPLATE_BTN")," ")}}function rl(t,r){if(t&1){let e=M();a(0,"div",47),v("click",function(o){E(e);let m=d(5);return C(m.stylingService.stopPropagation(o))}),a(1,"div",48,1),v("click",function(){E(e);let o=d().$implicit,m=d(4);return C(m.stylingService.openCloseDotsMenu(o.id))}),u(3,"icons-component",49),a(4,"div",50),v("mouseleave",function(){E(e);let o=d().$implicit,m=d(4);return C(m.stylingService.childrenLosesFocusDotsMenu(o.id))}),a(5,"div",51),v("click",function(){E(e);let o=d().$implicit,m=d(4);return C(m.copyTemplate(o.id))}),p(6),s(7,"translate"),l(),a(8,"div",51),v("click",function(){E(e);let o=d().$implicit,m=d(4);return C(m.editTemplate(o.id))}),p(9),s(10,"translate"),l(),a(11,"div",51),v("click",function(){E(e);let o=d().$implicit,m=d(4);return C(m.editTemplateName(o.name,o.id))}),p(12),s(13,"translate"),l(),h(14,ll,4,9,"div",52),a(15,"div",53),v("click",function(){E(e);let o=d().$implicit,m=d(4);return C(m.deleteTemplate(o))}),p(16),s(17,"translate"),l()()()()}if(t&2){let e=d().$implicit,i=d(4);n(),T("id","menu"+e.id),n(2),T("type","listDotMenu"),n(3),_(c(7,7,"ADMIN.TEMPLATES.TE
1MPLATES.COPY_TEMPLATE")),n(3),_(c(10,9,"ADMIN.TEMPLATES.TEMPLATES.EDIT_TEMPLATE")),n(3),g(" ",c(13,11,"ADMIN.TEMPLATES.TEMPLATES.EDIT_TEMPLATE_NAME")," "),n(2),f(i.contadorService.isContador?14:-1),n(2),_(c(17,13,"ADMIN.TEMPLATES.TEMPLATES.DELETE_TEMPLATE"))}}function sl(t,r){if(t&1){let e=M();a(0,"div",47),v("click",function(o){E(e);let m=d(5);return C(m.stylingService.stopPropagation(o))}),a(1,"div",55),u(2,"div",56),l()()}}function pl(t,r){if(t&1){let e=M();a(0,"div",34),v("click",function(){let o=E(e).$implicit,m=d(4);return C(!m.copyingTemplates[o.id]&&m.editTemplate(o.id))}),a(1,"div",35),h(2,qa,1,0,"icons-component",36),h(3,Ka,1,0,"icons-component",37),a(4,"div",38),h(5,za,2,1,"div",39)(6,Ja,3,3,"span",40),a(7,"div",2)(8,"span",41),p(9),s(10,"formatDate"),l(),h(11,Za,3,3,"span",42),l()()(),a(12,"div",43),h(13,el,2,1,"div",44)(14,tl,3,3,"span",40),l(),a(15,"div",45),h(16,il,2,3)(17,nl,3,3,"span",40),l(),a(18,"div",45),h(19,ol,1,1)(20,al,3,3,"span",40),l(),h(21,rl,18,15,"div",46)(22,sl,3,0,"div",46),l()}if(t&2){let e=r.$implicit,i=d(4);T("id",e.id),n(2),f(e.fileType===1?2:-1),n(),f(e.fileType===2?3:-1),n(2),f(e.name?5:6),n(4),_(c(10,10,e.createTemplateAt)),n(2),f(i.isReplicatedByAccountant(e)?11:-1),n(2),f(e.fullname?13:14),n(3),f(e.updateTemplateAt?16:17),n(3),f(e.updateTemplateByUser?19:20),n(2),f(i.copyingTemplates[e.id]?22:21)}}function cl(t,r){if(t&1){let e=M();kt(0),a(1,"div",19)(2,"div",27)(3,"div",28)(4,"div",29),p(5),s(6,"translate"),l(),a(7,"div",30),p(8),s(9,"translate"),l(),a(10,"div",30),p(11),s(12,"translate"),l(),a(13,"div",30),p(14),s(15,"translate"),l()()(),a(16,"div",31),v("scrolled",function(){E(e);let o=d(3);return C(o.onScroll())}),P(17,pl,23,12,"div",32,Ga),l()(),u(19,"div",33),Bt()}if(t&2){let e=d(3);n(2),T("ngClass",x(15,ka,e.stylingService.shadowStickyTop)),n(3),_(c(6,7,"ADMIN.TEMPLATES.TEMPLATES.NAME")),n(3),_(c(9,9,"ADMIN.TEMPLATES.TEMPLATES.CREATED_BY")),n(3),_(c(12,11,"ADMIN.VALIDATIONS.UPDATED_AT")),n(3),_(c(15,13,"ADMIN.TEMPLATES.TEMPLATES.MODIFIED_BY")),n(2),T("infiniteScrollDistance",1)("infiniteScrollThrottle",300),n(),N(e.templateService.templates)}}function dl(t,r){if(t&1){let e=M();a(0,"div",58)(1,"div",59),u(2,"icons-component",49),a(3,"div",60)(4,"div",16),p(5),s(6,"translate"),l(),u(7,"div",61),s(8,"translate"),l(),a(9,"btn-component",11),s(10,"translate"),v("click",function(){E(e);let o=d(4);return C(o.newTemplate())}),l()()(),a(11,"div",62)(12,"div",63)(13,"div",64),p(14),s(15,"translate"),l(),u(16,"div",61),s(17,"translate"),l(),a(18,"div",63)(19,"div",64),p(20),s(21,"translate"),l(),u(22,"div",61),s(23,"translate"),l(),a(24,"div",63)(25,"div",64),p(26),s(27,"translate"),l(),u(28,"div",61),s(29,"translate"),u(30,"div",61),s(31,"translate"),l()()}t&2&&(n(2),T("type","noTemplates"),n(3),_(c(6,11,"ADMIN.TEMPLATES.TEMPLATES.EMPTY_TEMPLATES_TITLE")),n(2),T("innerHTML",c(8,13,"ADMIN.TEMPLATES.TEMPLATES.EMPTY_TEMPLATES_SUBTITLE"),G),n(2),T("buttonObject",x(31,Ba,c(10,15,"ADMIN.TEMPLATES.NEW_TEMPLATE.PLUS_CREATE_TEMPLATE"))),n(5),_(c(15,17,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.TITLE")),n(2),T("innerHTML",c(17,19,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.DESCRIPTION"),G),n(4),_(c(21,21,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.CREATE_TEMPLATE")),n(2),T("innerHTML",c(23,23,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.CREATE_TEMPLATE_DESCRIPTION"),G),n(4),_(c(27,25,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.TEMPLATE_TYPES")),n(2),T("innerHTML",c(29,27,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.EXCEL_TEMPLATE_DESCRIPTION"),G),n(2),T("innerHTML",c(31,29,"ADMIN.TEMPLATES.TEMPLATES.INSTRUCTION_CARDS.PDF_TEMPLATE_DESCRIPTION"),G))}function ml(t,r){if(t&1){let e=M();a(0,"div",57),u(1,"div",65),a(2,"app-empty-views",66),u(3,"icons-component",49),l(),u(4,"div",67)(5,"div",68),s(6,"translate"),a(7,"btn-component",11),v("click",function(){E(e);let o=d(4);return C(o.clearFilters())}),l()()}if(t&2){let e=d(4);n(2),T("emptyViewObject",y(6,Ua)),n(),T("type","noUserFound"),n(2),T("innerHTML",c(6,4,"ADMIN.TEMPLATES.TEMPLATES.FILTER.SUGGEST_DETAIL"),G),n(2),T("buttonObject",x(7,Va,e.loading))}}function Tl(t,r){if(t&1&&h(0,dl,32,33)(1,ml,8,9,"div",57),t&2){let e=d(3);f(e.enableClearFilterButton?1:0)}}function _l(t,r){if(t&1&&h(0,cl,20,17,"ng-container")(1,Tl,2,1),t&2){let e=d(2);f(e.templateService.templates.length>0?0:1)}}function ul(t,r){t&1&&(a(0,"div",19)(1,"div",69)(2,"div",28)(3,"div",29),p(4),s(5,"translate"),l(),a(6,"div",30),p(7),s(8,"translate"),l(),a(9,"div",30),p(10),s(11,"translate"),l(),a(12,"div",30),p(13),s(14,"translate"),l()()(),a(15,"div",70),u(16,"app-templates-skeleton"),l()()),t&2&&(n(4),_(c(5,4,"ADMIN.TEMPLATES.TE
1MPLATES.NAME")),n(3),_(c(8,6,"ADMIN.TEMPLATES.TEMPLATES.CREATED_BY")),n(3),_(c(11,8,"ADMIN.VALIDATIONS.UPDATED_AT")),n(3),_(c(14,10,"ADMIN.TEMPLATES.TEMPLATES.MODIFIED_BY")))}function El(t,r){t&1&&(a(0,"div",20),u(1,"app-templates-skeleton",71),l()),t&2&&(n(),T("rows",3))}function Cl(t,r){if(t&1&&(a(0,"div",9)(1,"div",14)(2,"div",15)(3,"div",16),p(4),s(5,"translate"),l(),a(6,"div",17)(7,"span"),p(8),s(9,"translate"),l(),h(10,Ha,3,3,"span",18),l()(),h(11,Qa,2,1),h(12,_l,2,1)(13,ul,17,12,"div",19),h(14,El,2,1,"div",20),l()()),t&2){let e=d();n(4),_(c(5,6,"ADMIN.TEMPLATES.TEMPLATES.TITLE_V2")),n(4),_(c(9,8,"ADMIN.TEMPLATES.TEMPLATES.DESCRIPTION")),n(2),f(e.templateService.templates.length>0?10:-1),n(),f(e.templateService.templates.length>0||e.enableClearFilterButton||e.loadingFilter?11:-1),n(),f(e.loading?13:12),n(2),f(e.loadingScroll?14:-1)}}function hl(t,r){t&1&&u(0,"app-filter-and-list",72)}var Li=(()=>{class t{constructor(e,i,o,m,S,w,b,$,ne,Oe,ye,Se,pe,Re,gt){this.translateService=e,this.stylingService=i,this.formBuilder=o,this.globalModalService=m,this.templateService=S,this.translate=w,this.alertService=b,this.router=$,this.selectControllerService=ne,this.authService=Oe,this.filterService=ye,this.snackService=Se,this.contadorService=pe,this.companyService=Re,this.activatedRoute=gt,this.cdr=I(k),this.loading=!1,this.loadingFilter=!0,this.loadingScroll=!1,this.copyingTemplates={},this.tabSelector=1,this.filterType=Ze,this.filterParameters=[],this.moreFilters=!1,this.enableClearFilterButton=!1,this.enableFilterButton=!1,this.filterDto={limit:20},this.offset=0,this.append=!1,this.warningAlert={}}async ngOnInit(){this.authService.checkUserPermissions(),this.loading=!0,this.cdr.markForCheck(),await this.getTemplates(),this.createtemplatesForm(),this.selectControllerService.setTemplatesType(),await this.setFilterParameters(),this.contadorService.isContador&&await this.contadorService.loadReplicableCompanies(),this.loading=!1,this.cdr.markForCheck(),this.loadingFilter=!1,this.cdr.markForCheck(),this.queryParamsSub=this.activatedRoute.queryParamMap.subscribe(e=>{e.get("quickTemplate")==="1"&&(this.router.navigate([],{queryParams:{quickTemplate:null},queryParamsHandling:"merge",replaceUrl:!0}),this.openQuickTemplateFromBanner()),this.cdr.markForCheck()})}ngOnDestroy(){this.queryParamsSub?.unsubscribe()}openQuickTemplateFromBanner(){this.globalModalService.replaceModal({type:"quickTemplate",styles:"modal-background banner-anchored",component:xi})}async createtemplatesForm(){this.templatesForm=this.formBuilder.group({type:[null],name:[null],creationDate:[null],createdBy:[null]})}async copyTemplate(e){this.copyingTemplates[e]=!0;let i=await this.templateService.getTemplate(e),o={name:"Copia de "+i.name,type:i.fileType.toString()};await this.templateService.createTemplate(o);let m={id:this.templateService.template.id,headers:i.headers,values:i.values};await this.templateService.updateTemplate(m),this.snackService.showSnackNotification({type:"success",message:this.translate.instant("SNACK.TEMPLATE_COPIED_SUCCESSFULLY")}),this.append=!1,this.filterDto.limit=this.templateService.templates.length>20?this.templateService.templates.length:20,this.offset=0,await this.getTemplates(),this.copyingTemplates[e]=!1}
1editTemplateName(e,i){this.globalModalService.params={type:"editTemplateName",styles:"modal-background",templateName:e,templateId:i,from:"templates",component:ft},this.globalModalService.showModal()}editTemplate(e){this.router.navigate(["/admin/templates/template",e])}openReplicateTemplateModal(e){this.globalModalService.params={type:"replicateTemplate",styles:"modal-background",templateId:e.id,templateName:e.name,component:we},this.globalModalService.showModal()}isReplicatedByAccountant(e){return!!e?.isReplicatedByAccountant}newTemplate(){this.globalModalService.params={type:"newTemplate",styles:"modal-background",component:ve},this.globalModalService.showModal()}async deleteTemplate(e){this.warningAlert.title=this.translate.instant("MESSAGE_ALERT.WAIT"),this.warningAlert.message=this.translate.instant("MESSAGE_ALERT.DELETE_TEMPLATE.MESSAGE",{templateName:e.name}),this.warningAlert.confirmButton=this.translate.instant("TOOLTIP.DELETE_FILE"),this.warningAlert.cancelButton=this.translate.instant("MESSAGE_ALERT.CANCEL_BUTTON"),this.warningAlert.rowButtons=!0,await this.alertService.warning(this.warningAlert),this.alertService.confirmedAlert&&await this.templateService.deleteTemplate(e.id)&&(this.snackService.showSnackNotification({type:"success",message:this.translate.instant("SNACK.TEMPLATE_DELETED_SUCCESSFULLY")}),this.templateService.templates=this.templateService.templates.filter(o=>o.id!==e.id))}showMoreFilters(){this.moreFilters=!this.moreFilters}async filterTemplates(){this.loading=!0,this.cdr.markForCheck(),this.enableFilterButton=!1,this.enableClearFilterButton=!0,await this.setTemplateFilter(),await this.getTemplates(),this.loading=!1,this.cdr.markForCheck()}async setTemplateFilter(){this.templatesForm.value.name&&(this.filterDto.name=this.templatesForm.value.name),this.templatesForm.value.type&&(this.filterDto.type=this.templatesForm.value.type),this.templatesForm.value.creationDate&&(this.filterDto.creationDate=this.templatesForm.value.creationDate),this.templatesForm.value.createdBy&&(this.filterDto.userName=this.templatesForm.value.createdBy),this.filterDto.limit=20,this.offset=0,this.append=!1}async onScroll(){this.append=!0,this.filterDto.limit=20;let e=this.offset;this.offset=this.templateService.templates.length,e!==this.offset&&(this.loadingScroll=!0,this.cdr.markForCheck(),await this.getTemplates(),this.loadingScroll=!1,this.cdr.markForCheck())}async clearFilters(){this.loading=!0,this.cdr.markForCheck(),this.filterDto={},this.offset=0,this.append=!1,this.filterDto.limit=20,this.templatesForm.reset(),this.filterService.resetAll(),await this.templateService.getCompanyTemplates(this.offset,this.append,this.filterDto),this.enableClearFilterButton=!1,this.loading=!1,this.cdr.markForCheck()}async getTemplates(){await this.templateService.getCompanyTemplates(this.offset,this.append,this.filterDto)}openHowWorksModal(){this.globalModalService.params={type:"howWorks",styles:"modal-popUp widthAdd",component:gi},this.globalModalService.showModal()}retrieveLastFilterDto(){this.loading||(this.filterService.retrieveLastFilterDto(),this.filterElements(this.filterService.filterDto))}async filterElements(e){this.loading||(this.loading=!0,this.cdr.markForCheck(),this.offset=0,this.enableClearFilterButton=!0,this.filterDto!==e&&(this.append=!1),Object.keys(e).length>0?(this.filterDto=structuredClone(e),this.filterDto.limit=20,await this.templateService.getCompanyTemplates(this.offset,this.append,this.filterDto),this.append=!0):(this.filterDto={},this.filterDto.limit=20,this.append=!1,await this.templateService.getCompanyTemplates(this.offset,this.append,this.filterDto)),this.loading=!1,this.cdr.markForCheck(),this.filterService.storeFilter())}async setFilterParameters(){this.filterParameters=[{items:null,type:"main",dtoName:"name",label:"ADMIN.TEMPLATES.TEMPLATES.FILTER.TEMPLATE_NAME",placeholder:"ADMIN.TEMPLATES.TEMPLATES.FILTER.TEMPLATE_NAME"},{items:this.selectControllerService.templatesType,type:"select",dtoName:"type",label:"EXPENSES.EXPENSE.FORMAT",placeholder:"EXPENSES.EXPENSE.FORMAT"},{items:null,type:"date",dtoName:"",label:"POLICIES.CREATE_DATE",placeholder:"POLICIES.CREATE_DATE"}],this.filterService.enableClearAll=!0,this.filterService.setFilterByComponent(Ze.TEMPLATES,!1),this.filterService.filterActive=!0,this.filterService.inContent=!1,this.filterService.filterType=Ze.TEMPLATES,this.filterService.checkIfFilterStored()}static{this.\u0275fac=function(i){return new(i||t)(A(V),A(le),A(ae),A(B),A(q),A(V),A(Ie),A(oe),A(be),A($t),A(ti),A(Q),A(re),A(de),A(tt))}}static{this.\u0275cmp=F({type:t,selectors:[["app-templates-module"]],standalone:!1,decls:18,vars:15,consts:[["stillLoadingFilter",""],["menuSelection",""],[1,"flex","ai-c","gap-8"],[3,"buttonObject"],[1,"pd-24-l","pd-24-t","pd-24-r"],[1,"bankDetail
1s"],[1,"flex","jc-sb","ai-c","mx-auto","max-w-[1920px]"],[1,"flex"],[1,"innerTabs","asbestos",3,"click","ngClass"],[1,"mg-24-l","mg-24-r"],[1,"pAbsolute"],[3,"click","buttonObject"],["before",""],[1,"bg-white","br-10","mx-auto","max-w-[1920px]","gminh",2,"--gminh","500"],[1,"bg-white","br-10-tab1st","mx-auto","max-w-[1920px]","gminh",2,"--gminh","500"],[1,"pd-24","flex","fd-c","gap-8"],[1,"bigger","bold"],[1,"sub-header-1","flex","gap-6"],[1,"blue","pointer"],[1,"mg-24-l","mg-24-r","mg-24-b","br-10","border","border-solid","border-black20"],[1,"mg-24-l","mg-24-r","mg-24-b","rGridList","bodyList","noChildMargin","mg-0"],[1,"blue","pointer",3,"click"],[3,"filterElementsOutput","componentFilterParameters"],["changeDisplay",""],[1,"flex","ai-c","gap-24","mg-1-t"],[1,"flex","ai-c","gap-16","py-16","pd-24-sides","box-bb","min-h-[74px]"],[3,"theme"],[1,"rGridList","headList","noMargin",3,"ngClass"],[1,"gridItem","head","nM","pd-16-tb","pd-24-sides"],[1,"gridCol","sp7"],[1,"gridCol","sp4"],["infiniteScroll","",1,"rGridList","bodyList","noChildMargin","mg-0",3,"scrolled","infiniteScrollDistance","infiniteScrollThrottle"],[1,"gridItem",3,"id"],[1,"h-[1px]"],[1,"gridItem",3,"click","id"],["isEllipsis","",1,"gridCol","sp7","flex"],["type","excel",1,"bg-clouds","br-10"],["type","pdf",1,"bg-clouds","br-10"],[1,"w-[80%]"],["isEllipsis","",1,"textCheck","bold"],[1,"noData"],[1,"small","gray70"],[1,"small","text-black50","bg-black10","br-8","px-8","py-2"],["isEllipsis","",1,"gridCol","sp4","flex"],["isEllipsis","",1,"textCheck"],[1,"gridCol","sp4","flex"],[1,"gridCol","sp1","menu","noHide"],[1,"gridCol","sp1","menu","noHide",3,"click"],[1,"endListMenu","moreMenu",3,"click","id"],[3,"type"],[1,"dropDown",3,"mouseleave"],[1,"opt",3,"click"],["matTooltipPosition","left",1,"opt",3,"disabled","matTooltip","matTooltipDisabled"],[1,"opt","orange",3,"click"],["matTooltipPosition","left",1,"opt",3,"click","matTooltip","matTooltipDisabled"],[1,"endListMenu","pos-r","mg-a-l","flex","jc-fe","ai-c"],[1,"spinner-b","inline"],[1,"fullEmptyComponent"],[1,"ta-c","bg-blueLight","border-1-s-blue","pd-40","mg-24-l","mg-24-r","mg-24-b","br-10"],[1,"flex","fd-c","jc-c","ai-c","gap-24"],[1,"flex","fd-c","jc-c","ai-c","gap-8"],[3,"innerHTML"],[1,"flex","gap-24","mg-24-r","mg-24-l","mg-24-b"],[1,"bg-white","flex","fx-1","fd-c","pd-24","gap-16","br-10"],[1,"text-blue","bold"],[1,"h-48"],[3,"emptyViewObject"],[1,"h-8"],[1,"sug_detail",3,"innerHTML"],[1,"rGridList","headList","noMargin","noSticky"],[1,"rGridList","bodyList","noChildMargin","mg-0"],[3,"rows"],["type","filter"]],template:function(i,o){i&1&&(a(0,"app-breadcrumbs")(1,"div",2),h(2,Wa,4,5,"btn-component",3),l()(),a(3,"div",4)(4,"div",5)(5,"div",6)(6,"div",7)(7,"div",8),v("click",function(){return o.tabSelector=1}),p(8),s(9,"translate"),l(),a(10,"div",8),v("click",function(){return o.tabSelector=2}),p(11),s(12,"translate"),l()()()()(),h(13,ja,3,0,"div",9),h(14,Cl,15,10,"div",9),Y(15,hl,1,0,"ng-template",null,0,Ye),u(17,"app-go-top",10)),i&2&&(n(2),f(o.tabSelector===1?2:-1),n(5),T("ngClass",x(11,Ii,o.tabSelector===1)),n(),g(" ",c(9,7,"ADMIN.TEMPLATES.TEMPLATES.TITLE_V2")," "),n(2),T("ngClass",x(13,Ii,o.tabSelector===2)),n(),g(" ",c(12,9,"ADMIN.TEMPLATES.SUGGESTED.TITLE")," "),n(2),f(o.tabSelector===2?13:-1),n(),f(o.tabSelector===1?14:-1))},dependencies:[Pe,W,rt,zt,st,pt,ct,ei,ii,ri,li,j,O,St,D,Jt],encapsulation:2,changeDetection:0})}}return t})();var fl=[{path:"",component:Li,data:{breadcrumb:"ADMIN.TEMPLATES.TEMPLATES.TITLE"}},{path:"template/:id",component:vi,canDeactivate:[si],data:{breadcrumb:[{label:"ADMIN.TEMPLATES.TEMPLATES.TITLE",url:"/admin/templates"},{label:"ADMIN.TEMPLATES.TEMPLATES.EDIT_TEMPLATE",newLabel:"ADMIN.TEMPLATES.NEW_TEMPLATE.TITLE",newQueryParam:"fromNewTemplate"}]}},{path:"",redirectTo:"",pathMatch:"full"},{path:"**",redirectTo:"",pathMatch:"full"}],bi=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=Ve({type:t})}static{this.\u0275inj=Ue({imports:[xt.forChild(fl),xt]})}}return t})();var vl=[mt,Tt,ut,Et,_t],pp=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=Ve({type:t})}static{this.\u0275inj=Ue({imports:[Pe,H,bi,vl,St]})}}return t})();
1export{pp as TemplatesModuleModule};

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.