diff --git a/package-lock.json b/package-lock.json index 9fc7698..9070f13 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 0027bc8..c53b809 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", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index c4f4dc7..99893c7 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,40 +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: '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' +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/app.module.ts b/src/app/app.module.ts index 287c89e..a075dc3 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -11,12 +11,17 @@ 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 { MatCardModule } from '@angular/material/card'; import { LoginPage } from './login/login.page'; +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], + imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule, MatMenuModule, BrowserAnimationsModule, MatIconModule, MatCardModule], providers: [ StatusBar, SplashScreen, 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.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..9c09003 --- /dev/null +++ b/src/app/feed/feed.page.html @@ -0,0 +1,35 @@ + + + Eventos Próximos + + + + + + + +
+ + +
+
+ {{evento.nombre}} · + + {{evento.fecha}} · + + {{evento.precio1}},{{evento.precio2}} +
+
+ {{evento.descripcion}} +
+
+ {{discotecas[idsDiscoteca.indexOf(evento.discotecaID)]?.nombre}} +
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/app/feed/feed.page.scss b/src/app/feed/feed.page.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/feed/feed.page.spec.ts b/src/app/feed/feed.page.spec.ts new file mode 100644 index 0000000..a6dba8c --- /dev/null +++ b/src/app/feed/feed.page.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/src/app/feed/feed.page.ts b/src/app/feed/feed.page.ts new file mode 100644 index 0000000..f928a9e --- /dev/null +++ b/src/app/feed/feed.page.ts @@ -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]); + }) + } + ) + } + + + +} 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/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/perfil-discoteca/perfil-discoteca.page.html b/src/app/perfil-discoteca/perfil-discoteca.page.html index e3cd2bf..2e12076 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.html +++ b/src/app/perfil-discoteca/perfil-discoteca.page.html @@ -8,40 +8,54 @@ - - -
+
- +
{{nombre}}
- -
- - - - -
- -
- - - -
- - - - - Cancelar -
-
- - - - +
- + + + + + + +
+ + +
+
+ @@ -52,10 +66,24 @@
{{localizacion}}
- +
+ + + Descripción + + + {{descripcion}} + + +
+
+ + +
Galería de Fotos + @@ -69,19 +97,10 @@
-
- - - - - - Añadir evento - - - +
@@ -101,14 +120,13 @@
+
+
+ + +
- - - - - -
\ No newline at end of file diff --git a/src/app/perfil-discoteca/perfil-discoteca.page.scss b/src/app/perfil-discoteca/perfil-discoteca.page.scss index d4e24fa..ef9b42d 100644 --- a/src/app/perfil-discoteca/perfil-discoteca.page.scss +++ b/src/app/perfil-discoteca/perfil-discoteca.page.scss @@ -6,16 +6,20 @@ } *{ - 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 +39,8 @@ float: left; position: relative; margin: auto; + text-align: right; + padding-right: 50px; } @@ -43,15 +49,14 @@ } .galeria{ - - display: block; - max-width: 300px; - max-height: auto; + text-align: center; + padding: 30px; margin: auto; } .botonesHidden{ display: none; + padding: none; } .botonesVisible{ @@ -59,14 +64,21 @@ } .eventos{ - display:block; + text-align: justify; + } + + .evento{ + max-width:fit-content; } .evento:hover{ background-color: rgb(97, 97, 97); } + .eventoHeader{ font-weight: bold; + float: left; + } .eventoDesc{ @@ -76,3 +88,26 @@ ion-slides { height: 200px; } + + mat-card-header{ + text-align: right; + font-weight: bold; + } + + + button{ + background-color: transparent; + } + + .settingsIcon{ + font-size: large; + background-color: white; + } + + .menuBotones{ + position: relative; + float: left; + 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 2438f98..6ab4d9e 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) { @@ -49,6 +48,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'; @@ -79,6 +79,7 @@ export class PerfilDiscotecaPage implements OnInit { this.eventos = this.tab1Service.eventos; } + cargarImagen(){ this.fotoSrc = this.someURL; } @@ -123,10 +124,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 +143,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"); @@ -183,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/prompt-evento/prompt-evento.page.html b/src/app/prompt-evento/prompt-evento.page.html index 8e2cd63..b0b83a2 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 @@ -32,10 +32,10 @@ + *ngIf="hora?.errors?.required && submitted"> Tu evento necesita una hora @@ -47,7 +47,7 @@ + *ngIf="precio1?.errors?.required && (precio1.touched||submitted)"> Tu evento necesita un precio (puede ser 0) @@ -58,7 +58,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 31b21a3..c1e13d9 100644 --- a/src/app/prompt-evento/prompt-evento.page.ts +++ b/src/app/prompt-evento/prompt-evento.page.ts @@ -13,6 +13,7 @@ import { ViewEventoPageRoutingModule } from '../view-evento/view-evento-routing. }) export class PromptEventoPage implements OnInit{ submitted = false; + editarEvento = false; eventoForm = new FormGroup({ nombre: new FormControl(null, Validators.required), fecha: new FormControl(null, Validators.required), @@ -36,21 +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,30 +46,21 @@ 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; - //evento.setDia(evento.getFecha()); el datetime de Ion devuelve un String, no se puede if (!this.tab1Service.eventos){ - this.tab1Service.initEventos();} + this.tab1Service.eventos=[];} 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/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..62b4d40 --- /dev/null +++ b/src/app/services/feed.service.ts @@ -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]; + } + + +} 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..3a95975 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,20 @@ 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.patchValue(evento); + this.eventoForms.push(thisForm); + }) + } } getEventobyIndex(eventoIndex: number){ @@ -91,6 +105,7 @@ getDiscoteca(discotecaId: number){ this.initValues(); }) } + } postEvento(evento: Eventoi){ @@ -102,7 +117,9 @@ getDiscoteca(discotecaId: number){ } updateEvento(evento: Eventoi){ - + } + + } diff --git a/src/app/tab2/tab2-routing.module.ts b/src/app/tab2/tab2-routing.module.ts index e96ec09..3ec4433 100644 --- a/src/app/tab2/tab2-routing.module.ts +++ b/src/app/tab2/tab2-routing.module.ts @@ -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 } ]; diff --git a/src/app/tab2/tab2.page.html b/src/app/tab2/tab2.page.html index 74fa30f..e69de29 100644 --- a/src/app/tab2/tab2.page.html +++ b/src/app/tab2/tab2.page.html @@ -1,56 +0,0 @@ - - - - - - - Página 1 - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - \ No newline at end of file diff --git a/src/app/tab2/tab2.page.ts b/src/app/tab2/tab2.page.ts index e14cad4..bba1910 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() {} + ngOnInit(){ + + } + } 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 - 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..221d5ec --- /dev/null +++ b/src/app/view-discoteca-cliente/view-discoteca-cliente.page.ts @@ -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); + } + }) + } + +} 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..808147f --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente-routing.module.ts @@ -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 {} 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..39aad18 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.html @@ -0,0 +1,31 @@ + + + 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..50f1b40 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.scss @@ -0,0 +1,3 @@ +.discotecaEvento{ + padding: 40px; +} \ No newline at end of file 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..d9edc72 --- /dev/null +++ b/src/app/view-evento-cliente/view-evento-cliente.page.ts @@ -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; + } + +}