Compare commits
1 Commits
BackEnd
...
0b84c0987e
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b84c0987e |
33
package-lock.json
generated
33
package-lock.json
generated
@@ -358,6 +358,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@angular/animations": {
|
||||||
|
"version": "11.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@angular/animations/-/animations-11.2.1.tgz",
|
||||||
|
"integrity": "sha512-U2gtMaiVfTNMn0FPpSDTgOgtYc45QUnQcc2Po40rCmgH7BGyJAOgmaXY9uv319Jjl+vNrX+bbXaZix73Zpjfyg==",
|
||||||
|
"requires": {
|
||||||
|
"tslib": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@angular/cdk": {
|
||||||
|
"version": "11.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-11.2.1.tgz",
|
||||||
|
"integrity": "sha512-d+ERvvWqGykBm5ooWG8TmMjL6q6aOpUd13ha1sx960EfKJqNyideYUfPMp6xprTyxmUIUZ/G9AQ/pxnzrLGnsA==",
|
||||||
|
"requires": {
|
||||||
|
"parse5": "^5.0.0",
|
||||||
|
"tslib": "^2.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"parse5": {
|
||||||
|
"version": "5.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",
|
||||||
|
"integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==",
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@angular/cli": {
|
"@angular/cli": {
|
||||||
"version": "10.0.8",
|
"version": "10.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@angular/cli/-/cli-10.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/cli/-/cli-10.0.8.tgz",
|
||||||
@@ -832,6 +857,14 @@
|
|||||||
"integrity": "sha512-QQLYUjD0T6u2hLNYXUEUbupAGsz5egmhCAckaQojvXCe3SLL/hQsrK4odrNuspy7TvMB0H5ZNEHGlF6m/WLZ3g==",
|
"integrity": "sha512-QQLYUjD0T6u2hLNYXUEUbupAGsz5egmhCAckaQojvXCe3SLL/hQsrK4odrNuspy7TvMB0H5ZNEHGlF6m/WLZ3g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@angular/material": {
|
||||||
|
"version": "11.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@angular/material/-/material-11.2.1.tgz",
|
||||||
|
"integrity": "sha512-unHC8W+GcZSNRNSZ4l3ABdbezf6PIUtShx5MMG6HXgieqlkEgkU0W0BAeGvO/61vl6yEebizMYD/+5yqM9lUlw==",
|
||||||
|
"requires": {
|
||||||
|
"tslib": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@angular/platform-browser": {
|
"@angular/platform-browser": {
|
||||||
"version": "10.0.14",
|
"version": "10.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-10.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-10.0.14.tgz",
|
||||||
|
|||||||
@@ -13,9 +13,12 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@angular/animations": "^11.2.1",
|
||||||
|
"@angular/cdk": "^11.2.1",
|
||||||
"@angular/common": "~10.0.0",
|
"@angular/common": "~10.0.0",
|
||||||
"@angular/core": "~10.0.0",
|
"@angular/core": "~10.0.0",
|
||||||
"@angular/forms": "~10.0.0",
|
"@angular/forms": "~10.0.0",
|
||||||
|
"@angular/material": "^11.2.1",
|
||||||
"@angular/platform-browser": "~10.0.0",
|
"@angular/platform-browser": "~10.0.0",
|
||||||
"@angular/platform-browser-dynamic": "~10.0.0",
|
"@angular/platform-browser-dynamic": "~10.0.0",
|
||||||
"@angular/router": "~10.0.0",
|
"@angular/router": "~10.0.0",
|
||||||
@@ -75,4 +78,4 @@
|
|||||||
"android"
|
"android"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
33
src/app/api.service.ts
Normal file
33
src/app/api.service.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
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{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ const routes: Routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path:'',
|
path:'',
|
||||||
redirectTo: 'login',
|
redirectTo: 'tabs',
|
||||||
pathMatch: 'full'
|
pathMatch: 'full'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ import { AppComponent } from './app.component';
|
|||||||
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 { GaleriamodalPageModule } from './galeriamodal/galeriamodal.module';
|
import { GaleriamodalPageModule } from './galeriamodal/galeriamodal.module';
|
||||||
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { LoginPage } from './login/login.page';
|
import { LoginPage } from './login/login.page';
|
||||||
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage],
|
declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage],
|
||||||
entryComponents: [],
|
entryComponents: [],
|
||||||
imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule],
|
imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule, MatMenuModule, BrowserAnimationsModule],
|
||||||
providers: [
|
providers: [
|
||||||
StatusBar,
|
StatusBar,
|
||||||
SplashScreen,
|
SplashScreen,
|
||||||
|
|||||||
@@ -10,13 +10,6 @@ export class Discoteca {
|
|||||||
private eventos: Evento[];
|
private eventos: Evento[];
|
||||||
private descripcion: string;
|
private descripcion: string;
|
||||||
|
|
||||||
setId(id: number): void{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
getId(): number{
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
setNombre(nombre: string): void{
|
setNombre(nombre: string): void{
|
||||||
this.nombre = nombre;
|
this.nombre = nombre;
|
||||||
@@ -50,7 +43,7 @@ export class Discoteca {
|
|||||||
this.descripcion = desc;
|
this.descripcion = desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDescripcion(): string{
|
get Descripcion(): string{
|
||||||
return this.descripcion;
|
return this.descripcion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7
src/app/evento.spec.ts
Normal file
7
src/app/evento.spec.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { Evento } from './evento';
|
||||||
|
|
||||||
|
describe('Evento', () => {
|
||||||
|
it('should create an instance', () => {
|
||||||
|
expect(new Evento()).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
75
src/app/evento.ts
Normal file
75
src/app/evento.ts
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
export interface DiscotecaI {
|
|
||||||
discotecaID: number,
|
|
||||||
nombre: string,
|
|
||||||
telefono: number,
|
|
||||||
localizacion: string
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
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,
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
export interface UserLogin {
|
|
||||||
loginUser: string;
|
|
||||||
loginPassword: string;
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
export interface User {
|
|
||||||
id: number;
|
|
||||||
discotecaID: number;
|
|
||||||
userType: number;
|
|
||||||
username: string;
|
|
||||||
}
|
|
||||||
30
src/app/login.service.ts
Normal file
30
src/app/login.service.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
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{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,14 +5,7 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<span>Usuario: </span><input type="text" id="username">
|
|
||||||
<span>Contraseña: </span><input type="text" id="password">
|
|
||||||
<ion-button (click)="login()">
|
<ion-button (click)="login()">
|
||||||
Login
|
Login
|
||||||
</ion-button>
|
</ion-button>
|
||||||
<div>
|
|
||||||
<div *ngIf="user">
|
|
||||||
{{user.username}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
input{
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { LoginService } from '../services/login.service';
|
|
||||||
import { User } from '../interfaces/user';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
@@ -10,23 +8,13 @@ import { User } from '../interfaces/user';
|
|||||||
})
|
})
|
||||||
export class LoginPage implements OnInit {
|
export class LoginPage implements OnInit {
|
||||||
|
|
||||||
username: string;
|
constructor(private router: Router) { }
|
||||||
password: string;
|
|
||||||
user: User;
|
|
||||||
|
|
||||||
constructor(private router: Router, private loginService: LoginService) { }
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.user = this.loginService.user;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
login() {
|
login(){
|
||||||
|
this.router.navigate(['/tabs']);
|
||||||
this.username = (<HTMLInputElement>document.getElementById("username")).value;
|
|
||||||
this.password = (<HTMLInputElement>document.getElementById("password")).value;
|
|
||||||
this.loginService.validateUser(this.username, this.password)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,40 +8,13 @@
|
|||||||
|
|
||||||
<ion-content [fullscreen]="true">
|
<ion-content [fullscreen]="true">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class='fotoPerfil'>
|
<div class='fotoPerfil'>
|
||||||
<ion-grid>
|
<ion-grid>
|
||||||
<ion-row>
|
<ion-row>
|
||||||
<ion-col>
|
|
||||||
<ion-img class="fotoPerfil" width="100%" height="100%" [src]='fotoSrc' alt='barraquinha'></ion-img>
|
<ion-img class="fotoPerfil" width="100%" height="100%" [src]='fotoSrc' alt='barraquinha'></ion-img>
|
||||||
<div class="textoPie">{{nombre}}</div>
|
<div class="textoPie">{{nombre}}</div>
|
||||||
|
|
||||||
<div class="addFoto">
|
|
||||||
<ion-button [disabled]='editDisabled'>
|
|
||||||
<ion-icon name="image" slot="icon-only"></ion-icon>
|
|
||||||
<input type="file" (change)="loadImageFromDevice($event);cargarImagen()" id="file-input-perfil" accept="image/png, image/jpeg">
|
|
||||||
</ion-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<ion-button (click)="enableEdit()" label="editar" [disabled]='editEnabled'>
|
|
||||||
<ion-icon name="create"></ion-icon>
|
|
||||||
</ion-button>
|
|
||||||
<div id="botonesHidden1" class="botonesHidden">
|
|
||||||
<ion-button (click)="saveEdit()" label="guardar" [disabled]='editDisabled'>
|
|
||||||
<ion-icon name="save"></ion-icon>
|
|
||||||
</ion-button>
|
|
||||||
<ion-button (click)="cancelEdit()" [disabled]='editDisabled'>
|
|
||||||
Cancelar
|
|
||||||
</ion-button></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ion-col>
|
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
|
||||||
|
|
||||||
<ion-row>
|
<ion-row>
|
||||||
<ion-col>
|
<ion-col>
|
||||||
@@ -52,10 +25,16 @@
|
|||||||
<div [contentEditable]='editEnabled'>{{localizacion}}</div>
|
<div [contentEditable]='editEnabled'>{{localizacion}}</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
|
|
||||||
<ion-col>
|
<ion-col>
|
||||||
|
<div>{{descripcion}}</div>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
||||||
|
|
||||||
|
<ion-row>
|
||||||
<div class="galeria">
|
<div class="galeria">
|
||||||
Galería de Fotos
|
Galería de Fotos
|
||||||
|
|
||||||
<input type="file" (change)="loadImageFromDevice($event)" id="file-input-galeria" accept="image/png, image/jpeg">
|
<input type="file" (change)="loadImageFromDevice($event)" id="file-input-galeria" accept="image/png, image/jpeg">
|
||||||
<ion-slides (ionDrag)="onSlideChanged()" [options]="sliderOpts">
|
<ion-slides (ionDrag)="onSlideChanged()" [options]="sliderOpts">
|
||||||
<ion-slide *ngFor="let foto of galeriaFotos">
|
<ion-slide *ngFor="let foto of galeriaFotos">
|
||||||
@@ -69,18 +48,8 @@
|
|||||||
</ion-slide>
|
</ion-slide>
|
||||||
</ion-slides>
|
</ion-slides>
|
||||||
</div>
|
</div>
|
||||||
</ion-col>
|
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
|
||||||
|
|
||||||
<ion-row>
|
|
||||||
<ion-button (click)="addEvento()">
|
|
||||||
<ion-icon name="add-circle-outline">
|
|
||||||
</ion-icon>
|
|
||||||
Añadir evento
|
|
||||||
</ion-button>
|
|
||||||
</ion-row>
|
|
||||||
|
|
||||||
<ion-row>
|
<ion-row>
|
||||||
<div *ngIf="eventos.length>0" class="eventos">
|
<div *ngIf="eventos.length>0" class="eventos">
|
||||||
<ion-list>
|
<ion-list>
|
||||||
@@ -102,13 +71,40 @@
|
|||||||
</ion-list>
|
</ion-list>
|
||||||
</div>
|
</div>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
|
||||||
|
<ion-row>
|
||||||
|
<button mat-icon-button [matMenuTriggerFor]="menu">
|
||||||
|
<ion-icon name="create"></ion-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<mat-menu #menu="matMenu">
|
||||||
|
<button mat-menu-item [disabled]='editDisabled'>
|
||||||
|
<ion-icon name="image" slot="icon-only"></ion-icon>
|
||||||
|
<input type="file" (change)="loadImageFromDevice($event);cargarImagen()" id="file-input-perfil" accept="image/png, image/jpeg">
|
||||||
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
<button mat-menu-item (click)="enableEdit()" label="editar" [disabled]='editEnabled'>
|
||||||
|
<ion-icon name="create"></ion-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button mat-menu-item (click)="saveEdit()" label="guardar" [disabled]='editDisabled'>
|
||||||
|
<ion-icon name="save"></ion-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button mat-menu-item (click)="cancelEdit()" [disabled]='editDisabled'>
|
||||||
|
Cancelar
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button mat-menu-item (click)="addEvento()">
|
||||||
|
<ion-icon name="add-circle-outline">
|
||||||
|
</ion-icon>
|
||||||
|
Añadir evento
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</mat-menu>
|
||||||
|
</ion-row>
|
||||||
</ion-grid>
|
</ion-grid>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
@@ -3,8 +3,9 @@ import { Tab1Service } from '../tab1/tab1.service';
|
|||||||
import { IonSlides, ModalController} from '@ionic/angular';
|
import { IonSlides, ModalController} from '@ionic/angular';
|
||||||
import { AlertController } from '@ionic/angular';
|
import { AlertController } from '@ionic/angular';
|
||||||
import { ViewChild } from '@angular/core';
|
import { ViewChild } from '@angular/core';
|
||||||
import { Eventoi } from '../interfaces/eventoi';
|
import { Evento } from '../evento';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
|
||||||
import { THIS_EXPR } from '@angular/compiler/src/output/output_ast';
|
import { THIS_EXPR } from '@angular/compiler/src/output/output_ast';
|
||||||
import { GaleriamodalPage } from '../galeriamodal/galeriamodal.page';
|
import { GaleriamodalPage } from '../galeriamodal/galeriamodal.page';
|
||||||
import { stringify } from '@angular/compiler/src/util';
|
import { stringify } from '@angular/compiler/src/util';
|
||||||
@@ -17,10 +18,10 @@ import { stringify } from '@angular/compiler/src/util';
|
|||||||
export class PerfilDiscotecaPage implements OnInit {
|
export class PerfilDiscotecaPage implements OnInit {
|
||||||
|
|
||||||
@ViewChild('IonSlides') slides: IonSlides;
|
@ViewChild('IonSlides') slides: IonSlides;
|
||||||
|
@ViewChild('MatMenuTrigger') trigger: MatMenuTrigger;
|
||||||
nombre: string;
|
nombre: string;
|
||||||
telefono: number;
|
telefono: number;
|
||||||
localizacion: string;
|
localizacion: string;
|
||||||
descripcion: string;
|
|
||||||
fotoSrc: string;
|
fotoSrc: string;
|
||||||
fotoLoaded: string;
|
fotoLoaded: string;
|
||||||
someURL: string;
|
someURL: string;
|
||||||
@@ -28,7 +29,7 @@ export class PerfilDiscotecaPage implements OnInit {
|
|||||||
editEnabled: string;
|
editEnabled: string;
|
||||||
galeriaFotos: string[];
|
galeriaFotos: string[];
|
||||||
currentIndex: number;
|
currentIndex: number;
|
||||||
eventos: Eventoi[];
|
eventos: Evento[];
|
||||||
alertCtrl: AlertController;
|
alertCtrl: AlertController;
|
||||||
sliderOpts = {
|
sliderOpts = {
|
||||||
slidesPerView: 1.5,
|
slidesPerView: 1.5,
|
||||||
@@ -70,13 +71,8 @@ export class PerfilDiscotecaPage implements OnInit {
|
|||||||
this.localizacion = this.tab1Service.getLocalizacion();
|
this.localizacion = this.tab1Service.getLocalizacion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getDescripcion(): void{
|
|
||||||
this.descripcion = this.tab1Service.getDescripcion();
|
|
||||||
}
|
|
||||||
|
|
||||||
getEventos(): void{
|
getEventos(): void{
|
||||||
this.eventos = this.tab1Service.eventos;
|
this.eventos = this.tab1Service.getEventos();
|
||||||
}
|
}
|
||||||
|
|
||||||
cargarImagen(){
|
cargarImagen(){
|
||||||
@@ -175,12 +171,12 @@ export class PerfilDiscotecaPage implements OnInit {
|
|||||||
this.router.navigate(['/tabs/tab1/prompt-evento']);
|
this.router.navigate(['/tabs/tab1/prompt-evento']);
|
||||||
}
|
}
|
||||||
|
|
||||||
mostrarEvento(evento: Eventoi){
|
mostrarEvento(evento: Evento){
|
||||||
this.tab1Service.eventoIndex = this.eventos.indexOf(evento);
|
this.tab1Service.eventoIndex = this.eventos.indexOf(evento);
|
||||||
this.router.navigate(['/tabs/tab1/view-evento']);
|
this.router.navigate(['/tabs/tab1/view-evento']);
|
||||||
}
|
}
|
||||||
|
|
||||||
editarEvento(evento: Eventoi){
|
editarEvento(evento: Evento){
|
||||||
this.tab1Service.eventoIndex = this.eventos.indexOf(evento);
|
this.tab1Service.eventoIndex = this.eventos.indexOf(evento);
|
||||||
this.tab1Service.editarEvento = true;
|
this.tab1Service.editarEvento = true;
|
||||||
this.router.navigate(['/tabs/tab1/prompt-evento']);
|
this.router.navigate(['/tabs/tab1/prompt-evento']);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<ion-item>
|
<ion-item>
|
||||||
<label>
|
<label>
|
||||||
Fecha:
|
Fecha:
|
||||||
<ion-datetime displayFormat="YYYY/DD/MM"placeholder="Elegir Fecha" formControlName="fecha"></ion-datetime>
|
<ion-datetime displayFormat="DD/MM, HH:mm"placeholder="Elegir Fecha" formControlName="fecha"></ion-datetime>
|
||||||
</label>
|
</label>
|
||||||
<span
|
<span
|
||||||
*ngIf="fecha.errors.required && submitted">
|
*ngIf="fecha.errors.required && submitted">
|
||||||
@@ -29,17 +29,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-item>
|
|
||||||
<label>
|
|
||||||
Hora
|
|
||||||
<ion-datetime displayFormat="HH:MM"placeholder="Elegir Hora" formControlName="hora"></ion-datetime>
|
|
||||||
</label>
|
|
||||||
<span
|
|
||||||
*ngIf="hora.errors.required && submitted">
|
|
||||||
Tu evento necesita una hora
|
|
||||||
</span>
|
|
||||||
</ion-item>
|
|
||||||
|
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<label>
|
<label>
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
import { Tab1Service } from '../tab1/tab1.service';
|
import { Tab1Service } from '../tab1/tab1.service';
|
||||||
|
import { Evento } from '../evento';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Eventoi } from '../interfaces/eventoi';
|
|
||||||
import { DatePipe } from '@angular/common'
|
|
||||||
import { ViewEventoPageRoutingModule } from '../view-evento/view-evento-routing.module';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-prompt-evento',
|
selector: 'app-prompt-evento',
|
||||||
@@ -12,17 +10,17 @@ import { ViewEventoPageRoutingModule } from '../view-evento/view-evento-routing.
|
|||||||
styleUrls: ['./prompt-evento.page.scss'],
|
styleUrls: ['./prompt-evento.page.scss'],
|
||||||
})
|
})
|
||||||
export class PromptEventoPage implements OnInit{
|
export class PromptEventoPage implements OnInit{
|
||||||
|
|
||||||
submitted = false;
|
submitted = false;
|
||||||
eventoForm = new FormGroup({
|
eventoForm = new FormGroup({
|
||||||
nombre: new FormControl(null, Validators.required),
|
nombre: new FormControl('', Validators.required),
|
||||||
fecha: new FormControl(null, Validators.required),
|
fecha: new FormControl('', Validators.required),
|
||||||
hora: new FormControl(null, Validators.required),
|
precio1: new FormControl('', Validators.required),
|
||||||
precio1: new FormControl(null, Validators.required),
|
precio2: new FormControl('', Validators.required),
|
||||||
precio2: new FormControl(null, Validators.required),
|
descripcion: new FormControl('', Validators.required),
|
||||||
descripcion: new FormControl(null, Validators.required),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
eventos: Eventoi[];
|
eventos: Evento[];
|
||||||
|
|
||||||
constructor(private tab1Service: Tab1Service, private router: Router) {
|
constructor(private tab1Service: Tab1Service, private router: Router) {
|
||||||
|
|
||||||
@@ -36,50 +34,30 @@ export class PromptEventoPage implements OnInit{
|
|||||||
onSubmit(){
|
onSubmit(){
|
||||||
this.submitted = true;
|
this.submitted = true;
|
||||||
if (this.eventoForm.valid){
|
if (this.eventoForm.valid){
|
||||||
let evento: Eventoi = {
|
let evento = new Evento();
|
||||||
id: null,
|
|
||||||
discotecaID: this.tab1Service.discotecaI.discotecaID,
|
|
||||||
nombre: '',
|
|
||||||
localizacion: this.tab1Service.discotecaI.localizacion,
|
|
||||||
fecha: null,
|
|
||||||
hora: null,
|
|
||||||
descripcion: '',
|
|
||||||
precio1: null,
|
|
||||||
precio2: null
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
this.asignarEvento(evento);
|
this.asignarEvento(evento);
|
||||||
|
this.router.navigate(['/tabs']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
asignarEvento(evento: Eventoi){
|
asignarEvento(evento: Evento){
|
||||||
evento.nombre = this.eventoForm.get('nombre').value;
|
evento.setNombre(this.eventoForm.get('nombre').value);
|
||||||
evento.descripcion = this.eventoForm.get('descripcion').value;
|
evento.setDesc(this.eventoForm.get('descripcion').value);
|
||||||
var fecha = this.eventoForm.get('fecha').value;
|
evento.setFecha(this.eventoForm.get('fecha').value);
|
||||||
fecha = fecha.split("T")[0];
|
evento.setPrecio1(this.eventoForm.get('precio1').value);
|
||||||
evento.fecha = fecha;
|
evento.setPrecio2(this.eventoForm.get('precio2').value);
|
||||||
let hora = this.eventoForm.get('hora').value;
|
|
||||||
hora = hora.split("T")[1];
|
|
||||||
hora = hora.split(":")[0]+(":")+hora.split(":")[1];
|
|
||||||
evento.hora = hora;
|
|
||||||
evento.precio1 = this.eventoForm.get('precio1').value;
|
|
||||||
evento.precio2 = this.eventoForm.get('precio2').value;
|
|
||||||
//evento.setDia(evento.getFecha()); el datetime de Ion devuelve un String, no se puede
|
//evento.setDia(evento.getFecha()); el datetime de Ion devuelve un String, no se puede
|
||||||
|
//evento.setHora(evento.getFecha()); transformar en dia y hora
|
||||||
if (!this.tab1Service.eventos){
|
if (!this.tab1Service.eventos){
|
||||||
this.tab1Service.initEventos();}
|
this.tab1Service.initEventos();}
|
||||||
if(!this.tab1Service.eventoForms){
|
if(!this.tab1Service.eventoForms){
|
||||||
this.tab1Service.initEventoForms();}
|
this.tab1Service.initEventoForms();}
|
||||||
if(this.tab1Service.editarEvento==true){
|
if(this.tab1Service.editarEvento==true){
|
||||||
this.tab1Service.updateEvento(evento);
|
this.tab1Service.eventos[this.tab1Service.eventoIndex] = evento;
|
||||||
//this.tab1Service.eventos[this.tab1Service.eventoIndex] = evento;
|
this.tab1Service.eventoForms[this.tab1Service.eventoIndex] = this.eventoForm;
|
||||||
//this.tab1Service.eventoForms[this.tab1Service.eventoIndex] = this.eventoForm;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.tab1Service.postEvento(evento);
|
this.tab1Service.eventos.push(evento);
|
||||||
//this.tab1Service.eventos.push(evento);
|
this.tab1Service.eventoForms.push(this.eventoForm);}
|
||||||
//this.tab1Service.eventoForms.push(this.eventoForm);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +84,6 @@ export class PromptEventoPage implements OnInit{
|
|||||||
get descripcion(){
|
get descripcion(){
|
||||||
return this.eventoForm.get('descripcion');
|
return this.eventoForm.get('descripcion');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { HttpClient } from '@angular/common/http';
|
|
||||||
import { Observable, throwError, BehaviorSubject } from 'rxjs';
|
|
||||||
import { catchError, retry, map, tap } from 'rxjs/operators';
|
|
||||||
import { User } from '../interfaces/user';
|
|
||||||
import { Discoteca } from '../discoteca';
|
|
||||||
import { UserLogin } from '../interfaces/user-login';
|
|
||||||
import { DiscotecaI } from '../interfaces/discoteca-i';
|
|
||||||
import { Eventoi } from '../interfaces/eventoi';
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class ApiService {
|
|
||||||
|
|
||||||
baseUrl = "http://localhost:3307/api/consultas";
|
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
validateUser(user: UserLogin): Observable<User>{
|
|
||||||
|
|
||||||
return this.http.post<User>(this.baseUrl+"/users", user)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
getUserDiscoteca(discotecaId: number): Observable<DiscotecaI>{
|
|
||||||
|
|
||||||
return this.http.post<DiscotecaI>(this.baseUrl+"/discoteca", { "id": discotecaId});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
postEvento(eventoInterface: Eventoi): Observable<Eventoi>{
|
|
||||||
|
|
||||||
return this.http.post<Eventoi>(this.baseUrl+"/evento", eventoInterface);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
getEventos(discotecaID: number): Observable<Eventoi[]>{
|
|
||||||
return this.http.post<Eventoi[]>(this.baseUrl+"/eventosDiscoteca", {"id": discotecaID});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { Router } from '@angular/router';
|
|
||||||
import { VirtualTimeScheduler } from 'rxjs';
|
|
||||||
import { ApiService } from './api.service';
|
|
||||||
import { Tab1Service } from '../tab1/tab1.service';
|
|
||||||
import { User } from '../interfaces/user';
|
|
||||||
import { UserLogin } from '../interfaces/user-login';
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class LoginService {
|
|
||||||
|
|
||||||
user: User;
|
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private router: Router, private tab1service: Tab1Service) {
|
|
||||||
this.user = {
|
|
||||||
id: 0,
|
|
||||||
discotecaID: 0,
|
|
||||||
userType: 0,
|
|
||||||
username: '',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
validateUser(login: string, password: string): void{
|
|
||||||
|
|
||||||
let userlogin: UserLogin = {
|
|
||||||
loginUser: login,
|
|
||||||
loginPassword: password,
|
|
||||||
}
|
|
||||||
|
|
||||||
this.apiService.validateUser(userlogin)
|
|
||||||
.subscribe(user => {
|
|
||||||
this.user = user[0];
|
|
||||||
console.log(this.user);
|
|
||||||
console.log(this.user.discotecaID);
|
|
||||||
this.tab1service.getDiscoteca(this.user.discotecaID);
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,13 +2,9 @@ import { Injectable, OnInit } from '@angular/core';
|
|||||||
import { stringify } from 'querystring';
|
import { stringify } from 'querystring';
|
||||||
import { Tab1Page } from './tab1.page'
|
import { Tab1Page } from './tab1.page'
|
||||||
import { Discoteca } from '../discoteca'
|
import { Discoteca } from '../discoteca'
|
||||||
import { Observable, of } from 'rxjs';
|
import { Evento } from '../evento';
|
||||||
import { FormControl, FormGroup } from '@angular/forms';
|
import { FormControl, FormGroup } from '@angular/forms';
|
||||||
import { NumericValueAccessor } from '@ionic/angular';
|
import { NumericValueAccessor } from '@ionic/angular';
|
||||||
import { DiscotecaI } from '../interfaces/discoteca-i';
|
|
||||||
import { ApiService } from '../services/api.service';
|
|
||||||
import { Router } from '@angular/router';
|
|
||||||
import { Eventoi } from '../interfaces/eventoi';
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -17,61 +13,51 @@ import { Eventoi } from '../interfaces/eventoi';
|
|||||||
export class Tab1Service implements OnInit{
|
export class Tab1Service implements OnInit{
|
||||||
|
|
||||||
discoteca: Discoteca;
|
discoteca: Discoteca;
|
||||||
discotecaI: DiscotecaI;
|
|
||||||
galeria: string[];
|
galeria: string[];
|
||||||
eventos: Eventoi[];
|
eventos: Evento[];
|
||||||
eventoForms: FormGroup[];
|
eventoForms: FormGroup[];
|
||||||
eventoIndex: number;
|
eventoIndex: number;
|
||||||
editarEvento: boolean;
|
editarEvento: boolean;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private router: Router) {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
|
this.initValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
initValues(): void{
|
initValues(): void{
|
||||||
this.discoteca = new Discoteca();
|
this.discoteca = new Discoteca();
|
||||||
this.discoteca.setId(this.discotecaI.discotecaID);
|
this.discoteca.setNombre('Barraca');
|
||||||
this.discoteca.setNombre(this.discotecaI.nombre);
|
this.discoteca.setTelefono(666666666);
|
||||||
this.discoteca.setTelefono(this.discotecaI.telefono);
|
this.discoteca.setLocalizacion('Calle del Barquillo');
|
||||||
this.discoteca.setLocalizacion(this.discotecaI.localizacion);
|
|
||||||
this.initEventos();
|
|
||||||
this.galeria = [];
|
this.galeria = [];
|
||||||
|
this.initEventos();
|
||||||
this.editarEvento = false;
|
this.editarEvento = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNombre(): string{
|
getNombre(): string{
|
||||||
|
this.initValues();
|
||||||
return this.discoteca.getNombre();
|
return this.discoteca.getNombre();
|
||||||
}
|
}
|
||||||
|
|
||||||
getTelefono(): number{
|
getTelefono(): number{
|
||||||
|
this.initValues();
|
||||||
return this.discoteca.getTelefono();
|
return this.discoteca.getTelefono();
|
||||||
}
|
}
|
||||||
|
|
||||||
getLocalizacion(): string{
|
getLocalizacion(): string{
|
||||||
|
this.initValues();
|
||||||
return this.discoteca.getLocalizacion();
|
return this.discoteca.getLocalizacion();
|
||||||
}
|
}
|
||||||
|
|
||||||
getEventos(): Eventoi[]{
|
getEventos(): Evento[]{
|
||||||
return this.eventos;
|
return this.eventos;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDescripcion(): string{
|
|
||||||
return this.discoteca.getDescripcion();
|
|
||||||
}
|
|
||||||
|
|
||||||
initEventos(): void{
|
initEventos(): void{
|
||||||
this.eventos = [];
|
this.eventos = [];
|
||||||
this.apiService.getEventos(this.discoteca.getId())
|
|
||||||
.subscribe(eventos => {
|
|
||||||
this.eventos = eventos;
|
|
||||||
this.router.navigate(['/tabs/tab1/perfil-discoteca']);
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initEventoForms(): void{
|
initEventoForms(): void{
|
||||||
@@ -82,27 +68,4 @@ export class Tab1Service implements OnInit{
|
|||||||
return this.eventos[eventoIndex];
|
return this.eventos[eventoIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
getDiscoteca(discotecaId: number){
|
|
||||||
if (discotecaId != 0){
|
|
||||||
this.apiService.getUserDiscoteca(discotecaId)
|
|
||||||
.subscribe(discoteca => {
|
|
||||||
this.discotecaI = discoteca[0];
|
|
||||||
console.log(this.discotecaI);
|
|
||||||
this.initValues();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
postEvento(evento: Eventoi){
|
|
||||||
this.apiService.postEvento(evento)
|
|
||||||
.subscribe(evento => {
|
|
||||||
this.initEventos();
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
updateEvento(evento: Eventoi){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
6
src/app/user.ts
Normal file
6
src/app/user.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export interface User {
|
||||||
|
userId: number;
|
||||||
|
userType: number;
|
||||||
|
loginUser: string;
|
||||||
|
loginPassword: string;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user