-
Notifications
You must be signed in to change notification settings - Fork 0
/
125.24dcf9b34d01b967.js
1 lines (1 loc) · 12.7 KB
/
125.24dcf9b34d01b967.js
1
"use strict";(self.webpackChunkfuse=self.webpackChunkfuse||[]).push([[125],{9125:(J,y,i)=>{i.r(y),i.d(y,{default:()=>B});var v=i(177),e=i(4438),p=i(8834),c=i(2102),u=i(9213),g=i(9042),m=i(5351),x=i(5416),k=i(33),d=i(9079),b=i(1849),E=i(6601),C=i(1016),G=i(467),a=i(9417),j=i(450),f=i(4794),h=i(3587),I=i(9896),F=i(2798),R=i(6600);const $=(t,r)=>r.$id,D=t=>({"cursor-not-allowed bg-gray-100":t}),w=t=>({"text-gray-500 dark:text-gray-300":t}),T=t=>({"cursor-not-allowed":t});function z(t,r){1&t&&(e.j41(0,"h2",2),e.EFF(1,"Agregar elemento"),e.k0s())}function X(t,r){1&t&&(e.j41(0,"h2",2),e.EFF(1,"Editar elemento"),e.k0s())}function W(t,r){1&t&&(e.j41(0,"mat-error"),e.EFF(1," El t\xedtulo del elemento es obligatorio. "),e.k0s())}function A(t,r){1&t&&(e.j41(0,"mat-error"),e.EFF(1," El t\xedtulo del elemento debe contener entre 3 y 255 caracteres. "),e.k0s())}function M(t,r){if(1&t&&(e.j41(0,"mat-option",10),e.EFF(1),e.k0s()),2&t){const o=r.$implicit;e.Y8G("value",o.$id),e.R7$(),e.JRh(o.name)}}function Q(t,r){1&t&&(e.j41(0,"mat-error"),e.EFF(1," Debe seleccionar un servicio. "),e.k0s())}function N(t,r){if(1&t){const o=e.RV6();e.j41(0,"button",16),e.bIt("click",function(){e.eBV(o);const n=e.XpG();return e.Njj(n.updateElement())}),e.EFF(1," Actualizar "),e.k0s()}if(2&t){const o=e.XpG();e.Y8G("color","primary")("disabled",o.galleryElementForm.invalid)("ngClass",e.eq3(3,T,o.galleryElementForm.invalid))}}let Y=(()=>{class t{#o;#e;#n;#i;#l;#a;#t;constructor(o){this.data=o,this.assistances=(0,e.WQX)(I.E).assistances,this.galleryElement=null,this.#o=(0,e.WQX)(e.gRc),this.#e=(0,e.WQX)(e.abz),this.#n=(0,e.WQX)(m.CP),this.#i=(0,e.WQX)(a.ok),this.#l=(0,e.WQX)(E.G),this.#a=(0,e.WQX)(x.UG),this.#t=(0,e.WQX)(C.M),this.galleryElement=o.element}ngOnInit(){this.galleryElementForm=this.#i.group({$id:new a.MJ(null),title:new a.MJ(null,[a.k0.required,a.k0.maxLength(255)]),serviceId:new a.MJ(null,[a.k0.required,a.k0.maxLength(255)]),services:new a.MJ(null,[a.k0.required,a.k0.maxLength(255)])}),this.galleryElementForm.get("serviceId").valueChanges.pipe((0,d.pQ)(this.#e)).subscribe(o=>{this.galleryElementForm.get("services").setValue(o)}),"edit"===this.data.dialogMode&&this.galleryElementForm.patchValue(this.data.element),this.myWidget=cloudinary.createUploadWidget({cloudName:h.c.cloudName,uploadPreset:h.c.uploadPreset,multiple:!1,folder:h.c.cloudinaryFolder,maxImageFileSize:2e6},(o,l)=>{if(!o&&l&&"success"===l.event)if("edit"===this.data.dialogMode)this.galleryElement.urlId=l.info.public_id,this.galleryElement.url=l.info.secure_url,this.#s(this.galleryElement);else{let n=this.galleryElementForm.getRawValue();delete n.$id,n.url=l.info.secure_url,n.urlId=l.info.public_id,this.#r(n)}})}openCloudinaryWidget(){this.galleryElementForm.invalid||this.myWidget.open()}updateElement(){let o=this.galleryElementForm.getRawValue();o.url=this.galleryElement.url,o.urlId=this.galleryElement.urlId,this.#l.open({title:"Actualizar elemento",message:"\xbfEsta seguro que todos los datos son correctos?",icon:{show:!0,name:"heroicons_outline:question-mark-circle",color:"info"},actions:{confirm:{label:"Aceptar",color:"primary"}}}).afterClosed().pipe((0,d.pQ)(this.#e)).subscribe(n=>{"confirmed"===n&&this.#t.update(o).then(s=>{this.#a.openFromComponent(f.p,{panelClass:["p-0","bg-transparent"],horizontalPosition:"end",verticalPosition:"bottom",duration:5e3,data:{message:"Elemento actualizado correctamente",title:"Confirmaci\xf3n",type:"success",appearance:"fill"}}),this.#t.loadAll(),this.#o.markForCheck(),this.#n.close()})})}#r(o){var l=this;return(0,G.A)(function*(){l.#l.open({title:"Crear elemento",message:"\xbfEsta seguro que todos los datos son correctos?",icon:{show:!0,name:"heroicons_outline:question-mark-circle",color:"info"},actions:{confirm:{label:"Aceptar",color:"primary"}}}).afterClosed().pipe((0,d.pQ)(l.#e)).subscribe(s=>{"confirmed"===s&&l.#t.create(o).then(()=>{l.#a.openFromComponent(f.p,{panelClass:["p-0","bg-transparent"],horizontalPosition:"end",verticalPosition:"bottom",duration:5e3,data:{message:"Elemento creado correctamente",title:"Confirmaci\xf3n",type:"success",appearance:"fill"}}),l.#t.loadAll(),l.#o.markForCheck(),l.#n.close()})})})()}#s(o){this.#l.open({title:"Actualizar elemento",message:"\xbfEsta seguro que todos los datos son correctos?",icon:{show:!0,name:"heroicons_outline:question-mark-circle",color:"info"},actions:{confirm:{label:"Aceptar",color:"primary"}}}).afterClosed().pipe((0,d.pQ)(this.#e)).subscribe(n=>{"confirmed"===n&&this.#t.update(o).then(s=>{this.#a.openFromComponent(f.p,{panelClass:["p-0","bg-transparent"],horizontalPosition:"end",verticalPosition:"bottom",duration:5e3,data:{message:"Elemento actualizado correctamente",title:"Confirmaci\xf3n",type:"success",appearance:"fill"}}),this.#t.loadAll(),this.#o.markForCheck(),this.#n.close()})})}static#c=this.\u0275fac=function(l){return new(l||t)(e.rXU(m.Vh))};static#m=this.\u0275cmp=e.VBU({type:t,selectors:[["app-gallery-image-dialog"]],standalone:!0,features:[e.aNF],decls:27,vars:23,consts:[[1,"relative","flex","flex-col","w-full","h-full"],[1,"flex","flex-col","items-center","px-8","pt-4","space-y-1","text-center","border-b","sm:items-start","sm:mt-0","sm:pr-8","sm:text-left"],[1,"text-2xl","text-gray-400"],[1,"flex","flex-col","w-full","px-8","py-6","sm:py-8"],[1,"w-full","overflow-hidden"],[1,"flex"],[1,"flex","flex-col","w-full","space-y-4",3,"formGroup","autocomplete"],[1,"fuse-mat-dense",3,"subscriptSizing"],["matInput","","required","",3,"type","formControlName","minlength","maxlength"],["required","",3,"formControlName"],[3,"value"],[1,"flex","items-center","justify-center","w-32","h-32","p-5","mx-auto","overflow-hidden","rounded-full","cursor-pointer","bg-primary-100","dark:bg-gray-600",3,"click","ngClass"],[1,"icon-size-10","text-primary-500","dark:text-primary-300",3,"ngClass","svgIcon"],[1,"flex","items-center","justify-center","px-6","py-4","space-x-3","sm:justify-end","bg-gray-50","dark:bg-black","dark:bg-opacity-10"],["mat-stroked-button","",3,"matDialogClose"],["mat-flat-button","",3,"color","disabled","ngClass"],["mat-flat-button","",3,"click","color","disabled","ngClass"]],template:function(l,n){1&l&&(e.j41(0,"div",0)(1,"div",1),e.DNE(2,z,2,0,"h2",2)(3,X,2,0,"h2",2),e.k0s(),e.j41(4,"div",3)(5,"div",4)(6,"div",5)(7,"form",6)(8,"mat-form-field",7)(9,"mat-label"),e.EFF(10,"T\xedtulo"),e.k0s(),e.nrm(11,"input",8),e.DNE(12,W,2,0,"mat-error")(13,A,2,0,"mat-error"),e.k0s(),e.j41(14,"mat-form-field",7)(15,"mat-label"),e.EFF(16,"Seleccionar servicio"),e.k0s(),e.j41(17,"mat-select",9),e.Z7z(18,M,2,2,"mat-option",10,$),e.k0s(),e.DNE(20,Q,2,0,"mat-error"),e.k0s(),e.j41(21,"div",11),e.bIt("click",function(){return n.openCloudinaryWidget()}),e.nrm(22,"mat-icon",12),e.k0s()()()()(),e.j41(23,"div",13)(24,"button",14),e.EFF(25," Cancelar "),e.k0s(),e.DNE(26,N,2,5,"button",15),e.k0s()()),2&l&&(e.R7$(2),e.vxM(2,"create"===n.data.dialogMode?2:-1),e.R7$(),e.vxM(3,"edit"===n.data.dialogMode?3:-1),e.R7$(4),e.Y8G("formGroup",n.galleryElementForm)("autocomplete","off"),e.R7$(),e.Y8G("subscriptSizing","dynamic"),e.R7$(3),e.Y8G("type","text")("formControlName","title")("minlength",3)("maxlength",255),e.R7$(),e.vxM(12,n.galleryElementForm.get("title").hasError("required")?12:-1),e.R7$(),e.vxM(13,n.galleryElementForm.get("title").hasError("maxlength")||n.galleryElementForm.get("title").hasError("minlength")?13:-1),e.R7$(),e.Y8G("subscriptSizing","dynamic"),e.R7$(3),e.Y8G("formControlName","serviceId"),e.R7$(),e.Dyx(n.assistances()),e.R7$(2),e.vxM(20,n.galleryElementForm.get("serviceId").hasError("required")?20:-1),e.R7$(),e.Y8G("ngClass",e.eq3(19,D,n.galleryElementForm.invalid)),e.R7$(),e.Y8G("ngClass",e.eq3(21,w,n.galleryElementForm.invalid))("svgIcon","heroicons_outline:camera"),e.R7$(2),e.Y8G("matDialogClose","cancelled"),e.R7$(2),e.vxM(26,"edit"===n.data.dialogMode?26:-1))},dependencies:[p.Hl,p.$z,m.hM,m.tx,c.RG,c.rl,c.nJ,c.TL,u.m_,u.An,g.fS,g.fg,F.Ve,F.VO,R.wT,j.mV,v.YU,a.X1,a.qT,a.me,a.BC,a.cb,a.YS,a.xh,a.tU,a.j4,a.JD],encapsulation:2,changeDetection:0})}return t})();const V=(t,r)=>r.$id;function S(t,r){if(1&t){const o=e.RV6();e.j41(0,"fuse-card",16),e.nrm(1,"img",17),e.j41(2,"div",18),e.EFF(3),e.k0s(),e.j41(4,"div",19)(5,"a",20),e.bIt("click",function(){const n=e.eBV(o).$implicit,s=e.XpG(2);return e.Njj(s.deleteGalleryElement(n.$id))}),e.nrm(6,"mat-icon",21),e.j41(7,"span",22),e.EFF(8,"Eliminar"),e.k0s()(),e.j41(9,"a",23),e.bIt("click",function(){const n=e.eBV(o).$implicit,s=e.XpG(2);return e.Njj(s.openElementDialog(n,"edit"))}),e.nrm(10,"mat-icon",24),e.j41(11,"span",25),e.EFF(12,"Editar"),e.k0s()()()()}if(2&t){const o=r.$implicit;e.R7$(),e.Y8G("ngSrc","/c_scale,h_200,w_320/"+o.urlId),e.R7$(2),e.JRh(o.title),e.R7$(3),e.Y8G("svgIcon","heroicons_outline:trash"),e.R7$(4),e.Y8G("svgIcon","heroicons_outline:pencil")}}function P(t,r){if(1&t&&(e.j41(0,"div",15),e.Z7z(1,S,13,4,"fuse-card",16,V),e.k0s()),2&t){const o=e.XpG();e.R7$(),e.Dyx(o.store.gallery())}}function _(t,r){1&t&&(e.j41(0,"div",26),e.EFF(1," \xa1No se ha creado creado ning\xfan elemento a\xfan!' "),e.k0s())}const B=[{path:"",component:(()=>{class t{constructor(){this.store=(0,e.WQX)(C.M),this.selectedPhoto=null,this.#o=(0,e.WQX)(e.gRc),this.#e=(0,e.WQX)(e.abz),this.#n=(0,e.WQX)(m.bZ),this.#i=(0,e.WQX)(E.G),this.#l=(0,e.WQX)(x.UG)}#o;#e;#n;#i;#l;openElementDialog(o=null,l="create"){this.#n.open(Y,{data:{element:o,dialogMode:l},disableClose:!0,panelClass:"ath-dialog-panel"})}deleteGalleryElement(o){this.#i.open({title:"Eliminar elemento",message:"\xbfEsta seguro que desea eliminar este elemento?",icon:{show:!0,name:"heroicons_outline:question-mark-circle",color:"info"},actions:{confirm:{label:"Aceptar",color:"primary"}}}).afterClosed().pipe((0,d.pQ)(this.#e)).subscribe(n=>{"confirmed"===n&&this.store.delete(o).then(()=>{this.#l.openFromComponent(f.p,{panelClass:["p-0","bg-transparent"],horizontalPosition:"end",verticalPosition:"bottom",duration:5e3,data:{message:"Elemento eliminado correctamente",title:"Confirmaci\xf3n",type:"success",appearance:"fill"}}),this.store.loadAll(),this.#o.markForCheck()})})}static#a=this.\u0275fac=function(l){return new(l||t)};static#t=this.\u0275cmp=e.VBU({type:t,selectors:[["app-gallery"]],standalone:!0,features:[e.aNF],decls:22,vars:3,consts:[["cdkScrollable","",1,"absolute","inset-0","flex","flex-col","flex-auto","min-w-0","overflow-x-auto","overflow-y-auto","bg-card","dark:bg-transparent","lg:overflow-x-hidden"],[1,"relative","flex","flex-col","px-6","py-8","border-b","lg:flex-row","flex-0","lg:items-center","lg:justify-between","md:px-8"],[1,"flex-1","min-w-0"],[1,"flex","flex-wrap","items-center","font-medium"],["routerLink","/home",1,"whitespace-nowrap","text-primary-500"],[1,"flex","items-center","ml-1","whitespace-nowrap"],[1,"icon-size-3","text-secondary",3,"svgIcon"],[1,"ml-1","text-primary-500"],[1,"mt-2"],[1,"text-3xl","font-extrabold","leading-7","tracking-tight","truncate","md:text-4xl","sm:leading-10"],[1,"flex","items-center","gap-2","mt-6","shrink-0","lg:mt-0","lg:ml-4"],["mat-raised-button","",1,"mt-4","text-white","sm:mt-0","bg-gradient-to-r","from-primary-500","to-primary-600","hover:to-primary-900","hover:shadow-lg",3,"click"],[3,"svgIcon"],[1,"hidden","ml-2","mr-1","text-white","sm:block"],[1,"flex","items-center","justify-center","flex-auto","p-6","sm:p-8"],[1,"flex","flex-wrap","items-start","w-full","gap-5","-m-4"],[1,"flex","flex-col","w-full","max-w-80","filter-article"],["height","200","width","320","alt","Gallery Element","priority","","placeholder","",1,"object-cover","w-[320px]","h-[200px]",3,"ngSrc"],[1,"m-3","text-2xl","font-semibold","leading-tight","text-center"],[1,"flex","items-center","w-full","border-t","divide-x"],[1,"flex","items-center","justify-center","flex-auto","py-4","cursor-pointer","transitions","group","hover:bg-red-500",3,"click"],[1,"transitions","icon-size-5","text-hint","group-hover:text-white",3,"svgIcon"],[1,"ml-2","transitions","group-hover:text-white"],[1,"flex","items-center","justify-center","flex-auto","py-4","cursor-pointer","transitions","hover:bg-hover",3,"click"],[1,"transitions","icon-size-5","text-hint",3,"svgIcon"],[1,"ml-2","transitions"],[1,"w-full","p-8","text-4xl","font-semibold","tracking-tight","text-center","sm:p-16"]],template:function(l,n){1&l&&(e.j41(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div")(5,"a",4),e.EFF(6,"Inicio"),e.k0s()(),e.j41(7,"div",5),e.nrm(8,"mat-icon",6),e.j41(9,"a",7),e.EFF(10,"Galer\xeda"),e.k0s()()(),e.j41(11,"div",8)(12,"h2",9),e.EFF(13," Elementos creados "),e.k0s()()(),e.j41(14,"div",10)(15,"button",11),e.bIt("click",function(){return n.openElementDialog()}),e.nrm(16,"mat-icon",12),e.j41(17,"span",13),e.EFF(18,"Agregar"),e.k0s()()()(),e.j41(19,"div",14),e.DNE(20,P,3,0,"div",15)(21,_,2,0),e.k0s()()),2&l&&(e.R7$(8),e.Y8G("svgIcon","heroicons_outline:chevron-right"),e.R7$(8),e.Y8G("svgIcon","heroicons_outline:plus"),e.R7$(4),e.vxM(20,n.store.gallery().length>0?20:21))},dependencies:[b.$,p.Hl,p.$z,c.RG,u.m_,u.An,g.fS,v.kt,k.Wk],encapsulation:2,changeDetection:0})}return t})()}]}}]);