Compare commits

..

3 Commits

15 changed files with 217 additions and 59 deletions

View File

@ -41,6 +41,9 @@ const routes: Routes = [
{
path: 'view-evento-cliente',
loadChildren: () => import('./view-evento-cliente/view-evento-cliente.module').then( m => m.ViewEventoClientePageModule)
}, {
path: 'view-discoteca-cliente',
loadChildren: () => import('./view-discoteca-cliente/view-discoteca-cliente.module').then( m => m.ViewDiscotecaClientePageModule)
},
@ -48,6 +51,7 @@ const routes: Routes = [
];
@NgModule({
imports: [

View File

@ -22,6 +22,9 @@
<div class="eventoDesc">
{{evento.descripcion}}
</div>
<div class="discotecaEvento">
{{discotecas[idsDiscoteca.indexOf(evento.discotecaID)]?.nombre}}
</div>
</div>
</ion-item>
</ion-list>

View File

@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Eventoi } from '../interfaces/eventoi';
import { DiscotecaI } from '../interfaces/discoteca-i';
import { ApiService } from '../services/api.service';
import { FeedService } from '../services/feed.service';
import { Tab1Service } from '../tab1/tab1.service';
@ -12,16 +14,46 @@ import { Tab1Service } from '../tab1/tab1.service';
export class FeedPage implements OnInit {
eventos: Eventoi[];
constructor(private feedService:FeedService, private tab1Service: Tab1Service, private router:Router ) { }
discotecas: DiscotecaI[];
idsDiscoteca: number[];
constructor(private feedService:FeedService, private tab1Service: Tab1Service, private router:Router, private apiService: ApiService ) { }
ngOnInit() {
this.eventos = this.feedService.eventos;
this.idsDiscoteca = [];
this.discotecas=[];
this.getDiscotecasDistintas();
}
mostrarEvento(evento: Eventoi){
this.feedService.eventoIndex = this.eventos.indexOf(evento);
let discotecaDelEvento: DiscotecaI = this.discotecas[this.idsDiscoteca.indexOf(evento.discotecaID)];
this.feedService.discotecaEvento = discotecaDelEvento;
this.router.navigate(['/tabsUser/tab2/view-evento-cliente']);
}
}
getDiscotecasDistintas(){
this.eventos.forEach(
evento => {
if(!(this.idsDiscoteca.find(id => evento.discotecaID==id))){
this.idsDiscoteca.push(evento.discotecaID);
}
}
)
this.idsDiscoteca.forEach(
idDiscoteca => {
this.apiService.getUserDiscoteca(idDiscoteca)
.subscribe(discoteca => {
console.log(discoteca[0]);
this.discotecas.push(discoteca[0]);
})
}
)
}
}

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { DiscotecaI } from '../interfaces/discoteca-i';
import { Eventoi } from '../interfaces/eventoi';
import { ApiService } from './api.service';
@ -10,6 +11,7 @@ export class FeedService {
eventos: Eventoi[];
eventoIndex: number;
discotecaEvento: DiscotecaI;
constructor(private apiService: ApiService, private router: Router) { }

View File

@ -3,17 +3,21 @@ import { RouterModule, Routes } from '@angular/router';
import { FeedPage } from '../feed/feed.page';
import { Tab2Page } from './tab2.page';
import { ViewEventoClientePage } from '../view-evento-cliente/view-evento-cliente.page';
import { ViewDiscotecaClientePage } from '../view-discoteca-cliente/view-discoteca-cliente.page';
const routes: Routes = [
{
path: '',
component: FeedPage,
},
{
path: 'view-evento-cliente',
component: ViewEventoClientePage
},
{
path: 'view-discoteca-cliente',
component: ViewDiscotecaClientePage
}
];

View File

@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ViewDiscotecaClientePage } from './view-discoteca-cliente.page';
const routes: Routes = [
{
path: '',
component: ViewDiscotecaClientePage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ViewDiscotecaClientePageRoutingModule {}

View File

@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ViewDiscotecaClientePageRoutingModule } from './view-discoteca-cliente-routing.module';
import { ViewDiscotecaClientePage } from './view-discoteca-cliente.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ViewDiscotecaClientePageRoutingModule
],
declarations: [ViewDiscotecaClientePage]
})
export class ViewDiscotecaClientePageModule {}

View File

@ -0,0 +1,9 @@
<ion-header>
<ion-toolbar>
<ion-title>view-discoteca-cliente</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
</ion-content>

View File

@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ViewDiscotecaClientePage } from './view-discoteca-cliente.page';
describe('ViewDiscotecaClientePage', () => {
let component: ViewDiscotecaClientePage;
let fixture: ComponentFixture<ViewDiscotecaClientePage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewDiscotecaClientePage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ViewDiscotecaClientePage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,27 @@
import { Component, OnInit } from '@angular/core';
import { DiscotecaI } from '../interfaces/discoteca-i';
import { Eventoi } from '../interfaces/eventoi';
import { FeedService } from '../services/feed.service';
@Component({
selector: 'app-view-discoteca-cliente',
templateUrl: './view-discoteca-cliente.page.html',
styleUrls: ['./view-discoteca-cliente.page.scss'],
})
export class ViewDiscotecaClientePage implements OnInit {
discoteca: DiscotecaI
eventos: Eventoi[]
constructor(private feedService: FeedService) { }
ngOnInit() {
this.discoteca = this.feedService.discotecaEvento;
this.feedService.eventos.forEach(evento => {
if (this.discoteca.discotecaID == evento.discotecaID){
this.eventos.push(evento);
}
})
}
}

View File

@ -1,5 +1,6 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ViewDiscotecaClientePage } from '../view-discoteca-cliente/view-discoteca-cliente.page';
import { ViewEventoClientePage } from './view-evento-cliente.page';
@ -7,6 +8,10 @@ const routes: Routes = [
{
path: '',
component: ViewEventoClientePage
},
{
path: 'view-discoteca-cliente',
component: ViewDiscotecaClientePage
}
];

View File

@ -21,6 +21,11 @@
{{evento.descripcion}}
</div>
</ion-row>
<ion-row>
<div class="discotecaEvento">
<a [routerLink]="['/tabsUser/tab2/view-discoteca-cliente']">{{discoteca?.nombre}}</a>
</div>
</ion-row>
</div>
</ion-grid>
</ion-content>

View File

@ -0,0 +1,3 @@
.discotecaEvento{
padding: 40px;
}

View File

@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { DiscotecaI } from '../interfaces/discoteca-i';
import { Eventoi } from '../interfaces/eventoi';
import { FeedService } from '../services/feed.service';
@ -10,10 +11,12 @@ import { FeedService } from '../services/feed.service';
export class ViewEventoClientePage implements OnInit {
evento: Eventoi;
discoteca: DiscotecaI;
constructor(private feedService: FeedService) { }
ngOnInit() {
this.evento = this.feedService.getEventoByIndex(this.feedService.eventoIndex);
this.discoteca = this.feedService.discotecaEvento;
}
}