Compare commits

..

2 Commits

11 changed files with 182 additions and 51 deletions

View File

@ -1,53 +1,58 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { LoginPage } from './login/login.page'; import { LoginPage } from './login/login.page';
const routes: Routes = [ const routes: Routes = [
{ {
path: 'login', path: 'login',
component: LoginPage component: LoginPage
}, },
{ {
path: 'tabs', path: 'tabs',
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule) loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
}, },
{ {
path: 'tabsUser', path: 'tabsUser',
loadChildren: () => import('./tabs-user/tabs-user.module').then(m => m.TabsUserPageModule) loadChildren: () => import('./tabs-user/tabs-user.module').then(m => m.TabsUserPageModule)
}, },
{ {
path: 'view-evento', path: 'view-evento',
loadChildren: () => import('./view-evento/view-evento.module').then( m => m.ViewEventoPageModule) loadChildren: () => import('./view-evento/view-evento.module').then( m => m.ViewEventoPageModule)
}, },
{ {
path: 'galeriamodal', path: 'galeriamodal',
loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule) loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule)
}, },
{ {
path:'', path:'',
redirectTo: 'login', redirectTo: 'login',
pathMatch: 'full' pathMatch: 'full'
}, },
{ {
path: 'tabs-user', path: 'tabs-user',
loadChildren: () => import('./tabs-user/tabs-user.module').then( m => m.TabsUserPageModule) loadChildren: () => import('./tabs-user/tabs-user.module').then( m => m.TabsUserPageModule)
}, { },
{
path: 'feed', path: 'feed',
loadChildren: () => import('./feed/feed.module').then( m => m.FeedPageModule) loadChildren: () => import('./feed/feed.module').then( m => m.FeedPageModule)
}, },
{
path: 'view-evento-cliente',
loadChildren: () => import('./view-evento-cliente/view-evento-cliente.module').then( m => m.ViewEventoClientePageModule)
},
]; ];
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
], ],
exports: [RouterModule] exports: [RouterModule]
}) })
export class AppRoutingModule {} export class AppRoutingModule {}

View File

@ -18,7 +18,6 @@
{{evento.fecha}} · {{evento.fecha}} ·
<ion-icon name="cash-outline"></ion-icon> <ion-icon name="cash-outline"></ion-icon>
{{evento.precio1}},{{evento.precio2}} {{evento.precio1}},{{evento.precio2}}
<ion-button (click)="editarEvento(evento);$event.stopPropagation();"><ion-icon name="pencil-outline"></ion-icon></ion-button>
</div> </div>
<div class="eventoDesc"> <div class="eventoDesc">
{{evento.descripcion}} {{evento.descripcion}}

View File

@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Eventoi } from '../interfaces/eventoi'; import { Eventoi } from '../interfaces/eventoi';
import { FeedService } from '../services/feed.service'; import { FeedService } from '../services/feed.service';
import { Tab1Service } from '../tab1/tab1.service';
@Component({ @Component({
selector: 'app-feed', selector: 'app-feed',
@ -11,10 +13,15 @@ export class FeedPage implements OnInit {
eventos: Eventoi[]; eventos: Eventoi[];
constructor(private feedService:FeedService) { } constructor(private feedService:FeedService, private tab1Service: Tab1Service, private router:Router ) { }
ngOnInit() { ngOnInit() {
this.eventos = this.feedService.eventos; this.eventos = this.feedService.eventos;
} }
mostrarEvento(evento: Eventoi){
this.feedService.eventoIndex = this.eventos.indexOf(evento);
this.router.navigate(['/tabsUser/tab2/view-evento-cliente']);
}
} }

View File

@ -9,6 +9,7 @@ import { ApiService } from './api.service';
export class FeedService { export class FeedService {
eventos: Eventoi[]; eventos: Eventoi[];
eventoIndex: number;
constructor(private apiService: ApiService, private router: Router) { } constructor(private apiService: ApiService, private router: Router) { }
@ -19,4 +20,10 @@ export class FeedService {
this.router.navigate(['/tabsUser']) this.router.navigate(['/tabsUser'])
}) })
} }
getEventoByIndex(eventoIndex: number):Eventoi{
return this.eventos[eventoIndex];
}
} }

View File

@ -2,11 +2,18 @@ import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { FeedPage } from '../feed/feed.page'; import { FeedPage } from '../feed/feed.page';
import { Tab2Page } from './tab2.page'; import { Tab2Page } from './tab2.page';
import { ViewEventoClientePage } from '../view-evento-cliente/view-evento-cliente.page';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
component: FeedPage, component: FeedPage,
},
{
path: 'view-evento-cliente',
component: ViewEventoClientePage
} }
]; ];

View File

@ -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 {}

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 { 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 {}

View File

@ -0,0 +1,26 @@
<ion-header>
<ion-toolbar>
<ion-title>ViewEvento</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-grid>
<div class="evento">
<ion-row>
<div class="eventoHeader">
{{evento.nombre}} ·
<ion-icon name="calendar-outline"></ion-icon>
{{evento.fecha}} ·
<ion-icon name="cash-outline"></ion-icon>
{{evento.precio1}},{{evento.precio2}}
</div>
</ion-row>
<ion-row>
<div class="eventoDesc">
{{evento.descripcion}}
</div>
</ion-row>
</div>
</ion-grid>
</ion-content>

View File

@ -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<ViewEventoClientePage>;
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();
});
});

View File

@ -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);
}
}