Gabinete digital offline complete

This commit is contained in:
Eudes Inácio
2021-09-29 16:47:58 +01:00
parent b59070f35e
commit 0b42dba6ca
25 changed files with 1324 additions and 746 deletions
@@ -33,38 +33,7 @@ export class AllProcessesPage implements OnInit {
ngOnInit() {
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
this.allProcessesList = allprocess;
console.log("All process from db ", allprocess)
})
/* synchro.registerCallback('Online', () => {
this.platform.ready().then(() => {
this.loadAllProcesses();
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital')) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing();
} else {
this.loadAllProcesses();
}
}
});
})
})
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
this.allProcessesList = allprocess;
console.log("All process from db ", allprocess)
})
})
console.log('Offlineee')
}) */
this.getAllProcessFromDB()
}
doRefresh() {
@@ -150,65 +119,56 @@ export class AllProcessesPage implements OnInit {
getAllProcessFromDB() {
synchro.registerCallback('Online', () => {
this.platform.ready().then(() => {
this.loadAllProcesses();
if(synchro.connected === true) {
this.loadAllProcesses();
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital')) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing();
} else {
this.loadAllProcesses();
}
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital')) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing();
} else {
this.loadAllProcesses();
}
}
});
} else {
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
allprocess.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
let task = {
"SerialNumber": element.serialNumber,
"Folio": workflowInstanceDataFields.Subject,
"Senders": workflowInstanceDataFields.Sender,
"CreateDate": taskDate,
"DocumentURL": workflowInstanceDataFields.ViewerRequest,
"Remetente": workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": workflowInstanceDataFields.DispatchDocId,
"FolderID": workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": workflowInstanceDataFields.Status,
"Agenda": workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
});
this.allProcessesList = allprocess;
console.log("All process from db ", allprocess)
})
})
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
allprocess.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
console.log("WORKFLOW all process", workflowInstanceDataFields)
let task = {
"SerialNumber": element.serialNumber,
"Folio": workflowInstanceDataFields.Subject,
"Senders": workflowInstanceDataFields.Sender,
"CreateDate": taskDate,
"DocumentURL": workflowInstanceDataFields.ViewerRequest,
"Remetente": workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": workflowInstanceDataFields.DispatchDocId,
"FolderID": workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": workflowInstanceDataFields.Status,
"Agenda": workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
});
this.allProcessesList = allprocess;
console.log("All process from db ", allprocess)
})
})
console.log('Offlineee')
})
}
}
sortArrayISODate(myArray: any) {