From 0b84c0987e948bf41e766acfa8dc945f23fb27af Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Tue, 23 Feb 2021 16:54:27 +0100 Subject: [PATCH 01/15] =?UTF-8?q?botones=20incluidos=20en=20un=20menu=20de?= =?UTF-8?q?splegable=20(a=C3=BAn=20sin=20formato)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 33 +++++++ package.json | 5 +- src/app/app.module.ts | 4 +- .../perfil-discoteca.page.html | 86 +++++++++---------- .../perfil-discoteca/perfil-discoteca.page.ts | 2 + 5 files changed, 83 insertions(+), 47 deletions(-) diff --git a/package-lock.json b/package-lock.json index d20f2d7..5f25b9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { "version": "10.0.8", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-10.0.8.tgz", @@ -832,6 +857,14 @@ "integrity": "sha512-QQLYUjD0T6u2hLNYXUEUbupAGsz5egmhCAckaQojvXCe3SLL/hQsrK4odrNuspy7TvMB0H5ZNEHGlF6m/WLZ3g==", "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": { "version": "10.0.14", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-10.0.14.tgz", diff --git a/package.json b/package.json index d369621..5512a85 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,12 @@ }, "private": true, "dependencies": { + "@angular/animations": "^11.2.1", + "@angular/cdk": "^11.2.1", "@angular/common": "~10.0.0", "@angular/core": "~10.0.0", "@angular/forms": "~10.0.0", + "@angular/material": "^11.2.1", "@angular/platform-browser": "~10.0.0", "@angular/platform-browser-dynamic": "~10.0.0", "@angular/router": "~10.0.0", @@ -75,4 +78,4 @@ "android" ] } -} \ No newline at end of file +} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 287c89e..575f1a1 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -11,12 +11,14 @@ import { AppComponent } from './app.component'; import { PerfilDiscotecaPage } from './perfil-discoteca/perfil-discoteca.page'; import { PromptEventoPage} from './prompt-evento/prompt-evento.page' import { GaleriamodalPageModule } from './galeriamodal/galeriamodal.module'; +import { MatMenuModule } from '@angular/material/menu'; import { LoginPage } from './login/login.page'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations' @NgModule({ declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage], entryComponents: [], - imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule], + imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule, MatMenuModule, BrowserAnimationsModule], providers: [ StatusBar, SplashScreen, diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.html b/src/app/perfil-discoteca/perfil-discoteca.page.html index e3cd2bf..552baa3 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.html +++ b/src/app/perfil-discoteca/perfil-discoteca.page.html @@ -8,40 +8,13 @@ - -
-
{{nombre}}
- -
- - - - -
- -
- - - -
- - - - - Cancelar -
-
- - - -
- + @@ -52,10 +25,16 @@
{{localizacion}}
- + +
{{descripcion}}
+
+ + +
Galería de Fotos + @@ -69,18 +48,8 @@
-
- - - - - - Añadir evento - - -
@@ -102,13 +71,40 @@
+ + + + + + + + + + + + + + + + + + - - - - - -
\ No newline at end of file diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.ts b/src/app/perfil-discoteca/perfil-discoteca.page.ts index deeaeb9..d845565 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.ts +++ b/src/app/perfil-discoteca/perfil-discoteca.page.ts @@ -5,6 +5,7 @@ import { AlertController } from '@ionic/angular'; import { ViewChild } from '@angular/core'; import { Evento } from '../evento'; import { Router } from '@angular/router'; +import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu'; import { THIS_EXPR } from '@angular/compiler/src/output/output_ast'; import { GaleriamodalPage } from '../galeriamodal/galeriamodal.page'; import { stringify } from '@angular/compiler/src/util'; @@ -17,6 +18,7 @@ import { stringify } from '@angular/compiler/src/util'; export class PerfilDiscotecaPage implements OnInit { @ViewChild('IonSlides') slides: IonSlides; + @ViewChild('MatMenuTrigger') trigger: MatMenuTrigger; nombre: string; telefono: number; localizacion: string; -- 2.44.1 From 638467e9c416050a0eac3aa791b97a399d072640 Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Tue, 23 Feb 2021 19:18:46 +0100 Subject: [PATCH 02/15] ... --- src/app/app.module.ts | 6 +- .../perfil-discoteca.page.html | 63 ++++++++++--------- .../perfil-discoteca.page.scss | 21 ++++++- .../perfil-discoteca/perfil-discoteca.page.ts | 2 - 4 files changed, 56 insertions(+), 36 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 575f1a1..468c51b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,12 +13,14 @@ import { PromptEventoPage} from './prompt-evento/prompt-evento.page' import { GaleriamodalPageModule } from './galeriamodal/galeriamodal.module'; import { MatMenuModule } from '@angular/material/menu'; import { LoginPage } from './login/login.page'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations' +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { MatIconModule } from '@angular/material/icon'; + @NgModule({ declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage], entryComponents: [], - imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule, MatMenuModule, BrowserAnimationsModule], + imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule, MatMenuModule, BrowserAnimationsModule, MatIconModule], providers: [ StatusBar, SplashScreen, diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.html b/src/app/perfil-discoteca/perfil-discoteca.page.html index 552baa3..ecc8d1a 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.html +++ b/src/app/perfil-discoteca/perfil-discoteca.page.html @@ -13,6 +13,38 @@
{{nombre}}
+
@@ -73,36 +105,7 @@ - - - - - - - - - - - - - - - + diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.scss b/src/app/perfil-discoteca/perfil-discoteca.page.scss index d4e24fa..8dadcde 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.scss +++ b/src/app/perfil-discoteca/perfil-discoteca.page.scss @@ -44,7 +44,6 @@ .galeria{ - display: block; max-width: 300px; max-height: auto; margin: auto; @@ -59,7 +58,7 @@ } .eventos{ - display:block; + float: left; } .evento:hover{ @@ -76,3 +75,21 @@ ion-slides { height: 200px; } + + + button{ + background-color: transparent; + } + + .settingsIcon{ + font-size: large; + background-color: white; + } + + .menuBotones{ + position: relative; + float: left; + bottom: 40px; + left: 20px; + + } diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.ts b/src/app/perfil-discoteca/perfil-discoteca.page.ts index d845565..deeaeb9 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.ts +++ b/src/app/perfil-discoteca/perfil-discoteca.page.ts @@ -5,7 +5,6 @@ import { AlertController } from '@ionic/angular'; import { ViewChild } from '@angular/core'; import { Evento } from '../evento'; import { Router } from '@angular/router'; -import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu'; import { THIS_EXPR } from '@angular/compiler/src/output/output_ast'; import { GaleriamodalPage } from '../galeriamodal/galeriamodal.page'; import { stringify } from '@angular/compiler/src/util'; @@ -18,7 +17,6 @@ import { stringify } from '@angular/compiler/src/util'; export class PerfilDiscotecaPage implements OnInit { @ViewChild('IonSlides') slides: IonSlides; - @ViewChild('MatMenuTrigger') trigger: MatMenuTrigger; nombre: string; telefono: number; localizacion: string; -- 2.44.1 From 07696694b381bd92a07a7330282968cc8536a1d3 Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Tue, 23 Feb 2021 19:39:36 +0100 Subject: [PATCH 03/15] arreglado bug de editar eventos --- src/app/prompt-evento/prompt-evento.page.html | 8 ++++---- src/app/prompt-evento/prompt-evento.page.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/prompt-evento/prompt-evento.page.html b/src/app/prompt-evento/prompt-evento.page.html index 94845bd..bd7d349 100644 --- a/src/app/prompt-evento/prompt-evento.page.html +++ b/src/app/prompt-evento/prompt-evento.page.html @@ -13,7 +13,7 @@ + *ngIf="nombre?.errors?.required && (nombre.touched||submitted)"> Tu evento necesita un nombre @@ -24,7 +24,7 @@ + *ngIf="fecha?.errors?.required && submitted"> Tu evento necesita una fecha @@ -36,7 +36,7 @@ + *ngIf="precio1?.errors?.required && (precio1.touched||submitted)"> Tu evento necesita un precio (puede ser 0) @@ -47,7 +47,7 @@ + *ngIf="descripcion?.errors?.required && (descripcion.touched||submitted)"> ¡Dale una descripción a tu evento! diff --git a/src/app/prompt-evento/prompt-evento.page.ts b/src/app/prompt-evento/prompt-evento.page.ts index 7711c91..667411f 100644 --- a/src/app/prompt-evento/prompt-evento.page.ts +++ b/src/app/prompt-evento/prompt-evento.page.ts @@ -12,6 +12,7 @@ import { Router } from '@angular/router'; export class PromptEventoPage implements OnInit{ submitted = false; + editarEvento = false; eventoForm = new FormGroup({ nombre: new FormControl('', Validators.required), fecha: new FormControl('', Validators.required), -- 2.44.1 From 9e0617e796d892be6f93bcc2e0be371304b22a91 Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Thu, 25 Feb 2021 13:16:46 +0100 Subject: [PATCH 04/15] . --- src/app/discoteca.ts | 2 +- .../perfil-discoteca.page.html | 34 +++++++++++++------ .../perfil-discoteca.page.scss | 33 +++++++++++++----- .../perfil-discoteca/perfil-discoteca.page.ts | 6 ++++ src/app/tab1/tab1.service.ts | 5 +++ 5 files changed, 61 insertions(+), 19 deletions(-) diff --git a/src/app/discoteca.ts b/src/app/discoteca.ts index 4ba5387..8114e04 100644 --- a/src/app/discoteca.ts +++ b/src/app/discoteca.ts @@ -43,7 +43,7 @@ export class Discoteca { this.descripcion = desc; } - get Descripcion(): string{ + getDescripcion(): string{ return this.descripcion; } } diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.html b/src/app/perfil-discoteca/perfil-discoteca.page.html index ecc8d1a..17b5096 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.html +++ b/src/app/perfil-discoteca/perfil-discoteca.page.html @@ -8,9 +8,10 @@ -
+
+
{{nombre}}
+
+
+ + +
+ + +
@@ -57,9 +63,17 @@
{{localizacion}}
- -
{{descripcion}}
+
+ + + Descripción + + + {{descripcion}} + + +
diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.scss b/src/app/perfil-discoteca/perfil-discoteca.page.scss index 8dadcde..ad48bad 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.scss +++ b/src/app/perfil-discoteca/perfil-discoteca.page.scss @@ -6,16 +6,21 @@ } *{ - padding: 5px; + padding: 10px; display: block; margin: auto; } + .main{ + max-width: 800px; + max-height: auto; + margin: auto; + text-align: justify; + } + .fotoPerfil{ text-align: end; - max-width: 800px; - max-height: auto; - margin: auto; + } .textoPie{ @@ -35,6 +40,8 @@ float: left; position: relative; margin: auto; + text-align: right; + padding-right: 50px; } @@ -43,9 +50,8 @@ } .galeria{ - - max-width: 300px; - max-height: auto; + text-align: center; + padding: 30px; margin: auto; } @@ -76,6 +82,17 @@ height: 200px; } + mat-menu{ + position: relative; + margin: inherit; + color: pink; + } + + mat-card-header{ + text-align: right; + font-weight: bold; + } + button{ background-color: transparent; @@ -89,7 +106,7 @@ .menuBotones{ position: relative; float: left; - bottom: 40px; + bottom: 60px; left: 20px; } diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.ts b/src/app/perfil-discoteca/perfil-discoteca.page.ts index deeaeb9..16a9703 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.ts +++ b/src/app/perfil-discoteca/perfil-discoteca.page.ts @@ -20,6 +20,7 @@ export class PerfilDiscotecaPage implements OnInit { nombre: string; telefono: number; localizacion: string; + descripcion: string; fotoSrc: string; fotoLoaded: string; someURL: string; @@ -48,6 +49,7 @@ export class PerfilDiscotecaPage implements OnInit { this.getTelefono(); this.getLocalizacion(); this.getEventos(); + this.getDescripcion(); this.editDisabled="true"; this.editEnabled="false"; this.fotoSrc = '../assets/img/barraca.jpg'; @@ -73,6 +75,10 @@ export class PerfilDiscotecaPage implements OnInit { this.eventos = this.tab1Service.getEventos(); } + getDescripcion(): void{ + this.descripcion = this.tab1Service.getDescripcion(); + } + cargarImagen(){ this.fotoSrc = this.someURL; } diff --git a/src/app/tab1/tab1.service.ts b/src/app/tab1/tab1.service.ts index c07d3c7..abe618a 100644 --- a/src/app/tab1/tab1.service.ts +++ b/src/app/tab1/tab1.service.ts @@ -32,6 +32,7 @@ export class Tab1Service implements OnInit{ 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.initEventos(); this.editarEvento = false; @@ -52,6 +53,10 @@ export class Tab1Service implements OnInit{ return this.discoteca.getLocalizacion(); } + getDescripcion(): string{ + return this.discoteca.getDescripcion(); + } + getEventos(): Evento[]{ return this.eventos; } -- 2.44.1 From 3e7968ab7fe8703dcb40522d6475b11c1d85b12a Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Tue, 2 Mar 2021 18:49:54 +0100 Subject: [PATCH 05/15] Nada nuevo --- src/app/app.module.ts | 3 +- .../perfil-discoteca.page.html | 61 ++++++++++--------- .../perfil-discoteca.page.scss | 17 +++--- .../perfil-discoteca/perfil-discoteca.page.ts | 10 ++- 4 files changed, 51 insertions(+), 40 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 468c51b..a075dc3 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -12,6 +12,7 @@ import { PerfilDiscotecaPage } from './perfil-discoteca/perfil-discoteca.page'; import { PromptEventoPage} from './prompt-evento/prompt-evento.page' import { GaleriamodalPageModule } from './galeriamodal/galeriamodal.module'; import { MatMenuModule } from '@angular/material/menu'; +import { MatCardModule } from '@angular/material/card'; import { LoginPage } from './login/login.page'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MatIconModule } from '@angular/material/icon'; @@ -20,7 +21,7 @@ import { MatIconModule } from '@angular/material/icon'; @NgModule({ declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage], entryComponents: [], - imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule, MatMenuModule, BrowserAnimationsModule, MatIconModule], + imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule, MatMenuModule, BrowserAnimationsModule, MatIconModule, MatCardModule], providers: [ StatusBar, SplashScreen, diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.html b/src/app/perfil-discoteca/perfil-discoteca.page.html index 17b5096..2e12076 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.html +++ b/src/app/perfil-discoteca/perfil-discoteca.page.html @@ -14,40 +14,43 @@
{{nombre}}
-
-
- + + + + + + + + + + +
+
+ + +
+ -
@@ -97,6 +100,7 @@
+
@@ -116,6 +120,7 @@
+
diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.scss b/src/app/perfil-discoteca/perfil-discoteca.page.scss index ad48bad..ef9b42d 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.scss +++ b/src/app/perfil-discoteca/perfil-discoteca.page.scss @@ -8,7 +8,6 @@ *{ padding: 10px; display: block; - margin: auto; } .main{ @@ -57,6 +56,7 @@ .botonesHidden{ display: none; + padding: none; } .botonesVisible{ @@ -64,14 +64,21 @@ } .eventos{ - float: left; + text-align: justify; + } + + .evento{ + max-width:fit-content; } .evento:hover{ background-color: rgb(97, 97, 97); } + .eventoHeader{ font-weight: bold; + float: left; + } .eventoDesc{ @@ -82,12 +89,6 @@ height: 200px; } - mat-menu{ - position: relative; - margin: inherit; - color: pink; - } - mat-card-header{ text-align: right; font-weight: bold; diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.ts b/src/app/perfil-discoteca/perfil-discoteca.page.ts index 16a9703..9d79548 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.ts +++ b/src/app/perfil-discoteca/perfil-discoteca.page.ts @@ -33,7 +33,6 @@ export class PerfilDiscotecaPage implements OnInit { sliderOpts = { slidesPerView: 1.5, centeredSlides: true, - spaceBetween: 20, }; constructor(private tab1Service: Tab1Service, private router: Router, private modalController: ModalController) { @@ -123,10 +122,14 @@ export class PerfilDiscotecaPage implements OnInit { let cajaDatos = document.getElementById("cajaDatos"); cajaDatos.style.background="white"; cajaDatos.style.color="black"; + cajaDatos.contentEditable = "true"; let botones = document.getElementById("botonesHidden1"); botones.style.display = "block"; - botones = document.getElementById("botonesHidden2"); - botones.style.display = "block"; + let saveButton = document.getElementById("saveButton") as HTMLButtonElement; + saveButton.disabled=false; + let cancelButton = document.getElementById("cancelButton") as HTMLButtonElement; + cancelButton.disabled=false; + @@ -138,6 +141,7 @@ export class PerfilDiscotecaPage implements OnInit { let cajaDatos = document.getElementById("cajaDatos"); cajaDatos.style.background="inherit"; cajaDatos.style.color="inherit"; + cajaDatos.contentEditable="false"; let botones = document.getElementById("botonesHidden1"); botones.style.display = "none"; botones = document.getElementById("botonesHidden2"); -- 2.44.1 From 139e3fcb8b5731dfd5c58603810542e17ccfd2fd Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Sat, 3 Apr 2021 11:43:08 +0200 Subject: [PATCH 06/15] creado feed component. llamada a la API para descargar todos los eventos --- src/app/feed/feed.component.html | 3 +++ src/app/feed/feed.component.scss | 0 src/app/feed/feed.component.spec.ts | 24 +++++++++++++++++ src/app/feed/feed.component.ts | 14 ++++++++++ .../perfil-discoteca/perfil-discoteca.page.ts | 4 +-- src/app/services/api.service.ts | 8 +++++- src/app/services/feed.service.spec.ts | 16 ++++++++++++ src/app/services/feed.service.ts | 22 ++++++++++++++++ src/app/services/login.service.ts | 12 +++++---- src/app/tab1/tab1.service.ts | 26 +++++++++++++++++-- 10 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 src/app/feed/feed.component.html create mode 100644 src/app/feed/feed.component.scss create mode 100644 src/app/feed/feed.component.spec.ts create mode 100644 src/app/feed/feed.component.ts create mode 100644 src/app/services/feed.service.spec.ts create mode 100644 src/app/services/feed.service.ts diff --git a/src/app/feed/feed.component.html b/src/app/feed/feed.component.html new file mode 100644 index 0000000..229abb4 --- /dev/null +++ b/src/app/feed/feed.component.html @@ -0,0 +1,3 @@ +

+ feed works! +

diff --git a/src/app/feed/feed.component.scss b/src/app/feed/feed.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/feed/feed.component.spec.ts b/src/app/feed/feed.component.spec.ts new file mode 100644 index 0000000..009b6e6 --- /dev/null +++ b/src/app/feed/feed.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { FeedComponent } from './feed.component'; + +describe('FeedComponent', () => { + let component: FeedComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FeedComponent ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(FeedComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/feed/feed.component.ts b/src/app/feed/feed.component.ts new file mode 100644 index 0000000..da2fc7a --- /dev/null +++ b/src/app/feed/feed.component.ts @@ -0,0 +1,14 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-feed', + templateUrl: './feed.component.html', + styleUrls: ['./feed.component.scss'], +}) +export class FeedComponent implements OnInit { + + constructor() { } + + ngOnInit() {} + +} diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.ts b/src/app/perfil-discoteca/perfil-discoteca.page.ts index fd858bb..6ab4d9e 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.ts +++ b/src/app/perfil-discoteca/perfil-discoteca.page.ts @@ -79,9 +79,6 @@ export class PerfilDiscotecaPage implements OnInit { this.eventos = this.tab1Service.eventos; } - getDescripcion(): void{ - this.descripcion = this.tab1Service.getDescripcion(); - } cargarImagen(){ this.fotoSrc = this.someURL; @@ -192,6 +189,7 @@ export class PerfilDiscotecaPage implements OnInit { editarEvento(evento: Eventoi){ this.tab1Service.eventoIndex = this.eventos.indexOf(evento); this.tab1Service.editarEvento = true; + this.tab1Service.initEventoForms(); this.router.navigate(['/tabs/tab1/prompt-evento']); } diff --git a/src/app/services/api.service.ts b/src/app/services/api.service.ts index b922549..8d2d383 100644 --- a/src/app/services/api.service.ts +++ b/src/app/services/api.service.ts @@ -39,7 +39,13 @@ export class ApiService { } - getEventos(discotecaID: number): Observable{ + getEventos(): Observable{ + + return this.http.get(this.baseUrl+"/evento"); + } + + getEventosDiscoteca(discotecaID: number): Observable{ + return this.http.post(this.baseUrl+"/eventosDiscoteca", {"id": discotecaID}); diff --git a/src/app/services/feed.service.spec.ts b/src/app/services/feed.service.spec.ts new file mode 100644 index 0000000..656b960 --- /dev/null +++ b/src/app/services/feed.service.spec.ts @@ -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(); + }); +}); diff --git a/src/app/services/feed.service.ts b/src/app/services/feed.service.ts new file mode 100644 index 0000000..980b787 --- /dev/null +++ b/src/app/services/feed.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; +import { Eventoi } from '../interfaces/eventoi'; +import { ApiService } from './api.service'; + +@Injectable({ + providedIn: 'root' +}) +export class FeedService { + + eventos: Eventoi[]; + + constructor(private apiService: ApiService, private router: Router) { } + + initFeed(): void{ + this.apiService.getEventos() + .subscribe(eventos => { + this.eventos = eventos; + + }) + } +} diff --git a/src/app/services/login.service.ts b/src/app/services/login.service.ts index 977a8b3..ad5d36e 100644 --- a/src/app/services/login.service.ts +++ b/src/app/services/login.service.ts @@ -5,6 +5,7 @@ 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({ @@ -14,7 +15,7 @@ export class LoginService { user: User; - constructor(private apiService: ApiService, private router: Router, private tab1service: Tab1Service) { + constructor(private apiService: ApiService, private router: Router, private tab1service: Tab1Service, private feedService: FeedService) { this.user = { id: 0, discotecaID: 0, @@ -32,10 +33,11 @@ export class LoginService { 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); + this.user = user[0]; + if (this.user.userType==0) + this.tab1service.getDiscoteca(this.user.discotecaID); + else if (this.user.userType==1) + this.feedService.initFeed(); }) diff --git a/src/app/tab1/tab1.service.ts b/src/app/tab1/tab1.service.ts index 5b65175..f7de7bd 100644 --- a/src/app/tab1/tab1.service.ts +++ b/src/app/tab1/tab1.service.ts @@ -3,7 +3,7 @@ import { stringify } from 'querystring'; import { Tab1Page } from './tab1.page' import { Discoteca } from '../discoteca' import { Observable, of } from 'rxjs'; -import { FormControl, FormGroup } from '@angular/forms'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import { NumericValueAccessor } from '@ionic/angular'; import { DiscotecaI } from '../interfaces/discoteca-i'; import { ApiService } from '../services/api.service'; @@ -65,7 +65,7 @@ export class Tab1Service implements OnInit{ initEventos(): void{ this.eventos = []; - this.apiService.getEventos(this.discoteca.getId()) + this.apiService.getEventosDiscoteca(this.discoteca.getId()) .subscribe(eventos => { this.eventos = eventos; this.router.navigate(['/tabs/tab1/perfil-discoteca']); @@ -76,6 +76,25 @@ export class Tab1Service implements OnInit{ 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.controls['nombre'].setValue(evento.nombre); + thisForm.controls['fecha'].setValue(evento.fecha); + thisForm.controls['hora'].setValue(evento.hora); + thisForm.controls['precio1'].setValue(evento.precio1); + thisForm.controls['precio2'].setValue(evento.precio2); + thisForm.controls['descripcion'].setValue(evento.descripcion); + this.eventoForms.push(thisForm); + }) + } } getEventobyIndex(eventoIndex: number){ @@ -91,6 +110,7 @@ getDiscoteca(discotecaId: number){ this.initValues(); }) } + } postEvento(evento: Eventoi){ @@ -105,4 +125,6 @@ getDiscoteca(discotecaId: number){ } + + } -- 2.44.1 From 4ee33458dcfadc0d7f600878878173d794db04cb Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Sat, 3 Apr 2021 12:11:01 +0200 Subject: [PATCH 07/15] separado routing de usuarios y discotecas --- src/app/app-routing.module.ts | 9 +++++ src/app/services/feed.service.ts | 2 +- src/app/tabs-user/tabs-user-routing.module.ts | 34 +++++++++++++++++++ src/app/tabs-user/tabs-user.module.ts | 20 +++++++++++ src/app/tabs-user/tabs-user.page.html | 17 ++++++++++ src/app/tabs-user/tabs-user.page.scss | 0 src/app/tabs-user/tabs-user.page.spec.ts | 24 +++++++++++++ src/app/tabs-user/tabs-user.page.ts | 15 ++++++++ src/app/tabs/tabs-routing.module.ts | 9 +---- src/app/tabs/tabs.page.html | 12 ++----- 10 files changed, 123 insertions(+), 19 deletions(-) create mode 100644 src/app/tabs-user/tabs-user-routing.module.ts create mode 100644 src/app/tabs-user/tabs-user.module.ts create mode 100644 src/app/tabs-user/tabs-user.page.html create mode 100644 src/app/tabs-user/tabs-user.page.scss create mode 100644 src/app/tabs-user/tabs-user.page.spec.ts create mode 100644 src/app/tabs-user/tabs-user.page.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index c4f4dc7..f4817e5 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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) @@ -26,6 +30,11 @@ const routes: Routes = [ redirectTo: 'login', pathMatch: 'full' }, + { + path: 'tabs-user', + loadChildren: () => import('./tabs-user/tabs-user.module').then( m => m.TabsUserPageModule) + }, + diff --git a/src/app/services/feed.service.ts b/src/app/services/feed.service.ts index 980b787..a8f6909 100644 --- a/src/app/services/feed.service.ts +++ b/src/app/services/feed.service.ts @@ -16,7 +16,7 @@ export class FeedService { this.apiService.getEventos() .subscribe(eventos => { this.eventos = eventos; - + this.router.navigate(['/tabsUser']) }) } } diff --git a/src/app/tabs-user/tabs-user-routing.module.ts b/src/app/tabs-user/tabs-user-routing.module.ts new file mode 100644 index 0000000..56547a8 --- /dev/null +++ b/src/app/tabs-user/tabs-user-routing.module.ts @@ -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 {} diff --git a/src/app/tabs-user/tabs-user.module.ts b/src/app/tabs-user/tabs-user.module.ts new file mode 100644 index 0000000..623ac6d --- /dev/null +++ b/src/app/tabs-user/tabs-user.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { TabsUserPageRoutingModule } from './tabs-user-routing.module'; + +import { TabsUserPage } from './tabs-user.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + TabsUserPageRoutingModule + ], + declarations: [TabsUserPage] +}) +export class TabsUserPageModule {} diff --git a/src/app/tabs-user/tabs-user.page.html b/src/app/tabs-user/tabs-user.page.html new file mode 100644 index 0000000..b0982d7 --- /dev/null +++ b/src/app/tabs-user/tabs-user.page.html @@ -0,0 +1,17 @@ + + + + + + Feed + + + + + Me + + + + + + diff --git a/src/app/tabs-user/tabs-user.page.scss b/src/app/tabs-user/tabs-user.page.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/tabs-user/tabs-user.page.spec.ts b/src/app/tabs-user/tabs-user.page.spec.ts new file mode 100644 index 0000000..606c6ed --- /dev/null +++ b/src/app/tabs-user/tabs-user.page.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/src/app/tabs-user/tabs-user.page.ts b/src/app/tabs-user/tabs-user.page.ts new file mode 100644 index 0000000..4829034 --- /dev/null +++ b/src/app/tabs-user/tabs-user.page.ts @@ -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() { + } + +} diff --git a/src/app/tabs/tabs-routing.module.ts b/src/app/tabs/tabs-routing.module.ts index 90830aa..3e9d0dc 100644 --- a/src/app/tabs/tabs-routing.module.ts +++ b/src/app/tabs/tabs-routing.module.ts @@ -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', diff --git a/src/app/tabs/tabs.page.html b/src/app/tabs/tabs.page.html index 0995c40..53cf3e9 100644 --- a/src/app/tabs/tabs.page.html +++ b/src/app/tabs/tabs.page.html @@ -2,19 +2,11 @@ - - Tab 1 + + Perfil - - - Tab 2 - - - - Tab 3 - -- 2.44.1 From b163dee4b7732c54f0ebb10dd6952345753b6da7 Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Sat, 3 Apr 2021 14:06:39 +0200 Subject: [PATCH 08/15] =?UTF-8?q?para=20editar=20eventos.=20No=20funciona?= =?UTF-8?q?=20la=20asignaci=C3=B3n=20de=20hora=20(undefined).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/interfaces/eventoi.ts | 2 +- src/app/prompt-evento/prompt-evento.page.html | 4 +- src/app/prompt-evento/prompt-evento.page.ts | 14 +--- src/app/tab1/tab1.service.ts | 9 +-- src/app/tab2/tab2.page.html | 81 +++++++------------ src/app/tab2/tab2.page.ts | 13 ++- 6 files changed, 45 insertions(+), 78 deletions(-) diff --git a/src/app/interfaces/eventoi.ts b/src/app/interfaces/eventoi.ts index b613b3c..ef66e5b 100644 --- a/src/app/interfaces/eventoi.ts +++ b/src/app/interfaces/eventoi.ts @@ -6,7 +6,7 @@ export interface Eventoi { nombre: string, localizacion: string, fecha: Date, - hora: Time, + hora: Date, descripcion: string, precio1: number, precio2: number, diff --git a/src/app/prompt-evento/prompt-evento.page.html b/src/app/prompt-evento/prompt-evento.page.html index 147e07f..b0b83a2 100644 --- a/src/app/prompt-evento/prompt-evento.page.html +++ b/src/app/prompt-evento/prompt-evento.page.html @@ -32,10 +32,10 @@ + *ngIf="hora?.errors?.required && submitted"> Tu evento necesita una hora diff --git a/src/app/prompt-evento/prompt-evento.page.ts b/src/app/prompt-evento/prompt-evento.page.ts index 7209410..78da3b2 100644 --- a/src/app/prompt-evento/prompt-evento.page.ts +++ b/src/app/prompt-evento/prompt-evento.page.ts @@ -48,7 +48,6 @@ export class PromptEventoPage implements OnInit{ precio1: null, precio2: null - }; this.asignarEvento(evento); @@ -66,24 +65,13 @@ export class PromptEventoPage implements OnInit{ 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 if (!this.tab1Service.eventos){ this.tab1Service.initEventos();} if(!this.tab1Service.eventoForms){ this.tab1Service.initEventoForms();} - if(this.tab1Service.editarEvento==true){ - this.tab1Service.updateEvento(evento); - //this.tab1Service.eventos[this.tab1Service.eventoIndex] = evento; - //this.tab1Service.eventoForms[this.tab1Service.eventoIndex] = this.eventoForm; - } - else{ - this.tab1Service.postEvento(evento); - //this.tab1Service.eventos.push(evento); - //this.tab1Service.eventoForms.push(this.eventoForm); + this.tab1Service.postEvento(evento); } - } - get nombre(){ return this.eventoForm.get('nombre'); } diff --git a/src/app/tab1/tab1.service.ts b/src/app/tab1/tab1.service.ts index f7de7bd..3a95975 100644 --- a/src/app/tab1/tab1.service.ts +++ b/src/app/tab1/tab1.service.ts @@ -86,12 +86,7 @@ export class Tab1Service implements OnInit{ precio2: new FormControl(null, Validators.required), descripcion: new FormControl(null, Validators.required), }); - thisForm.controls['nombre'].setValue(evento.nombre); - thisForm.controls['fecha'].setValue(evento.fecha); - thisForm.controls['hora'].setValue(evento.hora); - thisForm.controls['precio1'].setValue(evento.precio1); - thisForm.controls['precio2'].setValue(evento.precio2); - thisForm.controls['descripcion'].setValue(evento.descripcion); + thisForm.patchValue(evento); this.eventoForms.push(thisForm); }) } @@ -122,7 +117,7 @@ getDiscoteca(discotecaId: number){ } updateEvento(evento: Eventoi){ - + } diff --git a/src/app/tab2/tab2.page.html b/src/app/tab2/tab2.page.html index 74fa30f..56450ed 100644 --- a/src/app/tab2/tab2.page.html +++ b/src/app/tab2/tab2.page.html @@ -1,56 +1,33 @@ - - - - - - - Página 1 - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
- -
-
-
+ + + Eventos Próximos + + + + + + + +
+ + +
+
+ {{evento.nombre}} · + + {{evento.fecha}} · + + {{evento.precio1}},{{evento.precio2}} +
-
-
-
-
-
-
-
-
-
+
+ {{evento.descripcion}}
-
-
+ +
-
- - - - - \ No newline at end of file + +
+ + \ No newline at end of file diff --git a/src/app/tab2/tab2.page.ts b/src/app/tab2/tab2.page.ts index e14cad4..300414f 100644 --- a/src/app/tab2/tab2.page.ts +++ b/src/app/tab2/tab2.page.ts @@ -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() {} + eventos: Eventoi[]; + constructor(private feedService: FeedService) {} + + ngOnInit(){ + this.eventos = this.feedService.eventos; + } } -- 2.44.1 From 427398154ba8b0281e8f649f42aeaa0f9aa2aebc Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Sun, 4 Apr 2021 19:10:56 +0200 Subject: [PATCH 09/15] permite editar eventos y se reflejan los cambios. Arreglado el bug de la hora --- src/app/prompt-evento/prompt-evento.page.ts | 23 ++++++--------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/app/prompt-evento/prompt-evento.page.ts b/src/app/prompt-evento/prompt-evento.page.ts index 78da3b2..c1e13d9 100644 --- a/src/app/prompt-evento/prompt-evento.page.ts +++ b/src/app/prompt-evento/prompt-evento.page.ts @@ -37,20 +37,7 @@ export class PromptEventoPage implements OnInit{ onSubmit(){ this.submitted = true; if (this.eventoForm.valid){ - let evento: Eventoi = { - 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(this.tab1Service.eventos[this.tab1Service.eventoIndex]); } } asignarEvento(evento: Eventoi){ @@ -59,14 +46,16 @@ export class PromptEventoPage implements OnInit{ var fecha = this.eventoForm.get('fecha').value; fecha = fecha.split("T")[0]; evento.fecha = fecha; - let hora = this.eventoForm.get('hora').value; - hora = hora.split("T")[1]; + 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();} this.tab1Service.postEvento(evento); -- 2.44.1 From 277ad1d88a57265dedae48a611a1ea844364e03e Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Sun, 4 Apr 2021 19:17:26 +0200 Subject: [PATCH 10/15] =?UTF-8?q?creada=20p=C3=A1gina=20feed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app-routing.module.ts | 98 ++++++++++--------- src/app/feed/feed-routing.module.ts | 17 ++++ src/app/feed/feed.component.html | 3 - src/app/feed/feed.component.ts | 14 --- src/app/feed/feed.module.ts | 20 ++++ src/app/feed/feed.page.html | 33 +++++++ .../{feed.component.scss => feed.page.scss} | 0 ...ed.component.spec.ts => feed.page.spec.ts} | 12 +-- src/app/feed/feed.page.ts | 20 ++++ src/app/login/login.page.html | 2 +- src/app/tab2/tab2-routing.module.ts | 3 +- src/app/tab2/tab2.page.html | 33 ------- src/app/tab2/tab2.page.ts | 6 +- 13 files changed, 153 insertions(+), 108 deletions(-) create mode 100644 src/app/feed/feed-routing.module.ts delete mode 100644 src/app/feed/feed.component.html delete mode 100644 src/app/feed/feed.component.ts create mode 100644 src/app/feed/feed.module.ts create mode 100644 src/app/feed/feed.page.html rename src/app/feed/{feed.component.scss => feed.page.scss} (100%) rename src/app/feed/{feed.component.spec.ts => feed.page.spec.ts} (61%) create mode 100644 src/app/feed/feed.page.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f4817e5..9f512f2 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,49 +1,53 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; -import { LoginPage } from './login/login.page'; - - -const routes: Routes = [ - - { - path: 'login', - component: LoginPage - }, - { - 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) - }, - { - path: 'galeriamodal', - loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule) - }, - { - path:'', - redirectTo: 'login', - pathMatch: 'full' - }, - { - path: 'tabs-user', - loadChildren: () => import('./tabs-user/tabs-user.module').then( m => m.TabsUserPageModule) +import { NgModule } from '@angular/core'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +import { LoginPage } from './login/login.page'; + + +const routes: Routes = [ + + { + path: 'login', + component: LoginPage + }, + { + 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) + }, + { + path: 'galeriamodal', + loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule) + }, + { + path:'', + 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) }, - - - - -]; -@NgModule({ - imports: [ - RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) - ], - exports: [RouterModule] -}) -export class AppRoutingModule {} + + + + + +]; +@NgModule({ + imports: [ + RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) + ], + exports: [RouterModule] +}) +export class AppRoutingModule {} diff --git a/src/app/feed/feed-routing.module.ts b/src/app/feed/feed-routing.module.ts new file mode 100644 index 0000000..6fd7a3d --- /dev/null +++ b/src/app/feed/feed-routing.module.ts @@ -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 {} diff --git a/src/app/feed/feed.component.html b/src/app/feed/feed.component.html deleted file mode 100644 index 229abb4..0000000 --- a/src/app/feed/feed.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- feed works! -

diff --git a/src/app/feed/feed.component.ts b/src/app/feed/feed.component.ts deleted file mode 100644 index da2fc7a..0000000 --- a/src/app/feed/feed.component.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-feed', - templateUrl: './feed.component.html', - styleUrls: ['./feed.component.scss'], -}) -export class FeedComponent implements OnInit { - - constructor() { } - - ngOnInit() {} - -} diff --git a/src/app/feed/feed.module.ts b/src/app/feed/feed.module.ts new file mode 100644 index 0000000..4e6e999 --- /dev/null +++ b/src/app/feed/feed.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { FeedPageRoutingModule } from './feed-routing.module'; + +import { FeedPage } from './feed.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + FeedPageRoutingModule + ], + declarations: [FeedPage] +}) +export class FeedPageModule {} diff --git a/src/app/feed/feed.page.html b/src/app/feed/feed.page.html new file mode 100644 index 0000000..56450ed --- /dev/null +++ b/src/app/feed/feed.page.html @@ -0,0 +1,33 @@ + + + Eventos Próximos + + + + + + + +
+ + +
+
+ {{evento.nombre}} · + + {{evento.fecha}} · + + {{evento.precio1}},{{evento.precio2}} + +
+
+ {{evento.descripcion}} +
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/app/feed/feed.component.scss b/src/app/feed/feed.page.scss similarity index 100% rename from src/app/feed/feed.component.scss rename to src/app/feed/feed.page.scss diff --git a/src/app/feed/feed.component.spec.ts b/src/app/feed/feed.page.spec.ts similarity index 61% rename from src/app/feed/feed.component.spec.ts rename to src/app/feed/feed.page.spec.ts index 009b6e6..a6dba8c 100644 --- a/src/app/feed/feed.component.spec.ts +++ b/src/app/feed/feed.page.spec.ts @@ -1,19 +1,19 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; -import { FeedComponent } from './feed.component'; +import { FeedPage } from './feed.page'; -describe('FeedComponent', () => { - let component: FeedComponent; - let fixture: ComponentFixture; +describe('FeedPage', () => { + let component: FeedPage; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FeedComponent ], + declarations: [ FeedPage ], imports: [IonicModule.forRoot()] }).compileComponents(); - fixture = TestBed.createComponent(FeedComponent); + fixture = TestBed.createComponent(FeedPage); component = fixture.componentInstance; fixture.detectChanges(); })); diff --git a/src/app/feed/feed.page.ts b/src/app/feed/feed.page.ts new file mode 100644 index 0000000..4c46af7 --- /dev/null +++ b/src/app/feed/feed.page.ts @@ -0,0 +1,20 @@ +import { Component, OnInit } from '@angular/core'; +import { Eventoi } from '../interfaces/eventoi'; +import { FeedService } from '../services/feed.service'; + +@Component({ + selector: 'app-feed', + templateUrl: './feed.page.html', + styleUrls: ['./feed.page.scss'], +}) +export class FeedPage implements OnInit { + + eventos: Eventoi[]; + + constructor(private feedService:FeedService) { } + + ngOnInit() { + this.eventos = this.feedService.eventos; + } + +} diff --git a/src/app/login/login.page.html b/src/app/login/login.page.html index cacbd4a..3f7179e 100644 --- a/src/app/login/login.page.html +++ b/src/app/login/login.page.html @@ -6,7 +6,7 @@ Usuario: - Contraseña: + Contraseña: Login diff --git a/src/app/tab2/tab2-routing.module.ts b/src/app/tab2/tab2-routing.module.ts index e96ec09..d654720 100644 --- a/src/app/tab2/tab2-routing.module.ts +++ b/src/app/tab2/tab2-routing.module.ts @@ -1,11 +1,12 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { FeedPage } from '../feed/feed.page'; import { Tab2Page } from './tab2.page'; const routes: Routes = [ { path: '', - component: Tab2Page, + component: FeedPage, } ]; diff --git a/src/app/tab2/tab2.page.html b/src/app/tab2/tab2.page.html index 56450ed..e69de29 100644 --- a/src/app/tab2/tab2.page.html +++ b/src/app/tab2/tab2.page.html @@ -1,33 +0,0 @@ - - - Eventos Próximos - - - - - - - -
- - -
-
- {{evento.nombre}} · - - {{evento.fecha}} · - - {{evento.precio1}},{{evento.precio2}} - -
-
- {{evento.descripcion}} -
-
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/src/app/tab2/tab2.page.ts b/src/app/tab2/tab2.page.ts index 300414f..bba1910 100644 --- a/src/app/tab2/tab2.page.ts +++ b/src/app/tab2/tab2.page.ts @@ -9,11 +9,11 @@ import { FeedService } from '../services/feed.service'; }) export class Tab2Page implements OnInit{ - eventos: Eventoi[]; - constructor(private feedService: FeedService) {} + + constructor() {} ngOnInit(){ - this.eventos = this.feedService.eventos; + } } -- 2.44.1 From 4aa238ab9eac8b3c68eda196b1d57583a089603c Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Wed, 12 May 2021 18:16:12 +0200 Subject: [PATCH 11/15] =?UTF-8?q?Se=20pueden=20ver=20eventos=20desde=20usu?= =?UTF-8?q?ario=20cliente.=20Hay=20c=C3=B3digo=20(algo)=20duplicado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app-routing.module.ts | 8 ++++++ src/app/feed/feed.page.html | 1 - src/app/feed/feed.page.ts | 9 ++++++- src/app/services/feed.service.ts | 7 +++++ src/app/tab2/tab2-routing.module.ts | 7 +++++ .../view-evento-cliente-routing.module.ts | 17 ++++++++++++ .../view-evento-cliente.module.ts | 20 ++++++++++++++ .../view-evento-cliente.page.html | 26 +++++++++++++++++++ .../view-evento-cliente.page.scss | 0 .../view-evento-cliente.page.spec.ts | 24 +++++++++++++++++ .../view-evento-cliente.page.ts | 19 ++++++++++++++ 11 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 src/app/view-evento-cliente/view-evento-cliente-routing.module.ts create mode 100644 src/app/view-evento-cliente/view-evento-cliente.module.ts create mode 100644 src/app/view-evento-cliente/view-evento-cliente.page.html create mode 100644 src/app/view-evento-cliente/view-evento-cliente.page.scss create mode 100644 src/app/view-evento-cliente/view-evento-cliente.page.spec.ts create mode 100644 src/app/view-evento-cliente/view-evento-cliente.page.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9f512f2..646e1d6 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -37,6 +37,14 @@ const routes: Routes = [ path: 'feed', loadChildren: () => import('./feed/feed.module').then( m => m.FeedPageModule) }, + { + path: 'vieweventocliente', + loadChildren: () => import('./vieweventocliente/vieweventocliente.module').then( m => m.VieweventoclientePageModule) + }, + { + path: 'view-evento-cliente', + loadChildren: () => import('./view-evento-cliente/view-evento-cliente.module').then( m => m.ViewEventoClientePageModule) + }, diff --git a/src/app/feed/feed.page.html b/src/app/feed/feed.page.html index 56450ed..fd150bf 100644 --- a/src/app/feed/feed.page.html +++ b/src/app/feed/feed.page.html @@ -18,7 +18,6 @@ {{evento.fecha}} · {{evento.precio1}},{{evento.precio2}} -
{{evento.descripcion}} diff --git a/src/app/feed/feed.page.ts b/src/app/feed/feed.page.ts index 4c46af7..3e43741 100644 --- a/src/app/feed/feed.page.ts +++ b/src/app/feed/feed.page.ts @@ -1,6 +1,8 @@ import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; import { Eventoi } from '../interfaces/eventoi'; import { FeedService } from '../services/feed.service'; +import { Tab1Service } from '../tab1/tab1.service'; @Component({ selector: 'app-feed', @@ -11,10 +13,15 @@ export class FeedPage implements OnInit { eventos: Eventoi[]; - constructor(private feedService:FeedService) { } + constructor(private feedService:FeedService, private tab1Service: Tab1Service, private router:Router ) { } ngOnInit() { this.eventos = this.feedService.eventos; } + mostrarEvento(evento: Eventoi){ + this.feedService.eventoIndex = this.eventos.indexOf(evento); + this.router.navigate(['/tabs/tab2/view-evento-cliente']); + } + } diff --git a/src/app/services/feed.service.ts b/src/app/services/feed.service.ts index a8f6909..25e5322 100644 --- a/src/app/services/feed.service.ts +++ b/src/app/services/feed.service.ts @@ -9,6 +9,7 @@ import { ApiService } from './api.service'; export class FeedService { eventos: Eventoi[]; + eventoIndex: number; constructor(private apiService: ApiService, private router: Router) { } @@ -19,4 +20,10 @@ export class FeedService { this.router.navigate(['/tabsUser']) }) } + + getEventoByIndex(eventoIndex: number):Eventoi{ + return this.eventos[eventoIndex]; + } + + } diff --git a/src/app/tab2/tab2-routing.module.ts b/src/app/tab2/tab2-routing.module.ts index d654720..4678fa5 100644 --- a/src/app/tab2/tab2-routing.module.ts +++ b/src/app/tab2/tab2-routing.module.ts @@ -2,11 +2,18 @@ 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'; const routes: Routes = [ { path: '', component: FeedPage, + + + }, + { + path: 'view-evento-cliente', + component: ViewEventoClientePage } ]; diff --git a/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts b/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts new file mode 100644 index 0000000..a1deaeb --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { ViewEventoClientePage } from './view-evento-cliente.page'; + +const routes: Routes = [ + { + path: '', + component: ViewEventoClientePage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class ViewEventoClientePageRoutingModule {} diff --git a/src/app/view-evento-cliente/view-evento-cliente.module.ts b/src/app/view-evento-cliente/view-evento-cliente.module.ts new file mode 100644 index 0000000..f9f155e --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { 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 {} diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.html b/src/app/view-evento-cliente/view-evento-cliente.page.html new file mode 100644 index 0000000..e44a147 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.html @@ -0,0 +1,26 @@ + + + ViewEvento + + + + + +
+ +
+ {{evento.nombre}} · + + {{evento.fecha}} · + + {{evento.precio1}},{{evento.precio2}} +
+
+ +
+ {{evento.descripcion}} +
+
+
+
+
diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.scss b/src/app/view-evento-cliente/view-evento-cliente.page.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.spec.ts b/src/app/view-evento-cliente/view-evento-cliente.page.spec.ts new file mode 100644 index 0000000..a329129 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.ts b/src/app/view-evento-cliente/view-evento-cliente.page.ts new file mode 100644 index 0000000..de3fec9 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.ts @@ -0,0 +1,19 @@ +import { Component, OnInit } from '@angular/core'; +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; + constructor(private feedService: FeedService) { } + + ngOnInit() { + this.evento = this.feedService.getEventoByIndex(this.feedService.eventoIndex); + } + +} -- 2.44.1 From 3c2976437d7e2e0016409c8f256a040878fa19b2 Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Wed, 12 May 2021 18:22:30 +0200 Subject: [PATCH 12/15] arreglados errores commit anterior --- src/app/app-routing.module.ts | 103 +++++++++++++++++----------------- src/app/feed/feed.page.ts | 2 +- 2 files changed, 51 insertions(+), 54 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 646e1d6..9b6b79e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,61 +1,58 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; -import { LoginPage } from './login/login.page'; - - -const routes: Routes = [ - - { - path: 'login', - component: LoginPage - }, - { - 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) - }, - { - path: 'galeriamodal', - loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule) - }, - { - path:'', - 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) +import { NgModule } from '@angular/core'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +import { LoginPage } from './login/login.page'; + + +const routes: Routes = [ + + { + path: 'login', + component: LoginPage }, { - path: 'vieweventocliente', - loadChildren: () => import('./vieweventocliente/vieweventocliente.module').then( m => m.VieweventoclientePageModule) + 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) + }, + { + path: 'galeriamodal', + loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule) + }, + { + path:'', + 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) }, - - - - - -]; -@NgModule({ - imports: [ - RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) - ], - exports: [RouterModule] -}) -export class AppRoutingModule {} + + + + + +]; +@NgModule({ + imports: [ + RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) + ], + exports: [RouterModule] +}) +export class AppRoutingModule {} diff --git a/src/app/feed/feed.page.ts b/src/app/feed/feed.page.ts index 3e43741..e392ccc 100644 --- a/src/app/feed/feed.page.ts +++ b/src/app/feed/feed.page.ts @@ -21,7 +21,7 @@ export class FeedPage implements OnInit { mostrarEvento(evento: Eventoi){ this.feedService.eventoIndex = this.eventos.indexOf(evento); - this.router.navigate(['/tabs/tab2/view-evento-cliente']); + this.router.navigate(['/tabsUser/tab2/view-evento-cliente']); } } -- 2.44.1 From 59f0fcc724824c75b434e9848df485eb5eebb4ea Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Thu, 13 May 2021 17:47:34 +0200 Subject: [PATCH 13/15] se tiene la discoteca asociada a los eventos en Feed y view Evento Cliente --- src/app/feed/feed.page.html | 3 ++ src/app/feed/feed.page.ts | 37 ++++++++++++++++++- src/app/services/feed.service.ts | 2 + .../view-evento-cliente.page.html | 5 +++ .../view-evento-cliente.page.ts | 3 ++ 5 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/app/feed/feed.page.html b/src/app/feed/feed.page.html index fd150bf..9c09003 100644 --- a/src/app/feed/feed.page.html +++ b/src/app/feed/feed.page.html @@ -22,6 +22,9 @@
{{evento.descripcion}}
+
+ {{discotecas[idsDiscoteca.indexOf(evento.discotecaID)]?.nombre}} +
diff --git a/src/app/feed/feed.page.ts b/src/app/feed/feed.page.ts index e392ccc..f224008 100644 --- a/src/app/feed/feed.page.ts +++ b/src/app/feed/feed.page.ts @@ -1,6 +1,8 @@ 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'; @@ -12,16 +14,47 @@ import { Tab1Service } from '../tab1/tab1.service'; export class FeedPage implements OnInit { eventos: Eventoi[]; - - constructor(private feedService:FeedService, private tab1Service: Tab1Service, private router:Router ) { } + 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)]; + console.log(discotecaDelEvento); + 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]); + }) + } + ) + } + + + } diff --git a/src/app/services/feed.service.ts b/src/app/services/feed.service.ts index 25e5322..62b4d40 100644 --- a/src/app/services/feed.service.ts +++ b/src/app/services/feed.service.ts @@ -1,5 +1,6 @@ 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'; @@ -10,6 +11,7 @@ export class FeedService { eventos: Eventoi[]; eventoIndex: number; + discotecaEvento: DiscotecaI; constructor(private apiService: ApiService, private router: Router) { } diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.html b/src/app/view-evento-cliente/view-evento-cliente.page.html index e44a147..83661de 100644 --- a/src/app/view-evento-cliente/view-evento-cliente.page.html +++ b/src/app/view-evento-cliente/view-evento-cliente.page.html @@ -21,6 +21,11 @@ {{evento.descripcion}} + +
+ {{discoteca?.nombre}} +
+
diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.ts b/src/app/view-evento-cliente/view-evento-cliente.page.ts index de3fec9..d9edc72 100644 --- a/src/app/view-evento-cliente/view-evento-cliente.page.ts +++ b/src/app/view-evento-cliente/view-evento-cliente.page.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { DiscotecaI } from '../interfaces/discoteca-i'; import { Eventoi } from '../interfaces/eventoi'; import { FeedService } from '../services/feed.service'; @@ -10,10 +11,12 @@ import { FeedService } from '../services/feed.service'; 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; } } -- 2.44.1 From dc04cd122f11a228b24d4662af16aea371e3d7ac Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Thu, 13 May 2021 18:13:47 +0200 Subject: [PATCH 14/15] Nombre de la discoteca en evento linkado a view discoteca cliente --- src/app/app-routing.module.ts | 116 +++++++++--------- src/app/feed/feed.page.ts | 1 - src/app/tab2/tab2-routing.module.ts | 6 +- .../view-discoteca-cliente-routing.module.ts | 17 +++ .../view-discoteca-cliente.module.ts | 20 +++ .../view-discoteca-cliente.page.html | 9 ++ .../view-discoteca-cliente.page.scss | 0 .../view-discoteca-cliente.page.spec.ts | 24 ++++ .../view-discoteca-cliente.page.ts | 15 +++ .../view-evento-cliente-routing.module.ts | 5 + .../view-evento-cliente.page.html | 2 +- .../view-evento-cliente.page.scss | 3 + 12 files changed, 159 insertions(+), 59 deletions(-) create mode 100644 src/app/view-discoteca-cliente/view-discoteca-cliente-routing.module.ts create mode 100644 src/app/view-discoteca-cliente/view-discoteca-cliente.module.ts create mode 100644 src/app/view-discoteca-cliente/view-discoteca-cliente.page.html create mode 100644 src/app/view-discoteca-cliente/view-discoteca-cliente.page.scss create mode 100644 src/app/view-discoteca-cliente/view-discoteca-cliente.page.spec.ts create mode 100644 src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9b6b79e..99893c7 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,58 +1,62 @@ -import { NgModule } from '@angular/core'; -import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; -import { LoginPage } from './login/login.page'; - - -const routes: Routes = [ - - { - path: 'login', - component: LoginPage - }, - { - 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) - }, - { - path: 'galeriamodal', - loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule) - }, - { - path:'', - 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) +import { NgModule } from '@angular/core'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; +import { LoginPage } from './login/login.page'; + + +const routes: Routes = [ + + { + path: 'login', + component: LoginPage + }, + { + 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) + }, + { + path: 'galeriamodal', + loadChildren: () => import('./galeriamodal/galeriamodal.module').then( m => m.GaleriamodalPageModule) + }, + { + path:'', + 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) }, - - - - - -]; -@NgModule({ - imports: [ - RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) - ], - exports: [RouterModule] -}) -export class AppRoutingModule {} + + + + + + +]; +@NgModule({ + imports: [ + RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) + ], + exports: [RouterModule] +}) +export class AppRoutingModule {} diff --git a/src/app/feed/feed.page.ts b/src/app/feed/feed.page.ts index f224008..f928a9e 100644 --- a/src/app/feed/feed.page.ts +++ b/src/app/feed/feed.page.ts @@ -29,7 +29,6 @@ export class FeedPage implements OnInit { this.feedService.eventoIndex = this.eventos.indexOf(evento); let discotecaDelEvento: DiscotecaI = this.discotecas[this.idsDiscoteca.indexOf(evento.discotecaID)]; - console.log(discotecaDelEvento); this.feedService.discotecaEvento = discotecaDelEvento; this.router.navigate(['/tabsUser/tab2/view-evento-cliente']); diff --git a/src/app/tab2/tab2-routing.module.ts b/src/app/tab2/tab2-routing.module.ts index 4678fa5..3ec4433 100644 --- a/src/app/tab2/tab2-routing.module.ts +++ b/src/app/tab2/tab2-routing.module.ts @@ -3,17 +3,21 @@ 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: FeedPage, - }, { path: 'view-evento-cliente', component: ViewEventoClientePage + }, + { + path: 'view-discoteca-cliente', + component: ViewDiscotecaClientePage } ]; diff --git a/src/app/view-discoteca-cliente/view-discoteca-cliente-routing.module.ts b/src/app/view-discoteca-cliente/view-discoteca-cliente-routing.module.ts new file mode 100644 index 0000000..6d44c7e --- /dev/null +++ b/src/app/view-discoteca-cliente/view-discoteca-cliente-routing.module.ts @@ -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 {} diff --git a/src/app/view-discoteca-cliente/view-discoteca-cliente.module.ts b/src/app/view-discoteca-cliente/view-discoteca-cliente.module.ts new file mode 100644 index 0000000..2fe7f87 --- /dev/null +++ b/src/app/view-discoteca-cliente/view-discoteca-cliente.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { 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 {} diff --git a/src/app/view-discoteca-cliente/view-discoteca-cliente.page.html b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.html new file mode 100644 index 0000000..111ddd9 --- /dev/null +++ b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.html @@ -0,0 +1,9 @@ + + + view-discoteca-cliente + + + + + + diff --git a/src/app/view-discoteca-cliente/view-discoteca-cliente.page.scss b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/view-discoteca-cliente/view-discoteca-cliente.page.spec.ts b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.spec.ts new file mode 100644 index 0000000..74a4352 --- /dev/null +++ b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts new file mode 100644 index 0000000..02d4214 --- /dev/null +++ b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-view-discoteca-cliente', + templateUrl: './view-discoteca-cliente.page.html', + styleUrls: ['./view-discoteca-cliente.page.scss'], +}) +export class ViewDiscotecaClientePage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts b/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts index a1deaeb..808147f 100644 --- a/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts +++ b/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts @@ -1,5 +1,6 @@ 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'; @@ -7,6 +8,10 @@ const routes: Routes = [ { path: '', component: ViewEventoClientePage + }, + { + path: 'view-discoteca-cliente', + component: ViewDiscotecaClientePage } ]; diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.html b/src/app/view-evento-cliente/view-evento-cliente.page.html index 83661de..39aad18 100644 --- a/src/app/view-evento-cliente/view-evento-cliente.page.html +++ b/src/app/view-evento-cliente/view-evento-cliente.page.html @@ -23,7 +23,7 @@
- {{discoteca?.nombre}} + {{discoteca?.nombre}}
diff --git a/src/app/view-evento-cliente/view-evento-cliente.page.scss b/src/app/view-evento-cliente/view-evento-cliente.page.scss index e69de29..50f1b40 100644 --- a/src/app/view-evento-cliente/view-evento-cliente.page.scss +++ b/src/app/view-evento-cliente/view-evento-cliente.page.scss @@ -0,0 +1,3 @@ +.discotecaEvento{ + padding: 40px; +} \ No newline at end of file -- 2.44.1 From 80088382b5379bd1601b62835766f9042eae7ae0 Mon Sep 17 00:00:00 2001 From: onsaliyo Date: Fri, 14 May 2021 09:58:48 +0200 Subject: [PATCH 15/15] =?UTF-8?q?a=C3=B1adida=20pagina=20para=20ver=20disc?= =?UTF-8?q?oteca=20desde=20cliente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view-discoteca-cliente.page.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts index 02d4214..221d5ec 100644 --- a/src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts +++ b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts @@ -1,4 +1,7 @@ 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', @@ -7,9 +10,18 @@ import { Component, OnInit } from '@angular/core'; }) export class ViewDiscotecaClientePage implements OnInit { - constructor() { } + 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); + } + }) } } -- 2.44.1