diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 7675048..c4f4dc7 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -23,7 +23,7 @@ const routes: Routes = [ }, { path:'', - redirectTo: 'tabs', + redirectTo: 'login', pathMatch: 'full' }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9ba0407..287c89e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; +import { HttpClientModule } from '@angular/common/http'; import { RouteReuseStrategy } from '@angular/router'; import { ReactiveFormsModule } from '@angular/forms'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; @@ -15,7 +16,7 @@ import { LoginPage } from './login/login.page'; @NgModule({ declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage], entryComponents: [], - imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule], + imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule], providers: [ StatusBar, SplashScreen, diff --git a/src/app/discoteca.ts b/src/app/discoteca.ts index 63143b7..8438b79 100644 --- a/src/app/discoteca.ts +++ b/src/app/discoteca.ts @@ -8,7 +8,15 @@ export class Discoteca { private telefono: number; private localizacion: string; private eventos: Evento[]; + private descripcion: string; + setId(id: number): void{ + this.id = id; + } + + getId(): number{ + return this.id; + } setNombre(nombre: string): void{ this.nombre = nombre; @@ -37,4 +45,12 @@ export class Discoteca { getEventos(): Evento[]{ return this.eventos; } + + setDescripcion(desc: string): void{ + this.descripcion = desc; + } + + getDescripcion(): string{ + return this.descripcion; + } } diff --git a/src/app/evento.spec.ts b/src/app/evento.spec.ts deleted file mode 100644 index e2e7d95..0000000 --- a/src/app/evento.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Evento } from './evento'; - -describe('Evento', () => { - it('should create an instance', () => { - expect(new Evento()).toBeTruthy(); - }); -}); diff --git a/src/app/evento.ts b/src/app/evento.ts deleted file mode 100644 index 0471ab1..0000000 --- a/src/app/evento.ts +++ /dev/null @@ -1,75 +0,0 @@ -export class Evento { - private id: number; - nombre: string; - localizacion: string; - fecha: Date; - dia: string; - hora: string; - descripcion: string; - precio1: number; - precio2: number; - - setNombre(nombre: string): void{ - this.nombre = nombre; - } - - getNombre(): string{ - return this.nombre; - } - - setLocalizacion(localizacion: string): void{ - this.localizacion = localizacion; - } - - getLocalizacion(): string{ - return this.localizacion - } - - setFecha(fecha: Date): void{ - this.fecha = fecha; - } - - getFecha(): Date{ - return this.fecha; - } - - setDesc(desc: string): void{ - this.descripcion = desc; - } - - getDesc(): string{ - return this.descripcion; - } - - setDia(fecha: Date): void{ - this.dia = fecha.getDate()+"/"+fecha.getMonth(); - } - - getDia(): string{ - return this.dia; - } - - setHora(fecha: Date): void{ - this.hora = fecha.getHours()+":"+fecha.getMinutes(); - } - - getHora(): string{ - return this.hora; - } - - setPrecio1(precio: number): void{ - this.precio1 = precio; - } - - getPrecio1(): number{ - return this.precio1; - } - - setPrecio2(precio: number): void{ - this.precio2 = precio; - } - - getPrecio2(): number{ - return this.precio2; - } -} diff --git a/src/app/interfaces/discoteca-i.ts b/src/app/interfaces/discoteca-i.ts new file mode 100644 index 0000000..c5e5c93 --- /dev/null +++ b/src/app/interfaces/discoteca-i.ts @@ -0,0 +1,6 @@ +export interface DiscotecaI { + discotecaID: number, + nombre: string, + telefono: number, + localizacion: string +} diff --git a/src/app/interfaces/eventoi.ts b/src/app/interfaces/eventoi.ts new file mode 100644 index 0000000..b613b3c --- /dev/null +++ b/src/app/interfaces/eventoi.ts @@ -0,0 +1,14 @@ +import { Time } from "@angular/common"; + +export interface Eventoi { + id: number, + discotecaID: number, + nombre: string, + localizacion: string, + fecha: Date, + hora: Time, + descripcion: string, + precio1: number, + precio2: number, + +} diff --git a/src/app/interfaces/user-login.ts b/src/app/interfaces/user-login.ts new file mode 100644 index 0000000..f0cc9b0 --- /dev/null +++ b/src/app/interfaces/user-login.ts @@ -0,0 +1,4 @@ +export interface UserLogin { + loginUser: string; + loginPassword: string; +} diff --git a/src/app/interfaces/user.ts b/src/app/interfaces/user.ts new file mode 100644 index 0000000..f40b02f --- /dev/null +++ b/src/app/interfaces/user.ts @@ -0,0 +1,6 @@ +export interface User { + id: number; + discotecaID: number; + userType: number; + username: string; +} diff --git a/src/app/login.service.ts b/src/app/login.service.ts deleted file mode 100644 index 92c777e..0000000 --- a/src/app/login.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class LoginService { - - constructor() { } -} diff --git a/src/app/login/login.page.html b/src/app/login/login.page.html index 1a77f8b..cacbd4a 100644 --- a/src/app/login/login.page.html +++ b/src/app/login/login.page.html @@ -5,7 +5,14 @@ + Usuario: + ContraseƱa: Login +
+
+ {{user.username}} +
+
diff --git a/src/app/login/login.page.scss b/src/app/login/login.page.scss index e69de29..1bdc99e 100644 --- a/src/app/login/login.page.scss +++ b/src/app/login/login.page.scss @@ -0,0 +1,3 @@ +input{ + color: black; +} \ No newline at end of file diff --git a/src/app/login/login.page.ts b/src/app/login/login.page.ts index 75a025e..c33e6a8 100644 --- a/src/app/login/login.page.ts +++ b/src/app/login/login.page.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; +import { LoginService } from '../services/login.service'; +import { User } from '../interfaces/user'; @Component({ selector: 'app-login', @@ -8,13 +10,23 @@ import { Router } from '@angular/router'; }) export class LoginPage implements OnInit { - constructor(private router: Router) { } + username: string; + password: string; + user: User; + + constructor(private router: Router, private loginService: LoginService) { } ngOnInit() { + this.user = this.loginService.user; } - login(){ - this.router.navigate(['/tabs']); + login() { + + this.username = (document.getElementById("username")).value; + this.password = (document.getElementById("password")).value; + this.loginService.validateUser(this.username, this.password) + + } } diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.ts b/src/app/perfil-discoteca/perfil-discoteca.page.ts index deeaeb9..2438f98 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.ts +++ b/src/app/perfil-discoteca/perfil-discoteca.page.ts @@ -3,7 +3,7 @@ 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 { Eventoi } from '../interfaces/eventoi'; import { Router } from '@angular/router'; import { THIS_EXPR } from '@angular/compiler/src/output/output_ast'; import { GaleriamodalPage } from '../galeriamodal/galeriamodal.page'; @@ -20,6 +20,7 @@ export class PerfilDiscotecaPage implements OnInit { nombre: string; telefono: number; localizacion: string; + descripcion: string; fotoSrc: string; fotoLoaded: string; someURL: string; @@ -27,7 +28,7 @@ export class PerfilDiscotecaPage implements OnInit { editEnabled: string; galeriaFotos: string[]; currentIndex: number; - eventos: Evento[]; + eventos: Eventoi[]; alertCtrl: AlertController; sliderOpts = { slidesPerView: 1.5, @@ -69,8 +70,13 @@ export class PerfilDiscotecaPage implements OnInit { this.localizacion = this.tab1Service.getLocalizacion(); } + + getDescripcion(): void{ + this.descripcion = this.tab1Service.getDescripcion(); + } + getEventos(): void{ - this.eventos = this.tab1Service.getEventos(); + this.eventos = this.tab1Service.eventos; } cargarImagen(){ @@ -169,12 +175,12 @@ export class PerfilDiscotecaPage implements OnInit { this.router.navigate(['/tabs/tab1/prompt-evento']); } - mostrarEvento(evento: Evento){ + mostrarEvento(evento: Eventoi){ this.tab1Service.eventoIndex = this.eventos.indexOf(evento); this.router.navigate(['/tabs/tab1/view-evento']); } - editarEvento(evento: Evento){ + editarEvento(evento: Eventoi){ this.tab1Service.eventoIndex = this.eventos.indexOf(evento); this.tab1Service.editarEvento = true; this.router.navigate(['/tabs/tab1/prompt-evento']); diff --git a/src/app/prompt-evento/prompt-evento.page.html b/src/app/prompt-evento/prompt-evento.page.html index 94845bd..8e2cd63 100644 --- a/src/app/prompt-evento/prompt-evento.page.html +++ b/src/app/prompt-evento/prompt-evento.page.html @@ -21,7 +21,7 @@ @@ -29,6 +29,17 @@ + + + + Tu evento necesita una hora + + +