diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 45fa8a3..7675048 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,16 +1,33 @@ import { NgModule } from '@angular/core'; import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +import { LoginPage } from './login/login.page'; const routes: Routes = [ + { - path: '', + path: 'login', + component: LoginPage + }, + { + path: 'tabs', loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule) }, { 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: 'tabs', + pathMatch: 'full' + }, + + ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 98b0670..9ba0407 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -5,16 +5,17 @@ import { ReactiveFormsModule } from '@angular/forms'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { StatusBar } from '@ionic-native/status-bar/ngx'; - import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { PerfilDiscotecaPage } from './perfil-discoteca/perfil-discoteca.page'; import { PromptEventoPage} from './prompt-evento/prompt-evento.page' +import { GaleriamodalPageModule } from './galeriamodal/galeriamodal.module'; +import { LoginPage } from './login/login.page'; @NgModule({ - declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage], + declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage], entryComponents: [], - imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule], + imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule], providers: [ StatusBar, SplashScreen, diff --git a/src/app/galeriamodal/galeriamodal-routing.module.ts b/src/app/galeriamodal/galeriamodal-routing.module.ts new file mode 100644 index 0000000..6d0a353 --- /dev/null +++ b/src/app/galeriamodal/galeriamodal-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { GaleriamodalPage } from './galeriamodal.page'; + +const routes: Routes = [ + { + path: '', + component: GaleriamodalPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class GaleriamodalPageRoutingModule {} diff --git a/src/app/galeriamodal/galeriamodal.module.ts b/src/app/galeriamodal/galeriamodal.module.ts new file mode 100644 index 0000000..6e40a45 --- /dev/null +++ b/src/app/galeriamodal/galeriamodal.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 { GaleriamodalPageRoutingModule } from './galeriamodal-routing.module'; + +import { GaleriamodalPage } from './galeriamodal.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + GaleriamodalPageRoutingModule + ], + declarations: [GaleriamodalPage] +}) +export class GaleriamodalPageModule {} diff --git a/src/app/galeriamodal/galeriamodal.page.html b/src/app/galeriamodal/galeriamodal.page.html new file mode 100644 index 0000000..41f9aa3 --- /dev/null +++ b/src/app/galeriamodal/galeriamodal.page.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/app/galeriamodal/galeriamodal.page.scss b/src/app/galeriamodal/galeriamodal.page.scss new file mode 100644 index 0000000..6c210a4 --- /dev/null +++ b/src/app/galeriamodal/galeriamodal.page.scss @@ -0,0 +1,4 @@ +ion-content { + background: rgba(0, 0, 0, 0.589) + +} \ No newline at end of file diff --git a/src/app/galeriamodal/galeriamodal.page.spec.ts b/src/app/galeriamodal/galeriamodal.page.spec.ts new file mode 100644 index 0000000..63d6229 --- /dev/null +++ b/src/app/galeriamodal/galeriamodal.page.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { GaleriamodalPage } from './galeriamodal.page'; + +describe('GaleriamodalPage', () => { + let component: GaleriamodalPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ GaleriamodalPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(GaleriamodalPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/galeriamodal/galeriamodal.page.ts b/src/app/galeriamodal/galeriamodal.page.ts new file mode 100644 index 0000000..a5e2125 --- /dev/null +++ b/src/app/galeriamodal/galeriamodal.page.ts @@ -0,0 +1,36 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { ModalController, NavParams } from '@ionic/angular'; +import { Tab1Service } from '../tab1/tab1.service'; + +@Component({ + selector: 'app-galeriamodal', + templateUrl: './galeriamodal.page.html', + styleUrls: ['./galeriamodal.page.scss'], +}) +export class GaleriamodalPage implements OnInit { + + foto: string; + + sliderOpts = { + + } + constructor(private navParams: NavParams, private modalController: ModalController, private tab1Service: Tab1Service, + private router: Router) { } + + ngOnInit() { + this.foto = this.navParams.get('foto'); + } + + + borrar(){ + let index = this.tab1Service.galeria.indexOf('foto'); + this.tab1Service.galeria.slice[index]; + this.close(); + } + + close(){ + this.modalController.dismiss(); + } + +} diff --git a/src/app/login/login-routing.module.ts b/src/app/login/login-routing.module.ts new file mode 100644 index 0000000..b0b8a72 --- /dev/null +++ b/src/app/login/login-routing.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { LoginPage } from './login.page'; + +const routes: Routes = [ + { + path: '', + component: LoginPage, + }, + { + path: 'tabs', + loadChildren: () => import('../tabs/tabs.module').then(m => m.TabsPageModule) + }, + + { + path: '', + redirectTo: 'login' + } + +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class LoginPageRoutingModule {} diff --git a/src/app/login/login.module.ts b/src/app/login/login.module.ts new file mode 100644 index 0000000..6710e2a --- /dev/null +++ b/src/app/login/login.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { IonicModule } from '@ionic/angular'; +import { LoginPageRoutingModule } from './login-routing.module'; +import { LoginPage } from './login.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + LoginPageRoutingModule + ], + declarations: [LoginPage] +}) +export class LoginPageModule {} diff --git a/src/app/login/login.page.html b/src/app/login/login.page.html new file mode 100644 index 0000000..1a77f8b --- /dev/null +++ b/src/app/login/login.page.html @@ -0,0 +1,11 @@ + + + Login + + + + + + Login + + diff --git a/src/app/login/login.page.scss b/src/app/login/login.page.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/login/login.page.spec.ts b/src/app/login/login.page.spec.ts new file mode 100644 index 0000000..07cb76a --- /dev/null +++ b/src/app/login/login.page.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { LoginPage } from './login.page'; + +describe('LoginPage', () => { + let component: LoginPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ LoginPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(LoginPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/login/login.page.ts b/src/app/login/login.page.ts new file mode 100644 index 0000000..75a025e --- /dev/null +++ b/src/app/login/login.page.ts @@ -0,0 +1,20 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-login', + templateUrl: './login.page.html', + styleUrls: ['./login.page.scss'], +}) +export class LoginPage implements OnInit { + + constructor(private router: Router) { } + + ngOnInit() { + } + + login(){ + this.router.navigate(['/tabs']); + } + +} diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.html b/src/app/perfil-discoteca/perfil-discoteca.page.html index 2840b2a..ace607c 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.html +++ b/src/app/perfil-discoteca/perfil-discoteca.page.html @@ -13,8 +13,9 @@ - + + @@ -55,17 +56,20 @@ {{localizacion}} + Galería de Fotos - + - - - - - + + + + + + + @@ -91,7 +95,8 @@ {{evento.fecha}} · - {{evento.precio1}}, {{evento.precio2}} + {{evento.precio1}},{{evento.precio2}} + {{evento.descripcion}} @@ -101,13 +106,13 @@ - + - + \ No newline at end of file diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.ts b/src/app/perfil-discoteca/perfil-discoteca.page.ts index 74e2432..deeaeb9 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.ts +++ b/src/app/perfil-discoteca/perfil-discoteca.page.ts @@ -1,13 +1,13 @@ import { Component, OnInit } from '@angular/core'; -import { NodeCompatibleEventEmitter } from 'rxjs/internal/observable/fromEvent'; -import { Tab1Service } from '../tab1/tab1.service' -import { Discoteca } from '../discoteca' -import { IonSlides} from '@ionic/angular'; +import { Tab1Service } from '../tab1/tab1.service'; +import { IonSlides, ModalController} from '@ionic/angular'; import { AlertController } from '@ionic/angular'; import { ViewChild } from '@angular/core'; import { Evento } from '../evento'; import { Router } from '@angular/router'; import { THIS_EXPR } from '@angular/compiler/src/output/output_ast'; +import { GaleriamodalPage } from '../galeriamodal/galeriamodal.page'; +import { stringify } from '@angular/compiler/src/util'; @Component({ selector: 'app-perfil-discoteca', @@ -29,8 +29,13 @@ export class PerfilDiscotecaPage implements OnInit { currentIndex: number; eventos: Evento[]; alertCtrl: AlertController; + sliderOpts = { + slidesPerView: 1.5, + centeredSlides: true, + spaceBetween: 20, + }; - constructor(private tab1Service: Tab1Service, private router: Router) { + constructor(private tab1Service: Tab1Service, private router: Router, private modalController: ModalController) { } @@ -45,9 +50,9 @@ export class PerfilDiscotecaPage implements OnInit { this.getEventos(); this.editDisabled="true"; this.editEnabled="false"; - this.fotoSrc = '../assets/barraca.jpg'; + this.fotoSrc = '../assets/img/barraca.jpg'; this.fotoLoaded = this.fotoSrc; - this.galeriaFotos = []; + this.galeriaFotos = this.tab1Service.galeria; } @@ -73,8 +78,9 @@ export class PerfilDiscotecaPage implements OnInit { } addGaleria(){ - this.galeriaFotos.push(this.someURL); - this.slides.update(); + this.tab1Service.galeria.push(this.someURL); + this.galeriaFotos = this.tab1Service.galeria; + this.slides.update(); } @@ -158,14 +164,30 @@ export class PerfilDiscotecaPage implements OnInit { this.slides.update(); } -addEvento() { - this.router.navigate(['/tabs/tab1/prompt-evento']); + addEvento() { + this.tab1Service.editarEvento=false; + this.router.navigate(['/tabs/tab1/prompt-evento']); } -mostrarEvento(evento: Evento){ - this.tab1Service.eventoIndex = this.eventos.indexOf(evento); - this.router.navigate(['/tabs/tab1/view-evento']); + mostrarEvento(evento: Evento){ + this.tab1Service.eventoIndex = this.eventos.indexOf(evento); + this.router.navigate(['/tabs/tab1/view-evento']); } + + editarEvento(evento: Evento){ + this.tab1Service.eventoIndex = this.eventos.indexOf(evento); + this.tab1Service.editarEvento = true; + this.router.navigate(['/tabs/tab1/prompt-evento']); +} + + openPreview(foto: string){ + this.modalController.create({ + component: GaleriamodalPage, + componentProps: { + foto: foto + } + }).then(modal=>modal.present()); + } } diff --git a/src/app/prompt-evento/prompt-evento.page.ts b/src/app/prompt-evento/prompt-evento.page.ts index 80243b0..77163c3 100644 --- a/src/app/prompt-evento/prompt-evento.page.ts +++ b/src/app/prompt-evento/prompt-evento.page.ts @@ -3,14 +3,13 @@ import { FormControl, FormGroup } from '@angular/forms'; import { Tab1Service } from '../tab1/tab1.service'; import { Evento } from '../evento'; import { Router } from '@angular/router'; -import { FormBuilder } from '@angular/forms'; @Component({ selector: 'app-prompt-evento', templateUrl: './prompt-evento.page.html', styleUrls: ['./prompt-evento.page.scss'], }) -export class PromptEventoPage{ +export class PromptEventoPage implements OnInit{ eventoForm = new FormGroup({ nombre: new FormControl(''), fecha: new FormControl(''), @@ -23,9 +22,14 @@ export class PromptEventoPage{ eventos: Evento[]; constructor(private tab1Service: Tab1Service, private router: Router) { - this.eventos = []; - } + } + + ngOnInit(){ + if (this.tab1Service.editarEvento==true){ + this.eventoForm = this.tab1Service.eventoForms[this.tab1Service.eventoIndex]; + } + } onSubmit(){ let evento = new Evento(); this.asignarEvento(evento); @@ -41,7 +45,16 @@ export class PromptEventoPage{ //evento.setHora(evento.getFecha()); transformar en dia y hora if (!this.tab1Service.eventos){ this.tab1Service.initEventos();} - this.tab1Service.eventos.push(evento); + if(!this.tab1Service.eventoForms){ + this.tab1Service.initEventoForms();} + if(this.tab1Service.editarEvento==true){ + this.tab1Service.eventos[this.tab1Service.eventoIndex] = evento; + this.tab1Service.eventoForms[this.tab1Service.eventoIndex] = this.eventoForm; + } + else{ + this.tab1Service.eventos.push(evento); + this.tab1Service.eventoForms.push(this.eventoForm);} + } diff --git a/src/app/tab1/tab1-routing.module.ts b/src/app/tab1/tab1-routing.module.ts index c0e8f23..19fb6ff 100644 --- a/src/app/tab1/tab1-routing.module.ts +++ b/src/app/tab1/tab1-routing.module.ts @@ -6,14 +6,10 @@ import { PromptEventoPage } from '../prompt-evento/prompt-evento.page' import { ViewEventoPage } from '../view-evento/view-evento.page' const routes: Routes = [ - { - path: '', - redirectTo: 'perfil-discoteca', - pathMatch: 'full', - }, + { - path: 'perfil-discoteca', + path: '', component: PerfilDiscotecaPage }, @@ -26,9 +22,9 @@ const routes: Routes = [ path: 'view-evento', component: ViewEventoPage } - + diff --git a/src/app/tab1/tab1.service.ts b/src/app/tab1/tab1.service.ts index 5088eab..c07d3c7 100644 --- a/src/app/tab1/tab1.service.ts +++ b/src/app/tab1/tab1.service.ts @@ -2,8 +2,8 @@ import { Injectable, OnInit } from '@angular/core'; import { stringify } from 'querystring'; import { Tab1Page } from './tab1.page' import { Discoteca } from '../discoteca' -import { Galeria } from '../galeria'; import { Evento } from '../evento'; +import { FormControl, FormGroup } from '@angular/forms'; import { NumericValueAccessor } from '@ionic/angular'; @@ -13,9 +13,11 @@ import { NumericValueAccessor } from '@ionic/angular'; export class Tab1Service implements OnInit{ discoteca: Discoteca; - galeria: Galeria; + galeria: string[]; eventos: Evento[]; + eventoForms: FormGroup[]; eventoIndex: number; + editarEvento: boolean; constructor() { @@ -30,9 +32,9 @@ export class Tab1Service implements OnInit{ this.discoteca.setNombre('Barraca'); this.discoteca.setTelefono(666666666); this.discoteca.setLocalizacion('Calle del Barquillo'); - this.galeria = new Galeria(); + this.galeria = []; this.initEventos(); - this.galeria.setDiscoteca(this.discoteca.getNombre()); + this.editarEvento = false; } getNombre(): string{ @@ -58,6 +60,10 @@ export class Tab1Service implements OnInit{ this.eventos = []; } + initEventoForms(): void{ + this.eventoForms = []; + } + getEventobyIndex(eventoIndex: number){ return this.eventos[eventoIndex]; } diff --git a/src/app/tabs/tabs-routing.module.ts b/src/app/tabs/tabs-routing.module.ts index 19c6a1b..90830aa 100644 --- a/src/app/tabs/tabs-routing.module.ts +++ b/src/app/tabs/tabs-routing.module.ts @@ -4,12 +4,12 @@ import { TabsPage } from './tabs.page'; const routes: Routes = [ { - path: 'tabs', + path: '', component: TabsPage, children: [ { path: 'tab1', - loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule) + loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule), }, { path: 'tab2', @@ -21,16 +21,14 @@ const routes: Routes = [ }, { path: '', - redirectTo: '/tabs/tab1', + redirectTo: 'tab1', pathMatch: 'full' }, - - ] }, { path: '', - redirectTo: '/tabs/tab1', + redirectTo: 'tabs', pathMatch: 'full' } ]; diff --git a/src/app/view-evento/view-evento.page.html b/src/app/view-evento/view-evento.page.html index fbd24ed..e44a147 100644 --- a/src/app/view-evento/view-evento.page.html +++ b/src/app/view-evento/view-evento.page.html @@ -5,5 +5,22 @@ - {{evento.nombre}} + + + + + {{evento.nombre}} · + + {{evento.fecha}} · + + {{evento.precio1}},{{evento.precio2}} + + + + + {{evento.descripcion}} + + + + diff --git a/src/app/view-evento/view-evento.page.scss b/src/app/view-evento/view-evento.page.scss index e69de29..aef8929 100644 --- a/src/app/view-evento/view-evento.page.scss +++ b/src/app/view-evento/view-evento.page.scss @@ -0,0 +1,17 @@ +.eventoHeader{ + font-weight: bold; + } + + .eventoDesc{ + color: white; + margin-top: 20px; + } + +.evento{ + display: block; + max-width: 800px; + max-height: auto; + margin: auto; + text-align: justify; + +} \ No newline at end of file diff --git a/src/assets/img/1.jpeg b/src/assets/img/1.jpeg new file mode 100644 index 0000000..14d8138 Binary files /dev/null and b/src/assets/img/1.jpeg differ diff --git a/src/assets/img/2.jpg b/src/assets/img/2.jpg new file mode 100644 index 0000000..d09fc0b Binary files /dev/null and b/src/assets/img/2.jpg differ diff --git a/src/assets/img/3.jpg b/src/assets/img/3.jpg new file mode 100644 index 0000000..e805984 Binary files /dev/null and b/src/assets/img/3.jpg differ diff --git a/src/assets/barraca.jpg b/src/assets/img/barraca.jpg similarity index 100% rename from src/assets/barraca.jpg rename to src/assets/img/barraca.jpg