1import{a as ce}from"./chunk-UV44MRQP.js";import{a as ae}from"./chunk-CD2CGC5S.js";import{a as W}from"./chunk-ZW5B5J3B.js";import"./chunk-GCE2MEC6.js";import{a as de}from"./chunk-UGA23ICO.js";import{a as me}from"./chunk-NGCQOK2V.js";import{a as se}from"./chunk-DQPLM2C5.js";import"./chunk-MIHC4Y75.js";import{b as H}from"./chunk-SB5L2XE4.js";import{A as oe,D as le,b as J,c as K,g as X,h as Y,j as Z,l as ee,m as te,s as ie,t as ne,u as re}from"./chunk-ICJV4PL6.js";import{a as Q}from"./chunk-RIRGXRXY.js";import"./chunk-3GN2FC7K.js";import{t as q}from"./chunk-47CSRN7C.js";import{c as $}from"./chunk-SKH2MXBC.js";import{i as N,j as P,k as D,o as j,v as z}from"./chunk-BQLJE42W.js";import{$b as L,Db as v,Ib as f,Jb as d,Pa as B,Pb as I,Qa as h,Qb as k,Rb as w,Sb as x,Tb as c,Ub as V,Vb as y,Xa as s,Ya as S,Zb as E,_b as G,bc as U,da as T,dc as M,gc as F,hc as O,ib as _,k as A,kc as R,mb as a,na as u,oa as b,v as C,xb as o,yb as l,zb as m}from"./chunk-YE3BF7DR.js";import"./chunk-4IDNTCH7.js";var _e=["form"],ue=["formGlobal"],be=n=>({"isDisabled disable":n});function fe(n,t){n&1&&(o(0,"span"),c(1,"Debes ingresar una url"),l())}function ge(n,t){if(n&1&&(o(0,"div",33),_(1,fe,2,0,"span",12),l()),n&2){let e;d();let i=x(6);s(),a("ngIf",(e=i.form.get("url"))==null||e.errors==null?null:e.errors.required)}}function ve(n,t){if(n&1){let e=v();o(0,"div",34),c(1," Ocultar "),o(2,"div",35)(3,"input",36),f("ngModelChange",function(){u(e);let r=d(2);return b(r.changeRemoveSite())}),l(),o(4,"div",37),m(5,"span"),l()(),o(6,"p"),c(7,"Solo podr\xE1s ocultar los banners GOV.CO que no sean obligatorios"),l()()}if(n&2){let e=d(2);s(3),a("ngModel",e.editGlobal.removeBySite)}}function he(n,t){if(n&1){let e=v();o(0,"div",20)(1,"div",21)(2,"div",22),f("click",function(){u(e);let r=d();return b(r.editGlobal=null)}),m(3,"i",23),l(),o(4,"div",24)(5,"form",25,2),f("ngSubmit",function(){u(e);let r=d();return b(r.saveGlobal())}),o(7,"div",26),c(8,"Esto es un banner GOV.CO"),l(),o(9,"div",27),c(10,"Enlace"),l(),o(11,"div",28),c(12," Para agregar un enlace externo use http:// o https:// antes del v\xEDnculo. "),m(13,"br"),o(14,"b"),c(15,"Ejemplo: http://www.gmail.com"),l()(),o(16,"div",28),c(17," Para agregar un enlace dentro de su sitio territorial use / y luego la secci\xF3n "),m(18,"br"),o(19,"b"),c(20,"Ejemplo: /Noticias"),l()(),o(21,"input",29),L("ngModelChange",function(r){u(e);let p=d();return G(p.editGlobal.customUrl,r)||(p.editGlobal.customUrl=r),b(r)}),l(),_(22,ge,2,1,"div",30)(23,ve,8,1,"div",31),m(24,"br")(25,"br"),o(26,"button",32),c(27,"Aceptar"),l()()()()()}if(n&2){let e,i=x(6),r=d();s(21),E("ngModel",r.editGlobal.customUrl),s(),a("ngIf",((e=i.form.get("url"))==null?null:e.invalid)&&r.formGlobalSubmitted),s(),a("ngIf",!r.editGlobal.isRequired),s(3),a("disabled",r.formGlobalIsBusy)}}function Se(n,t){n&1&&m(0,"div")}function xe(n,t){if(n&1&&(o(0,"div"),_(1,Se,1,0,"div",38),l()),n&2){d();let e=x(31);s(),a("ngTemplateOutlet",e)}}function ye(n,t){if(n&1){let e=v();o(0,"div",53),f("click",function(){u(e);let r=d().index,p=d();return b(p.changePosition(r,-1))}),m(1,"i",54),l()}}function Ce(n,t){if(n&1){let e=v();o(0,"div",55),f("click",function(){u(e);let r=d().index,p=d();return b(p.changePosition(r,1))}),m(1,"i",56),l()}}function Be(n,t){if(n&1&&(m(0,"img",57),F(1,"fullPathImage")),n&2){let e=d().$implicit;a("src",O(1,1,e.model.file.imageUrl),h)}}function Ie(n,t){if(n&1&&(o(0,"div",58),m(1,"img",59),l()),n&2){let e=d().$implicit;s(),a("src",e.model.file.urlVideo,h)}}function ke(n,t){if(n&1&&(o(0,"div",60),c(1),l()),n&2){let e=d().$implicit;s(),y("Link:",e.model.link,"")}}function we(n,t){n&1&&m(0,"app-helper",61)}function Ee(n,t){n&1&&m(0,"div",62)}function Ge(n,t){if(n&1&&(o(0,"div")(1,"li",39)(2,"div",40),_(3,ye,2,0,"div",41)(4,Ce,2,0,"div",42),l(),o(5,"div",40)(6,"div",43),c(7),l()(),o(8,"div",40),_(9,Be,2,3,"img",44)(10,Ie,2,1,"div",45),l(),o(11,"div",40),m(12,"div",46)(13,"div",47),_(14,ke,2,1,"div",48),l(),o(15,"div",40),_(16,we,1,0,"app-helper",49),o(17,"a",50),m(18,"i",51),c(19," Editar "),l()()(),_(20,Ee,1,0,"div",52),l()),n&2){let e=t.$implicit,i=t.first,r=t.last,p=t.index,g=d();s(3),a("ngIf",g.bannerList.length>1&&(r||!i)),s(),a("ngIf",g.bannerList.length>1&&(i||!r)),s(3),y(" ",g.getIndex(p,0,e)," "),s(2),a("ngIf",e.model.file.imageUrl),s(),a("ngIf",e.model.file.embedUrl),s(2),a("innerHTML",e.model.title,B),s(),a("innerHTML",e.model.subtitle,B),s(),a("ngIf",e.model.link),s(2),a("ngIf",p===0),s(),a("href","/administrador/banner?id="+e.bannerID,h),s(3),a("ngIf",g.globalPosition==="2"&&i||g.globalPosition==="3"&&r)}}function Le(n,t){if(n&1&&(o(0,"option",65),c(1),l()),n&2){let e=t.$implicit;a("ngValue",e.id),s(),V(e.value)}}function Ae(n,t){if(n&1){let e=v();o(0,"select",63),L("ngModelChange",function(r){u(e);let p=d();return G(p.block.json.rotation,r)||(p.block.json.rotation=r),b(r)}),_(1,Le,2,2,"option",64),l()}if(n&2){let e=d();a("disabled",e.formIsBusy),E("ngModel",e.block.json.rotation),s(),a("ngForOf",e.seconds)}}
1function Te(n,t){if(n&1&&m(0,"img",57),n&2){let e=d().$implicit;a("src",e.model.file.imageUrl,h)}}function Ve(n,t){if(n&1&&(o(0,"div",58),m(1,"img",59),l()),n&2){let e=d().$implicit;s(),a("src",e.model.file.urlVideo,h)}}function Ue(n,t){if(n&1){let e=v();o(0,"li",67)(1,"div",40),m(2,"div",68)(3,"div",69),l(),o(4,"div",40)(5,"div",43),c(6),l()(),o(7,"div",40),_(8,Te,1,1,"img",44)(9,Ve,2,1,"div",45),l(),o(10,"div",70),m(11,"img",71),l(),o(12,"div",40)(13,"a",72),f("click",function(){let r=u(e).$implicit,p=d(2);return b(p.editBannerGlobal(r))}),m(14,"i",51),c(15," Editar "),l()()()}if(n&2){let e=t.$implicit,i=t.index,r=d(2);s(6),y(" ",r.getIndex(i,1,e)," "),s(2),a("ngIf",e.model.file.imageUrl),s(),a("ngIf",e.model.file.embedUrl)}}function Me(n,t){if(n&1&&_(0,Ue,16,3,"li",66),n&2){let e=d();a("ngForOf",e.bannerGlobal)}}var pe=class n{constructor(t,e,i,r,p,g){this.modalService=t;this.helperService=e;this.bannerService=i;this.blocksService=r;this.settingService=p;this.activatedRoute=g}form;formGlobal;bannerFilter={};bannerList=[];bannerGlobal=[];seconds=[];isChangePosition=!1;changeDisabled=!1;block={};counter=0;formIsBusy=!1;formSubmitted=!1;formGlobalIsBusy=!1;formGlobalSubmitted=!1;restIndex;globalPosition;editGlobal;changeValueRemove;originalRemoveSite;ngOnInit(){this.activate()}back(){this.blocksService.goBack(this.activatedRoute.snapshot.params)}bindSeconds(){for(var t=0;t<31;t++)t===0?this.seconds.push({id:t,value:"Sin rotaci\xF3n"}):t>9&&this.seconds.push({id:t,value:t===1?t+" segundo":t+" segundos"})}send(){this.form.valid&&!this.formIsBusy?(this.formIsBusy=!0,this.block.frame=JSON.stringify(this.block.json),C([this.callSaveSort(),this.blocksService.update(this.block)]).subscribe({next:t=>{this.isChangePosition=!1,this.formIsBusy=!1,this.formSubmitted=!1,this.modalService.showAlert("Bloque de banner institucional actualizado")},error:t=>{this.formIsBusy=!1,this.formSubmitted=!1,this.helperService.handlerException(t)}})):this.formSubmitted=!0}getIndex(t,e,i){if(e===1){t===0&&(this.counter=0);var r=this.restIndex.indexOf(i);return i.removeBySite?(this.counter++,'<i class="icon-visibility"></i>'):this.globalPosition==="3"?t+this.bannerList.length+1-this.counter:t+parseInt(this.globalPosition)-this.counter}else return this.globalPosition==="1"?t+1+this.bannerGlobal.length-this.restIndex.length:this.globalPosition==="2"?t===0?t+1:t+1+this.bannerGlobal.length-this.restIndex.length:t+1}saveGlobal(){if(this.formGlobal.valid&&!this.formGlobalIsBusy){this.formGlobalIsBusy=!0;var t={bannerID:this.editGlobal.bannerID,url:this.editGlobal.customUrl?this.editGlobal.customUrl:"",alias:this.settingService.settings.general.siteKeyword};this.bannerService.updateGlobal(t).subscribe({next:e=>{if(this.formGlobalIsBusy=!1,this.formGlobalSubmitted=!1,this.changeValueRemove){var i={bannerID:this.editGlobal.bannerID,alias:this.settingService.settings.general.siteKeyword};this.editGlobal.removeBySite?this.bannerService.disabledGlobal(i).subscribe({next:r=>this.succesfulUpdate(),error:r=>this.errorUpdate(r)}):this.bannerService.enabledGlobal(i).subscribe({next:r=>this.succesfulUpdate(),error:r=>this.errorUpdate(r)})}else this.editGlobal=null,this.activate()},error:e=>{this.formGlobalIsBusy=!1,this.formGlobalSubmitted=!1,this.modalService.showAlert("No se pudo actualizar la informaci\xF3n. Intentalo m\xE1s tarde.")}})}else this.formGlobalSubmitted=!0}errorUpdate(t){this.helperService.handlerException(t)}succesfulUpdate(){this.editGlobal=null,this.activate()}changeRemoveSite(){this.changeValueRemove=this.originalRemoveSite!==this.editGlobal.removeBySite}editBannerGlobal(t){this.editGlobal=t,this.changeValueRemove=!1,this.originalRemoveSite=this.editGlobal.removeBySite,this.editGlobal.isRequired||console.log(this.editGlobal)}checkAvailable(t){return this.bannerList.length<5||t.preventDefault(),!0}activate(){this.bindSeconds(),this.bannerFilter.section="Home",this.blocksService.get(1).subscribe({next:t=>{this.block=t,this.block.json=JSON.parse(t.frame),(this.block.json.rotation===null||this.block.json.rotation===void 0||this.block.json.rotation<10)&&(this.block.json.rotation=0),C([this.bannerService.get(this.bannerFilter),this.bannerService.getGlobal(this.settingService.settings.general.siteKeyword)]).subscribe({next:e=>{this.bannerGlobal=[],this.globalPosition=e[1].position,e[1].banners.forEac
1h((i,r)=>{i.model=JSON.parse(i.body),i.model.file&&i.model.file.imageUrl&&(i.model.file.imageUrl=this.settingService.settings.general.globalApiUrl+i.model.file.imageUrl),i.model.mobile&&i.model.mobile.imageUrl&&(i.model.mobile.imageUrl=this.settingService.settings.general.globalApiUrl+i.model.mobile.imageUrl),i.model.file&&i.model.file.cropImage&&(i.model.file.cropImage=this.settingService.settings.general.globalApiUrl+i.model.file.cropImage),i.model.mobile&&i.model.mobile.cropImage&&(i.model.mobile.cropImage=this.settingService.settings.general.globalApiUrl+i.model.mobile.cropImage),i.customUrl&&(i.model.link=i.customUrl),this.bannerGlobal.push(i)}),this.restIndex=this.bannerGlobal.filter(i=>i.removeBySite),this.setBannerList(e[0])},error:e=>{this.helperService.handlerException(e)}})},error:t=>{this.helperService.handlerException(t)}})}changePosition(t,e){var i=t+e;if(t!==i){var r=this.bannerList[t];this.bannerList.splice(t,1),this.bannerList.splice(i,0,r),this.isChangePosition=!0}}callSaveSort(){if(this.isChangePosition){var t=this.bannerList.map((e,i)=>({bannerID:e.bannerID,position:i}));return this.bannerService.sortArray(t)}else return A(!1)}setBannerList(t){this.bannerList=[],t.results&&t.results.length>0&&(this.activatedRoute.snapshot.params.id===void 0&&t.results.length>5&&this.back(),t.results.forEach((e,i)=>{e.model=JSON.parse(e.body),e.index=i+1,this.bannerList.push(e)}))}static \u0275fac=function(e){return new(e||n)(S(q),S(Q),S(ae),S(se),S($),S(H))};static \u0275cmp=T({type:n,selectors:[["app-admin-list-banners"]],viewQuery:function(e,i){if(e&1&&(I(_e,5),I(ue,5)),e&2){let r;k(r=w())&&(i.form=r.first),k(r=w())&&(i.formGlobal=r.first)}},standalone:!0,features:[U],decls:32,vars:12,consts:[["form","ngForm"],["templateGlobal",""],["formGlobal","ngForm"],["class","modal-wrap","style","z-index:3;",4,"ngIf"],[3,"backEvent"],[1,"content_all"],[1,"setBanner__tit"],[1,"setBanner__txt"],[1,"setBanner__btnAdd","setBanner__btnAdd--lineFlex",3,"click","ngClass","href"],[1,"icon-icon-7"],[3,"key","classname"],[1,"setBanner-order"],[4,"ngIf"],[4,"ngFor","ngForOf"],["novalidate","","name","form",3,"ngSubmit"],[1,"mt40"],["key","19","classname","toolTip-btn toolTip__adminBlock"],["class","setBanner__sel mt10","name","position","name","rotation",3,"disabled","ngModel","ngModelChange",4,"ngIf"],["type","button",1,"btn-main","btn-main--line","mr20",3,"click","disabled"],["type","submit",1,"btn-main","btn-main--line",3,"disabled"],[1,"modal-wrap",2,"z-index","3"],[1,"modal-inner"],[1,"modal__close",3,"click"],[1,"icon-icon-1"],[1,"modal-wrapTxt"],["novalidate","","name","formGlobal",3,"ngSubmit"],[1,"modal__tit"],[1,"modal__subTit"],[1,"modal__txt",2,"text-align","left"],["name","url","type","text","maxlength","250","placeholder","Url",1,"modal__input","ta-c",3,"ngModelChange","ngModel"],["class","error",4,"ngIf"],["class","mt20",4,"ngIf"],["type","submit",1,"modal__btn",3,"disabled"],[1,"error"],[1,"mt20"],[1,"checkCustom-wrap"],["type","checkbox","name","exclude",3,"ngModelChange","ngModel"],[1,"checkCustom-btn"],[4,"ngTemplateOutlet"],[1,"setBanner-orderRow"],[1,"setBanner-orderCol"],["class","setBanner__btnUp",3,"click",4,"ngIf"],["class","setBanner__btnDown",3,"click",4,"ngIf"],[1,"setBanner__orderNum"],["class","setBanner__imgXs",3,"src",4,"ngIf"],["class","preview_img",4,"ngIf"],[1,"setBanner__orderTxt","setBanner__orderTxt--tit",3,"innerHTML"],[1,"setBanner__orderTxt",3,"innerHTML"],["class","setBanner__orderTxt",4,"ngIf"],["key","18","classname","toolTip-btn toolTip__",4,"ngIf"],[1,"setBanner__btnEdit",3,"href"],[1,"icon-icon-10"],["class","setBanner-wGovCo","ng-include","'template-global'",4,"ngIf"],[1,"setBanner__btnUp",3,"click"],[1,"icon-icon-8"],[1,"setBanner__btnDown",3,"click"],[1,"icon-icon-9"],[1,"setBanner__imgXs",3,"src"],[1,"preview_img"],["alt","",3,"src"],[1,"setBanner__orderTxt"],["key","18","classname","toolTip-btn toolTip__"],["ng-include","'template-global'",1,"setBanner-wGovCo"],["name","position","name","rotation",1,"setBanner__sel","mt10",3,"ngModelChange","disabled","ngModel"],[3,"ngValue",4,"ngFor","ngForOf"],[3,"ngValue"],["class","setBanner-orderRow setBanner-orderRow--govCo",4,"ngFor","ngForOf"],[1,"setBanner-orderRow","setBanner-orderRow--govCo"],[1,"setBanner__btnUp"],[1,"setBanner__btnDown"],[1,"setBanner-orderCol",2,"text-align","right"],["width","120","src","../../content/images/logo-gov.svg","alt","",1,"setBanner__logoGov"],["href","",1,"setBanner__btnEdit",3,"click"]],template:function(e,i){if(e&1){let r=v();_(0,he,28,4,"div",3),o(1,"app-admin-header",4),f("backEvent",function(){return u(r),b(i.back())}),l(),m(2,"app-admin-desktop"),o(3,"div",5)(4,"div",6),c(5,"Administraci\xF3n de banners"),l(),o(6,"div",7),c(7,"Agrega y/o edita el contenido de los banners y el orden en que aparecer\xE1n (M\xE1ximo 5 banners)"),l(),o(8,"a",8),f("click",function(g){return u(r),b(i.checkAvailable(g))}
1),m(9,"i",9),c(10," Agregar "),l(),m(11,"app-helper",10),o(12,"ul",11),_(13,xe,2,1,"div",12)(14,Ge,21,11,"div",13),l(),o(15,"form",14,0),f("ngSubmit",function(){return u(r),b(i.send())}),o(17,"div",15)(18,"div",6),c(19,"Duraci\xF3n de rotaci\xF3n "),m(20,"app-helper",16),l(),o(21,"div",7),c(22," Define los segundos que durar\xE1 la rotaci\xF3n autom\xE1ticamente de las im\xE1genes "),l(),_(23,Ae,2,3,"select",17),l(),o(24,"div",15)(25,"button",18),f("click",function(){return u(r),b(i.back())}),c(26," Cancelar "),l(),o(27,"button",19),c(28," Guardar "),l()(),m(29,"div",15),l()(),_(30,Me,1,1,"ng-template",null,1,R)}e&2&&(a("ngIf",i.editGlobal),s(8),a("ngClass",M(10,be,i.bannerList.length>=5))("href","/administrador/banner?count="+i.bannerList.length,h),s(3),a("key",16)("classname","toolTip-btn toolTip__addBanner"),s(2),a("ngIf",i.globalPosition==="1"),s(),a("ngForOf",i.bannerList),s(9),a("ngIf",i.block==null?null:i.block.json),s(2),a("disabled",i.formIsBusy),s(2),a("disabled",i.formIsBusy))},dependencies:[z,N,P,D,j,le,te,ne,re,K,J,ie,X,Y,oe,ee,Z,de,me,W,ce]})};export{pe as AdminListBannersComponent};
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.