diff --git a/src/app/api.service.ts b/src/app/api.service.ts deleted file mode 100644 index 32381eb..0000000 --- a/src/app/api.service.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { Observable, throwError } from 'rxjs'; -import { catchError, retry } from 'rxjs/operators'; -import { User } from './user'; -import { Discoteca } from './discoteca'; - -@Injectable({ - providedIn: 'root' -}) -export class ApiService { - - constructor(private http: HttpClient) { - - } - - - validateUser(loginUser: string, loginPassword: string): boolean{ - return (loginUser==''); - } - - getUser (loginUser: string): void{ - - } - - postNewUser(user: User): void{ - - } - - postNewDiscoteca(discoteca: Discoteca): void{ - - } -} 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/discoteca.ts b/src/app/discoteca.ts index 8114e04..8438b79 100644 --- a/src/app/discoteca.ts +++ b/src/app/discoteca.ts @@ -10,6 +10,13 @@ export class Discoteca { 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; 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 2e1fcfe..0000000 --- a/src/app/login.service.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ApiService } from './api.service'; -import { User } from './user'; - -@Injectable({ - providedIn: 'root' -}) -export class LoginService { - - private userId: number; - private sessionType: number; - private loginUser: string; - private loginPassword: string; - - constructor(private apiService: ApiService) { - - } - - validateUser(loginUser: string, loginPassword: string): boolean{ - return (loginUser==''); - } - - getUser (loginUser: string): void{ - - } - - postNewUser(user: User): void{ - - } -} 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 9d79548..fd858bb 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'; @@ -28,7 +28,7 @@ export class PerfilDiscotecaPage implements OnInit { editEnabled: string; galeriaFotos: string[]; currentIndex: number; - eventos: Evento[]; + eventos: Eventoi[]; alertCtrl: AlertController; sliderOpts = { slidesPerView: 1.5, @@ -70,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; } getDescripcion(): void{ @@ -179,12 +184,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 bd7d349..147e07f 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 + + +