-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path511.2f409477ade4d093.js
1 lines (1 loc) · 14.7 KB
/
511.2f409477ade4d093.js
1
"use strict";(self.webpackChunkaes_admin=self.webpackChunkaes_admin||[]).push([[511],{7511:(ae,g,i)=>{i.r(g),i.d(g,{WizardModule:()=>oe});var f=i(5357),Z=i(2266),a=i(3075),b=i(9646),C=i(7579),p=i(2722),_=i(7489),T=i(4787),z=i(8288),F=i(4062),e=i(5e3),y=i(9851),I=i(1683),A=i(7231),J=i(1158),U=i(5094),h=i(9808),N=i(2494),v=i(508),Q=i(7423),l=i(5615),w=i(5245),c=i(7322),M=i(7531),q=i(773),k=i(4107);const W=["wizardMerchantNgForm"],S=["logoFileInput"];function Y(r,n){if(1&r&&(e.TgZ(0,"fuse-alert",46),e._uU(1),e.qZA()),2&r){const o=e.oxw();e.Q6J("type",o.alert.type)("showIcon",!1),e.xp6(1),e.hij(" ",o.alert.message," ")}}function j(r,n){1&r&&e._uU(0,"Informaci\xf3n general")}function D(r,n){1&r&&(e.TgZ(0,"mat-error"),e._uU(1," El nombre del negocio es obligatorio. "),e.qZA())}function R(r,n){1&r&&(e.TgZ(0,"mat-error"),e._uU(1," El nombre del negocio debe contener entre 3 y 40 caracteres. "),e.qZA())}function B(r,n){if(1&r&&(e.TgZ(0,"mat-option",47),e._uU(1),e.qZA()),2&r){const o=n.$implicit;e.Q6J("value",o.name),e.xp6(1),e.hij(" ",o.name," ")}}function E(r,n){1&r&&(e.TgZ(0,"mat-error"),e._uU(1," Debe escoger un sector. "),e.qZA())}function L(r,n){1&r&&e._uU(0,"Domicilio")}function O(r,n){1&r&&(e.TgZ(0,"mat-error"),e._uU(1," La direcci\xf3n es obligatoria. "),e.qZA())}function G(r,n){1&r&&(e.TgZ(0,"mat-error"),e._uU(1," La direcci\xf3n debe contener entre 3 y 100 caracteres. "),e.qZA())}function $(r,n){if(1&r&&(e.TgZ(0,"mat-option",47),e._uU(1),e.qZA()),2&r){const o=n.$implicit;e.Q6J("value",o),e.xp6(1),e.hij(" ",o," ")}}function H(r,n){1&r&&(e.TgZ(0,"mat-error"),e._uU(1," Debe seleccionar una provincia. "),e.qZA())}function P(r,n){if(1&r&&(e.TgZ(0,"mat-option",47),e._uU(1),e.qZA()),2&r){const o=n.$implicit;e.Q6J("value",o.city),e.xp6(1),e.hij(" ",o.city," ")}}function V(r,n){1&r&&(e.TgZ(0,"mat-error"),e._uU(1," Debe seleccionar un municipio. "),e.qZA())}function K(r,n){1&r&&e._uU(0,"Imagen")}function X(r,n){if(1&r&&e._UZ(0,"img",48),2&r){const o=e.oxw();e.Q6J("src",o.wizardMerchantForm.get("step3.logoUrl").value,e.LSH)}}function ee(r,n){1&r&&(e.TgZ(0,"span"),e._uU(1," Crear Negocio "),e.qZA())}function te(r,n){1&r&&e._UZ(0,"mat-progress-spinner",49),2&r&&e.Q6J("diameter",24)("mode","indeterminate")}const re=[{path:"",component:(()=>{class r{constructor(o,t,s,m,u,x,d,ie){this._merchantsService=o,this._changeDetectorRef=t,this._formBuilder=s,this._fuseConfirmationService=m,this._imagesService=u,this._locationService=x,this._router=d,this.store=ie,this.merchant=null,this.cities=[],this.domainCode="",this.domains=[],this.isLoading=!1,this.stateCode="",this.states=[],this.statesCodes=[],this.stateSelected="",this.user=null,this.user$=(0,b.of)(null),this._unsubscribeAll=new C.x}ngOnInit(){var o;this.user$=this.store.select(T.rk),this.user$.subscribe(t=>this.user=t),this._merchantsService.domains$.pipe((0,p.R)(this._unsubscribeAll)).subscribe(t=>{this.domains=t,this._changeDetectorRef.markForCheck()}),this._locationService.states$.pipe((0,p.R)(this._unsubscribeAll)).subscribe(t=>{this.states=t,this._changeDetectorRef.markForCheck()}),this._locationService.statesCodes$.pipe((0,p.R)(this._unsubscribeAll)).subscribe(t=>{this.statesCodes=t,this._changeDetectorRef.markForCheck()}),this.wizardMerchantForm=this._formBuilder.group({step1:this._formBuilder.group({_id:[""],active:[!0,[a.kI.required]],owner:[this.user._id,[a.kI.required]],name:["",[a.kI.required,a.kI.minLength(3),a.kI.maxLength(250)]],domain:["",[a.kI.required]],merchantType:[{value:"comercio",disabled:!0},[a.kI.required]],currency:[{value:"cup",disabled:!0},[a.kI.required]],description:["",[a.kI.maxLength(1e3)]]}),step2:this._formBuilder.group({address:["",[a.kI.required,a.kI.minLength(3),a.kI.maxLength(250)]],state:["",[a.kI.required]],city:["",[a.kI.required]],country:[{value:"Cuba",disabled:!0},[a.kI.required]]}),step3:this._formBuilder.group({logoUrl:[""]})}),null===(o=this.wizardMerchantForm.get("step2.state"))||void 0===o||o.valueChanges.pipe((0,p.R)(this._unsubscribeAll)).subscribe(t=>{this._getCitiesByState(t),this._changeDetectorRef.markForCheck()})}ngOnDestroy(){this._unsubscribeAll.next(null),this._unsubscribeAll.complete()}uploadLogo(o){if(!o.length)return;const s=o[0];!["image/jpeg","image/jpg","image/webp","image/png"].includes(s.type)||this._imagesService.uploadImage("Merchant",s).subscribe(m=>{this.wizardMerchantForm.get("step3.logoUrl").setValue(m.imageUrl),this._changeDetectorRef.markForCheck()})}removeLogo(){const o=this.wizardMerchantForm.get("step3.logoUrl");o.value&&this._imagesService.removeImage(this.wizardMerchantForm.get("step3.logoUrl").value).subscribe(()=>{o.setValue(null),this._logoFileInput.nativeElement.value=null,this._changeDetectorRef.markForCheck()})}createMerchant(){this.isLoading=!0;const o=this.wizardMerchantForm.getRawValue();let t=Object.assign(Object.assign(Object.assign({},o.step1),o.step2),o.step3);t=(0,_.omit)(t,"_id"),t.slug=new F.i(t.name).slug,this._fuseConfirmationService.open({title:"Crear negocio",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().subscribe(m=>{"confirmed"===m&&this._merchantsService.createMerchant(t).subscribe(u=>{this._fuseConfirmationService.open({title:"Confirmaci\xf3n",message:u.message,icon:{show:!0,name:"heroicons_outline:check",color:"success"},actions:{confirm:{show:!0,label:"Ok",color:"primary"},cancel:{show:!1}},dismissible:!1}).afterClosed().subscribe(d=>{"confirmed"===d&&this._router.navigateByUrl("/desktop")}),this._changeDetectorRef.markForCheck()}),this._changeDetectorRef.markForCheck()})}clearForm(){this.wizardMerchantNgForm.resetForm()}trackByFn(o,t){return t.id||o}_getCitiesByState(o){o!==this.stateSelected&&this._locationService.getCitiesByState(o).subscribe(t=>{this.cities=t,this._changeDetectorRef.markForCheck()})}}return r.\u0275fac=function(o){return new(o||r)(e.Y36(y.S),e.Y36(e.sBO),e.Y36(a.qu),e.Y36(I.R),e.Y36(A.C),e.Y36(J.a),e.Y36(f.F0),e.Y36(U.yh))},r.\u0275cmp=e.Xpm({type:r,selectors:[["ath-wizard"]],viewQuery:function(o,t){if(1&o&&(e.Gf(W,5),e.Gf(S,5)),2&o){let s;e.iGM(s=e.CRH())&&(t.wizardMerchantNgForm=s.first),e.iGM(s=e.CRH())&&(t._logoFileInput=s.first)}},decls:101,vars:59,consts:[[1,"flex","flex-col","flex-auto","min-w-0"],[1,"flex","flex-col","flex-auto","items-center","p-6","sm:p-10"],[1,"flex","flex-col","w-full","max-w-4xl"],[1,"mt-2","text-4xl","sm:text-5xl","text-primary","font-extrabold","tracking-tight","leading-tight"],[1,"mt-8","sm:mt-12","p-6","pb-7","sm:p-10","sm:pb-7","shadow","rounded-2xl","bg-card"],["class","mb-8",3,"type","showIcon",4,"ngIf"],["wizardBusinessNgForm","ngForm",1,"p-4","overflow-hidden",3,"formGroup"],["wizardBusinessNgForm",""],[3,"linear"],["wizard",""],[3,"formGroupName","stepControl"],["wizardStep1",""],["matStepLabel",""],[1,"my-6","font-medium"],[1,"flex","mb-6"],[1,"w-full"],["matInput","","required","",3,"type","formControlName","minlength","maxlength","placeholder"],[4,"ngIf"],[1,"flex","flex-col","gt-xs:flex-row","mb-6","gap-6"],[3,"formControlName"],[3,"value",4,"ngFor","ngForOf","ngForTrackBy"],[1,"w-full","fuse-mat-no-subscript"],["matPrefix","",1,"hidden","sm:flex","icon-size-5",3,"svgIcon"],["matInput","","matTextareaAutosize","",3,"formControlName","rows","maxlength","spellcheck"],[1,"flex","justify-end"],["mat-flat-button","","type","button","matStepperNext","",1,"px-8",3,"color","disabled"],["wizardStep2",""],[1,"flex","flex-col","gt-xs:flex-row","gap-6","mb-6"],["matInput","","required","",3,"type","formControlName","minlength","maxlength"],["matPrefix","",1,"icon-size-5",3,"svgIcon"],["required","",3,"formControlName"],["value","Cuba"],[1,"flex","justify-between"],["mat-flat-button","","type","button","matStepperPrevious","",1,"px-8","mr-2",3,"color"],[1,"flex","flex-col","gt-sm:flex-row","items-center","justify-center"],[1,"relative","flex","items-center","justify-center","w-32","h-32","border","border-dashed","rounded-full","overflow-hidden"],["class","object-cover rounded bg-hover","alt","IMAGEN",3,"src",4,"ngIf"],[1,"absolute","inset-0","flex","items-center","justify-center","z-20"],["id","logo-file-input","type","file",1,"absolute","h-0","w-0","opacity-0","invisible","pointer-events-none",3,"multiple","accept","change"],["logoFileInput",""],["for","logo-file-input","matRipple","",1,"flex","items-center","justify-center","w-10","h-10","rounded-full","cursor-pointer","hover:bg-hover"],[1,"text-primary",3,"svgIcon"],["mat-icon-button","",1,"rounded-full",3,"click"],[1,"flex","justify-between","mt-8"],["mat-flat-button","","type","button","matStepperNext","",1,"px-8",3,"color","disabled","click"],[3,"diameter","mode",4,"ngIf"],[1,"mb-8",3,"type","showIcon"],[3,"value"],["alt","IMAGEN",1,"object-cover","rounded","bg-hover",3,"src"],[3,"diameter","mode"]],template:function(o,t){if(1&o){const s=e.EpF();e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),e._uU(4," Est\xe1 solo a tres pasos de crear su primer negocio. "),e.qZA(),e.TgZ(5,"div",4),e.YNc(6,Y,2,3,"fuse-alert",5),e.TgZ(7,"form",6,7)(9,"mat-horizontal-stepper",8,9)(11,"mat-step",10,11),e.YNc(13,j,1,0,"ng-template",12),e.TgZ(14,"p",13),e._uU(15," Ingrese la informaci\xf3n m\xednima necesaria para que sus clientes conozcan el negocio. "),e.qZA(),e.TgZ(16,"div",14)(17,"mat-form-field",15)(18,"mat-label"),e._uU(19,"Nombre"),e.qZA(),e._UZ(20,"input",16),e.YNc(21,D,2,0,"mat-error",17),e.YNc(22,R,2,0,"mat-error",17),e.qZA()(),e.TgZ(23,"div",18)(24,"mat-form-field",15)(25,"mat-label"),e._uU(26,"Sector"),e.qZA(),e.TgZ(27,"mat-select",19),e.YNc(28,B,2,2,"mat-option",20),e.qZA(),e.TgZ(29,"mat-hint"),e._uU(30,"Nomenclador de la Organizaci\xf3n Internacional del Trabajo OIT"),e.qZA(),e.YNc(31,E,2,0,"mat-error",17),e.qZA(),e.TgZ(32,"mat-form-field",21)(33,"mat-label"),e._uU(34,"Descripci\xf3n del Negocio"),e.qZA(),e._UZ(35,"mat-icon",22)(36,"textarea",23),e.qZA()(),e.TgZ(37,"div",24)(38,"button",25),e._uU(39," Avanzar "),e.qZA()()(),e.TgZ(40,"mat-step",10,26),e.YNc(42,L,1,0,"ng-template",12),e.TgZ(43,"p",13),e._uU(44," La direcci\xf3n donde radica el negocio aporta confianza a los clientes a la hora de tomar una decisi\xf3n de compra. "),e.qZA(),e.TgZ(45,"div",27)(46,"mat-form-field",15)(47,"mat-label"),e._uU(48,"Direcci\xf3n"),e.qZA(),e._UZ(49,"mat-icon",22)(50,"input",28),e.YNc(51,O,2,0,"mat-error",17),e.YNc(52,G,2,0,"mat-error",17),e.qZA(),e.TgZ(53,"mat-form-field",15)(54,"mat-label"),e._uU(55,"Provincia"),e.qZA(),e._UZ(56,"mat-icon",29),e.TgZ(57,"mat-select",30),e.YNc(58,$,2,2,"mat-option",20),e.qZA(),e.YNc(59,H,2,0,"mat-error",17),e.qZA(),e.TgZ(60,"mat-form-field",15)(61,"mat-label"),e._uU(62,"Municipio"),e.qZA(),e._UZ(63,"mat-icon",29),e.TgZ(64,"mat-select",30),e.YNc(65,P,2,2,"mat-option",20),e.qZA(),e.YNc(66,V,2,0,"mat-error",17),e.qZA(),e.TgZ(67,"mat-form-field",21)(68,"mat-label"),e._uU(69,"Pa\xeds"),e.qZA(),e.TgZ(70,"mat-select",30)(71,"mat-option",31),e._uU(72,"Cuba"),e.qZA()(),e._UZ(73,"mat-icon",29),e.qZA()(),e.TgZ(74,"div",32)(75,"button",33),e._uU(76," Regresar "),e.qZA(),e.TgZ(77,"button",25),e._uU(78," Avanzar "),e.qZA()()(),e.TgZ(79,"mat-step",10),e.YNc(80,K,1,0,"ng-template",12),e.TgZ(81,"p",13),e._uU(82," Su logo es la imagen que van a recordar los clientes toda la vida. "),e.qZA(),e.TgZ(83,"div",34)(84,"div",35),e.YNc(85,X,1,1,"img",36),e.TgZ(86,"div",37)(87,"div")(88,"input",38,39),e.NdJ("change",function(){e.CHM(s);const u=e.MAs(89);return e.KtG(t.uploadLogo(u.files))}),e.qZA(),e.TgZ(90,"label",40),e._UZ(91,"mat-icon",41),e.qZA()(),e.TgZ(92,"div")(93,"button",42),e.NdJ("click",function(){return t.removeLogo()}),e._UZ(94,"mat-icon",41),e.qZA()()()()(),e.TgZ(95,"div",43)(96,"button",33),e._uU(97," Regresar "),e.qZA(),e.TgZ(98,"button",44),e.NdJ("click",function(){return t.createMerchant()}),e.YNc(99,ee,2,0,"span",17),e.YNc(100,te,1,2,"mat-progress-spinner",45),e.qZA()()()()()()()()()}if(2&o){const s=e.MAs(12),m=e.MAs(41);e.xp6(6),e.Q6J("ngIf",t.alert),e.xp6(1),e.Q6J("formGroup",t.wizardMerchantForm),e.xp6(2),e.Q6J("linear",!0),e.xp6(2),e.Q6J("formGroupName","step1")("stepControl",t.wizardMerchantForm.get("step1")),e.xp6(9),e.Q6J("type","text")("formControlName","name")("minlength",3)("maxlength",250)("placeholder","Nombre del negocio"),e.xp6(1),e.Q6J("ngIf",t.wizardMerchantForm.get("step1.name").hasError("required")),e.xp6(1),e.Q6J("ngIf",t.wizardMerchantForm.get("step1.name").hasError("maxlength")||t.wizardMerchantForm.get("step1.name").hasError("minlength")),e.xp6(5),e.Q6J("formControlName","domain"),e.xp6(1),e.Q6J("ngForOf",t.domains)("ngForTrackBy",t.trackByFn),e.xp6(3),e.Q6J("ngIf",t.wizardMerchantForm.get("step1.domain").hasError("required")),e.xp6(4),e.Q6J("svgIcon","heroicons_solid:menu-alt-2"),e.xp6(1),e.Q6J("formControlName","description")("rows",5)("maxlength",1e3)("spellcheck",!1),e.xp6(2),e.Q6J("color","primary")("disabled",s.stepControl.pristine||s.stepControl.invalid),e.xp6(2),e.Q6J("formGroupName","step2")("stepControl",t.wizardMerchantForm.get("step2")),e.xp6(9),e.Q6J("svgIcon","heroicons_solid:home"),e.xp6(1),e.Q6J("type","text")("formControlName","address")("minlength",3)("maxlength",250),e.xp6(1),e.Q6J("ngIf",t.wizardMerchantForm.get("step2.address").hasError("required")),e.xp6(1),e.Q6J("ngIf",t.wizardMerchantForm.get("step2.address").hasError("maxlength")||t.wizardMerchantForm.get("step2.address").hasError("minlength")),e.xp6(4),e.Q6J("svgIcon","heroicons_solid:map"),e.xp6(1),e.Q6J("formControlName","state"),e.xp6(1),e.Q6J("ngForOf",t.states)("ngForTrackBy",t.trackByFn),e.xp6(1),e.Q6J("ngIf",t.wizardMerchantForm.get("step2.state").hasError("required")),e.xp6(4),e.Q6J("svgIcon","heroicons_solid:location-marker"),e.xp6(1),e.Q6J("formControlName","city"),e.xp6(1),e.Q6J("ngForOf",t.cities)("ngForTrackBy",t.trackByFn),e.xp6(1),e.Q6J("ngIf",t.wizardMerchantForm.get("step2.city").hasError("required")),e.xp6(4),e.Q6J("formControlName","country"),e.xp6(3),e.Q6J("svgIcon","heroicons_solid:globe"),e.xp6(2),e.Q6J("color","accent"),e.xp6(2),e.Q6J("color","primary")("disabled",m.stepControl.pristine||m.stepControl.invalid),e.xp6(2),e.Q6J("formGroupName","step3")("stepControl",t.wizardMerchantForm.get("step3")),e.xp6(6),e.Q6J("ngIf",t.wizardMerchantForm.get("step3.logoUrl").value),e.xp6(3),e.Q6J("multiple",!1)("accept","image/jpeg, image/jpg, image/webp, image/png"),e.xp6(3),e.Q6J("svgIcon","heroicons_outline:camera"),e.xp6(3),e.Q6J("svgIcon","heroicons_outline:trash"),e.xp6(2),e.Q6J("color","accent"),e.xp6(2),e.Q6J("color","primary")("disabled",t.isLoading),e.xp6(1),e.Q6J("ngIf",!t.isLoading),e.xp6(1),e.Q6J("ngIf",t.isLoading)}},dependencies:[h.sg,h.O5,a._Y,a.Fj,a.JJ,a.JL,a.Q7,a.wO,a.nD,a.sg,a.u,a.x0,N.W,v.ey,Q.lW,l.C0,l.VY,l.Vq,l.Ic,l.fd,w.Hw,c.TO,c.KE,c.bx,c.hX,c.qo,M.Nt,q.Ou,v.wG,k.gD],encapsulation:2,data:{animation:z.L}}),r})(),resolve:{}}];let oe=(()=>{class r{}return r.\u0275fac=function(o){return new(o||r)},r.\u0275mod=e.oAB({type:r}),r.\u0275inj=e.cJS({imports:[f.Bz.forChild(re),Z.m]}),r})()}}]);