implementation of add + view event modals

This commit is contained in:
tiago.kayaya
2021-01-29 15:55:49 +01:00
parent e1d06247cf
commit fefb6dcc37
6 changed files with 102 additions and 26 deletions
@@ -1,4 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
import { AuthConnstants } from 'src/app/config/auth-constants';
import { Attachment } from 'src/app/models/attachment.model';
import { EventBody } from 'src/app/models/eventbody.model';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { Event } from '../../../models/event.model';
@Component({
selector: 'app-view-event',
@@ -7,9 +14,61 @@ import { Component, OnInit } from '@angular/core';
})
export class ViewEventPage implements OnInit {
constructor() { }
loadedEvent: Event;
eventBody: EventBody;
loadedAttachments:any;
loadedEventAttachments: Attachment[];
pageId: string;
showLoader: boolean;
minDate: Date;
profile:string;
eventId:string;
customDate:any;
today:any;
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
constructor(
private modalController: ModalController,
private navParams: NavParams,
private eventsService: EventsService,
private attachmentsService: AttachmentsService,
) {
this.loadedEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""};
this.loadedEvent.Body = this.eventBody;
this.eventId = this.navParams.get('eventId');
}
ngOnInit() {
/* console.log(this.eventId); */
this.loadEvent();
this.getAttachments();
}
loadEvent(){
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
console.log(res);
this.today = new Date(res.StartDate);
console.log(new Date(this.today));
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
});
}
getAttachments(){
this.attachmentsService.getAttachmentsById(this.eventId).subscribe(res=>{
this.loadedAttachments = res;
console.log(res);
});
}
}