This commit is contained in:
Peter Maquiran
2022-04-06 14:51:35 +01:00
parent 5570b07ddf
commit d0d920f80b
5 changed files with 54 additions and 43 deletions
-4
View File
@@ -671,7 +671,6 @@ export class AgendaPage implements OnInit {
}) })
} }
} }
} else { } else {
@@ -681,9 +680,6 @@ export class AgendaPage implements OnInit {
if (this.loggeduser.Profile == 'MDGPR') { if (this.loggeduser.Profile == 'MDGPR') {
alert('MDGPR')
this.eventService.getAllMdEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => { this.eventService.getAllMdEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
this.addEventToDB(response, "md"); this.addEventToDB(response, "md");
@@ -206,8 +206,9 @@ export class ViewEventPage implements OnInit {
const event = this.CalendarService.eventSource.find((ele) => ele.id == this.eventId) const event = this.CalendarService.eventSource.find((ele) => ele.id == this.eventId)
if(event?.CalendarId) { // console.log('View event details', event)
if(event?.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, event.CalendarId).subscribe(res => { this.eventsService.genericGetEvent(this.eventId, event.CalendarId).subscribe(res => {
this.loadedEvent = res; this.loadedEvent = res;
this.addEventToDb(res); this.addEventToDb(res);
@@ -261,23 +262,24 @@ export class ViewEventPage implements OnInit {
} else { } else {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => { alert('generic delete')
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => { this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
alert.dismiss(); const alert = await this.alertController.create({
}, 1500); cssClass: 'my-custom-class',
this.goBack(); header: 'Evento removido',
this.toastService.successMessage('Evento apagado'); buttons: ['OK']
}, () => { }, });
() => {
loader.remove();
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.toastService.successMessage('Evento apagado');
}, () => { },
() => {
loader.remove();
});
} }
+4
View File
@@ -175,6 +175,10 @@ export class AuthService {
SessionStore.user.RochetChatUserId = message.result.id SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save() SessionStore.save()
// console.log('user session', SessionStore.user)
this.WsChatService.setStatus('online') this.WsChatService.setStatus('online')
}).catch((message) => { }).catch((message) => {
+10 -1
View File
@@ -486,7 +486,7 @@ export class EventsService {
return this.http.get<Event>(`${geturl}`, options); return this.http.get<Event>(`${geturl}`, options);
} else { } else {
alert('headr not found'+ calendarId)
} }
throw('error') throw('error')
@@ -814,6 +814,13 @@ export class EventsService {
}) })
if (header) { if (header) {
options = {
headers: header,
params: params
};
return this.http.delete(`${puturl}`, options).pipe( return this.http.delete(`${puturl}`, options).pipe(
catchError(err => { catchError(err => {
console.log('Event edit saved offline') console.log('Event edit saved offline')
@@ -821,6 +828,8 @@ export class EventsService {
throw new Error(err); throw new Error(err);
}) })
) )
} else {
} }
throw('header not found') throw('header not found')
@@ -122,30 +122,30 @@ export class ViewEventPage implements OnInit {
}); });
} else { } else {
const event = this.CalendarService.eventSource.find((ele) => ele.id == this.eventId)
this.eventsService.genericGetEvent(this.eventId, this.loadedEvent.CalendarId).subscribe(res => {
this.loadedEvent = res;
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
this.viewEventDetailDismiss.emit({
type: 'close'
})
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
});
if(event?.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, event.CalendarId).subscribe(res => {
this.loadedEvent = res;
this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}, (error)=> {
this.viewEventDetailDismiss.emit({
type: 'close'
})
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
});
}
} }
} }
async deleteEvent() { async deleteEvent() {