This commit is contained in:
tiago.kayaya
2021-07-15 16:09:30 +01:00
parent dab38e06bf
commit bd63ca691d
3 changed files with 19 additions and 25 deletions
@@ -200,9 +200,11 @@ export class EditEventPage implements OnInit {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
}
console.log(body);
}
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (error) {}
}
this.toastService.successMessage();
@@ -173,7 +173,7 @@
<mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required>
<mat-select
placeholder="Selecione repetição*"
[(ngModel)]="selectedRecurringType"
[(ngModel)]="postEvent.EventRecurrence.Type"
(ngModelChange)="onSelectedRecurringChanged($event)">
<mat-option
*ngFor="let recurring of recurringTypes"
@@ -32,7 +32,6 @@ export class EditEventPage implements OnInit {
// minDate: string;
loadedEventAttachments: Attachment[]=[];
recurringTypes: any;
selectedRecurringType: any;
public dateControlOccurrence = new FormControl(moment("DD MM YYYY hh"));
public date: any;
@@ -106,7 +105,6 @@ export class EditEventPage implements OnInit {
}
ngOnInit() {
console.log(this.postEvent);
this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence));
if(!this.restoreTemporaryData()) {
@@ -151,11 +149,11 @@ export class EditEventPage implements OnInit {
this.restoreDatepickerData();
this.getRecurrenceTypes();
this.selectedRecurringType = this.postEvent.EventRecurrence.Type.toString();
this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString();
setTimeout(() => {
this.selectedRecurringType = this.postEvent.EventRecurrence.Type.toString();
console.log(this.selectedRecurringType);
this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString();
console.log( this.postEvent.EventRecurrence.Type);
}, 1000);
@@ -177,17 +175,6 @@ export class EditEventPage implements OnInit {
});
}
onSelectedRecurringChanged(ev:any){
console.log(ev);
if(ev.length > 1){
console.log(ev.filter(data => data != '-1'));
this.selectedRecurringType = ev.filter(data => data != '-1');
}
if(ev.length == 0){
this.selectedRecurringType = "-1";
}
}
runValidation() {
this.validateFrom = true
@@ -248,6 +235,17 @@ export class EditEventPage implements OnInit {
}
}
onSelectedRecurringChanged(ev:any){
console.log(ev);
if(ev.length > 1){
console.log(ev.filter(data => data != '-1'));
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
}
if(ev.length == 0){
this.postEvent.EventRecurrence.Type = "-1";
}
}
async save() {
@@ -257,9 +255,6 @@ export class EditEventPage implements OnInit {
if(this.Form.invalid) {
return false
}
if(this.selectedRecurringType != '-1'){
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
}
this.getDatepickerData()
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
@@ -273,12 +268,9 @@ export class EditEventPage implements OnInit {
"CalendarDestinationName": this.postEvent.CalendarName,
}
console.log(body);
try {
await this.eventsService.changeAgenda(body).toPromise();
} catch (e) {}
}
this.showLoader = false;
this.toastService.successMessage()