discofy inicial

This commit is contained in:
2021-01-18 14:01:50 +01:00
commit 5f48a57c6f
152 changed files with 17101 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes: Routes = [
{
path: '',
loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
},
{
path: 'prompt-evento',
loadChildren: () => import('./prompt-evento/prompt-evento.module').then( m => m.PromptEventoPageModule)
},
{
path: 'perfil-discoteca',
loadChildren: () => import('./perfil-discoteca/perfil-discoteca.module').then( m => m.PerfilDiscotecaPageModule)
},
];
@NgModule({
imports: [
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}

View File

@@ -0,0 +1,3 @@
<ion-app>
<ion-router-outlet></ion-router-outlet>
</ion-app>

View File

@@ -0,0 +1,13 @@
*{
--ion-background-color: #494949;
--ion-background-color-rgb: 73,73,73;
--ion-text-color: #eeeeee;
--ion-text-color-rgb: 238,238,238;
display: block;
margin-left: auto;
margin-right: auto;
text-align: center;
margin: auto;
}

View File

@@ -0,0 +1,50 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TestBed, async } from '@angular/core/testing';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
let statusBarSpy;
let splashScreenSpy;
let platformReadySpy;
let platformSpy;
beforeEach(async(() => {
statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
platformReadySpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [
{ provide: StatusBar, useValue: statusBarSpy },
{ provide: SplashScreen, useValue: splashScreenSpy },
{ provide: Platform, useValue: platformSpy },
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should initialize the app', async () => {
TestBed.createComponent(AppComponent);
expect(platformSpy.ready).toHaveBeenCalled();
await platformReadySpy;
expect(statusBarSpy.styleDefault).toHaveBeenCalled();
expect(splashScreenSpy.hide).toHaveBeenCalled();
});
// TODO: add more tests!
});

27
src/app/app.component.ts Normal file
View File

@@ -0,0 +1,27 @@
import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
})
export class AppComponent {
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar
) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
});
}
}

23
src/app/app.module.ts Normal file
View File

@@ -0,0 +1,23 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}

View File

@@ -0,0 +1,7 @@
import { Discoteca } from './discoteca';
describe('Discoteca', () => {
it('should create an instance', () => {
expect(new Discoteca()).toBeTruthy();
});
});

40
src/app/discoteca.ts Normal file
View File

@@ -0,0 +1,40 @@
import {Evento} from './evento';
export class Discoteca {
private id: number;
private nombre: string;
private telefono: number;
private localizacion: string;
private eventos: Evento[];
setNombre(nombre: string): void{
this.nombre = nombre;
}
getNombre(): string{
return this.nombre;
}
setTelefono(telefono: number): void{
this.telefono = telefono;
}
getTelefono(): number{
return this.telefono;
}
setLocalizacion(localizacion: string): void{
this.localizacion = localizacion;
}
getLocalizacion(): string{
return this.localizacion
}
getEventos(): Evento[]{
return this.eventos;
}
}

7
src/app/evento.spec.ts Normal file
View File

@@ -0,0 +1,7 @@
import { Evento } from './evento';
describe('Evento', () => {
it('should create an instance', () => {
expect(new Evento()).toBeTruthy();
});
});

39
src/app/evento.ts Normal file
View File

@@ -0,0 +1,39 @@
export class Evento {
private id: number;
private nombre: string;
private localizacion: string;
private fecha: Date;
private desc: string;
setNombre(nombre: string): void{
this.nombre = nombre;
}
getNombre(): string{
return this.nombre;
}
setLocalizacion(localizacion: string): void{
this.localizacion = localizacion;
}
getLocalizacion(): string{
return this.localizacion
}
setFecha(fecha: Date): void{
this.fecha = fecha;
}
getFecha(): Date{
return this.fecha;
}
setDesc(desc: string): void{
this.desc = desc;
}
getDesc(): string{
return this.desc;
}
}

View File

