diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9f512f2..646e1d6 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -37,6 +37,14 @@ const routes: Routes = [ path: 'feed', loadChildren: () => import('./feed/feed.module').then( m => m.FeedPageModule) }, + { + path: 'vieweventocliente', + loadChildren: () => import('./vieweventocliente/vieweventocliente.module').then( m => m.VieweventoclientePageModule) + }, + { + path: 'view-evento-cliente', + loadChildren: () => import('./view-evento-cliente/view-evento-cliente.module').then( m => m.ViewEventoClientePageModule) + }, diff --git a/src/app/feed/feed.page.html b/src/app/feed/feed.page.html index 56450ed..fd150bf 100644 --- a/src/app/feed/feed.page.html +++ b/src/app/feed/feed.page.html @@ -18,7 +18,6 @@ {{evento.fecha}} · {{evento.precio1}},{{evento.precio2}} -
{{evento.descripcion}} diff --git a/src/app/feed/feed.page.ts b/src/app/feed/feed.page.ts index 4c46af7..3e43741 100644 --- a/src/app/feed/feed.page.ts +++ b/src/app/feed/feed.page.ts @@ -1,6 +1,8 @@ import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; import { Eventoi } from '../interfaces/eventoi'; import { FeedService } from '../services/feed.service'; +import { Tab1Service } from '../tab1/tab1.service'; @Component({ selector: 'app-feed', @@ -11,10 +13,15 @@ export class FeedPage implements OnInit { eventos: Eventoi[]; - constructor(private feedService:FeedService) { } + constructor(private feedService:FeedService, private tab1Service: Tab1Service, private router:Router ) { } ngOnInit() { this.eventos = this.feedService.eventos; } + mostrarEvento(evento: Eventoi){ + this.feedService.eventoIndex = this.eventos.indexOf(evento); + this.router.navigate(['/tabs/tab2/view-evento-cliente']); + } + } diff --git a/src/app/services/feed.service.ts b/src/app/services/feed.service.ts index a8f6909..25e5322 100644 --- a/src/app/services/feed.service.ts +++ b/src/app/services/feed.service.ts @@ -9,6 +9,7 @@ import { ApiService } from './api.service'; export class FeedService { eventos: Eventoi[]; + eventoIndex: number; constructor(private apiService: ApiService, private router: Router) { } @@ -19,4 +20,10 @@ export class FeedService { this.router.navigate(['/tabsUser']) }) } + + getEventoByIndex(eventoIndex: number):Eventoi{ + return this.eventos[eventoIndex]; + } + + } diff --git a/src/app/tab2/tab2-routing.module.ts b/src/app/tab2/tab2-routing.module.ts index d654720..4678fa5 100644 --- a/src/app/tab2/tab2-routing.module.ts +++ b/src/app/tab2/tab2-routing.module.ts @@ -2,11 +2,18 @@ import { NgModule } from '@angular/core'; 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'; const routes: Routes = [ { path: '', component: FeedPage, + + + }, + { + path: 'view-evento-cliente', + component: ViewEventoClientePage } ]; diff --git a/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts b/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts new file mode 100644 index 0000000..a1deaeb --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { ViewEventoClientePage } from './view-evento-cliente.page'; + +const routes: Routes = [ + { + path: '', + component: ViewEventoClientePage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class ViewEventoClientePageRoutingModule {} diff --git a/src/app/view-evento-cliente/view-evento-cliente.module.ts b/src/app/view-evento-cliente/view-evento-cliente.module.ts new file mode 100644 index 0000000..f9f155e --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.module.ts @@ -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 { ViewEventoClientePageRoutingModule } from './view-evento-cliente-routing.module'; + +import { ViewEventoClientePage } from './view-evento-cliente.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + ViewEventoClientePageRoutingModule + ], + declarations: [ViewEventoClientePage] +}) +export class ViewEventoClientePageModule {} diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.html b/src/app/view-evento-cliente/view-evento-cliente.page.html new file mode 100644 index 0000000..e44a147 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.html @@ -0,0 +1,26 @@ + + + ViewEvento + + + + + +
+ +
+ {{evento.nombre}} · + + {{evento.fecha}} · + + {{evento.precio1}},{{evento.precio2}} +
+
+ +
+ {{evento.descripcion}} +
+
+
+
+
diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.scss b/src/app/view-evento-cliente/view-evento-cliente.page.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.spec.ts b/src/app/view-evento-cliente/view-evento-cliente.page.spec.ts new file mode 100644 index 0000000..a329129 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { ViewEventoClientePage } from './view-evento-cliente.page'; + +describe('ViewEventoClientePage', () => { + let component: ViewEventoClientePage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewEventoClientePage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(ViewEventoClientePage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.ts b/src/app/view-evento-cliente/view-evento-cliente.page.ts new file mode 100644 index 0000000..de3fec9 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.ts @@ -0,0 +1,19 @@ +import { Component, OnInit } from '@angular/core'; +import { Eventoi } from '../interfaces/eventoi'; +import { FeedService } from '../services/feed.service'; + +@Component({ + selector: 'app-view-evento-cliente', + templateUrl: './view-evento-cliente.page.html', + styleUrls: ['./view-evento-cliente.page.scss'], +}) +export class ViewEventoClientePage implements OnInit { + + evento: Eventoi; + constructor(private feedService: FeedService) { } + + ngOnInit() { + this.evento = this.feedService.getEventoByIndex(this.feedService.eventoIndex); + } + +}