change text, fixe create and edit event

This commit is contained in:
Peter Maquiran
2023-09-20 20:25:48 +01:00
parent be3f1e8f15
commit c674ec0bca
11 changed files with 149 additions and 128 deletions
@@ -87,7 +87,7 @@ export class EditEventPage implements OnInit {
sesseionStora = SessionStore
environment = environment
constructor(
private modalController: ModalController,
private navParams: NavParams,
@@ -111,7 +111,7 @@ export class EditEventPage implements OnInit {
this.initCalendarName = this.postEvent.CalendarName;
for(const index in this.postEvent.Attendees) {
const user = this.postEvent.Attendees[index]
@@ -119,7 +119,7 @@ export class EditEventPage implements OnInit {
if(userData) {
this.postEvent.Attendees[index].UserType = userData.UserType
}
}
@@ -199,13 +199,13 @@ export class EditEventPage implements OnInit {
}
goBack() {
this.router.navigate(['/home',this.caller]);
}
getRecurrenceTypes() {
this.eventsService.getRecurrenceTypes().subscribe(res=>{
this.recurringTypes = res;
});
}
@@ -216,7 +216,7 @@ export class EditEventPage implements OnInit {
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
} else if (minutes > 30) {
@@ -227,7 +227,7 @@ export class EditEventPage implements OnInit {
date.setMinutes(15)
}
}
}
return date
}
@@ -236,15 +236,15 @@ export class EditEventPage implements OnInit {
const _date = new Date(date);
const minutes = _date .getMinutes();
_date .setMinutes(minutes + 15)
return _date
return _date
}
onSelectedRecurringChanged(ev?:any) {
this.calculetedLastOccurrence(ev);
if(ev.length > 1){
this.selectedRecurringType = ev.filter(data => data != '-1');
}
if(ev.length == 0){
@@ -254,7 +254,7 @@ export class EditEventPage implements OnInit {
calculetedLastOccurrence(type:number){
// console.log(type);
var valor;
var valor;
var opcao: boolean;
if (type == 0) {
valor = 7;
@@ -280,15 +280,15 @@ export class EditEventPage implements OnInit {
this.postEvent.EventRecurrence.LastOccurrence = time;
} else {
time = new Date(
time.getFullYear() + valor,
time.getMonth(),
time.getDate(),
time.getHours(),
time.getFullYear() + valor,
time.getMonth(),
time.getDate(),
time.getHours(),
time.getMinutes()
);
this.postEvent.EventRecurrence.LastOccurrence = time;
}
}
@@ -332,7 +332,7 @@ export class EditEventPage implements OnInit {
openInicio() {
let input: any = document.querySelector('#new-inicio')
if(input) {
input.click()
}
}
@@ -366,7 +366,7 @@ export class EditEventPage implements OnInit {
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {
if(window['reloadCalendar']) {
@@ -374,7 +374,7 @@ export class EditEventPage implements OnInit {
}
if(this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
@@ -384,11 +384,11 @@ export class EditEventPage implements OnInit {
} catch (error) {}
finally {
}
}
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
}, error => {
this.httpErrorHandle.httpStatusHandle(error)
});
@@ -398,9 +398,9 @@ export class EditEventPage implements OnInit {
if(window['reloadCalendar']) {
window['reloadCalendar']()
}
if(this.initCalendarName != this.postEvent.CalendarName) {
let body = {
"EventId": this.postEvent.EventId,
"CalendarDestinationName": this.postEvent.CalendarName,
@@ -410,22 +410,22 @@ export class EditEventPage implements OnInit {
} catch (error) {}
finally {
}
}
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
}, error => {
this.httpErrorHandle.httpStatusHandle(error)
});
}
this.isEventEdited = true;
/* await this.saveDocument() */
await this.saveDocument()
this.goBack();
}
@@ -434,7 +434,7 @@ export class EditEventPage implements OnInit {
async saveDocument() {
try {
for( let e of this.loadedEventAttachments) {
const id: any = e.Id
const remove = e['remove']
@@ -452,7 +452,7 @@ export class EditEventPage implements OnInit {
SerialNumber: '',
};
await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();
} else if(remove) {
await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise()
@@ -461,7 +461,7 @@ export class EditEventPage implements OnInit {
} catch (error) {
} finally {
}
this.modalController.dismiss({
@@ -545,13 +545,13 @@ export class EditEventPage implements OnInit {
if(this.postEvent.HasAttachments) {
this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{
this.loadedEventAttachments = res;
},((erro) => {
console.error('editgetAttchament', erro)
}));
}));
}
}
deleteAttachment(attachmentID: string, index) {
@@ -597,7 +597,7 @@ export class EditEventPage implements OnInit {
SerialNumber: '',
}
this.loadedEventAttachments.push(ApplicationIdDocumentToSave)
this.postEvent.Attachments = this.loadedEventAttachments;
@@ -613,17 +613,17 @@ export class EditEventPage implements OnInit {
setTimeout(() => {
if(this.eventsService.calendarNamesType[this.CalendarNameOwnerName]?.['Oficial'] && this.eventsService.calendarNamesType[this.CalendarNameOwnerName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
} else if (this.eventsService.calendarNamesType[this.CalendarNameOwnerName]?.['Oficial']) {
this.CalendarNamesOptions = ['Oficial']
this.postEvent.CalendarName = 'Oficial'
} else if (this.eventsService.calendarNamesType[this.CalendarNameOwnerName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Pessoal']
this.postEvent.CalendarName = 'Pessoal'
} else {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
}