@@ -0,0 +1,4 @@
<div id="container">
<strong>{{ name }}</strong>
<p>Explore <a target="_blank" rel="noopener noreferrer" href="https://ionicframework.com/docs/components">UI Components</a></p>
</div>

View File

@@ -0,0 +1,27 @@
#container {
text-align: center;
position: absolute;
left: 0;
right: 0;
top: 50%;
transform: translateY(-50%);
}
#container strong {
font-size: 20px;
line-height: 26px;
}
#container p {
font-size: 16px;
line-height: 22px;
color: #8c8c8c;
margin: 0;
}
#container a {
text-decoration: none;
}

View File

@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from './explore-container.component';
describe('ExploreContainerComponent', () => {
let component: ExploreContainerComponent;
let fixture: ComponentFixture<ExploreContainerComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ExploreContainerComponent ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ExploreContainerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-explore-container',
templateUrl: './explore-container.component.html',
styleUrls: ['./explore-container.component.scss'],
})
export class ExploreContainerComponent implements OnInit {
@Input() name: string;
constructor() { }
ngOnInit() {}
}

View File

@@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from './explore-container.component';
@NgModule({
imports: [ CommonModule, FormsModule, IonicModule],
declarations: [ExploreContainerComponent],
exports: [ExploreContainerComponent]
})
export class ExploreContainerComponentModule {}

7
src/app/galeria.spec.ts Normal file
View File

@@ -0,0 +1,7 @@
import { Galeria } from './galeria';
describe('Galeria', () => {
it('should create an instance', () => {
expect(new Galeria()).toBeTruthy();
});
});

21
src/app/galeria.ts Normal file
View File

@@ -0,0 +1,21 @@
export class Galeria {
private id: number;
private discoteca: string;
private fotos: string[];
addFoto(src: string){
this.fotos.push(src);
}
setDiscoteca(nombre: string): void{
this.discoteca = nombre;
}
getDiscoteca(): string{
return this.discoteca;
}
getGaleria(): string[]{
return this.fotos;
}
}

View File

@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PerfilDiscotecaPage } from './perfil-discoteca.page';
const routes: Routes = [
{
path: '',
component: PerfilDiscotecaPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PerfilDiscotecaPageRoutingModule {}

View File

@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { PerfilDiscotecaPageRoutingModule } from './perfil-discoteca-routing.module';
import { PerfilDiscotecaPage } from './perfil-discoteca.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PerfilDiscotecaPageRoutingModule
],
declarations: [PerfilDiscotecaPage]
})
export class PerfilDiscotecaPageModule {}

View File

@@ -0,0 +1,90 @@
<ion-header>
<ion-toolbar>
<ion-title>Mi Perfil</ion-title>
</ion-toolbar>
</ion-header>
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title class="titulo" size="large">Mi Perfil</ion-title>
</ion-toolbar>
</ion-header>
<ion-grid>
<div class='fotoPerfil'>
<ion-row>
<ion-col>
<ion-img class="fotoPerfil" width="100%" height="100%" [src]='fotoSrc' alt='barraquinha'></ion-img>
<div class="textoPie">{{nombre}}</div>
<div class="addFoto">
<ion-button [disabled]='editDisabled'>
<ion-icon name="image" slot="icon-only"></ion-icon>
<input type="file" (change)="loadImageFromDevice($event);cargarImagen()" id="file-input-perfil" accept="image/png, image/jpeg">
</ion-button>
</div>
<div>
<ion-button (click)="enableEdit()" label="editar" [disabled]='editEnabled'>
<ion-icon name="create"></ion-icon>
</ion-button>
<div id="botonesHidden1" class="botonesHidden">
<ion-button (click)="saveEdit()" label="guardar" [disabled]='editDisabled'>
<ion-icon name="save"></ion-icon>
</ion-button>
<ion-button (click)="cancelEdit()" [disabled]='editDisabled'>
Cancelar
</ion-button></div>
</div>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<div id="cajaDatos" class='datosDisplay'>
<div class="datosLabel">Teléfono: </div>
<div [contentEditable]='editEnabled'>{{telefono}}</div>
<div class="datosLabel">Localización: </div>
<div [contentEditable]='editEnabled'>{{localizacion}}</div>
</div>
</ion-col>
<ion-col>
<div class="galeria">
<input type="file" (change)="loadImageFromDevice($event)" id="file-input-galeria" accept="image/png, image/jpeg">
<ion-slides (ionDrag)="onSlideChanged()">
<ion-slide *ngFor="let foto of galeriaFotos">
<div class="fotoGaleria"><img src="{{foto}}">
<ion-button (click)="borrarDeGaleria()">
<ion-icon name="trash-outline"></ion-icon>
</ion-button>
</div>
</ion-slide>
</ion-slides>
</div>
</ion-col>
</ion-row>
<ion-row>
<ion-button (click)="addEvento()">
<ion-icon name="add-circle-outline">
</ion-icon>
Añadir evento
</ion-button>
</ion-row>
</div>
</ion-grid>
</ion-content>

