Se muestran los eventos asociados a la disco en la BD. No se muestran, y deberían, los recién añadidos
This commit is contained in:
@@ -2,7 +2,7 @@ import { Injectable, OnInit } from '@angular/core';
|
||||
import { stringify } from 'querystring';
|
||||
import { Tab1Page } from './tab1.page'
|
||||
import { Discoteca } from '../discoteca'
|
||||
import { Evento } from '../evento';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { NumericValueAccessor } from '@ionic/angular';
|
||||
import { DiscotecaI } from '../interfaces/discoteca-i';
|
||||
@@ -19,7 +19,7 @@ export class Tab1Service implements OnInit{
|
||||
discoteca: Discoteca;
|
||||
discotecaI: DiscotecaI;
|
||||
galeria: string[];
|
||||
eventos: Evento[];
|
||||
eventos: Eventoi[];
|
||||
eventoForms: FormGroup[];
|
||||
eventoIndex: number;
|
||||
editarEvento: boolean;
|
||||
@@ -29,7 +29,7 @@ export class Tab1Service implements OnInit{
|
||||
}
|
||||
|
||||
ngOnInit(){
|
||||
this.initValues();
|
||||
|
||||
}
|
||||
|
||||
initValues(): void{
|
||||
@@ -38,37 +38,40 @@ export class Tab1Service implements OnInit{
|
||||
this.discoteca.setNombre(this.discotecaI.nombre);
|
||||
this.discoteca.setTelefono(this.discotecaI.telefono);
|
||||
this.discoteca.setLocalizacion(this.discotecaI.localizacion);
|
||||
this.galeria = [];
|
||||
this.initEventos();
|
||||
this.galeria = [];
|
||||
this.editarEvento = false;
|
||||
}
|
||||
|
||||
getNombre(): string{
|
||||
this.initValues();
|
||||
return this.discoteca.getNombre();
|
||||
}
|
||||
|
||||
getTelefono(): number{
|
||||
this.initValues();
|
||||
return this.discoteca.getTelefono();
|
||||
}
|
||||
|
||||
getLocalizacion(): string{
|
||||
this.initValues();
|
||||
return this.discoteca.getLocalizacion();
|
||||
}
|
||||
|
||||
getEventos(): Evento[]{
|
||||
getEventos(): Eventoi[]{
|
||||
return this.eventos;
|
||||
}
|
||||
|
||||
getDescripcion(): string{
|
||||
this.initValues();
|
||||
return this.discoteca.getDescripcion();
|
||||
}
|
||||
|
||||
initEventos(): void{
|
||||
this.eventos = [];
|
||||
this.apiService.getEventos(this.discoteca.getId())
|
||||
.subscribe(eventos => {
|
||||
this.eventos = eventos;
|
||||
this.router.navigate(['/tabs/tab1/perfil-discoteca']);
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
initEventoForms(): void{
|
||||
@@ -79,14 +82,13 @@ export class Tab1Service implements OnInit{
|
||||
return this.eventos[eventoIndex];
|
||||
}
|
||||
|
||||
getDiscoteca(discotecaId: number){
|
||||
getDiscoteca(discotecaId: number){
|
||||
if (discotecaId != 0){
|
||||
this.apiService.getUserDiscoteca(discotecaId)
|
||||
.subscribe(discoteca => {
|
||||
this.discotecaI = discoteca[0];
|
||||
console.log(this.discotecaI);
|
||||
this.initValues();
|
||||
this.router.navigate(['/tabs/tab1/perfil-discoteca']);
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -94,7 +96,7 @@ export class Tab1Service implements OnInit{
|
||||
postEvento(evento: Eventoi){
|
||||
this.apiService.postEvento(evento)
|
||||
.subscribe(evento => {
|
||||
this.router.navigate(['/tabs']);
|
||||
this.initEventos();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user