offline angenda and actions

This commit is contained in:
Eudes Inácio
2021-10-09 09:15:22 +01:00
parent ca7965719c
commit 4ca3998717
8 changed files with 542 additions and 369 deletions
+5 -49
View File
@@ -108,14 +108,14 @@ export class EventsPage implements OnInit {
});
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
try {
this.sqliteservice.databaseConn();
} catch (error) {
console.log("Error creating local database: ", error)
}
}
} */
}
@@ -324,52 +324,6 @@ export class EventsPage implements OnInit {
getEventsFromLocalDb() {
window.addEventListener('online',() => {
this.showGreeting();
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == '/home/events') {
this.RefreshEvents();
setTimeout(() => {
this.LoadList();
}, 1500)
}
});
this.hideSearch();
})
window.addEventListener('offline', () => {
this.sqliteservice.getAllEvents().then((event:any[]) => {
this.listToPresent = event
this.totalEvent = this.listToPresent.length
this.currentEvent = this.listToPresent[0].Subject
this.currentHoursMinutes = this.listToPresent[0].StartDate
console.log("All events from local,", event)
})
this.sqliteservice.getprocessByworkflow("Expediente").then((process: any[]) => {
var expedientlist = [];
process.forEach((element) => {
let task = {
CreateDate: element.taskStartDate,
DocumentsQty: element.totalDocuments,
Senders: JSON.parse(element.workflowInstanceDataFields).Sender,
SerialNumber: element.serialNumber,
Status: JSON.parse(element.workflowInstanceDataFields).Status,
Subject: JSON.parse(element.workflowInstanceDataFields).Subject,
WorkflowName: element.workflowDisplayName,
activityInstanceName: element.activityInstanceName,
taskStartDate: element.taskStartDate,
}
expedientlist.push(task);
})
const ExpedienteTask = expedientlist.map(e => this.expedienteTaskPipe.transform(e))
this.listToPresentexpediente = ExpedienteTask;
})
})
if (synchro.connected === true) {
this.showGreeting();
@@ -382,7 +336,8 @@ export class EventsPage implements OnInit {
}
});
this.hideSearch();
} else {
} else {
this.platform.ready().then(async () => {
this.sqliteservice.getAllEvents().then((event:any[]) => {
this.listToPresent = event
this.totalEvent = this.listToPresent.length
@@ -412,6 +367,7 @@ export class EventsPage implements OnInit {
})
});
}
}