View File

@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { PerfilDiscotecaPage } from './perfil-discoteca.page';
describe('PerfilDiscotecaPage', () => {
let component: PerfilDiscotecaPage;
let fixture: ComponentFixture<PerfilDiscotecaPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PerfilDiscotecaPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(PerfilDiscotecaPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,168 @@
import { Component, OnInit } from '@angular/core';
import { NodeCompatibleEventEmitter } from 'rxjs/internal/observable/fromEvent';
import { Tab1Service } from '../tab1/tab1.service'
import { Discoteca } from '../discoteca'
import { IonSlides} from '@ionic/angular';
import { AlertController } from '@ionic/angular';
import { ViewChild } from '@angular/core';
import { Evento } from '../evento';
import { Router } from '@angular/router';
@Component({
selector: 'app-perfil-discoteca',
templateUrl: './perfil-discoteca.page.html',
styleUrls: ['./perfil-discoteca.page.scss'],
})
export class PerfilDiscotecaPage implements OnInit {
@ViewChild('IonSlides') slides: IonSlides;
nombre: string;
telefono: number;
localizacion: string;
fotoSrc: string;
fotoLoaded: string;
someURL: string;
editDisabled: string;
editEnabled: string;
galeriaFotos: string[];
galeriaFake: string[];
currentIndex: number;
eventos: Evento[];
alertCtrl: AlertController;
constructor(private tab1Service: Tab1Service, private router: Router) {
}
ngOnInit(){
this.initValues();
}
initValues(): void{
this.getNombre();
this.getTelefono();
this.getLocalizacion();
this.getEventos();
this.editDisabled="true";
this.editEnabled="false";
this.fotoSrc = '../assets/barraca.jpg';
this.fotoLoaded = this.fotoSrc;
this.galeriaFotos = [];
}
getNombre(): void{
this.nombre = this.tab1Service.getNombre();
}
getTelefono(): void{
this.telefono = this.tab1Service.getTelefono();
}
getLocalizacion(): void{
this.localizacion = this.tab1Service.getLocalizacion();
}
getEventos(): void{
this.eventos = this.tab1Service.getEventos();
}
cargarImagen(){
this.fotoSrc = this.someURL;
}
addGaleria(){
this.galeriaFotos.push(this.someURL);
this.slides.update();
}
loadImageFromDevice(event): void{
const file = event.target.files[0];
let blobURL: string;
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
let blob: Blob = new Blob([new Uint8Array((reader.result as ArrayBuffer))]);
let blobURL = URL.createObjectURL(blob);
this.someURL = reader.result as string;
if (event.target.id=="file-input-perfil")
this.cargarImagen();
else if (event.target.id=="file-input-galeria")
this.addGaleria();
};
};
enableEdit(){
this.editDisabled="false";
this.editEnabled="true";
let cajaDatos = document.getElementById("cajaDatos");
cajaDatos.style.background="white";
cajaDatos.style.color="black";
let botones = document.getElementById("botonesHidden1");
botones.style.display = "block";
botones = document.getElementById("botonesHidden2");
botones.style.display = "block";
}
disableEdit(){
this.editDisabled="true";
this.editEnabled="false";
let cajaDatos = document.getElementById("cajaDatos");
cajaDatos.style.background="inherit";
cajaDatos.style.color="inherit";
let botones = document.getElementById("botonesHidden1");
botones.style.display = "none";
botones = document.getElementById("botonesHidden2");
botones.style.display = "none";
}
saveEdit(){
this.fotoLoaded = this.fotoSrc;
this.disableEdit();
}
cancelEdit(){
if(this.fotoLoaded)
this.fotoSrc = this.fotoLoaded;
this.disableEdit();}
borrarDeGaleria(){
this.galeriaFotos.splice(this.currentIndex, 1);
}
onSlideChanged() {
this.slides.getActiveIndex().then(index =>{
this.currentIndex = index;}
);
this.slides.update();
}
addEvento() {
this.router.navigate(['prompt-evento']);
}
}

View File

@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PromptEventoPage } from './prompt-evento.page';
const routes: Routes = [
{
path: '',
component: PromptEventoPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PromptEventoPageRoutingModule {}

View File

@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { PromptEventoPageRoutingModule } from './prompt-evento-routing.module';
import { PromptEventoPage } from './prompt-evento.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PromptEventoPageRoutingModule
],
declarations: [PromptEventoPage]
})
export class PromptEventoPageModule {}

