FrontEndDev #1

Merged
onsaliyo merged 3 commits from FrontEndDev into master 2021-02-19 13:17:31 +01:00
26 changed files with 358 additions and 51 deletions
Showing only changes of commit 3c9a0c416f - Show all commits

View File

@ -1,16 +1,33 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { LoginPage } from './login/login.page';
const routes: Routes = [
{
path: '',
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: 'tabs',
pathMatch: 'full'
},
];

View File

@ -5,16 +5,17 @@ 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';
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'
import { GaleriamodalPageModule } from './galeriamodal/galeriamodal.module';
import { LoginPage } from './login/login.page';
@NgModule({
declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage],
declarations: [AppComponent, PerfilDiscotecaPage, PromptEventoPage, LoginPage],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, ReactiveFormsModule, GaleriamodalPageModule],
providers: [
StatusBar,
SplashScreen,

View File

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

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 { GaleriamodalPageRoutingModule } from './galeriamodal-routing.module';
import { GaleriamodalPage } from './galeriamodal.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
GaleriamodalPageRoutingModule
],
declarations: [GaleriamodalPage]
})
export class GaleriamodalPageModule {}

View File

@ -0,0 +1,15 @@
<ion-content fullscreen>
<ion-button (click)="close()">
<ion-icon name="close" slot="start"></ion-icon>
</ion-button>
<ion-slide>
<img src="{{foto}}">
</ion-slide>
<ion-button (click)="borrar()">
<ion-icon name="trash-outline"></ion-icon>
</ion-button>
</ion-content>

View File

@ -0,0 +1,4 @@
ion-content {
background: rgba(0, 0, 0, 0.589)
}

View File

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

View File

@ -0,0 +1,36 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { ModalController, NavParams } from '@ionic/angular';
import { Tab1Service } from '../tab1/tab1.service';
@Component({
selector: 'app-galeriamodal',
templateUrl: './galeriamodal.page.html',
styleUrls: ['./galeriamodal.page.scss'],
})
export class GaleriamodalPage implements OnInit {
foto: string;
sliderOpts = {
}
constructor(private navParams: NavParams, private modalController: ModalController, private tab1Service: Tab1Service,
private router: Router) { }
ngOnInit() {
this.foto = this.navParams.get('foto');
}
borrar(){
let index = this.tab1Service.galeria.indexOf('foto');
this.tab1Service.galeria.slice[index];
this.close();
}
close(){
this.modalController.dismiss();
}
}

View File

@ -0,0 +1,27 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginPage } from './login.page';
const routes: Routes = [
{
path: '',
component: LoginPage,
},
{
path: 'tabs',
loadChildren: () => import('../tabs/tabs.module').then(m => m.TabsPageModule)
},
{
path: '',
redirectTo: 'login'
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class LoginPageRoutingModule {}

View File

@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { LoginPageRoutingModule } from './login-routing.module';
import { LoginPage } from './login.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
LoginPageRoutingModule
],
declarations: [LoginPage]
})
export class LoginPageModule {}

View File

@ -0,0 +1,11 @@
<ion-header>
<ion-toolbar>
<ion-title>Login</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-button (click)="login()">
Login
</ion-button>
</ion-content>

View File

View File

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

View File

@ -0,0 +1,20 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: 'app-login',
templateUrl: './login.page.html',
styleUrls: ['./login.page.scss'],
})
export class LoginPage implements OnInit {
constructor(private router: Router) { }
ngOnInit() {
}
login(){
this.router.navigate(['/tabs']);
}
}

View File

