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

View File

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

View File

@ -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(['/tabsUser/tab2/view-evento-cliente']);
}
}

View File

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

View File

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

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