Compare commits
25 Commits
3e7968ab7f
...
FrontEndDe
| Author | SHA1 | Date | |
|---|---|---|---|
| 80088382b5 | |||
| dc04cd122f | |||
| 59f0fcc724 | |||
| 3c2976437d | |||
| 4aa238ab9e | |||
| 277ad1d88a | |||
| 427398154b | |||
| b163dee4b7 | |||
| 4ee33458dc | |||
| 139e3fcb8b | |||
| 6c8af25e4b | |||
| 77016910fd | |||
| 10d1387936 | |||
| 099180f8d2 | |||
| 9fa286848d | |||
| bc2d935506 | |||
| 4b2d8cf7b6 | |||
| f6756c25a8 | |||
| 660f19932c | |||
| de5a925e38 | |||
| 36426bc643 | |||
| f1bf8ff75e | |||
| 659783d23f | |||
| 808fbe1561 | |||
| b9d95793dc |
1124
package-lock.json
generated
1124
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
24
package.json
24
package.json
@@ -23,16 +23,16 @@
|
||||
"@angular/platform-browser-dynamic": "~10.0.0",
|
||||
"@angular/router": "~10.0.0",
|
||||
"@capacitor/core": "2.4.3",
|
||||
"@ionic-native/core": "^5.0.0",
|
||||
"@ionic-native/splash-screen": "^5.0.0",
|
||||
"@ionic-native/status-bar": "^5.0.0",
|
||||
"@ionic/angular": "^5.0.0",
|
||||
"@ionic-native/core": "^5.31.1",
|
||||
"@ionic-native/splash-screen": "^5.31.1",
|
||||
"@ionic-native/status-bar": "^5.31.1",
|
||||
"@ionic/angular": "^5.5.4",
|
||||
"rxjs": "~6.5.5",
|
||||
"tslib": "^2.0.0",
|
||||
"tslib": "^2.1.0",
|
||||
"zone.js": "~0.10.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~0.1000.0",
|
||||
"@angular-devkit/build-angular": "^0.1000.8",
|
||||
"@angular/cli": "10.0.8",
|
||||
"@angular/compiler": "~10.0.0",
|
||||
"@angular/compiler-cli": "~10.0.0",
|
||||
@@ -41,15 +41,15 @@
|
||||
"@ionic/angular-toolkit": "^2.3.0",
|
||||
"@types/jasmine": "~3.5.0",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "^12.11.1",
|
||||
"@types/node": "^12.20.4",
|
||||
"codelyzer": "^6.0.0",
|
||||
"cordova-android": "^9.0.0",
|
||||
"cordova-plugin-device": "^2.0.2",
|
||||
"cordova-plugin-device": "^2.0.3",
|
||||
"cordova-plugin-ionic-keyboard": "^2.2.0",
|
||||
"cordova-plugin-ionic-webview": "^4.2.1",
|
||||
"cordova-plugin-splashscreen": "^5.0.2",
|
||||
"cordova-plugin-statusbar": "^2.4.2",
|
||||
"cordova-plugin-whitelist": "^1.3.3",
|
||||
"cordova-plugin-splashscreen": "^5.0.4",
|
||||
"cordova-plugin-statusbar": "^2.4.3",
|
||||
"cordova-plugin-whitelist": "^1.3.4",
|
||||
"jasmine-core": "~3.5.0",
|
||||
"jasmine-spec-reporter": "~5.0.0",
|
||||
"karma": "~5.0.0",
|
||||
@@ -60,7 +60,7 @@
|
||||
"protractor": "~7.0.0",
|
||||
"ts-node": "~8.3.0",
|
||||
"tslint": "~6.1.0",
|
||||
"typescript": "~3.9.5"
|
||||
"typescript": "^3.9.9"
|
||||
},
|
||||
"description": "An Ionic project",
|
||||
"cordova": {
|
||||
|
||||
@@ -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{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,10 @@ const routes: Routes = [
|
||||
path: 'tabs',
|
||||
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
|
||||
},
|
||||
{
|
||||
path: 'tabsUser',
|
||||
loadChildren: () => import('./tabs-user/tabs-user.module').then(m => m.TabsUserPageModule)
|
||||
},
|
||||
{
|
||||
path: 'view-evento',
|
||||
loadChildren: () => import('./view-evento/view-evento.module').then( m => m.ViewEventoPageModule)
|
||||
@@ -23,9 +27,27 @@ const routes: Routes = [
|
||||
},
|
||||
{
|
||||
path:'',
|
||||
redirectTo: 'tabs',
|
||||
redirectTo: 'login',
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'tabs-user',
|
||||
loadChildren: () => import('./tabs-user/tabs-user.module').then( m => m.TabsUserPageModule)
|
||||
},
|
||||
{
|
||||
path: 'feed',
|
||||
loadChildren: () => import('./feed/feed.module').then( m => m.FeedPageModule)
|
||||
},
|
||||
{
|
||||
path: 'view-evento-cliente',
|
||||
loadChildren: () => import('./view-evento-cliente/view-evento-cliente.module').then( m => m.ViewEventoClientePageModule)
|
||||
},
|
||||
{
|
||||
path: 'view-discoteca-cliente',
|
||||
loadChildren: () => import('./view-discoteca-cliente/view-discoteca-cliente.module').then( m => m.ViewDiscotecaClientePageModule)
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import {Evento} from './evento';
|
||||
import {Eventoi} from './interfaces/eventoi';
|
||||
|
||||
export class Discoteca {
|
||||
|
||||
@@ -7,9 +7,16 @@ export class Discoteca {
|
||||
private nombre: string;
|
||||
private telefono: number;
|
||||
private localizacion: string;
|
||||
private eventos: Evento[];
|
||||
private eventos: Eventoi[];
|
||||
private descripcion: string;
|
||||
|
||||
setId(id: number): void{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
getId(): number{
|
||||
return this.id;
|
||||
}
|
||||
|
||||
setNombre(nombre: string): void{
|
||||
this.nombre = nombre;
|
||||
@@ -35,7 +42,7 @@ export class Discoteca {
|
||||
return this.localizacion
|
||||
}
|
||||
|
||||
getEventos(): Evento[]{
|
||||
getEventos(): Eventoi[]{
|
||||
return this.eventos;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { Evento } from './evento';
|
||||
|
||||
describe('Evento', () => {
|
||||
it('should create an instance', () => {
|
||||
expect(new Evento()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
17
src/app/feed/feed-routing.module.ts
Normal file
17
src/app/feed/feed-routing.module.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { FeedPage } from './feed.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: FeedPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class FeedPageRoutingModule {}
|
||||
20
src/app/feed/feed.module.ts
Normal file
20
src/app/feed/feed.module.ts
Normal 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 { FeedPageRoutingModule } from './feed-routing.module';
|
||||
|
||||
import { FeedPage } from './feed.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
FeedPageRoutingModule
|
||||
],
|
||||
declarations: [FeedPage]
|
||||
})
|
||||
export class FeedPageModule {}
|
||||
35
src/app/feed/feed.page.html
Normal file
35
src/app/feed/feed.page.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>Eventos Próximos</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col size="12">
|
||||
<div *ngIf="eventos.length>0" class="eventos">
|
||||
<ion-list>
|
||||
<ion-item *ngFor="let evento of eventos" button (click)="mostrarEvento(evento)">
|
||||
<div class="evento">
|
||||
<div class="eventoHeader">
|
||||
{{evento.nombre}} ·
|
||||
<ion-icon name="calendar-outline"></ion-icon>
|
||||
{{evento.fecha}} ·
|
||||
<ion-icon name="cash-outline"></ion-icon>
|
||||
{{evento.precio1}},{{evento.precio2}}
|
||||
</div>
|
||||
<div class="eventoDesc">
|
||||
{{evento.descripcion}}
|
||||
</div>
|
||||
<div class="discotecaEvento">
|
||||
{{discotecas[idsDiscoteca.indexOf(evento.discotecaID)]?.nombre}}
|
||||
</div>
|
||||
</div>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</div>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ion-content>
|
||||
0
src/app/feed/feed.page.scss
Normal file
0
src/app/feed/feed.page.scss
Normal file
24
src/app/feed/feed.page.spec.ts
Normal file
24
src/app/feed/feed.page.spec.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { FeedPage } from './feed.page';
|
||||
|
||||
describe('FeedPage', () => {
|
||||
let component: FeedPage;
|
||||
let fixture: ComponentFixture<FeedPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FeedPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(FeedPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
59
src/app/feed/feed.page.ts
Normal file
59
src/app/feed/feed.page.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Eventoi } from '../interfaces/eventoi';
|
||||
import { DiscotecaI } from '../interfaces/discoteca-i';
|
||||
import { ApiService } from '../services/api.service';
|
||||
import { FeedService } from '../services/feed.service';
|
||||
import { Tab1Service } from '../tab1/tab1.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-feed',
|
||||
templateUrl: './feed.page.html',
|
||||
styleUrls: ['./feed.page.scss'],
|
||||
})
|
||||
export class FeedPage implements OnInit {
|
||||
|
||||
eventos: Eventoi[];
|
||||
discotecas: DiscotecaI[];
|
||||
idsDiscoteca: number[];
|
||||
constructor(private feedService:FeedService, private tab1Service: Tab1Service, private router:Router, private apiService: ApiService ) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.eventos = this.feedService.eventos;
|
||||
this.idsDiscoteca = [];
|
||||
this.discotecas=[];
|
||||
this.getDiscotecasDistintas();
|
||||
}
|
||||
|
||||
mostrarEvento(evento: Eventoi){
|
||||
|
||||
this.feedService.eventoIndex = this.eventos.indexOf(evento);
|
||||
let discotecaDelEvento: DiscotecaI = this.discotecas[this.idsDiscoteca.indexOf(evento.discotecaID)];
|
||||
this.feedService.discotecaEvento = discotecaDelEvento;
|
||||
this.router.navigate(['/tabsUser/tab2/view-evento-cliente']);
|
||||
|
||||
}
|
||||
|
||||
getDiscotecasDistintas(){
|
||||
this.eventos.forEach(
|
||||
evento => {
|
||||
if(!(this.idsDiscoteca.find(id => evento.discotecaID==id))){
|
||||
this.idsDiscoteca.push(evento.discotecaID);
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
this.idsDiscoteca.forEach(
|
||||
idDiscoteca => {
|
||||
this.apiService.getUserDiscoteca(idDiscoteca)
|
||||
.subscribe(discoteca => {
|
||||
console.log(discoteca[0]);
|
||||
this.discotecas.push(discoteca[0]);
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
6
src/app/interfaces/discoteca-i.ts
Normal file
6
src/app/interfaces/discoteca-i.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface DiscotecaI {
|
||||
discotecaID: number,
|
||||
nombre: string,
|
||||
telefono: number,
|
||||
localizacion: string
|
||||
}
|
||||
14
src/app/interfaces/eventoi.ts
Normal file
14
src/app/interfaces/eventoi.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Time } from "@angular/common";
|
||||
|
||||
export interface Eventoi {
|
||||
id: number,
|
||||
discotecaID: number,
|
||||
nombre: string,
|
||||
localizacion: string,
|
||||
fecha: Date,
|
||||
hora: Date,
|
||||
descripcion: string,
|
||||
precio1: number,
|
||||
precio2: number,
|
||||
|
||||
}
|
||||
4
src/app/interfaces/user-login.ts
Normal file
4
src/app/interfaces/user-login.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface UserLogin {
|
||||
loginUser: string;
|
||||
loginPassword: string;
|
||||
}
|
||||
6
src/app/interfaces/user.ts
Normal file
6
src/app/interfaces/user.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface User {
|
||||
id: number;
|
||||
discotecaID: number;
|
||||
userType: number;
|
||||
username: string;
|
||||
}
|
||||
@@ -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{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,14 @@
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<span>Usuario: </span><input type="text" id="username">
|
||||
<span>Contraseña: </span><input type="password" id="password">
|
||||
<ion-button (click)="login()">
|
||||
Login
|
||||
</ion-button>
|
||||
<div>
|
||||
<div *ngIf="user">
|
||||
{{user.username}}
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
input{
|
||||
color: black;
|
||||
}
|
||||
@@ -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 = (<HTMLInputElement>document.getElementById("username")).value;
|
||||
this.password = (<HTMLInputElement>document.getElementById("password")).value;
|
||||
this.loginService.validateUser(this.username, this.password)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,14 +70,16 @@ export class PerfilDiscotecaPage implements OnInit {
|
||||
this.localizacion = this.tab1Service.getLocalizacion();
|
||||
}
|
||||
|
||||
getEventos(): void{
|
||||
this.eventos = this.tab1Service.getEventos();
|
||||
}
|
||||
|
||||
getDescripcion(): void{
|
||||
this.descripcion = this.tab1Service.getDescripcion();
|
||||
}
|
||||
|
||||
getEventos(): void{
|
||||
this.eventos = this.tab1Service.eventos;
|
||||
}
|
||||
|
||||
|
||||
cargarImagen(){
|
||||
this.fotoSrc = this.someURL;
|
||||
}
|
||||
@@ -179,14 +181,15 @@ 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.tab1Service.initEventoForms();
|
||||
this.router.navigate(['/tabs/tab1/prompt-evento']);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<ion-item>
|
||||
<label>
|
||||
Fecha:
|
||||
<ion-datetime displayFormat="DD/MM, HH:mm"placeholder="Elegir Fecha" formControlName="fecha"></ion-datetime>
|
||||
<ion-datetime displayFormat="YYYY/DD/MM"placeholder="Elegir Fecha" formControlName="fecha"></ion-datetime>
|
||||
</label>
|
||||
<span
|
||||
*ngIf="fecha?.errors?.required && submitted">
|
||||
@@ -29,6 +29,17 @@
|
||||
</span>
|
||||
</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>
|
||||
<label>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Tab1Service } from '../tab1/tab1.service';
|
||||
import { Evento } from '../evento';
|
||||
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({
|
||||
selector: 'app-prompt-evento',
|
||||
@@ -10,18 +12,18 @@ import { Router } from '@angular/router';
|
||||
styleUrls: ['./prompt-evento.page.scss'],
|
||||
})
|
||||
export class PromptEventoPage implements OnInit{
|
||||
|
||||
submitted = false;
|
||||
editarEvento = false;
|
||||
eventoForm = new FormGroup({
|
||||
nombre: new FormControl('', Validators.required),
|
||||
fecha: new FormControl('', Validators.required),
|
||||
precio1: new FormControl('', Validators.required),
|
||||
precio2: new FormControl('', Validators.required),
|
||||
descripcion: new FormControl('', Validators.required),
|
||||
nombre: new FormControl(null, Validators.required),
|
||||
fecha: new FormControl(null, Validators.required),
|
||||
hora: new FormControl(null, Validators.required),
|
||||
precio1: new FormControl(null, Validators.required),
|
||||
precio2: new FormControl(null, Validators.required),
|
||||
descripcion: new FormControl(null, Validators.required),
|
||||
});
|
||||
|
||||
eventos: Evento[];
|
||||
eventos: Eventoi[];
|
||||
|
||||
constructor(private tab1Service: Tab1Service, private router: Router) {
|
||||
|
||||
@@ -35,32 +37,29 @@ export class PromptEventoPage implements OnInit{
|
||||
onSubmit(){
|
||||
this.submitted = true;
|
||||
if (this.eventoForm.valid){
|
||||
let evento = new Evento();
|
||||
this.asignarEvento(evento);
|
||||
this.router.navigate(['/tabs']);
|
||||
this.asignarEvento(this.tab1Service.eventos[this.tab1Service.eventoIndex]);
|
||||
}
|
||||
}
|
||||
asignarEvento(evento: Evento){
|
||||
evento.setNombre(this.eventoForm.get('nombre').value);
|
||||
evento.setDesc(this.eventoForm.get('descripcion').value);
|
||||
evento.setFecha(this.eventoForm.get('fecha').value);
|
||||
evento.setPrecio1(this.eventoForm.get('precio1').value);
|
||||
evento.setPrecio2(this.eventoForm.get('precio2').value);
|
||||
//evento.setDia(evento.getFecha()); el datetime de Ion devuelve un String, no se puede
|
||||
//evento.setHora(evento.getFecha()); transformar en dia y hora
|
||||
asignarEvento(evento: Eventoi){
|
||||
evento.nombre = this.eventoForm.get('nombre').value;
|
||||
evento.descripcion = this.eventoForm.get('descripcion').value;
|
||||
var fecha = this.eventoForm.get('fecha').value;
|
||||
fecha = fecha.split("T")[0];
|
||||
evento.fecha = fecha;
|
||||
var hora = this.eventoForm.get('hora').value;
|
||||
if (!this.tab1Service.editarEvento){
|
||||
hora = hora.split("T")[1];}
|
||||
hora = hora.split(":")[0]+(":")+hora.split(":")[1];
|
||||
console.log(hora);
|
||||
evento.hora = hora;
|
||||
evento.precio1 = this.eventoForm.get('precio1').value;
|
||||
evento.precio2 = this.eventoForm.get('precio2').value;
|
||||
if (!this.tab1Service.eventos){
|
||||
this.tab1Service.initEventos();}
|
||||
this.tab1Service.eventos=[];}
|
||||
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;
|
||||
this.tab1Service.postEvento(evento);
|
||||
}
|
||||
else{
|
||||
this.tab1Service.eventos.push(evento);
|
||||
this.tab1Service.eventoForms.push(this.eventoForm);}
|
||||
|
||||
}
|
||||
|
||||
get nombre(){
|
||||
return this.eventoForm.get('nombre');
|
||||
|
||||
57
src/app/services/api.service.ts
Normal file
57
src/app/services/api.service.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
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(): Observable<Eventoi[]>{
|
||||
|
||||
return this.http.get<Eventoi[]>(this.baseUrl+"/evento");
|
||||
}
|
||||
|
||||
getEventosDiscoteca(discotecaID: number): Observable<Eventoi[]>{
|
||||
|
||||
return this.http.post<Eventoi[]>(this.baseUrl+"/eventosDiscoteca", {"id": discotecaID});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
16
src/app/services/feed.service.spec.ts
Normal file
16
src/app/services/feed.service.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FeedService } from './feed.service';
|
||||
|
||||
describe('FeedService', () => {
|
||||
let service: FeedService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FeedService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
31
src/app/services/feed.service.ts
Normal file
31
src/app/services/feed.service.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { DiscotecaI } from '../interfaces/discoteca-i';
|
||||
import { Eventoi } from '../interfaces/eventoi';
|
||||
import { ApiService } from './api.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FeedService {
|
||||
|
||||
eventos: Eventoi[];
|
||||
eventoIndex: number;
|
||||
discotecaEvento: DiscotecaI;
|
||||
|
||||
constructor(private apiService: ApiService, private router: Router) { }
|
||||
|
||||
initFeed(): void{
|
||||
this.apiService.getEventos()
|
||||
.subscribe(eventos => {
|
||||
this.eventos = eventos;
|
||||
this.router.navigate(['/tabsUser'])
|
||||
})
|
||||
}
|
||||
|
||||
getEventoByIndex(eventoIndex: number):Eventoi{
|
||||
return this.eventos[eventoIndex];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
47
src/app/services/login.service.ts
Normal file
47
src/app/services/login.service.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
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';
|
||||
import { FeedService } from './feed.service';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoginService {
|
||||
|
||||
user: User;
|
||||
|
||||
constructor(private apiService: ApiService, private router: Router, private tab1service: Tab1Service, private feedService: FeedService) {
|
||||
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];
|
||||
if (this.user.userType==0)
|
||||
this.tab1service.getDiscoteca(this.user.discotecaID);
|
||||
else if (this.user.userType==1)
|
||||
this.feedService.initFeed();
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import { PerfilDiscotecaPage } from '../perfil-discoteca/perfil-discoteca.page'
|
||||
import { IonSlides} from '@ionic/angular';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { ViewChild } from '@angular/core';
|
||||
import { Evento } from '../evento';
|
||||
import { Router } from '@angular/router';
|
||||
import { from } from 'rxjs';
|
||||
|
||||
|
||||
@@ -2,9 +2,13 @@ import { Injectable, OnInit } from '@angular/core';
|
||||
import { stringify } from 'querystring';
|
||||
import { Tab1Page } from './tab1.page'
|
||||
import { Discoteca } from '../discoteca'
|
||||
import { Evento } from '../evento';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
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({
|
||||
@@ -13,64 +17,109 @@ import { NumericValueAccessor } from '@ionic/angular';
|
||||
export class Tab1Service implements OnInit{
|
||||
|
||||
discoteca: Discoteca;
|
||||
discotecaI: DiscotecaI;
|
||||
galeria: string[];
|
||||
eventos: Evento[];
|
||||
eventos: Eventoi[];
|
||||
eventoForms: FormGroup[];
|
||||
eventoIndex: number;
|
||||
editarEvento: boolean;
|
||||
|
||||
constructor() {
|
||||
constructor(private apiService: ApiService, private router: Router) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(){
|
||||
this.initValues();
|
||||
|
||||
}
|
||||
|
||||
initValues(): void{
|
||||
this.discoteca = new Discoteca();
|
||||
this.discoteca.setNombre('Barraca');
|
||||
this.discoteca.setTelefono(666666666);
|
||||
this.discoteca.setLocalizacion('Calle del Barquillo');
|
||||
this.discoteca.setDescripcion('Barraca es una discoteca inaugurada en 1965 que tuvo su gran auge en los años 80, cuando se consolidó como la discoteca de mayor importancia de la movida valenciana, durante la conocida Ruta Destroy.');
|
||||
this.galeria = [];
|
||||
this.discoteca.setId(this.discotecaI.discotecaID);
|
||||
this.discoteca.setNombre(this.discotecaI.nombre);
|
||||
this.discoteca.setTelefono(this.discotecaI.telefono);
|
||||
this.discoteca.setLocalizacion(this.discotecaI.localizacion);
|
||||
this.initEventos();
|
||||
this.galeria = [];
|
||||
this.editarEvento = false;
|
||||
}
|
||||
|
||||
getNombre(): string{
|
||||
this.initValues();
|
||||
return this.discoteca.getNombre();
|
||||
}
|
||||
|
||||
getTelefono(): number{
|
||||
this.initValues();
|
||||
return this.discoteca.getTelefono();
|
||||
}
|
||||
|
||||
getLocalizacion(): string{
|
||||
this.initValues();
|
||||
return this.discoteca.getLocalizacion();
|
||||
}
|
||||
|
||||
getEventos(): Eventoi[]{
|
||||
return this.eventos;
|
||||
}
|
||||
|
||||
getDescripcion(): string{
|
||||
return this.discoteca.getDescripcion();
|
||||
}
|
||||
|
||||
getEventos(): Evento[]{
|
||||
return this.eventos;
|
||||
}
|
||||
|
||||
initEventos(): void{
|
||||
this.eventos = [];
|
||||
this.apiService.getEventosDiscoteca(this.discoteca.getId())
|
||||
.subscribe(eventos => {
|
||||
this.eventos = eventos;
|
||||
this.router.navigate(['/tabs/tab1/perfil-discoteca']);
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
initEventoForms(): void{
|
||||
this.eventoForms = [];
|
||||
if (this.eventos){
|
||||
this.eventos.forEach(evento => {
|
||||
let thisForm = new FormGroup({
|
||||
nombre: new FormControl(null, Validators.required),
|
||||
fecha: new FormControl(null, Validators.required),
|
||||
hora: new FormControl(null, Validators.required),
|
||||
precio1: new FormControl(null, Validators.required),
|
||||
precio2: new FormControl(null, Validators.required),
|
||||
descripcion: new FormControl(null, Validators.required),
|
||||
});
|
||||
thisForm.patchValue(evento);
|
||||
this.eventoForms.push(thisForm);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
getEventobyIndex(eventoIndex: number){
|
||||
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){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { FeedPage } from '../feed/feed.page';
|
||||
import { Tab2Page } from './tab2.page';
|
||||
import { ViewEventoClientePage } from '../view-evento-cliente/view-evento-cliente.page';
|
||||
import { ViewDiscotecaClientePage } from '../view-discoteca-cliente/view-discoteca-cliente.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: Tab2Page,
|
||||
component: FeedPage,
|
||||
|
||||
},
|
||||
{
|
||||
path: 'view-evento-cliente',
|
||||
component: ViewEventoClientePage
|
||||
},
|
||||
{
|
||||
path: 'view-discoteca-cliente',
|
||||
component: ViewDiscotecaClientePage
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8">
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
<meta name="page_type" content="np-template-header-footer-from-plugin">
|
||||
<title>Página 1</title>
|
||||
<link rel="stylesheet" href="nicepage.css" media="screen">
|
||||
<link rel="stylesheet" href="Página-1.css" media="screen">
|
||||
<script class="u-script" type="text/javascript" src="jquery.js" defer=""></script>
|
||||
<script class="u-script" type="text/javascript" src="nicepage.js" defer=""></script>
|
||||
<meta name="generator" content="Nicepage 3.0.9, nicepage.com">
|
||||
<link id="u-theme-google-font" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i|Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i">
|
||||
|
||||
|
||||
|
||||
<meta property="og:title" content="Página 1">
|
||||
<meta property="og:type" content="website">
|
||||
<meta name="theme-color" content="#478ac9">
|
||||
<link rel="canonical" href="index.html">
|
||||
<meta property="og:url" content="index.html">
|
||||
</head>
|
||||
<body class="u-body">
|
||||
<section class="u-clearfix u-section-1" id="sec-6396">
|
||||
<div class="u-clearfix u-sheet u-sheet-1">
|
||||
<div class="u-clearfix u-expanded-width u-layout-wrap u-layout-wrap-1">
|
||||
<div class="u-layout">
|
||||
<div class="u-layout-row">
|
||||
<div class="u-size-30">
|
||||
<div class="u-layout-col">
|
||||
<div class="u-container-style u-layout-cell u-size-60 u-layout-cell-1">
|
||||
|
||||
<div class="u-container-layout u-container-layout-1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-size-30">
|
||||
<div class="u-layout-col">
|
||||
<div class="u-container-style u-layout-cell u-size-30 u-layout-cell-2">
|
||||
<div class="u-container-layout u-container-layout-2"></div>
|
||||
</div>
|
||||
<div class="u-container-style u-layout-cell u-size-30 u-layout-cell-3">
|
||||
<div class="u-container-layout u-container-layout-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
@@ -1,12 +1,19 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Eventoi } from '../interfaces/eventoi';
|
||||
import { FeedService } from '../services/feed.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-tab2',
|
||||
templateUrl: 'tab2.page.html',
|
||||
styleUrls: ['tab2.page.scss']
|
||||
})
|
||||
export class Tab2Page {
|
||||
export class Tab2Page implements OnInit{
|
||||
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
34
src/app/tabs-user/tabs-user-routing.module.ts
Normal file
34
src/app/tabs-user/tabs-user-routing.module.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { FullscreenOverlayContainer } from '@angular/cdk/overlay';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { TabsUserPage } from './tabs-user.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: TabsUserPage,
|
||||
children: [
|
||||
{
|
||||
path: 'tab2',
|
||||
loadChildren: ()=> import('../tab2/tab2.module').then(m=>m.Tab2PageModule),
|
||||
},
|
||||
|
||||
{
|
||||
path: 'tab3',
|
||||
loadChildren: ()=> import('../tab3/tab3.module').then(m=>m.Tab3PageModule),
|
||||
},
|
||||
|
||||
{
|
||||
path:'',
|
||||
redirectTo: 'tab2',
|
||||
pathMatch: 'full'
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class TabsUserPageRoutingModule {}
|
||||
20
src/app/tabs-user/tabs-user.module.ts
Normal file
20
src/app/tabs-user/tabs-user.module.ts
Normal 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 { TabsUserPageRoutingModule } from './tabs-user-routing.module';
|
||||
|
||||
import { TabsUserPage } from './tabs-user.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
TabsUserPageRoutingModule
|
||||
],
|
||||
declarations: [TabsUserPage]
|
||||
})
|
||||
export class TabsUserPageModule {}
|
||||
17
src/app/tabs-user/tabs-user.page.html
Normal file
17
src/app/tabs-user/tabs-user.page.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<ion-tabs>
|
||||
|
||||
<ion-tab-bar slot="bottom">
|
||||
<ion-tab-button tab="tab2">
|
||||
<ion-icon name="search-outline"></ion-icon>
|
||||
<ion-label>Feed</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
<ion-tab-button tab="tab3">
|
||||
<ion-icon name="accessibility-outline"></ion-icon>
|
||||
<ion-label>Me</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
|
||||
</ion-tab-bar>
|
||||
|
||||
</ion-tabs>
|
||||
0
src/app/tabs-user/tabs-user.page.scss
Normal file
0
src/app/tabs-user/tabs-user.page.scss
Normal file
24
src/app/tabs-user/tabs-user.page.spec.ts
Normal file
24
src/app/tabs-user/tabs-user.page.spec.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { TabsUserPage } from './tabs-user.page';
|
||||
|
||||
describe('TabsUserPage', () => {
|
||||
let component: TabsUserPage;
|
||||
let fixture: ComponentFixture<TabsUserPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TabsUserPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(TabsUserPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
15
src/app/tabs-user/tabs-user.page.ts
Normal file
15
src/app/tabs-user/tabs-user.page.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-tabs-user',
|
||||
templateUrl: './tabs-user.page.html',
|
||||
styleUrls: ['./tabs-user.page.scss'],
|
||||
})
|
||||
export class TabsUserPage implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,14 +11,7 @@ const routes: Routes = [
|
||||
path: 'tab1',
|
||||
loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule),
|
||||
},
|
||||
{
|
||||
path: 'tab2',
|
||||
loadChildren: () => import('../tab2/tab2.module').then(m => m.Tab2PageModule)
|
||||
},
|
||||
{
|
||||
path: 'tab3',
|
||||
loadChildren: () => import('../tab3/tab3.module').then(m => m.Tab3PageModule)
|
||||
},
|
||||
|
||||
{
|
||||
path: '',
|
||||
redirectTo: 'tab1',
|
||||
|
||||
@@ -2,19 +2,11 @@
|
||||
|
||||
<ion-tab-bar slot="bottom">
|
||||
<ion-tab-button tab="tab1">
|
||||
<ion-icon name="triangle"></ion-icon>
|
||||
<ion-label>Tab 1</ion-label>
|
||||
<ion-icon name="home-outline"></ion-icon>
|
||||
<ion-label>Perfil</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
<ion-tab-button tab="tab2">
|
||||
<ion-icon name="ellipse"></ion-icon>
|
||||
<ion-label>Tab 2</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
<ion-tab-button tab="tab3">
|
||||
<ion-icon name="square"></ion-icon>
|
||||
<ion-label>Tab 3</ion-label>
|
||||
</ion-tab-button>
|
||||
</ion-tab-bar>
|
||||
|
||||
</ion-tabs>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
export interface User {
|
||||
userId: number;
|
||||
userType: number;
|
||||
loginUser: string;
|
||||
loginPassword: string;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { ViewDiscotecaClientePage } from './view-discoteca-cliente.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ViewDiscotecaClientePage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class ViewDiscotecaClientePageRoutingModule {}
|
||||
@@ -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 { ViewDiscotecaClientePageRoutingModule } from './view-discoteca-cliente-routing.module';
|
||||
|
||||
import { ViewDiscotecaClientePage } from './view-discoteca-cliente.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
ViewDiscotecaClientePageRoutingModule
|
||||
],
|
||||
declarations: [ViewDiscotecaClientePage]
|
||||
})
|
||||
export class ViewDiscotecaClientePageModule {}
|
||||
@@ -0,0 +1,9 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>view-discoteca-cliente</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
|
||||
</ion-content>
|
||||
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { ViewDiscotecaClientePage } from './view-discoteca-cliente.page';
|
||||
|
||||
describe('ViewDiscotecaClientePage', () => {
|
||||
let component: ViewDiscotecaClientePage;
|
||||
let fixture: ComponentFixture<ViewDiscotecaClientePage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewDiscotecaClientePage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ViewDiscotecaClientePage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { DiscotecaI } from '../interfaces/discoteca-i';
|
||||
import { Eventoi } from '../interfaces/eventoi';
|
||||
import { FeedService } from '../services/feed.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-discoteca-cliente',
|
||||
templateUrl: './view-discoteca-cliente.page.html',
|
||||
styleUrls: ['./view-discoteca-cliente.page.scss'],
|
||||
})
|
||||
export class ViewDiscotecaClientePage implements OnInit {
|
||||
|
||||
discoteca: DiscotecaI
|
||||
eventos: Eventoi[]
|
||||
|
||||
constructor(private feedService: FeedService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.discoteca = this.feedService.discotecaEvento;
|
||||
this.feedService.eventos.forEach(evento => {
|
||||
if (this.discoteca.discotecaID == evento.discotecaID){
|
||||
this.eventos.push(evento);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { ViewDiscotecaClientePage } from '../view-discoteca-cliente/view-discoteca-cliente.page';
|
||||
|
||||
import { ViewEventoClientePage } from './view-evento-cliente.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ViewEventoClientePage
|
||||
},
|
||||
{
|
||||
path: 'view-discoteca-cliente',
|
||||
component: ViewDiscotecaClientePage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class ViewEventoClientePageRoutingModule {}
|
||||
20
src/app/view-evento-cliente/view-evento-cliente.module.ts
Normal file
20
src/app/view-evento-cliente/view-evento-cliente.module.ts
Normal 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 { ViewEventoClientePageRoutingModule } from './view-evento-cliente-routing.module';
|
||||
|
||||
import { ViewEventoClientePage } from './view-evento-cliente.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
ViewEventoClientePageRoutingModule
|
||||
],
|
||||
declarations: [ViewEventoClientePage]
|
||||
})
|
||||
export class ViewEventoClientePageModule {}
|
||||
31
src/app/view-evento-cliente/view-evento-cliente.page.html
Normal file
31
src/app/view-evento-cliente/view-evento-cliente.page.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>ViewEvento</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-grid>
|
||||
<div class="evento">
|
||||
<ion-row>
|
||||
<div class="eventoHeader">
|
||||
{{evento.nombre}} ·
|
||||
<ion-icon name="calendar-outline"></ion-icon>
|
||||
{{evento.fecha}} ·
|
||||
<ion-icon name="cash-outline"></ion-icon>
|
||||
{{evento.precio1}},{{evento.precio2}}
|
||||
</div>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<div class="eventoDesc">
|
||||
{{evento.descripcion}}
|
||||
</div>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<div class="discotecaEvento">
|
||||
<a [routerLink]="['/tabsUser/tab2/view-discoteca-cliente']">{{discoteca?.nombre}}</a>
|
||||
</div>
|
||||
</ion-row>
|
||||
</div>
|
||||
</ion-grid>
|
||||
</ion-content>
|
||||
@@ -0,0 +1,3 @@
|
||||
.discotecaEvento{
|
||||
padding: 40px;
|
||||
}
|
||||
24
src/app/view-evento-cliente/view-evento-cliente.page.spec.ts
Normal file
24
src/app/view-evento-cliente/view-evento-cliente.page.spec.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { ViewEventoClientePage } from './view-evento-cliente.page';
|
||||
|
||||
describe('ViewEventoClientePage', () => {
|
||||
let component: ViewEventoClientePage;
|
||||
let fixture: ComponentFixture<ViewEventoClientePage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewEventoClientePage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ViewEventoClientePage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
22
src/app/view-evento-cliente/view-evento-cliente.page.ts
Normal file
22
src/app/view-evento-cliente/view-evento-cliente.page.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { DiscotecaI } from '../interfaces/discoteca-i';
|
||||
import { Eventoi } from '../interfaces/eventoi';
|
||||
import { FeedService } from '../services/feed.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-evento-cliente',
|
||||
templateUrl: './view-evento-cliente.page.html',
|
||||
styleUrls: ['./view-evento-cliente.page.scss'],
|
||||
})
|
||||
export class ViewEventoClientePage implements OnInit {
|
||||
|
||||
evento: Eventoi;
|
||||
discoteca: DiscotecaI;
|
||||
constructor(private feedService: FeedService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.evento = this.feedService.getEventoByIndex(this.feedService.eventoIndex);
|
||||
this.discoteca = this.feedService.discotecaEvento;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Evento } from '../evento';
|
||||
import { Eventoi } from '../interfaces/eventoi';
|
||||
import { Tab1Service } from '../tab1/tab1.service';
|
||||
|
||||
@Component({
|
||||
@@ -9,7 +9,7 @@ import { Tab1Service } from '../tab1/tab1.service';
|
||||
})
|
||||
export class ViewEventoPage implements OnInit {
|
||||
|
||||
evento: Evento;
|
||||
evento: Eventoi;
|
||||
|
||||
constructor(private tab1Service: Tab1Service) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user