Fix create event

This commit is contained in:
Peter Maquiran
2021-09-03 12:19:21 +01:00
parent 5d4a238a57
commit 745b634123
30 changed files with 125 additions and 724 deletions
@@ -12,6 +12,7 @@ import { Attachment } from 'src/app/models/attachment.model';
import { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import * as moment from 'moment';
import { ParticipantsPipe } from 'src/app/pipes/participants.pipe';
@Component({
selector: 'app-edit-event',
@@ -34,8 +35,6 @@ export class EditEventPage implements OnInit {
recurringTypes = [];
selectedRecurringType: any;
public dateControlOccurrence = new FormControl(moment("DD MM YYYY hh"));
public date: any;
public disabled = false;
public showSpinners = true;
@@ -86,19 +85,19 @@ export class EditEventPage implements OnInit {
public stepMinutes = [1, 5, 10, 15, 20, 25];
public stepSeconds = [1, 5, 10, 15, 20, 25];
private participantsPipe = new ParticipantsPipe()
constructor(
private modalController: ModalController,
private eventsService: EventsService,
public alertController: AlertController,
private attachmentsService: AttachmentsService,
private toastService: ToastService ) {
private toastService: ToastService,
) {
}
ngOnInit() {
this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence));
this.postEvent.EventRecurrence.Type = '-1'
if(!this.restoreTemporaryData()) {
// clear
@@ -111,16 +110,9 @@ export class EditEventPage implements OnInit {
}
}
// attendees list
if(this.postEvent.Attendees != null) {
this.postEvent.Attendees.forEach(e =>{
if(e.IsRequired) {
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
}
})
}
const result = this.participantsPipe.transform(this.postEvent.Attendees)
this.taskParticipants = result.taskParticipants
this.taskParticipantsCc = result.taskParticipantsCc
this.taskParticipants = removeDuplicate(this.taskParticipants);
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
@@ -142,6 +134,7 @@ export class EditEventPage implements OnInit {
this.getRecurrenceTypes();
this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString();
setTimeout(() => {
this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString();
console.log( this.postEvent.EventRecurrence.Type);
@@ -250,9 +243,10 @@ export class EditEventPage implements OnInit {
if(!this.postEvent.EventRecurrence.hasOwnProperty('Type')) {
this.postEvent.EventRecurrence.Type = '-1'
} else {
}
//
if(this.postEvent.EventRecurrence.Type == undefined) {
this.postEvent.EventRecurrence.Type = '-1'
}