View File

@@ -0,0 +1,10 @@
<ion-header>
<ion-toolbar>
<ion-title>Nuevo Evento</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
</ion-content>

View File

@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { PromptEventoPage } from './prompt-evento.page';
describe('PromptEventoPage', () => {
let component: PromptEventoPage;
let fixture: ComponentFixture<PromptEventoPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PromptEventoPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(PromptEventoPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-prompt-evento',
templateUrl: './prompt-evento.page.html',
styleUrls: ['./prompt-evento.page.scss'],
})
export class PromptEventoPage implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { Tab1Page } from './tab1.page';
const routes: Routes = [
{
path: '',
component: Tab1Page,
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class Tab1PageRoutingModule {}

View File

@@ -0,0 +1,20 @@
import { IonicModule } from '@ionic/angular';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Tab1Page } from './tab1.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { Tab1PageRoutingModule } from './tab1-routing.module';
@NgModule({
imports: [
IonicModule,
CommonModule,
FormsModule,
ExploreContainerComponentModule,
Tab1PageRoutingModule
],
declarations: [Tab1Page]
})
export class Tab1PageModule {}

View File

@@ -0,0 +1,92 @@
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>
Mi Perfil
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title class="titulo" size="large">Mi Perfil</ion-title>
</ion-toolbar>
</ion-header>
<ion-grid>
<div class='fotoPerfil'>
<ion-row>
<ion-col>
<ion-img class="fotoPerfil" width="100%" height="100%" [src]='fotoSrc' alt='barraquinha'></ion-img>
<div class="textoPie">{{nombre}}</div>
<div class="addFoto">
<ion-button [disabled]='editDisabled'>
<ion-icon name="image" slot="icon-only"></ion-icon>
<input type="file" (change)="loadImageFromDevice($event);cargarImagen()" id="file-input-perfil" accept="image/png, image/jpeg">
</ion-button>
</div>
<div>
<ion-button (click)="enableEdit()" label="editar" [disabled]='editEnabled'>
<ion-icon name="create"></ion-icon>
</ion-button>
<div id="botonesHidden1" class="botonesHidden">
<ion-button (click)="saveEdit()" label="guardar" [disabled]='editDisabled'>
<ion-icon name="save"></ion-icon>
</ion-button>
<ion-button (click)="cancelEdit()" [disabled]='editDisabled'>
Cancelar
</ion-button></div>
</div>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<div id="cajaDatos" class='datosDisplay'>
<div class="datosLabel">Teléfono: </div>
<div [contentEditable]='editEnabled'>{{telefono}}</div>
<div class="datosLabel">Localización: </div>
<div [contentEditable]='editEnabled'>{{localizacion}}</div>
</div>
</ion-col>
<ion-col>
<div class="galeria">
<input type="file" (change)="loadImageFromDevice($event)" id="file-input-galeria" accept="image/png, image/jpeg">
<ion-slides (ionDrag)="onSlideChanged()">
<ion-slide *ngFor="let foto of galeriaFotos">
<div class="fotoGaleria"><img src="{{foto}}">
<ion-button (click)="borrarDeGaleria()">
<ion-icon name="trash-outline"></ion-icon>
</ion-button>
</div>
</ion-slide>
</ion-slides>
</div>
</ion-col>
</ion-row>
<ion-row>
<ion-button (click)="addEvento()">
<ion-icon name="add-circle-outline">
</ion-icon>
Añadir evento
</ion-button>
</ion-row>
</div>
</ion-grid>
</ion-content>

View File

@@ -0,0 +1,65 @@
:root {--ion-background-color: #494949;
--ion-background-color-rgb: 73,73,73;
--ion-text-color: #eeeeee;
--ion-text-color-rgb: 238,238,238;}
*{
padding: 5px;
letter-spacing: 2px;
}
.titulo{
font: "arial";
}
.fotoPerfil{
display: block;
text-align: end;
max-width: 800px;
max-height: auto;
margin: auto;
}
.textoPie{
position: relative;
bottom: 40px;
right: 20px;
float: right;
}
.addFoto{
position: relative;
float: left;
}
.datosDisplay{
float: left;
position: relative;
margin: auto;
}
.datosLabel{
color: grey;
}
.galeria{
display: block;
max-width: 300px;
max-height: auto;
margin: auto;
}
.botonesHidden{
display: none;
}
.botonesVisible{
display: none;
}
ion-slides {
height: 100%;
}

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { Tab1Page } from './tab1.page';
describe('Tab1Page', () => {
let component: Tab1Page;
let fixture: ComponentFixture<Tab1Page>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [Tab1Page],
imports: [IonicModule.forRoot(), ExploreContainerComponentModule]
}).compileComponents();
fixture = TestBed.createComponent(Tab1Page);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

169
src/app/tab1/tab1.page.ts Normal file
View File

@@ -0,0 +1,169 @@
import { Component, OnInit } from '@angular/core';
import { NodeCompatibleEventEmitter } from 'rxjs/internal/observable/fromEvent';
import { Tab1Service } from './tab1.service'
import { Discoteca } from '../discoteca'
import { IonSlides} from '@ionic/angular';
import { AlertController } from '@ionic/angular';
import { ViewChild } from '@angular/core';
import { Evento } from '../evento';
import { Router } from '@angular/router';
import { PerfilDiscotecaPageModule } from '../perfil-discoteca/perfil-discoteca.module';
@Component({
selector: 'app-tab1',
templateUrl: 'tab1.page.html',
styleUrls: ['tab1.page.scss']
})
export class Tab1Page implements OnInit {
@ViewChild('IonSlides') slides: IonSlides;
nombre: string;
telefono: number;
localizacion: string;
fotoSrc: string;
fotoLoaded: string;
someURL: string;
editDisabled: string;
editEnabled: string;
galeriaFotos: string[];
galeriaFake: string[];
currentIndex: number;
eventos: Evento[];
alertCtrl: AlertController;
constructor(private tab1Service: Tab1Service, private router: Router) {
}
ngOnInit(){
this.initValues();
}
initValues(): void{
this.getNombre();
this.getTelefono();
this.getLocalizacion();
this.getEventos();
this.editDisabled="true";
this.editEnabled="false";
this.fotoSrc = '../assets/barraca.jpg';
this.fotoLoaded = this.fotoSrc;
this.galeriaFotos = [];
}
getNombre(): void{
this.nombre = this.tab1Service.getNombre();
}
getTelefono(): void{
this.telefono = this.tab1Service.getTelefono();
}
getLocalizacion(): void{
this.localizacion = this.tab1Service.getLocalizacion();
}
getEventos(): void{
this.eventos = this.tab1Service.getEventos();
}
cargarImagen(){
this.fotoSrc = this.someURL;
}
addGaleria(){
this.galeriaFotos.push(this.someURL);
this.slides.update();
}
loadImageFromDevice(event): void{
const file = event.target.files[0];
let blobURL: string;
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
let blob: Blob = new Blob([new Uint8Array((reader.result as ArrayBuffer))]);
let blobURL = URL.createObjectURL(blob);
this.someURL = reader.result as string;
if (event.target.id=="file-input-perfil")
this.cargarImagen();
else if (event.target.id=="file-input-galeria")
this.addGaleria();
};
};
enableEdit(){
this.editDisabled="false";
this.editEnabled="true";
let cajaDatos = document.getElementById("cajaDatos");
cajaDatos.style.background="white";
cajaDatos.style.color="black";
let botones = document.getElementById("botonesHidden1");
botones.style.display = "block";
botones = document.getElementById("botonesHidden2");
botones.style.display = "block";
}
disableEdit(){
this.editDisabled="true";
this.editEnabled="false";
let cajaDatos = document.getElementById("cajaDatos");
cajaDatos.style.background="inherit";
cajaDatos.style.color="inherit";
let botones = document.getElementById("botonesHidden1");
botones.style.display = "none";
botones = document.getElementById("botonesHidden2");
botones.style.display = "none";
}
saveEdit(){
this.fotoLoaded = this.fotoSrc;
this.disableEdit();
}
cancelEdit(){
if(this.fotoLoaded)
this.fotoSrc = this.fotoLoaded;
this.disableEdit();}
borrarDeGaleria(){
this.galeriaFotos.splice(this.currentIndex, 1);
}
onSlideChanged() {
this.slides.getActiveIndex().then(index =>{
this.currentIndex = index;}
);
this.slides.update();
}
addEvento() {
this.router.navigate(['prompt-evento']);
}
}

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { Tab1Service } from './tab1.service';
describe('Tab1Service', () => {
let service: Tab1Service;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(Tab1Service);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,54 @@
import { Injectable, OnInit } from '@angular/core';
import { stringify } from 'querystring';
import { Tab1Page } from './tab1.page'
import { Discoteca } from '../discoteca'
import { Galeria } from '../galeria';
import { Evento } from '../evento';
@Injectable({
providedIn: 'root'
})
export class Tab1Service implements OnInit{
discoteca: Discoteca;
galeria: Galeria;
eventos: Evento[];
constructor() {
}
ngOnInit(){
this.initValues();
}
initValues(): void{
this.discoteca = new Discoteca();
this.discoteca.setNombre('Barraca');
this.discoteca.setTelefono(666666666);
this.discoteca.setLocalizacion('Calle del Barquillo');
this.galeria = new Galeria();
this.galeria.setDiscoteca(this.discoteca.getNombre());
}
getNombre(): string{
this.initValues();
return this.discoteca.getNombre();
}
getTelefono(): number{
this.initValues();
return this.discoteca.getTelefono();
}
getLocalizacion(): string{
this.initValues();
return this.discoteca.getLocalizacion();
}
getEventos(): Evento[]{
return this.discoteca.getEventos();
}
}

View File

@@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { Tab2Page } from './tab2.page';
const routes: Routes = [
{
path: '',
component: Tab2Page,
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class Tab2PageRoutingModule {}

View File

@@ -0,0 +1,21 @@
import { IonicModule } from '@ionic/angular';
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Tab2Page } from './tab2.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { Tab2PageRoutingModule } from './tab2-routing.module';
@NgModule({
imports: [
IonicModule,
CommonModule,
FormsModule,
ExploreContainerComponentModule,
Tab2PageRoutingModule
],
declarations: [Tab2Page]
})
export class Tab2PageModule {}

View File

@@ -0,0 +1,56 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="page_type" content="np-template-header-footer-from-plugin">
<title>Página 1</title>
<link rel="stylesheet" href="nicepage.css" media="screen">
<link rel="stylesheet" href="Página-1.css" media="screen">
<script class="u-script" type="text/javascript" src="jquery.js" defer=""></script>
<script class="u-script" type="text/javascript" src="nicepage.js" defer=""></script>
<meta name="generator" content="Nicepage 3.0.9, nicepage.com">
<link id="u-theme-google-font" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i|Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i">
<meta property="og:title" content="Página 1">
<meta property="og:type" content="website">
<meta name="theme-color" content="#478ac9">
<link rel="canonical" href="index.html">
<meta property="og:url" content="index.html">
</head>
<body class="u-body">
<section class="u-clearfix u-section-1" id="sec-6396">
<div class="u-clearfix u-sheet u-sheet-1">
<div class="u-clearfix u-expanded-width u-layout-wrap u-layout-wrap-1">
<div class="u-layout">
<div class="u-layout-row">
<div class="u-size-30">
<div class="u-layout-col">
<div class="u-container-style u-layout-cell u-size-60 u-layout-cell-1">
<div class="u-container-layout u-container-layout-1"></div>
</div>
</div>
</div>
<div class="u-size-30">
<div class="u-layout-col">
<div class="u-container-style u-layout-cell u-size-30 u-layout-cell-2">
<div class="u-container-layout u-container-layout-2"></div>
</div>
<div class="u-container-style u-layout-cell u-size-30 u-layout-cell-3">
<div class="u-container-layout u-container-layout-3"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</body>

120
src/app/tab2/tab2.page.scss Normal file
View File

@@ -0,0 +1,120 @@
.u-section-1 .u-sheet-1 {
min-height: 500px;
}
.u-section-1 .u-layout-wrap-1 {
margin-top: 60px;
margin-bottom: 60px;
position: relative;
}
.u-section-1 .u-layout-cell-1 {
min-height: 400px;
}
.u-section-1 .u-container-layout-1 {
padding: 30px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 200px;
}
.u-section-1 .u-container-layout-2 {
padding: 30px;
}
.u-section-1 .u-layout-cell-3 {
min-height: 200px;
}
.u-section-1 .u-container-layout-3 {
padding: 30px;
}
@media (max-width: 1199px) {
.u-section-1 .u-sheet-1 {
min-height: 430px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 330px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 165px;
}
.u-section-1 .u-layout-cell-3 {
min-height: 165px;
}
}
@media (max-width: 991px) {
.u-section-1 .u-sheet-1 {
min-height: 353px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 253px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 126px;
}
.u-section-1 .u-layout-cell-3 {
min-height: 126px;
}
}
@media (max-width: 767px) {
.u-section-1 .u-sheet-1 {
min-height: 858px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 380px;
}
.u-section-1 .u-container-layout-1 {
padding-left: 10px;
padding-right: 10px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 189px;
}
.u-section-1 .u-container-layout-2 {
padding-left: 10px;
padding-right: 10px;
}
.u-section-1 .u-layout-cell-3 {
min-height: 189px;
}
.u-section-1 .u-container-layout-3 {
padding-left: 10px;
padding-right: 10px;
}
}
@media (max-width: 575px) {
.u-section-1 .u-sheet-1 {
min-height: 577px;
}
.u-section-1 .u-layout-cell-1 {
min-height: 239px;
}
.u-section-1 .u-layout-cell-2 {
min-height: 119px;
}
.u-section-1 .u-layout-cell-3 {
min-height: 119px;
}
}

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { Tab2Page } from './tab2.page';
describe('Tab2Page', () => {
let component: Tab2Page;
let fixture: ComponentFixture<Tab2Page>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [Tab2Page],
imports: [IonicModule.forRoot(), ExploreContainerComponentModule]
}).compileComponents();
fixture = TestBed.createComponent(Tab2Page);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

12
src/app/tab2/tab2.page.ts Normal file
View File

@@ -0,0 +1,12 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-tab2',
templateUrl: 'tab2.page.html',
styleUrls: ['tab2.page.scss']
})
export class Tab2Page {
constructor() {}
}

View File

@@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { Tab3Page } from './tab3.page';
const routes: Routes = [
{
path: '',
component: Tab3Page,
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class Tab3PageRoutingModule {}

View File

@@ -0,0 +1,22 @@
import { IonicModule } from '@ionic/angular';
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Tab3Page } from './tab3.page';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { Tab3PageRoutingModule } from './tab3-routing.module';
@NgModule({
imports: [
IonicModule,
CommonModule,
FormsModule,
ExploreContainerComponentModule,
RouterModule.forChild([{ path: '', component: Tab3Page }]),
Tab3PageRoutingModule,
],
declarations: [Tab3Page]
})
export class Tab3PageModule {}

View File

@@ -0,0 +1,17 @@
<ion-header [translucent]="true">
<ion-toolbar>
<ion-title>
Tab 3
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">Tab 3</ion-title>
</ion-toolbar>
</ion-header>
<app-explore-container name="Tab 3 page"></app-explore-container>
</ion-content>

View File

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
import { Tab3Page } from './tab3.page';
describe('Tab3Page', () => {
let component: Tab3Page;
let fixture: ComponentFixture<Tab3Page>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [Tab3Page],
imports: [IonicModule.forRoot(), ExploreContainerComponentModule]
}).compileComponents();
fixture = TestBed.createComponent(Tab3Page);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});

12
src/app/tab3/tab3.page.ts Normal file
View File

@@ -0,0 +1,12 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-tab3',
templateUrl: 'tab3.page.html',
styleUrls: ['tab3.page.scss']
})
export class Tab3Page {
constructor() {}
}

