1"use strict";(self.webpackChunkwebB=self.webpackChunkwebB||[]).push([[4093],{4093:(U,v,n)=>{n.r(v),n.d(v,{RedeemcenterNoGroupComponent:()=>M});var C=n(1797),y=n(467),e=n(4438),a=n(9417),F=n(9941),k=n(272),S=n(4830),d=n(4331),c=n(1526),g=n(6072),p=n(969),h=n(4031);let j=(()=>{class r{constructor(t){this.modalService=t,this.heightMap="800px",this.widthMap="100%",this.center={lat:12.5757842,lng:-84.7029384},this.zoom=7,this.markerPosition={}}ngOnInit(){const{ubication:t}=this.modalService.getData();t&&(this.markerPosition=t)}move(t){null!=t.latLng&&(this.display=t.latLng.toJSON())}addMarker(t){this.markerPosition=t.latLng.toJSON(),setTimeout(()=>{this.modalService.close(this.markerPosition)},500)}static{this.\u0275fac=function(i){return new(i||r)(e.rXU(h.W))}}static{this.\u0275cmp=e.VBU({type:r,selectors:[["app-google-map"]],standalone:!0,features:[e.aNF],decls:4,vars:5,consts:[["marker","mapMarker"],["id","mapa"],[3,"mapMousemove","mapClick","height","width","center","zoom"],[3,"position"]],template:function(i,o){if(1&i){const s=e.RV6();e.j41(0,"div",1)(1,"google-map",2),e.bIt("mapMousemove",function(u){return e.eBV(s),e.Njj(o.move(u))})("mapClick",function(u){return e.eBV(s),e.Njj(o.addMarker(u))}),e.nrm(2,"map-marker",3,0),e.k0s()()}2&i&&(e.R7$(),e.Y8G("height",o.heightMap)("width",o.widthMap)("center",o.center)("zoom",o.zoom),e.R7$(),e.Y8G("position",o.markerPosition))},dependencies:[p.rJ,p.u6,p.fU]})}}return r})();var l=n(299),b=n(3115);let T=(()=>{class r{constructor(t,i,o,s){this.fb=t,this.toastService=i,this.modalService=o,this.redeemCenterService=s,this.saving=!1,this.departments=[],this.optiones=[],this.isUpdate=!1,this.form=t.group({name:["",a.k0.required],code:[0,a.k0.required],department:["",a.k0.required],municipality:["",a.k0.required],latitude:["",a.k0.required],longitude:["",a.k0.required],active:[!0,a.k0.required]}),(0,e.QZP)(()=>{(0,l.JK)()&&(0,l.JK)().lat&&(0,l.JK)().lng&&(this.form.get("latitude").setValue((0,l.JK)().lat),this.form.get("longitude").setValue((0,l.JK)().lng))})}ngOnDestroy(){l.JK.set(null)}ngOnInit(){const t=this.modalService.getData();if(k.Ay.getStatesOfCountry("NI").forEach(o=>{this.departments.push({value:o.isoCode,keyword:o.name})}),t){this.isUpdate=!0,this.dataId=t.redemptionCenterId;const o=this.departments.filter(s=>s.keyword.toLowerCase()===t.department.toLowerCase());o.length>0&&this.setMunicipalities(o[0].value),this.form.setValue({name:t.name,code:t.code,department:t.department,municipality:t.municipality,latitude:t.latitude,longitude:t.longitude,active:t.active})}else this.currentDepartment=this.departments[0].value,this.setMunicipalities(this.currentDepartment)}setMunicipalities(t){const i=S.A.getCitiesOfState("NI",t);this.optiones=[],i.forEach(o=>{this.optiones.push({value:o.name,keyword:o.name})}),"AN"===t&&this.optiones.push({value:"Rosita",keyword:"Rosita"})}add(){var t=this;return(0,y.A)(function*(){const i={name:t.form.get("name").value,code:String(t.form.get("code").value),department:t.form.get("department").value,municipality:t.form.get("municipality").value,latitude:t.form.get("latitude").value,longitude:t.form.get("longitude").value,active:t.form.get("active").value};6===i.code.length?(t.saving=!0,t.isUpdate?yield t.redeemCenterService.updateRedeemCenter(t.dataId,i).then(()=>{t.saving=!1,t.modalService.close(!0),t.toastService.showToast(d.y.info,g.H.RCUpdated)}):yield t.redeemCenterService.createRedeemCenter(i).then(o=>{t.saving=!1,t.modalService.close(!0),t.toastService.showToast(d.y.info,g.H.RCCreated)}).catch(o=>{t.saving=!1,o.error.hasOwnProperty("message")&&"Los datos del centro de canje no son v\xe1lidos."===o.error.message&&t.toastService.showToast(d.y.danger,c.zF.badCoordinates)})):t.toastService.showToast(d.y.danger,c.zF.codeRCIncorrect)})()}departmanetSelected(t){this.form.get("department").setValue(t.keyword),this.currentDepartment!==t.value&&this.setMunicipalities(t.value)}getUbication(){navigator.geolocation?navigator.geolocation.getCurrentPosition(t=>{const i=t.coords.latitude,o=t.coords.longitude;this.form.get("latitude").setValue(i),this.form.get("longitude").setValue(o)}):this.toastService.showToast(d.y.danger,c.zF.geolocalitationNoSuported)}openGM(){this.modalService.open(j,{title:"Seleccionar una ubicaci\xf3n",maximize:!1,width:"90%",data:{ubication:""!==this.form.get("latitude").value&&""!==this.form.get("longitude").value?{lat:this.form.get("latitude").value,lng:this.form.get("longitude").value}:null},useSuscribe:!1})}static{this.\u0275fac=function(i){return new(i||r)(e.rXU(a.ok),e.rXU(d.m),e.rXU(h.W),e.rXU(b._))}}static{this.\u0275cmp=e.VBU({type:r,selectors:[["app-add-or-edit"]],standalone:!0,features:[e.aNF],decls:69,vars:7,consts:[[3,"submit","formGroup"],[1,"row"],[1,"col-12"],[1,"cfield"],["for","name"],[1,"required"],["id","name","formControlName","name","type","text",1,"styleInput"],[1,"asteric"],["
1id","name","formControlName","code","type","text",1,"styleInput"],["for",""],["theme","form","id","DEPARTMENTS",3,"Selected","itemSelected","optiones"],["theme","form","id","MUNICIPALITIES",3,"Selected","itemSelected","optiones"],[1,"col-12","col-md-3"],["type","number","formControlName","latitude",1,"styleInput"],["type","number","formControlName","longitude",1,"styleInput"],[1,"col-12","col-md-6"],[1,"btnG"],["type","button",1,"styleButton",3,"click"],[1,"row","mt-3","mb-3"],[1,"d-flex","flex-row"],["type","checkbox","formControlName","active",2,"margin-right","5px","cursor","pointer"],["for","",1,"styleP"],[1,"mt-5","d-flex","justify-content-center"],["type","submit",1,"styleButton",2,"width","150px",3,"disabled"]],template:function(i,o){1&i&&(e.j41(0,"form",0),e.bIt("submit",function(){return o.add()}),e.j41(1,"div",1)(2,"div",2)(3,"div",3)(4,"label",4),e.EFF(5,"Nombre"),e.k0s(),e.j41(6,"div",5),e.nrm(7,"input",6),e.j41(8,"span",7),e.EFF(9,"*"),e.k0s()()()()(),e.j41(10,"div",1)(11,"div",2)(12,"div",3)(13,"label",4),e.EFF(14,"C\xf3digo"),e.k0s(),e.j41(15,"div",5),e.nrm(16,"input",8),e.j41(17,"span",7),e.EFF(18,"*"),e.k0s()()()()(),e.j41(19,"div",1)(20,"div",2)(21,"div",3)(22,"label",9),e.EFF(23,"Departamento"),e.k0s(),e.j41(24,"div",5)(25,"app-custom-select",10),e.bIt("Selected",function(m){return o.departmanetSelected(m)}),e.k0s(),e.j41(26,"span",7),e.EFF(27,"*"),e.k0s()()()()(),e.j41(28,"div",1)(29,"div",2)(30,"div",3)(31,"label",9),e.EFF(32,"Municipio"),e.k0s(),e.j41(33,"div",5)(34,"app-custom-select",11),e.bIt("Selected",function(m){return o.form.get("municipality").setValue(m.keyword)}),e.k0s(),e.j41(35,"span",7),e.EFF(36,"*"),e.k0s()()()()(),e.j41(37,"div",1)(38,"div",12)(39,"div",3)(40,"label"),e.EFF(41,"Latitud"),e.k0s(),e.j41(42,"div",5),e.nrm(43,"input",13),e.j41(44,"span",7),e.EFF(45,"*"),e.k0s()()()(),e.j41(46,"div",12)(47,"div",3)(48,"label"),e.EFF(49,"Longitud"),e.k0s(),e.j41(50,"div",5),e.nrm(51,"input",14),e.j41(52,"span",7),e.EFF(53,"*"),e.k0s()()()(),e.j41(54,"div",15)(55,"div",16)(56,"button",17),e.bIt("click",function(){return o.getUbication()}),e.EFF(57,"Obtener mi ubicaci\xf3n"),e.k0s(),e.j41(58,"button",17),e.bIt("click",function(){return o.openGM()}),e.EFF(59,"Abrir google map"),e.k0s()()()(),e.j41(60,"div",18)(61,"div",2)(62,"div",19),e.nrm(63,"input",20),e.j41(64,"label",21),e.EFF(65,"\xbfActiva?"),e.k0s()()()(),e.j41(66,"div",22)(67,"button",23),e.EFF(68),e.k0s()()()),2&i&&(e.Y8G("formGroup",o.form),e.R7$(25),e.Y8G("itemSelected",o.form.get("department").value)("optiones",o.departments),e.R7$(9),e.Y8G("itemSelected",o.form.get("municipality").value)("optiones",o.optiones),e.R7$(33),e.Y8G("disabled",o.saving||o.form.invalid),e.R7$(),e.SpI(" ",o.saving?"Guardando":"Guardar"," "))},dependencies:[a.X1,a.qT,a.me,a.Q0,a.Zm,a.BC,a.cb,a.j4,a.JD,a.YN,F.f],styles:["form[_ngcontent-%COMP%]{width:100%}.btnG[_ngcontent-%COMP%]{height:100%;display:flex;align-items:end;justify-content:end;padding-bottom:10px}.btnG[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-right:10px}"]})}}return r})();var f=n(1922),E=n(345);let M=(()=>{class r{constructor(t){this.titleService=t,this.colsHeader=["Nombre","C\xf3digo","Departamento","Municipio","Activo","Fecha creaci\xf3n"],this.keysToUse=["name","code","department","municipality","active","createdAt"],this.componentToCreateNew=T,this.endpoint=f.R.redeemCenter,this.endpointUpload=f.R.uploadRedeemsCenters,this.UploadExample=[["nombre1","c\xf3digo centro de canje 1","departamento1","municipio1","latitud1","longitud1"],["nombre2","c\xf3digo centro de canje 2","departamento2","municipio2","latitud2","longitud2"],["nombre3","c\xf3digo centro de canje 3","departamento3","municipio3","latitud3","longitud3"]],this.titleService.setTitle("GoPromo | Centros de Canjes")}static{this.\u0275fac=function(i){return new(i||r)(e.rXU(E.hE))}}static{this.\u0275cmp=e.VBU({type:r,selectors:[["app-redeemcenter-no-group"]],standalone:!0,features:[e.aNF],decls:1,vars:9,consts:[["title","Centros de Canjes","titleToModalAdd","Nuevo Centro de Canje","titleToModalUpdate","Actualizar Centro de Canje","NameIdData","redemptionCenterId",3,"colsHeader","keysToUse","componentToCreateNew","enpoint","confirmToDelete","maximizeModal","showBtnUpload","endpointUpload","UploadExample"]],template:function(i,o){1&i&&e.nrm(0,"app-table",0),2&i&&e.Y8G("colsHeader",o.colsHeader)("keysToUse",o.keysToUse)("componentToCreateNew",o.componentToCreateNew)("enpoint",o.endpoint)("confirmToDelete",!0)("maximizeModal",!1)("showBtnUpload",!0)("endpointUpload",o.endpointUpload)("UploadExample",o.UploadExample)},dependencies:[C.O]})}}return r})()}}]);
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.