criar evento com recorrencia

This commit is contained in:
tiago.kayaya
2021-07-12 14:32:43 +01:00
parent d68a89e7c9
commit aa3a2e0420
4 changed files with 185 additions and 131 deletions
@@ -63,12 +63,12 @@ export class NewEventPage implements OnInit {
constructor(
private modalController: ModalController,
private navParams: NavParams,
private eventService: EventsService,
private eventService: EventsService,
private attachmentsService: AttachmentsService,
private animationController: AnimationController,
private toastService: ToastService,
userService: AuthService,
) {
) {
this.loggeduser = userService.ValidatedUser;
this.postEvent = new Event();
this.postEvent.EventRecurrence = {Type:'-1'};
@@ -87,16 +87,16 @@ export class NewEventPage implements OnInit {
ngOnInit() {
this.selectedRecurringType = "-1";
console.log(this.postEvent);
this.getRecurrenceTypes();
/* 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) ;
selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ;
if(this.selectedSegment != "Combinada"){
this.postEvent ={
EventId: '',
@@ -148,9 +148,12 @@ export class NewEventPage implements OnInit {
this.modalController.dismiss();
}
};
console.log(this.postEvent);
}
close(){
this.modalController.dismiss();
}
@@ -173,7 +176,7 @@ export class NewEventPage implements OnInit {
this.selectedRecurringType = "-1";
}
}
runValidation() {
this.validateFrom = true
@@ -216,22 +219,22 @@ export class NewEventPage implements OnInit {
})
}
async save() {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
if(this.documents.length >= 0) {
this.postEvent.HasAttachments = true;
}
if(this.selectedRecurringType != '-1'){
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
}
let eventId: any;
try {
const loader = this.toastService.loading()
@@ -240,15 +243,15 @@ export class NewEventPage implements OnInit {
console.log(this.loggeduser.Profile);
console.log(this.postEvent);
eventId = await this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).toPromise();
console.log(eventId);
loader.remove()
}
else if(this.loggeduser.Profile == 'PR'){
console.log(this.loggeduser.Profile);
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
loader.remove()
}
@@ -272,14 +275,14 @@ export class NewEventPage implements OnInit {
} catch(error) {
console.log('document not save')
}
});
this.toastService.successMessage()
this.modalController.dismiss(this.postEvent);
} catch (error) {
this.toastService.badRequest()
}
@@ -287,7 +290,7 @@ export class NewEventPage implements OnInit {
}
async openAttendees() {
const modal = await this.modalController.create({
component: AttendeesPageModal,
componentProps: {
@@ -302,7 +305,7 @@ export class NewEventPage implements OnInit {
await modal.present();
modal.onDidDismiss().then((data) => {
if(data){
data = data['data'];
@@ -319,7 +322,7 @@ export class NewEventPage implements OnInit {
this.taskParticipants = data;
this.postEvent.Attendees = data;
}
setIntervenientCC(data){
this.taskParticipantsCc = data;
}
@@ -359,4 +362,4 @@ export class NewEventPage implements OnInit {
this.documents = this.documents.filter( (e, i) => index != i);
}
}
}