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
+22 -7
View File
@@ -60,7 +60,9 @@ export class AgendaPage implements OnInit {
private eventService: EventsService,
private router: Router,
private alertCrontroller: AlertService
) {}
) {
this.showLoader = false;
}
ngOnInit() {
this.profile = "mdgpr";
@@ -97,7 +99,7 @@ export class AgendaPage implements OnInit {
}
//Show information of the event
async onEventSelected(ev: { event: Event}){
this.viewEventDetail();
this.viewEventDetail(ev.event.EventId);
/* this.router.navigate(["/home/agenda", ev.event.EventId, 'agenda']); */
}
@@ -307,18 +309,31 @@ export class AgendaPage implements OnInit {
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
modal.onDidDismiss().then((data) => {
let postEvent: Event = data['data'];
if (postEvent.Subject != null)
{
this.eventSource.push({
title: postEvent.Subject,
startTime: new Date(postEvent.StartDate),
endTime: new Date(postEvent.EndDate),
allDay: false,
event: postEvent
});
this.myCal.update();
this.myCal.loadEvents();
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
});
}
async viewEventDetail() {
async viewEventDetail(eventId:any) {
console.log(this.profile);
const modal = await this.modalCtrl.create({
component: ViewEventPage,
componentProps:{
segment: this.segment,
profile: this.profile,
/* eventSelectedDate: this.eventSelectedDate, */
eventId: eventId,
},
cssClass: 'modal',
backdropDismiss: false
@@ -55,7 +55,10 @@
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div>
<div class="ion-input-class">
<ion-select placeholder="Selecione tipo" [(ngModel)]="postEvent.EventType" interface="action-sheet" Cancel-text="Cancelar" required>
<ion-select placeholder="Selecione tipo"
[(ngModel)]="postEvent.EventType"
interface="action-sheet"
Cancel-text="Cancelar" required>
<ion-select-option value="Reunião">Reunião</ion-select-option>
<ion-select-option value="Viagem">Viagem</ion-select-option>
<ion-select-option value="Conferência">Conferência</ion-select-option>
@@ -38,14 +38,12 @@ export class NewEventPage implements OnInit {
ngOnInit() {
console.log(this.profile);
let selectedStartdDate = this.selectedDate;
let selectedEndDate = new Date(this.selectedDate);
/* Set + 30minutes to seleted datetime */
/* selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) */
/* this.minDate = this.selectedDate.toString(); */
selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ;
this.minDate = this.selectedDate.toString();
if(this.selectedSegment != "Combinada"){
this.postEvent ={
@@ -4,7 +4,7 @@
<div class="title-content">
<app-btn-modal-dismiss></app-btn-modal-dismiss>
<div class="middle">
<ion-label class="title">Ver Evento</ion-label>
<ion-label class="title">{{loadedEvent.Subject}}</ion-label>
</div>
<div class="header-icon-right">
<ion-icon slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
@@ -19,18 +19,18 @@
<div class="upper-content">
<div class="content-location">
<div class="location-detail">
<ion-label >Texto</ion-label>
<ion-label >{{loadedEvent.Location}}</ion-label>
</div>
<div class="button-calendar-type">
<ion-button class="button-calendar-type" slot="end">Texto</ion-button>
<ion-button class="button-calendar-type" slot="end">{{loadedEvent.CalendarName}}</ion-button>
</div>
</div>
<div class="content-details">
<ion-label>
<p>Texto</p>
<p>das Texto às Texto</p>
<p >(Não se repete)</p>
<p >Repete</p>
<p>{{customDate}}</p>
<p>das {{loadedEvent.StartDate | date: 'hh:mm'}} às {{loadedEvent.EndDate | date: 'hh:mm'}}</p>
<p *ngIf="!loadedEvent.IsRecurring">(Não se repete)</p>
<p *ngIf="loadedEvent.IsRecurring">Repete</p>
</ion-label>
</div>
</div>
@@ -38,13 +38,15 @@
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<h3>Intervenientes</h3>
<p>Texto</p>
<div *ngFor="let attendee of loadedEvent.Attendees">
<p>{{attendee.Name}}</p>
</div>
</ion-label>
</ion-item>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<h3>Detalhes</h3>
<p>Texto</p>
<p>{{loadedEvent.Body.Text}}</p>
</ion-label>
</ion-item>
</div>
@@ -53,9 +55,9 @@
<ion-list>
<h3>Documentos Anexados</h3>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<p class="attach-title-item">Receita por Natureza</p>
<p><span class="span-left">Texto</span><span class="span-right"><!-- {{ task.CreateDate | date: 'dd-MM-yy' }} --></span></p>
<ion-label *ngFor="let attach of loadedAttachments">
<p class="attach-title-item">{{attach.SourceName}}</p>
<p><span class="span-left">{{attach.Stakeholders}}</span><span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yy' }}</span></p>
</ion-label>
</ion-item>
</ion-list>
@@ -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);
});
}
}
-1
View File
@@ -106,7 +106,6 @@ export class EventsPage implements OnInit {
this.storageService.get(AuthConnstants.USER).then(res=>{
console.log(res);
});
this.showGreeting();