Bug on synch event edit and delete and added offline synch to event to aprove REver

This commit is contained in:
Eudes Inácio
2021-11-16 13:12:25 +01:00
parent 487fe4ae6d
commit e7c3bbf3ae
6 changed files with 103 additions and 7 deletions
@@ -171,9 +171,9 @@ export class ViewEventPage implements OnInit {
loader.remove()
}, (error) => {
console.log('errorstatus',error.status)
console.log('errorstatus ss',error.status)
if (error.status == 0) {
if (error.status === 0) {
this.getFromDb();
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
@@ -205,6 +205,8 @@ export class ViewEventPage implements OnInit {
() => {
loader.remove();
});
loader.remove();
}
@@ -421,8 +423,9 @@ export class ViewEventPage implements OnInit {
const loader = this.toastService.loading();
this.sqliteservice.getEventById(this.eventId).then((event) => {
let arrayevent = [];
console.log('EVENT ATTENDEES',event[0].Attendees)
let elemet = {
Attendees: JSON.parse(event[0].Attendees) || "",
Attendees: (typeof JSON.parse(event[0].Attendees) === 'undefined') ? "" : JSON.parse(event[0].Attendees),
Body: JSON.parse(event[0].Body) || "",
CalendarId: event[0].CalendarId,
CalendarName: event[0].CalendarName,
+30
View File
@@ -318,6 +318,36 @@ export class EventsPage implements OnInit {
if (list.length > 0) {
list.forEach(element => {
this.sqliteservice.addEvent(element)
this.sqliteservice.getAllEvents().then((event: any[]) => {
let todayEvents = new Array()
event.forEach((element) => {
let eventObject = {
AppointmentState: element.AppointmentState,
Attachments: element.Attachments,
Attendees: element.Attendees,
CalendarId: element.CalendarId,
CalendarName: element.CalendarName,
Category: element.Category,
EndDate: element.EndDate,
EventId: element.EventId,
EventRecurrence: element.EventRecurrence,
EventType: element.EventType,
HasAttachments: element.HasAttachments,
HumanDate: element.HumanDate,
IsAllDayEvent: element.IsAllDayEvent,
IsMeeting: element.IsMeeting,
IsRecurring: element.IsRecurring,
Location: element.Location,
Organizer: element.Organizer,
Profile: element.Profile,
StartDate: element.StartDate,
Subject: element.Subject
}
todayEvents.push(eventObject);
})
console.log('JIFJSOSDJSDONS',todayEvents)
})
});
}
}
@@ -17,6 +17,7 @@ import { SqliteService } from '../../../../services/sqlite.service';
import { BackgroundService } from '../../../../services/background.service';
import { Platform } from '@ionic/angular';
import { ThemeService } from 'src/app/services/theme.service'
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
@Component({
@@ -62,6 +63,7 @@ export class ApproveEventPage implements OnInit {
private platform: Platform,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService,
private offlineManager: OfflineManagerService
) {
this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]);
@@ -255,7 +257,11 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
await this.processes.PostTaskAction(body).toPromise()
.catch(() => {
console.log('Send event to approve for revition')
this.offlineManager.storeRequestData('event-listRever', body);
});
this.toastService._successMessage('Pedido enviado');
this.goBack();
} catch (error) {