mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
implementation of add + view event modals
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user