\r\n
{{ '¿Olvidaste la contraseña?' | translate}} \r\n
\r\n
\r\n
{{ '¿No tienes cuenta?' | translate}}
\r\n
{{ 'Regístrate como:' | translate}}
\r\n
\r\n
\r\n
\r\n","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-maker-admin',\r\n templateUrl: './maker-admin.component.html',\r\n styleUrls: ['./maker-admin.component.css']\r\n})\r\nexport class MakerAdminComponent {\r\n}\r\n","\r\n
\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\n\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { MakerService } from '../../../shared/maker.service';\r\nimport { ConfirmationDialogComponent } from '../../../shared/confirmation-dialog/confirmation-dialog.component';\r\nimport { maxTableRows } from 'globals';\r\n\r\n@Component({\r\n selector: 'app-maker-contacts-list',\r\n styleUrls: ['./maker-contacts-list.component.scss'],\r\n templateUrl: './maker-contacts-list.component.html',\r\n\r\n})\r\nexport class MakerContactsListComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n columns = [];\r\n rows = [];\r\n rowsGroups = []\r\n columnsGroups = [];\r\n searchForm: UntypedFormGroup;\r\n alert = { message: null, type: null };\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private makerService: MakerService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n public dialog: BsModalService,\r\n public translate: TranslateService\r\n ) {\r\n this.makerService.getContactsByMakerId(makerService.getId()).subscribe((contacts => {\r\n this.rows = contacts['hydra:member'];\r\n\r\n contacts['hydra:member'].forEach(contact => {\r\n contact.contactGroups = contact.contactGroups.map(group => group.name).join(', ');\r\n });\r\n\r\n }));\r\n this.makerService.getContactsGroupsByMakerId(makerService.getId()).subscribe((res: any) => {\r\n res['hydra:member'].forEach(group => {\r\n this.rowsGroups.push({ id: group['@id'], name: group.name });\r\n });\r\n this.table.offset = 0;\r\n });\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n group: ['']\r\n });\r\n\r\n this.columns = [\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'contactGroups', name: 'Grupo' },\r\n // { prop: 'position', name: 'Cargo' },\r\n { prop: 'email', name: 'Email' },\r\n { prop: 'phone', name: 'Teléfono' }];\r\n this.columnsGroups = [\r\n { prop: 'name', name: 'Nombre' },];\r\n }\r\n\r\n applyFilter() {\r\n this.makerService.getContactsByMakerId(this.makerService.getId(), this.searchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n console.log(data['hydra:member']);\r\n data['hydra:member'].forEach(data => {\r\n data.contactGroups = data.contactGroups.map(group => group.name).join(', ');\r\n });\r\n }\r\n );\r\n }\r\n\r\n deleteContact(contactId) {\r\n this.dialogRef = this.dialog.show(ConfirmationDialogComponent, {\r\n initialState: {\r\n confirmMessage: '¿Seguro que quieres eliminar este contacto?',\r\n callback: (confirm) => {\r\n if (confirm) {\r\n this.makerService.deleteContact(contactId).subscribe(\r\n (result) => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Contacto eliminado correctamente';\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n },\r\n error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n },\r\n );\r\n setTimeout(() => {\r\n this.makerService.getContactsByMakerId(this.makerService.getId()).subscribe((contacts => {\r\n this.rows = contacts['hydra:member'];\r\n this.table.offset = 0;\r\n }));\r\n }, 1000);\r\n }\r\n this.dialogRef = null;\r\n }\r\n }\r\n });\r\n }\r\n deleteGroup(contact_groupsId) {\r\n this.dialogRef = this.dialog.show(ConfirmationDialogComponent, {\r\n initialState: {\r\n confirmMessage: '¿Seguro que quieres eliminar este grupo?',\r\n callback: (confirm) => {\r\n if (confirm) {\r\n this.makerService.deleteGroup(contact_groupsId).subscribe(\r\n (result) => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Grupo eliminado correctamente';\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n },\r\n error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n },\r\n );\r\n /* setTimeout(() => {\r\n this.makerService.getContactsByMakerId(this.makerService.getId()).subscribe((contacts => {\r\n this.rows = contacts['hydra:member'];\r\n this.table.offset = 0;\r\n }));\r\n }, 1000); */\r\n }\r\n this.dialogRef = null;\r\n }\r\n }\r\n });\r\n }\r\n\r\n showTab = 'contacts';\r\n\r\n}\r\n","
\r\n
{{ 'Contactos' | translate}} \r\n\r\n\r\n\r\n\r\n
\r\n
{{alert.message}}
\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n
\r\n
{{ 'Buscar:' | translate}} \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
","import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { TranslateService } from '@ngx-translate/core';\r\n\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { errorMessages, regExps } from '../../../shared/custom-validators';\r\nimport { MakerService } from '../../../shared/maker.service';\r\nimport { environment } from '../../../../../environments/environment';\r\nimport { ModalAlertComponent } from 'src/app/shared/modal-alert/modal-alert.component';\r\n\r\nconst FRONT_URL = environment.frontUrl;\r\n\r\n@Component({\r\n selector: 'app-maker-contacts',\r\n templateUrl: './maker-contacts.component.html',\r\n styleUrls: ['./maker-contacts.component.css']\r\n})\r\nexport class MakerContactsComponent implements OnInit {\r\n contactForm: UntypedFormGroup;\r\n contactImage = null;\r\n selectedFile: File;\r\n selectedFiles = [];\r\n uploadedFiles = [];\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n uploadProgress = 0;\r\n alert = { message: null, type: null };\r\n errors = errorMessages;\r\n maker = null;\r\n contact = null;\r\n title = 'Nuevo contacto';\r\n selectedGroups = [];\r\n groups = [];\r\n\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private makerService: MakerService,\r\n public translate: TranslateService,\r\n public dialog: BsModalService,\r\n ) {\r\n if (this.makerService.getId()) {\r\n this.maker = '/makers/' + this.makerService.getId();\r\n this.createForm();\r\n } else {\r\n this.router.navigateByUrl('/maker/admin/perfil');\r\n }\r\n }\r\n\r\n ngOnInit(): void {\r\n if (this.activatedRoute.snapshot.params.id) {\r\n this.title = 'Editar contacto';\r\n setTimeout(() => {\r\n this.editContact(this.activatedRoute.snapshot.params.id);\r\n }, 1000);\r\n }\r\n\r\n\r\n }\r\n\r\n createForm() {\r\n this.makerService.getContactsGroupsByMakerId(this.makerService.getId()).subscribe((res: any) => {\r\n\r\n this.groups = res['hydra:member'];\r\n\r\n });\r\n this.contactForm = this.formBuilder.group({\r\n mediaContacts: [[],\r\n // Validators.required\r\n ],\r\n name: ['',\r\n Validators.required\r\n ],\r\n group: [null\r\n ],\r\n position: ['UNDEFINED',\r\n // Validators.required\r\n ],\r\n email: ['', [\r\n Validators.required,\r\n Validators.email\r\n ]\r\n ],\r\n phone: ['+', [\r\n Validators.required,\r\n Validators.pattern(regExps.phone)\r\n ]\r\n ],\r\n\r\n company: ['', Validators.required],\r\n maker: [this.maker]\r\n });\r\n }\r\n\r\n editContact(contactId) {\r\n this.makerService.getContact(contactId, this.translate.getDefaultLang()).subscribe((contact: any) => {\r\n this.contact = contact;\r\n\r\n this.contactForm.get('name').setValue(contact.name);\r\n this.contactForm.get('position').setValue(contact.position);\r\n this.contactForm.get('email').setValue(contact.email);\r\n this.contactForm.get('phone').setValue(contact.phone);\r\n this.contactForm.get('company').setValue(contact.company);\r\n this.contactForm.get('group').setValue(contact.contactGroups.length > 1 ? contact.contactGroups[0]['@id'] : []);\r\n var contactGroup = { value: contact.contactGroups[0]['@id'], name: contact.contactGroups[0].name };\r\n this.contactForm.get('group').setValue(contactGroup);\r\n\r\n\r\n this.selectedGroups = [];\r\n\r\n // if(contact.contactGroups.length > 1){\r\n // contact.contactGroups.forEach(group => {\r\n // this.selectedGroups.push({value: group['@id'], name: group.name});\r\n // });\r\n\r\n // this.contactForm.get('group').setValue(this.selectedGroups);\r\n\r\n\r\n // } else {\r\n // this.selectedGroups.push({value: contact.contactGroups[0]['@id'], name: contact.contactGroups[0].name});\r\n // var contactGroup = {value: contact.contactGroups[0]['@id'], name: contact.contactGroups[0].name};\r\n // this.contactForm.get('group').setValue(contactGroup);\r\n // }\r\n /* contact.contactGroups.forEach(group => {\r\n this.selectedGroups.push({value: group['@id'], name: group.name});\r\n }); */\r\n\r\n\r\n //this.contactForm.get('group').setValue(this.selectedGroups);\r\n\r\n if (contact.mediaContacts.length > 0) {\r\n this.contactForm.get('mediaContacts').setValue([contact.mediaContacts[0]['@id']]);\r\n this.contactImage = '/assets/makerContact/files/' + contact.mediaContacts[0]['contentUrl'];\r\n }\r\n });\r\n }\r\n\r\n updateContact() {\r\n if (this.contactForm.invalid) {\r\n this.showErrors(this.contactForm);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n return;\r\n }\r\n\r\n // var groupsIris = [];\r\n\r\n console.log(this.contactForm.get('group').value)\r\n\r\n // if(this.contactForm.get('group').value){\r\n // if(this.contactForm.get('group').value.length > 1){\r\n // this.contactForm.get('group').value.forEach(group => {\r\n // groupsIris.push(group['@id']);\r\n // });\r\n // } else {\r\n // groupsIris.push(this.contactForm.get('group').value['@id']);\r\n // }\r\n // } else {\r\n // groupsIris = null;\r\n // }\r\n\r\n /* if(this.contactForm.get('group').value.length > 1){\r\n this.contactForm.get('group').value.forEach(group => {\r\n groupsIris.push(group['@id']);\r\n });\r\n } else {\r\n groupsIris.push(this.contactForm.get('group').value['@id']);\r\n } */\r\n\r\n /* this.contactForm.get('group').value.forEach(group => {\r\n groupsIris.push(group['@id']);\r\n }); */\r\n\r\n let contactGroup = [];\r\n if (this.contactForm.get('group').value && this.contactForm.get('group').value['@id']) {\r\n contactGroup = [this.contactForm.get('group').value['@id']];\r\n } else if (this.contactForm.get('group').value && this.contactForm.get('group').value.value) {\r\n contactGroup = [this.contactForm.get('group').value.value]\r\n }\r\n\r\n\r\n const editedContact = {\r\n name: this.contactForm.get('name').value,\r\n position: this.contactForm.get('position').value,\r\n email: this.contactForm.get('email').value,\r\n phone: this.contactForm.get('phone').value,\r\n company: this.contactForm.get('company').value,\r\n mediaContacts: this.contactForm.get('mediaContacts').value,\r\n maker: this.contactForm.get('maker').value,\r\n contactGroups: contactGroup\r\n };\r\n\r\n this.makerService.putContact(this.contact.id, editedContact, this.translate.getDefaultLang())\r\n .subscribe(\r\n (result) => {\r\n // this.alert.type = 1;\r\n // this.alert.message = 'Contacto guardado correctamente';\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 2000);\r\n // this.contact = null;\r\n // this.createForm();\r\n // location.replace(this.translate.getDefaultLang() + '/maker/admin/contactos');\r\n this.openAlert('Contacto Guardado!', 'w-300', true)\r\n },\r\n error => {\r\n this.alert.message = error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n },\r\n () => console.log('complete'));\r\n }\r\n\r\n createContact() {\r\n if (this.contactForm.invalid) {\r\n this.showErrors(this.contactForm);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n return;\r\n }\r\n const contact = {\r\n mediaContacts: this.contactForm.get('mediaContacts').value,\r\n name: this.contactForm.get('name').value,\r\n position: this.contactForm.get('position').value,\r\n email: this.contactForm.get('email').value,\r\n phone: this.contactForm.get('phone').value,\r\n company: this.contactForm.get('company').value,\r\n maker: this.contactForm.get('maker').value,\r\n group: this.contactForm.get('group').value,\r\n };\r\n this.makerService.postContact(contact).subscribe(() => {\r\n // this.alert.type = 1;\r\n // this.alert.message = this.translate.instant('Contacto creado correctamente');\r\n // setTimeout(() => {\r\n // location.replace(this.translate.getDefaultLang() + '/maker/admin/contactos');\r\n // this.alert = { message: null, type: null };\r\n // }, 2000);\r\n this.openAlert('Contacto Guardado!', 'w-300', true)\r\n }, (error) => {\r\n // this.alert.message = error.error.code + '- ' + error.error.message;\r\n // this.alert.type = 2;\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 5000);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n });\r\n }\r\n\r\n onFileChanged(event) {\r\n if (event.target.files[0].type === 'image/jpeg' || event.target.files[0].type === 'image/png') {\r\n this.selectedFile = event.target.files[0];\r\n }\r\n }\r\n\r\n onUploadedImage(uploadedImage: object, formControlName: string) {\r\n if (formControlName === 'mediaContacts') {\r\n this.contactForm.get(formControlName).patchValue([uploadedImage['id']]);\r\n this.contactImage = uploadedImage['url'];\r\n }\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n showError(formValue) {\r\n return this.contactForm.get(formValue).invalid && this.contactForm.get(formValue).touched;\r\n }\r\n\r\n changeLanguage(language) {\r\n this.translate.setDefaultLang(language);\r\n setTimeout(() => {\r\n this.editContact(this.activatedRoute.snapshot.params.id);\r\n }, 100);\r\n }\r\n\r\n openAlert(modalText: string, className: string, status: boolean) {\r\n let iconClass: string;\r\n if (status) {\r\n iconClass = 'vi-check';\r\n } else {\r\n iconClass = 'vi-sad';\r\n }\r\n const modalConfig = {\r\n class: className,\r\n initialState: {\r\n alertMessage: this.translate.instant(\r\n modalText\r\n ),\r\n iconClass,\r\n status\r\n }\r\n }\r\n this.dialogRef = this.dialog.show(ModalAlertComponent, modalConfig);\r\n setTimeout(() => {\r\n this.dialogRef.hide();\r\n }, 2500);\r\n }\r\n}\r\n","
{{translate.instant(title)}}\r\n
\r\n \r\n Español \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
{{alert.message}}
\r\n
","import { Component, OnInit } from '@angular/core';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { errorMessages, regExps } from '../../../shared/custom-validators';\r\nimport { MakerService } from '../../../shared/maker.service';\r\nimport { environment } from '../../../../../environments/environment';\r\nimport { FormBuilder, FormGroup, Validators } from '@angular/forms';\r\nimport { ModalAlertComponent } from 'src/app/shared/modal-alert/modal-alert.component';\r\n\r\nconst FRONT_URL = environment.frontUrl;\r\n\r\n@Component({\r\n selector: 'app-maker-group',\r\n templateUrl: './maker-group.component.html',\r\n styleUrls: ['./maker-group.component.scss']\r\n})\r\nexport class MakerGroupComponent implements OnInit {\r\n\r\n groupForm: FormGroup;\r\n contactImage = null;\r\n selectedFile: File;\r\n selectedFiles = [];\r\n uploadedFiles = [];\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n uploadProgress = 0;\r\n alert = { message: null, type: null };\r\n errors = errorMessages;\r\n maker = null;\r\n contact = null;\r\n group = null;\r\n title = 'Nuevo grupo';\r\n selectedContacts = [];\r\n contacts: any = [];\r\n\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private formBuilder: FormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private makerService: MakerService,\r\n public translate: TranslateService,\r\n public dialog: BsModalService\r\n ) {\r\n if (this.makerService.getId()) {\r\n this.maker = '/makers/' + this.makerService.getId();\r\n this.createForm();\r\n } else {\r\n this.router.navigateByUrl('/maker/admin/perfil');\r\n }\r\n }\r\n\r\n ngOnInit(): void {\r\n if (this.activatedRoute.snapshot.params.id) {\r\n this.title = 'Editar grupo';\r\n setTimeout(() => {\r\n this.editGroup(this.activatedRoute.snapshot.params.id);\r\n }, 1000);\r\n }\r\n }\r\n\r\n\r\n createForm() {\r\n this.makerService.getContactsByMakerId(this.makerService.getId()).subscribe((res: any) => {\r\n var hydraContacts = [];\r\n\r\n res['hydra:member'].forEach(contact => {\r\n // if (contact.contactGroups.length > 0 && contact.contactGroups[0].id != this.activatedRoute.snapshot.params.id) {\r\n // hydraContacts.splice(hydraContacts.indexOf(contact), 1);\r\n // }\r\n // if (contact.contactGroups.length == 0 || contact.contactGroups[0].id == this.activatedRoute.snapshot.params.id) {\r\n hydraContacts.push(contact);\r\n // }\r\n });\r\n\r\n this.contacts = hydraContacts;\r\n\r\n });\r\n\r\n this.groupForm = this.formBuilder.group({\r\n\r\n name: [null,\r\n Validators.required\r\n ],\r\n contact: [[], Validators.required], // Agrega el control 'contact' con valor inicial null\r\n });\r\n }\r\n\r\n editGroup(contact_groupsId: any) {\r\n\r\n\r\n this.makerService.getGroup(contact_groupsId, this.translate.getDefaultLang()).subscribe((group: any) => {\r\n this.group = group;\r\n\r\n this.groupForm.get('name').setValue(group.name);\r\n\r\n const contactsMaker = [];\r\n group.contacts.forEach(contact => {\r\n contactsMaker.push({ name: contact.name, value: contact['@id'] });\r\n });\r\n\r\n console.log(contactsMaker)\r\n\r\n this.groupForm.get('contact').setValue(contactsMaker);\r\n\r\n\r\n });\r\n }\r\n\r\n updateGroup() {\r\n if (this.groupForm.invalid) {\r\n this.showErrors(this.groupForm);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n return;\r\n }\r\n\r\n var contactIris = [];\r\n this.groupForm.get('contact').value.forEach(contact => {\r\n contactIris.push(contact.value ? contact.value : contact['@id']);\r\n });\r\n\r\n console.log(contactIris)\r\n\r\n const editedGroup = {\r\n name: this.groupForm.get('name').value,\r\n contacts: contactIris\r\n // maker: this.groupForm.get('maker').value,\r\n };\r\n\r\n this.makerService.putGroupIri(this.group['@id'], editedGroup, this.translate.getDefaultLang())\r\n .subscribe(\r\n (result) => {\r\n // this.alert.type = 1;\r\n // this.alert.message = 'Grupo guardado correctamente';\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 2000);\r\n this.contact = null;\r\n this.createForm();\r\n location.replace(this.translate.getDefaultLang() + '/maker/admin/contactos');\r\n this.openAlert('Grupo guardado!', 'w-300', true)\r\n },\r\n error => {\r\n // this.alert.message = error.message;\r\n // this.alert.type = 2;\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 5000);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n },\r\n () => console.log('complete'));\r\n }\r\n\r\n createGroup() {\r\n if (this.groupForm.invalid) {\r\n this.showErrors(this.groupForm);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n return;\r\n }\r\n\r\n var contactsIris = [];\r\n\r\n this.groupForm.get('contact').value.forEach(contact => {\r\n contactsIris.push(contact['@id']);\r\n });\r\n\r\n const group = {\r\n name: this.groupForm.get('name').value,\r\n contacts: contactsIris,\r\n maker: '/makers/' + this.makerService.getId()\r\n // maker: this.groupForm.get('maker').value\r\n // name: document.getElementById('name').innerHTML,\r\n // maker: this.groupForm.get('maker').value\r\n\r\n };\r\n this.makerService.postGroup(group).subscribe(() => {\r\n // this.alert.type = 1;\r\n // this.alert.message = this.translate.instant('Grupo creado correctamente');\r\n // setTimeout(() => {\r\n // location.replace(this.translate.getDefaultLang() + '/maker/admin/contactos');\r\n // this.alert = { message: null, type: null };\r\n // }, 2000);\r\n this.openAlert('Grupo creado!', 'w-300', true)\r\n }, (error) => {\r\n // this.alert.message = error.error.code + '- ' + error.error.message;\r\n // this.alert.type = 2;\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 5000);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n });\r\n }\r\n\r\n onFileChanged(event) {\r\n if (event.target.files[0].type === 'image/jpeg' || event.target.files[0].type === 'image/png') {\r\n this.selectedFile = event.target.files[0];\r\n }\r\n }\r\n\r\n onUploadedImage(uploadedImage: object, formControlName: string) {\r\n if (formControlName === 'mediaContacts') {\r\n this.groupForm.get(formControlName).patchValue([uploadedImage['id']]);\r\n this.contactImage = FRONT_URL + uploadedImage['url'];\r\n }\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n showError(formValue) {\r\n return this.groupForm.get(formValue).invalid && this.groupForm.get(formValue).touched;\r\n }\r\n\r\n changeLanguage(language) {\r\n this.translate.setDefaultLang(language);\r\n setTimeout(() => {\r\n this.editGroup(this.activatedRoute.snapshot.params.id);\r\n }, 100);\r\n }\r\n\r\n openAlert(modalText: string, className: string, status: boolean) {\r\n let iconClass: string;\r\n if (status) {\r\n iconClass = 'vi-check';\r\n } else {\r\n iconClass = 'vi-sad';\r\n }\r\n const modalConfig = {\r\n class: className,\r\n initialState: {\r\n alertMessage: this.translate.instant(\r\n modalText\r\n ),\r\n iconClass,\r\n status\r\n }\r\n }\r\n this.dialogRef = this.dialog.show(ModalAlertComponent, modalConfig);\r\n setTimeout(() => {\r\n this.dialogRef.hide();\r\n }, 2500);\r\n }\r\n}\r\n","
\r\n {{ translate.instant(title) }}\r\n \r\n
\r\n
\r\n
\r\n
\r\n {{ alert.message }}\r\n
\r\n
","import { Component, Input, OnInit, Renderer2, ViewChild } from '@angular/core';\r\nimport { Meta, Title } from '@angular/platform-browser';\r\nimport { Router } from '@angular/router';\r\nimport { ModalDirective } from 'ngx-bootstrap/modal';\r\nimport { finalize } from 'rxjs/operators';\r\n\r\nimport { Experience } from '../../experiences/experiences/experience.model';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { TakerService } from '../../shared/taker.service';\r\nimport { Taker } from '../../taker/taker-profile/taker.model';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { ResellerService } from '../../shared/reseller.service';\r\nimport { AuthService } from '../../shared/auth.service';\r\nimport { ExperienceSearchComponent } from 'src/app/shared/experience-search/experience-search.component';\r\n\r\nimport { MakerService } from '../../shared/maker.service';\r\nimport { forEach } from 'jszip';\r\n\r\n@Component({\r\n selector: 'app-maker-directories',\r\n styleUrls: ['./maker-directories.component.scss'],\r\n templateUrl: './maker-directories.component.html',\r\n})\r\n\r\nexport class MakerDirectories implements OnInit {\r\n parentVariable: string;\r\n public expandedIndex = -1;\r\n public originalExperiences: Experience[];\r\n experiences = [];\r\n takerExperiences = [];\r\n resellerExperiences = [];\r\n shownDays = [\r\n { value: 0, text: 'Todos los días' },\r\n { value: 1, text: 'Lun' },\r\n { value: 2, text: 'Mar' },\r\n { value: 3, text: 'Mié' },\r\n { value: 4, text: 'Jue' },\r\n { value: 5, text: 'Vie' },\r\n { value: 6, text: 'Sáb' },\r\n { value: 7, text: 'Dom' },\r\n ];\r\n isAlertShown = false;\r\n throttle = 150;\r\n scrollDistance = 0.1;\r\n page = 1;\r\n total = 0;\r\n notEmptyExperience = true;\r\n notScrolly = true;\r\n loading = false;\r\n @ViewChild('autoShownModal', { static: false }) autoShownModal: ModalDirective;\r\n @Input() childData: string;\r\n\r\n constructor(\r\n private makerService: MakerService,\r\n private router: Router,\r\n private titleService: Title,\r\n private takerService: TakerService,\r\n private resellerService: ResellerService,\r\n public authService: AuthService,\r\n public translate: TranslateService,\r\n private meta: Meta,\r\n private renderer2: Renderer2\r\n ) {\r\n }\r\n\r\n ngOnInit(): void {\r\n this.removeMetaTags();\r\n this.loading = true;\r\n this.titleService.setTitle('Encuentra tu experiencia | Venntur');\r\n this.router['rawUrlTree'].queryParams['page'] = this.page;\r\n\r\n setTimeout(() => {\r\n this.makerService.getMakers(this.router['rawUrlTree'].queryParams)\r\n .pipe(\r\n finalize(() => this.loading = false)\r\n )\r\n .subscribe((experiences => {\r\n this.total = experiences['hydra:totalItems'];\r\n //this.experiences = experiences['hydra:member'];\r\n\r\n const filteredExperiences = experiences['hydra:member'].filter((experience) => experience.mediaMakersHeader[0]);\r\n\r\n this.experiences = filteredExperiences;\r\n\r\n console.log(this.experiences);\r\n\r\n\r\n }));\r\n }, 1000);\r\n /* this.makerService.getMakerByUserId(this.takerService.getId()).subscribe(experiences => {\r\n this.takerExperiences = Array.from(experiences['hydra:member']).map((item) => item['@id']);\r\n });\r\n this.makerService.getMakersByResellerId(this.resellerService.getId(), {}).subscribe(experiences => {\r\n this.resellerExperiences = Array.from(experiences['hydra:member']).map((item) => item['experience']['@id']);\r\n }); */\r\n this.meta.addTags([\r\n { name: 'description', content: 'test' },\r\n { name: 'lang', content: 'es' },\r\n { name: 'robots', content: 'index, follow' },\r\n { property: 'og:title', content: 'test' },\r\n { property: 'og:description', content: 'test' },\r\n { property: 'og:image', content: 'https://venntur.com/assets/venntur-isotype-70.png' },\r\n { property: 'og:url', content: 'https://venntur.com/' },\r\n { property: 'og:site_name', content: 'Venntur' }\r\n ]);\r\n }\r\n\r\n clickFavorite(event, experienceId) {\r\n if (this.takerService.getId()) {\r\n this.takerExperiences.includes(experienceId) ?\r\n this.takerExperiences.splice(this.takerExperiences.indexOf(experienceId), 1) : this.takerExperiences.push(experienceId);\r\n const taker = {\r\n favoriteExperiences: this.takerExperiences\r\n };\r\n const editedTaker = new Taker(taker);\r\n this.takerService.putTaker(this.takerService.getId(), editedTaker).subscribe();\r\n } else {\r\n this.isAlertShown = true;\r\n }\r\n }\r\n\r\n addFavoriteToReseller(event, experienceId) {\r\n this.resellerExperiences.includes(experienceId) ?\r\n this.resellerExperiences.splice(this.resellerExperiences.indexOf(experienceId), 1) : this.resellerExperiences.push(experienceId);\r\n const favoriteExperience = {\r\n reseller: '/resellers/' + this.resellerService.getId(),\r\n experience: experienceId,\r\n status: 'Pendiente contacto'\r\n };\r\n this.resellerService.postFavoriteExperience(favoriteExperience).subscribe();\r\n }\r\n\r\n removeFavoriteToReseller(favoriteExperienceId) {\r\n this.makerService.getMakersByResellerId(this.resellerService.getId(), { id: favoriteExperienceId }).subscribe(experiences => {\r\n this.resellerService.deleteFavoriteExperience(experiences['hydra:member'][0]['@id']).subscribe(() => {\r\n this.resellerExperiences.splice(this.resellerExperiences.indexOf(favoriteExperienceId), 1);\r\n });\r\n });\r\n }\r\n\r\n expandText(index: number): void {\r\n this.expandedIndex = index === this.expandedIndex ? -1 : index;\r\n }\r\n\r\n onScroll() {\r\n this.loading = true;\r\n if (this.notScrolly && this.notEmptyExperience) {\r\n this.notScrolly = false;\r\n setTimeout(() => {\r\n this.loadNextExperience();\r\n }, 500);\r\n } else {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n loadNextExperience() {\r\n // this.router['rawUrlTree'].queryParams['page'] = ++this.page;\r\n ++this.page;\r\n let updatedUrl;\r\n if (this.parentVariable) {\r\n updatedUrl = this.parentVariable.replace(/page=\\d+/, `page=${this.page}`);\r\n } else if (this.router['rawUrlTree'].queryParams['localidad']) {\r\n this.router['rawUrlTree'].queryParams['page'] = this.page;\r\n updatedUrl = this.router['rawUrlTree'];\r\n } else {\r\n updatedUrl = '?page=' + this.page;\r\n }\r\n\r\n let params: any = (new URL('http://localhost:4200/' + updatedUrl)).searchParams;\r\n\r\n if (this.experiences.length < this.total) {\r\n this.makerService.getMakersByUrl(params, 'es')\r\n .pipe(\r\n finalize(() => this.loading = false)\r\n )\r\n .subscribe((experiences => {\r\n this.total = experiences['hydra:totalItems'];\r\n\r\n const filteredExperiences = experiences['hydra:member'].filter((experience) => experience.mediaMakersHeader[0]);\r\n this.experiences = this.experiences.concat(filteredExperiences);\r\n }));\r\n // let i;\r\n // const length = this.experiences.length;\r\n // const experiencePerPage = 9;\r\n // const experienceToLoad = this.originalExperiences.length - length;\r\n\r\n // if ( experienceToLoad >= experiencePerPage ) {\r\n // for (i = length; i <= length + experiencePerPage; i++) {\r\n // this.experiences.push(this.originalExperiences[i]);\r\n // }\r\n // } else {\r\n // for (i = length; i <= length + experienceToLoad - 1; i++) {\r\n // this.experiences.push(this.originalExperiences[i]);\r\n // }\r\n // }\r\n this.notScrolly = true;\r\n } else {\r\n this.notEmptyExperience = false;\r\n this.loading = false;\r\n }\r\n }\r\n\r\n hideModal(): void {\r\n this.autoShownModal.hide();\r\n }\r\n\r\n onHidden(): void {\r\n this.isAlertShown = false;\r\n }\r\n\r\n changeParentVariable(newVariable: string) {\r\n this.parentVariable = newVariable;\r\n\r\n const params = (new URL('http://localhost:4200/' + this.parentVariable)).searchParams;\r\n\r\n this.makerService.getMakersByUrl(params, 'es')\r\n .pipe(\r\n finalize(() => this.loading = false)\r\n )\r\n .subscribe((experiences => {\r\n this.total = experiences['hydra:totalItems'];\r\n this.experiences = experiences['hydra:member'];\r\n this.page = 1;\r\n }));\r\n\r\n }\r\n\r\n getUrl(isCivitatis, image) {\r\n return !isCivitatis ? 'https://venntur.com/assets/experience/files/' + image : image;\r\n }\r\n\r\n setCategoryTitle(experience) {\r\n return experience.categories.map(obj => obj.name).join(' / ')\r\n }\r\n\r\n setLanguagesTitle(experience) {\r\n return experience.languages.map(obj => obj.name).join(' , ')\r\n }\r\n\r\n convertTimeToCustomFormat(inputTime: string): string {\r\n let formattedText;\r\n const [hours, minutes] = inputTime.split(':').map(part => parseInt(part, 10));\r\n\r\n if (minutes != 0) {\r\n formattedText = hours + ' h y ' + minutes + ' min'\r\n } else {\r\n formattedText = hours + ' h'\r\n }\r\n\r\n return formattedText;\r\n }\r\n\r\n shareExperience(experience) {\r\n var enlace = 'https://venntur.com/product/' + experience.slug;\r\n var mensaje = '¡Mira esta experiencia en Venntur!';\r\n\r\n mensaje = encodeURIComponent(mensaje);\r\n enlace = encodeURIComponent(enlace);\r\n\r\n var enlaceWhatsApp = 'https://wa.me/?text=' + mensaje + '%20' + enlace;\r\n\r\n window.open(enlaceWhatsApp);\r\n\r\n }\r\n\r\n removeMetaTags() {\r\n const metaTags = Array.from(document.querySelectorAll('meta'));\r\n\r\n metaTags.forEach((metaTag: Element) => {\r\n this.renderer2.removeChild(document.head, metaTag);\r\n });\r\n }\r\n\r\n}\r\n","
\r\n
\r\n
\r\n
\r\n
\r\n
{{ 'Encuentra tu empresa' | translate}} \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
{{ 'Sin resultados' | translate}} \r\n
{{ 'Ups.. Parece que no hay resultados para tu búsqueda' | translate}}
\r\n
{{ 'Inténtalo de nuevo utilizando otros filtros o' | translate}} {{ 'ponte en contacto con nosotros' | translate}} {{ ' y te ayudaremos a encontrar el organizador que estás buscando.' | translate}}\r\n
\r\n
\r\n
\r\n
\r\n Loading... \r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
","import { Component, HostListener, Inject, OnInit, Renderer2, TemplateRef } from '@angular/core';\r\nimport { Meta, Title } from '@angular/platform-browser';\r\nimport { Router } from '@angular/router';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { finalize } from 'rxjs/operators';\r\nimport { TakerService } from '../../shared/taker.service';\r\nimport { Taker } from '../../taker/taker-profile/taker.model';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { Experience } from '../../experiences/experiences/experience.model';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { MakerService } from '../../shared/maker.service';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { LocationService } from '../../../shared/locations/location.service';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { AnalyticsService } from 'src/app/pages/analytics/analytics.service';\r\nimport { JsonLdService } from 'src/app/json-ld.service';\r\n\r\n@Component({\r\n selector: 'app-maker-page',\r\n styleUrls: ['./maker-page.component.scss'],\r\n templateUrl: './maker-page.component.html'\r\n})\r\n\r\nexport class MakerPageComponent implements OnInit {\r\n public expandedIndex = -1;\r\n public originalExperiences: Experience[];\r\n experiences = [];\r\n takerExperiences = [];\r\n shownDays = [\r\n { value: 0, text: 'Todos los días' },\r\n { value: 1, text: 'Lun' },\r\n { value: 2, text: 'Mar' },\r\n { value: 3, text: 'Mié' },\r\n { value: 4, text: 'Jue' },\r\n { value: 5, text: 'Vie' },\r\n { value: 6, text: 'Sáb' },\r\n { value: 7, text: 'Dom' },\r\n ];\r\n maker = null;\r\n makerId = null;\r\n isAlertShown = false;\r\n throttle = 150;\r\n scrollDistance = 0.1;\r\n notEmptyExperience = true;\r\n notScrolly = true;\r\n loading = false;\r\n cities = null;\r\n citySelected = null;\r\n showCategories: boolean = false;\r\n experienceSearchForm: UntypedFormGroup;\r\n modalRef: BsModalRef;\r\n customPhoneTooltip = 'Copiar al portapapeles';\r\n customEmailTooltip = 'Copiar al portapapeles';\r\n myImageArray = ['https://venntur.com/assets/experience/files/649198d9952cf975573530.jpeg', 'https://venntur.com/assets/experience/files/600c20ad9f5d5384735017.jpg', 'https://venntur.com/assets/experience/files/60d2f09f2e710932983928.jpeg']\r\n\r\n constructor(\r\n private experienceService: ExperiencesService,\r\n private makerService: MakerService,\r\n public locationService: LocationService,\r\n private modalService: BsModalService,\r\n private router: Router,\r\n private titleService: Title,\r\n private takerService: TakerService,\r\n public translate: TranslateService,\r\n private renderer2: Renderer2,\r\n private formBuilder: UntypedFormBuilder,\r\n private analyticsService: AnalyticsService,\r\n private meta: Meta,\r\n private title: Title,\r\n private jsonLdService: JsonLdService,\r\n @Inject(DOCUMENT) private _document\r\n ) {\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n this.removeMetaTags();\r\n this.loading = true;\r\n this.titleService.setTitle('Encuentra tu maker | Venntur');\r\n\r\n // this.makerId = this.router['browserUrlTree'].root.children.primary.segments[2].path;\r\n\r\n var makerSlug = this.router['rawUrlTree'].root.children.primary.segments[2].path;\r\n\r\n this.makerService.getMakerBySlug(makerSlug, this.translate.getDefaultLang()).subscribe(maker => {\r\n maker = maker['hydra:member'][0];\r\n this.makerService.getMaker(maker['@id'], this.translate.getDefaultLang()).subscribe((maker => {\r\n\r\n this.makerId = maker.id;\r\n\r\n this.maker = maker;\r\n this.cities = maker['activeLocations'];\r\n\r\n // Add JSON-LD script\r\n this.addJsonLdScript();\r\n\r\n const s = this.renderer2.createElement('script');\r\n s.type = 'text/javascript';\r\n s.src = `https://www.jscache.com/wejs?wtype=cdsratingsonlywide&uniq=609&border=true&lang=en_US&locationId=${maker['tripadvisor']}&border=false&display_version=2`;\r\n s.text = ``;\r\n this.renderer2.appendChild(this._document.body, s);\r\n\r\n this.meta.addTags([\r\n { name: 'description', content: this.removeHtmlTags(this.maker.description) },\r\n { name: 'lang', content: 'es' },\r\n { name: 'robots', content: 'index, follow' },\r\n { property: 'og:title', content: this.maker.name },\r\n { property: 'og:description', content: this.removeHtmlTags(this.maker.description) },\r\n { property: 'og:image', content: 'https://venntur.com/assets/maker/files/' + maker.mediaMakers[0].contentUrl },\r\n { property: 'og:url', content: 'https://venntur.com/' + this.maker.slug },\r\n { property: 'og:site_name', content: 'Venntur' }\r\n ]);\r\n this.setTitle(this.maker.name);\r\n\r\n /* ****************************************** */\r\n /* *********** GET EXPERIENCES ************** */\r\n /* Movida la obtención de experiencias fuera */\r\n /* del timeout porque no siempre cargaban... */\r\n /* ****************************************** */\r\n\r\n this.experienceService.getExperiencesByMakerId(this.makerId, {}, this.translate.getDefaultLang())\r\n .pipe(\r\n finalize(() => this.loading = false)\r\n )\r\n .subscribe((experiences => {\r\n this.originalExperiences = experiences['hydra:member'];\r\n this.analyticsService.calculateAnalytic({ 'type': 'makerPage', 'directoryAnalyticsId': this.maker.directoriesAnalytics[0], 'experiences': experiences['hydra:member'] }).subscribe();\r\n this.experiences = this.originalExperiences.slice(0, 9);\r\n }));\r\n\r\n /* ****************************************** */\r\n /* ****************************************** */\r\n /* ****************************************** */\r\n\r\n\r\n\r\n }))\r\n\r\n });\r\n /* setTimeout(() => {\r\n \r\n }, 1000); */\r\n this.experienceService.getExperiencesByTakerId(this.takerService.getId()).subscribe(experiences => {\r\n this.takerExperiences = Array.from(experiences['hydra:member']).map((item) => item['@id']);\r\n });\r\n // this.locationService.getLocations().subscribe(locations => {\r\n // this.cities = locations['hydra:member'];\r\n // });\r\n }\r\n\r\n createForm() {\r\n this.experienceSearchForm = this.formBuilder.group({\r\n location: ['',\r\n Validators.required\r\n ]\r\n });\r\n }\r\n\r\n @HostListener('document:click', ['$event'])\r\n onDocumentClick(event: MouseEvent) {\r\n // Check if the click event target is not inside the element\r\n if (!this.isDescendant(event.target as Node, document.querySelector('.tags-container'))) {\r\n this.showCategories = false;\r\n }\r\n }\r\n\r\n // Helper function to check if an element is a descendant of another element\r\n private isDescendant(element: Node, parent: Node | null): boolean {\r\n while (element !== null) {\r\n if (element === parent) {\r\n return true;\r\n }\r\n element = element.parentNode;\r\n }\r\n return false;\r\n }\r\n\r\n clickFavorite(event, experienceId) {\r\n if (this.takerService.getId()) {\r\n this.takerExperiences.includes(experienceId) ?\r\n this.takerExperiences.splice(this.takerExperiences.indexOf(experienceId), 1) : this.takerExperiences.push(experienceId);\r\n const taker = {\r\n favoriteExperiences: this.takerExperiences\r\n };\r\n const editedTaker = new Taker(taker);\r\n this.takerService.putTaker(this.takerService.getId(), editedTaker).subscribe();\r\n } else {\r\n this.isAlertShown = true;\r\n }\r\n }\r\n\r\n expandText(index: number): void {\r\n this.expandedIndex = index === this.expandedIndex ? -1 : index;\r\n }\r\n\r\n onScroll() {\r\n this.loading = true;\r\n if (this.notScrolly && this.notEmptyExperience) {\r\n this.notScrolly = false;\r\n setTimeout(() => {\r\n this.loadNextExperience();\r\n }, 500);\r\n } else {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n loadNextExperience() {\r\n if (this.experiences.length < this.originalExperiences.length) {\r\n let i;\r\n const length = this.experiences.length;\r\n const experiencePerPage = 8;\r\n const experienceToLoad = this.originalExperiences.length - length;\r\n\r\n if (experienceToLoad >= experiencePerPage) {\r\n for (i = length; i <= length + experiencePerPage; i++) {\r\n this.experiences.push(this.originalExperiences[i]);\r\n }\r\n } else {\r\n for (i = length; i <= length + experienceToLoad - 1; i++) {\r\n this.experiences.push(this.originalExperiences[i]);\r\n }\r\n }\r\n this.notScrolly = true;\r\n } else {\r\n this.notEmptyExperience = false;\r\n }\r\n this.loading = false;\r\n }\r\n\r\n searchExperiences() {\r\n this.loading = true;\r\n this.experienceService.getExperiencesByMakerId(this.makerId, { location: this.experienceSearchForm.get('location').value },\r\n this.translate.getDefaultLang())\r\n // this.experienceService.getExperiencesByMakerId(this.makerId, this.router['rawUrlTree'].queryParams, )\r\n .pipe(\r\n finalize(() => this.loading = false)\r\n )\r\n .subscribe((experiences => {\r\n this.originalExperiences = experiences['hydra:member'];\r\n this.experiences = this.originalExperiences.slice(0, 10);\r\n this.loading = false;\r\n }));\r\n }\r\n\r\n openPhotosModal(template: TemplateRef
, config: any) {\r\n this.modalRef = this.modalService.show(template, config);\r\n }\r\n\r\n changePhoneTooltip(text: string) {\r\n const textarea = document.createElement('textarea');\r\n textarea.style.position = 'fixed';\r\n textarea.style.opacity = '0';\r\n textarea.value = text;\r\n document.body.appendChild(textarea);\r\n textarea.select();\r\n document.execCommand('copy');\r\n document.body.removeChild(textarea);\r\n this.customEmailTooltip = 'Copiar al portapapeles'\r\n this.customPhoneTooltip = 'Copiado!'\r\n }\r\n\r\n changeEmailTooltip(text: string) {\r\n const textarea = document.createElement('textarea');\r\n textarea.style.position = 'fixed';\r\n textarea.style.opacity = '0';\r\n textarea.value = text;\r\n document.body.appendChild(textarea);\r\n textarea.select();\r\n document.execCommand('copy');\r\n document.body.removeChild(textarea);\r\n this.customPhoneTooltip = 'Copiar al portapapeles'\r\n this.customEmailTooltip = 'Copiado!'\r\n }\r\n\r\n convertTimeToCustomFormat(inputTime: string): string {\r\n let formattedText;\r\n const [hours, minutes] = inputTime.split(':').map(part => parseInt(part, 10));\r\n\r\n if (minutes != 0) {\r\n formattedText = hours + ' h y ' + minutes + ' min'\r\n } else {\r\n formattedText = hours + ' h'\r\n }\r\n\r\n return formattedText;\r\n }\r\n\r\n getUrl(isCivitatis, image) {\r\n return !isCivitatis ? 'https://venntur.com/assets/experience/files/' + image : image;\r\n }\r\n\r\n setCategoryTitle(experience) {\r\n return experience.categories.map(obj => obj.name).join(' / ')\r\n }\r\n setActiveCategoryTitle(activeCategories) {\r\n return activeCategories.map(obj => obj[1]).join(' - ')\r\n }\r\n\r\n setLanguagesTitle(experience) {\r\n return experience.languages.map(obj => obj.name).join(' , ')\r\n }\r\n\r\n shareExperience(experience) {\r\n var enlace = 'https://venntur.com/product/' + experience.slug;\r\n var mensaje = '¡Mira esta experiencia en Venntur!';\r\n\r\n mensaje = encodeURIComponent(mensaje);\r\n enlace = encodeURIComponent(enlace);\r\n\r\n var enlaceWhatsApp = 'https://wa.me/?text=' + mensaje + '%20' + enlace;\r\n\r\n window.open(enlaceWhatsApp);\r\n }\r\n\r\n private addJsonLdScript(): void {\r\n const jsonLd = {\r\n \"@context\": \"https://schema.org\",\r\n \"@type\": \"Organization\",\r\n \"name\": this.maker.name,\r\n \"url\": `https://venntur.com/${this.maker.slug}`,\r\n \"description\": this.removeHtmlTags(this.maker.description),\r\n \"address\": {\r\n \"@type\": \"PostalAddress\",\r\n \"addressLocality\": this.cities?.map((city) => city.name).join(', ')\r\n },\r\n \"image\": `https://venntur.com/assets/maker/files/${this.maker.mediaMakers[0].contentUrl}`,\r\n \"telephone\": this.maker.phone,\r\n \"sameAs\": this.maker.socialMediaLinks // Assuming you have an array of social media URLs\r\n };\r\n\r\n const script = this.renderer2.createElement('script');\r\n script.type = 'application/ld+json';\r\n script.text = JSON.stringify(jsonLd);\r\n this.renderer2.appendChild(this._document.head, script);\r\n }\r\n\r\n removeHtmlTags(input) {\r\n if (input) {\r\n let stringWithoutEntities = input.replace(/&[a-zA-Z]+;/g, function (match) {\r\n const entityMap = {\r\n 'á': 'á',\r\n 'ó': 'ó',\r\n 'é': 'é',\r\n 'í': 'í',\r\n 'ú': 'ú',\r\n };\r\n return entityMap[match] || match;\r\n });\r\n \r\n return stringWithoutEntities.replace(/<\\/?[^>]+(>|$)/g, \"\");\r\n }\r\n \r\n return input;\r\n }\r\n\r\n removeMetaTags() {\r\n const metaTags = Array.from(document.querySelectorAll('meta'));\r\n\r\n metaTags.forEach((metaTag: Element) => {\r\n this.renderer2.removeChild(document.head, metaTag);\r\n });\r\n }\r\n\r\n public setTitle(newTitle: string) {\r\n this.title.setTitle(newTitle);\r\n }\r\n}\r\n","\r\n
\r\n
\r\n
0 ? maker.mediaMakersHeader[0].contentUrl : '')\"\r\n alt=\"Imagen de cabecera\" onError=\"this.src='https://venntur.com/assets/image-not-available-placeholder.png'\">\r\n \r\n
\r\n
\r\n
\r\n
\r\n
0 ? maker.mediaMakers[0].contentUrl : '')\"\r\n alt=\"{{maker['phrase']}}\" title=\"{{maker['phrase']}}\"\r\n onError=\"this.src='assets/image-not-available-placeholder.png'\">\r\n
\r\n
\r\n
{{maker.name}} \r\n {{maker.address}} \r\n {{maker.postalCode}},\r\n {{maker.location.name}} \r\n \r\n
\r\n
\r\n
\r\n {{activeCategory[1]}}\r\n \r\n
\r\n \r\n
\r\n\r\n
\r\n
\r\n\r\n
\r\n\r\n
0\">\r\n \r\n \r\n {{ 'Estas son las experiencias que tenemos para ti' | translate }}\r\n \r\n \r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n Loading... \r\n
\r\n
\r\n
\r\n
","import { Component, ElementRef, Inject, OnInit, Renderer2, ViewChild } from '@angular/core';\r\nimport { Title } from '@angular/platform-browser';\r\nimport { Router } from '@angular/router';\r\nimport { MakerService } from '../../shared/maker.service';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { DOCUMENT } from '@angular/common';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { finalize } from 'rxjs/operators';\r\nimport { Experience } from '../../experiences/experiences/experience.model';\r\nimport { AnalyticsService } from '../../analytics/analytics.service';\r\nimport { TakerService } from '../../shared/taker.service';\r\nimport KeenSlider, { KeenSliderInstance } from 'keen-slider';\r\n\r\n@Component({\r\n selector: 'app-maker-pin',\r\n templateUrl: './maker-pin.component.html',\r\n styleUrls: ['./maker-pin.component.scss',\r\n '../../../../../node_modules/keen-slider/keen-slider.min.css'],\r\n\r\n})\r\nexport class MakerPinComponent implements OnInit {\r\n\r\n @ViewChild(\"pinImagesSlider\") pinImagesSlider: ElementRef;\r\n public originalExperiences: Experience[];\r\n experiences = [];\r\n takerExperiences = [];\r\n makerImages = [];\r\n loading = false;\r\n makerId = null;\r\n maker = null;\r\n cities = null;\r\n showTab = 'companyData';\r\n pagesQuantity = 0;\r\n currentPage = 1;\r\n\r\n currentSlide: number = 0\r\n dotHelper: Array = []\r\n slider: KeenSliderInstance = null\r\n\r\n constructor(\r\n private titleService: Title,\r\n private router: Router,\r\n private makerService: MakerService,\r\n public translate: TranslateService,\r\n private renderer2: Renderer2,\r\n private experienceService: ExperiencesService,\r\n private takerService: TakerService,\r\n @Inject(DOCUMENT) private _document\r\n\r\n ) { }\r\n\r\n ngOnInit(): void {\r\n this.loading = true;\r\n this.titleService.setTitle('Encuentra tu maker | Venntur');\r\n\r\n var makerSlug = this.router['rawUrlTree'].root.children.primary.segments[2].path;\r\n\r\n this.makerService.getMakerBySlug(makerSlug, this.translate.getDefaultLang()).subscribe(maker => {\r\n\r\n maker = maker['hydra:member'][0];\r\n\r\n this.makerService.getMakerById(maker.id).subscribe(maker => {\r\n\r\n if (maker.mediaMakersDocs.length > 0) {\r\n maker.mediaMakersDocs.forEach(doc => {\r\n\r\n //cases: Licencia de actividad, Plantilla de contrato de colaboracion, Poliza RRCC, ReciboRRCC, Catalogos\r\n\r\n switch (doc.typeOf) {\r\n case 'Licencia de actividad':\r\n doc.typeOf = 'Licencia de actividad';\r\n break;\r\n case 'Plantilla de contrato de colaboracion':\r\n doc.typeOf = 'Plantilla de contrato de colaboración';\r\n break;\r\n case 'Poliza RRCC': \r\n doc.typeOf = 'Póliza RRCC';\r\n break;\r\n case 'Recibo RRCC':\r\n doc.typeOf = 'Recibo RRCC';\r\n break;\r\n case 'Catalogos':\r\n doc.typeOf = 'Catálogos';\r\n break;\r\n }\r\n\r\n\r\n\r\n });\r\n }\r\n\r\n this.makerId = maker.id;\r\n\r\n this.maker = maker;\r\n\r\n maker.mediaMakersHeader.forEach(image => {\r\n this.makerImages.push('https://venntur.com/assets/makerHeader/files/' + image.contentUrl)\r\n });\r\n maker.mediaMakersStaff.forEach(image => {\r\n this.makerImages.push('https://venntur.com/assets/makerStaff/files/' + image.contentUrl)\r\n });\r\n\r\n this.cities = maker['activeLocations'];\r\n const s = this.renderer2.createElement('script');\r\n s.type = 'text/javascript';\r\n s.src = `https://www.jscache.com/wejs?wtype=cdsratingsonlywide&uniq=609&border=true&lang=en_US&locationId=${maker['tripadvisor']}&border=false&display_version=2`;\r\n s.text = ``;\r\n this.renderer2.appendChild(this._document.body, s);\r\n\r\n this.experienceService.getExperiencesByMakerId(this.makerId, {}, 'es')\r\n .pipe(\r\n finalize(() => this.loading = false)\r\n )\r\n .subscribe((experiences => {\r\n this.originalExperiences = experiences['hydra:member'];\r\n this.pagesQuantity = Math.ceil(this.originalExperiences.length / 4)\r\n console.log(this.pagesQuantity);\r\n\r\n }));\r\n\r\n });\r\n\r\n\r\n });\r\n this.experienceService.getExperiencesByTakerId(this.takerService.getId()).subscribe(experiences => {\r\n this.takerExperiences = Array.from(experiences['hydra:member']).map((item) => item['@id']);\r\n });\r\n }\r\n\r\n ngAfterViewInit() {\r\n setTimeout(() => {\r\n this.slider = new KeenSlider(this.pinImagesSlider.nativeElement, {\r\n initial: this.currentSlide,\r\n slideChanged: (s) => {\r\n this.currentSlide = s.track.details.rel\r\n },\r\n })\r\n this.dotHelper = [\r\n ...Array(this.slider.track.details.slides.length).keys(),\r\n ]\r\n }, 1000);\r\n }\r\n\r\n ngOnDestroy() {\r\n if (this.slider) this.slider.destroy()\r\n }\r\n\r\n setCategoryTitle(experience) {\r\n return experience.categories.map(obj => obj.name).join(', ')\r\n }\r\n\r\n nextPage() {\r\n if (this.currentPage == this.pagesQuantity) {\r\n return\r\n } else {\r\n this.currentPage++;\r\n }\r\n }\r\n\r\n prevPage() {\r\n if (this.currentPage == 1) {\r\n return\r\n } else {\r\n this.currentPage--;\r\n }\r\n }\r\n\r\n\r\n}\r\n","\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
0 ? maker.mediaMakers[0].contentUrl : '')\"\r\n alt=\"Imagen de la empresa\">\r\n
\r\n
\r\n Nombre Comercial \r\n {{maker.name}} \r\n
\r\n
\r\n
\r\n ID \r\n {{maker.id}} \r\n
\r\n
\r\n API Tripadvisor \r\n {{maker.tripadvisor}} \r\n
\r\n
\r\n Sistemas de reservas \r\n {{maker.bookingEngine}} \r\n
\r\n
\r\n ID sistema de reservas ({{maker.bookingEngine}}) \r\n {{maker.bookingEngineWidget}} \r\n \r\n
\r\n
\r\n Google Maps \r\n {{maker.googleMaps}} \r\n
\r\n
\r\n
\r\n
\r\n
\r\n Nombre Comercial \r\n {{maker.name}} \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
1\">\r\n \r\n
\r\n
\r\n
\r\n
\r\n Nombre Comercial \r\n {{maker.name}} \r\n
\r\n
\r\n
\r\n ID \r\n {{maker.id}} \r\n
\r\n
\r\n API Tripadvisor \r\n {{maker.tripadvisor}} \r\n
\r\n
\r\n Sistemas de reservas \r\n {{maker.bookingEngine}} \r\n
\r\n
\r\n ID sistema de reservas ({{maker.bookingEngine}}) \r\n {{maker.bookingEngineWidget}} \r\n
\r\n
\r\n Google Maps \r\n {{maker.googleSites}} \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n Razón Social\r\n \r\n \r\n {{maker.companyName}}\r\n \r\n
\r\n
\r\n \r\n {{maker.documentType}}\r\n \r\n \r\n {{maker.document}}\r\n \r\n
\r\n
\r\n \r\n Dirección\r\n \r\n \r\n {{maker.address}}\r\n \r\n
\r\n
\r\n \r\n Zona\r\n \r\n \r\n {{maker.location.name}}\r\n \r\n
\r\n
\r\n \r\n País\r\n \r\n \r\n {{maker.country}}\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n Contacto\r\n \r\n \r\n {{maker.name}}\r\n \r\n
\r\n
\r\n \r\n Teléfono\r\n \r\n \r\n {{maker.phone}}\r\n \r\n
\r\n
\r\n \r\n Teléfono 2\r\n \r\n \r\n {{maker.phone2}}\r\n \r\n
\r\n
\r\n \r\n Mail Reservas\r\n \r\n \r\n {{maker.bookingEmail}}\r\n \r\n
\r\n
\r\n \r\n Mail Comercial\r\n \r\n \r\n {{maker.email}}\r\n \r\n
\r\n
\r\n \r\n Mail Administración\r\n \r\n \r\n {{maker.administrationEmail}}\r\n \r\n
\r\n
\r\n
\r\n RR SS\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n Condiciones de reserva\r\n \r\n \r\n \r\n {{maker.reservationConditions}}\r\n\r\n \r\n
\r\n
\r\n \r\n Condiciones de cancelación y cambios\r\n \r\n \r\n {{maker.cancelationConditions}}\r\n \r\n
\r\n
\r\n \r\n Condiciones de pago\r\n \r\n \r\n {{maker.paymentConditions}}\r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
Productos \r\n
\r\n Total: \r\n {{originalExperiences.length}} productos \r\n
\r\n
\r\n
0\">\r\n
\r\n
\r\n
{{experience.name}} \r\n
\r\n
\r\n
{{experience.name}} \r\n
\r\n
\r\n
\r\n Ubicación \r\n
\r\n
{{experience.location.name}} \r\n
\r\n
\r\n
\r\n Modalidades \r\n
\r\n
\r\n {{modality.title}}XXX, \r\n
\r\n
\r\n
\r\n
\r\n Categorías \r\n
\r\n
\r\n {{category.name}}, \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n Descargar todos \r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
","import { Component, OnInit, TemplateRef } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { Title } from '@angular/platform-browser';\r\nimport { Maker } from './maker.model';\r\nimport { HttpEventType } from '@angular/common/http';\r\nimport { MediaMakerService } from './media-maker';\r\nimport { MakerService } from '../../shared/maker.service';\r\nimport { CustomValidators, errorMessages, regExps } from '../../shared/custom-validators';\r\nimport { AuthService } from '../../shared/auth.service';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { environment } from '../../../../environments/environment';\r\nimport { Tag } from '../../../shared/tags/tag.model';\r\nimport { TagsService } from '../../../shared/tags/tags.service';\r\nimport { User } from '../../../shared/users/user.model';\r\nimport { UsersService } from '../../../shared/users/users.service';\r\nimport { LocationService } from 'src/app/shared/locations/location.service';\r\nimport { CountryService } from 'src/app/shared/locations/country.service';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { ReplaySubject } from 'rxjs';\r\nimport { Location } from '../../../shared/locations/location.model';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { ModalAlertComponent } from 'src/app/shared/modal-alert/modal-alert.component';\r\nimport ClassicEditor from '@ckeditor/ckeditor5-build-classic';\r\n//import file from angular http\r\n\r\ndeclare const Stripe: any;\r\n\r\nconst FRONT_URL = environment.frontUrl;\r\nconst PUBLIC_KEY = environment.stripe.publicKey;\r\nconst BASIC_PRICE = environment.stripe.basicPrice;\r\n\r\n@Component({\r\n selector: 'app-maker',\r\n styleUrls: ['./maker.component.scss'],\r\n templateUrl: './maker.component.html',\r\n\r\n})\r\nexport class MakerComponent implements OnInit {\r\n public Editor = ClassicEditor;\r\n contactForm: UntypedFormGroup;\r\n makerForm: UntypedFormGroup;\r\n planForm: UntypedFormGroup;\r\n maker: Maker;\r\n title = 'Perfil maker';\r\n documentTypes = ['DNI', 'NIE', 'CIF'];\r\n documentTypeSelected = null;\r\n selectedFile: File;\r\n selectedFiles = [];\r\n uploadedFiles = [];\r\n\r\n selectedPdfFile: File;\r\n selectedPdfFiles = [];\r\n uploadedPdfFiles = [];\r\n pdfFiles: any;\r\n\r\n validPolizaRRCC = false;\r\n validReciboRRCC = false;\r\n validLicenciaActividad = false;\r\n validPlantillaContratoColaboracion = false;\r\n validCatalogos = false;\r\n\r\n namePolizaRRCC = '';\r\n nameReciboRRCC = '';\r\n nameLicenciaActividad = '';\r\n namePlantillaContratoColaboracion = '';\r\n nameCatalogos = '';\r\n\r\n image = null;\r\n contactImage = null;\r\n images = [];\r\n logoImage = null;\r\n headerImage = null;\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n alert = { message: null, type: null };\r\n errors = errorMessages;\r\n uploadProgress = 0;\r\n makerId = null;\r\n phraseMaxChar = 160;\r\n descriptionMaxChar = 1200;\r\n plan = null;\r\n invoices = [];\r\n tags: Tag[] = [];\r\n tagsSelected = [];\r\n mediaMakersStaff = [];\r\n formLanguage = this.translate.getDefaultLang();\r\n columns = [];\r\n rows = [];\r\n plans = [];\r\n planSelected = null;\r\n public locationList: ReplaySubject = new ReplaySubject(1);\r\n countryList = [];\r\n editorTemplateStaticData = '';\r\n editorTemplate: any;\r\n\r\n locations: Location[] = [];\r\n\r\n makerExperiences: any;\r\n totalExperiences: any;\r\n publishedExperiences = 0;\r\n\r\n showTab = 'private';\r\n nextPayment = null;\r\n\r\n isInfoValid = false;\r\n isDirectoryValid = false;\r\n isSheetValid = false;\r\n isPinValid = false;\r\n pdf: any;\r\n\r\n productsSelected = 3;\r\n regulation = 'monthly'\r\n modalRef: BsModalRef;\r\n\r\n bookingEngine = '';\r\n\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private authService: AuthService,\r\n private experiencesService: ExperiencesService,\r\n private makerService: MakerService,\r\n private userService: UsersService,\r\n private tagService: TagsService,\r\n private mediaMakerService: MediaMakerService,\r\n private locationService: LocationService,\r\n private countryService: CountryService,\r\n public translate: TranslateService,\r\n public dialog: BsModalService\r\n ) {\r\n this.makerService.getPlans().subscribe(plans => {\r\n this.plans = plans['hydra:member'];\r\n });\r\n /* this.locationService.getLocations().subscribe(locations => {\r\n this.locationList = locations['hydra:member'];\r\n }); */\r\n this.countryService.getCountries().subscribe(countries => {\r\n this.countryList = countries;\r\n });\r\n if (this.makerService.getId()) {\r\n this.title = 'Editar perfil maker';\r\n this.makerId = '/makers/' + this.makerService.getId();\r\n }\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n if (this.makerId) {\r\n setTimeout(() => {\r\n /* this.tagService.getTags(this.translate.getDefaultLang()).subscribe(tags => {\r\n this.tags = tags['hydra:member'];\r\n }); */\r\n this.editMaker(this.makerId);\r\n }, 1000);\r\n }\r\n\r\n this.makerForm.valueChanges.subscribe(changes => {\r\n this.checkInfoContent();\r\n this.checkDirectoryContent();\r\n this.checkSheetContent();\r\n this.checkPinContent();\r\n // this.checkWebSheetContent();\r\n });\r\n\r\n this.tagService.getTags(this.translate.getDefaultLang()).subscribe(tags => {\r\n this.tags = tags['hydra:member'];\r\n });\r\n\r\n this.activatedRoute.params.subscribe(params => {\r\n if (this.router.routerState.snapshot.url.split('/').pop() === \"basico\") {\r\n this.enableBasicFields();\r\n }\r\n setTimeout(() => {\r\n if (params['plan']) {\r\n this.planForm.get('plan').setValue(params['plan'].toLowerCase());\r\n this.plan = params['plan'];\r\n } else {\r\n this.planForm.get('plan').setValue('Plan Free - de 1 a 3 productos en directorio');\r\n this.plan = 'Plan Free - de 1 a 3 productos en directorio';\r\n }\r\n }, 1000);\r\n });\r\n\r\n this.experiencesService.getAllExperiencesByMakerId(this.makerService.getId()).subscribe(((resp: any) => {\r\n this.makerExperiences = resp['hydra:member'];\r\n this.totalExperiences = this.makerExperiences.length;\r\n\r\n this.makerExperiences.forEach(experience => {\r\n if (experience.isActive) {\r\n this.publishedExperiences++\r\n }\r\n });\r\n }))\r\n }\r\n\r\n createForm() {\r\n this.makerForm = this.formBuilder.group({\r\n name: ['',\r\n Validators.required\r\n ],\r\n companyName: ['',\r\n Validators.required],\r\n documentType: [null,\r\n Validators.required\r\n ],\r\n document: [null, [\r\n Validators.required,\r\n // CustomValidators.dniOrNieValidator\r\n ]],\r\n contactName: ['', [\r\n Validators.required,\r\n ]],\r\n contactLastname: ['', [\r\n Validators.required,\r\n ]],\r\n contactPhone: ['', [\r\n Validators.required,\r\n ]],\r\n contactEmail: ['', [\r\n Validators.required,\r\n ]],\r\n mediaMakers: [[],\r\n Validators.required\r\n ],\r\n mediaMakersHeader: [[], Validators.required\r\n ],\r\n mediaMakersLogo: [[]\r\n ],\r\n mediaMakersStaff: [[]\r\n ],\r\n phrase: ['', Validators.required],\r\n address: ['',\r\n Validators.required],\r\n location: [null,\r\n Validators.required],\r\n country: [null,\r\n Validators.required],\r\n postalCode: [null, [\r\n Validators.required,\r\n Validators.pattern('^[0-9]{5}$') // Validates exactly 5 digits\r\n ]],\r\n phone: ['', [\r\n Validators.required,\r\n Validators.pattern(regExps.phone)\r\n ]],\r\n whatsapp: ['', [\r\n Validators.pattern(regExps.phone)\r\n ]],\r\n email: ['', [\r\n Validators.required,\r\n Validators.email\r\n ]],\r\n web: ['', [\r\n Validators.required,\r\n Validators.pattern(regExps.url)\r\n ]\r\n ],\r\n sustainableSeal: [false],\r\n user: ['/users/' + this.authService.getUserId()],\r\n tripadvisor: [''],\r\n description: [''],\r\n founders: [''],\r\n director: [''],\r\n operations: [''],\r\n technology: [''],\r\n customerId: [''],\r\n instagram: [''],\r\n twitter: [''],\r\n linkedIn: [''],\r\n facebook: [''],\r\n tags: [['/tags/10']],\r\n slug: [''],\r\n bookingEmail: [''],\r\n holdedId: [''],\r\n googleSites: [''],\r\n googleMaps: [''],\r\n phone2: [''],\r\n tripadvisorApiWidgetReview: [''],\r\n bookingEngine: [''],\r\n bookingEngineWidget: [''],\r\n polizaRRCC: [''],\r\n reciboRRCC: [''],\r\n licenciaActividad: [''],\r\n plantillaContratoColaboracion: [''],\r\n catalogos: [''],\r\n administrationEmail: [''],\r\n reservationConditions: [''],\r\n paymentConditions: [''],\r\n cancelationConditions: [''],\r\n idFareharbor: [''],\r\n });\r\n this.contactForm = this.formBuilder.group({\r\n mediaContacts: [[]],\r\n name: ['',\r\n Validators.required\r\n ],\r\n position: ['',\r\n Validators.required\r\n ],\r\n email: ['',\r\n Validators.required\r\n ],\r\n phone: ['',\r\n Validators.required\r\n ]\r\n });\r\n this.planForm = this.formBuilder.group({\r\n plan: ['']\r\n });\r\n }\r\n\r\n async createMaker() {\r\n this.makerForm.markAllAsTouched();\r\n // if (this.makerForm.invalid) {\r\n // this.showErrors(this.makerForm);\r\n // return;\r\n // }\r\n\r\n\r\n\r\n var slug = this.makerForm.get('name').value;\r\n\r\n console.log(\"Slug sin limpiar:\");\r\n console.log(slug);\r\n\r\n slug = await this.convertSlug(slug);\r\n\r\n console.log(\"Slug FINAL:\");\r\n console.log(slug);\r\n\r\n var postalCodeString = this.makerForm.get('postalCode').value.toString();\r\n\r\n\r\n const maker = {\r\n name: this.makerForm.get('name').value,\r\n companyName: this.makerForm.get('companyName').value,\r\n documentType: this.makerForm.get('documentType').value,\r\n document: this.makerForm.get('document').value,\r\n contactName: this.makerForm.get('contactName').value,\r\n contactLastname: this.makerForm.get('contactLastname').value,\r\n bookingEmail: this.makerForm.get('contactEmail').value,\r\n mediaMakers: this.makerForm.get('mediaMakers').value,\r\n mediaMakersHeader: this.makerForm.get('mediaMakersHeader').value,\r\n // mediaMakersLogo: this.makerForm.get('mediaMakersLogo').value,\r\n mediaMakersStaff: this.makerForm.get('mediaMakersStaff').value,\r\n phrase: this.makerForm.get('phrase').value,\r\n phone: this.makerForm.get('phone').value,\r\n whatsapp: this.makerForm.get('whatsapp').value,\r\n email: this.makerForm.get('email').value,\r\n web: this.makerForm.get('web').value,\r\n sustainableSeal: this.makerForm.get('sustainableSeal').value,\r\n user: this.makerForm.get('user').value,\r\n tripadvisor: this.makerForm.get('tripadvisor').value,\r\n description: this.makerForm.get('description').value,\r\n founders: this.makerForm.get('founders').value,\r\n director: this.makerForm.get('director').value,\r\n operations: this.makerForm.get('operations').value,\r\n technology: this.makerForm.get('technology').value,\r\n customerId: this.makerForm.get('customerId').value,\r\n instagram: this.makerForm.get('instagram').value,\r\n twitter: this.makerForm.get('twitter').value,\r\n linkedIn: this.makerForm.get('linkedIn').value,\r\n facebook: this.makerForm.get('facebook').value,\r\n tags: this.makerForm.get('tags').value,\r\n slug: slug,\r\n address: this.makerForm.get('address').value,\r\n postalCode: postalCodeString,\r\n location: this.makerForm.get('location').value,\r\n country: this.makerForm.get('country').value,\r\n holdedId: this.makerForm.get('holdedId').value,\r\n googleSites: this.makerForm.get('googleSites').value,\r\n googleMaps: this.makerForm.get('googleMaps').value,\r\n phone2: this.makerForm.get('phone2').value,\r\n tripadvisorApiWidgetReview: this.makerForm.get('tripadvisorApiWidgetReview').value,\r\n bookingEngine: this.makerForm.get('bookingEngine').value,\r\n bookingEngineWidget: this.makerForm.get('bookingEngineWidget').value,\r\n directoryCompleted: this.isDirectoryValid,\r\n sheetCompleted: this.isSheetValid,\r\n pinCompleted: this.isPinValid,\r\n administrationEmail: this.makerForm.get('administrationEmail').value,\r\n reservationConditions: this.makerForm.get('reservationConditions').value,\r\n paymentConditions: this.makerForm.get('paymentConditions').value,\r\n cancelationConditions: this.makerForm.get('cancelationConditions').value,\r\n idFareharbor: this.makerForm.get('idFareharbor').value,\r\n };\r\n if (this.maker) {\r\n this.createMakerPlan(false);\r\n } else {\r\n this.makerService.postMaker(maker).subscribe(() => {\r\n // this.alert.type = 1;\r\n // this.alert.message = this.translate.instant('Maker creado correctamente');\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 5000);\r\n const roles = this.authService.roles();\r\n if (!roles.includes('ROLE_MAKER')) {\r\n roles.push('ROLE_MAKER');\r\n }\r\n const editedUser = new User({ roles: roles });\r\n this.userService.putUser(this.authService.getUserId(), editedUser).subscribe(currentUser => {\r\n localStorage.setItem('user', JSON.stringify(currentUser));\r\n });\r\n this.makerService.getMakerByUserId(this.authService.getUserId()).subscribe(currentMaker => {\r\n this.maker = currentMaker;\r\n this.makerId = currentMaker.id;\r\n localStorage.setItem('maker', JSON.stringify({ id: currentMaker.id, name: currentMaker.name }));\r\n this.createMakerPlan(false);\r\n });\r\n this.openAlert('Maker creado!', 'w-300', true)\r\n }, (error) => {\r\n // this.alert.message = error.error.code + '- ' + error.error.message;\r\n // this.alert.type = 2;\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 5000);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n });\r\n }\r\n }\r\n\r\n editMaker(makerId) {\r\n this.makerService.getMaker(makerId, this.translate.getDefaultLang()).subscribe((maker: Maker) => {\r\n this.maker = maker;\r\n this.makerForm.get('name').setValue(maker.name);\r\n this.makerForm.get('email').setValue(maker.email);\r\n this.makerForm.get('documentType').setValue(maker.documentType);\r\n this.makerForm.get('document').setValue(maker.document);\r\n this.makerForm.get('phrase').setValue(maker.phrase);\r\n this.makerForm.get('phone').setValue(maker.phone);\r\n this.makerForm.get('whatsapp').setValue(maker.whatsapp);\r\n this.makerForm.get('email').setValue(maker.email);\r\n this.makerForm.get('web').setValue(maker.web);\r\n this.makerForm.get('sustainableSeal').setValue(maker.sustainableSeal);\r\n this.makerForm.get('address').setValue(maker.address);\r\n this.makerForm.get('postalCode').setValue(maker.postalCode);\r\n this.makerForm.get('companyName').setValue(maker.companyName);\r\n this.makerForm.get('contactName').setValue(maker.contactName);\r\n this.makerForm.get('contactLastname').setValue(maker.contactLastname);\r\n this.makerForm.get('bookingEmail').setValue(maker.bookingEmail);\r\n this.makerForm.get('country').setValue(maker.country);\r\n this.makerForm.get('holdedId').setValue(maker.holdedId);\r\n this.makerForm.get('googleSites').setValue(maker.googleSites);\r\n this.makerForm.get('googleMaps').setValue(maker.googleMaps);\r\n this.makerForm.get('phone2').setValue(maker.phone2);\r\n this.makerForm.get('tripadvisorApiWidgetReview').setValue(maker.tripadvisorApiWidgetReview);\r\n this.makerForm.get('bookingEngine').setValue(maker.bookingEngine);\r\n this.bookingEngine = maker.bookingEngine;\r\n this.makerForm.get('bookingEngineWidget').setValue(maker.bookingEngineWidget);\r\n this.makerForm.get('administrationEmail').setValue(maker.administrationEmail);\r\n this.makerForm.get('reservationConditions').setValue(maker.reservationConditions);\r\n this.makerForm.get('paymentConditions').setValue(maker.paymentConditions);\r\n this.makerForm.get('cancelationConditions').setValue(maker.cancelationConditions);\r\n this.makerForm.get('idFareharbor').setValue(maker.idFareharbor);\r\n\r\n\r\n if (maker.country) {\r\n this.loadLocations(maker.country);\r\n }\r\n\r\n if (maker.mediaMakersDocs.length > 0) {\r\n console.log(\"Hay documentos\");\r\n console.log(maker.mediaMakersDocs);\r\n this.pdfFiles = maker.mediaMakersDocs;\r\n\r\n maker.mediaMakersDocs.forEach(pdf => {\r\n\r\n this.uploadedPdfFiles.push({\r\n id: pdf['@id'],\r\n url: '/assets/maker/pdf/files/' + pdf.contentUrl,\r\n name: pdf.name ? pdf.name : pdf.contentUrl,\r\n typeOf: pdf.typeOf\r\n });\r\n\r\n });\r\n\r\n if (this.uploadedPdfFiles.length > 0) {\r\n\r\n this.uploadedPdfFiles.forEach(pdf => {\r\n this.selectedPdfFiles.push(pdf);\r\n\r\n switch (pdf.typeOf) {\r\n case 'Poliza RRCC':\r\n this.validPolizaRRCC = true;\r\n this.namePolizaRRCC = pdf.name;\r\n break;\r\n case 'Recibo RRCC':\r\n this.validReciboRRCC = true;\r\n this.nameReciboRRCC = pdf.name;\r\n break;\r\n case 'Licencia de actividad':\r\n this.validLicenciaActividad = true;\r\n this.nameLicenciaActividad = pdf.name;\r\n break;\r\n case 'Plantilla de contrato de colaboración':\r\n this.validPlantillaContratoColaboracion = true;\r\n this.namePlantillaContratoColaboracion = pdf.name;\r\n break;\r\n case 'Catalogos':\r\n this.validCatalogos = true;\r\n this.nameCatalogos = pdf.name;\r\n break;\r\n\r\n }\r\n\r\n\r\n //this.switchDocsValues(pdf.typeOf, pdf);\r\n\r\n\r\n });\r\n\r\n\r\n }\r\n\r\n\r\n }\r\n\r\n this.makerForm.get('location').setValue(maker.location ? maker.location['@id'] : null);\r\n\r\n if (maker.mediaMakers.length > 0) {\r\n this.makerForm.get('mediaMakers').setValue([maker.mediaMakers[0]['@id']]);\r\n this.image = '/assets/maker/files/' + maker.mediaMakers[0]['contentUrl'];\r\n }\r\n if (maker['makerPlan'] && maker['holdedId']) {\r\n if (maker['makerPlan']['plan']['name'] === \"Básico\") {\r\n this.enableBasicFields();\r\n }\r\n this.makerService.getInvoices(this.maker['holdedId']).subscribe((result) => {\r\n this.invoices = result['invoices'];\r\n });\r\n\r\n this.makerService.getStripeCustomer(this.maker['makerPlan']['stripeCustomerId']).subscribe((resp: any) => {\r\n this.nextPayment = resp['stripeCustomer'];\r\n })\r\n }\r\n\r\n this.makerForm.get('tripadvisor').setValue(maker.tripadvisor);\r\n this.makerForm.get('description').setValue(maker.description);\r\n this.makerForm.get('founders').setValue(maker.founders);\r\n this.makerForm.get('director').setValue(maker.director);\r\n this.makerForm.get('operations').setValue(maker.operations);\r\n this.makerForm.get('technology').setValue(maker.technology);\r\n this.makerForm.get('customerId').setValue(maker.customerId);\r\n this.makerForm.get('instagram').setValue(maker.instagram);\r\n this.makerForm.get('twitter').setValue(maker.twitter);\r\n this.makerForm.get('linkedIn').setValue(maker.linkedIn);\r\n this.makerForm.get('facebook').setValue(maker.facebook);\r\n\r\n const tags = [];\r\n if (maker.tags) {\r\n maker.tags.forEach(tag => {\r\n tags.push(tag);\r\n });\r\n this.makerForm.get('tags').setValue(tags);\r\n }\r\n // this.makerForm.get('tags').setValue(maker.tags);\r\n if (maker.mediaMakersHeader.length > 0) {\r\n this.makerForm.get('mediaMakersHeader').setValue([maker.mediaMakersHeader[0]['@id']]);\r\n this.headerImage = '/assets/makerHeader/files/' + maker.mediaMakersHeader[0]['contentUrl'];\r\n }\r\n // if (maker.mediaMakersLogo.length > 0) {\r\n // this.makerForm.get('mediaMakersLogo').setValue([maker.mediaMakersLogo[0]['@id']]);\r\n // this.logoImage = '/assets/makerLogo/files/' + maker.mediaMakersLogo[0]['contentUrl'];\r\n // }\r\n maker.mediaMakersStaff.forEach(mediaMakerStaff => {\r\n if (!this.mediaMakersStaff.some(e => e.id === mediaMakerStaff['@id'])) {\r\n this.mediaMakersStaff.push({ url: '/assets/makerStaff/files/' + mediaMakerStaff['contentUrl'], id: mediaMakerStaff['@id'] });\r\n this.uploadedFiles.push(mediaMakerStaff['@id']);\r\n } else if (this.mediaMakersStaff.length <= 0) {\r\n this.mediaMakersStaff.push({ url: '/assets/makerStaff/files/' + mediaMakerStaff['contentUrl'], id: mediaMakerStaff['@id'] });\r\n this.uploadedFiles.push(mediaMakerStaff['@id']);\r\n }\r\n });\r\n this.makerForm.get('mediaMakersStaff').setValue(this.uploadedFiles);\r\n this.rows = maker['contacts'];\r\n if (this.makerForm.get('documentType').value === 'Otros') {\r\n this.makerForm.get('document').setErrors(null);\r\n this.makerForm.get('document').clearValidators();\r\n this.makerForm.get('document').setValidators([Validators.required]);\r\n this.makerForm.updateValueAndValidity();\r\n }\r\n });\r\n }\r\n\r\n async updateMaker() {\r\n this.makerForm.markAllAsTouched();\r\n // if (this.makerForm.invalid) {\r\n // this.showErrors(this.makerForm);\r\n // return;\r\n // }\r\n\r\n\r\n if (this.selectedPdfFiles.length > 0) {\r\n\r\n //this.uploadPdfFiles();\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n var slug = this.makerForm.get('name').value;\r\n\r\n console.log(\"Slug sin limpiar:\");\r\n console.log(slug);\r\n\r\n slug = await this.convertSlug(slug);\r\n\r\n console.log(\"Slug FINAL:\");\r\n console.log(slug);\r\n\r\n var postalCodeString = this.makerForm.get('postalCode').value ? this.makerForm.get('postalCode').value.toString() : null;\r\n\r\n\r\n const maker = {\r\n name: this.makerForm.get('name').value,\r\n documentType: this.makerForm.get('documentType').value,\r\n document: this.makerForm.get('document').value,\r\n mediaMakers: this.makerForm.get('mediaMakers').value,\r\n mediaMakersHeader: this.makerForm.get('mediaMakersHeader').value,\r\n // mediaMakersLogo: this.makerForm.get('mediaMakersLogo').value,\r\n mediaMakersStaff: this.makerForm.get('mediaMakersStaff').value,\r\n phrase: this.makerForm.get('phrase').value,\r\n phone: this.makerForm.get('phone').value,\r\n whatsapp: this.makerForm.get('whatsapp').value,\r\n email: this.makerForm.get('email').value,\r\n web: this.makerForm.get('web').value,\r\n sustainableSeal: this.makerForm.get('sustainableSeal').value,\r\n tripadvisor: this.makerForm.get('tripadvisor').value,\r\n description: this.makerForm.get('description').value,\r\n founders: this.makerForm.get('founders').value,\r\n director: this.makerForm.get('director').value,\r\n operations: this.makerForm.get('operations').value,\r\n technology: this.makerForm.get('technology').value,\r\n customerId: this.makerForm.get('customerId').value,\r\n instagram: this.makerForm.get('instagram').value,\r\n twitter: this.makerForm.get('twitter').value,\r\n linkedIn: this.makerForm.get('linkedIn').value,\r\n facebook: this.makerForm.get('facebook').value,\r\n tags: this.makerForm.get('tags').value,\r\n slug: slug,\r\n address: this.makerForm.get('address').value,\r\n postalCode: postalCodeString,\r\n location: this.makerForm.get('location').value,\r\n country: this.makerForm.get('country').value,\r\n companyName: this.makerForm.get('companyName').value,\r\n contactName: this.makerForm.get('contactName').value,\r\n contactLastname: this.makerForm.get('contactLastname').value,\r\n bookingEmail: this.makerForm.get('bookingEmail').value,\r\n holdedId: this.makerForm.get('holdedId').value,\r\n googleSites: this.makerForm.get('googleSites').value,\r\n googleMaps: this.makerForm.get('googleMaps').value,\r\n phone2: this.makerForm.get('phone2').value,\r\n tripadvisorApiWidgetReview: this.makerForm.get('tripadvisorApiWidgetReview').value,\r\n bookingEngine: this.makerForm.get('bookingEngine').value,\r\n bookingEngineWidget: this.makerForm.get('bookingEngineWidget').value,\r\n directoryCompleted: this.isDirectoryValid,\r\n sheetCompleted: this.isSheetValid,\r\n pinCompleted: this.isPinValid,\r\n administrationEmail: this.makerForm.get('administrationEmail').value,\r\n reservationConditions: this.makerForm.get('reservationConditions').value,\r\n paymentConditions: this.makerForm.get('paymentConditions').value,\r\n cancelationConditions: this.makerForm.get('cancelationConditions').value,\r\n idFareharbor: this.makerForm.get('idFareharbor').value,\r\n\r\n };\r\n const editedMaker = new Maker(maker);\r\n this.makerService.putMaker(this.maker.id, editedMaker, this.translate.getDefaultLang())\r\n .subscribe(\r\n (result) => {\r\n // this.alert.type = 1;\r\n // this.alert.message = this.translate.instant('Maker guardado correctamente');\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 5000);\r\n this.openAlert('Maker guardado!', 'w-300', true)\r\n },\r\n error => {\r\n // this.alert.message = error.error.code + '- ' + error.error.message;\r\n // this.alert.type = 2;\r\n // setTimeout(() => {\r\n // this.alert = { message: null, type: null };\r\n // }, 5000);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n },\r\n () => console.log('complete'));\r\n }\r\n\r\n createContact() {\r\n if (this.contactForm.invalid) {\r\n this.showErrors(this.contactForm);\r\n return;\r\n }\r\n const contact = {\r\n mediaContacts: this.contactForm.get('mediaContacts').value,\r\n name: this.contactForm.get('name').value,\r\n position: this.contactForm.get('position').value,\r\n email: this.contactForm.get('email').value,\r\n phone: this.contactForm.get('phone').value,\r\n maker: this.maker['@id']\r\n };\r\n this.makerService.postContact(contact).subscribe(() => {\r\n this.alert.type = 1;\r\n this.alert.message = this.translate.instant('Contacto creado correctamente');\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n }, (error) => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n });\r\n }\r\n\r\n // updateContact() {\r\n // if (this.contactForm.invalid) {\r\n // this.showErrors(this.contactForm);\r\n // return;\r\n // }\r\n // const contact = {\r\n // mediaContact: this.contactForm.get('mediaContact').value,\r\n // name: this.contactForm.get('name').value,\r\n // position: this.contactForm.get('position').value,\r\n // email: this.contactForm.get('email').value,\r\n // phone: this.contactForm.get('phone').value\r\n // };\r\n // const editedContact = new Contact(contact);\r\n // this.makerService.putContact(this.contact.id, editedContact, this.formLanguage)\r\n // .subscribe(\r\n // (result) => {\r\n // this.alert.type = 1;\r\n // this.alert.message = this.translate.instant('Contacto guardado correctamente');\r\n // setTimeout(() => {\r\n // this.alert = {message: null, type: null};\r\n // }, 5000);\r\n // },\r\n // error => {\r\n // this.alert.message = error.error.code + '- ' + error.error.message;\r\n // this.alert.type = 2;\r\n // setTimeout(() => {this.alert = {message: null, type: null};\r\n // }, 5000);\r\n // },\r\n // () => console.log('complete'));\r\n // }\r\n\r\n onFileChanged(event) {\r\n if (event.target.files[0].type === 'image/jpeg' || event.target.files[0].type === 'image/png') {\r\n this.selectedFile = event.target.files[0];\r\n const reader = new FileReader();\r\n\r\n reader.onload = (event: any) => {\r\n this.image = event.target.result;\r\n };\r\n\r\n reader.readAsDataURL(event.target.files[0]);\r\n }\r\n }\r\n\r\n enableBasicFields() {\r\n this.makerForm.get('phrase').enable();\r\n this.makerForm.get('tripadvisor').enable();\r\n this.makerForm.get('description').enable();\r\n // this.makerForm.get('tripadvisor').setValidators([Validators.required]);\r\n // this.makerForm.get('description').setValidators([Validators.required]);\r\n this.makerForm.get('founders').enable();\r\n this.makerForm.get('director').enable();\r\n // this.makerForm.get('founders').setValidators([Validators.required]);\r\n // this.makerForm.get('director').setValidators([Validators.required]);\r\n this.makerForm.get('operations').enable();\r\n this.makerForm.get('technology').enable();\r\n // this.makerForm.get('operations').setValidators([Validators.required]);\r\n // this.makerForm.get('technology').setValidators([Validators.required]);\r\n this.makerForm.get('customerId').enable();\r\n this.makerForm.get('instagram').enable();\r\n // this.makerForm.get('customerId').setValidators([Validators.required]);\r\n // this.makerForm.get('instagram').setValidators([Validators.required]);\r\n this.makerForm.get('twitter').enable();\r\n this.makerForm.get('linkedIn').enable();\r\n // this.makerForm.get('twitter').setValidators([Validators.required]);\r\n // this.makerForm.get('linkedIn').setValidators([Validators.required]);\r\n this.makerForm.get('facebook').enable();\r\n // this.makerForm.get('facebook').setValidators([Validators.required]);\r\n this.makerForm.get('tags').enable();\r\n\r\n //this.makerForm.get('slug').enable();\r\n\r\n // this.makerForm.get('tags').setValidators([Validators.required]);\r\n this.makerForm.updateValueAndValidity();\r\n }\r\n\r\n onUpload() {\r\n this.mediaMakerService.mediaMakersUpload(\r\n this.selectedFile, '/media_makers').subscribe(result => {\r\n this.handleProgress(result);\r\n }, error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n });\r\n }\r\n\r\n handleProgress(event) {\r\n if (event.type === HttpEventType.DownloadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.UploadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.Response) {\r\n this.uploadComplete = true;\r\n this.uploadingProgressing = false;\r\n this.serverResponse = event.body;\r\n\r\n this.alert.type = 1;\r\n this.alert.message = this.translate.instant('Logo guardado correctamente');\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n\r\n this.makerForm.get('mediaMakers').setValue([event.body['@id']]);\r\n }\r\n }\r\n\r\n onUploadedImage(uploadedImage: object, formControlName: string) {\r\n if (formControlName === 'mediaMakersStaff') {\r\n this.mediaMakersStaff.push({\r\n url: uploadedImage['url'],\r\n id: uploadedImage['id']\r\n });\r\n this.uploadedFiles.push(uploadedImage['id']);\r\n this.makerForm.get(formControlName).patchValue(this.uploadedFiles);\r\n }\r\n if (formControlName === 'mediaMakers') {\r\n this.makerForm.get(formControlName).patchValue([uploadedImage['id']]);\r\n this.image = uploadedImage['url'];\r\n }\r\n if (formControlName === 'mediaMakersLogo') {\r\n this.makerForm.get(formControlName).patchValue([uploadedImage['id']]);\r\n this.logoImage = uploadedImage['url'];\r\n }\r\n if (formControlName === 'mediaMakersHeader') {\r\n this.makerForm.get(formControlName).patchValue([uploadedImage['id']]);\r\n this.headerImage = uploadedImage['url'];\r\n }\r\n if (formControlName === 'mediaContacts') {\r\n this.contactForm.get(formControlName).patchValue([uploadedImage['id']]);\r\n this.contactImage = uploadedImage['url'];\r\n }\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n }\r\n\r\n showError(formValue) {\r\n // Handling documentType and document validation\r\n if (formValue === 'documentType') {\r\n if (this.makerForm.get('documentType').value === 'CIF') {\r\n this.makerForm.get('document').clearValidators();\r\n this.makerForm.get('document').setValidators([Validators.required, CustomValidators.isValidCif]);\r\n this.makerForm.updateValueAndValidity();\r\n this.makerForm.get('document').setErrors(CustomValidators.isValidCif(this.makerForm.get('document').value));\r\n this.makerForm.get('document').markAsTouched();\r\n } else {\r\n this.makerForm.get('document').clearValidators();\r\n this.makerForm.get('document').setValidators([Validators.required, CustomValidators.dniOrNieValidator]);\r\n this.makerForm.updateValueAndValidity();\r\n this.makerForm.get('document').setErrors(CustomValidators.dniOrNieValidator(this.makerForm.get('document')));\r\n this.makerForm.get('document').markAsTouched();\r\n }\r\n }\r\n \r\n // General validation for other fields (address, postalCode, description, etc.)\r\n if (formValue === 'address' || formValue === 'postalCode' || formValue === 'description') {\r\n this.makerForm.get(formValue).markAsTouched();\r\n this.makerForm.get(formValue).updateValueAndValidity();\r\n }\r\n \r\n // Return true if the form control is invalid and has been touched\r\n return this.makerForm.get(formValue).invalid && this.makerForm.get(formValue).touched;\r\n }\r\n \r\n\r\n showContactError(formValue) {\r\n return this.contactForm.get(formValue).invalid && this.contactForm.get(formValue).touched;\r\n }\r\n\r\n changeLanguage(language) {\r\n this.formLanguage = language;\r\n // this.translate.setDefaultLang(language);\r\n this.editMaker(this.makerId);\r\n }\r\n\r\n deleteMediaMakersStaff(image, uploaded) {\r\n if (uploaded) {\r\n this.mediaMakerService.deleteMediaMakers(image).subscribe(() => {\r\n const index = this.uploadedFiles.indexOf(image);\r\n this.uploadedFiles.splice(index, 1);\r\n this.mediaMakersStaff = this.mediaMakersStaff.filter((el) => el.id !== image);\r\n this.makerForm.get('mediaMakersStaff').setValue(this.uploadedFiles);\r\n }\r\n );\r\n } else {\r\n this.selectedFiles = this.selectedFiles.filter((el) => el.name !== image);\r\n this.images = this.images.filter((el) => el.name !== image);\r\n }\r\n }\r\n\r\n loadLocations(countryCode: string) {\r\n this.locationService.getLocationsFiltered({ country: countryCode }, this.translate.getDefaultLang()).subscribe(\r\n (locations) => {\r\n this.locations = locations;\r\n this.locationList.next(this.locations.slice());\r\n }\r\n );\r\n }\r\n\r\n createMakerPlan(isChangingPlan) {\r\n if (this.planForm.get('plan').value.toLowerCase() === 'Plan Free - de 1 a 3 productos en directorio' && !isChangingPlan) {\r\n this.makerService.postFreeMakerPlan({ price: 0, email: this.authService.getUserEmail() }).subscribe(() => {\r\n window.location.reload();\r\n });\r\n // this.router.navigateByUrl(this.translate.getDefaultLang() + '/maker/admin/perfil');\r\n } else {\r\n let planPrice = null;\r\n if (this.planForm.get('plan').value.toLowerCase() === 'pro-m-3' || isChangingPlan) {\r\n planPrice = BASIC_PRICE;\r\n } else if (this.planForm.get('plan').value === 'pro') {\r\n planPrice = '';\r\n }\r\n // @ts-ignore\r\n const stripe = Stripe(PUBLIC_KEY);\r\n stripe.redirectToCheckout({\r\n lineItems: [{ price: planPrice, quantity: 1 }],\r\n mode: 'subscription',\r\n successUrl: `${FRONT_URL}${this.translate.getDefaultLang()}/maker/admin/perfil`,\r\n cancelUrl: `${FRONT_URL}${this.translate.getDefaultLang()}`,\r\n })\r\n // tslint:disable-next-line:only-arrow-functions no-shadowed-variable\r\n .then(function (result) {\r\n if (result.error) {\r\n const displayError = document.getElementById('error-message');\r\n displayError.textContent = result.error.message;\r\n }\r\n });\r\n }\r\n }\r\n\r\n timestampToDate(timestamp) {\r\n // Create a new Date object with the Unix timestamp (in milliseconds)\r\n const date = new Date(timestamp * 1000);\r\n\r\n // Extract the day, month, and year\r\n const day = date.getDate();\r\n const month = date.getMonth() + 1; // Months are zero-based\r\n const year = date.getFullYear();\r\n\r\n // Format the date as 'dd/mm/yyyy'\r\n const formattedDate = `${day.toString().padStart(2, '0')}/${month.toString().padStart(2, '0')}/${year}`;\r\n\r\n return formattedDate;\r\n }\r\n\r\n downloadPdf(fileNumber, invoiceId) {\r\n this.makerService.getInvoicePdf(invoiceId).subscribe((result) => {\r\n const binaryString = atob(result['invoices']['data']);\r\n \r\n const len = binaryString.length;\r\n const bytes = new Uint8Array(len);\r\n for (let i = 0; i < len; i++) {\r\n bytes[i] = binaryString.charCodeAt(i);\r\n }\r\n\r\n // Create a Blob from the binary data\r\n const blob = new Blob([bytes], { type: 'application/pdf' });\r\n\r\n // Create a URL for the Blob\r\n const url = URL.createObjectURL(blob);\r\n\r\n // Create a link element and trigger a download\r\n const link = document.createElement('a');\r\n link.href = url;\r\n link.download = fileNumber+'.pdf';\r\n link.click();\r\n\r\n // Clean up the URL object\r\n URL.revokeObjectURL(url);\r\n });\r\n }\r\n\r\n checkInfoContent() {\r\n let controlNames = ['companyName', 'documentType', 'document', 'contactName', 'contactLastname'];\r\n this.isInfoValid = false;\r\n for (let controlName of controlNames) {\r\n if (this.makerForm.get(controlName).valid) {\r\n this.isInfoValid = true;\r\n } else {\r\n this.isInfoValid = false;\r\n break;\r\n }\r\n };\r\n }\r\n\r\n checkDirectoryContent() {\r\n //, 'mediaMakersHeader'\r\n let controlNames = ['name', 'mediaMakers', 'phone', 'email', 'web'];\r\n this.isDirectoryValid = false;\r\n for (let controlName of controlNames) {\r\n if (this.makerForm.get(controlName).valid) {\r\n this.isDirectoryValid = true;\r\n } else {\r\n if (controlName == 'mediaMakers' && this.makerForm.get(controlName).value.length > 0) {\r\n this.isDirectoryValid = true;\r\n } else {\r\n this.isDirectoryValid = false;\r\n }\r\n\r\n break;\r\n }\r\n };\r\n }\r\n\r\n checkSheetContent() {\r\n let controlNames = ['mediaMakersHeader', 'description', 'address', 'location', 'country', 'postalCode'];\r\n this.isSheetValid = false;\r\n for (let controlName of controlNames) {\r\n if (this.makerForm.get(controlName).valid) {\r\n this.isSheetValid = true;\r\n } else {\r\n if (controlName == 'mediaMakersHeader' && this.makerForm.get(controlName).value.length > 0) {\r\n this.isSheetValid = true;\r\n } else {\r\n this.isSheetValid = false;\r\n }\r\n\r\n break;\r\n }\r\n };\r\n }\r\n\r\n checkPinContent() {\r\n\r\n //administrationEmail, phone2, bookingEngine, bookingEngineWidget, tripadvisor, linkedin, facebook, instagram, twitter, googleMaps, reservationConditions, paymentConditions, cancelationConditions\r\n\r\n\r\n\r\n this.isPinValid = false;\r\n\r\n if (this.maker) {\r\n\r\n\r\n var administrationEmail = this.makerForm.get('administrationEmail').value;\r\n var phone2 = this.makerForm.get('phone2').value;\r\n var bookingEngine = this.makerForm.get('bookingEngine').value;\r\n var bookingEngineWidget = this.makerForm.get('bookingEngineWidget').value;\r\n var tripadvisor = this.makerForm.get('tripadvisor').value;\r\n var linkedIn = this.makerForm.get('linkedIn').value;\r\n var facebook = this.makerForm.get('facebook').value;\r\n var instagram = this.makerForm.get('instagram').value;\r\n var twitter = this.makerForm.get('twitter').value;\r\n var reservationConditions = this.makerForm.get('reservationConditions').value;\r\n var paymentConditions = this.makerForm.get('paymentConditions').value;\r\n var cancelationConditions = this.makerForm.get('cancelationConditions').value;\r\n\r\n if (this.selectedPdfFiles.length == 5 && this.mediaMakersStaff.length > 0 && (administrationEmail != '' && administrationEmail != null)\r\n && (phone2 != '' && phone2 != null) && (bookingEngine != '' && bookingEngine != null) && (bookingEngineWidget != '' && bookingEngineWidget != null)\r\n && (tripadvisor != '' && tripadvisor != null) && (linkedIn != '' && linkedIn != null) && (facebook != '' && facebook != null)\r\n && (instagram != '' && instagram != null) && (twitter != '' && twitter != null) && (reservationConditions != '' && reservationConditions != null)\r\n && (paymentConditions != '' && paymentConditions != null) && (cancelationConditions != '' && cancelationConditions != null)) {\r\n\r\n this.isPinValid = true;\r\n } else {\r\n this.isPinValid = false;\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n async convertSlug(slug: string) {\r\n // Create a map of characters to replace\r\n /* const charMap: { [key: string]: string } = {\r\n 'ÀÁÂÃÄÅ': 'A', 'àáâãäå': 'a',\r\n 'ÈÉÊË': 'E', 'èéêë': 'e',\r\n 'ÍÌÎÏ': 'I', 'íìîï': 'i',\r\n 'ÓÒÔÕÖ': 'O', 'óòôõö': 'o',\r\n 'ÚÙÛÜ': 'U', 'úùûü': 'u',\r\n 'Ñ': 'N', 'ñ': 'n',\r\n 'Ç': 'C', 'ç': 'c',\r\n 'Ý': 'Y', 'ÿý': 'y',\r\n '’‘“”«»': '', // Special quotation marks\r\n '—·/\\\\': '-', // Replace with hyphens\r\n '?¿!¡ºª°&<>;\"\\'.,:[]{}()~|%*@+': '', // Remove these characters\r\n };\r\n \r\n // Replace characters using the charMap\r\n for (const key in charMap) {\r\n slug = slug.replace(new RegExp(`[${key}]`, 'g'), charMap[key]);\r\n } */\r\n \r\n // Further cleanup: remove extra hyphens, trim hyphens, and convert to lowercase\r\n let slugCleared = slug.replace(/ /g, '-') // Replace spaces with hyphen\r\n .replace(/--+/g, '-') // Replace multiple hyphens with a single one\r\n .replace(/^-|-$/g, '') // Trim hyphens at the start and end\r\n .toLowerCase();\r\n \r\n // Check if the slug exists\r\n const slugExist = await this.verifySlugExists(slugCleared);\r\n \r\n // Append \"-1\" if the slug already exists and is not the current slug\r\n if (slugExist && this.maker.slug !== slugCleared) {\r\n slugCleared = `${slugCleared}-1`;\r\n }\r\n \r\n return slugCleared;\r\n }\r\n \r\n\r\n\r\n async verifySlugExists(slug: string) {\r\n\r\n var slugExist = false;\r\n\r\n var maker = await this.makerService.getMakerBySlug(slug).toPromise();\r\n\r\n maker = maker['hydra:member'];\r\n\r\n if (maker.length > 0 && maker) {\r\n\r\n slugExist = true;\r\n\r\n return slugExist;\r\n\r\n } else {\r\n\r\n slugExist = false;\r\n\r\n return slugExist;\r\n }\r\n\r\n }\r\n\r\n onFileSelected(event, type) {\r\n console.log(event);\r\n console.log(type);\r\n\r\n /* get the pdf file from the event input */\r\n const file = event.target.files[0];\r\n console.log(file);\r\n\r\n file.typeOf = type;\r\n\r\n if (file.type != \"application/pdf\" || !file) {\r\n return;\r\n }\r\n\r\n\r\n /* Switch: type: */\r\n this.switchDocsValues(type, file);\r\n\r\n console.log(this.selectedPdfFiles);\r\n //si type está dentro de selectedPdfFiles.typeOf, borrarlo y sustituirlo por el nuevo\r\n if (this.selectedPdfFiles.length > 0) {\r\n for (var i = 0; i < this.selectedPdfFiles.length; i++) {\r\n if (this.selectedPdfFiles[i].typeOf == type) {\r\n\r\n //delete PDF\r\n this.mediaMakerService.deleteMediaMakers(this.selectedPdfFiles[i].id).subscribe(() => {\r\n console.log(\"PDF deleted\");\r\n this.selectedPdfFiles.splice(i, 1);\r\n });\r\n\r\n\r\n }\r\n }\r\n\r\n }\r\n\r\n\r\n\r\n this.uploadPdfFile(file);\r\n\r\n console.log(this.selectedPdfFiles);\r\n\r\n this.checkPinContent();\r\n\r\n\r\n\r\n }\r\n\r\n uploadPdfFiles() {\r\n\r\n console.log(this.selectedPdfFiles);\r\n console.log(this.makerId);\r\n\r\n if (this.selectedPdfFiles.length > 0) {\r\n\r\n this.selectedPdfFiles.forEach(file => {\r\n\r\n var objectFile = {\r\n maker: this.makerId,\r\n typeOf: file.typeOf\r\n };\r\n console.log(file);\r\n console.log(objectFile);\r\n\r\n this.selectedPdfFile = file;\r\n\r\n this.mediaMakerService.mediaMakersUpload(file, '/media_makers_docs', objectFile\r\n ).subscribe(result => {\r\n\r\n this.selectedPdfFiles.push(result);\r\n\r\n console.log(result);\r\n this.handleProgress(result);\r\n\r\n }, error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n\r\n console.log(error);\r\n\r\n\r\n\r\n });\r\n\r\n });\r\n }\r\n\r\n\r\n\r\n /* for(var i = 0; i < this.selectedPdfFiles.length; i++){\r\n \r\n const formData = new FormData();\r\n formData.append('file', this.selectedPdfFiles[i], this.selectedPdfFiles[i].name);\r\n \r\n this.makerService.postPdfFile(formData).subscribe((result) => {\r\n \r\n console.log(result);\r\n \r\n //this.makerForm.get('mediaPdf').setValue([result['@id']]);\r\n this.pdf = FRONT_URL + result['contentUrl'];\r\n \r\n this.alert.type = 1;\r\n this.alert.message = this.translate.instant('Logo guardado correctamente');\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n \r\n console.log(this.pdf);\r\n \r\n \r\n });\r\n \r\n } */\r\n }\r\n\r\n uploadPdfFile(file) {\r\n\r\n var objectFile = {\r\n maker: this.makerId,\r\n typeOf: file.typeOf\r\n };\r\n console.log(file);\r\n console.log(objectFile);\r\n\r\n this.mediaMakerService.mediaMakersUpload(file, '/media_makers_docs', objectFile\r\n ).subscribe(result => {\r\n\r\n console.log(result.body);\r\n\r\n if (result.body) {\r\n\r\n result.body.id = result.body['@id'];\r\n\r\n this.selectedPdfFiles.push(result.body);\r\n\r\n }\r\n\r\n\r\n\r\n }, error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n\r\n console.log(error);\r\n\r\n });\r\n\r\n\r\n }\r\n\r\n\r\n switchDocsValues(type, file) {\r\n\r\n\r\n switch (type) {\r\n case 'Poliza RRCC':\r\n\r\n console.log(\"polizaRRCC\");\r\n //set class success-border\r\n document.getElementById(\"polizaRRCCLabel\").classList.add(\"success-border\");\r\n document.getElementById(\"polizaRRCCLabel\").classList.remove(\"error-border\");\r\n //set the text of the label to the name of the file\r\n document.getElementById(\"polizaRRCCLabel\").innerHTML = '';\r\n document.getElementById(\"polizaRRCCLabel\").innerHTML = file.name;\r\n\r\n\r\n\r\n break;\r\n case 'Recibo RRCC':\r\n console.log(\"reciboRRCC\");\r\n //set class success-border\r\n document.getElementById(\"reciboRRCCLabel\").classList.add(\"success-border\");\r\n document.getElementById(\"reciboRRCCLabel\").classList.remove(\"error-border\");\r\n //set the text of the label to the name of the file\r\n document.getElementById(\"reciboRRCCLabel\").innerHTML = '';\r\n document.getElementById(\"reciboRRCCLabel\").innerHTML = file.name;\r\n\r\n\r\n\r\n break;\r\n case 'Licencia de actividad':\r\n console.log(\"licenciaActividad\");\r\n //set class success-border\r\n document.getElementById(\"licenciaActividadLabel\").classList.add(\"success-border\");\r\n document.getElementById(\"licenciaActividadLabel\").classList.remove(\"error-border\");\r\n //set the text of the label to the name of the file\r\n document.getElementById(\"licenciaActividadLabel\").innerHTML = '';\r\n document.getElementById(\"licenciaActividadLabel\").innerHTML = file.name;\r\n\r\n break;\r\n case 'Plantilla de contrato de colaboración':\r\n console.log(\"plantillaContratoColaboracion\");\r\n //set class success-border\r\n document.getElementById(\"plantillaContratoColaboracionLabel\").classList.add(\"success-border\");\r\n document.getElementById(\"plantillaContratoColaboracionLabel\").classList.remove(\"error-border\");\r\n //set the text of the label to the name of the file\r\n document.getElementById(\"plantillaContratoColaboracionLabel\").innerHTML = '';\r\n document.getElementById(\"plantillaContratoColaboracionLabel\").innerHTML = file.name;\r\n\r\n break;\r\n case 'Catalogos':\r\n console.log(\"catalogos\");\r\n //set class success-border\r\n document.getElementById(\"catalogosLabel\").classList.add(\"success-border\");\r\n document.getElementById(\"catalogosLabel\").classList.remove(\"error-border\");\r\n //set the text of the label to the name of the file\r\n document.getElementById(\"catalogosLabel\").innerHTML = '';\r\n document.getElementById(\"catalogosLabel\").innerHTML = file.name;\r\n\r\n break;\r\n default:\r\n console.log(\"default\");\r\n break;\r\n }\r\n\r\n\r\n }\r\n\r\n deletePdf(pdfId: any, pdf: any) {\r\n console.log(pdfId);\r\n console.log(pdf);\r\n\r\n if (pdfId) {\r\n\r\n this.mediaMakerService.deleteMediaDocs(pdfId).subscribe(() => {\r\n console.log(\"pdf deleted\");\r\n\r\n //remove pdf from this.selectedPdfFiles\r\n for (var i = 0; i < this.selectedPdfFiles.length; i++) {\r\n if (this.selectedPdfFiles[i].id == pdfId) {\r\n this.selectedPdfFiles.splice(i, 1);\r\n\r\n switch (pdf.typeOf) {\r\n case 'Poliza RRCC':\r\n this.validPolizaRRCC = false;\r\n break;\r\n case 'Recibo RRCC':\r\n this.validReciboRRCC = false;\r\n break;\r\n case 'Licencia de actividad':\r\n this.validLicenciaActividad = false;\r\n break;\r\n case 'Plantilla de contrato de colaboración':\r\n this.validPlantillaContratoColaboracion = false;\r\n break;\r\n case 'Catalogos':\r\n this.validCatalogos = false;\r\n break;\r\n\r\n }\r\n\r\n\r\n }\r\n }\r\n\r\n this.checkPinContent();\r\n\r\n\r\n /* this.alert.type = 1;\r\n this.alert.message = this.translate.instant('Logo guardado correctamente');\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000); */\r\n }\r\n );\r\n\r\n } else {\r\n\r\n //remove pdf from this.selectedPdfFiles\r\n for (var i = 0; i < this.selectedPdfFiles.length; i++) {\r\n if (this.selectedPdfFiles[i].name == pdf.name) {\r\n this.selectedPdfFiles.splice(i, 1);\r\n\r\n switch (pdf.typeOf) {\r\n case 'Poliza RRCC':\r\n this.validPolizaRRCC = false;\r\n break;\r\n case 'Recibo RRCC':\r\n this.validReciboRRCC = false;\r\n break;\r\n case 'Licencia de actividad':\r\n this.validLicenciaActividad = false;\r\n break;\r\n case 'Plantilla de contrato de colaboración':\r\n this.validPlantillaContratoColaboracion = false;\r\n break;\r\n case 'Catalogos':\r\n this.validCatalogos = false;\r\n break;\r\n\r\n }\r\n\r\n }\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n validatePostalCode(event) {\r\n let postalCode = event.target.value;\r\n \r\n postalCode = postalCode.replace(/[a-zA-Z]/g, \"\");\r\n postalCode = postalCode.replace(/ /g, \"\");\r\n postalCode = postalCode.replace(/-/g, \"\");\r\n \r\n this.makerForm.get('postalCode').setValue(postalCode, { emitEvent: true });\r\n this.makerForm.get('postalCode').markAsTouched(); // Mark as touched\r\n this.makerForm.get('postalCode').updateValueAndValidity(); // Revalidate the field\r\n }\r\n\r\n openAlert(modalText: string, className: string, status: boolean) {\r\n let iconClass: string;\r\n if (status) {\r\n iconClass = 'vi-check';\r\n } else {\r\n iconClass = 'vi-sad';\r\n }\r\n const modalConfig = {\r\n class: className,\r\n initialState: {\r\n alertMessage: this.translate.instant(\r\n modalText\r\n ),\r\n iconClass,\r\n status\r\n }\r\n }\r\n this.dialogRef = this.dialog.show(ModalAlertComponent, modalConfig);\r\n setTimeout(() => {\r\n this.dialogRef.hide();\r\n }, 2500);\r\n }\r\n\r\n openUpgradePlanModal(template: TemplateRef, config: any) {\r\n this.modalRef = this.dialog.show(template, config);\r\n }\r\n\r\n pay() {\r\n let MONTHLY = [0, 0, 0, 'price_1Nb5Z7ECh0SazpvMUadAJcuk', 'price_1Nb5DLECh0SazpvMmdT3Huk9', 'price_1NdbGeECh0SazpvMGmc9xD7a', 'price_1NdbM1ECh0SazpvMFzbk2CqI', 'price_1NdbO1ECh0SazpvML8uKSyOU', 'price_1NibmlECh0SazpvMdeHZqxM8', 'price_1NicLJECh0SazpvMTdJipfSE', 'price_1NicMYECh0SazpvMVi6KGM53'];\r\n let ANUALLY = [0, 0, 0, 'price_1NdZ9qECh0SazpvMKrUExRSr', 'price_1Nb5IKECh0SazpvMiGYN6f0s', 'price_1NdbIJECh0SazpvMm91UniiJ', 'price_1NdbN4ECh0SazpvMMlYi3cTt', 'price_1NicISECh0SazpvMWNWj59OP', 'price_1NicKSECh0SazpvMSojrXJkh', 'price_1NicLrECh0SazpvMZHNNLzyY', 'price_1O5nktECh0SazpvMZKbRbpTh'];\r\n\r\n // PUBLIC_KEY = \"pk_test_PpbS40l0Y5lUsMN5YzpGlDZj00duWmRb3T\";\r\n let PUBLIC_KEY = \"pk_live_oJ6GN2TgQ5d6LvUiigRMQU6L003eXQBbMH\";\r\n\r\n const stripe = Stripe(PUBLIC_KEY);\r\n stripe.redirectToCheckout({\r\n lineItems: [{ price: this.regulation == 'monthly' ? MONTHLY[this.productsSelected] : ANUALLY[this.productsSelected], quantity: 1 }],\r\n mode: 'subscription',\r\n successUrl: `https://venntur.com/es/maker/admin/perfil`,\r\n cancelUrl: `https://venntur.com/es/maker/admin/perfil`,\r\n })\r\n .then(function (result) {\r\n if (result.error) {\r\n const displayError = document.getElementById('error-message');\r\n displayError.textContent = result.error.message;\r\n }\r\n });\r\n };\r\n}\r\n","{{translate.instant(title)}} \r\n\r\n
{{ 'Completa los datos del maker para poder crear experiencias' | translate}}
\r\n
\r\n\r\n\r\n\r\n\r\n
\r\n\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n Nº de factura\r\n \r\n
\r\n
\r\n \r\n Precio\r\n \r\n
\r\n
\r\n \r\n Fecha de pago\r\n \r\n
\r\n \r\n
\r\n
0\">\r\n \r\n
\r\n
\r\n \r\n {{invoice['paymentsTotal']}} €\r\n \r\n
\r\n
\r\n \r\n {{timestampToDate(invoice['date'])}}\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n -\r\n \r\n
\r\n
\r\n \r\n -\r\n \r\n
\r\n
\r\n - \r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n\r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n
Mejora tu plan \r\n \r\n
\r\n \r\n \r\n \r\n Pago mensual \r\n \r\n \r\n Pago anual \r\n \r\n
\r\n
\r\n
{{productsSelected + ' productos'}} \r\n
Mejora tu visibilidad con mas experiencias. \r\n
\r\n {{regulation == 'monthly' ? (6 * productsSelected) + 3 : ((5 *\r\n (productsSelected))) * 12 + 30}}€ \r\n / {{regulation == 'monthly' ? 'Mes' : 'Año'}} \r\n
\r\n
\r\n {{number}} \r\n \r\n
\r\n Plan Pro {{productsSelected == 1 ? 1 + ' producto' : productsSelected + ' productos'}}\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n
\r\n
\r\n\r\n\r\n\r\n
\r\n
\r\n\r\n\r\n
{{alert.message}}\r\n
\r\n
","export class MakerCollection {\r\n total: number;\r\n makers: Maker[];\r\n}\r\n\r\nexport class Maker {\r\n id: string;\r\n name: string;\r\n documentType: string;\r\n document: string;\r\n mediaMakers: any[];\r\n mediaMakersHeader: any[];\r\n mediaMakersLogo: any[];\r\n mediaMakersStaff: any[];\r\n phrase: string;\r\n phone: string;\r\n whatsapp: string;\r\n email: string;\r\n web: string;\r\n sustainableSeal: boolean;\r\n user: string;\r\n tripadvisor: string;\r\n description: string;\r\n founders: string;\r\n director: string;\r\n operations: string;\r\n technology: string;\r\n customerId: string;\r\n instagram: string;\r\n twitter: string;\r\n linkedIn: string;\r\n facebook: string;\r\n tags: any[];\r\n slug: string;\r\n makerPlan: any[];\r\n destinations: any[];\r\n address: string;\r\n location: any;\r\n postalCode: number;\r\n country: string;\r\n companyName: string;\r\n contactName: string;\r\n contactLastname: string;\r\n bookingEmail: string;\r\n holdedId: string;\r\n googleSites: string;\r\n googleMaps: string;\r\n phone2: string;\r\n tripadvisorApiWidgetReview: string;\r\n bookingEngine: string;\r\n bookingEngineWidget: string;\r\n mediaMakersDocs: any[];\r\n administrationEmail: string;\r\n reservationConditions: string;\r\n paymentConditions: string;\r\n cancelationConditions: string;\r\n idFareharbor: string;\r\n constructor(values: any = {}) {\r\n Object.assign(this, values);\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { HttpClient, HttpRequest } from '@angular/common/http';\r\n\r\nimport { Observable } from 'rxjs';\r\n\r\nimport { environment } from '../../../../environments/environment';\r\n\r\nconst API_URL = environment.apiUrl;\r\n\r\n@Injectable()\r\nexport class MediaMakerService {\r\n constructor(private http: HttpClient) {\r\n }\r\n\r\n mediaMakersUpload(fileItem: File, url, extraData?: object): Observable {\r\n const apiCreateEndpoint = `${API_URL}${url}`;\r\n const formData: FormData = new FormData();\r\n\r\n formData.append('file', fileItem, fileItem.name);\r\n if (extraData) {\r\n for (const key in extraData) {\r\n if (extraData.hasOwnProperty(key)) {\r\n formData.append(key, extraData[ key ]);\r\n }\r\n }\r\n }\r\n const req = new HttpRequest('POST', apiCreateEndpoint, formData, {\r\n reportProgress: true // for progress data\r\n });\r\n return this.http.request(req);\r\n }\r\n\r\n deleteMediaMakers(mediaMakersId) {\r\n return this.http\r\n .delete(`${API_URL}${mediaMakersId}`);\r\n }\r\n\r\n getMediaMakers(mediaMakersId) {\r\n return this.http\r\n .get(`${API_URL}${mediaMakersId}`);\r\n }\r\n\r\n mediaMakersDocsUpload(fileItem: File, url, extraData?: object): Observable {\r\n const apiCreateEndpoint = `${API_URL}${url}`;\r\n const formData: FormData = new FormData();\r\n\r\n formData.append('file', fileItem, fileItem.name);\r\n if (extraData) {\r\n for (const key in extraData) {\r\n if (extraData.hasOwnProperty(key)) {\r\n formData.append(key, extraData[ key ]);\r\n }\r\n }\r\n }\r\n const req = new HttpRequest('POST', apiCreateEndpoint, formData, {\r\n reportProgress: true // for progress data\r\n });\r\n return this.http.request(req);\r\n }\r\n\r\n deleteMediaDocs(mediaDocsIri) {\r\n return this.http\r\n .delete(`${API_URL}${mediaDocsIri}`);\r\n }\r\n\r\n}\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { ResellerService } from '../../shared/reseller.service';\r\nimport { MakerService } from '../../shared/maker.service';\r\nimport { Location } from '../../../shared/locations/location.model';\r\nimport { LocationService } from '../../../shared/locations/location.service';\r\nimport { TagsService } from '../../../shared/tags/tags.service';\r\nimport { Tag } from '../../../shared/tags/tag.model';\r\nimport { maxTableRows } from 'globals';\r\n\r\n@Component({\r\n selector: 'app-maker-resellers-list',\r\n templateUrl: './maker-resellers-list.component.html',\r\n styleUrls: ['./maker-resellers-list.component.css']\r\n})\r\nexport class MakerResellersListComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n columns = [];\r\n rows = [];\r\n makersResellers = [];\r\n statusArray = ['Pendiente contacto', 'Contactado', 'Contratado', 'Terminado'];\r\n isFavorites = true;\r\n tags: Tag[] = [];\r\n tagsSelected = [];\r\n locations: Location[] = [];\r\n locationsSelected = [];\r\n makerId;\r\n searchForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private resellerService: ResellerService,\r\n private makersService: MakerService,\r\n private tagsService: TagsService,\r\n private locationsService: LocationService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n public dialog: BsModalService,\r\n ) {\r\n this.makerId = this.makersService.getId();\r\n this.tagsService.getResellerActiveTags('es').subscribe(tags => {\r\n this.tags = tags['hydra:member'];\r\n });\r\n this.locationsService.getResellerActiveLocations().subscribe(locations => {\r\n this.locations = locations['hydra:member'];\r\n }\r\n );\r\n this.resellerService.getResellersByMakerId(this.makerId, {}).subscribe(experiences => {\r\n this.makersResellers = experiences[ 'hydra:member' ];\r\n });\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n fiscalName: [''],\r\n // email: [''],\r\n tags: [''],\r\n locations: [''],\r\n urlWeb: [''],\r\n isFavorites: [true],\r\n makerId: [this.makerId]\r\n });\r\n this.columns = [\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'fiscalName', name: 'Nombre fiscal' },\r\n // { prop: 'email', name: 'Email' },\r\n { prop: 'urlWeb', name: 'Página web' }];\r\n this.applyFilter();\r\n }\r\n\r\n applyFilter() {\r\n if (!this.searchForm.value.isFavorites) {\r\n this.resellerService.getResellers(this.searchForm.value).subscribe(\r\n data => {\r\n this.resellerService.getResellersByMakerId(this.makerId, {}).subscribe(resellers => {\r\n this.makersResellers = Array.from(resellers['hydra:member']).map((item) => item['reseller']['@id']);\r\n });\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n this.isFavorites = false;\r\n this.columns = [\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'fiscalName', name: 'Nombre fiscal' },\r\n // { prop: 'email', name: 'Email' },\r\n { prop: 'urlWeb', name: 'Página web' }];\r\n }\r\n );\r\n } else {\r\n this.resellerService.getResellersByMakerId(this.makerId, this.searchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n this.isFavorites = true;\r\n this.columns = [\r\n { prop: 'reseller.name', name: 'Nombre' },\r\n { prop: 'reseller.fiscalName', name: 'Nombre fiscal' },\r\n // { prop: 'email', name: 'Email' },\r\n { prop: 'reseller.urlWeb', name: 'Página web' }];\r\n });\r\n }\r\n }\r\n\r\n addFavorite(event, resellerId) {\r\n this.makersResellers.includes(resellerId) ?\r\n this.makersResellers.splice(this.makersResellers.indexOf(resellerId), 1) : this.makersResellers.push(resellerId);\r\n const favoriteReseller = {\r\n maker: '/makers/' + this.makerId,\r\n reseller: resellerId,\r\n status: 'Pendiente contacto'\r\n };\r\n this.makersService.postFavoriteReseller(favoriteReseller).subscribe();\r\n }\r\n\r\n removeFavorite(favoriteResellerId) {\r\n this.makersService.deleteFavoriteReseller(favoriteResellerId).subscribe(() => {\r\n this.applyFilter();\r\n }\r\n );\r\n }\r\n\r\n changeStatus(status, favoriteResellerId) {\r\n this.makersService.putFavoriteReseller(favoriteResellerId, {status: status}).subscribe();\r\n }\r\n}\r\n","\r\n
Resellers \r\n\r\n\r\n
{{alert.message}}
\r\n
\r\n\r\n
\r\n
Buscar por: \r\n
\r\n
\r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-not-found',\r\n template: `\r\n \r\n
\r\n
Página no encontrada \r\n
Ups.. Error 404, parece que la página que buscas no existe :(
\r\n
\r\n `,\r\n})\r\nexport class NotFoundComponent implements OnInit {\r\n\r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n}\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { ExperiencesService } from '../experiences/experiences/experiences.service';\r\nimport { MakerService } from '../shared/maker.service';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { ActivatedRoute } from '@angular/router';\r\nimport { maxTableRows } from 'globals';\r\n\r\n@Component({\r\n selector: 'app-product-reviews-list',\r\n templateUrl: './product-reviews-list.component.html',\r\n styleUrls: ['./product-reviews-list.component.scss']\r\n})\r\nexport class ProductReviewsListComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n title = 'Reviews de ';\r\n experienceName = '';\r\n productId = this.activatedRoute.snapshot.params.id\r\n\r\n searchForm: UntypedFormGroup;\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n\r\n columns = [];\r\n rows = [];\r\n\r\n maker: any = [];\r\n\r\n constructor(\r\n public translate: TranslateService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n private experienceService: ExperiencesService,\r\n private makerService: MakerService,\r\n private activatedRoute: ActivatedRoute,\r\n ) {\r\n\r\n this.getReviewsByExperienceId();\r\n this.getExperienceName();\r\n\r\n this.makerService.getMaker('/makers/' + makerService.getId()).subscribe((maker => {\r\n this.maker = maker;\r\n }));\r\n\r\n this.columns = [\r\n { prop: 'comments', name: 'Comentario' },\r\n { prop: 'channel', name: 'Canal' },\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'reviewerLocation', name: 'Localidad' },\r\n ];\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n comments: [''],\r\n });\r\n }\r\n\r\n getExperienceName() {\r\n this.experienceService.getExperience(this.productId).subscribe((resp => {\r\n this.experienceName = resp.name;\r\n }));\r\n }\r\n\r\n getReviewsByExperienceId() {\r\n this.experienceService.getReviewsByExperienceId(this.productId).subscribe((reviews => {\r\n this.rows = reviews['hydra:member'];\r\n }));\r\n }\r\n\r\n\r\n applyFilter() {\r\n this.experienceService.getReviewsByExperienceId(this.productId, this.searchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n }\r\n );\r\n }\r\n\r\n setReviewStatus(id, status) {\r\n this.experienceService.putReviewStatus(id, status).subscribe((maker => {\r\n this.getReviewsByExperienceId()\r\n }));\r\n }\r\n\r\n formatDateString(inputDateString: string): string {\r\n const date = new Date(inputDateString);\r\n\r\n if (isNaN(date.getTime())) {\r\n return \"Invalid Date\";\r\n }\r\n\r\n const day = date.getDate().toString().padStart(2, '0');\r\n const month = (date.getMonth() + 1).toString().padStart(2, '0');\r\n const year = date.getFullYear();\r\n\r\n const formattedDateString = `${day}/${month}/${year}`;\r\n\r\n return formattedDateString;\r\n }\r\n\r\n}\r\n","\r\n
\r\n
\r\n \r\n {{ translate.instant(title) + ' ' + experienceName }}\r\n \r\n \r\n
\r\n\r\n
\r\n
{{ 'Buscar por:' | translate}} \r\n
\r\n
\r\n
\r\n\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {{formatDateString(value)}}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
","import { Component, OnInit, Renderer2, TemplateRef, ViewChild } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { BsModalRef, BsModalService, ModalDirective } from 'ngx-bootstrap/modal';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { BsDatepickerConfig, BsLocaleService } from 'ngx-bootstrap/datepicker';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { SalesService } from '../../sales/sales.service';\r\nimport { errorMessages } from '../../shared/custom-validators';\r\nimport { Taker } from '../../taker/taker-profile/taker.model';\r\nimport { TakerService } from '../../shared/taker.service';\r\nimport { Meta, Title } from '@angular/platform-browser';\r\nimport { JsonLdService } from 'src/app/json-ld.service';\r\n\r\n@Component({\r\n selector: 'app-product-page',\r\n templateUrl: './product-page.component.html',\r\n styleUrls: ['./product-page.component.scss']\r\n})\r\nexport class ProductPageComponent implements OnInit {\r\n activeTag = 'description';\r\n modalRef: BsModalRef;\r\n myImageArray = ['https://venntur.com/assets/experience/files/649198d9952cf975573530.jpeg', 'https://venntur.com/assets/experience/files/600c20ad9f5d5384735017.jpg', 'https://venntur.com/assets/experience/files/60d2f09f2e710932983928.jpeg']\r\n productId = null;\r\n experience = null;\r\n reviews: any;\r\n customPhoneTooltip = 'Copiar al portapapeles';\r\n customEmailTooltip = 'Copiar al portapapeles';\r\n week = ['Todos los días', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo']\r\n takerExperiences = [];\r\n bsInlineValue = new Date();\r\n bsConfig?: Partial;\r\n selectedAdults = 2;\r\n selectedKids = 0;\r\n bookingRequestForm: UntypedFormGroup;\r\n bookingEmailData = {\r\n makerName: null,\r\n makerEmail: null,\r\n experienceName: null,\r\n date: null,\r\n adults: null,\r\n kids: null,\r\n name: null,\r\n phone: null,\r\n email: null,\r\n comments: null,\r\n url: null\r\n }\r\n errors = errorMessages;\r\n bookingRequestSuccess = false;\r\n isAlertShown = false;\r\n turitopId;\r\n bokunId;\r\n rezdyId;\r\n donicusId;\r\n showDefault: any = false;\r\n @ViewChild('autoShownModal', { static: false }) autoShownModal: ModalDirective;\r\n tripAdvisorOpinions = [{\r\n image: \"../../../../assets/venntur-isotype-70.png\",\r\n username: 'Adrian A',\r\n date: 'October 24',\r\n title: 'Excursión inolvidable',\r\n review: 'Es inexplicable lo que puedes disfrutar !!! La compañía , los trabajadores, el PATRON !!!! Se pasa volando , es una pena que excursiones así se acaben tan pronto !!! Me lo he pasado en grande , volvería a repetir una y millones de veces.'\r\n }, {\r\n image: \"../../../../assets/venntur-isotype-70.png\",\r\n username: 'Adriana B',\r\n date: 'June 27',\r\n title: 'Excursión inolvidable',\r\n review: 'Es inexplicable lo que puedes disfrutar !!! La compañía , los trabajadores, el PATRON !!!! Se pasa volando , es una pena que excursiones así se acaben tan pronto !!! Me lo he pasado en grande , volvería a repetir una y millones de veces.'\r\n }\r\n ]\r\n\r\n constructor(\r\n private router: Router,\r\n private modalService: BsModalService,\r\n private experienceService: ExperiencesService,\r\n public translate: TranslateService,\r\n public salesService: SalesService,\r\n public bsLocaleService: BsLocaleService,\r\n private takerService: TakerService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n private meta: Meta,\r\n private renderer2: Renderer2,\r\n private title: Title,\r\n private jsonLdService: JsonLdService\r\n ) {\r\n this.bsConfig = Object.assign({}, { showWeekNumbers: false, adaptivePosition: true });\r\n this.bsLocaleService.use('es');//fecha en español, datepicker\r\n }\r\n\r\n ngOnInit(): void {\r\n // Generate and add JSON-LD schema\r\n this.removeMetaTags();\r\n this.loadExperience();\r\n\r\n \r\n // Initialize the form group with validators\r\n this.bookingRequestForm = this.searchFormBuilder.group({\r\n date: ['',\r\n Validators.required],\r\n adults: ['',\r\n Validators.required],\r\n kids: ['',\r\n Validators.required],\r\n name: ['',\r\n Validators.required],\r\n phone: ['',\r\n Validators.required],\r\n email: ['',\r\n Validators.required],\r\n comments: ['',\r\n Validators.required],\r\n dataProtection: ['',\r\n Validators.required]\r\n });\r\n \r\n // Fetch experiences by taker ID\r\n this.experienceService.getExperiencesByTakerId(this.takerService.getId()).subscribe(experiences => {\r\n this.takerExperiences = Array.from(experiences['hydra:member']).map((item) => item['@id']);\r\n });\r\n\r\n \r\n }\r\n\r\n loadExperience() {\r\n var productSlug = this.router['rawUrlTree'].root.children.primary.segments[2].path;\r\n\r\n this.experienceService.getExperienceBySlug(productSlug, this.translate.getDefaultLang()).subscribe(experience => {\r\n experience = experience['hydra:member'][0];\r\n this.experienceService.getExperience(experience.id, this.translate.getDefaultLang()).subscribe(experience => {\r\n\r\n this.productId = experience.id;\r\n \r\n this.experience = experience;\r\n\r\n this.meta.addTags([\r\n { name: 'description', content: this.experience.description },\r\n { name: 'lang', content: 'es' },\r\n { name: 'robots', content: 'index, follow' },\r\n { property: 'og:title', content: this.experience.name },\r\n { property: 'og:description', content: this.experience.description },\r\n { property: 'og:image', content: 'https://venntur.com/assets/experience/files/' + experience.mediaExperiences[0].contentUrl },\r\n { property: 'og:url', content: 'https://venntur.com/' + this.experience.slug },\r\n { property: 'og:site_name', content: 'Venntur' }\r\n ]);\r\n this.setTitle(this.experience.name);\r\n\r\n if (this.experience.maker.bookingEngine) {\r\n if (this.experience.bookingEngine == 'Turitop' || (!this.experience.bookingEngine && this.experience.maker.bookingEngine == 'Turitop')) {\r\n this.turitopId = this.experience.turitopId;\r\n setTimeout(() => {\r\n let calendar: any = document.getElementById('turitop-calendar');\r\n\r\n var s = document.createElement(\"script\");\r\n s.type = \"text/javascript\";\r\n s.src = \"https://app.turitop.com/js/load-turitop.min.js\";\r\n s.id = \"js-turitop\";\r\n s.setAttribute('data-company', this.experience.bookingEngineWidget ? this.experience.bookingEngineWidget : this.experience.maker.bookingEngineWidget);\r\n s.setAttribute('data-ga', 'no');\r\n s.setAttribute('data-buttoncolor', 'green');\r\n s.setAttribute('data-afftag', 'ttafid');\r\n calendar.appendChild(s);\r\n }, 1000);\r\n } else if (this.experience.bookingEngine == 'Fareharbor' || (!this.experience.bookingEngine && this.experience.maker.bookingEngine == 'Fareharbor')) {\r\n setTimeout(() => {\r\n let calendar: any = document.getElementById(\"fareharbor-calendar\");\r\n let fareharbor: any = document.getElementsByClassName(\"fareharbor-calendar-wrap\")[0];\r\n (fareharbor as any).style.display = \"block\";\r\n (fareharbor as any).parentNode.removeChild(fareharbor);\r\n (fareharbor.firstChild as any).src = \"https://fareharbor.com/embeds/calendar/\" + (this.experience.bookingEngineWidget ? this.experience.bookingEngineWidget : this.experience.maker.bookingEngineWidget) + \"/items/\" + this.experience.fareharborId + \"?fallback=simple&flow=no&back=https://venntur.com/es/product/\" + this.experience.slug + '&language=' + this.translate.getDefaultLang();\r\n calendar.appendChild(fareharbor);\r\n }, 1000);\r\n } else if (this.experience.bookingEngine == 'Bokun' || (!this.experience.bookingEngine && this.experience.maker.bookingEngine == 'Bokun')) {\r\n setTimeout(() => {\r\n var s = document.createElement(\"script\");\r\n s.type = \"text/javascript\";\r\n s.src = \"https://widgets.bokun.io/assets/javascripts/apps/build/BokunWidgetsLoader.js?bookingChannelUUID=\" + (this.experience.bookingEngineWidget ? this.experience.bookingEngineWidget : this.experience.maker.bookingEngineWidget) + \"&isDuda=true\";\r\n document.getElementsByTagName('head')[0].appendChild(s);\r\n }, 1000);\r\n\r\n this.bokunId = this.experience.bokunId;\r\n } else if (this.experience.bookingEngine == 'Rezdy' || (!this.experience.bookingEngine && this.experience.maker.bookingEngine == 'Rezdy')) {\r\n this.rezdyId = this.experience.rezdyId;\r\n var s = document.createElement(\"script\");\r\n s.type = \"text/javascript\";\r\n s.src = \"https://catlanza.rezdy.com/pluginJs\";\r\n document.getElementsByTagName('head')[0].appendChild(s);\r\n setTimeout(() => {\r\n var w: any = document.getElementById('iFrameResizer0');\r\n w.src = 'https://' + (this.experience.bookingEngineWidget ? this.experience.bookingEngineWidget : this.experience.maker.bookingEngineWidget) + '.rezdy.com/calendarWidget/' + this.rezdyId + '?iframe=true';\r\n }, 1000);\r\n\r\n } else if (this.experience.bookingEngine == 'Donicus' || (!this.experience.bookingEngine && this.experience.maker.bookingEngine == 'Donicus')) {\r\n this.donicusId = this.experience.donicusId;\r\n setTimeout(() => {\r\n let calendar: any = document.getElementById('don-'+this.experience.bookingEngineWidget );\r\n // don-EDCFD2BC-EE8E-4D29-A680-25474C872D85\r\n // '65a8daf7-e9b5-45ff-bdf6-f3f7d7639499'\r\n calendar.setAttribute('donref', this.donicusId);\r\n calendar.setAttribute('donlocale', 'ES'); \r\n }, 500);\r\n \r\n setTimeout(() => {\r\n var s = document.createElement(\"script\");\r\n s.type = \"text/javascript\";\r\n s.src = \"https://service.donicus.com/dist/loader.min.js\";\r\n s.setAttribute('donname', 'donicusBooking');\r\n document.getElementsByTagName('head')[0].appendChild(s);\r\n }, 1000);\r\n\r\n } else {\r\n this.showDefault = true;\r\n }\r\n } else {\r\n this.showDefault = true;\r\n }\r\n\r\n this.addJsonLdSchema();\r\n\r\n\r\n this.experienceService.getValidatedReviewsByExperienceId(this.productId).subscribe(reviews => {\r\n this.reviews = reviews['hydra:member'];\r\n\r\n // Dont show the comment if has not text\r\n this.reviews.forEach(review => {\r\n\r\n if (review.comments === \"Sin comentario\") {\r\n review.comments = \"\";\r\n }\r\n\r\n });\r\n\r\n });\r\n\r\n });\r\n })\r\n }\r\n\r\n\r\n scrollToElement(id: any) {\r\n const element = document.getElementById(id);\r\n if (element) {\r\n element.scrollIntoView({ behavior: 'smooth' });\r\n }\r\n }\r\n\r\n openPhotosModal(template: TemplateRef, config: any) {\r\n this.modalRef = this.modalService.show(template, config);\r\n }\r\n\r\n convertTimeToCustomFormat(inputTime: string): string {\r\n let formattedText;\r\n const [hours, minutes] = inputTime.split(':').map(part => parseInt(part, 10));\r\n\r\n if (minutes != 0) {\r\n formattedText = hours + ' h y ' + minutes + ' min'\r\n } else {\r\n formattedText = hours + ' h'\r\n }\r\n\r\n return formattedText;\r\n }\r\n\r\n changePhoneTooltip(text: string) {\r\n const textarea = document.createElement('textarea');\r\n textarea.style.position = 'fixed';\r\n textarea.style.opacity = '0';\r\n textarea.value = text;\r\n document.body.appendChild(textarea);\r\n textarea.select();\r\n document.execCommand('copy');\r\n document.body.removeChild(textarea);\r\n this.customEmailTooltip = 'Copiar al portapapeles'\r\n this.customPhoneTooltip = 'Copiado!'\r\n }\r\n\r\n changeEmailTooltip(text: string) {\r\n const textarea = document.createElement('textarea');\r\n textarea.style.position = 'fixed';\r\n textarea.style.opacity = '0';\r\n textarea.value = text;\r\n document.body.appendChild(textarea);\r\n textarea.select();\r\n document.execCommand('copy');\r\n document.body.removeChild(textarea);\r\n this.customPhoneTooltip = 'Copiar al portapapeles'\r\n this.customEmailTooltip = 'Copiado!'\r\n }\r\n\r\n formatDate(inputDate) {\r\n const date = new Date(inputDate);\r\n const day = String(date.getDate()).padStart(2, '0');\r\n const month = String(date.getMonth() + 1).padStart(2, '0'); // Note: Months are zero-based, so we add 1.\r\n const year = date.getFullYear();\r\n\r\n return `${day}-${month}-${year}`;\r\n }\r\n\r\n storeDate(event) {\r\n console.log(event);\r\n this.bsInlineValue = event;\r\n }\r\n\r\n \r\n\r\n sendBookingEmail() {\r\n\r\n this.bookingEmailData.makerEmail = this.experience.maker.email;\r\n this.bookingEmailData.makerName = this.experience.maker.name;\r\n this.bookingEmailData.experienceName = this.experience.name;\r\n this.bookingEmailData.date = this.formatDate(this.bsInlineValue);\r\n this.bookingRequestForm.get('date').setValue(this.formatDate(this.bsInlineValue));\r\n this.bookingEmailData.adults = this.bookingRequestForm.get('adults').value;\r\n this.bookingEmailData.kids = this.bookingRequestForm.get('kids').value;\r\n this.bookingEmailData.name = this.bookingRequestForm.get('name').value;\r\n this.bookingEmailData.phone = this.bookingRequestForm.get('phone').value;\r\n this.bookingEmailData.email = this.bookingRequestForm.get('email').value;\r\n this.bookingEmailData.comments = this.bookingRequestForm.get('comments').value;\r\n this.bookingEmailData.url = 'https://venntur.com/es/product/' + this.experience.slug;\r\n\r\n if (this.bookingRequestForm.status == 'VALID') {\r\n this.salesService.postBookingEmail(this.bookingEmailData).subscribe(\r\n response => {\r\n console.log(response);\r\n this.bookingRequestSuccess = true;\r\n setTimeout(() => {\r\n this.bookingRequestSuccess = false;\r\n }, 5000);\r\n },\r\n error => {\r\n console.log('error al enviar el email');\r\n console.log(error);\r\n });\r\n } else {\r\n this.bookingRequestForm.markAllAsTouched();\r\n }\r\n\r\n }\r\n\r\n showError(formValue) {\r\n return this.bookingRequestForm.get(formValue).invalid && this.bookingRequestForm.get(formValue).touched;\r\n }\r\n\r\n clickFavorite(event, experienceId) {\r\n if (this.takerService.getId()) {\r\n this.takerExperiences.includes(experienceId) ?\r\n this.takerExperiences.splice(this.takerExperiences.indexOf(experienceId), 1) : this.takerExperiences.push(experienceId);\r\n const taker = {\r\n favoriteExperiences: this.takerExperiences\r\n };\r\n const editedTaker = new Taker(taker);\r\n this.takerService.putTaker(this.takerService.getId(), editedTaker).subscribe();\r\n } else {\r\n this.isAlertShown = true;\r\n }\r\n }\r\n\r\n shareExperience(experience) {\r\n var enlace = 'https://venntur.com/product/' + experience.slug;\r\n var mensaje = this.translate.instant('¡Mira esta experiencia en Venntur!');\r\n\r\n mensaje = encodeURIComponent(mensaje);\r\n enlace = encodeURIComponent(enlace);\r\n\r\n var enlaceWhatsApp = 'https://wa.me/?text=' + mensaje + '%20' + enlace;\r\n\r\n window.open(enlaceWhatsApp);\r\n\r\n }\r\n\r\n onHidden(): void {\r\n this.isAlertShown = false;\r\n }\r\n\r\n hideModal(): void {\r\n this.autoShownModal.hide();\r\n }\r\n\r\n removeMetaTags() {\r\n const metaTags = Array.from(document.querySelectorAll('meta'));\r\n\r\n metaTags.forEach((metaTag: Element) => {\r\n this.renderer2.removeChild(document.head, metaTag);\r\n });\r\n }\r\n\r\n public setTitle(newTitle: string) {\r\n this.title.setTitle(newTitle);\r\n }\r\n\r\n getUrl(isCivitatis, image) {\r\n return !isCivitatis ? 'https://venntur.com/assets/experience/files/' + image : image;\r\n // return !isCivitatis ? 'https://dev.venntur.com/assets/newExperience/files/' + image : image;\r\n }\r\n\r\n // New method for adding JSON-LD schema\r\naddJsonLdSchema(): void {\r\n console.log('Adding JSON-LD schema', this.experience);\r\n if (this.experience) {\r\n const currentLanguage = this.experience.language || 'en';\r\n const schema = {\r\n \"@context\": \"https://schema.org\",\r\n \"@type\": \"TouristAttraction\",\r\n \"name\": this.experience.name,\r\n \"description\": this.experience.description,\r\n \"image\": this.myImageArray,\r\n \"url\": `https://venntur.com/${currentLanguage}/product/${this.experience.slug}`,\r\n \"addressLocality\": this.experience.location.city,\r\n \"addressRegion\": this.experience.location.region\r\n // \"aggregateRating\": {\r\n // \"@type\": \"AggregateRating\",\r\n // \"ratingValue\": this.experience.averageRating || \"4.5\",\r\n // \"reviewCount\": this.experience.reviewCount || this.reviews.length\r\n // },\r\n // \"offers\": {\r\n // \"@type\": \"Offer\",\r\n // \"price\": this.experience.price || \"0\",\r\n // \"priceCurrency\": \"EUR\",\r\n // \"availability\": \"https://schema.org/InStock\",\r\n // \"url\": `https://venntur.com/${currentLanguage}/product/${this.experience.slug}`\r\n // },\r\n // \"address\": {\r\n // \"@type\": \"PostalAddress\",\r\n // \"addressLocality\": this.experience.location.city,\r\n // \"addressRegion\": this.experience.location.region,\r\n // \"addressCountry\": \"ES\"\r\n // }\r\n };\r\n // Add JSON-LD schema to the page\r\n console.log(\"ABOUT TO SEND SCHEMA...\");\r\n this.jsonLdService.setData(schema);\r\n }\r\n }\r\n}\r\n","\r\n
\r\n
\r\n
\r\n {{experience.name}}\r\n \r\n
\r\n
\r\n \r\n {{category.name}}, \r\n \r\n \r\n |\r\n \r\n \r\n \r\n {{experience.location.name}}, {{experience.location.country}}\r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
0 ? experience.mediaExperiences[0].contentUrl : ''))\"\r\n alt=\"Imagen de la empresa\" (click)=\"openPhotosModal(photosContent,{class: 'photosModal'})\">\r\n
{{experience.promotionType}} \r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n {{ 'Descripción' | translate }} \r\n {{ 'Qué incluye' | translate }} \r\n {{ 'Excluido' | translate }} \r\n {{ 'Qué debes saber' | translate }} \r\n {{ 'Qué debes llevar' | translate }} \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
1 ? experience.mediaExperiences[1].contentUrl : ''))\"\r\n alt=\"Imagen de la experiencia\" (click)=\"openPhotosModal(photosContent,{class: 'photosModal'})\">\r\n
\r\n
\r\n
2 ? experience.mediaExperiences[2].contentUrl : ''))\"\r\n alt=\"Imagen de la experiencia\" style=\"border-radius: 0px 20px 0px 0px;\" (click)=\"openPhotosModal(photosContent,{class: 'photosModal'})\">\r\n
\r\n
\r\n
3 ? experience.mediaExperiences[3].contentUrl : ''))\"\r\n alt=\"Imagen de la experiencia\" (click)=\"openPhotosModal(photosContent,{class: 'photosModal'})\">\r\n
\r\n
\r\n
4 ? experience.mediaExperiences[4].contentUrl : ''))\"\r\n alt=\"Imagen de la experiencia\" style=\"border-radius: 0px 0px 20px 0px;\" (click)=\"openPhotosModal(photosContent,{class: 'photosModal'})\">\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n {{convertTimeToCustomFormat(experience.duration)}}\r\n \r\n \r\n
\r\n
0\" class=\"pr-3\">\r\n | \r\n \r\n \r\n {{ week[day] | translate }}, \r\n \r\n \r\n
\r\n
\r\n | \r\n \r\n \r\n {{language.name}}, \r\n \r\n \r\n Sin datos\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n Sin datos\r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n {{ 'Qué incluye' | translate }}\r\n \r\n
\r\n
\r\n \r\n {{includes}}\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n {{ 'Excluido' | translate }}\r\n \r\n
\r\n
\r\n \r\n {{notIncludes}}\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n {{ 'Qué debes saber' | translate }}\r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n {{'Qué debes llevar' | translate }}\r\n \r\n
\r\n \r\n
\r\n \r\n {{carryInfo}}\r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
{{ 'Reservar en la web' | translate }} \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n\r\n\r\n \r\n
\r\n \r\n
\r\n \r\n
{{i + 1}}/{{experience.mediaExperiences.length}} \r\n
\r\n \r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n \r\n \r\n
\r\n \r\n
\r\n \r\n\r\n","import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { Router } from '@angular/router';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport KeenSlider, { KeenSliderInstance } from 'keen-slider';\r\nimport JSZip from 'jszip';\r\nimport { HttpClient } from '@angular/common/http';\r\n\r\n@Component({\r\n selector: 'app-product-pin-page',\r\n templateUrl: './product-pin-page.component.html',\r\n styleUrls: ['./product-pin-page.component.scss',\r\n '../../../../../node_modules/keen-slider/keen-slider.min.css']\r\n})\r\nexport class ProductPinPageComponent implements OnInit {\r\n\r\n @ViewChild(\"pinImagesSlider\") pinImagesSlider: ElementRef;\r\n\r\n productId = null;\r\n experience = null;\r\n showTab = 'generalData'\r\n currentModality = 0;\r\n savedUrls: string[] = [];\r\n savedVideoUrls: string[] = [];\r\n allImages: string[] = [];\r\n disableDownload = false;\r\n\r\n currentSlide: number = 0\r\n dotHelper: Array = []\r\n slider: KeenSliderInstance = null\r\n\r\n constructor(\r\n private router: Router,\r\n public translate: TranslateService,\r\n private experienceService: ExperiencesService,\r\n private http: HttpClient\r\n ) { }\r\n\r\n ngOnInit(): void {\r\n var productSlug = this.router['rawUrlTree'].root.children.primary.segments[2].path;\r\n\r\n this.experienceService.getExperienceBySlug(productSlug, this.translate.getDefaultLang()).subscribe(experience => {\r\n\r\n experience = experience['hydra:member'][0];\r\n this.productId = experience.id;\r\n\r\n this.experience = experience;\r\n\r\n experience.mediaExperiences.forEach(image => {\r\n this.allImages.push('https://venntur.com/assets/experience/files/' + image.contentUrl)\r\n });\r\n });\r\n\r\n }\r\n\r\n ngAfterViewInit() {\r\n\r\n setTimeout(() => {\r\n this.slider = new KeenSlider(this.pinImagesSlider.nativeElement, {\r\n initial: this.currentSlide,\r\n slideChanged: (s) => {\r\n this.currentSlide = s.track.details.rel\r\n },\r\n })\r\n this.dotHelper = [\r\n ...Array(this.slider.track.details.slides.length).keys(),\r\n ]\r\n }, 1000);\r\n }\r\n\r\n ngOnDestroy() {\r\n if (this.slider) this.slider.destroy()\r\n }\r\n\r\n setTitle(array) {\r\n return array.map(obj => obj.name).join(', ')\r\n }\r\n\r\n setModality(index) {\r\n this.currentModality = index;\r\n }\r\n\r\n saveImage(url) {\r\n console.log(url);\r\n\r\n if (this.savedUrls.includes('https://venntur.com/assets/experience/files/' + url)) {\r\n this.savedUrls = this.savedUrls.filter(item => item !== 'https://venntur.com/assets/experience/files/' + url);\r\n } else {\r\n this.savedUrls.push('https://venntur.com/assets/experience/files/' + url)\r\n }\r\n console.log(this.savedUrls);\r\n\r\n }\r\n\r\n saveVideo(url) {\r\n\r\n console.log(url);\r\n\r\n if(this.savedVideoUrls.includes(url)){\r\n this.savedVideoUrls = this.savedVideoUrls.filter(item => item !== url);\r\n } else {\r\n this.savedVideoUrls.push(url);\r\n }\r\n\r\n console.log(this.savedVideoUrls);\r\n\r\n }\r\n\r\n downloadFiles(urls) {\r\n for (let i = 0; i < urls.length; i++) {\r\n const url = urls[i];\r\n const fileName = url.substring(url.lastIndexOf('/') + 1); // Extract file name from URL\r\n\r\n // Create an element\r\n const link = document.createElement('a');\r\n link.href = url;\r\n link.download = fileName;\r\n\r\n console.log(url);\r\n\r\n // Trigger the download programmatically\r\n link.style.display = 'none'; // Hide the link\r\n document.body.appendChild(link);\r\n link.click();\r\n\r\n // Clean up\r\n document.body.removeChild(link);\r\n }\r\n }\r\n\r\n async downloadAllFiles(savedUrls) {\r\n this.disableDownload = true;\r\n const zip = new JSZip();\r\n\r\n // Create a folder in the ZIP archive\r\n const folder = zip.folder('files');\r\n\r\n // Add each file to the folder\r\n for (const [index, url] of savedUrls.entries()) {\r\n this.experienceService.getFileDatas({ 'url': url }).subscribe((response => {\r\n const data = this.base64toBlob(response.response);\r\n const fileName = `${this.experience.slug}${index + 1}.${url.split('.').pop()}`;\r\n folder.file(fileName, data);\r\n }))\r\n\r\n }\r\n\r\n setTimeout(async () => {\r\n const zipBlob = await zip.generateAsync({ type: 'blob' });\r\n\r\n // Create a download link for the ZIP file\r\n const link = document.createElement('a');\r\n link.href = URL.createObjectURL(zipBlob);\r\n link.download = 'Images.zip';\r\n link.style.display = 'none';\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n \r\n this.disableDownload = false;\r\n }, 1000);\r\n\r\n // Generate the ZIP file\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n async downloadAllVideos(savedUrls) {\r\n this.disableDownload = true;\r\n const zip = new JSZip();\r\n\r\n // Create a folder in the ZIP archive\r\n const folder = zip.folder('archivos');\r\n\r\n // Add each file to the folder\r\n for (const [index, url] of savedUrls.entries()) {\r\n this.experienceService.getFileDatas({ 'url': url }).subscribe((response => {\r\n\r\n var cleanUrl = url.replace('https://venntur-media.s3.eu-west-3.amazonaws.com/', '');\r\n var videoFormat = 'video/' + cleanUrl.split('.').pop();\r\n var format = cleanUrl.split('.').pop();\r\n\r\n console.log(videoFormat);\r\n\r\n //convert response.response to blob video\r\n const videoData = this.base64ToBlobVideo(response.response, videoFormat);\r\n const fileName = this.experience.slug + '.' + format;\r\n folder.file(fileName, videoData);\r\n }))\r\n\r\n }\r\n\r\n setTimeout(async () => {\r\n const zipBlob = await zip.generateAsync({ type: 'blob' });\r\n\r\n // Create a download link for the ZIP file\r\n const link = document.createElement('a');\r\n link.href = URL.createObjectURL(zipBlob);\r\n link.download = 'Venntur-videos.zip';\r\n link.style.display = 'none';\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n \r\n this.disableDownload = false;\r\n }, 1000);\r\n\r\n // Generate the ZIP file\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n /* async downloadAllVideos(savedUrls) {\r\n this.disableDownload = true;\r\n const zip = new JSZip();\r\n const folder = zip.folder('files');\r\n \r\n for (const [index, url] of savedUrls.entries()) {\r\n // Utiliza tu método o servicio para obtener los datos del video\r\n\r\n const videoHtml = document.getElementById(url);\r\n console.log(videoHtml);\r\n\r\n var cleanUrl = url.replace('https://venntur-media.s3.eu-west-3.amazonaws.com/', '');\r\n var videoFormat = cleanUrl.split('.').pop();\r\n\r\n this.getVideoDataHtml(videoHtml, videoFormat).then((data) => {\r\n console.log(data);\r\n //folder.file(`${this.experience.slug}${index + 1}.${videoFormat}`, data, { binary: true });\r\n });\r\n\r\n\r\n //url: https://---.com/---.extension we need just the extension\r\n const fileName = `${this.experience.slug}${index + 1}.${url.split('.').pop()}`;\r\n\r\n console.log(url);\r\n console.log(fileName);\r\n console.log(videoFormat);\r\n\r\n\r\n \r\n // Agrega los datos del video al archivo ZIP\r\n //folder.file(fileName, videoData, { binary: true });\r\n }\r\n \r\n const zipBlob = await zip.generateAsync({ type: 'blob' });\r\n \r\n const link = document.createElement('a');\r\n link.href = URL.createObjectURL(zipBlob);\r\n link.download = 'Videos.zip';\r\n link.style.display = 'none';\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n \r\n this.disableDownload = false;\r\n }\r\n\r\n getVideoDataHtml(videoHtml, videoFormat) {\r\n return new Promise((resolve, reject) => {\r\n videoHtml.onloadeddata = () => {\r\n const canvas = document.createElement('canvas');\r\n canvas.width = videoHtml.videoWidth;\r\n canvas.height = videoHtml.videoHeight;\r\n canvas.getContext('2d').drawImage(videoHtml, 0, 0, canvas.width, canvas.height);\r\n canvas.toBlob(resolve, 'video/'+videoFormat, 0.95);\r\n\r\n console.log(canvas);\r\n\r\n\r\n };\r\n });\r\n }\r\n \r\n async getVideoData(url) {\r\n // Utiliza tu método o servicio para obtener los datos del video en el formato adecuado\r\n // y devuélvelos como un objeto Blob o en el formato necesario para ser agregados al archivo ZIP\r\n\r\n // NO CORS MODE, GET VIDEO DATA FROM VIDEO URL\r\n\r\n \r\n\r\n\r\n try {\r\n\r\n const response = await fetch(url, {\r\n mode: 'no-cors'\r\n });\r\n \r\n if (!response.ok) {\r\n throw new Error('Error al obtener los datos del video');\r\n }\r\n\r\n console.log(url);\r\n console.log(response);\r\n \r\n const videoData = await response.blob();\r\n console.log(videoData);\r\n \r\n return videoData;\r\n\r\n } catch (error) {\r\n console.error(error);\r\n throw error;\r\n }\r\n\r\n } */\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n base64toBlob(base64Data) {\r\n // contentType = contentType || '';\r\n const byteCharacters = atob(base64Data);\r\n const byteArrays = [];\r\n\r\n for (let i = 0; i < byteCharacters.length; i++) {\r\n byteArrays.push(byteCharacters.charCodeAt(i));\r\n }\r\n\r\n return new Blob([new Uint8Array(byteArrays)]);\r\n }\r\n\r\n base64ToBlobVideo(base64Data, contentType) {\r\n const byteCharacters = atob(base64Data);\r\n const byteArrays = [];\r\n \r\n for (let offset = 0; offset < byteCharacters.length; offset += 512) {\r\n const slice = byteCharacters.slice(offset, offset + 512);\r\n \r\n const byteNumbers = new Array(slice.length);\r\n for (let i = 0; i < slice.length; i++) {\r\n byteNumbers[i] = slice.charCodeAt(i);\r\n }\r\n \r\n const byteArray = new Uint8Array(byteNumbers);\r\n byteArrays.push(byteArray);\r\n }\r\n \r\n return new Blob(byteArrays, { type: contentType });\r\n }\r\n \r\n\r\n}\r\n","\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
0 ? experience.maker.mediaMakers[0].contentUrl : '')\"\r\n alt=\"Imagen de la experiencia\">\r\n
{{experience.name}} \r\n
Descargar ficha \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
1\">\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n ID Venntur \r\n {{experience.id ? experience.id : 'No disponible' }} \r\n
\r\n
\r\n Título \r\n {{experience.name}} \r\n
\r\n
\r\n Categoría \r\n {{experience.categories[0].name}} \r\n
\r\n
\r\n
Subategoría/s \r\n
\r\n {{category.name}}, \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n ID Channel Manager \r\n {{ experience.channelManagerId ? experience.channelManagerId : 'No disponible' }} \r\n
\r\n
\r\n Destino \r\n {{experience.location.name}} \r\n
\r\n
\r\n
Etiquetas \r\n
\r\n {{tag.name}}, \r\n
\r\n
\r\n
\r\n
Idiomas \r\n
\r\n {{language.name}}, \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n Descripción\r\n \r\n \r\n {{experience.description}}\r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n \r\n Descripción extendida\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n Qué incluye\r\n \r\n
\r\n \r\n {{includes}}\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n Excluído\r\n \r\n
\r\n \r\n {{notIncludes}}\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n ¿Qué debes llevar?\r\n \r\n
\r\n \r\n {{carryInfo}}\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n ¿Qué debes saber?\r\n \r\n
\r\n \r\n {{moreInfo}}\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n Política de cancelaciones y cambios\r\n \r\n \r\n {{experience.cancellation}}\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n Modalidad {{i+1}} \r\n
\r\n
\r\n
\r\n
\r\n ID Venntur \r\n {{ experience.id ? experience.id : 'No disponible' }} \r\n
\r\n
\r\n ID Channel Manager \r\n {{ experience.modalities[currentModality].bookingEngineId ? experience.modalities[currentModality].bookingEngineId : 'No disponible' }} \r\n
\r\n
\r\n Título modalidad {{currentModality+1}} \r\n {{experience.modalities[currentModality].title}} \r\n
\r\n
\r\n Descripción modalidad {{currentModality+1}} \r\n {{experience.modalities[currentModality].description}} \r\n
\r\n
\r\n BE option ID \r\n {{experience.modalities[currentModality].bookingEngineId}} \r\n
\r\n
\r\n Duración \r\n {{experience.modalities[currentModality].duration}} \r\n
\r\n
\r\n Hora de inicio \r\n {{experience.modalities[currentModality].start}} \r\n
\r\n
\r\n Hora de finalización \r\n {{experience.modalities[currentModality].end}} \r\n
\r\n
\r\n Punto de encuentro \r\n {{experience.modalities[currentModality].meetingPoint}} \r\n
\r\n
\r\n Servicio de recogida \r\n {{experience.modalities[currentModality].pickup == true ? 'Si' : 'No'}} \r\n
\r\n
\r\n Ubicación \r\n {{experience.modalities[currentModality].location}} \r\n
\r\n\r\n \r\n
0\">\r\n
Precios \r\n
\r\n
\r\n \r\n {{price.name}}: \r\n \r\n {{price.price}}€ \r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
","import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\n// import { FacebookLoginProvider, GoogleLoginProvider, SocialAuthService, SocialUser } from 'angularx-social-login';\r\nimport { User } from '../../../shared/users/user.model';\r\nimport { UsersService } from '../../../shared/users/users.service';\r\nimport { AuthService } from '../../shared/auth.service';\r\nimport { errorMessages, regExps } from '../../shared/custom-validators';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { environment } from '../../../../environments/environment';\r\nimport { MakerService } from '../../shared/maker.service';\r\n\r\nconst FRONT_URL = environment.frontUrl;\r\n\r\n@Component({\r\n selector: 'app-register-maker',\r\n templateUrl: './register-maker.component.html',\r\n})\r\nexport class RegisterMakerComponent implements OnInit {\r\n userForm: UntypedFormGroup;\r\n user: User;\r\n alert = { message: null, type: null };\r\n errors = errorMessages;\r\n plan: string;\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private authService: AuthService,\r\n // private socialAuthService: SocialAuthService,\r\n private userService: UsersService,\r\n private makerService: MakerService,\r\n public translate: TranslateService\r\n ) {\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n this.activatedRoute.params.subscribe(params => {\r\n this.plan = params['plan'];\r\n });\r\n\r\n this.initializeGoogleSignIn();\r\n }\r\n\r\n initializeGoogleSignIn() {\r\n // Aquí reemplaza 'TU_CLIENT_ID' con tu Client ID de Google\r\n google.accounts.id.initialize({\r\n client_id: '306399346139-snsajbsqgf2dc48eeptm1ir0v94k00hi.apps.googleusercontent.com',\r\n callback: this.handleCredentialResponse.bind(this)\r\n });\r\n\r\n // Renderiza el botón de Google Sign-In\r\n google.accounts.id.renderButton(\r\n document.getElementById('registerGoogle'),\r\n { theme: 'outline', size: 'large', text: 'signup_with' } // puedes personalizar el botón aquí\r\n );\r\n }\r\n\r\n handleCredentialResponse(response: any) {\r\n // console.log(\"Token de ID de Google: \", response.credential);\r\n // Envía el token a tu backend o realiza la lógica de autenticación aquí\r\n\r\n this.authService.loginByGoogle(response.credential, 'ROLE_MAKER')\r\n .then(\r\n (response) => {\r\n // console.log('Respuesta después token: ' + response);\r\n // window.location.reload();\r\n /* setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n if (this.authService.hasMakerRole()) {\r\n window.location.replace(FRONT_URL + this.translate.getDefaultLang() + '/maker/admin/perfil/');\r\n } else if (this.authService.hasTakerRole()) {\r\n window.location.replace(FRONT_URL + this.translate.getDefaultLang() + '/taker/admin/perfil/');\r\n } else if (this.authService.hasResellerRole()) {\r\n window.location.replace(FRONT_URL + this.translate.getDefaultLang() + '/reseller/admin/perfil/');\r\n }\r\n }, 1000); */\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/maker/admin/perfil/');\r\n },\r\n (error) => {\r\n this.alert.type = 2;\r\n this.alert.message = 'Ocurrió un error al intentar hacer login con Google, por favor vuelve a intentarlo';\r\n });\r\n\r\n }\r\n\r\n createForm() {\r\n this.userForm = this.formBuilder.group({\r\n email: ['', [\r\n Validators.required,\r\n Validators.email\r\n ]],\r\n password: ['', [\r\n Validators.required,\r\n Validators.pattern(regExps.password)\r\n ]\r\n ],\r\n role: ['ROLE_MAKER', Validators.required]\r\n });\r\n }\r\n\r\n createUser() {\r\n if (this.userForm.invalid) {\r\n this.showErrors(this.userForm);\r\n return;\r\n }\r\n const user = {\r\n email: this.userForm.get('email').value,\r\n password: this.userForm.get('password').value,\r\n roles: this.userForm.get('role').value\r\n };\r\n this.userService.postUser(user).subscribe((result) => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Usuario creado correctamente';\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n this.authService.login(user.email, user.password)\r\n .then(() => {\r\n if (user.roles.includes('ROLE_MAKER')) {\r\n this.createMakerPlan(result.user, user.password);\r\n }\r\n // } else if (user.roles.includes('ROLE_TAKER')) {\r\n // this.router.navigateByUrl(this.translate.getDefaultLang() + '/taker/admin/perfil');\r\n // }\r\n })\r\n .catch();\r\n }, 1000);\r\n this.createForm();\r\n }, (error) => {\r\n this.alert.message = error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n });\r\n }\r\n\r\n /* signInWithFB(): void {\r\n this.socialAuthService.signIn(FacebookLoginProvider.PROVIDER_ID).then((user: SocialUser) => {\r\n this.authService.loginByFacebook(user, 'ROLE_MAKER')\r\n .then(\r\n (response) => {\r\n // this.alert.type = 1;\r\n // this.alert.message = `Ya casi hemos acabado... Te hemos enviado un correo al email con el que te has registrado.\r\n // Por favor, ve a tu bandeja de entrada y confirma el registro.`;\r\n // setTimeout(() => {\r\n // this.alert = {message: null, type: null};\r\n // }, 5000);\r\n // this.createMakerPlan(user.email);\r\n },\r\n (error) => {\r\n this.alert.type = 2;\r\n this.alert.message = 'Ocurrió un error al intentar registrarte con Facebook, por favor vuelve a intentarlo';\r\n });\r\n });\r\n }\r\n\r\n signInWithGoogle(): void {\r\n this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID).then((user: SocialUser) => {\r\n this.authService.loginByGoogle(user.idToken, 'ROLE_MAKER')\r\n .then(\r\n (response) => {\r\n // this.alert.type = 1;\r\n // this.alert.message = `Ya casi hemos acabado... Te hemos enviado un correo al email con el que te has registrado.\r\n // Por favor, ve a tu bandeja de entrada y confirma el registro.`;\r\n // setTimeout(() => {\r\n // this.alert = {message: null, type: null};\r\n // }, 5000);\r\n // this.createMakerPlan(user);\r\n },\r\n (error) => {\r\n this.alert.type = 2;\r\n this.alert.message = 'Ocurrió un error al intentar registrarte con Google, por favor vuelve a intentarlo';\r\n });\r\n });\r\n } */\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n showError(formValue) {\r\n return this.userForm.get(formValue).invalid && this.userForm.get(formValue).touched;\r\n }\r\n\r\n createMakerPlan(user, password) {\r\n console.log(user);\r\n let maker: any = {\r\n \"email\": user.email,\r\n \"name\": user.email,\r\n \"user\": '/users/' + user.id,\r\n \"slug\": user.email\r\n }\r\n this.makerService.postMaker(maker).subscribe((makerResult) => {\r\n let makerPlan = {\r\n \"price\": '0',\r\n \"startDate\": new Date(),\r\n \"maker\": \"/makers/\" + makerResult.id,\r\n \"plan\": \"/plans/df432580-3b93-11eb-80af-509a4c653a6c\",\r\n \"stripeCustomerId\": \"GRATUITO\"\r\n }\r\n maker.plan = \"START\";\r\n maker.creation = (new Date()).toLocaleDateString('en-GB');\r\n this.makerService.postFreeMakerPlan(makerPlan).subscribe((result) => {\r\n let directoryAnalytics = {\r\n maker: \"/makers/\" + makerResult.id\r\n }\r\n this.makerService.sendFreeMakerPlanEmail({'email': makerResult.email, 'name': makerResult.name}).subscribe((result) => {\r\n this.makerService.postDirectoryAnalytics(directoryAnalytics).subscribe((result) => {\r\n this.makerService.postMakerContact(maker).subscribe((result) => {\r\n this.authService.login(user.email, password)\r\n .then(() => {\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/maker/admin/perfil/');\r\n // } else if (user.roles.includes('ROLE_TAKER')) {\r\n // this.router.navigateByUrl(this.translate.getDefaultLang() + '/taker/admin/perfil');\r\n // }\r\n })\r\n })\r\n })\r\n });\r\n })\r\n })\r\n // if (this.plan === 'gratuito') {\r\n // this.makerService.postFreeMakerPlan({price: 0, email: makerEmail});\r\n // this.router.navigateByUrl(this.translate.getDefaultLang() + '/maker/admin/perfil');\r\n // } else {\r\n // let planPrice = null;\r\n // if (this.plan === 'basico') {\r\n // planPrice = 'price_1HtuT8DQOX9k1ARpo2xGkQpJ';\r\n // } else if (this.plan === 'pro') {\r\n // planPrice = '';\r\n // }\r\n // // @ts-ignore\r\n // const stripe = Stripe('pk_test_my9mJE7a5hoQWNV7HSnFvCY0');\r\n // stripe.redirectToCheckout({\r\n // lineItems: [{price: planPrice, quantity: 1}],\r\n // mode: 'subscription',\r\n // successUrl: `${FRONT_URL}${this.translate.getDefaultLang()}/maker/admin/perfil`,\r\n // cancelUrl: `${FRONT_URL}${this.translate.getDefaultLang()}`,\r\n // })\r\n // // tslint:disable-next-line:only-arrow-functions no-shadowed-variable\r\n // .then(function(result) {\r\n // if (result.error) {\r\n // const displayError = document.getElementById('error-message');\r\n // displayError.textContent = result.error.message;\r\n // }\r\n // });\r\n // }\r\n }\r\n}\r\n","\r\n
\r\n
{{ 'Únete al club de makers más rentable' | translate}} \r\n \r\n\r\n \r\n
\r\n\r\n \r\n \r\n
\r\n o \r\n
\r\n \r\n
\r\n \r\n \r\n \r\n {{translate.instant(errors['email'])}}\r\n \r\n
\r\n \r\n \r\n \r\n {{translate.instant(errors['password'])}}\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n {{ '¿Quieres recibir información útil?' | translate}} \r\n \r\n
\r\n {{ 'Al Hacer clic en “Crear cuenta” aceptas nuestras' | translate}} {{ 'Condiciones de uso' | translate}} ,\r\n {{ 'Política de privacidad' | translate}} {{ 'y la' | translate}} {{ 'Política de cookies' | translate}} .\r\n
\r\n {{ 'Crear cuenta' |\r\n translate}} \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n
\r\n
{{alert.message}}\r\n
\r\n
\r\n
","import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { FacebookLoginProvider, GoogleLoginProvider, SocialAuthService, SocialUser } from 'angularx-social-login';\r\nimport { User } from '../../../shared/users/user.model';\r\nimport { UsersService } from '../../../shared/users/users.service';\r\nimport { AuthService } from '../../shared/auth.service';\r\nimport { errorMessages, regExps } from '../../shared/custom-validators';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { environment } from '../../../../environments/environment';\r\nimport { ResellerService } from '../../shared/reseller.service';\r\n\r\nconst FRONT_URL = environment.frontUrl;\r\n\r\n@Component({\r\n selector: 'app-register-reseller',\r\n templateUrl: './register-reseller.component.html',\r\n})\r\nexport class RegisterResellerComponent implements OnInit {\r\n userForm: UntypedFormGroup;\r\n user: User;\r\n alert = {message: null, type: null};\r\n errors = errorMessages;\r\n plan: string;\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private authService: AuthService,\r\n private socialAuthService: SocialAuthService,\r\n private userService: UsersService,\r\n private resellerService: ResellerService,\r\n public translate: TranslateService\r\n ) {\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n createForm() {\r\n this.userForm = this.formBuilder.group({\r\n email: [ '', [\r\n Validators.required,\r\n Validators.email\r\n ]],\r\n password: [ '', [\r\n Validators.required,\r\n Validators.pattern(regExps.password)\r\n ]\r\n ],\r\n role: ['ROLE_RESELLER', Validators.required]\r\n });\r\n }\r\n\r\n createUser() {\r\n if (this.userForm.invalid) {\r\n this.showErrors(this.userForm);\r\n return;\r\n }\r\n const user = {\r\n email: this.userForm.get('email').value,\r\n password: this.userForm.get('password').value,\r\n roles: this.userForm.get('role').value\r\n };\r\n this.userService.postUser(user).subscribe((result) => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Usuario creado correctamente';\r\n setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n this.authService.login(user.email, user.password)\r\n .then(() => {\r\n if (user.roles.includes('ROLE_RESELLER')) {\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/reseller/admin/perfil');\r\n }\r\n // } else if (user.roles.includes('ROLE_TAKER')) {\r\n // this.router.navigateByUrl(this.translate.getDefaultLang() + '/taker/admin/perfil');\r\n // }\r\n })\r\n .catch();\r\n }, 1000);\r\n this.createForm();\r\n }, (error) => {\r\n this.alert.message = error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {this.alert = {message: null, type: null};\r\n }, 5000);\r\n });\r\n }\r\n\r\n signInWithFB(): void {\r\n this.socialAuthService.signIn(FacebookLoginProvider.PROVIDER_ID).then((user: SocialUser) => {\r\n this.authService.loginByFacebook(user, 'ROLE_RESELLER')\r\n .then(\r\n (response) => {\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/reseller/admin/perfil');\r\n },\r\n (error) => {\r\n this.alert.type = 2;\r\n this.alert.message = 'Ocurrió un error al intentar registrarte con Facebook, por favor vuelve a intentarlo';\r\n });\r\n });\r\n }\r\n\r\n signInWithGoogle(): void {\r\n this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID).then((user: SocialUser) => {\r\n this.authService.loginByGoogle(user.idToken, 'ROLE_RESELLER')\r\n .then(\r\n (response) => {\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/reseller/admin/perfil');\r\n },\r\n (error) => {\r\n this.alert.type = 2;\r\n this.alert.message = 'Ocurrió un error al intentar registrarte con Google, por favor vuelve a intentarlo';\r\n });\r\n });\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n showError(formValue) {\r\n return this.userForm.get(formValue).invalid && this.userForm.get(formValue).touched;\r\n }\r\n}\r\n","\r\n
\r\n
{{ 'Regístrate' | translate}} \r\n
{{ 'Regístrate ya y crea tu propio panel de venta y contratación' | translate}}
\r\n
\r\n
\r\n
{{ 'Regístrate con Facebook' | translate}}\r\n
{{ 'Regístrate con Google' | translate}}\r\n
\r\n o \r\n
\r\n \r\n
\r\n \r\n \r\n \r\n {{translate.instant(errors['email'])}}\r\n \r\n
\r\n \r\n \r\n \r\n {{translate.instant(errors['password'])}}\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n {{ '¿Quieres recibir información útil?' | translate}} \r\n \r\n
\r\n {{ 'Al Hacer clic en “Crear cuenta” aceptas nuestras' | translate}} {{ 'Condiciones de uso' | translate}} ,\r\n {{ 'Política de privacidad' | translate}} {{ 'y la' | translate}} {{ 'Política de cookies' | translate}} .\r\n
\r\n {{ 'Crear cuenta' |\r\n translate}} \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n
\r\n
{{alert.message}}\r\n
\r\n
\r\n
","import { Component, OnInit } from '@angular/core';\r\nimport { errorMessages, regExps } from '../shared/custom-validators';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { User } from '../../shared/users/user.model';\r\nimport { UsersService } from '../../shared/users/users.service';\r\nimport { AuthService } from '../shared/auth.service';\r\nimport { FacebookLoginProvider, GoogleLoginProvider, SocialAuthService, SocialUser } from 'angularx-social-login';\r\nimport {TranslateService} from '@ngx-translate/core';\r\n\r\n@Component({\r\n selector: 'app-register',\r\n templateUrl: './register.component.html',\r\n})\r\nexport class RegisterComponent implements OnInit {\r\n userForm: UntypedFormGroup;\r\n user: User;\r\n alert = {message: null, type: null};\r\n errors = errorMessages;\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private authService: AuthService,\r\n private socialAuthService: SocialAuthService,\r\n private userService: UsersService,\r\n public translate: TranslateService\r\n ) {\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n createForm() {\r\n this.userForm = this.formBuilder.group({\r\n email: [ '', [\r\n Validators.required,\r\n Validators.email\r\n ]],\r\n password: [ '', [\r\n Validators.required,\r\n Validators.pattern(regExps.password)\r\n ]\r\n ],\r\n role: ['ROLE_TAKER', Validators.required]\r\n });\r\n }\r\n\r\n createUser() {\r\n if (this.userForm.invalid) {\r\n this.showErrors(this.userForm);\r\n return;\r\n }\r\n const user = {\r\n email: this.userForm.get('email').value,\r\n password: this.userForm.get('password').value,\r\n roles: this.userForm.get('role').value\r\n };\r\n this.userService.postUser(user).subscribe((result) => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Usuario creado correctamente';\r\n setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n }, 5000);\r\n this.createForm();\r\n this.authService.login(user.email, user.password)\r\n .then(() => {\r\n if (user.roles.includes('ROLE_MAKER')) {\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/maker/admin/perfil');\r\n } else if (user.roles.includes('ROLE_TAKER')) {\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/taker/admin/perfil');\r\n }\r\n })\r\n .catch();\r\n }, (error) => {\r\n this.alert.message = error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {this.alert = {message: null, type: null};\r\n }, 5000);\r\n });\r\n }\r\n\r\n signInWithFB(): void {\r\n this.socialAuthService.signIn(FacebookLoginProvider.PROVIDER_ID).then((user: SocialUser) => {\r\n this.authService.loginByFacebook(user, 'ROLE_TAKER')\r\n .then(\r\n (response) => {\r\n // this.alert.type = 1;\r\n // this.alert.message = `Ya casi hemos acabado... Te hemos enviado un correo al email con el que te has registrado.\r\n // Por favor, ve a tu bandeja de entrada y confirma el registro.`;\r\n // setTimeout(() => {\r\n // this.alert = {message: null, type: null};\r\n // }, 5000);\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/taker/admin/perfil');\r\n },\r\n (error) => {\r\n this.alert.type = 2;\r\n this.alert.message = 'Ocurrió un error al intentar registrarte con Facebook, por favor vuelve a intentarlo';\r\n });\r\n });\r\n }\r\n\r\n signInWithGoogle(): void {\r\n this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID).then((user: SocialUser) => {\r\n this.authService.loginByGoogle(user.idToken, 'ROLE_TAKER')\r\n .then(\r\n (response) => {\r\n // this.alert.type = 1;\r\n // this.alert.message = `Ya casi hemos acabado... Te hemos enviado un correo al email con el que te has registrado.\r\n // Por favor, ve a tu bandeja de entrada y confirma el registro.`;\r\n // setTimeout(() => {\r\n // this.alert = {message: null, type: null};\r\n // }, 5000);\r\n this.router.navigateByUrl(this.translate.getDefaultLang() + '/taker/admin/perfil');\r\n },\r\n (error) => {\r\n this.alert.type = 2;\r\n this.alert.message = 'Ocurrió un error al intentar registrarte con Google, por favor vuelve a intentarlo';\r\n });\r\n });\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n showError(formValue) {\r\n return this.userForm.get(formValue).invalid && this.userForm.get(formValue).touched;\r\n }\r\n}\r\n","\r\n
\r\n
{{ 'Regístrate' | translate}} \r\n
{{ 'Regístrate ya y forma parte de nuestra comunidad' | translate}}
\r\n
\r\n
\r\n
{{ 'Regístrate con Facebook' | translate}}\r\n
{{ 'Regístrate con Google' | translate}}\r\n
\r\n {{ 'o' | translate}} \r\n
\r\n \r\n
\r\n \r\n \r\n \r\n {{translate.instant(errors['email'])}}\r\n \r\n
\r\n \r\n \r\n \r\n {{translate.instant(errors['password'])}}\r\n \r\n
\r\n \r\n \r\n \r\n \r\n {{ '¿Quieres recibir nuestra Newsletter?' | translate}} \r\n \r\n
\r\n {{ 'Al Hacer clic en “Crear cuenta” aceptas nuestras' | translate}} {{ 'Condiciones de uso' | translate}} ,\r\n {{ 'Política de privacidad' | translate}} {{ 'Crear cuenta' | translate}} y la {{ 'Política de cookies' | translate}} .\r\n
\r\n {{ 'Crear cuenta' |\r\n translate}} \r\n \r\n
\r\n
{{alert.message}}\r\n
\r\n
\r\n
","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-reseller-admin',\r\n templateUrl: './reseller-admin.component.html',\r\n styleUrls: ['./reseller-admin.component.css']\r\n})\r\nexport class ResellerAdminComponent {}\r\n","\r\n\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\n\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { ResellerService } from '../../../shared/reseller.service';\r\nimport { ConfirmationDialogComponent } from '../../../shared/confirmation-dialog/confirmation-dialog.component';\r\nimport { maxTableRows } from 'globals';\r\n\r\n@Component({\r\n selector: 'app-reseller-contacts-list',\r\n styleUrls: ['./reseller-contacts-list.component.scss'],\r\n templateUrl: './reseller-contacts-list.component.html',\r\n\r\n})\r\nexport class ResellerContactsListComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n columns = [];\r\n rows = [];\r\n searchForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private resellerService: ResellerService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n public dialog: BsModalService,\r\n public translate: TranslateService\r\n ) {\r\n this.resellerService.getContactsByResellerId(resellerService.getId()).subscribe((contacts => {\r\n this.rows = contacts[ 'hydra:member' ];\r\n }));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n position: [''],\r\n email: [''],\r\n phone: [''],\r\n id: ['']\r\n });\r\n this.columns = [\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'position', name: 'Cargo' },\r\n { prop: 'email', name: 'Email' },\r\n { prop: 'phone', name: 'Teléfono' }];\r\n }\r\n\r\n applyFilter() {\r\n this.resellerService.getContactsByResellerId(this.resellerService.getId()).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n }\r\n );\r\n }\r\n\r\n deleteContact(contactId) {\r\n this.dialogRef = this.dialog.show(ConfirmationDialogComponent, {\r\n initialState: {\r\n confirmMessage: '¿Seguro que quieres eliminar este contacto?',\r\n callback: (confirm) => {\r\n if (confirm) {\r\n this.resellerService.deleteContact(contactId).subscribe(\r\n (result) => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Contacto eliminado correctamente';\r\n setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n }, 5000);\r\n },\r\n error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {this.alert = {message: null, type: null};\r\n }, 5000);\r\n },\r\n );\r\n setTimeout(() => {\r\n this.resellerService.getContactsByResellerId(this.resellerService.getId()).subscribe((contacts => {\r\n this.rows = contacts[ 'hydra:member' ];\r\n this.table.offset = 0;\r\n }));\r\n }, 1000);\r\n }\r\n this.dialogRef = null;\r\n }\r\n }\r\n });\r\n }\r\n\r\n}\r\n","\r\n\r\n
{{alert.message}}
\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n
\r\n\r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { Title } from '@angular/platform-browser';\r\n\r\nimport { TranslateService } from '@ngx-translate/core';\r\n\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { errorMessages, regExps } from '../../../shared/custom-validators';\r\nimport { ResellerService } from '../../../shared/reseller.service';\r\nimport { MediaResellerService } from '../../reseller-profile/media-reseller';\r\nimport { environment } from '../../../../../environments/environment';\r\n\r\nconst FRONT_URL = environment.frontUrl;\r\n\r\n@Component({\r\n selector: 'app-reseller-contacts',\r\n templateUrl: './reseller-contacts.component.html',\r\n styleUrls: ['./reseller-contacts.component.css']\r\n})\r\nexport class ResellerContactsComponent implements OnInit {\r\n contactForm: UntypedFormGroup;\r\n contactImage = null;\r\n selectedFile: File;\r\n selectedFiles = [];\r\n uploadedFiles = [];\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n uploadProgress = 0;\r\n alert = { message: null, type: null };\r\n errors = errorMessages;\r\n reseller = null;\r\n contact = null;\r\n title = 'Nuevo contacto';\r\n\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private titleService: Title,\r\n private mediaResellerService: MediaResellerService,\r\n private resellerService: ResellerService,\r\n public translate: TranslateService,\r\n public dialog: BsModalService\r\n ) {\r\n if (this.resellerService.getId()) {\r\n this.reseller = '/resellers/' + this.resellerService.getId();\r\n this.createForm();\r\n } else {\r\n this.router.navigateByUrl('/reseller/admin/perfil');\r\n }\r\n }\r\n\r\n ngOnInit(): void {\r\n if (this.activatedRoute.snapshot.params.id) {\r\n this.title = 'Editar contacto';\r\n setTimeout(() => {\r\n this.editContact(this.activatedRoute.snapshot.params.id);\r\n }, 1000);\r\n }\r\n }\r\n\r\n createForm() {\r\n this.contactForm = this.formBuilder.group({\r\n mediaContacts: ['',\r\n Validators.required\r\n ],\r\n name: ['',\r\n Validators.required\r\n ],\r\n position: ['',\r\n Validators.required\r\n ],\r\n email: ['', [\r\n Validators.required,\r\n Validators.email\r\n ]\r\n ],\r\n phone: ['', [\r\n Validators.required,\r\n Validators.pattern(regExps.phone)\r\n ]\r\n ],\r\n reseller: [this.reseller]\r\n });\r\n }\r\n\r\n editContact(contactId) {\r\n this.resellerService.getContact(contactId, this.translate.getDefaultLang()).subscribe((contact: any) => {\r\n this.contact = contact;\r\n this.contactForm.get('name').setValue(contact.name);\r\n this.contactForm.get('position').setValue(contact.position);\r\n this.contactForm.get('email').setValue(contact.email);\r\n this.contactForm.get('phone').setValue(contact.phone);\r\n if (contact.mediaContacts.length > 0) {\r\n this.contactForm.get('mediaContacts').setValue([contact.mediaContacts[0]['@id']]);\r\n this.contactImage = '/assets/makerContact/files/' + contact.mediaContacts[0]['contentUrl'];\r\n }\r\n });\r\n }\r\n\r\n updateContact() {\r\n if (this.contactForm.invalid) {\r\n this.showErrors(this.contactForm);\r\n return;\r\n }\r\n const editedContact = {\r\n name: this.contactForm.get('name').value,\r\n position: this.contactForm.get('position').value,\r\n email: this.contactForm.get('email').value,\r\n phone: this.contactForm.get('phone').value,\r\n mediaContacts: this.contactForm.get('mediaContacts').value,\r\n reseller: this.contactForm.get('reseller').value,\r\n };\r\n this.resellerService.putContact(this.contact.id, editedContact, this.translate.getDefaultLang())\r\n .subscribe(\r\n (result) => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Contacto guardado correctamente';\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n this.contact = null;\r\n this.createForm();\r\n location.replace(this.translate.getDefaultLang() + '/reseller/admin/contactos');\r\n },\r\n error => {\r\n this.alert.message = error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n },\r\n () => console.log('complete'));\r\n }\r\n\r\n createContact() {\r\n if (this.contactForm.invalid) {\r\n this.showErrors(this.contactForm);\r\n return;\r\n }\r\n const contact = {\r\n mediaContacts: this.contactForm.get('mediaContacts').value,\r\n name: this.contactForm.get('name').value,\r\n position: this.contactForm.get('position').value,\r\n email: this.contactForm.get('email').value,\r\n phone: this.contactForm.get('phone').value,\r\n reseller: this.contactForm.get('reseller').value\r\n };\r\n this.resellerService.postContact(contact).subscribe(() => {\r\n this.alert.type = 1;\r\n this.alert.message = this.translate.instant('Contacto creado correctamente');\r\n setTimeout(() => {\r\n location.replace(this.translate.getDefaultLang() + '/reseller/admin/contactos');\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n }, (error) => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {\r\n this.alert = { message: null, type: null };\r\n }, 5000);\r\n });\r\n }\r\n\r\n onFileChanged(event) {\r\n if (event.target.files[0].type === 'image/jpeg' || event.target.files[0].type === 'image/png') {\r\n this.selectedFile = event.target.files[0];\r\n }\r\n }\r\n\r\n onUploadedImage(uploadedImage: object, formControlName: string) {\r\n if (formControlName === 'mediaContacts') {\r\n this.contactForm.get(formControlName).patchValue([uploadedImage['id']]);\r\n this.contactImage = FRONT_URL + uploadedImage['url'];\r\n }\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n showError(formValue) {\r\n return this.contactForm.get(formValue).invalid && this.contactForm.get(formValue).touched;\r\n }\r\n\r\n changeLanguage(language) {\r\n this.translate.setDefaultLang(language);\r\n setTimeout(() => {\r\n this.editContact(this.activatedRoute.snapshot.params.id);\r\n }, 100);\r\n }\r\n\r\n}\r\n"," {{translate.instant(title)}} \r\n\r\n \r\n Español \r\n \r\n\r\n\r\n\r\n \r\n\r\n
\r\n
\r\n \r\n
\r\n
{{ 'Subir avatar contacto' | translate}} * \r\n
{{ 'Selecciona un avatar de contacto. Formatos aceptados: .jpeg, .jpg, .png' | translate}} \r\n
{{ 'Dimensiones recomendadas:' | translate}} 150x150 \r\n
\r\n
\r\n {{translate.instant(errors['mediaContacts'])}}\r\n \r\n
\r\n
\r\n \r\n
Avatar {{ 'subido' | translate }}:
\r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n \r\n {{ 'Guardar contacto' | translate}}\r\n \r\n \r\n {{ 'Crear nuevo contacto' | translate}}\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n\r\n
{{alert.message}}
\r\n
\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { CountryService } from '../../../shared/locations/country.service';\r\nimport { maxTableRows } from 'globals';\r\n\r\n\r\n@Component({\r\n selector: 'app-reseller-countries-list',\r\n templateUrl: './reseller-countries-list.component.html',\r\n styleUrls: ['./reseller-countries-list.component.css']\r\n})\r\nexport class ResellerCountriesListComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n columns = [\r\n { prop: 'text', name: 'Nombre' }];\r\n rows = [];\r\n searchForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private countriesService: CountryService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n public dialog: BsModalService,\r\n ) {\r\n this.countriesService.getCountries().subscribe((countries => {\r\n this.rows = countries[ 'hydra:member' ];\r\n }));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n });\r\n }\r\n\r\n applyFilter() {\r\n this.countriesService.getCountries().subscribe(\r\n data => {\r\n this.rows = data;\r\n this.table.offset = 0;\r\n }\r\n );\r\n }\r\n}\r\n","\r\n\r\n
{{alert.message}}
\r\n
\r\n\r\n
\r\n
Buscar por: \r\n
\r\n \r\n \r\n
\r\n
\r\n\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { ResellerService } from '../../shared/reseller.service';\r\nimport { CategoriesService } from '../../../shared/categories/categories.service';\r\nimport { Location } from '../../../shared/locations/location.model';\r\nimport { LocationService } from '../../../shared/locations/location.service';\r\nimport { Router } from '@angular/router';\r\nimport { Tag } from '../../../shared/tags/tag.model';\r\nimport {TagsService} from '../../../shared/tags/tags.service';\r\nimport { maxTableRows } from 'globals';\r\n\r\n@Component({\r\n selector: 'app-reseller-experiences-list',\r\n styleUrls: ['./reseller-experiences-list.component.scss'],\r\n templateUrl: './reseller-experiences-list.component.html',\r\n\r\n})\r\nexport class ResellerExperiencesListComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n columns = [];\r\n rows = [];\r\n resellerId;\r\n resellerExperiences = [];\r\n statusArray = ['Pendiente contacto', 'Contactado', 'Contratado', 'Terminado'];\r\n isFavorites = true;\r\n tags: Tag[] = [];\r\n tagsSelected = [];\r\n locations: Location[] = [];\r\n locationsSelected = [];\r\n searchForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private experienceService: ExperiencesService,\r\n private resellerService: ResellerService,\r\n private router: Router,\r\n private tagsService: TagsService,\r\n private locationsService: LocationService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n public dialog: BsModalService,\r\n ) {\r\n this.tagsService.getActiveTags('es').subscribe(tags => {\r\n this.tags = tags['hydra:member'];\r\n });\r\n this.locationsService.getActiveLocations().subscribe(locations => {\r\n this.locations = locations['hydra:member'];\r\n }\r\n );\r\n this.resellerId = this.resellerService.getId();\r\n if (!this.router['rawUrlTree'].queryParams['maker']) {\r\n this.experienceService.getExperiencesByResellerId(this.resellerId, {}).subscribe(experiences => {\r\n this.resellerExperiences = experiences[ 'hydra:member' ];\r\n });\r\n }\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n maker: [''],\r\n locations: [''],\r\n tags: [''],\r\n isFavorites: [true],\r\n resellerId: [this.resellerId],\r\n id: ['']\r\n });\r\n if (this.router['rawUrlTree'].queryParams['maker']) {\r\n this.searchForm.get('maker').setValue(this.router['rawUrlTree'].queryParams['maker']);\r\n this.searchForm.get('isFavorites').setValue(false);\r\n this.isFavorites = false;\r\n }\r\n this.columns = [\r\n { prop: 'experience.id', name: 'ID' },\r\n { prop: 'experience.name', name: 'Nombre' },\r\n { prop: 'experience.location.name', name: 'Ubicación' },\r\n { prop: 'experience.maker.name', name: 'Maker' }];\r\n\r\n this.applyFilter();\r\n }\r\n\r\n applyFilter() {\r\n if (!this.searchForm.value.isFavorites) {\r\n this.experienceService.getExperiences(this.searchForm.value, 'es').subscribe(\r\n data => {\r\n this.experienceService.getExperiencesByResellerId(this.resellerId, {}).subscribe(experiences => {\r\n this.resellerExperiences = Array.from(experiences['hydra:member']).map((item) => item['experience']['@id']);\r\n });\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n this.isFavorites = false;\r\n this.columns = [\r\n { prop: 'id', name: 'ID' },\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'location.name', name: 'Ubicación' },\r\n { prop: 'maker.name', name: 'Maker' }];\r\n }\r\n );\r\n } else {\r\n this.experienceService.getExperiencesByResellerId(this.resellerId, this.searchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n this.isFavorites = true;\r\n this.columns = [\r\n { prop: 'experience.id', name: 'ID' },\r\n { prop: 'experience.name', name: 'Nombre' },\r\n { prop: 'experience.location.name', name: 'Ubicación' },\r\n { prop: 'experience.maker.name', name: 'Maker' }];\r\n }\r\n );\r\n }\r\n }\r\n\r\n addFavorite(event, experienceId) {\r\n this.resellerExperiences.includes(experienceId) ?\r\n this.resellerExperiences.splice(this.resellerExperiences.indexOf(experienceId), 1) : this.resellerExperiences.push(experienceId);\r\n const favoriteExperience = {\r\n reseller: '/resellers/' + this.resellerId,\r\n experience: experienceId,\r\n status: 'Pendiente contacto'\r\n };\r\n this.resellerService.postFavoriteExperience(favoriteExperience).subscribe();\r\n }\r\n\r\n removeFavorite(favoriteExperienceId) {\r\n this.resellerService.deleteFavoriteExperience(favoriteExperienceId).subscribe( () => {\r\n this.applyFilter();\r\n }\r\n );\r\n }\r\n\r\n changeStatus(status, favoriteExperienceId) {\r\n this.resellerService.putFavoriteExperience(favoriteExperienceId, {status: status}).subscribe();\r\n }\r\n}\r\n","\r\n
Productos \r\n\r\n\r\n
{{alert.message}}
\r\n
\r\n\r\n
\r\n
Buscar por: \r\n
\r\n \r\n \r\n
\r\n
\r\n\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { LocationService } from '../../../shared/locations/location.service';\r\nimport {Reseller} from '../reseller-profile/reseller.model';\r\nimport {ResellerService} from '../../shared/reseller.service';\r\nimport { maxTableRows } from 'globals';\r\n\r\n\r\n@Component({\r\n selector: 'app-reseller-locations-list',\r\n templateUrl: './reseller-locations-list.component.html',\r\n styleUrls: ['./reseller-locations-list.component.css']\r\n})\r\nexport class ResellerLocationsListComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n columns = [\r\n { prop: 'name', name: 'Nombre' }];\r\n rows = [];\r\n resellerLocations = [];\r\n resellerId;\r\n searchForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private locationsService: LocationService,\r\n private resellerService: ResellerService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n public dialog: BsModalService,\r\n ) {\r\n this.resellerId = this.resellerService.getId();\r\n // this.locationsService.getLocations().subscribe((locations => {\r\n // this.rows = locations[ 'hydra:member' ];\r\n // }));\r\n this.locationsService.getLocationsByResellerId(this.resellerId).subscribe(experiences => {\r\n this.resellerLocations = Array.from(experiences['hydra:member']).map((item) => item['@id']);\r\n });\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n isFavorites: [true],\r\n resellerId: [this.resellerId]\r\n });\r\n this.applyFilter();\r\n }\r\n\r\n applyFilter() {\r\n this.locationsService.getLocations(this.searchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n }\r\n );\r\n }\r\n\r\n clickFavorite(event, locationId) {\r\n this.resellerLocations.includes(locationId) ?\r\n this.resellerLocations.splice(this.resellerLocations.indexOf(locationId), 1) : this.resellerLocations.push(locationId);\r\n const reseller = {\r\n locations: this.resellerLocations\r\n };\r\n const editedReseller = new Reseller(reseller);\r\n this.resellerService.putReseller(this.resellerService.getId(), editedReseller).subscribe();\r\n }\r\n}\r\n","\r\n
Destinos \r\n\r\n\r\n
{{alert.message}}
\r\n
\r\n\r\n
\r\n
Buscar por: \r\n
\r\n \r\n \r\n
\r\n
\r\n\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { MakerService } from '../../shared/maker.service';\r\nimport {Reseller} from '../reseller-profile/reseller.model';\r\nimport {ResellerService} from '../../shared/reseller.service';\r\nimport {LocationService} from '../../../shared/locations/location.service';\r\nimport {Location} from '../../../shared/locations/location.model';\r\nimport { maxTableRows } from 'globals';\r\n\r\n@Component({\r\n selector: 'app-reseller-makers-list',\r\n templateUrl: './reseller-makers-list.component.html',\r\n styleUrls: ['./reseller-makers-list.component.css']\r\n})\r\nexport class ResellerMakersListComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n columns = [];\r\n rows = [];\r\n resellerMakers = [];\r\n statusArray = ['Pendiente contacto', 'Contactado', 'Contratado', 'Terminado'];\r\n resellerId;\r\n locations: Location[] = [];\r\n locationsSelected = [];\r\n isFavorites = true;\r\n searchForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n private makersService: MakerService,\r\n private resellerService: ResellerService,\r\n private locationsService: LocationService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n public dialog: BsModalService,\r\n ) {\r\n this.locationsService.getActiveLocations().subscribe(locations => {\r\n this.locations = locations['hydra:member'];\r\n }\r\n );\r\n this.resellerId = this.resellerService.getId();\r\n this.makersService.getMakersByResellerId(this.resellerId, {}).subscribe(experiences => {\r\n this.resellerMakers = experiences[ 'hydra:member' ];\r\n });\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n phone: [''],\r\n email: [''],\r\n web: [''],\r\n locations: [''],\r\n isFavorites: [true],\r\n isFavoritesProducts: [false],\r\n resellerId: [this.resellerId]\r\n });\r\n this.columns = [\r\n { prop: 'maker.name', name: 'Nombre' },\r\n { prop: 'maker.phone', name: 'Teléfono' },\r\n { prop: 'maker.email', name: 'Email' },\r\n { prop: 'maker.web', name: 'Página web' }];\r\n\r\n this.applyFilter();\r\n }\r\n\r\n applyFilter() {\r\n if (!this.searchForm.value.isFavorites) {\r\n this.makersService.getMakers(this.searchForm.value).subscribe(\r\n data => {\r\n this.makersService.getMakersByResellerId(this.resellerId, {}).subscribe(makers => {\r\n this.resellerMakers = Array.from(makers['hydra:member']).map((item) => item['maker']['@id']);\r\n });\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n this.isFavorites = false;\r\n this.columns = [\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'phone', name: 'Teléfono' },\r\n { prop: 'email', name: 'Email' },\r\n { prop: 'web', name: 'Página web' }];\r\n }\r\n );\r\n } else {\r\n this.makersService.getMakersByResellerId(this.resellerId, this.searchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n this.isFavorites = true;\r\n this.columns = [\r\n { prop: 'maker.name', name: 'Nombre' },\r\n { prop: 'maker.phone', name: 'Teléfono' },\r\n { prop: 'maker.email', name: 'Email' },\r\n { prop: 'maker.web', name: 'Página web' }];\r\n });\r\n }\r\n }\r\n\r\n addFavorite(event, makerId) {\r\n this.resellerMakers.includes(makerId) ?\r\n this.resellerMakers.splice(this.resellerMakers.indexOf(makerId), 1) : this.resellerMakers.push(makerId);\r\n const favoriteMaker = {\r\n reseller: '/resellers/' + this.resellerId,\r\n maker: makerId,\r\n status: 'Pendiente contacto'\r\n };\r\n this.resellerService.postFavoriteMaker(favoriteMaker).subscribe();\r\n }\r\n\r\n removeFavorite(favoriteMakerId) {\r\n this.resellerService.deleteFavoriteMaker(favoriteMakerId).subscribe(() => {\r\n this.applyFilter();\r\n }\r\n );\r\n }\r\n\r\n changeStatus(status, favoriteMakerId) {\r\n this.resellerService.putFavoriteMaker(favoriteMakerId, {status: status}).subscribe();\r\n }\r\n}\r\n","\r\n
Makers \r\n\r\n\r\n
{{alert.message}}
\r\n
\r\n\r\n
\r\n
Buscar por: \r\n
\r\n \r\n \r\n
\r\n
\r\n\r\n","import { Injectable } from '@angular/core';\r\nimport { HttpClient, HttpRequest } from '@angular/common/http';\r\n\r\nimport { Observable } from 'rxjs';\r\n\r\nimport { environment } from '../../../../environments/environment';\r\n\r\nconst API_URL = environment.apiUrl;\r\n\r\n@Injectable()\r\nexport class MediaResellerService {\r\n constructor(private http: HttpClient) {\r\n }\r\n\r\n mediaResellersUpload(fileItem: File, url, extraData?: object): Observable {\r\n const apiCreateEndpoint = `${API_URL}${url}`;\r\n const formData: FormData = new FormData();\r\n\r\n formData.append('file', fileItem, fileItem.name);\r\n if (extraData) {\r\n for (const key in extraData) {\r\n if (extraData.hasOwnProperty(key)) {\r\n formData.append(key, extraData[ key ]);\r\n }\r\n }\r\n }\r\n const req = new HttpRequest('POST', apiCreateEndpoint, formData, {\r\n reportProgress: true // for progress data\r\n });\r\n return this.http.request(req);\r\n }\r\n\r\n deleteMediaResellers(mediaResellersId) {\r\n return this.http\r\n .delete(`${API_URL}${mediaResellersId}`);\r\n }\r\n\r\n getMediaResellers(mediaResellersId) {\r\n return this.http\r\n .get(`${API_URL}${mediaResellersId}`);\r\n }\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { Title } from '@angular/platform-browser';\r\nimport { Reseller } from './reseller.model';\r\nimport { HttpEventType } from '@angular/common/http';\r\nimport { MediaResellerService } from './media-reseller';\r\nimport { ResellerService } from '../../shared/reseller.service';\r\nimport { CustomValidators, errorMessages, regExps } from '../../shared/custom-validators';\r\nimport { AuthService } from '../../shared/auth.service';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { environment } from '../../../../environments/environment';\r\nimport { Tag } from '../../../shared/tags/tag.model';\r\nimport { TagsService } from '../../../shared/tags/tags.service';\r\nimport { User } from '../../../shared/users/user.model';\r\nimport { UsersService } from '../../../shared/users/users.service';\r\nimport { CountryService } from '../../../shared/locations/country.service';\r\nimport { ReplaySubject } from 'rxjs';\r\nimport { Country } from '../../../shared/locations/country.model';\r\nimport { Category } from '../../../shared/categories/category.model';\r\nimport { CategoriesService } from '../../../shared/categories/categories.service';\r\n\r\nconst FRONT_URL = environment.frontUrl;\r\n\r\n@Component({\r\n selector: 'app-reseller',\r\n templateUrl: './reseller.component.html',\r\n})\r\nexport class ResellerComponent implements OnInit {\r\n resellerForm: UntypedFormGroup;\r\n reseller: Reseller;\r\n title = 'Perfil agencia';\r\n selectedFile: File;\r\n selectedFiles = [];\r\n uploadedFiles = [];\r\n categories: Category[] = [];\r\n categoriesSelected = [];\r\n image = null;\r\n contactImage = null;\r\n images = [];\r\n logoImage = null;\r\n headerImage = null;\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n alert = {message: null, type: null};\r\n errors = errorMessages;\r\n uploadProgress = 0;\r\n resellerId = null;\r\n countries = [];\r\n public filteredCountries: ReplaySubject = new ReplaySubject(1);\r\n countrySelected = null;\r\n countriesSelected = [];\r\n phraseText = '';\r\n phraseMaxChar = 160;\r\n descriptionText = '';\r\n descriptionMaxChar = 160;\r\n tags: Tag[] = [];\r\n tagsSelected = [];\r\n formLanguage = 'es';\r\n\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private authService: AuthService,\r\n private titleService: Title,\r\n private resellerService: ResellerService,\r\n private userService: UsersService,\r\n private categoryService: CategoriesService,\r\n private tagService: TagsService,\r\n private countryService: CountryService,\r\n private mediaResellerService: MediaResellerService,\r\n public translate: TranslateService\r\n ) {\r\n this.countryService.getCountries().subscribe(countries => {\r\n this.countries = countries;\r\n });\r\n this.tagService.getTags('es').subscribe(tags => {\r\n this.tags = tags['hydra:member'];\r\n });\r\n this.categoryService.getCategories(this.translate.getDefaultLang()).subscribe(categories => {\r\n this.categories = categories['hydra:member'];\r\n });\r\n if (this.resellerService.getId()) {\r\n this.title = 'Editar perfil agencia';\r\n this.resellerId = '/resellers/' + this.resellerService.getId();\r\n }\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n if (this.resellerId) {\r\n setTimeout(() => {\r\n this.editReseller(this.resellerId);\r\n }, 1000);\r\n }\r\n }\r\n\r\n createForm() {\r\n this.resellerForm = this.formBuilder.group({\r\n name: [ '',\r\n Validators.required\r\n ],\r\n fiscalName: [ '',\r\n Validators.required\r\n ],\r\n cif: [ '', [\r\n Validators.required,\r\n // CustomValidators.dniOrNieValidator\r\n ]],\r\n address: [ '', [\r\n Validators.required,\r\n ]],\r\n cp: [ '', [\r\n Validators.required,\r\n ]],\r\n country: [ '',\r\n Validators.required\r\n ],\r\n claim: [ '', [\r\n Validators.required,\r\n ]],\r\n whatsapp: [ '' , [\r\n Validators.pattern(regExps.phone)\r\n ]],\r\n instagram: [ ''],\r\n twitter: [ ''],\r\n linkedIn: [ ''],\r\n facebook: [ ''],\r\n observations: [ ''],\r\n urlWeb: [ '', [\r\n Validators.required,\r\n Validators.pattern(regExps.url)\r\n ]\r\n ],\r\n urlWebSupplier: [ '', [\r\n Validators.required,\r\n Validators.pattern(regExps.url)\r\n ]\r\n ],\r\n user: ['/users/' + this.authService.getUserId()],\r\n tripadvisor: [ ''],\r\n mediaResellersLogos: [ [], [\r\n Validators.required,\r\n ]],\r\n // categories: [''],\r\n tags: [''],\r\n countries: ['']\r\n });\r\n }\r\n\r\n createReseller() {\r\n if (this.resellerForm.invalid) {\r\n this.showErrors(this.resellerForm);\r\n return;\r\n }\r\n const reseller = {\r\n name: this.resellerForm.get('name').value,\r\n fiscalName: this.resellerForm.get('fiscalName').value,\r\n cif: this.resellerForm.get('cif').value,\r\n address: this.resellerForm.get('address').value,\r\n cp: this.resellerForm.get('cp').value,\r\n country: this.resellerForm.get('country').value,\r\n claim: this.resellerForm.get('claim').value,\r\n whatsapp: this.resellerForm.get('whatsapp').value,\r\n instagram: this.resellerForm.get('instagram').value,\r\n twitter: this.resellerForm.get('twitter').value,\r\n linkedIn: this.resellerForm.get('linkedIn').value,\r\n facebook: this.resellerForm.get('facebook').value,\r\n observations: this.resellerForm.get('observations').value,\r\n urlWeb: this.resellerForm.get('urlWeb').value,\r\n urlWebSupplier: this.resellerForm.get('urlWebSupplier').value,\r\n user: this.resellerForm.get('user').value,\r\n tripadvisor: this.resellerForm.get('tripadvisor').value,\r\n mediaResellersLogos: this.resellerForm.get('mediaResellersLogos').value,\r\n // categories: this.resellerForm.get('categories').value,\r\n tags: this.resellerForm.get('tags').value,\r\n countries: this.resellerForm.get('countries').value\r\n };\r\n this.resellerService.postReseller(reseller).subscribe(() => {\r\n this.alert.type = 1;\r\n this.alert.message = this.translate.instant('Agencia creada correctamente');\r\n setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n }, 5000);\r\n const roles = this.authService.roles();\r\n if (!roles.includes('ROLE_RESELLER')) {\r\n roles.push('ROLE_RESELLER');\r\n }\r\n\r\n const editedUser = new User({roles: roles});\r\n this.userService.putUser(this.authService.getUserId(), editedUser).subscribe(currentUser => {\r\n localStorage.setItem('user', JSON.stringify(currentUser));\r\n });\r\n // }\r\n this.resellerService.getResellerByUserId(this.authService.getUserId()).subscribe(currentReseller => {\r\n this.reseller = currentReseller;\r\n this.resellerId = currentReseller.id;\r\n localStorage.setItem('reseller', JSON.stringify({id: currentReseller.id , name: currentReseller.name}));\r\n });\r\n }, (error) => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {this.alert = {message: null, type: null};\r\n }, 5000);\r\n });\r\n }\r\n\r\n editReseller(resellerId) {\r\n this.resellerService.getReseller(resellerId, this.formLanguage).subscribe((reseller: Reseller) => {\r\n this.reseller = reseller;\r\n this.resellerForm.get('name').setValue(reseller.name);\r\n this.resellerForm.get('fiscalName').setValue(reseller.fiscalName);\r\n this.resellerForm.get('cif').setValue(reseller.cif);\r\n this.resellerForm.get('address').setValue(reseller.address);\r\n this.resellerForm.get('cp').setValue(reseller.cp);\r\n this.resellerForm.get('country').setValue(reseller.country);\r\n this.resellerForm.get('claim').setValue(reseller.claim);\r\n this.resellerForm.get('whatsapp').setValue(reseller.instagram);\r\n this.resellerForm.get('instagram').setValue(reseller.instagram);\r\n this.resellerForm.get('twitter').setValue(reseller.twitter);\r\n this.resellerForm.get('linkedIn').setValue(reseller.linkedIn);\r\n this.resellerForm.get('facebook').setValue(reseller.facebook);\r\n this.resellerForm.get('observations').setValue(reseller.observations);\r\n this.resellerForm.get('urlWeb').setValue(reseller.urlWeb);\r\n this.resellerForm.get('urlWebSupplier').setValue(reseller.urlWebSupplier);\r\n this.resellerForm.get('tripadvisor').setValue(reseller.tripadvisor);\r\n if (reseller.mediaResellersLogos.length > 0) {\r\n this.resellerForm.get('mediaResellersLogos').setValue([reseller.mediaResellersLogos[0]['@id']]);\r\n this.logoImage = '/assets/resellerLogo/files/' + reseller.mediaResellersLogos[0]['contentUrl'];\r\n }\r\n // this.resellerForm.get('categories').setValue(reseller.categories);\r\n const tags = [];\r\n if (reseller.tags) {\r\n reseller.tags.forEach(tag => {\r\n tags.push(tag['@id']);\r\n });\r\n this.resellerForm.get('tags').setValue(tags);\r\n }\r\n this.resellerForm.get('countries').setValue(reseller.countries);\r\n });\r\n }\r\n\r\n updateReseller() {\r\n if (this.resellerForm.invalid) {\r\n this.showErrors(this.resellerForm);\r\n return;\r\n }\r\n const reseller = {\r\n name: this.resellerForm.get('name').value,\r\n fiscalName: this.resellerForm.get('fiscalName').value,\r\n cif: this.resellerForm.get('cif').value,\r\n address: this.resellerForm.get('address').value,\r\n cp: this.resellerForm.get('cp').value,\r\n country: this.resellerForm.get('country').value,\r\n claim: this.resellerForm.get('claim').value,\r\n whatsapp: this.resellerForm.get('whatsapp').value,\r\n instagram: this.resellerForm.get('instagram').value,\r\n twitter: this.resellerForm.get('twitter').value,\r\n linkedIn: this.resellerForm.get('linkedIn').value,\r\n facebook: this.resellerForm.get('facebook').value,\r\n observations: this.resellerForm.get('observations').value,\r\n urlWeb: this.resellerForm.get('urlWeb').value,\r\n urlWebSupplier: this.resellerForm.get('urlWebSupplier').value,\r\n user: this.resellerForm.get('user').value,\r\n tripadvisor: this.resellerForm.get('tripadvisor').value,\r\n mediaResellersLogos: this.resellerForm.get('mediaResellersLogos').value,\r\n // categories: this.resellerForm.get('categories').value,\r\n tags: this.resellerForm.get('tags').value,\r\n countries: this.resellerForm.get('countries').value\r\n };\r\n const editedReseller = new Reseller(reseller);\r\n this.resellerService.putReseller(this.reseller.id, editedReseller, this.formLanguage)\r\n .subscribe(\r\n (result) => {\r\n this.alert.type = 1;\r\n this.alert.message = this.translate.instant('Agencia guardada correctamente');\r\n setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n }, 5000);\r\n },\r\n error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {this.alert = {message: null, type: null};\r\n }, 5000);\r\n },\r\n () => console.log('complete'));\r\n }\r\n\r\n onFileChanged(event) {\r\n if (event.target.files[ 0 ].type === 'image/jpeg' || event.target.files[ 0 ].type === 'image/png') {\r\n this.selectedFile = event.target.files[ 0 ];\r\n const reader = new FileReader();\r\n\r\n reader.onload = (event: any) => {\r\n this.image = event.target.result;\r\n };\r\n\r\n reader.readAsDataURL(event.target.files[0]);\r\n }\r\n }\r\n\r\n onUpload() {\r\n this.mediaResellerService.mediaResellersUpload(\r\n this.selectedFile, '/media_resellers_logos').subscribe(result => {\r\n this.handleProgress(result);\r\n }, error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {this.alert = {message: null, type: null};\r\n }, 5000);\r\n });\r\n }\r\n\r\n handleProgress(event) {\r\n if (event.type === HttpEventType.DownloadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.UploadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.Response) {\r\n this.uploadComplete = true;\r\n this.uploadingProgressing = false;\r\n this.serverResponse = event.body;\r\n\r\n this.alert.type = 1;\r\n this.alert.message = this.translate.instant('Logo guardado correctamente');\r\n setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n }, 5000);\r\n\r\n this.resellerForm.get('mediaResellers').setValue([event.body['@id']]);\r\n }\r\n }\r\n\r\n onUploadedImage(uploadedImage: object, formControlName: string) {\r\n if (formControlName === 'mediaResellersLogos') {\r\n this.resellerForm.get(formControlName).patchValue([uploadedImage['id']]);\r\n this.logoImage = FRONT_URL + uploadedImage['url'];\r\n }\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n showError(formValue) {\r\n return this.resellerForm.get(formValue).invalid && this.resellerForm.get(formValue).touched;\r\n }\r\n\r\n changeLanguage(language) {\r\n this.formLanguage = language;\r\n // this.translate.setDefaultLang(language);\r\n this.editReseller(this.resellerId);\r\n }\r\n}\r\n","{{translate.instant(title)}} \r\n\r\n
{{ 'Completa los datos de la agencia' | translate }}
\r\n
\r\n\r\n\r\n\r\n
\r\n
{{ 'Datos privados' | translate }}\r\n
\r\n \r\n
\r\n CIF * \r\n \r\n \r\n {{ translate.instant(errors['document']) }}\r\n \r\n
\r\n
\r\n {{ 'Datos públicos' | translate }} \r\n \r\n \r\n \r\n
\r\n {{ 'País' | translate }} * \r\n \r\n {{ country.text }} \r\n \r\n \r\n {{ translate.instant(errors['countryName']) }}\r\n \r\n
\r\n
\r\n {{ 'Dirección' | translate }} * \r\n \r\n \r\n {{ translate.instant(errors['address']) }}\r\n \r\n
\r\n
\r\n \r\n
\r\n {{ 'Código Postal' | translate }} * \r\n \r\n \r\n {{ translate.instant(errors['cp']) }}\r\n \r\n
\r\n
\r\n \r\n
\r\n
{{ 'Subir' | translate }} logo Agencia * \r\n
{{ 'Selecciona un logo de Agencia. Formatos aceptados: .jpeg, .jpg, .png' | translate}} \r\n
{{ 'Dimensiones recomendadas:' | translate}} \r\n
\r\n
\r\n {{ translate.instant(errors['mediaReseller']) }}\r\n \r\n
\r\n
\r\n \r\n
Logo {{ 'subido' | translate }}:
\r\n\r\n
\r\n\r\n\r\n\r\n
\r\n {{ 'Datos de tu ficha de Agencia' | translate}} \r\n \r\n
\r\n {{ 'Eslogan' | translate }}* \r\n \r\n {{phraseText ? phraseText.length : 0}} / {{ phraseMaxChar }} \r\n {{ 'Max. 160 caracteres' | translate}} \r\n
\r\n
\r\n {{ 'Texto libre' | translate }} \r\n \r\n {{descriptionText ? descriptionText.length : 0}} / {{ descriptionMaxChar }} \r\n {{ 'Max. 160 caracteres' | translate }} \r\n\r\n\r\n\r\n
\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n {{ 'Mis etiquetas' | translate}} * \r\n \r\n {{tag.name}} \r\n \r\n \r\n {{translate.instant(errors['resellerTags'])}}\r\n \r\n
\r\n
\r\n {{ 'Mis países' | translate }} * \r\n \r\n {{ country.text }} \r\n \r\n \r\n {{ translate.instant(errors['countryName']) }}\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n\r\n
{{alert.message}}
\r\n
\r\n","export class ResellerCollection {\r\n total: number;\r\n resellers: Reseller[];\r\n}\r\n\r\nexport class Reseller {\r\n id: string;\r\n name: string;\r\n fiscalName: string;\r\n cif: string;\r\n address: string;\r\n cp: string;\r\n country: string;\r\n claim: string;\r\n whatsapp: string;\r\n instagram: string;\r\n twitter: string;\r\n linkedIn: string;\r\n facebook: string;\r\n observations: string;\r\n urlWeb: string;\r\n urlWebSupplier: boolean;\r\n user: string;\r\n tripadvisor: string;\r\n mediaResellersLogos: any[];\r\n categories: any[];\r\n tags: any[];\r\n countries: any[];\r\n constructor(values: any = {}) {\r\n Object.assign(this, values);\r\n }\r\n}\r\n","import { Component, OnInit, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { MakerService } from '../shared/maker.service';\r\nimport { ExperiencesService } from '../experiences/experiences/experiences.service';\r\nimport { DatatableComponent } from '@swimlane/ngx-datatable';\r\nimport { maxTableRows } from 'globals';\r\n\r\n@Component({\r\n selector: 'app-reviews-page',\r\n templateUrl: './reviews-page.component.html',\r\n styleUrls: ['./reviews-page.component.scss']\r\n})\r\nexport class ReviewsPageComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n title = 'Reviews';\r\n searchForm: UntypedFormGroup;\r\n @ViewChild(DatatableComponent) table: DatatableComponent;\r\n\r\n columns = [];\r\n rows = [];\r\n\r\n maker: any = [];\r\n\r\n constructor(\r\n public translate: TranslateService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n private experienceService: ExperiencesService,\r\n private makerService: MakerService,\r\n ) { \r\n\r\n this.experienceService.getAllExperiencesByMakerId(makerService.getId()).subscribe((experiences => {\r\n this.rows = experiences['hydra:member'];\r\n }));\r\n\r\n this.makerService.getMaker('/makers/' + makerService.getId()).subscribe((maker => {\r\n this.maker = maker;\r\n }));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n });\r\n this.columns = [\r\n // { prop: 'id', name: 'ID' },\r\n { prop: 'name', name: 'Experiencia' },\r\n { prop: 'reviews.length', name: 'Reviews' }];\r\n }\r\n\r\n applyFilter() {\r\n this.experienceService.getAllExperiencesByMakerId(this.makerService.getId(), this.searchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n }\r\n )\r\n }\r\n\r\n\r\n importReviews(makerId) {\r\n\r\n this.experienceService.importReviews(makerId).subscribe(\r\n data => {\r\n console.log(data);\r\n }\r\n )\r\n\r\n }\r\n\r\n\r\n}\r\n","\r\n
\r\n
\r\n {{ translate.instant(title) }}\r\n \r\n \r\n\r\n
\r\n\r\n \r\n \r\n Importar reviews Get Your Guide\r\n \r\n \r\n\r\n
\r\n\r\n
\r\n\r\n
\r\n
{{ 'Buscar por:' | translate}} \r\n
\r\n \r\n
\r\n \r\n
\r\n
{{ 'Buscar' |\r\n translate}} \r\n
\r\n \r\n
\r\n
\r\n\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
","import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { SalesService } from '../sales.service';\r\nimport { MakerService } from '../../shared/maker.service';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport { BsDatepickerConfig } from 'ngx-bootstrap/datepicker';\r\nimport { maxTableRows } from 'globals';\r\n\r\n\r\n@Component({\r\n selector: 'app-sales-history',\r\n templateUrl: './sales-history.component.html',\r\n styleUrls: ['./sales-history.component.scss']\r\n})\r\nexport class SalesHistoryComponent implements OnInit {\r\n maxTableRows = maxTableRows;\r\n\r\n @ViewChild('toTemplate') toTemplate: TemplateRef;\r\n @ViewChild('messageTemplate') messageTemplate: TemplateRef;\r\n columns = [];\r\n rows = [];\r\n initialRows = [];\r\n stopSales;\r\n modalRef: BsModalRef;\r\n bsValue = new Date();\r\n bsConfig?: Partial;\r\n datepickerModel?: Date;\r\n monthList: string[] = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];\r\n selectedRangeDate = [];\r\n\r\n constructor(\r\n public translate: TranslateService,\r\n public makerService: MakerService,\r\n public salesService: SalesService,\r\n public modalService: BsModalService\r\n\r\n ) {\r\n this.bsConfig = Object.assign({}, { showWeekNumbers: false, displayOneMonthRange: true });\r\n\r\n this.salesService.getStopSalesByMakerId(makerService.getId()).subscribe((stopSales => {\r\n this.initialRows = stopSales['hydra:member'];\r\n this.rows = stopSales['hydra:member'];\r\n }));\r\n }\r\n\r\n ngOnInit(): void {\r\n\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.columns = [\r\n { prop: 'subject', name: 'Asunto' },\r\n { prop: 'contacts', name: 'Para' },\r\n { prop: 'createdAt', name: 'Fecha y hora de envío' },\r\n { prop: 'message', name: 'Mensaje' }\r\n ];\r\n }\r\n\r\n formatCustomDateWithTime(inputDateString: string): string {\r\n const inputDate = new Date(inputDateString);\r\n\r\n const options: Intl.DateTimeFormatOptions = {\r\n day: \"numeric\",\r\n month: \"long\",\r\n hour: \"2-digit\",\r\n minute: \"2-digit\"\r\n };\r\n const formatter = new Intl.DateTimeFormat(\"es-ES\", options);\r\n const formattedDate = formatter.format(inputDate);\r\n\r\n const parts = formattedDate.split(\",\");\r\n const dayAndMonth = parts[0];\r\n const time = parts[1].trim();\r\n\r\n return dayAndMonth + \" - \" + time;\r\n }\r\n\r\n formatCustomDate(inputDateString: string): string {\r\n const inputDate = new Date(inputDateString);\r\n\r\n const day = inputDate.getUTCDate().toString().padStart(2, \"0\");\r\n const month = (inputDate.getUTCMonth() + 1).toString().padStart(2, \"0\");\r\n const year = inputDate.getUTCFullYear();\r\n\r\n return `${day}/${month}/${year}`;\r\n }\r\n\r\n filterByRange(range) {\r\n if (range != null) {\r\n let startDate = this.formatDateToISO(new Date(range[0]));\r\n let endDate = this.formatDateToISO(new Date(range[1]));\r\n this.rows = this.rows.filter((objeto) => objeto.createdAt >= startDate && objeto.createdAt <= endDate);\r\n }\r\n }\r\n\r\n openMessageModal(template: TemplateRef, config: any) {\r\n this.modalRef = this.modalService.show(template, config);\r\n }\r\n\r\n formatDateToISO(date: Date) {\r\n var año = date.getUTCFullYear();\r\n var mes = (\"0\" + (date.getUTCMonth() + 1)).slice(-2);\r\n var dia = (\"0\" + date.getUTCDate()).slice(-2);\r\n var hora = (\"0\" + date.getUTCHours()).slice(-2);\r\n var minutos = (\"0\" + date.getUTCMinutes()).slice(-2);\r\n var segundos = (\"0\" + date.getUTCSeconds()).slice(-2);\r\n\r\n return `${año}-${mes}-${dia}T${hora}:${minutos}:${segundos}.000Z`;\r\n }\r\n\r\n deleteRange(range) {\r\n this.datepickerModel = null;\r\n this.rows = this.initialRows;\r\n }\r\n}\r\n\r\n","\r\n
{{ 'Historial de Stop Sales' | translate}} \r\n\r\n\r\n
\r\n Seleccionar Fechas\r\n \r\n \r\n
\r\n Desde el {{datepickerModel[0].getDate()}} de {{monthList[(datepickerModel[0].getMonth())]}} al {{datepickerModel[1].getDate()}} de {{\r\n monthList[(datepickerModel[1].getMonth())]}}\r\n de {{datepickerModel[1].getFullYear()}} \r\n \r\n
\r\n
\r\n\r\n \r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n {{contact.email}}\r\n \r\n
\r\n
2\" class=\"\">\r\n ... \r\n
\r\n
\r\n \r\n \r\n \r\n {{formatCustomDateWithTime(value)}}\r\n \r\n \r\n \r\n Ver\r\n mensaje \r\n \r\n \r\n \r\n {{value}}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n Total: {{ rowCount }} Stop Sales\r\n \r\n
\r\n
\r\n 1)\"\r\n (change)=\"myTable.onFooterPage($event)\">\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n\r\n\r\n \r\n \r\n
\r\n
\r\n
Fecha y hora de envio: \r\n
\r\n
\r\n Asunto \r\n \r\n
\r\n
Mensaje \r\n
\r\n
\r\n \r\n {{experience.name}}\r\n \r\n \r\n {{formatCustomDate(date[0]) + ' - ' + formatCustomDate(date[1])}}\r\n \r\n \r\n \r\n
\r\n Un saludo,\r\n \r\n
\r\n [Firma del Maker]\r\n \r\n
\r\n
\r\n
\r\n \r\n\r\n\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n {{contact.email}}\r\n \r\n
\r\n
\r\n
\r\n
\r\n ","import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { MakerService } from '../../shared/maker.service';\r\nimport { BsDatepickerConfig, BsLocaleService } from 'ngx-bootstrap/datepicker';\r\nimport { listLocales } from 'ngx-bootstrap/chronos';\r\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\r\nimport { SalesService } from '../sales.service';\r\nimport { maxTableRows } from 'globals';\r\nimport { ModalAlertComponent } from 'src/app/shared/modal-alert/modal-alert.component';\r\nimport { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';\r\nimport ClassicEditor from '@ckeditor/ckeditor5-build-classic';\r\n\r\n@Component({\r\n selector: 'app-sales-list',\r\n templateUrl: './sales-list.component.html',\r\n styleUrls: ['./sales-list.component.scss']\r\n})\r\nexport class SalesListComponent implements OnInit {\r\n public Editor = ClassicEditor;\r\n \r\n maxTableRows = maxTableRows;\r\n\r\n @ViewChild('myTable') table: any;\r\n alert = { message: null, type: null };\r\n showTab = 0; // 0\r\n steps = ['Seleccionar productos', 'Seleccionar fechas', 'Seleccionar contactos', 'Editar mensaje y envíar', 'Cierre de ventas'];\r\n tabs = ['products', 'stopSales', 'contacts', 'send']\r\n monthList: string[] = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];\r\n columns = [];\r\n rows = [];\r\n columnsContacts = [];\r\n rowsContacts = [];\r\n makerId = localStorage.getItem('maker')['id'];\r\n locale = 'es';\r\n locales = listLocales();\r\n bsConfig?: Partial;\r\n bsInlineRangeValue: Date[];\r\n selectedRangeDate = [];\r\n isMobile: boolean;\r\n currentNode = 1;\r\n flameFill = 0;\r\n productDetails = [];\r\n contactDetails = [];\r\n groupDetails = [];\r\n stopSalesDetails = [];\r\n searchForm: UntypedFormGroup;\r\n contactSearchForm: UntypedFormGroup;\r\n notificationEmailForm: UntypedFormGroup;\r\n notificationEmailData = {\r\n products: this.productDetails,\r\n dates: this.selectedRangeDate,\r\n contacts: this.contactDetails,\r\n groups: this.groupDetails,\r\n extraContacts: [],\r\n subject: null,\r\n message: null,\r\n maker: null\r\n }\r\n maker;\r\n makerName = '';\r\n contactsEmails = [];\r\n productList = '';\r\n editorTemplate = '';\r\n editorTemplateStaticData = '';\r\n contacts = [{ 'id': 'contacts', 'name': 'Contactos' }, { 'id': 'groups', 'name': 'Grupos' }]\r\n listType = 'contacts';\r\n isDecreasing = false;\r\n firstStepNumber = 1;\r\n firstStepText = this.steps[this.firstStepNumber - 1]\r\n secondStepNumber = this.firstStepNumber + 1;\r\n secondStepText = this.steps[this.secondStepNumber - 1]\r\n productCheckboxValue = false;\r\n contactCheckboxValue = false;\r\n dialogRef: BsModalRef;\r\n\r\n constructor(\r\n public translate: TranslateService,\r\n private router: Router,\r\n public experiencesService: ExperiencesService,\r\n public makerService: MakerService,\r\n public salesService: SalesService,\r\n public bsLocaleService: BsLocaleService,\r\n private searchFormBuilder: UntypedFormBuilder,\r\n public dialog: BsModalService\r\n ) {\r\n this.bsConfig = Object.assign({}, { displayOneMonthRange: !this.isMobile, showWeekNumbers: false });\r\n this.bsLocaleService.use('es');//fecha en español, datepicker\r\n this.experiencesService.getAllExperiencesByMakerId(makerService.getId()).subscribe((experiences => {\r\n this.rows = experiences['hydra:member'];\r\n }));\r\n this.makerService.getContactsByMakerId(makerService.getId()).subscribe((contacts => {\r\n this.rowsContacts = contacts['hydra:member'];\r\n }));\r\n this.makerService.getMaker('/makers/' + makerService.getId(), this.translate.getDefaultLang()).subscribe((maker => {\r\n this.makerName = maker.name;\r\n this.maker = maker;\r\n }));\r\n\r\n\r\n }\r\n\r\n ngOnInit(): void {\r\n this.detectMobile();\r\n this.makerId = this.router['rawUrlTree'].queryParams['id'];\r\n\r\n this.searchForm = this.searchFormBuilder.group({\r\n name: [''],\r\n maker: [''],\r\n location: [''],\r\n id: ['']\r\n });\r\n this.contactSearchForm = this.searchFormBuilder.group({\r\n contactName: [''],\r\n companyName: ['']\r\n });\r\n this.notificationEmailForm = this.searchFormBuilder.group({\r\n contacts: [''],\r\n subject: [''],\r\n message: ['']\r\n });\r\n this.columns = [\r\n { prop: 'name', name: 'Nombre' }\r\n ];\r\n this.columnsContacts = [\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'company', name: 'Empresa' },\r\n { prop: 'email', name: 'Email' },\r\n { prop: 'phone', name: 'Teléfono' },\r\n { prop: 'contactGroups', name: 'Grupo' },\r\n ];\r\n\r\n }\r\n\r\n stopSales() {\r\n this.notificationEmailData.subject = 'STOP SALES - ' + this.makerName + (this.notificationEmailForm.value['subject'] != '' ? ' - ' + this.notificationEmailForm.value['subject'] : '')\r\n this.notificationEmailData.message = this.notificationEmailForm.value['message']\r\n if (this.notificationEmailData.message == '') {\r\n this.notificationEmailData.message = this.editorTemplateStaticData;\r\n }\r\n this.notificationEmailData.maker = this.maker\r\n this.salesService.postNotificationEmail(this.notificationEmailData).subscribe(\r\n response => {\r\n this.sendPostSale();\r\n\r\n const currentDiv = document.getElementById('4');\r\n\r\n currentDiv?.nextElementSibling.firstElementChild.classList.remove('glowing');\r\n\r\n const nextDiv = document.getElementById('5');\r\n nextDiv?.classList.add('active');\r\n\r\n setTimeout(() => {\r\n nextDiv?.classList.add('final-state');\r\n }, 2000);\r\n\r\n setTimeout(() => {\r\n nextDiv?.nextElementSibling.firstElementChild.classList.add('active');\r\n nextDiv?.nextElementSibling.firstElementChild.classList.add('glowing');\r\n }, 2000);\r\n\r\n\r\n this.currentNode++;\r\n this.flameFill += 25;\r\n this.setProgress(this.flameFill / 100);\r\n\r\n this.addNumbersToMobileProgressBar(5)\r\n this.openAlert('Cierre de ventas enviado!', 'w-300', true)\r\n },\r\n error => {\r\n console.log('error al enviar el email');\r\n\r\n console.log(error);\r\n this.openAlert('Ha habido un error!', 'w-300', false)\r\n });\r\n }\r\n\r\n changeLang() {\r\n this.translate.setDefaultLang('es');\r\n }\r\n\r\n detectMobile() {\r\n const userAgent = navigator.userAgent.toLowerCase();\r\n this.isMobile = /mobile|android|iphone|ipad|ipod|blackberry|windows phone/i.test(userAgent);\r\n }\r\n\r\n nextTab(bool?: any) {\r\n if (bool != false) {\r\n this.showTab++\r\n if (this.showTab != 0) {\r\n this.notificationEmailData.contacts.forEach(contact => {\r\n if (!this.contactsEmails.includes(contact.email)) {\r\n this.contactsEmails.push(contact.email);\r\n }\r\n });\r\n this.notificationEmailForm.get('contacts').setValue(this.contactsEmails);\r\n\r\n }\r\n }\r\n\r\n if (this.productDetails.length > 0 && this.selectedRangeDate.length == 0) {\r\n const currentDiv = document.getElementById('1');\r\n\r\n currentDiv?.nextElementSibling.firstElementChild.classList.remove('glowing');\r\n\r\n const nextDiv = document.getElementById('2');\r\n nextDiv?.classList.add('active');\r\n\r\n setTimeout(() => {\r\n nextDiv?.classList.add('final-state');\r\n }, 2000);\r\n\r\n setTimeout(() => {\r\n nextDiv?.nextElementSibling.firstElementChild.classList.add('active');\r\n nextDiv?.nextElementSibling.firstElementChild.classList.add('glowing');\r\n }, 2000);\r\n }\r\n\r\n if (this.selectedRangeDate.length > 0 && this.contactDetails.length == 0) {\r\n const currentDiv = document.getElementById('2');\r\n\r\n currentDiv?.nextElementSibling.firstElementChild.classList.remove('glowing');\r\n\r\n const nextDiv = document.getElementById('3');\r\n nextDiv?.classList.add('active');\r\n\r\n setTimeout(() => {\r\n nextDiv?.classList.add('final-state');\r\n }, 2000);\r\n\r\n setTimeout(() => {\r\n nextDiv?.nextElementSibling.firstElementChild.classList.add('active');\r\n nextDiv?.nextElementSibling.firstElementChild.classList.add('glowing');\r\n }, 2000);\r\n }\r\n\r\n if (this.contactDetails.length > 0) {\r\n const currentDiv = document.getElementById('3');\r\n\r\n currentDiv?.nextElementSibling.firstElementChild.classList.remove('glowing');\r\n\r\n const nextDiv = document.getElementById('4');\r\n nextDiv?.classList.add('active');\r\n\r\n setTimeout(() => {\r\n nextDiv?.classList.add('final-state');\r\n }, 2000);\r\n\r\n setTimeout(() => {\r\n nextDiv?.nextElementSibling.firstElementChild.classList.add('active');\r\n nextDiv?.nextElementSibling.firstElementChild.classList.add('glowing');\r\n }, 2000);\r\n }\r\n\r\n this.currentNode++;\r\n this.flameFill += 25;\r\n this.setProgress(this.flameFill / 100);\r\n\r\n if (this.flameFill == 1) {\r\n const fireDiv = document.querySelector('.path');\r\n fireDiv.classList.add('glowing');\r\n }\r\n\r\n if (this.showTab == 3) {\r\n let rangeList = ' ';\r\n this.selectedRangeDate.forEach(range => {\r\n let date1 = new Date(range[0])\r\n let day1 = date1.getDate()\r\n let month1 = date1.getMonth() + 1\r\n let year1 = date1.getFullYear()\r\n\r\n let date2 = new Date(range[1])\r\n let day2 = date2.getDate()\r\n let month2 = date2.getMonth() + 1\r\n let year2 = date2.getFullYear()\r\n\r\n rangeList += day1 + '/' + month1 + '/' + year1 + ' - ' + day2 + '/' + month2 + '/' + year2 + ' '\r\n });\r\n\r\n this.editorTemplateStaticData = '';\r\n this.editorTemplate = '' +\r\n '
Hola [contactname],
' +\r\n '
Informamos de los siguientes cierres de venta:
' +\r\n '
';\r\n this.productDetails.forEach(product => {\r\n this.editorTemplateStaticData += '
' + product.name + '
'\r\n });\r\n this.editorTemplateStaticData += '
Las fechas de los cierres son:' +\r\n ' ' +\r\n rangeList +\r\n '
Un saludo
' +\r\n '
[Tu firma]
'\r\n '
';\r\n\r\n this.notificationEmailForm.controls['message'].setValue(this.editorTemplate);\r\n }\r\n }\r\n\r\n storeRangeDate(event) {\r\n let selectedDaysofRange = []\r\n event.forEach(range => {\r\n selectedDaysofRange.push(range)\r\n });\r\n this.selectedRangeDate.push(selectedDaysofRange)\r\n\r\n this.addNumbersToMobileProgressBar(3)\r\n }\r\n\r\n // Función para formatear un número con ceros a la izquierda (por ejemplo, 01, 02, 03, ...)\r\n formatWithLeadingZeros(value: number, length: number): string {\r\n return value.toString().padStart(length, '0');\r\n }\r\n\r\n // Función para formatear una fecha en el formato \"dd-mm-yyyy\"\r\n formatDateToDDMMYYYY(date: Date): string {\r\n const day = this.formatWithLeadingZeros(date.getDate(), 2);\r\n const month = this.formatWithLeadingZeros(date.getMonth() + 1, 2); // Los meses en JavaScript son base 0 (enero = 0)\r\n const year = date.getFullYear();\r\n\r\n return `${day}-${month}-${year}`;\r\n }\r\n\r\n onAnimationEnd(): void {\r\n // Agregar la clase 'final-state' al div para mantener el color después de la animación\r\n const progressDiv = document.querySelector('.progress');\r\n\r\n if (this.isDecreasing == false) {\r\n progressDiv?.classList.add('final-state');\r\n } else {\r\n progressDiv?.classList.remove('final-state');\r\n progressDiv?.classList.remove('active');\r\n progressDiv?.classList.remove('decreasing');\r\n }\r\n }\r\n\r\n onNumberAnimationEnd(): void {\r\n // Agregar la clase 'final-state' al div para mantener el color después de la animación\r\n const positionDiv = document.querySelector('.node-position');\r\n\r\n if (this.isDecreasing == false) {\r\n positionDiv?.classList.add('final-state');\r\n } else {\r\n positionDiv?.classList.remove('final-state');\r\n positionDiv?.classList.remove('active');\r\n }\r\n\r\n }\r\n\r\n setProgress(amt) {\r\n amt = (amt < 0) ? 0 : (amt > 1) ? 1 : amt;\r\n document.getElementById(\"stop1\").setAttribute(\"offset\", amt);\r\n document.getElementById(\"stop2\").setAttribute(\"offset\", amt);\r\n }\r\n\r\n addProduct(product) { \r\n console.log(this.productCheckboxValue);\r\n\r\n if (!this.productDetails.includes(product)) {\r\n this.productDetails.push(product);\r\n this.addNumbersToMobileProgressBar(2)\r\n } else {\r\n this.productDetails = this.productDetails.filter(deleteProduct => deleteProduct.id !== product.id);\r\n this.removeNumbersToMobileProgressBar();\r\n }\r\n }\r\n\r\n addContact(contact) {\r\n if (this.listType == 'groups') {\r\n if (!this.groupDetails.includes(contact['@id'])) {\r\n this.groupDetails.push(contact['@id']);\r\n this.addNumbersToMobileProgressBar(4)\r\n } else {\r\n this.groupDetails = this.groupDetails.filter(deleteContact => deleteContact !== contact['@id']);\r\n this.removeNumbersToMobileProgressBar();\r\n }\r\n contact.contacts.forEach(groupContact => {\r\n if (!this.contactDetails.includes(groupContact)) {\r\n this.contactDetails.push(groupContact)\r\n this.addNumbersToMobileProgressBar(4)\r\n } else {\r\n this.contactDetails = this.contactDetails.filter(deleteContact => deleteContact['@id'] !== groupContact['@id']);\r\n this.removeNumbersToMobileProgressBar();\r\n }\r\n });\r\n } else {\r\n if (!this.contactDetails.includes(contact)) {\r\n this.contactDetails.push(contact);\r\n this.addNumbersToMobileProgressBar(4)\r\n } else {\r\n this.contactDetails = this.contactDetails.filter(deleteContact => deleteContact.id !== contact.id);\r\n this.removeNumbersToMobileProgressBar();\r\n }\r\n }\r\n\r\n }\r\n\r\n addProducts(event: any) {\r\n let checked = event.target.checked;\r\n this.productCheckboxValue = checked;\r\n \r\n if (checked) {\r\n this.rows.forEach(row => {\r\n this.productDetails.push(row);\r\n });\r\n } else {\r\n this.productDetails = [];\r\n }\r\n }\r\n\r\n addContacts(event: any) {\r\n let checked = event.target.checked;\r\n this.contactCheckboxValue = checked;\r\n if (checked) {\r\n this.rowsContacts.forEach(row => {\r\n this.contactDetails.push(row);\r\n });\r\n } else {\r\n this.contactDetails = [];\r\n }\r\n }\r\n\r\n applyFilter() {\r\n this.experiencesService.getAllExperiencesByMakerId(this.makerService.getId(), this.searchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n }\r\n );\r\n }\r\n\r\n applyContactFilter() {\r\n this.makerService.getContactsByMakerId(this.makerService.getId(), this.contactSearchForm.value).subscribe(\r\n data => {\r\n this.rows = data['hydra:member'];\r\n this.table.offset = 0;\r\n }\r\n );\r\n }\r\n\r\n deleteRange(range) {\r\n var index = this.selectedRangeDate.indexOf(range);\r\n if (index !== -1) {\r\n this.selectedRangeDate.splice(index, 1);\r\n }\r\n this.removeNumbersToMobileProgressBar();\r\n }\r\n\r\n insertTag(event, type) {\r\n\r\n this[type + 'Selected'] = this.notificationEmailForm.controls[type].value ? this.notificationEmailForm.controls[type].value : [];\r\n\r\n if (event.target.value != '') {\r\n this[type + 'Selected'].push(event.target.value);\r\n }\r\n this.notificationEmailData.extraContacts.push(event.target.value)\r\n\r\n this.notificationEmailForm.controls[type].setValue(this[type + 'Selected']);\r\n event.target.value = null;\r\n // this[type + 'Selected'] = this.experienceForm.controls[type].value;\r\n\r\n }\r\n\r\n onRemove(event) {\r\n this.notificationEmailData.contacts.filter(function (obj) {\r\n return obj.email !== event.value;\r\n });\r\n this.notificationEmailData.extraContacts.filter(function (obj) {\r\n return obj.email !== event.value;\r\n });\r\n }\r\n\r\n changeList(listType: any) {\r\n this.listType = listType;\r\n if (this.listType == 'groups') {\r\n this.columnsContacts = [\r\n { prop: 'name', name: 'Nombre' },\r\n ];\r\n this.makerService.getContactsGroupsByMakerId(this.makerService.getId()).subscribe((groups => {\r\n this.rowsContacts = groups['hydra:member'];\r\n }));\r\n } else {\r\n this.listType = 'contacts';\r\n this.columnsContacts = [\r\n { prop: 'name', name: 'Nombre' },\r\n { prop: 'company', name: 'Empresa' },\r\n { prop: 'email', name: 'Email' },\r\n { prop: 'phone', name: 'Teléfono' },\r\n { prop: 'contactGroups', name: 'Grupo' },\r\n ];\r\n this.makerService.getContactsByMakerId(this.makerService.getId()).subscribe((contacts => {\r\n this.rowsContacts = contacts['hydra:member'];\r\n }));\r\n }\r\n }\r\n\r\n sendPostSale() {\r\n let notificationEmailDataToSend = {\r\n contacts: null,\r\n groups: null,\r\n extraContacts: null,\r\n dates: null,\r\n maker: null,\r\n experiences: null,\r\n message: null,\r\n subject: null,\r\n }\r\n let contactIds = [];\r\n this.notificationEmailData.contacts.forEach(data => {\r\n contactIds.push(data['@id'])\r\n });\r\n\r\n let groupIds = [];\r\n this.notificationEmailData.groups.forEach(data => {\r\n groupIds.push(data)\r\n });\r\n\r\n notificationEmailDataToSend.contacts = contactIds;\r\n notificationEmailDataToSend.groups = groupIds;\r\n\r\n notificationEmailDataToSend.maker = [this.notificationEmailData.maker['@id']];\r\n\r\n let productsIds = [];\r\n this.notificationEmailData.products.forEach(data => {\r\n productsIds.push(data['@id'])\r\n });\r\n notificationEmailDataToSend.experiences = productsIds;\r\n\r\n notificationEmailDataToSend.extraContacts = this.notificationEmailData.extraContacts;\r\n notificationEmailDataToSend.dates = this.notificationEmailData.dates;\r\n notificationEmailDataToSend.message = this.notificationEmailData.message;\r\n notificationEmailDataToSend.subject = this.notificationEmailData.subject;\r\n\r\n this.salesService.postStopSale(notificationEmailDataToSend).subscribe(\r\n response => {\r\n console.log(response);\r\n },\r\n error => {\r\n console.log(error);\r\n }\r\n )\r\n }\r\n\r\n isChecked(contact) {\r\n let filterContacts = this.contactDetails.filter(deleteContact => deleteContact['@id'] == contact);\r\n return filterContacts.length > 0;\r\n }\r\n\r\n ngOnDestroy(): void {\r\n //clear cache\r\n location.reload()\r\n }\r\n\r\n addNumbersToMobileProgressBar(number) {\r\n if (number == 5) {\r\n const progressDiv = document.getElementById('2m');\r\n progressDiv?.classList.add('active');\r\n const prevBall = progressDiv.previousElementSibling.firstElementChild;\r\n prevBall.classList.remove('glowing');\r\n const nextBall = progressDiv.nextElementSibling.firstElementChild;\r\n setTimeout(() => {\r\n progressDiv?.classList.add('final-state');\r\n nextBall.classList.add('active');\r\n nextBall.classList.add('glowing');\r\n }, 2000);\r\n } else {\r\n this.firstStepNumber = number;\r\n this.firstStepText = this.steps[this.firstStepNumber - 1];\r\n\r\n const progressDiv = document.getElementById('2m');\r\n progressDiv?.classList.add('active');\r\n\r\n setTimeout(() => {\r\n this.secondStepNumber = number + 1;\r\n this.secondStepText = this.steps[this.secondStepNumber - 1];\r\n progressDiv?.classList.remove('active');\r\n }, 2000);\r\n }\r\n\r\n }\r\n\r\n removeNumbersToMobileProgressBar() {\r\n this.secondStepNumber = this.firstStepNumber;\r\n this.secondStepText = this.steps[this.secondStepNumber - 1];\r\n\r\n const progressDiv = document.getElementById('2m');\r\n progressDiv?.classList.add('decreasing');\r\n\r\n setTimeout(() => {\r\n this.firstStepNumber--;\r\n this.firstStepText = this.steps[this.firstStepNumber - 1];\r\n progressDiv?.classList.remove('decreasing');\r\n }, 2000);\r\n }\r\n\r\n openAlert(modalText: string, className: string, status: boolean) {\r\n let iconClass: string;\r\n if (status) {\r\n iconClass = 'vi-check';\r\n } else {\r\n iconClass = 'vi-sad';\r\n }\r\n const modalConfig = {\r\n class: className,\r\n initialState: {\r\n alertMessage: this.translate.instant(\r\n modalText\r\n ),\r\n iconClass,\r\n status\r\n }\r\n }\r\n this.dialogRef = this.dialog.show(ModalAlertComponent, modalConfig);\r\n setTimeout(() => {\r\n this.dialogRef.hide();\r\n }, 2500);\r\n }\r\n\r\n}\r\n","\r\n
{{ 'Stop Sales' | translate}} \r\n \r\n\r\n\r\n
{{alert.message}}\r\n
\r\n
\r\n\r\n
\r\n
\r\n \r\n Tu progreso {{flameFill > 100 ? 100 : flameFill}}%\r\n \r\n \r\n 5 Pasos\r\n \r\n
\r\n
\r\n
\r\n
\r\n 1 \r\n Seleccionar productos \r\n
\r\n
\r\n
\r\n 2 \r\n Seleccionar fechas \r\n
\r\n
\r\n
\r\n 3 \r\n Seleccionar contactos \r\n
\r\n
\r\n
\r\n 4 \r\n Editar mensaje y enviar \r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Cierre de ventas \r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n \r\n Tu progreso {{flameFill > 100 ? 100 : flameFill}}%\r\n \r\n \r\n 5 Pasos\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n {{firstStepNumber}} \r\n {{firstStepText}} \r\n
\r\n
\r\n
\r\n {{secondStepNumber}} \r\n {{secondStepText}} \r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n\r\n
\r\n
{{ 'Buscar por:' | translate}} \r\n
\r\n \r\n
\r\n \r\n
\r\n
{{ 'Buscar' |\r\n translate}} \r\n
\r\n \r\n
\r\n
\r\n \r\n Ver historial \r\n
\r\n
\r\n\r\n\r\n
\r\n
{{ 'Buscar por:' | translate}} \r\n
\r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
{{ 'Buscar' |\r\n translate}} \r\n
\r\n \r\n
\r\n
\r\n \r\n Ver historial \r\n
\r\n
\r\n\r\n\r\n
\r\n \r\n Ver historial \r\n
\r\n
\r\n\r\n\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n Desde el {{range[0].getDate()}} de {{monthList[(range[0].getMonth())]}} al\r\n {{range[1].getDate()}} de {{\r\n monthList[(range[1].getMonth())]}}\r\n de {{range[1].getFullYear()}} \r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {{value}}\r\n \r\n \r\n \r\n \r\n {{value.length > 0 ? value[0].name : ''}}\r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
Para: \r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n Asunto: \r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
","import { HttpClient } from \"@angular/common/http\";\r\nimport { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { environment } from \"src/environments/environment\";\r\n\r\nconst API_URL = environment.apiUrl;\r\n\r\n@Injectable()\r\nexport class SalesService {\r\n constructor(\r\n private http: HttpClient\r\n ) { }\r\n\r\n public postNotificationEmail(notificationData): Observable {\r\n return this.http\r\n .post(API_URL + '/email/send', notificationData);\r\n }\r\n\r\n public postBookingEmail(bookingData): Observable {\r\n return this.http\r\n .post(API_URL + '/send_booking', bookingData);\r\n }\r\n\r\n public postStopSale(notificationData): Observable {\r\n return this.http\r\n .post(API_URL + '/stop_sales', notificationData);\r\n }\r\n\r\n public getStopSalesByMakerId(id): Observable {\r\n return this.http\r\n .get(API_URL + '/stop_sales?maker.id=' + id);\r\n }\r\n\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { CanActivate, Router } from '@angular/router';\r\nimport { AuthService } from './auth.service';\r\n\r\nimport { map } from 'rxjs/operators';\r\n\r\n@Injectable()\r\nexport class AuthGuard implements CanActivate {\r\n\r\n constructor(private authService: AuthService,\r\n private router: Router) { }\r\n\r\n canActivate() {\r\n return this.authService.isAuthenticated().pipe(\r\n map(isLoggedIn => {\r\n if (!isLoggedIn) {\r\n this.router.navigateByUrl('');\r\n }\r\n return isLoggedIn;\r\n }));\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { HttpClient } from '@angular/common/http';\r\n\r\nimport { of as observableOf, Observable } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\n\r\nimport { environment } from '../../../environments/environment';\r\nimport { MakerService } from './maker.service';\r\nimport { User } from '../../shared/users/user.model';\r\nimport { TakerService } from './taker.service';\r\nimport {ResellerService} from './reseller.service';\r\n@Injectable()\r\nexport class AuthService {\r\n private token: string;\r\n private user: object;\r\n private refreshToken: string;\r\n private isAdmin: boolean;\r\n\r\n constructor(private http: HttpClient,\r\n public makerService: MakerService,\r\n public takerService: TakerService,\r\n public resellerService: ResellerService,\r\n public router: Router\r\n ) {\r\n this.loadFromStorage();\r\n }\r\n\r\n login(email: string, password: string): Promise {\r\n const loginUrl = environment.apiUrl + '/login_check';\r\n\r\n return this.http.post(\r\n loginUrl, {\r\n username: email,\r\n password\r\n }).pipe(\r\n map((resp: any) => {\r\n this.saveToStorage(resp);\r\n\r\n return true;\r\n }))\r\n .toPromise();\r\n }\r\n\r\n loginByGoogle(token: string, role) {\r\n const url = environment.apiUrl + '/login/google';\r\n\r\n return this.http.post(url, {id_token: token, role: role})\r\n .pipe(map((resp: any) => {\r\n this.saveToStorage(resp);\r\n\r\n return true;\r\n }))\r\n .toPromise();\r\n }\r\n\r\n // tslint:disable-next-line:ban-types\r\n loginByFacebook(user: Object, role) {\r\n const url = environment.apiUrl + '/login/facebook';\r\n user['role'] = role;\r\n return this.http.post(url, user)\r\n .pipe(map((resp: any) => {\r\n this.saveToStorage(resp);\r\n\r\n return true;\r\n }))\r\n .toPromise();\r\n }\r\n\r\n doRefreshToken(): Observable {\r\n const data = {\r\n refresh_token: this.refreshToken\r\n };\r\n return this.http.post(environment.apiUrl + '/token/refresh', data).pipe(map(resp => resp.token));\r\n }\r\n\r\n public register(userId: string, user: User): Observable {\r\n return this.http\r\n .put(environment.apiUrl + '/register' + userId, user);\r\n }\r\n\r\n logout() {\r\n this.token = '';\r\n this.user = null;\r\n this.refreshToken = '';\r\n\r\n localStorage.removeItem('token');\r\n localStorage.removeItem('user');\r\n localStorage.removeItem('maker');\r\n localStorage.removeItem('taker');\r\n localStorage.removeItem('reseller');\r\n localStorage.removeItem('refresh_token');\r\n\r\n // this.router.navigate(['/login']);\r\n }\r\n\r\n isAuthenticated(): Observable {\r\n return observableOf(typeof this.token !== 'undefined' && this.token.length > 5);\r\n }\r\n\r\n isLoggedIn(): boolean {\r\n return this.token.length > 5;\r\n }\r\n\r\n isReallyLoggedIn(): boolean {\r\n return localStorage.getItem('token') && localStorage.getItem('token').length > 5 && this.isLoggedIn();\r\n }\r\n\r\n saveToStorage(resp: object) {\r\n if (resp.hasOwnProperty('token')) {\r\n localStorage.setItem('token', resp['token']);\r\n this.token = resp['token'];\r\n }\r\n\r\n if (resp.hasOwnProperty('user') && resp['user'].hasOwnProperty('id')) {\r\n localStorage.setItem('user', JSON.stringify(resp['user']));\r\n this.user = resp['user'];\r\n this.isAdmin = this.user['roles'].includes('ROLE_ADMIN');\r\n }\r\n\r\n if (resp.hasOwnProperty('refresh_token')) {\r\n localStorage.setItem('refresh_token', resp['refresh_token']);\r\n this.refreshToken = resp['refresh_token'];\r\n }\r\n\r\n if (this.user['roles'].includes('ROLE_MAKER') && this.user['maker']) {\r\n localStorage.setItem('maker', JSON.stringify({id: this.user['maker'].id , name: this.user['maker'].name}));\r\n }\r\n\r\n if (this.user['roles'].includes('ROLE_TAKER') && this.user['taker']) {\r\n localStorage.setItem('taker', JSON.stringify({id: this.user['taker'].id , name: this.user['taker'].name}));\r\n }\r\n if (this.user['roles'].includes('ROLE_RESELLER') && this.user['reseller']) {\r\n localStorage.setItem('reseller', JSON.stringify({id: this.user['reseller'].id , name: this.user['reseller'].name}));\r\n }\r\n }\r\n\r\n loadFromStorage() {\r\n if ( localStorage.getItem('token')) {\r\n this.token = localStorage.getItem('token');\r\n this.user = JSON.parse(localStorage.getItem('user'));\r\n this.refreshToken = localStorage.getItem('refresh_token');\r\n this.isAdmin = this.user['roles'].includes('ROLE_ADMIN');\r\n } else {\r\n this.token = '';\r\n this.user = null;\r\n this.refreshToken = '';\r\n }\r\n }\r\n\r\n getToken(): string {\r\n return this.token;\r\n }\r\n\r\n getUserId() {\r\n return this.user['id'];\r\n }\r\n\r\n getMakerId() {\r\n let maker = JSON.parse(localStorage.getItem('maker'));\r\n return maker['id'];\r\n }\r\n\r\n getUserEmail() {\r\n return this.user['email'];\r\n }\r\n\r\n isMaker() {\r\n return localStorage.getItem('maker');\r\n }\r\n\r\n isTaker() {\r\n return localStorage.getItem('taker');\r\n }\r\n\r\n isReseller() {\r\n return localStorage.getItem('taker');\r\n }\r\n \r\n isAdminUser() {\r\n return this.user['roles'].includes('ROLE_ADMIN');\r\n }\r\n\r\n hasMakerRole() {\r\n return localStorage.getItem('user') && JSON.parse(localStorage.getItem('user')).roles.includes('ROLE_MAKER');\r\n }\r\n\r\n hasTakerRole() {\r\n return localStorage.getItem('user') && JSON.parse(localStorage.getItem('user')).roles.includes('ROLE_TAKER');\r\n }\r\n\r\n hasResellerRole() {\r\n return localStorage.getItem('user') && JSON.parse(localStorage.getItem('user')).roles.includes('ROLE_RESELLER');\r\n }\r\n\r\n roles() {\r\n return JSON.parse(localStorage.getItem('user')).roles;\r\n }\r\n}\r\n","import { Component } from '@angular/core';\r\nimport { BsModalRef } from 'ngx-bootstrap/modal';\r\n\r\n@Component({\r\n selector: 'app-confirmation-dialog',\r\n templateUrl: './confirmation-dialog.component.html'\r\n})\r\nexport class ConfirmationDialogComponent {\r\n\r\n public confirmMessage: string;\r\n\r\n constructor(public dialogRef: BsModalRef) { }\r\n\r\n confirm() {\r\n if (this.dialogRef.content.callback != null) {\r\n this.dialogRef.content.callback(true);\r\n this.dialogRef.hide();\r\n }\r\n }\r\n\r\n decline() {\r\n if (this.dialogRef.content.callback != null) {\r\n this.dialogRef.content.callback(false);\r\n this.dialogRef.hide();\r\n }\r\n }\r\n\r\n}\r\n","\r\n
{{confirmMessage}}
\r\n
{{ 'Eliminar' | translate}} \r\n
{{ 'Cancelar' | translate}} \r\n
\r\n","import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder } from '@angular/forms';\r\nimport { HttpEventType } from '@angular/common/http';\r\n\r\nimport { Subscription } from 'rxjs';\r\n\r\nimport { CropperComponent as AngularCropperjsComponent } from 'angular-cropperjs';\r\n\r\n\r\nimport { MediaExperiencesService } from '../../experiences/experiences/media-experiences.service';\r\nimport { MediaMakerService } from '../../maker/maker-profile/media-maker';\r\nimport { MediaResellerService } from '../../reseller/reseller-profile/media-reseller';\r\nimport { TranslateService } from '@ngx-translate/core';\r\n\r\n\r\n@Component({\r\n selector: 'app-cropper',\r\n styleUrls: ['./cropper.component.scss'],\r\n templateUrl: './cropper.component.html',\r\n})\r\nexport class CropperComponent {\r\n\r\n @Input() loadedImages: number;\r\n @Input() aspectratio: number;\r\n @Input() preview: string;\r\n @Input() type: string;\r\n @ViewChild('angularCropper', { static: false }) public angularCropper: AngularCropperjsComponent;\r\n @Output() uploadedImage = new EventEmitter();\r\n @Output() isTooManyImages = new EventEmitter();\r\n didUploadImage = {};\r\n featuredImageTemp1 = '';\r\n config;\r\n\r\n featuredFileToUpload: File = null;\r\n fileUploadSub: Subscription;\r\n translate: TranslateService;\r\n uploadProgress = 0;\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n filesList: any;\r\n filesDestination: any;\r\n\r\n loading = false;\r\n\r\n constructor(private fb: UntypedFormBuilder,\r\n private mediaExperiencesService: MediaExperiencesService,\r\n private mediaMakersService: MediaMakerService,\r\n private mediaResellersService: MediaResellerService) {\r\n this.config = { aspectRatio: this.aspectratio, preview: '', autoCropArea: 1 };\r\n }\r\n\r\n\r\n\r\n insertImage(files: any, destination: string) {\r\n if(this.loadedImages + files.length > 10){\r\n this.isTooManyImages.emit(true)\r\n console.log('demasiadas imagenes');\r\n return\r\n }\r\n this.filesList = files;\r\n this.filesDestination = destination;\r\n\r\n this.config.aspectRatio = this.aspectratio;\r\n this.config.preview = '.' + this.preview;\r\n var fileItem = files[0];\r\n\r\n if (fileItem === null || fileItem.type.indexOf('image') < 0) {\r\n this.featuredFileToUpload = null;\r\n return;\r\n }\r\n this.featuredFileToUpload = fileItem;\r\n const reader = new FileReader();\r\n reader.readAsDataURL(fileItem);\r\n\r\n reader.onloadend = (progress) => {\r\n this[destination] = reader.result;\r\n if (this.angularCropper) {\r\n this.angularCropper.cropper.destroy();\r\n }\r\n return this[destination];\r\n };\r\n\r\n }\r\n\r\n uploadFeaturedFile(event: any) {\r\n this.loading = true;\r\n event.preventDefault();\r\n\r\n function toFile(b: any, name: string) {\r\n b.lastModifiedDate = new Date();\r\n b.name = name;\r\n return b as File;\r\n }\r\n\r\n this.angularCropper.cropper.getCroppedCanvas({ maxWidth: 4096, maxHeight: 2160, minWidth: 290, minHeight: 232, fillColor: '#fff' }).toBlob(\r\n (blobToUpload: Blob) => {\r\n const fileToUpload = toFile(blobToUpload, this.featuredFileToUpload.name);\r\n if (this.type === 'contact') {\r\n this.fileUploadSub = this.mediaMakersService.mediaMakersUpload(\r\n fileToUpload, '/media_contacts',\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n }\r\n else if (this.type === 'makerHeader') {\r\n this.fileUploadSub = this.mediaMakersService.mediaMakersUpload(\r\n fileToUpload, '/media_makers_header',\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n }\r\n else if (this.type === 'makerStaff') {\r\n this.fileUploadSub = this.mediaMakersService.mediaMakersUpload(\r\n fileToUpload, '/media_makers_staff',\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n }\r\n else if (this.type === 'maker') {\r\n this.fileUploadSub = this.mediaMakersService.mediaMakersUpload(\r\n fileToUpload, '/media_makers',\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n } else if (this.type === 'reseller') {\r\n this.fileUploadSub = this.mediaResellersService.mediaResellersUpload(\r\n fileToUpload, '/media_resellers_logos',\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n } else {\r\n this.fileUploadSub = this.mediaExperiencesService.mediaExperiencesUpload(\r\n fileToUpload,\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n }\r\n },\r\n 'image/jpeg', 1);\r\n\r\n let fileListArr = Array.from(this.filesList)\r\n console.log(fileListArr);\r\n \r\n if (fileListArr.length > 1) {\r\n fileListArr.splice(0, 1) // here u remove the file\r\n this.insertImage(fileListArr, this.filesDestination);\r\n } else {\r\n this.featuredImageTemp1 = '';\r\n }\r\n\r\n }\r\n\r\n handleProgress(event) {\r\n if (event.type === HttpEventType.DownloadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.UploadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.Response) {\r\n // console.log(event.body);\r\n this.uploadComplete = true;\r\n this.uploadingProgressing = false;\r\n this.serverResponse = event.body;\r\n\r\n this.didUploadImage = { id: event.body['@id'], url: event.body['contentUrl'] };\r\n this.uploadedImage.emit(this.didUploadImage);\r\n this.loading = false;\r\n }\r\n }\r\n}\r\n","\r\n\r\n
\r\n
{{ 'Selecciona el area de la Imagen' | translate}}
\r\n
\r\n
\r\n
\r\n
{{ 'Previsualización' | translate}}
\r\n
\r\n
\r\n {{ 'Subir Imagen' | translate}} \r\n \r\n
\r\n
\r\n Loading... \r\n
\r\n
\r\n
\r\n
","import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder } from '@angular/forms';\r\nimport { HttpEventType } from '@angular/common/http';\r\n\r\nimport { Subscription } from 'rxjs';\r\n\r\nimport { CropperComponent as AngularCropperjsComponent } from 'angular-cropperjs';\r\n\r\n\r\nimport { MediaExperiencesService } from '../../experiences/experiences/media-experiences.service';\r\nimport { MediaMakerService } from '../../maker/maker-profile/media-maker';\r\nimport { TranslateService } from '@ngx-translate/core';\r\n\r\n@Component({\r\n selector: 'app-cropper-2',\r\n styleUrls: ['./cropper.component.scss'],\r\n templateUrl: './cropper2.component.html',\r\n})\r\nexport class Cropper2Component {\r\n\r\n @Input() aspectratio: number;\r\n @Input() preview: string;\r\n @Input() type: string;\r\n @ViewChild('angularCropper2', { static: false }) public angularCropper: AngularCropperjsComponent;\r\n @Output() uploadedImage = new EventEmitter();\r\n didUploadImage = {};\r\n featuredImageTemp2 = '';\r\n config;\r\n\r\n featuredFileToUpload: File = null;\r\n fileUploadSub: Subscription;\r\n translate: TranslateService;\r\n uploadProgress = 0;\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n\r\n loading = false;\r\n\r\n constructor(private fb: UntypedFormBuilder,\r\n private mediaExperiencesService: MediaExperiencesService,\r\n private mediaMakersService: MediaMakerService) {\r\n this.config = { aspectRatio: this.aspectratio, preview: '', autoCropArea: 1 };\r\n }\r\n\r\n\r\n\r\n insertImage(files: FileList, destination: string) {\r\n this.config.aspectRatio = this.aspectratio;\r\n this.config.preview = '.' + this.preview;\r\n const fileItem = files.item(0);\r\n if (fileItem === null || fileItem.type.indexOf('image') < 0) {\r\n this.featuredFileToUpload = null;\r\n return;\r\n }\r\n this.featuredFileToUpload = fileItem;\r\n const reader = new FileReader();\r\n reader.readAsDataURL(fileItem);\r\n\r\n reader.onloadend = (progress) => {\r\n this[destination] = reader.result;\r\n if (this.angularCropper) {\r\n this.angularCropper.cropper.destroy();\r\n }\r\n return this[destination];\r\n };\r\n }\r\n\r\n uploadFeaturedFile(event: any) {\r\n this.loading = true;\r\n event.preventDefault();\r\n\r\n function toFile(b: any, name: string) {\r\n b.lastModifiedDate = new Date();\r\n b.name = name;\r\n return b as File;\r\n }\r\n\r\n this.angularCropper.cropper.getCroppedCanvas({ maxWidth: 1920, maxHeight: 640, minWidth: 1080, minHeight: 640 }).toBlob(\r\n (blobToUpload: Blob) => {\r\n const fileToUpload = toFile(blobToUpload, this.featuredFileToUpload.name);\r\n this.fileUploadSub = this.mediaMakersService.mediaMakersUpload(\r\n fileToUpload, '/media_makers_headers',\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n },\r\n 'image/jpeg', 1);\r\n }\r\n\r\n handleProgress(event) {\r\n if (event.type === HttpEventType.DownloadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.UploadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.Response) {\r\n // console.log(event.body);\r\n this.uploadComplete = true;\r\n this.uploadingProgressing = false;\r\n this.serverResponse = event.body;\r\n\r\n this.didUploadImage = { id: event.body['@id'], url: event.body['contentUrl'] };\r\n this.uploadedImage.emit(this.didUploadImage);\r\n this.loading = false;\r\n }\r\n }\r\n}\r\n","\r\n\r\n
\r\n
{{ 'Selecciona el area de la Imagen' | translate}}
\r\n
\r\n
\r\n
\r\n
{{ 'Previsualización' | translate}}
\r\n
\r\n
\r\n {{ 'Subir Imagen' | translate}} \r\n \r\n
\r\n
\r\n Loading... \r\n
\r\n
\r\n
\r\n
\r\n","import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder } from '@angular/forms';\r\nimport { HttpEventType } from '@angular/common/http';\r\n\r\nimport { Subscription } from 'rxjs';\r\n\r\nimport { CropperComponent as AngularCropperjsComponent } from 'angular-cropperjs';\r\n\r\n\r\nimport { MediaExperiencesService } from '../../experiences/experiences/media-experiences.service';\r\nimport { MediaMakerService } from '../../maker/maker-profile/media-maker';\r\nimport { TranslateService } from '@ngx-translate/core';\r\n\r\n@Component({\r\n selector: 'app-cropper-3',\r\n styleUrls: ['./cropper.component.scss'],\r\n templateUrl: './cropper3.component.html',\r\n})\r\nexport class Cropper3Component {\r\n\r\n @Input() aspectratio: number;\r\n @Input() preview: string;\r\n @Input() type: string;\r\n @ViewChild('angularCropper3', { static: false }) public angularCropper: AngularCropperjsComponent;\r\n @Output() uploadedImage = new EventEmitter();\r\n didUploadImage = {};\r\n featuredImageTemp3 = '';\r\n config;\r\n\r\n featuredFileToUpload: File = null;\r\n fileUploadSub: Subscription;\r\n translate: TranslateService;\r\n uploadProgress = 0;\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n\r\n loading = false;\r\n\r\n constructor(private fb: UntypedFormBuilder,\r\n private mediaExperiencesService: MediaExperiencesService,\r\n private mediaMakersService: MediaMakerService) {\r\n this.config = { aspectRatio: this.aspectratio, preview: '', autoCropArea: 1 };\r\n }\r\n\r\n\r\n\r\n insertImage(files: FileList, destination: string) {\r\n this.config.aspectRatio = this.aspectratio;\r\n this.config.preview = '.' + this.preview;\r\n const fileItem = files.item(0);\r\n if (fileItem === null || fileItem.type.indexOf('image') < 0) {\r\n this.featuredFileToUpload = null;\r\n return;\r\n }\r\n this.featuredFileToUpload = fileItem;\r\n const reader = new FileReader();\r\n reader.readAsDataURL(fileItem);\r\n\r\n reader.onloadend = (progress) => {\r\n this[destination] = reader.result;\r\n if (this.angularCropper) {\r\n this.angularCropper.cropper.destroy();\r\n }\r\n return this[destination];\r\n };\r\n }\r\n\r\n uploadFeaturedFile(event: any) {\r\n this.loading = true;\r\n event.preventDefault();\r\n\r\n function toFile(b: any, name: string) {\r\n b.lastModifiedDate = new Date();\r\n b.name = name;\r\n return b as File;\r\n }\r\n\r\n this.angularCropper.cropper.getCroppedCanvas({ maxWidth: 1920, maxHeight: 520, minWidth: 1080, minHeight: 340 }).toBlob(\r\n (blobToUpload: Blob) => {\r\n const fileToUpload = toFile(blobToUpload, this.featuredFileToUpload.name);\r\n this.fileUploadSub = this.mediaMakersService.mediaMakersUpload(\r\n fileToUpload, '/media_makers_staffs',\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n },\r\n 'image/jpeg', 1);\r\n }\r\n\r\n handleProgress(event) {\r\n if (event.type === HttpEventType.DownloadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.UploadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.Response) {\r\n // console.log(event.body);\r\n this.uploadComplete = true;\r\n this.uploadingProgressing = false;\r\n this.serverResponse = event.body;\r\n\r\n this.didUploadImage = { id: event.body['@id'], url: event.body['contentUrl'] };\r\n this.uploadedImage.emit(this.didUploadImage);\r\n this.loading = false;\r\n }\r\n }\r\n}\r\n","\r\n\r\n
\r\n
{{ 'Selecciona el area de la Imagen' | translate}}
\r\n
\r\n
\r\n
\r\n
{{ 'Previsualización' | translate}}
\r\n
\r\n
\r\n {{ 'Subir Imagen' | translate}} \r\n \r\n
\r\n
\r\n Loading... \r\n
\r\n
\r\n
\r\n
\r\n","import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';\r\nimport { UntypedFormBuilder } from '@angular/forms';\r\nimport { HttpEventType } from '@angular/common/http';\r\n\r\nimport { Subscription } from 'rxjs';\r\n\r\nimport { CropperComponent as AngularCropperjsComponent } from 'angular-cropperjs';\r\n\r\n\r\nimport { MediaExperiencesService } from '../../experiences/experiences/media-experiences.service';\r\nimport { MediaMakerService } from '../../maker/maker-profile/media-maker';\r\nimport { TranslateService } from '@ngx-translate/core';\r\n\r\n@Component({\r\n selector: 'app-cropper-4',\r\n styleUrls: ['./cropper.component.scss'],\r\n templateUrl: './cropper4.component.html',\r\n})\r\nexport class Cropper4Component {\r\n\r\n @Input() aspectratio: number;\r\n @Input() preview: string;\r\n @Input() type: string;\r\n @ViewChild('angularCropper4', { static: false }) public angularCropper: AngularCropperjsComponent;\r\n @Output() uploadedImage = new EventEmitter();\r\n didUploadImage = {};\r\n featuredImageTemp4 = '';\r\n config;\r\n\r\n featuredFileToUpload: File = null;\r\n fileUploadSub: Subscription;\r\n translate: TranslateService;\r\n uploadProgress = 0;\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n\r\n loading = false;\r\n\r\n constructor(private fb: UntypedFormBuilder,\r\n private mediaExperiencesService: MediaExperiencesService,\r\n private mediaMakersService: MediaMakerService) {\r\n this.config = { aspectRatio: this.aspectratio, preview: '', autoCropArea: 1 };\r\n }\r\n\r\n\r\n\r\n insertImage(files: FileList, destination: string) {\r\n this.config.aspectRatio = this.aspectratio;\r\n this.config.preview = '.' + this.preview;\r\n const fileItem = files.item(0);\r\n if (fileItem === null || fileItem.type.indexOf('image') < 0) {\r\n this.featuredFileToUpload = null;\r\n return;\r\n }\r\n this.featuredFileToUpload = fileItem;\r\n const reader = new FileReader();\r\n reader.readAsDataURL(fileItem);\r\n\r\n reader.onloadend = (progress) => {\r\n this[destination] = reader.result;\r\n if (this.angularCropper) {\r\n this.angularCropper.cropper.destroy();\r\n }\r\n return this[destination];\r\n };\r\n }\r\n\r\n uploadFeaturedFile(event: any) {\r\n this.loading = true;\r\n event.preventDefault();\r\n\r\n function toFile(b: any, name: string) {\r\n b.lastModifiedDate = new Date();\r\n b.name = name;\r\n return b as File;\r\n }\r\n\r\n this.angularCropper.cropper.getCroppedCanvas({ maxWidth: 250, maxHeight: 100, minWidth: 250, minHeight: 100, fillColor: '#fff' }).toBlob(\r\n (blobToUpload: Blob) => {\r\n const fileToUpload = toFile(blobToUpload, this.featuredFileToUpload.name);\r\n this.fileUploadSub = this.mediaMakersService.mediaMakersUpload(\r\n fileToUpload, '/media_makers',\r\n null).subscribe(\r\n uploadProgress => {\r\n this.handleProgress(uploadProgress);\r\n },\r\n error => {\r\n });\r\n },\r\n 'image/jpeg', 1);\r\n }\r\n\r\n handleProgress(event) {\r\n if (event.type === HttpEventType.DownloadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.UploadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.Response) {\r\n // console.log(event.body);\r\n this.uploadComplete = true;\r\n this.uploadingProgressing = false;\r\n this.serverResponse = event.body;\r\n\r\n this.didUploadImage = { id: event.body['@id'], url: event.body['contentUrl'] };\r\n this.uploadedImage.emit(this.didUploadImage);\r\n this.loading = false;\r\n }\r\n }\r\n}\r\n","\r\n\r\n
\r\n
{{ 'Selecciona el area de la Imagen' | translate}}
\r\n
\r\n
\r\n
\r\n
{{ 'Previsualización' | translate}}
\r\n
\r\n
\r\n {{ 'Subir Imagen' | translate}} \r\n \r\n
\r\n
\r\n Loading... \r\n
\r\n
\r\n
\r\n
\r\n","import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';\r\nimport { HttpEventType } from '@angular/common/http';\r\nimport { Subscription } from 'rxjs';\r\nimport { CropperComponent as AngularCropperjsComponent } from 'angular-cropperjs';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { CmsService } from '../../cms/service/cms.service';\r\n\r\n\r\n@Component({\r\n selector: 'app-full-width-cropper',\r\n styleUrls: ['./cropper.component.scss'],\r\n templateUrl: './full-width-cropper.component.html',\r\n})\r\nexport class FullWidthCropperComponent {\r\n\r\n @Input() valueId;\r\n @Input() loadedImages: number;\r\n @Input() aspectratio: number;\r\n @Input() preview: string;\r\n @Input() type: string;\r\n @ViewChild('fwangularCropper', { static: false }) public angularCropper: AngularCropperjsComponent;\r\n @Output() uploadedImage = new EventEmitter();\r\n @Output() isTooManyImages = new EventEmitter();\r\n didUploadImage = {};\r\n featuredImageTempFw = '';\r\n config;\r\n\r\n featuredFileToUpload: File = null;\r\n fileUploadSub: Subscription;\r\n translate: TranslateService;\r\n uploadProgress = 0;\r\n uploadingProgressing = false;\r\n uploadComplete = false;\r\n serverResponse: any;\r\n filesList: any;\r\n filesDestination: any;\r\n\r\n loading = false;\r\n\r\n constructor(private cmsService: CmsService) {\r\n this.config = { aspectRatio: this.aspectratio, preview: '', autoCropArea: 1 };\r\n }\r\n\r\n insertImage(files: any, destination: string) {\r\n\r\n if (this.loadedImages + files.length > 10) {\r\n this.isTooManyImages.emit(true)\r\n console.log('demasiadas imagenes');\r\n return\r\n }\r\n this.filesList = files;\r\n this.filesDestination = destination;\r\n\r\n this.config.aspectRatio = this.aspectratio;\r\n this.config.preview = '.' + this.preview;\r\n var fileItem = files[0];\r\n\r\n if (fileItem === null || fileItem.type.indexOf('image') < 0) {\r\n this.featuredFileToUpload = null;\r\n return;\r\n }\r\n this.featuredFileToUpload = fileItem;\r\n const reader = new FileReader();\r\n reader.readAsDataURL(fileItem);\r\n\r\n reader.onloadend = (progress) => {\r\n this[destination] = reader.result;\r\n if (this.angularCropper) {\r\n this.angularCropper.cropper.destroy();\r\n }\r\n return this[destination];\r\n };\r\n\r\n }\r\n\r\n uploadFeaturedFile(event: any) {\r\n this.loading = true;\r\n event.preventDefault();\r\n\r\n function toFile(b: any, name: string) {\r\n b.lastModifiedDate = new Date();\r\n b.name = name;\r\n return b as File;\r\n }\r\n\r\n this.angularCropper.cropper.getCroppedCanvas({ maxWidth: 4096, maxHeight: 2160, minWidth: 290, minHeight: 232, fillColor: '#fff' }).toBlob(\r\n (blobToUpload: Blob) => {\r\n const fileToUpload = toFile(blobToUpload, this.featuredFileToUpload.name);\r\n this.fileUploadSub = this.cmsService.cmsMediaUpload(fileToUpload, '/media_objects', null).subscribe((resp: any) => {\r\n let data = {valueMedia: [resp['@id']]}\r\n this.cmsService.update(this.valueId, 'dynamic_values', data).subscribe((resp: any) => {\r\n this.loading = false;\r\n });\r\n });\r\n },\r\n 'image/jpeg', 1);\r\n\r\n let fileListArr = Array.from(this.filesList)\r\n \r\n if (fileListArr.length > 1) {\r\n fileListArr.splice(0, 1) // here u remove the file\r\n this.insertImage(fileListArr, this.filesDestination);\r\n } else {\r\n this.featuredImageTempFw = '';\r\n }\r\n\r\n }\r\n\r\n handleProgress(event) {\r\n if (event.type === HttpEventType.DownloadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.UploadProgress) {\r\n this.uploadingProgressing = true;\r\n this.uploadProgress = Math.round(100 * event.loaded / event.total);\r\n }\r\n\r\n if (event.type === HttpEventType.Response) {\r\n // console.log(event.body);\r\n this.uploadComplete = true;\r\n this.uploadingProgressing = false;\r\n this.serverResponse = event.body;\r\n\r\n this.didUploadImage = { id: event.body['@id'], url: event.body['contentUrl'] };\r\n this.uploadedImage.emit(this.didUploadImage);\r\n this.loading = false;\r\n }\r\n }\r\n}\r\n","\r\n\r\n
\r\n
{{ 'Selecciona el area de la Imagen' | translate}}
\r\n
\r\n
\r\n
\r\n
{{ 'Previsualización' | translate}}
\r\n
\r\n
\r\n {{ 'Subir Imagen' | translate}} \r\n \r\n
\r\n
\r\n Loading... \r\n
\r\n
\r\n
\r\n
","import { UntypedFormGroup, ValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';\r\n\r\n/**\r\n * Custom validator functions for reactive form validation\r\n */\r\nexport class CustomValidators {\r\n /**\r\n * Validates that child controls in the form group are equal\r\n */\r\n\r\n static dniOrNieValidator(control: AbstractControl) {\r\n const validChars = 'TRWAGMYFPDXBNJZSQVHLCKET';\r\n const nifRexp = /^[0-9]{8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/i;\r\n const nieRexp = /^[XYZ]{1}[0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/i;\r\n const str = control.value ? control.value.toString().toUpperCase() : '';\r\n\r\n const isNIF = nifRexp.test(str);\r\n const isNIE = nieRexp.test(str);\r\n if (!isNIF && !isNIE) {\r\n return {\r\n dniOrNie: 'Formato de documento no válido',\r\n };\r\n }\r\n\r\n const nie = str\r\n .replace(/^[X]/, '0')\r\n .replace(/^[Y]/, '1')\r\n .replace(/^[Z]/, '2');\r\n\r\n const letter = str.substr(-1);\r\n const charIndex = parseInt(nie.substr(0, 8), 10) % 23;\r\n if (validChars.charAt(charIndex) !== letter) {\r\n return {\r\n dniOrNie: 'La letra no coincide con el documento',\r\n };\r\n }\r\n return null;\r\n }\r\n\r\n static spanishDocumentValidator: ValidatorFn = (formGroup: UntypedFormGroup) => {\r\n if (formGroup.get('country').value.code !== 'ES') {\r\n return null;\r\n }\r\n const str = formGroup.get('document').value ? formGroup.get('document').value.toString().toUpperCase() : '';\r\n\r\n if (CustomValidators.isValidCif(str) === null) {\r\n return null;\r\n } else {\r\n return CustomValidators.dniOrNieValidator(formGroup.get('document'));\r\n }\r\n }\r\n\r\n static isValidCif(cif) {\r\n if (!cif || cif.length !== 9) {\r\n return {\r\n invalidCif: 'Documento inválido',\r\n };\r\n }\r\n\r\n const letters = ['J', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'];\r\n const digits = cif.substr(1, cif.length - 2);\r\n const letter = cif.substr(0, 1);\r\n const control = cif.substr(cif.length - 1);\r\n let sum = 0;\r\n let i;\r\n let digit;\r\n\r\n if (!letter.match(/[A-Z]/)) {\r\n return {\r\n invalidCif: 'Documento inválido',\r\n };\r\n }\r\n\r\n for (i = 0; i < digits.length; ++i) {\r\n digit = parseInt(digits[i], 10);\r\n\r\n if (isNaN(digit)) {\r\n return {\r\n invalidCif: 'Documento inválido',\r\n };\r\n }\r\n\r\n if (i % 2 === 0) {\r\n digit *= 2;\r\n if (digit > 9) {\r\n digit = Math.floor(digit / 10) + (digit % 10);\r\n }\r\n\r\n sum += digit;\r\n } else {\r\n sum += digit;\r\n }\r\n }\r\n\r\n sum %= 10;\r\n if (sum !== 0) {\r\n digit = 10 - sum;\r\n } else {\r\n digit = sum;\r\n }\r\n\r\n if (letter.match(/[ABEH]/)) {\r\n return String(digit) === control ? null : {\r\n invalidCif: 'Documento inválido',\r\n };\r\n }\r\n if (letter.match(/[NPQRSW]/)) {\r\n return letters[digit] === control ? null : {\r\n invalidCif: 'Documento inválido',\r\n };\r\n }\r\n\r\n return String(digit) === control || letters[digit] === control ? null : {\r\n invalidCif: 'Documento inválido',\r\n };\r\n }\r\n\r\n static domainsRestriction(allowedDomains: any = '') {\r\n return (control: AbstractControl): { [key: string]: any } | null => {\r\n if (!control.value) {\r\n return null;\r\n }\r\n const currentDomain = '@' + control.value.split('@')[1];\r\n if (control.value === null || control.value === '' || !allowedDomains ||\r\n allowedDomains.length === 0 || allowedDomains.includes(currentDomain)) {\r\n return null;\r\n } else {\r\n return { unallowedDomain: { value: control.value } };\r\n }\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Collection of reusable RegExps\r\n */\r\nexport const regExps: { [key: string]: RegExp } = {\r\n password: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]{4,15}$/,\r\n url: /^(http(s)?:\\/\\/)(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,10}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$/,\r\n phone: /^\\+\\d{7}\\d{0,12}$/,\r\n domain: /^(@[-a-zA-Z0-9._]{2,256}\\.[a-z]{2,14})(\\,\\s?@[-a-zA-Z0-9._]{2,256}\\.[a-z]{2,14})*$/,\r\n lettersAndNumbers: /^([A-Za-z0-9 \\xc0-\\xff\\d])*$/i,\r\n onlyLetters: /^([A-Za-zÀ-ÖØ-öø-ÿ ])+$/,\r\n onlyNumbers: /^([0-9])+$/\r\n};\r\n\r\n/**\r\n * Collection of reusable error messages\r\n */\r\nexport const errorMessages: ValidationErrors = {\r\n languageName: 'El nombre del idioma es obligatorio',\r\n locationName: 'El nombre de la localidad es obligatorio',\r\n countryName: 'El nombre del país es obligatorio',\r\n categoryName: 'El nombre de la categoría es obligatorio',\r\n password: 'La contraseña debe tener entre 5 y 15 caracteres, y contener al menos una mayúscula, una minúscula y un número',\r\n makerDocumentType: 'El tipo de documento es obligatorio',\r\n document: 'El documento debe ser válido',\r\n makerName: 'El nombre del maker es obligatorio',\r\n makerWeb: 'La url debe ser un enlace válido (ej: https://ejemplo.com)',\r\n tripadvisor: 'El id de tripadvisor es obligatorio',\r\n description: 'La descripción del maker es obligatoria',\r\n founders: 'Los fundadores son obligatorios',\r\n director: 'El director es obligatorio',\r\n operations: 'Operaciones & Viper Team manager es obligatorio',\r\n technology: 'Tecnología de reservas es obligatoria',\r\n customerId: 'El id de cliente es obligatorio',\r\n instagram: 'El instagram es obligatorio',\r\n twitter: 'El twitter es obligatorio',\r\n linkedIn: 'LinkedIn es obligatorio',\r\n facebook: 'Facebook es obligatorio',\r\n mediaMaker: 'El logo del maker es obligatorio',\r\n email: 'El email debe ser un correo electrónico válido (ej: nombre@ejemplo.com)',\r\n phone: 'El teléfono debe ser válido (ej: +34600123123)',\r\n mediaContacts: 'El avatar del contacto es obligatorio',\r\n companyName: 'La denominación social es obligatoria',\r\n contactName: 'El nombre del contacto es obligatorio',\r\n contactLastname:'El apellido del contacto es obligatorio',\r\n contactPosition: 'El cargo del contacto es obligatorio',\r\n contactEmail: 'El email del contacto es obligatorio',\r\n contactPhone: 'El teléfono del contacto es obligatorio',\r\n experienceName: 'El nombre de la experiencia es obligatorio',\r\n experienceUrl: 'La url debe ser un enlace válido (ej: https://ejemplo.com)',\r\n experienceUrlButtonText: 'El texto del botón es obligatorio',\r\n experienceDescription: 'La descripción de la experiencia debe tener entre 120 y 600 caracteres',\r\n experienceDuration: 'La duración de la experiencia es obligatoria',\r\n experienceLanguages: 'El idioma de la experiencia es obligatorio',\r\n experienceCategories: 'La categoría de la experiencia es obligatoria',\r\n experienceTags: 'La etiqueta de la experiencia es obligatoria',\r\n experienceCountry: 'El país de la experiencia es obligatorio',\r\n experienceLocation: 'La localidad de la experiencia es obligatoria',\r\n experienceMaker: 'El maker de la expeiencia es obligatorio',\r\n mediaExperiences: 'Mínimo 5 y máximo 10 imagenes',\r\n expandedMediaExperiences: 'Mínimo 5 imagenes',\r\n role: 'El tipo de usuario es obligatorio',\r\n promotion: 'La descripción de la promoción es obligatoria',\r\n resellerName: 'El nombre del reseller es obligatorio',\r\n fiscalName: 'El nombre fiscal del reseller es obligatorio',\r\n address: 'La dirección del reseller es obligatoria',\r\n cp: 'El código postal del reseller es obligatorio',\r\n mediaReseller: 'El logo del reseller es obligatorio',\r\n resellerCategories: 'La categoría del reseller es obligatoria',\r\n resellerTags: 'La etiqueta del reseller es obligatoria',\r\n experienceWhyUs: 'El campo debe tener entre 120 y 600 caracteres',\r\n experiencePersons: 'La cantidad de personas es obligatoria',\r\n experiencePrice: 'Debe introducir un precio',\r\n experienceCancellation: 'Debe introducir una cancelación',\r\n experienceFareharbor: 'El id de fareharbor es obligatorio',\r\n experienceTypePrice: 'El tipo de precio es obligatorio',\r\n experienceWeekDays: 'Introduce los días de la experiencia',\r\n experienceFromDate: 'Indica la fecha de inicio de temporada de la actividad',\r\n experienceToDate: 'Indica la fecha de fin de la temporada de la actividad',\r\n experienceZone: 'Indica la zona de la experiencia',\r\n experienceSlug: 'Indica un titulo para el SEO de tu experiencia'\r\n};\r\n\r\n\r\nexport function getMessage(errorIndex: string, error: any = {}) {\r\n const messages: ValidationErrors = {\r\n ...errorMessages,\r\n };\r\n\r\n return messages[errorIndex];\r\n}\r\n\r\nexport function getMessageTranslations(errorIndex: string, error: any = {}, translateService) {\r\n const messages: ValidationErrors = {\r\n invalidAge: translateService.instant('Para este evento debes tener entre ') + error.minAge +\r\n translateService.instant(' y ') + error.maxAge + translateService.instant(' años ') +\r\n translateService.instant(error.when) + translateService.instant(' y ') + translateService.instant(' tendrás ') + error.age\r\n };\r\n\r\n return messages[errorIndex];\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';\r\n\r\nimport { Observable } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\n\r\nimport { AuthService } from './auth.service';\r\n\r\n@Injectable()\r\nexport class LoggedInGuard implements CanActivate {\r\n constructor(private authService: AuthService,\r\n private router: Router) {\r\n }\r\n\r\n canActivate(\r\n next: ActivatedRouteSnapshot,\r\n state: RouterStateSnapshot): Observable | Promise | boolean {\r\n return this.authService.isAuthenticated().pipe(\r\n map(isLoggedIn => {\r\n if (isLoggedIn) {\r\n this.router.navigateByUrl('experiencias');\r\n }\r\n\r\n return !isLoggedIn;\r\n }));\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { HttpClient, HttpParams } from '@angular/common/http';\r\nimport { environment } from '../../../environments/environment';\r\nimport { Maker, MakerCollection } from '../maker/maker-profile/maker.model';\r\nimport { LocationCollection } from '../../shared/locations/location.model';\r\n\r\nconst API_URL = environment.apiUrl;\r\nconst CMS_API_URL = environment.cmsApiUrl;\r\n\r\n@Injectable()\r\nexport class MakerService {\r\n constructor(private http: HttpClient) { }\r\n\r\n public getMakers(filters?: any): Observable {\r\n if (filters === undefined) { filters = {}; }\r\n\r\n let httpParams = new HttpParams();\r\n\r\n if (filters['name']) {\r\n httpParams = httpParams.set('name', String(filters.name));\r\n }\r\n if (filters['document']) {\r\n httpParams = httpParams.set('document', String(filters.document));\r\n }\r\n if (filters['phone']) {\r\n httpParams = httpParams.set('phone', String(filters.phone));\r\n }\r\n if (filters['email']) {\r\n httpParams = httpParams.set('email', String(filters.email));\r\n }\r\n if (filters['web']) {\r\n httpParams = httpParams.set('web', String(filters.web));\r\n }\r\n if (filters['locations']) {\r\n filters.locations.forEach(location =>\r\n httpParams = httpParams.append('experiences.location.id[]', location)\r\n );\r\n }\r\n if (filters['isFavorites']) {\r\n httpParams = httpParams.append('resellers.id[]', String(filters.resellerId));\r\n }\r\n if (filters['isFavoritesProducts']) {\r\n httpParams = httpParams.append('experiences.resellerFavoriteExperiences.reseller.id', String(filters.resellerId));\r\n }\r\n\r\n if (filters['categorias']) {\r\n filters.categorias.split(',').forEach(category =>\r\n httpParams = httpParams.append('experiences.categories.id[]', category)\r\n );\r\n }\r\n\r\n if (filters['localidad']) {\r\n httpParams = httpParams.append('location', String(filters.localidad));\r\n }\r\n\r\n if (filters['page']) {\r\n httpParams = httpParams.append('page', String(filters.page));\r\n }\r\n\r\n return this.http\r\n .get(API_URL + '/makers?directoryCompleted=true&order[makerPlan.plan.level]' , { params: httpParams });\r\n }\r\n\r\n public getMakersByUrl(filters: any, language): Observable {\r\n let httpParams = new HttpParams();\r\n\r\n filters.forEach((value, key) => {\r\n if (key == 'categorias') {\r\n value.split(',').forEach(category =>\r\n httpParams = httpParams.append('experiences.categories.id[]', category)\r\n );\r\n }\r\n if (key == 'localidad') {\r\n httpParams = httpParams.set('location', String(value));\r\n }\r\n if (key == 'page') {\r\n httpParams = httpParams.append('page', String(value));\r\n }\r\n });\r\n\r\n return this.http\r\n .get(API_URL + '/makers?directoryCompleted=true&order[makerPlan.plan.level]' , { params: httpParams });\r\n }\r\n\r\n\r\n public getMakerByUserId(userId: number): Observable {\r\n return this.http\r\n .get(API_URL + '/users/' + userId + '/maker');\r\n }\r\n \r\n public getMakerById(makerId: number): Observable {\r\n return this.http\r\n .get(API_URL + '/makers/' + makerId);\r\n }\r\n\r\n public getMakersByResellerId(resellerId: string, filters: any): Observable {\r\n if (filters === undefined) { filters = {}; }\r\n\r\n let httpParams = new HttpParams();\r\n\r\n if (filters['name']) {\r\n httpParams = httpParams.set('maker.name', String(filters.name));\r\n }\r\n if (filters['phone']) {\r\n httpParams = httpParams.set('maker.phone', String(filters.phone));\r\n }\r\n if (filters['email']) {\r\n httpParams = httpParams.set('maker.email', String(filters.email));\r\n }\r\n if (filters['web']) {\r\n httpParams = httpParams.set('maker.web', String(filters.web));\r\n }\r\n if (filters['locations']) {\r\n filters.locations.forEach(location =>\r\n httpParams = httpParams.append('maker.experiences.location.id[]', location)\r\n );\r\n }\r\n if (filters['isFavoritesProducts']) {\r\n httpParams = httpParams.append('maker.experiences.resellerFavoriteExperiences.reseller.id', resellerId);\r\n }\r\n return this.http\r\n .get(API_URL + '/resellers/' + resellerId + '/favorite_makers', { params: httpParams });\r\n }\r\n\r\n public getMaker(makerId: string, language = 'es'): Observable {\r\n return this.http\r\n .get(API_URL + makerId, {\r\n headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n\r\n public getMakerBySlug(makerSlug: string, language = 'es'): Observable {\r\n return this.http\r\n .get(API_URL + '/makers/?slug=' + makerSlug, {\r\n headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n\r\n public getInvoices(stripeCustomerId): Observable {\r\n return this.http\r\n .get(API_URL + '/maker_plans/invoices/' + stripeCustomerId);\r\n }\r\n\r\n public getInvoicePdf(stripeCustomerId): Observable {\r\n return this.http\r\n .get(API_URL + '/maker_plans/invoice/' + stripeCustomerId + '/pdf');\r\n }\r\n\r\n public getPlans() {\r\n return this.http\r\n .get(API_URL + '/plans');\r\n }\r\n\r\n public getPlanByMakerId(id) {\r\n return this.http\r\n .get(API_URL + '/plans/' + id + '/maker_plans');\r\n }\r\n\r\n // public getInvoices(stripeCustomerId): Observable {\r\n // return this.http\r\n // .get('https://api.stripe.com/v1/invoices', { headers: {\r\n // Authorization: `Bearer sk_test_ZZVWqw6sdmB1TkkjxGpVucGd`\r\n // }, params: {customer: stripeCustomerId}});\r\n // }\r\n\r\n public getName() {\r\n return JSON.parse(localStorage.getItem('maker')) ? JSON.parse(localStorage.getItem('maker'))['name'] : null;\r\n }\r\n \r\n public getUserMail() {\r\n return JSON.parse(localStorage.getItem('user')) ? JSON.parse(localStorage.getItem('user'))['email'] : null;\r\n }\r\n\r\n public getId() {\r\n return JSON.parse(localStorage.getItem('maker')) ? JSON.parse(localStorage.getItem('maker'))['id'] : null;\r\n }\r\n /* public getGroupId() {\r\n return JSON.parse(localStorage.getItem('group')) ? JSON.parse(localStorage.getItem('group'))['id'] : null;\r\n } */\r\n\r\n public putMaker(makerId: string, maker: Maker, language = 'es'): Observable {\r\n return this.http\r\n .put(API_URL + '/makers/' + makerId, maker, {\r\n headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n\r\n public postMaker(maker): Observable {\r\n return this.http\r\n .post(API_URL + '/makers', maker);\r\n }\r\n\r\n public postContact(contact): Observable {\r\n return this.http\r\n .post(API_URL + '/contacts', contact);\r\n }\r\n public postGroup(group): Observable {\r\n return this.http\r\n .post(API_URL + '/contact_groups', group);\r\n }\r\n\r\n public postFreeMakerPlan(makerPlan): Observable {\r\n return this.http\r\n .post(API_URL + '/maker_plans', makerPlan);\r\n }\r\n\r\n public sendFreeMakerPlanEmail(makerPlan): Observable {\r\n return this.http\r\n .post(API_URL + '/maker_plans/send_free_maker_plan_email', makerPlan);\r\n }\r\n\r\n public postMakerContact(makerContact): Observable {\r\n return this.http\r\n .post('https://hooks.zapier.com/hooks/catch/8831384/3pqn9kv', makerContact, {\r\n headers: {\r\n 'Content-Type': 'application/x-www-form-urlencoded'\r\n }\r\n });\r\n }\r\n\r\n public deleteContact(contactId: string): any {\r\n return this.http.delete(API_URL + contactId);\r\n }\r\n public deleteGroup(contact_groupsId: string): any {\r\n return this.http.delete(API_URL + contact_groupsId);\r\n }\r\n\r\n public getStripeCustomer(stripeCustomerId: string): Observable {\r\n return this.http\r\n .get(API_URL + '/stripe_customer/' + stripeCustomerId);\r\n }\r\n\r\n public getContact(contactId: string, language = 'es'): Observable {\r\n return this.http\r\n .get(API_URL + '/contacts/' + contactId, {\r\n headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n public getGroup(contact_groupsId: string, language = 'es'): Observable {\r\n return this.http\r\n .get(API_URL + '/contact_groups/' + contact_groupsId, {\r\n headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n\r\n public getGroups(): Observable {\r\n return this.http\r\n .get(API_URL + '/contact_groups'\r\n );\r\n }\r\n\r\n public getContactsByMakerId(makerId: number, filters?: any, language = 'es'): Observable {\r\n if (filters === undefined) { filters = {}; }\r\n\r\n let httpParams = new HttpParams();\r\n\r\n if (filters['name']) {\r\n httpParams = httpParams.set('name', String(filters.name));\r\n }\r\n if (filters['group']) {\r\n httpParams = httpParams.set('contactGroups.name', String(filters.group));\r\n }\r\n\r\n return this.http\r\n .get(API_URL + '/makers/' + makerId + '/contacts',\r\n {\r\n params: httpParams, headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n public getContactsGroupsByMakerId(makerId: number): Observable {\r\n return this.http\r\n .get(API_URL + '/makers/' + makerId + '/contacts_groups');\r\n }\r\n\r\n public putContact(contactId: string, contact, language = 'es'): Observable {\r\n return this.http\r\n .put(API_URL + '/contacts/' + contactId, contact, {\r\n headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n public putGroup(contact_groupsId: string, group, language = 'es'): Observable {\r\n return this.http\r\n .put(API_URL + '/contact_groups/' + contact_groupsId, group, {\r\n headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n\r\n public putGroupIri(contact_groupsId: string, group, language = 'es'): Observable {\r\n return this.http\r\n .put(API_URL + contact_groupsId, group, {\r\n headers: {\r\n 'Accept-Language': language\r\n }\r\n });\r\n }\r\n\r\n public postFavoriteReseller(favoriteReseller): Observable {\r\n return this.http\r\n .post(API_URL + '/favorite_resellers', favoriteReseller);\r\n }\r\n\r\n public deleteFavoriteReseller(favoriteResellerId: string): any {\r\n return this.http.delete(API_URL + favoriteResellerId);\r\n }\r\n\r\n public putFavoriteReseller(favoriteResellerId: string, favoriteReseller: any): Observable {\r\n return this.http\r\n .put(API_URL + favoriteResellerId, favoriteReseller);\r\n }\r\n\r\n public postDirectoryAnalytics(directoryAnalytics): Observable {\r\n return this.http\r\n .post(API_URL + '/directory_analytics', directoryAnalytics);\r\n }\r\n\r\n public postPdfFile(file): Observable {\r\n return this.http\r\n .post(API_URL + '/media_makers_docs', file);\r\n }\r\n\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { TranslateService } from '@ngx-translate/core';\r\n\r\n@Component({\r\n selector: 'app-redirect',\r\n templateUrl: './redirect.component.html',\r\n styleUrls: ['./redirect.component.css']\r\n})\r\nexport class RedirectComponent implements OnInit {\r\n\r\n name: string;\r\n makerLogo: string;\r\n slug: string;\r\n experience: any;\r\n\r\n constructor(private router: Router, private experienceService: ExperiencesService, private route: ActivatedRoute, public translate: TranslateService) { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n ngAfterViewInit() {\r\n this.slug = this.router['rawUrlTree'].root.children.primary.segments[2].path;\r\n\r\n this.experienceService.getExperienceBySlug(this.slug, this.translate.getDefaultLang()).subscribe(experience => {\r\n\r\n this.experience = experience['hydra:member'][0];\r\n\r\n this.name = this.experience.name;\r\n this.makerLogo = 'https://venntur.com/assets/maker/files/' + this.experience.maker.mediaMakers[0].contentUrl;\r\n\r\n setTimeout(() => {\r\n const params:any = new URL(this.experience.url);\r\n\r\n if (params.search) {\r\n window.location.href = !this.experience.civitatisId ? this.experience.url + '&utm_source=venntur' : this.experience.url + '&ag_aid=4732';\r\n } else {\r\n window.location.href = !this.experience.civitatisId ? this.experience.url + '?utm_source=venntur' : this.experience.url + '?ag_aid=4732';\r\n }\r\n }, 2500);\r\n });\r\n }\r\n}\r\n","\r\n\r\n\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n\r\n
La mejor experiencia de compra la encontrarás en la página del proveedor \r\n
Te estamos redirigiendo a la experiencia: \r\n
{{ name }} \r\n
Vuelve cuando quieras a venntur.com a seleccionar los mejores anfitriones para tus Vacaciones \r\n
¡Las experiencias nos unen! \r\n
\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { HttpClient, HttpParams } from '@angular/common/http';\r\nimport { environment } from '../../../environments/environment';\r\nimport { Reseller, ResellerCollection } from '../reseller/reseller-profile/reseller.model';\r\n\r\nconst API_URL = environment.apiUrl;\r\n\r\n@Injectable()\r\nexport class ResellerService {\r\n constructor(private http: HttpClient) { }\r\n\r\n public getResellers(filters?: any): Observable {\r\n if (filters === undefined) { filters = {}; }\r\n\r\n let httpParams = new HttpParams();\r\n\r\n if (filters['name']) {\r\n httpParams = httpParams.set('name', String(filters.name));\r\n }\r\n if (filters['fiscalName']) {\r\n httpParams = httpParams.set('fiscalName', String(filters.fiscalName));\r\n }\r\n if (filters['urlWeb']) {\r\n httpParams = httpParams.set('urlWeb', String(filters.urlWeb));\r\n }\r\n if (filters['tags']) {\r\n filters.tags.forEach( tag =>\r\n httpParams = httpParams.append('tags.id[]', tag)\r\n );\r\n }\r\n if (filters['locations']) {\r\n filters.locations.forEach( location =>\r\n httpParams = httpParams.append('locations.id[]', location)\r\n );\r\n }\r\n if (filters['isFavorites']) {\r\n httpParams = httpParams.append('makers.id[]', String(filters.makerId));\r\n }\r\n return this.http\r\n .get(API_URL + '/resellers', { params: httpParams });\r\n }\r\n\r\n public getResellerByUserId(userId: number): Observable {\r\n return this.http\r\n .get(API_URL + '/users/' + userId + '/reseller');\r\n }\r\n\r\n public getResellersByMakerId(makerId: number, filters: any): Observable {\r\n if (filters === undefined) { filters = {}; }\r\n\r\n let httpParams = new HttpParams();\r\n\r\n if (filters['name']) {\r\n httpParams = httpParams.set('reseller.name', String(filters.name));\r\n }\r\n if (filters['fiscalName']) {\r\n httpParams = httpParams.set('reseller.fiscalName', String(filters.fiscalName));\r\n }\r\n if (filters['urlWeb']) {\r\n httpParams = httpParams.set('reseller.urlWeb', String(filters.urlWeb));\r\n }\r\n if (filters['tags']) {\r\n filters.tags.forEach( tag =>\r\n httpParams = httpParams.append('reseller.tags.id[]', tag)\r\n );\r\n }\r\n if (filters['locations']) {\r\n filters.locations.forEach( location =>\r\n httpParams = httpParams.append('reseller.locations.id[]', location)\r\n );\r\n }\r\n return this.http\r\n .get(API_URL + '/makers/' + makerId + '/favorite_resellers', { params: httpParams });\r\n }\r\n\r\n public getReseller(resellerId: string, language = 'es'): Observable {\r\n return this.http\r\n .get(API_URL + resellerId, { headers: {\r\n 'Accept-Language': language\r\n }});\r\n }\r\n\r\n public getName() {\r\n return JSON.parse(localStorage.getItem('reseller')) ? JSON.parse(localStorage.getItem('reseller'))['name'] : null;\r\n }\r\n\r\n public getId() {\r\n return JSON.parse(localStorage.getItem('reseller')) ? JSON.parse(localStorage.getItem('reseller'))['id'] : null;\r\n }\r\n\r\n public putReseller(resellerId: string, reseller: Reseller, language = 'es'): Observable {\r\n return this.http\r\n .put(API_URL + '/resellers/' + resellerId, reseller, { headers: {\r\n 'Accept-Language': language\r\n }});\r\n }\r\n\r\n public postReseller(reseller): Observable {\r\n return this.http\r\n .post(API_URL + '/resellers', reseller);\r\n }\r\n\r\n public postContact(contact): Observable {\r\n return this.http\r\n .post(API_URL + '/contacts', contact);\r\n }\r\n\r\n public deleteContact(contactId: string): any {\r\n return this.http.delete(API_URL + contactId);\r\n }\r\n\r\n public getContact(contactId: string, language = 'es'): Observable {\r\n return this.http\r\n .get(API_URL + '/contacts/' + contactId, { headers: {\r\n 'Accept-Language': language\r\n }});\r\n }\r\n\r\n public getContactsByResellerId(resellerId: number): Observable {\r\n return this.http\r\n .get(API_URL + '/resellers/' + resellerId + '/contacts');\r\n }\r\n\r\n public putContact(contactId: string, contact, language = 'es'): Observable {\r\n return this.http\r\n .put(API_URL + '/contacts/' + contactId, contact, { headers: {\r\n 'Accept-Language': language\r\n }});\r\n }\r\n\r\n public postFavoriteExperience(favoriteExperience): Observable {\r\n return this.http\r\n .post(API_URL + '/favorite_experiences', favoriteExperience);\r\n }\r\n\r\n public deleteFavoriteExperience(favoriteExperienceId: string): any {\r\n return this.http.delete(API_URL + favoriteExperienceId);\r\n }\r\n\r\n public putFavoriteExperience(favoriteExperienceId: string, favoriteExperience: any): Observable {\r\n return this.http\r\n .put(API_URL + favoriteExperienceId, favoriteExperience);\r\n }\r\n\r\n public postFavoriteMaker(favoriteMaker): Observable {\r\n return this.http\r\n .post(API_URL + '/favorite_makers', favoriteMaker);\r\n }\r\n\r\n public deleteFavoriteMaker(favoriteMakerId: string): any {\r\n return this.http.delete(API_URL + favoriteMakerId);\r\n }\r\n\r\n public putFavoriteMaker(favoriteMakerId: string, favoriteMaker: any): Observable {\r\n return this.http\r\n .put(API_URL + favoriteMakerId, favoriteMaker);\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { environment } from '../../../environments/environment';\r\nimport { Taker } from '../taker/taker-profile/taker.model';\r\n\r\n\r\nconst API_URL = environment.apiUrl;\r\n\r\n@Injectable()\r\nexport class TakerService {\r\n constructor(private http: HttpClient) { }\r\n\r\n public getTakerByUserId(userId: number): Observable {\r\n return this.http\r\n .get(API_URL + '/users/' + userId + '/taker');\r\n }\r\n\r\n public getTaker(takerId: number): Observable {\r\n return this.http\r\n .get(API_URL + takerId);\r\n }\r\n\r\n public getName() {\r\n return JSON.parse(localStorage.getItem('taker')) ? JSON.parse(localStorage.getItem('taker'))['name'] : null;\r\n }\r\n\r\n public getId() {\r\n return JSON.parse(localStorage.getItem('taker')) ? JSON.parse(localStorage.getItem('taker'))['id'] : null;\r\n }\r\n\r\n public putTaker(takerId: string, taker: any): Observable {\r\n return this.http\r\n .put(API_URL + '/takers/' + takerId, taker);\r\n }\r\n\r\n public postTaker(taker): Observable {\r\n return this.http\r\n .post(API_URL + '/takers', taker);\r\n }\r\n}\r\n","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-taker-admin',\r\n templateUrl: './taker-admin.component.html',\r\n styleUrls: ['./taker-admin.component.css']\r\n})\r\nexport class TakerAdminComponent {\r\n}\r\n","\r\n","import {Component, OnInit} from '@angular/core';\r\nimport { Experience } from '../../experiences/experiences/experience.model';\r\nimport { ExperiencesService } from '../../experiences/experiences/experiences.service';\r\nimport { Router } from '@angular/router';\r\nimport { Title } from '@angular/platform-browser';\r\nimport {TakerService} from '../../shared/taker.service';\r\n\r\n@Component({\r\n selector: 'app-taker-favorites',\r\n templateUrl: './taker-favorites.component.html',\r\n styleUrls: ['./taker-favorites.component.scss']\r\n})\r\nexport class TakerFavoritesComponent implements OnInit {\r\n public expandedIndex = -1;\r\n public originalExperiences: Experience[];\r\n experiences;\r\n public toggleFav = false;\r\n\r\n throttle = 150;\r\n scrollDistance = 0.1;\r\n notEmptyExperience = true;\r\n notScrolly = true;\r\n loading = false;\r\n\r\n constructor(\r\n private experienceService: ExperiencesService,\r\n private takerService: TakerService,\r\n private router: Router,\r\n private titleService: Title,\r\n ) {\r\n }\r\n\r\n ngOnInit(): void {\r\n // this.loading = true;\r\n this.experienceService.getExperiencesByTakerId(this.takerService.getId()).subscribe((experiences => {\r\n this.originalExperiences = experiences[ 'hydra:member' ];\r\n this.experiences = this.originalExperiences.slice(0, 10);\r\n }));\r\n }\r\n\r\n clickFavorite(event) {\r\n this.toggleFav = !this.toggleFav;\r\n }\r\n\r\n expandText(index: number): void {\r\n this.expandedIndex = index === this.expandedIndex ? -1 : index;\r\n }\r\n\r\n onScroll() {\r\n this.loading = true;\r\n if (this.notScrolly && this.notEmptyExperience) {\r\n this.notScrolly = false;\r\n setTimeout(() => {\r\n this.loadNextExperience();\r\n }, 500);\r\n } else {\r\n this.loading = false;\r\n }\r\n }\r\n\r\n loadNextExperience() {\r\n if (this.experiences.length < this.originalExperiences.length) {\r\n let i;\r\n const length = this.experiences.length;\r\n const experiencePerPage = 9;\r\n const experienceToLoad = this.originalExperiences.length - length;\r\n\r\n if ( experienceToLoad >= experiencePerPage ) {\r\n for (i = length; i <= length + experiencePerPage; i++) {\r\n this.experiences.push(this.originalExperiences[i]);\r\n }\r\n } else {\r\n for (i = length; i <= length + experienceToLoad - 1; i++) {\r\n this.experiences.push(this.originalExperiences[i]);\r\n }\r\n }\r\n this.notScrolly = true;\r\n } else {\r\n this.notEmptyExperience = false;\r\n }\r\n this.loading = false;\r\n }\r\n}\r\n"," Tus experiencias favoritas \r\n\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n {{experience.promotionType}} \r\n {{experience.promotion}}
\r\n \r\n \r\n \r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n \r\n
\r\n \r\n \r\n
\r\n \r\n\r\n
\r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n {{category.name}}{{i === experience.categories.length - 1 ? '' : ', '}}\r\n \r\n
\r\n
\r\n
{{experience.reviewTripadvisor}}
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { Title } from '@angular/platform-browser';\r\nimport { Taker } from './taker.model';\r\nimport { TakerService } from '../../shared/taker.service';\r\nimport { errorMessages } from '../../shared/custom-validators';\r\nimport { AuthService } from '../../shared/auth.service';\r\nimport {TranslateService} from '@ngx-translate/core';\r\nimport {UsersService} from '../../../shared/users/users.service';\r\nimport {User} from '../../../shared/users/user.model';\r\n\r\n@Component({\r\n selector: 'app-taker',\r\n templateUrl: './taker.component.html',\r\n styleUrls: ['./taker.component.css']\r\n})\r\nexport class TakerComponent implements OnInit {\r\n takerForm: UntypedFormGroup;\r\n taker: Taker;\r\n title = 'Perfil taker';\r\n alert = {message: null, type: null};\r\n errors = errorMessages;\r\n takerId = null;\r\n\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private router: Router,\r\n private activatedRoute: ActivatedRoute,\r\n private authService: AuthService,\r\n private userService: UsersService,\r\n private titleService: Title,\r\n private takerService: TakerService,\r\n public translate: TranslateService\r\n ) {\r\n if (this.takerService.getId()) {\r\n this.title = 'Editar perfil taker';\r\n this.takerId = '/takers/' + this.takerService.getId();\r\n }\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n if (this.takerId) {\r\n this.editTaker(this.takerId);\r\n }\r\n }\r\n\r\n createForm() {\r\n this.takerForm = this.formBuilder.group({\r\n name: [ '',\r\n Validators.required\r\n ],\r\n surname: [ '',\r\n Validators.required\r\n ],\r\n user: ['/users/' + this.authService.getUserId()]\r\n });\r\n }\r\n\r\n createTaker() {\r\n if (this.takerForm.invalid) {\r\n this.showErrors(this.takerForm);\r\n return;\r\n }\r\n const taker = {\r\n name: this.takerForm.get('name').value,\r\n surname: this.takerForm.get('surname').value,\r\n user: this.takerForm.get('user').value\r\n };\r\n this.takerService.postTaker(taker).subscribe(() => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Taker creado correctamente';\r\n setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n }, 5000);\r\n const roles = this.authService.roles();\r\n if (!roles.includes('ROLE_TAKER')) {\r\n roles.push('ROLE_TAKER');\r\n }\r\n const editedUser = new User({roles: roles});\r\n this.userService.putUser(this.authService.getUserId(), editedUser).subscribe(currentUser => {\r\n localStorage.setItem('user', JSON.stringify(currentUser));\r\n });\r\n this.takerService.getTakerByUserId(this.authService.getUserId()).subscribe(currentTaker => {\r\n this.taker = currentTaker;\r\n this.takerId = currentTaker.id;\r\n localStorage.setItem('taker', JSON.stringify({id: currentTaker.id , name: currentTaker.name}));\r\n });\r\n }, (error) => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {this.alert = {message: null, type: null};\r\n }, 5000);\r\n });\r\n }\r\n\r\n editTaker(takerId) {\r\n this.takerService.getTaker(takerId).subscribe((taker: Taker) => {\r\n this.taker = taker;\r\n this.takerForm.get('name').setValue(taker.name);\r\n this.takerForm.get('surname').setValue(taker.surname);\r\n });\r\n }\r\n\r\n updateTaker() {\r\n if (this.takerForm.invalid) {\r\n this.showErrors(this.takerForm);\r\n return;\r\n }\r\n const taker = {\r\n name: this.takerForm.get('name').value,\r\n surname: this.takerForm.get('surname').value\r\n };\r\n const editedTaker = new Taker(taker);\r\n this.takerService.putTaker(this.taker.id, editedTaker)\r\n .subscribe(\r\n (result) => {\r\n this.alert.type = 1;\r\n this.alert.message = 'Taker guardado correctamente';\r\n setTimeout(() => {\r\n this.alert = {message: null, type: null};\r\n }, 5000);\r\n },\r\n error => {\r\n this.alert.message = error.error.code + '- ' + error.error.message;\r\n this.alert.type = 2;\r\n setTimeout(() => {this.alert = {message: null, type: null};\r\n }, 5000);\r\n },\r\n () => console.log('complete'));\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n showError(formValue) {\r\n return this.takerForm.get(formValue).invalid && this.takerForm.get(formValue).touched;\r\n }\r\n}\r\n"," {{title}} \r\n\r\n
{{ 'Completa los datos del taker para poder añadir favoritos' | translate}}
\r\n
\r\n\r\n
{{alert.message}}
\r\n
\r\n\r\n
\r\n
\r\n {{ 'Datos públicos' | translate}} \r\n \r\n \r\n \r\n
\r\n
\r\n","export class TakerCollection {\r\n total: number;\r\n takers: Taker[];\r\n}\r\n\r\nexport class Taker {\r\n id: string;\r\n name: string;\r\n surname: string;\r\n favoriteExperiences: any[];\r\n user: string;\r\n constructor(values: any = {}) {\r\n Object.assign(this, values);\r\n }\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { errorMessages, regExps } from '../../shared/custom-validators';\r\nimport { UsersService } from '../../../shared/users/users.service';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { environment } from '../../../../environments/environment';\r\n\r\nconst FRONT_URL = environment.frontUrl;\r\n\r\n@Component({\r\n selector: 'app-contact-form',\r\n templateUrl: './contact-form.component.html'\r\n})\r\nexport class ContactFormComponent implements OnInit {\r\n contactForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n errors = errorMessages;\r\n public message = '';\r\n public isLoading = false;\r\n\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private userService: UsersService,\r\n public translate: TranslateService\r\n ) {\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n createForm() {\r\n this.contactForm = this.formBuilder.group({\r\n name: [ '', [\r\n Validators.required\r\n ]],\r\n phone: [ '', [\r\n Validators.required,\r\n Validators.pattern(regExps.phone)\r\n ]],\r\n acceptance: [ false, [\r\n Validators.requiredTrue\r\n ]],\r\n });\r\n }\r\n\r\n showError(formValue) {\r\n return this.contactForm.get(formValue).invalid && this.contactForm.get(formValue).touched;\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n sendContactForm() {\r\n this.isLoading = true;\r\n if (this.contactForm.invalid) {\r\n this.showErrors(this.contactForm);\r\n return;\r\n }\r\n const contactForm = {\r\n name: this.contactForm.get('name').value,\r\n phone: this.contactForm.get('phone').value,\r\n acceptance: this.contactForm.get('acceptance').value\r\n };\r\n this.userService.contactForm(contactForm).subscribe(\r\n (response) => {\r\n this.isLoading = false;\r\n this.contactForm.markAsPristine();\r\n\r\n this.alert.type = 1;\r\n this.alert.message = 'Tus datos de contacto se han enviado correctamente. En breve nos pondremos en contacto contigo';\r\n setTimeout(() => {\r\n window.location.replace(FRONT_URL + this.translate.getDefaultLang() + '/precios-venntur');\r\n }, 3000);\r\n },\r\n (error) => {\r\n this.isLoading = false;\r\n this.contactForm.markAsPristine();\r\n\r\n this.alert.type = 2;\r\n this.alert.message = 'No se han podido enviar tus datos de contacto. Prueba de nuevo más tarde';\r\n }\r\n );\r\n }\r\n}\r\n","\r\n
\r\n
{{ 'Déjanos tu teléfono' | translate}} \r\n
{{ 'Te contaremos lo que Venntur puede hacer por los organizadores de experiencias.' | translate}}
\r\n
\r\n
\r\n \r\n
\r\n \r\n \r\n {{translate.instant(errors['name'])}}\r\n \r\n
\r\n
\r\n \r\n
\r\n \r\n \r\n {{translate.instant(errors['phone'])}}\r\n \r\n
\r\n
\r\n \r\n
\r\n \r\n \r\n \r\n {{ 'He leído y acepto la política de privacidad de este sitio web' | translate}} \r\n \r\n \r\n {{translate.instant(errors['acceptance'])}}\r\n \r\n
\r\n
\r\n\r\n {{ 'ENVIAR' | translate}} \r\n \r\n
{{alert.message}}
\r\n
\r\n \r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { errorMessages } from '../../shared/custom-validators';\r\nimport { UsersService } from '../../../shared/users/users.service';\r\nimport {TranslateService} from '@ngx-translate/core';\r\n\r\n@Component({\r\n selector: 'app-password-recover',\r\n templateUrl: './password-recover.component.html'\r\n})\r\nexport class PasswordRecoverComponent implements OnInit {\r\n passForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n errors = errorMessages;\r\n public message = '';\r\n public isLoading = false;\r\n\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private userService: UsersService,\r\n public translate: TranslateService\r\n ) {\r\n this.createForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n createForm() {\r\n this.passForm = this.formBuilder.group({\r\n email: [ '', [\r\n Validators.required,\r\n Validators.email\r\n ]],\r\n });\r\n }\r\n\r\n showError(formValue) {\r\n return this.passForm.get(formValue).invalid && this.passForm.get(formValue).touched;\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n\r\n sendForgotPassword() {\r\n this.isLoading = true;\r\n if (this.passForm.invalid) {\r\n this.showErrors(this.passForm);\r\n return;\r\n }\r\n this.userService.forgotPassword({email: this.passForm.get('email').value}).subscribe(\r\n (response) => {\r\n this.isLoading = false;\r\n this.passForm.markAsPristine();\r\n\r\n this.alert.type = 1;\r\n this.alert.message = 'Te hemos enviado un correo para restablecer tu contraseña.';\r\n },\r\n (error) => {\r\n this.isLoading = false;\r\n this.passForm.markAsPristine();\r\n\r\n this.alert.type = 2;\r\n this.alert.message = 'No hemos podido enviarte el correo para restablecer contraseña.';\r\n });\r\n }\r\n\r\n}\r\n","\r\n
\r\n
{{ '¿Olvidaste la contraseña?' | translate}} \r\n
{{ 'Introduce tu correo electrónico y te enviaremos un email de recuperación de contraseña' | translate}}
\r\n
\r\n
\r\n \r\n \r\n \r\n {{translate.instant(errors['email'])}}\r\n \r\n
\r\n\r\n {{ 'Recuperar contraseña' | translate}} \r\n \r\n
{{alert.message}}
\r\n
\r\n \r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { CustomValidators, regExps, errorMessages } from '../../shared/custom-validators';\r\n\r\nimport { ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';\r\n\r\nimport {User} from '../../../shared/users/user.model';\r\nimport {UsersService} from '../../../shared/users/users.service';\r\nimport {TranslateService} from '@ngx-translate/core';\r\n\r\n@Component({\r\n selector: 'app-reset-password',\r\n templateUrl: './reset-password.component.html'\r\n})\r\nexport class ResetPasswordComponent implements OnInit {\r\n\r\n userResetPasswordForm: UntypedFormGroup;\r\n alert = {message: null, type: null};\r\n errors = errorMessages;\r\n public message = '';\r\n public result = '';\r\n\r\n private id: any;\r\n private token: any;\r\n public isLoading = false;\r\n\r\n constructor(\r\n private formBuilder: UntypedFormBuilder,\r\n private activatedRoute: ActivatedRoute,\r\n private router: Router,\r\n public userService: UsersService,\r\n public translate: TranslateService\r\n ) {\r\n this.createForm();\r\n }\r\n\r\n createForm() {\r\n this.userResetPasswordForm = this.formBuilder.group({\r\n password: ['', [\r\n Validators.required,\r\n Validators.pattern(regExps.password)\r\n ]],\r\n });\r\n }\r\n\r\n reset(): void {\r\n if (!this.userResetPasswordForm.valid) {\r\n return;\r\n }\r\n\r\n const user = new User(\r\n {\r\n email: this.userResetPasswordForm.value.email,\r\n password: this.userResetPasswordForm.value.password\r\n }\r\n );\r\n\r\n this.isLoading = true;\r\n this.userService.resetPassword(user, this.token).subscribe(\r\n (response) => {\r\n this.isLoading = false;\r\n this.userResetPasswordForm.markAsPristine();\r\n\r\n this.alert.type = 1;\r\n this.alert.message = 'Se ha cambiado la contraseña con éxito. ' + '\\n' +\r\n 'En breve será redirigido.' ;\r\n this.result = 'success';\r\n\r\n setTimeout((router: Router) => {\r\n this.router.navigate([this.translate.getDefaultLang() + '/experiencias']);\r\n }, 10000);\r\n\r\n },\r\n (error) => {\r\n this.isLoading = false;\r\n this.userResetPasswordForm.markAsPristine();\r\n\r\n this.alert.type = 2;\r\n this.alert.message = 'No se ha podido cambiar la contraseña. Por favor, reinicie el proceso de reseteo de contraseña.';\r\n this.result = 'error';\r\n });\r\n }\r\n\r\n ngOnInit() {\r\n this.activatedRoute.params.subscribe(params => {\r\n this.token = params['token'];\r\n });\r\n }\r\n showError(formValue) {\r\n return this.userResetPasswordForm.get(formValue).invalid && this.userResetPasswordForm.get(formValue).touched;\r\n }\r\n\r\n showErrors(formGroup) {\r\n Object.keys(formGroup.controls).forEach(key => {\r\n formGroup.get(key).markAsTouched();\r\n });\r\n return;\r\n }\r\n}\r\n","\r\n
\r\n
{{ 'Restablecer contraseña' | translate}} \r\n
{{ 'Por favor, introduce tu contraseña nueva' | translate}}
\r\n
\r\n
\r\n \r\n \r\n \r\n {{translate.instant(errors['password'])}}\r\n \r\n
\r\n {{ 'Restablecer' | translate}} \r\n \r\n
{{alert.message}}
\r\n
\r\n \r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { CmsService } from '../cms/service/cms.service';\r\nimport { AuthService } from '../shared/auth.service';\r\nimport { MakerService } from '../shared/maker.service';\r\n\r\n@Component({\r\n selector: 'app-webs',\r\n templateUrl: './webs.component.html',\r\n styleUrls: ['./webs.component.scss']\r\n})\r\nexport class WebsComponent implements OnInit {\r\n webs: any;\r\n constructor(public translate: TranslateService, private cmsService: CmsService, private authService: AuthService, private makerService: MakerService) { }\r\n\r\n ngOnInit(): void {\r\n this.makerService.getMaker('/makers/'+this.authService.getMakerId()).subscribe((maker:any) => {\r\n this.cmsService.getAll('webs?externalUser=' + maker.user.email).subscribe((webs: any) => {\r\n this.webs = webs['hydra:member'];\r\n console.log(webs);\r\n \r\n })\r\n })\r\n\r\n }\r\n\r\n goMakerWeb(webId:any) {\r\n // const windowFeatures = 'width=600,height=400,location=no,toolbar=no,menubar=no';\r\n const newWindowURL = 'http://creator.venntur.com/login' + '?token=' + localStorage.getItem('token') + '&user=' + localStorage.getItem('user') + '&web=' + webId;\r\n window.open(newWindowURL, '_blank');\r\n }\r\n\r\n goMakerNewWebIa() {\r\n // const windowFeatures = 'width=600,height=400,location=no,toolbar=no,menubar=no';\r\n const newWindowURL = 'http://creator.venntur.com/login' + '?token=' + localStorage.getItem('token') + '&user=' + localStorage.getItem('user') + '&newWebIa=' + true + '&maker=' + this.getMaker();\r\n window.open(newWindowURL, '_blank');\r\n }\r\n\r\n goMakerNewWebBlank() {\r\n // const windowFeatures = 'width=600,height=400,location=no,toolbar=no,menubar=no';\r\n const newWindowURL = 'http://creator.venntur.com/login' + '?token=' + localStorage.getItem('token') + '&user=' + localStorage.getItem('user') + '&newWebBlank=' + true + '&maker=' + this.getMaker();\r\n window.open(newWindowURL, '_blank');\r\n }\r\n\r\n getUser() {\r\n return JSON.parse(localStorage.getItem('user')).id;\r\n }\r\n getMaker() {\r\n return JSON.parse(localStorage.getItem('maker')).id;\r\n }\r\n}\r\n","\r\n
\r\n
\r\n
\r\n Crear nueva landing \r\n \r\n
\r\n \r\n
\r\n Landing con IA \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n {{web.domain}} \r\n \r\n
\r\n
\r\n Edición visual \r\n
\r\n
\r\n Edición CMS \r\n
\r\n
\r\n
\r\n {{10}} \r\n \r\n
\r\n
\r\n {{2}} \r\n \r\n
\r\n
\r\n {{'Activa'}} \r\n \r\n
\r\n
\r\n
\r\n
\r\n
","import { Component, OnInit } from '@angular/core';\r\nimport { UsersService } from '../../shared/users/users.service';\r\nimport { ActivatedRoute } from '@angular/router';\r\nimport {DomSanitizer, Meta} from '@angular/platform-browser';\r\nimport {finalize} from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'app-wordpress-page',\r\n templateUrl: './wordpress-page.component.html',\r\n styleUrls: ['./wordpress-page.component.scss']\r\n})\r\nexport class WordpressPageComponent implements OnInit {\r\n\r\n href = null;\r\n constructor(\r\n private activatedRoute: ActivatedRoute,\r\n private userService: UsersService,\r\n private sanitizer: DomSanitizer,\r\n private metaService: Meta\r\n ) { }\r\n\r\n ngOnInit(): void {\r\n this.activatedRoute.params.subscribe(params => {\r\n if (params.page) {\r\n this.userService.getWordpressPage(params.page).subscribe( page => {\r\n if (page.length === 0) {\r\n this.userService.getWordpressPost(params.page).subscribe( post => {\r\n this.loadCSS(post[0].id, post[0].content.css_files);\r\n this.loadHead(post[0].head_tags);\r\n document.getElementById('wordpress').innerHTML = post[0].content.rendered;\r\n });\r\n } else {\r\n this.loadCSS(page[0].id, page[0].content.css_files);\r\n this.loadHead(page[0].head_tags);\r\n document.getElementById('wordpress').innerHTML = page[0].content.rendered;\r\n }\r\n });\r\n } else if (params.category) {\r\n this.userService.getWordpressPostsByCategory(params.category).subscribe( page => {\r\n this.loadCSS(page[0].id, page[0].content.css_files);\r\n this.loadHead(page[0].head_tags);\r\n document.getElementById('wordpress').innerHTML = page[0].content.rendered;\r\n page[0].content.categories.forEach( category => {\r\n let categories = Array.from(document.getElementsByClassName('category-' + category));\r\n categories.forEach(category => {\r\n if (!category.className.includes('category-' + params.category)) {\r\n category.remove();\r\n }\r\n });\r\n });\r\n });\r\n }\r\n });\r\n }\r\n\r\n loadHead(params) {\r\n params.forEach(param => {\r\n if (param.tag === 'meta') {\r\n this.metaService.addTag({name: param.attributes.name, content: param.attributes.content});\r\n }\r\n });\r\n }\r\n\r\n loadCSS(id, cssFiles) {\r\n const link = document.createElement('link');\r\n link.href = 'https://pro.venntur.com/wp-content/themes/Divi/style.dev.css';\r\n link.rel = 'stylesheet';\r\n link.type = 'text/css';\r\n\r\n const head = document.getElementsByTagName('head')[0];\r\n const style = head.getElementsByTagName('style')[0];\r\n head.insertBefore(link, style);\r\n\r\n // const link5 = document.createElement('link');\r\n // link5.href = 'https://wp.ttl.aititubi.es/wp-content/themes/Divi/style.dev.css';\r\n // link5.rel = 'stylesheet';\r\n // link5.type = 'text/css';\r\n //\r\n // const head5 = document.getElementsByTagName('head')[0];\r\n // const style5 = head.getElementsByTagName('style')[0];\r\n // head5.insertBefore(link5, style5);\r\n\r\n const link2 = document.createElement('link');\r\n link2.href = 'https://pro.venntur.com/wp-content/themes/venntur/style.css?ver=4.9.1';\r\n link2.rel = 'stylesheet';\r\n link2.type = 'text/css';\r\n\r\n const head2 = document.getElementsByTagName('head')[0];\r\n const style2 = head2.getElementsByTagName('style')[0];\r\n head2.insertBefore(link2, style2);\r\n\r\n // const link3 = document.createElement('link');\r\n // link3.href = 'https://pro.venntur.com/wp-content/plugins/monarch/css/style.css?ver=1.4.14';\r\n // link3.rel = 'stylesheet';\r\n // link3.type = 'text/css';\r\n //\r\n // const head3 = document.getElementsByTagName('head')[0];\r\n // const style3 = head3.getElementsByTagName('style')[0];\r\n // head3.insertBefore(link3, style3);\r\n\r\n if (cssFiles) {\r\n const link4 = document.createElement('link');\r\n link4.href = `https://pro.venntur.com/wp-content/et-cache/${id}/${cssFiles[2]}`;\r\n link4.rel = 'stylesheet';\r\n link4.type = 'text/css';\r\n\r\n const head4 = document.getElementsByTagName('head')[0];\r\n const style4 = head4.getElementsByTagName('style')[0];\r\n head4.insertBefore(link4, style4);\r\n }\r\n\r\n const script = document.createElement('script');\r\n\r\n script.setAttribute('src', 'https://pro.venntur.com/wp-content/themes/Divi/includes/builder/frontend-builder/build/frontend-builder-global-functions.js');\r\n\r\n document.head.appendChild(script);\r\n\r\n setTimeout(() => {\r\n const script2 = document.createElement('script');\r\n script2.setAttribute('src', 'https://pro.venntur.com/wp-content/themes/Divi/includes/builder/scripts/ext/salvattore.min.js?ver=4.9.1');\r\n document.body.appendChild(script2);\r\n }, 500);\r\n }\r\n}\r\n"," \r\n
\r\n","import { Injectable } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { Observable } from 'rxjs';\r\nimport { environment } from '../../../environments/environment';\r\nimport { Category, CategoryCollection } from './category.model';\r\n\r\n\r\nconst API_URL = environment.apiUrl;\r\n\r\n@Injectable()\r\nexport class CategoriesService {\r\n constructor(\r\n private http: HttpClient\r\n ) { }\r\n\r\n public postCategory(category): Observable {\r\n return this.http\r\n .post(API_URL + '/categories', category);\r\n }\r\n\r\n public getCategory(id: string): Observable {\r\n return this.http\r\n .get(API_URL + '/categories/' + id);\r\n }\r\n\r\n public getCategories(language): Observable {\r\n return this.http\r\n .get(API_URL + '/categories', { headers: {\r\n 'Accept-Language': language,\r\n }});\r\n }\r\n\r\n public getActiveCategories(language): Observable {\r\n return this.http\r\n .get(API_URL + '/categories?exists[experiences]=true', { headers: {\r\n 'Accept-Language': language,\r\n }});\r\n }\r\n\r\n public getActiveCategoriesByParentId(parentId:any ,language): Observable {\r\n return this.http\r\n .get(API_URL + '/categories?exists[experiences]=true&parents[]=' + parentId, { headers: {\r\n 'Accept-Language': language,\r\n }});\r\n }\r\n\r\n public deleteCategory(categoryId: string): any {\r\n return this.http.delete(API_URL + '/categories/' + categoryId);\r\n }\r\n\r\n public putCategory(categoryId: string, category: Category): Observable {\r\n return this.http\r\n .put(API_URL + '/categories/' + categoryId, category);\r\n }\r\n}\r\n","import { Component, ElementRef, Input, OnInit, Renderer2, ViewChild } from '@angular/core';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport KeenSlider, { KeenSliderInstance } from 'keen-slider';\r\nimport { ModalDirective } from 'ngx-bootstrap/modal';\r\nimport { TakerService } from 'src/app/pages/shared/taker.service';\r\nimport { Taker } from 'src/app/pages/taker/taker-profile/taker.model';\r\n\r\n@Component({\r\n selector: 'app-experience-card',\r\n templateUrl: './experience-card.component.html',\r\n styleUrls: ['./experience-card.component.scss',\r\n '../../../../node_modules/keen-slider/keen-slider.min.css']\r\n})\r\nexport class ExperienceCardComponent implements OnInit {\r\n\r\n @Input() experience;\r\n @Input() isDashboard = false;\r\n @Input() isFooterActive;\r\n\r\n @ViewChild(\"photosSlider\") photosSlider: ElementRef;\r\n @ViewChild('autoShownModal', { static: false }) autoShownModal: ModalDirective;\r\n\r\n currentSlide: number = 0\r\n dotHelper: Array = []\r\n slider: KeenSliderInstance = null\r\n\r\n\r\n takerExperiences = [];\r\n isAlertShown = false;\r\n shownDays = [\r\n { value: 0, text: 'Todos los días' },\r\n { value: 1, text: 'Lun' },\r\n { value: 2, text: 'Mar' },\r\n { value: 3, text: 'Mié' },\r\n { value: 4, text: 'Jue' },\r\n { value: 5, text: 'Vie' },\r\n { value: 6, text: 'Sáb' },\r\n { value: 7, text: 'Dom' },\r\n ];\r\n\r\n constructor(\r\n public translate: TranslateService,\r\n private takerService: TakerService,\r\n private el: ElementRef,\r\n private renderer: Renderer2\r\n ) { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n ngAfterViewInit() {\r\n\r\n this.awaitPhotoSlider();\r\n\r\n\r\n }\r\n\r\n loadPhotoSlider() {\r\n this.slider = new KeenSlider(this.photosSlider.nativeElement, {\r\n initial: this.currentSlide,\r\n slideChanged: (s) => {\r\n this.currentSlide = s.track.details.rel\r\n },\r\n });\r\n this.dotHelper = [\r\n ...Array(this.slider.track.details.slides.length).keys(),\r\n ];\r\n }\r\n\r\n awaitPhotoSlider() {\r\n if (this.photosSlider) {\r\n this.loadPhotoSlider();\r\n } else {\r\n setTimeout(() => {\r\n this.awaitPhotoSlider();\r\n }, 300);\r\n }\r\n }\r\n\r\n ngOnDestroy() {\r\n if (this.slider) this.slider.destroy()\r\n }\r\n\r\n\r\n getUrl(isCivitatis, image) {\r\n // return !isCivitatis ? 'https://dev.venntur.com/assets/experience/files/' + image : image;\r\n // return !isCivitatis ? 'http://localhost:4200/assets/experience/files/' + image : image;\r\n return !isCivitatis ? 'https://venntur.com/assets/experience/files/' + image : image;\r\n }\r\n\r\n clickFavorite(event, experienceId) {\r\n if (this.takerService.getId()) {\r\n this.takerExperiences.includes(experienceId) ?\r\n this.takerExperiences.splice(this.takerExperiences.indexOf(experienceId), 1) : this.takerExperiences.push(experienceId);\r\n const taker = {\r\n favoriteExperiences: this.takerExperiences\r\n };\r\n const editedTaker = new Taker(taker);\r\n this.takerService.putTaker(this.takerService.getId(), editedTaker).subscribe();\r\n } else {\r\n this.isAlertShown = true;\r\n }\r\n }\r\n\r\n shareExperience(experience) {\r\n var enlace = 'https://venntur.com/product/' + experience.slug;\r\n var mensaje = this.translate.instant('¡Mira esta experiencia en Venntur!');\r\n\r\n mensaje = encodeURIComponent(mensaje);\r\n enlace = encodeURIComponent(enlace);\r\n\r\n var enlaceWhatsApp = 'https://wa.me/?text=' + mensaje + '%20' + enlace;\r\n\r\n window.open(enlaceWhatsApp);\r\n\r\n }\r\n\r\n setCategoryTitle(experience) {\r\n return experience.categories.map(obj => obj.name).join(' / ')\r\n }\r\n\r\n setLanguagesTitle(experience) {\r\n return experience.languages.map(obj => obj.name).join(' , ')\r\n }\r\n\r\n convertTimeToCustomFormat(inputTime: string): string {\r\n let formattedText;\r\n const [hours, minutes] = inputTime.split(':').map(part => parseInt(part, 10));\r\n\r\n if (minutes != 0) {\r\n formattedText = hours + ' h y ' + minutes + ' min'\r\n } else {\r\n formattedText = hours + ' h'\r\n }\r\n\r\n return formattedText;\r\n }\r\n\r\n hideModal(): void {\r\n this.autoShownModal.hide();\r\n }\r\n\r\n onHidden(): void {\r\n this.isAlertShown = false;\r\n }\r\n\r\n}\r\n\r\n","\r\n