master #2

Merged
onsaliyo merged 8 commits from master into BackEnd 2021-02-19 13:21:42 +01:00
15 changed files with 97 additions and 31 deletions
Showing only changes of commit 594332fd87 - Show all commits

View File

@ -7,6 +7,10 @@ const routes: Routes = [
path: '', path: '',
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule) loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
}, },
{
path: 'view-evento',
loadChildren: () => import('./view-evento/view-evento.module').then( m => m.ViewEventoPageModule)
},
]; ];

View File

@ -84,7 +84,7 @@
<ion-row> <ion-row>
<div *ngIf="eventos.length>0" class="eventos"> <div *ngIf="eventos.length>0" class="eventos">
<ion-list> <ion-list>
<ion-item *ngFor="let evento of eventos"> <ion-item *ngFor="let evento of eventos" button (click)="mostrarEvento(evento)">
<div class="evento"> <div class="evento">
<div class="eventoHeader"> <div class="eventoHeader">
{{evento.nombre}} · {{evento.nombre}} ·

View File

@ -61,12 +61,11 @@
} }
.eventos{ .eventos{
margin: 20px; display:block;
justify-content: space-between;
} }
.evento{ .evento:hover{
margin-top: 20px; background-color: rgb(97, 97, 97);
} }
.eventoHeader{ .eventoHeader{
font-weight: bold; font-weight: bold;

View File

@ -161,6 +161,11 @@ export class PerfilDiscotecaPage implements OnInit {
addEvento() { addEvento() {
this.router.navigate(['/tabs/tab1/prompt-evento']); this.router.navigate(['/tabs/tab1/prompt-evento']);
} }
mostrarEvento(evento: Evento){
this.tab1Service.eventoIndex = this.eventos.indexOf(evento);
this.router.navigate(['/tabs/tab1/view-evento']);
}
} }

View File

@ -42,9 +42,6 @@ export class PromptEventoPage{
if (!this.tab1Service.eventos){ if (!this.tab1Service.eventos){
this.tab1Service.initEventos();} this.tab1Service.initEventos();}
this.tab1Service.eventos.push(evento); this.tab1Service.eventos.push(evento);
for (var i=0; i<this.tab1Service.eventos.length; i++){
console.warn(this.tab1Service.eventos[i].nombre);
}
} }

View File

@ -3,6 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { Tab1Page } from './tab1.page'; import { Tab1Page } from './tab1.page';
import { PerfilDiscotecaPage } from '../perfil-discoteca/perfil-discoteca.page' import { PerfilDiscotecaPage } from '../perfil-discoteca/perfil-discoteca.page'
import { PromptEventoPage } from '../prompt-evento/prompt-evento.page' import { PromptEventoPage } from '../prompt-evento/prompt-evento.page'
import { ViewEventoPage } from '../view-evento/view-evento.page'
const routes: Routes = [ const routes: Routes = [
{ {
@ -20,6 +21,11 @@ const routes: Routes = [
path: 'prompt-evento', path: 'prompt-evento',
component: PromptEventoPage component: PromptEventoPage
}, },
{
path: 'view-evento',
component: ViewEventoPage
}

View File

@ -4,6 +4,7 @@ import { Tab1Page } from './tab1.page'
import { Discoteca } from '../discoteca' import { Discoteca } from '../discoteca'
import { Galeria } from '../galeria'; import { Galeria } from '../galeria';
import { Evento } from '../evento'; import { Evento } from '../evento';
import { NumericValueAccessor } from '@ionic/angular';
@Injectable({ @Injectable({
@ -14,6 +15,7 @@ export class Tab1Service implements OnInit{
discoteca: Discoteca; discoteca: Discoteca;
galeria: Galeria; galeria: Galeria;
eventos: Evento[]; eventos: Evento[];
eventoIndex: number;
constructor() { constructor() {
@ -56,4 +58,8 @@ export class Tab1Service implements OnInit{
this.eventos = []; this.eventos = [];
} }
getEventobyIndex(eventoIndex: number){
return this.eventos[eventoIndex];
}
} }

View File

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

View File

@ -1,3 +0,0 @@
<p>
view-evento works!
</p>

View File

@ -1,14 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-view-evento',
templateUrl: './view-evento.component.html',
styleUrls: ['./view-evento.component.scss'],
})
export class ViewEventoComponent implements OnInit {
constructor() { }
ngOnInit() {}
}

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 { ViewEventoPageRoutingModule } from './view-evento-routing.module';
import { ViewEventoPage } from './view-evento.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ViewEventoPageRoutingModule
],
declarations: [ViewEventoPage]
})
export class ViewEventoPageModule {}

View File

@ -0,0 +1,9 @@
<ion-header>
<ion-toolbar>
<ion-title>ViewEvento</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<label>{{evento.nombre}}</label>
</ion-content>

View File

@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular'; import { IonicModule } from '@ionic/angular';
import { ViewEventoComponent } from './view-evento.component'; import { ViewEventoPage } from './view-evento.page';
describe('ViewEventoComponent', () => { describe('ViewEventoPage', () => {
let component: ViewEventoComponent; let component: ViewEventoPage;
let fixture: ComponentFixture<ViewEventoComponent>; let fixture: ComponentFixture<ViewEventoPage>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ ViewEventoComponent ], declarations: [ ViewEventoPage ],
imports: [IonicModule.forRoot()] imports: [IonicModule.forRoot()]
}).compileComponents(); }).compileComponents();
fixture = TestBed.createComponent(ViewEventoComponent); fixture = TestBed.createComponent(ViewEventoPage);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
})); }));

View File

@ -0,0 +1,20 @@
import { Component, OnInit } from '@angular/core';
import { Evento } from '../evento';
import { Tab1Service } from '../tab1/tab1.service';
@Component({
selector: 'app-view-evento',
templateUrl: './view-evento.page.html',
styleUrls: ['./view-evento.page.scss'],
})
export class ViewEventoPage implements OnInit {
evento: Evento;
constructor(private tab1Service: Tab1Service) { }
ngOnInit() {
this.evento = this.tab1Service.getEventobyIndex(this.tab1Service.eventoIndex);
}
}