View File

@@ -0,0 +1,40 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TabsPage } from './tabs.page';
const routes: Routes = [
{
path: 'tabs',
component: TabsPage,
children: [
{
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: '/tabs/tab1',
pathMatch: 'full'
}
]
},
{
path: '',
redirectTo: '/tabs/tab1',
pathMatch: 'full'
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class TabsPageRoutingModule {}

View File

@@ -0,0 +1,19 @@
import { IonicModule } from '@ionic/angular';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { TabsPageRoutingModule } from './tabs-routing.module';
import { TabsPage } from './tabs.page';
@NgModule({
imports: [
IonicModule,
CommonModule,
FormsModule,
TabsPageRoutingModule
],
declarations: [TabsPage]
})
export class TabsPageModule {}

View File

@@ -0,0 +1,20 @@
<ion-tabs>
<ion-tab-bar slot="bottom">
<ion-tab-button tab="tab1">
<ion-icon name="triangle"></ion-icon>
<ion-label>Tab 1</ion-label>
</ion-tab-button>
<ion-tab-button tab="tab2">
<ion-icon name="ellipse"></ion-icon>
<ion-label>Tab 2</ion-label>
</ion-tab-button>
<ion-tab-button tab="tab3">
<ion-icon name="square"></ion-icon>
<ion-label>Tab 3</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,26 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TabsPage } from './tabs.page';
describe('TabsPage', () => {
let component: TabsPage;
let fixture: ComponentFixture<TabsPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [TabsPage],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TabsPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

12
src/app/tabs/tabs.page.ts Normal file
View File

@@ -0,0 +1,12 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-tabs',
templateUrl: 'tabs.page.html',
styleUrls: ['tabs.page.scss']
})
export class TabsPage {
constructor() {}
}