From af852bff37fe98d346ad0226be12edc6769c7858 Mon Sep 17 00:00:00 2001
From: onsaliyo
Date: Tue, 2 Feb 2021 12:02:37 +0100
Subject: [PATCH] =?UTF-8?q?Permite=20a=C3=B1adir=20eventos=20a=20la=20p?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/app.component.scss | 12 ++++-
src/app/app.module.ts | 7 +--
src/app/evento.ts | 48 ++++++++++++++++---
.../perfil-discoteca.page.html | 22 +++++++++
.../perfil-discoteca.page.scss | 22 +++++++--
.../perfil-discoteca/perfil-discoteca.page.ts | 2 -
src/app/prompt-evento/prompt-evento.page.html | 36 +++++++++++++-
src/app/prompt-evento/prompt-evento.page.scss | 12 +++++
src/app/prompt-evento/prompt-evento.page.ts | 42 ++++++++++++++--
src/app/tab1/tab1.service.ts | 7 ++-
.../view-evento/view-evento.component.html | 3 ++
.../view-evento/view-evento.component.scss | 0
.../view-evento/view-evento.component.spec.ts | 24 ++++++++++
src/app/view-evento/view-evento.component.ts | 14 ++++++
14 files changed, 231 insertions(+), 20 deletions(-)
create mode 100644 src/app/view-evento/view-evento.component.html
create mode 100644 src/app/view-evento/view-evento.component.scss
create mode 100644 src/app/view-evento/view-evento.component.spec.ts
create mode 100644 src/app/view-evento/view-evento.component.ts
diff --git a/src/app/app.component.scss b/src/app/app.component.scss
index bad943f..e240050 100644
--- a/src/app/app.component.scss
+++ b/src/app/app.component.scss
@@ -10,4 +10,14 @@
margin-right: auto;
text-align: center;
margin: auto;
-}
\ No newline at end of file
+
+ --ion-color-primary: #c4b700;
+ --ion-color-primary-rgb: 196, 183, 0;
+ --ion-color-primary-contrast: #ffffff;
+ --ion-color-primary-contrast-rgb: 255,255,255;
+ --ion-color-primary-shade: #695100;
+ --ion-color-primary-tint: #8a8b39;
+}
+
+
+
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index afcb8df..98b0670 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
-
+import { ReactiveFormsModule } from '@angular/forms';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
@@ -9,11 +9,12 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { PerfilDiscotecaPage } from './perfil-discoteca/perfil-discoteca.page';
+import { PromptEventoPage} from './prompt-evento/prompt-evento.page'
@NgModule({
- declarations: [AppComponent, PerfilDiscotecaPage],
+ declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage],
entryComponents: [],
- imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
+ imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule],
providers: [
StatusBar,
SplashScreen,
diff --git a/src/app/evento.ts b/src/app/evento.ts
index c930c0e..0471ab1 100644
--- a/src/app/evento.ts
+++ b/src/app/evento.ts
@@ -1,9 +1,13 @@
export class Evento {
private id: number;
- private nombre: string;
- private localizacion: string;
- private fecha: Date;
- private desc: string;
+ nombre: string;
+ localizacion: string;
+ fecha: Date;
+ dia: string;
+ hora: string;
+ descripcion: string;
+ precio1: number;
+ precio2: number;
setNombre(nombre: string): void{
this.nombre = nombre;
@@ -30,10 +34,42 @@ export class Evento {
}
setDesc(desc: string): void{
- this.desc = desc;
+ this.descripcion = desc;
}
getDesc(): string{
- return this.desc;
+ return this.descripcion;
+ }
+
+ setDia(fecha: Date): void{
+ this.dia = fecha.getDate()+"/"+fecha.getMonth();
+ }
+
+ getDia(): string{
+ return this.dia;
+ }
+
+ setHora(fecha: Date): void{
+ this.hora = fecha.getHours()+":"+fecha.getMinutes();
+ }
+
+ getHora(): string{
+ return this.hora;
+ }
+
+ setPrecio1(precio: number): void{
+ this.precio1 = precio;
+ }
+
+ getPrecio1(): number{
+ return this.precio1;
+ }
+
+ setPrecio2(precio: number): void{
+ this.precio2 = precio;
+ }
+
+ getPrecio2(): number{
+ return this.precio2;
}
}
diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.html b/src/app/perfil-discoteca/perfil-discoteca.page.html
index d6a22c0..cd694f9 100644
--- a/src/app/perfil-discoteca/perfil-discoteca.page.html
+++ b/src/app/perfil-discoteca/perfil-discoteca.page.html
@@ -57,6 +57,7 @@
+ Galería de Fotos
@@ -79,6 +80,27 @@
Añadir evento
+
+
+ 0" class="eventos">
+
+
+
+
+
+ {{evento.descripcion}}
+
+
+
+
+
+
diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.scss b/src/app/perfil-discoteca/perfil-discoteca.page.scss
index 7292cb9..02d61ab 100644
--- a/src/app/perfil-discoteca/perfil-discoteca.page.scss
+++ b/src/app/perfil-discoteca/perfil-discoteca.page.scss
@@ -2,11 +2,11 @@
--ion-background-color-rgb: 73,73,73;
--ion-text-color: #eeeeee;
- --ion-text-color-rgb: 238,238,238;}
+ --ion-text-color-rgb: 238,238,238;
+ }
*{
padding: 5px;
- letter-spacing: 2px;
}
.titulo{
font: "arial";
@@ -59,7 +59,23 @@
.botonesVisible{
display: none;
}
+
+ .eventos{
+ margin: 20px;
+ justify-content: space-between;
+ }
+
+ .evento{
+ margin-top: 20px;
+ }
+ .eventoHeader{
+ font-weight: bold;
+ }
+
+ .eventoDesc{
+ color: white;
+ }
ion-slides {
height: 100%;
- }
\ 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 ce536a1..9ea5148 100644
--- a/src/app/perfil-discoteca/perfil-discoteca.page.ts
+++ b/src/app/perfil-discoteca/perfil-discoteca.page.ts
@@ -26,7 +26,6 @@ export class PerfilDiscotecaPage implements OnInit {
editDisabled: string;
editEnabled: string;
galeriaFotos: string[];
- galeriaFake: string[];
currentIndex: number;
eventos: Evento[];
alertCtrl: AlertController;
@@ -78,7 +77,6 @@ export class PerfilDiscotecaPage implements OnInit {
this.slides.update();
-
}
loadImageFromDevice(event): void{
diff --git a/src/app/prompt-evento/prompt-evento.page.html b/src/app/prompt-evento/prompt-evento.page.html
index 51f5d02..4590699 100644
--- a/src/app/prompt-evento/prompt-evento.page.html
+++ b/src/app/prompt-evento/prompt-evento.page.html
@@ -5,6 +5,40 @@
-
+
+
+
+
+
diff --git a/src/app/prompt-evento/prompt-evento.page.scss b/src/app/prompt-evento/prompt-evento.page.scss
index e69de29..749ffa2 100644
--- a/src/app/prompt-evento/prompt-evento.page.scss
+++ b/src/app/prompt-evento/prompt-evento.page.scss
@@ -0,0 +1,12 @@
+*{
+ --ion-text-color: #000000;
+ padding: 5px;
+ letter-spacing: 2px;
+
+}
+
+.campoInput{
+ display: block;
+}
+
+
diff --git a/src/app/prompt-evento/prompt-evento.page.ts b/src/app/prompt-evento/prompt-evento.page.ts
index 626868b..cef30c8 100644
--- a/src/app/prompt-evento/prompt-evento.page.ts
+++ b/src/app/prompt-evento/prompt-evento.page.ts
@@ -1,15 +1,51 @@
import { Component, OnInit } from '@angular/core';
+import { FormControl, FormGroup } from '@angular/forms';
+import { Tab1Service } from '../tab1/tab1.service';
+import { Evento } from '../evento';
+import { Router } from '@angular/router';
+import { FormBuilder } from '@angular/forms';
@Component({
selector: 'app-prompt-evento',
templateUrl: './prompt-evento.page.html',
styleUrls: ['./prompt-evento.page.scss'],
})
-export class PromptEventoPage implements OnInit {
+export class PromptEventoPage{
+ eventoForm = new FormGroup({
+ nombre: new FormControl(''),
+ fecha: new FormControl(''),
+ hora: new FormControl(''),
+ precio1: new FormControl(''),
+ precio2: new FormControl(''),
+ descripcion: new FormControl('')
+ });
- constructor() { }
+ eventos: Evento[];
- ngOnInit() {
+ constructor(private tab1Service: Tab1Service, private router: Router) {
+ this.eventos = [];
+ }
+
+ onSubmit(){
+ let evento = new Evento();
+ this.asignarEvento(evento);
+ this.router.navigate(['/tabs/tab1/perfil-discoteca']);
}
+ 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
+ if (!this.tab1Service.eventos){
+ this.tab1Service.initEventos();}
+ this.tab1Service.eventos.push(evento);
+ for (var i=0; i
+ view-evento works!
+
diff --git a/src/app/view-evento/view-evento.component.scss b/src/app/view-evento/view-evento.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/view-evento/view-evento.component.spec.ts b/src/app/view-evento/view-evento.component.spec.ts
new file mode 100644
index 0000000..0df046e
--- /dev/null
+++ b/src/app/view-evento/view-evento.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { ViewEventoComponent } from './view-evento.component';
+
+describe('ViewEventoComponent', () => {
+ let component: ViewEventoComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ViewEventoComponent ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(ViewEventoComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/view-evento/view-evento.component.ts b/src/app/view-evento/view-evento.component.ts
new file mode 100644
index 0000000..c71e99a
--- /dev/null
+++ b/src/app/view-evento/view-evento.component.ts
@@ -0,0 +1,14 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-view-evento',
+ templateUrl: './view-evento.component.html',
+ styleUrls: ['./view-evento.component.scss'],
+})
+export class ViewEventoComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {}
+
+}