@ -13,8 +13,9 @@
</ion-toolbar>
</ion-header>
<ion-grid>
<div class='fotoPerfil'>
<ion-grid>
<ion-row>
<ion-col>
<ion-img class="fotoPerfil" width="100%" height="100%" [src]='fotoSrc' alt='barraquinha'></ion-img>
@ -55,17 +56,20 @@
<div [contentEditable]='editEnabled'>{{localizacion}}</div>
</div>
</ion-col>
<ion-col>
<div class="galeria">
Galería de Fotos
<input type="file" (change)="loadImageFromDevice($event)" id="file-input-galeria" accept="image/png, image/jpeg">
<ion-slides (ionDrag)="onSlideChanged()">
<ion-slides (ionDrag)="onSlideChanged()" [options]="sliderOpts">
<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>
<div class="fotoGaleria"><img src="{{foto}}" tappable (click)="openPreview(foto)">
<div class="botonesHidden" id="botonesHidden3">
<ion-button (click)="borrarDeGaleria()">
<ion-icon name="trash-outline"></ion-icon>
</ion-button>
</div>
</div>
</ion-slide>
</ion-slides>
</div>
@ -91,7 +95,8 @@
<ion-icon name="calendar-outline"></ion-icon>
{{evento.fecha}} ·
<ion-icon name="cash-outline"></ion-icon>
{{evento.precio1}}, {{evento.precio2}}
{{evento.precio1}},{{evento.precio2}}
<ion-button (click)="editarEvento(evento);$event.stopPropagation();"><ion-icon name="pencil-outline"></ion-icon></ion-button>
</div>
<div class="eventoDesc">
{{evento.descripcion}}
@ -101,13 +106,13 @@
</ion-list>
</div>
</ion-row>
</ion-grid>
</div>
</ion-grid>
</ion-content>

View File

