permite editar eventos y se reflejan los cambios. Arreglado el bug de la hora

This commit is contained in:
onsaliyo 2021-04-04 19:10:56 +02:00
parent b163dee4b7
commit 427398154b
1 changed files with 6 additions and 17 deletions

View File

@ -37,20 +37,7 @@ export class PromptEventoPage implements OnInit{
onSubmit(){
this.submitted = true;
if (this.eventoForm.valid){
let evento: Eventoi = {
id: null,
discotecaID: this.tab1Service.discotecaI.discotecaID,
nombre: '',
localizacion: this.tab1Service.discotecaI.localizacion,
fecha: null,
hora: null,
descripcion: '',
precio1: null,
precio2: null
};
this.asignarEvento(evento);
this.asignarEvento(this.tab1Service.eventos[this.tab1Service.eventoIndex]);
}
}
asignarEvento(evento: Eventoi){
@ -59,14 +46,16 @@ export class PromptEventoPage implements OnInit{
var fecha = this.eventoForm.get('fecha').value;
fecha = fecha.split("T")[0];
evento.fecha = fecha;
let hora = this.eventoForm.get('hora').value;
hora = hora.split("T")[1];
var hora = this.eventoForm.get('hora').value;
if (!this.tab1Service.editarEvento){
hora = hora.split("T")[1];}
hora = hora.split(":")[0]+(":")+hora.split(":")[1];
console.log(hora);
evento.hora = hora;
evento.precio1 = this.eventoForm.get('precio1').value;
evento.precio2 = this.eventoForm.get('precio2').value;
if (!this.tab1Service.eventos){
this.tab1Service.initEventos();}
this.tab1Service.eventos=[];}
if(!this.tab1Service.eventoForms){
this.tab1Service.initEventoForms();}
this.tab1Service.postEvento(evento);