mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
change events agenda
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AlertController, AnimationController, ModalController, NavParams } from '@ionic/angular';
|
||||
import { Attachment } from 'src/app/models/attachment.model';
|
||||
import { EventBody } from 'src/app/models/eventbody.model';
|
||||
@@ -28,6 +29,8 @@ export class EditEventPage implements OnInit {
|
||||
selectedSegment: string;
|
||||
selectedDate: Date;
|
||||
minDate: string;
|
||||
initCalendarName: string;
|
||||
caller:string;
|
||||
|
||||
|
||||
loadedEventAttachments: Attachment[];
|
||||
@@ -46,9 +49,12 @@ export class EditEventPage implements OnInit {
|
||||
private attachmentsService: AttachmentsService,
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
private router: Router,
|
||||
) {
|
||||
this.isEventEdited = false;
|
||||
this.postEvent = this.navParams.get('event');
|
||||
this.caller = this.navParams.get('caller');
|
||||
this.initCalendarName = this.postEvent.CalendarName;
|
||||
|
||||
if(this.postEvent){
|
||||
if( this.postEvent.Body){
|
||||
@@ -78,13 +84,13 @@ export class EditEventPage implements OnInit {
|
||||
else {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
this.profile = this.navParams.get('profile');
|
||||
|
||||
|
||||
this.getAttachments(this.postEvent.EventId);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
console.log(this.caller);
|
||||
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
@@ -102,25 +108,31 @@ export class EditEventPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
goBack() {
|
||||
console.log(this.caller);
|
||||
this.router.navigate(['/home',this.caller]);
|
||||
}
|
||||
|
||||
save() {
|
||||
|
||||
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc)
|
||||
|
||||
try{
|
||||
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
|
||||
/* const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Evento actualizado',
|
||||
buttons: ['OK']
|
||||
});
|
||||
await alert.present(); */
|
||||
if(this.initCalendarName != this.postEvent.CalendarName){
|
||||
let body = {
|
||||
"EventId": this.postEvent.EventId,
|
||||
"CalendarDestinationName": this.postEvent.CalendarName,
|
||||
}
|
||||
console.log(body);
|
||||
await this.eventsService.changeAgenda(body).toPromise();
|
||||
}
|
||||
this.toastService.successMessage();
|
||||
|
||||
this.toastService.successMessage()
|
||||
}, error => {
|
||||
this.toastService.badRequest()
|
||||
});
|
||||
|
||||
this.isEventEdited = true;
|
||||
this.goBack();
|
||||
this.modalController.dismiss(this.isEventEdited);
|
||||
|
||||
} catch (error) {
|
||||
@@ -179,7 +191,7 @@ export class EditEventPage implements OnInit {
|
||||
}
|
||||
|
||||
addParticipantsCC(){
|
||||
this.adding = 'CC'
|
||||
this.adding = 'CC';
|
||||
this.openAttendees();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user