@ -1,13 +1,13 @@
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 { Tab1Service } from '../tab1/tab1.service';
import { IonSlides, ModalController} from '@ionic/angular';
import { AlertController } from '@ionic/angular';
import { ViewChild } from '@angular/core';
import { Evento } from '../evento';
import { Router } from '@angular/router';
import { THIS_EXPR } from '@angular/compiler/src/output/output_ast';
import { GaleriamodalPage } from '../galeriamodal/galeriamodal.page';
import { stringify } from '@angular/compiler/src/util';
@Component({
selector: 'app-perfil-discoteca',
@ -29,8 +29,13 @@ export class PerfilDiscotecaPage implements OnInit {
currentIndex: number;
eventos: Evento[];
alertCtrl: AlertController;
sliderOpts = {
slidesPerView: 1.5,
centeredSlides: true,
spaceBetween: 20,
};
constructor(private tab1Service: Tab1Service, private router: Router) {
constructor(private tab1Service: Tab1Service, private router: Router, private modalController: ModalController) {
}
@ -45,9 +50,9 @@ export class PerfilDiscotecaPage implements OnInit {
this.getEventos();
this.editDisabled="true";
this.editEnabled="false";
this.fotoSrc = '../assets/barraca.jpg';
this.fotoSrc = '../assets/img/barraca.jpg';
this.fotoLoaded = this.fotoSrc;
this.galeriaFotos = [];
this.galeriaFotos = this.tab1Service.galeria;
}
@ -73,8 +78,9 @@ export class PerfilDiscotecaPage implements OnInit {
}
addGaleria(){
this.galeriaFotos.push(this.someURL);
this.slides.update();
this.tab1Service.galeria.push(this.someURL);
this.galeriaFotos = this.tab1Service.galeria;
this.slides.update();
}
@ -158,14 +164,30 @@ export class PerfilDiscotecaPage implements OnInit {
this.slides.update();
}
addEvento() {
this.router.navigate(['/tabs/tab1/prompt-evento']);
addEvento() {
this.tab1Service.editarEvento=false;
this.router.navigate(['/tabs/tab1/prompt-evento']);
}
mostrarEvento(evento: Evento){
this.tab1Service.eventoIndex = this.eventos.indexOf(evento);
this.router.navigate(['/tabs/tab1/view-evento']);
mostrarEvento(evento: Evento){
this.tab1Service.eventoIndex = this.eventos.indexOf(evento);
this.router.navigate(['/tabs/tab1/view-evento']);
}
editarEvento(evento: Evento){
this.tab1Service.eventoIndex = this.eventos.indexOf(evento);
this.tab1Service.editarEvento = true;
this.router.navigate(['/tabs/tab1/prompt-evento']);
}
openPreview(foto: string){
this.modalController.create({
component: GaleriamodalPage,
componentProps: {
foto: foto
}
}).then(modal=>modal.present());
}
}

View File

@ -3,14 +3,13 @@ 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{
export class PromptEventoPage implements OnInit{
eventoForm = new FormGroup({
nombre: new FormControl(''),
fecha: new FormControl(''),
@ -23,9 +22,14 @@ export class PromptEventoPage{
eventos: Evento[];
constructor(private tab1Service: Tab1Service, private router: Router) {
this.eventos = [];
}
ngOnInit(){
if (this.tab1Service.editarEvento==true){
this.eventoForm = this.tab1Service.eventoForms[this.tab1Service.eventoIndex];
}
}
onSubmit(){
let evento = new Evento();
this.asignarEvento(evento);
@ -41,7 +45,16 @@ export class PromptEventoPage{
//evento.setHora(evento.getFecha()); transformar en dia y hora
if (!this.tab1Service.eventos){
this.tab1Service.initEventos();}
this.tab1Service.eventos.push(evento);
if(!this.tab1Service.eventoForms){
this.tab1Service.initEventoForms();}
if(this.tab1Service.editarEvento==true){
this.tab1Service.eventos[this.tab1Service.eventoIndex] = evento;
this.tab1Service.eventoForms[this.tab1Service.eventoIndex] = this.eventoForm;
}
else{
this.tab1Service.eventos.push(evento);
this.tab1Service.eventoForms.push(this.eventoForm);}
}

View File

@ -6,14 +6,10 @@ import { PromptEventoPage } from '../prompt-evento/prompt-evento.page'
import { ViewEventoPage } from '../view-evento/view-evento.page'
const routes: Routes = [
{
path: '',
redirectTo: 'perfil-discoteca',
pathMatch: 'full',
},
{
path: 'perfil-discoteca',
path: '',
component: PerfilDiscotecaPage
},

View File

@ -2,8 +2,8 @@ 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';
import { FormControl, FormGroup } from '@angular/forms';
import { NumericValueAccessor } from '@ionic/angular';
@ -13,9 +13,11 @@ import { NumericValueAccessor } from '@ionic/angular';
export class Tab1Service implements OnInit{
discoteca: Discoteca;
galeria: Galeria;
galeria: string[];
eventos: Evento[];
eventoForms: FormGroup[];
eventoIndex: number;
editarEvento: boolean;
constructor() {
@ -30,9 +32,9 @@ export class Tab1Service implements OnInit{
this.discoteca.setNombre('Barraca');
this.discoteca.setTelefono(666666666);
this.discoteca.setLocalizacion('Calle del Barquillo');
this.galeria = new Galeria();
this.galeria = [];
this.initEventos();
this.galeria.setDiscoteca(this.discoteca.getNombre());
this.editarEvento = false;
}
getNombre(): string{
@ -58,6 +60,10 @@ export class Tab1Service implements OnInit{
this.eventos = [];
}
initEventoForms(): void{
this.eventoForms = [];
}
getEventobyIndex(eventoIndex: number){
return this.eventos[eventoIndex];
}

View File

@ -4,12 +4,12 @@ import { TabsPage } from './tabs.page';
const routes: Routes = [
{
path: 'tabs',
path: '',
component: TabsPage,
children: [
{
path: 'tab1',
loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule)
loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule),
},
{
path: 'tab2',
@ -21,16 +21,14 @@ const routes: Routes = [
},
{
path: '',
redirectTo: '/tabs/tab1',
redirectTo: 'tab1',
pathMatch: 'full'
},
]
},
{
path: '',
redirectTo: '/tabs/tab1',
redirectTo: 'tabs',
pathMatch: 'full'
}
];

View File

@ -5,5 +5,22 @@
</ion-header>
<ion-content>
<label>{{evento.nombre}}</label>
<ion-grid>
<div class="evento">
<ion-row>
<div class="eventoHeader">
{{evento.nombre}} ·
<ion-icon name="calendar-outline"></ion-icon>
{{evento.fecha}} ·
<ion-icon name="cash-outline"></ion-icon>
{{evento.precio1}},{{evento.precio2}}
</div>
</ion-row>
<ion-row>
<div class="eventoDesc">
{{evento.descripcion}}
</div>
</ion-row>
</div>
</ion-grid>
</ion-content>

View File

@ -0,0 +1,17 @@
.eventoHeader{
font-weight: bold;
}
.eventoDesc{
color: white;
margin-top: 20px;
}
.evento{
display: block;
max-width: 800px;
max-height: auto;
margin: auto;
text-align: justify;
}

BIN
src/assets/img/1.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
src/assets/img/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 KiB

BIN
src/assets/img/3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

View File

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB