This commit is contained in:
Peter Maquiran
2023-05-29 11:51:08 +01:00
parent b2da8463b4
commit ee14fbe8e7
11 changed files with 51 additions and 142 deletions
@@ -115,65 +115,6 @@ export class EventListPage implements OnInit {
}
getEventToAproveFromDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('event-to-aproveMD').then((events = []) => {
this.eventsMDGPRList = events
})
this.storage.get('event-to-aprovePR').then((events = []) => {
this.eventsPRList = events
})
} else {
this.platform.ready().then(() => {
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[] = []) => {
this.eventsMDGPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
})
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[] = []) => {
this.eventsPRList = this.sortService.sortDate(this.transformaDataDB(event), 'taskStartDate')
})
})
}
}
transformaDataDB(events = []) {
let MdEventsArray = [];
for (let i of events) {
let eventMD = {
Documents: i.Documents,
actions: i.actions,
activityInstanceName: i.activityInstanceName,
formURL: i.formURL,
interveners: i.interveners,
originator: i.originator,
serialNumber: i.serialNumber,
taskStartDate: i.taskStartDate,
totalDocuments: i.totalDocuments,
workflowDisplayName: i.workflowDisplayName,
workflowID: i.workflowID,
workflowInstanceDataFields: JSON.parse(i.workflowInstanceDataFields),
workflowInstanceFolio: i.workflowInstanceFolio,
workflowInstanceID: i.workflowInstanceID,
workflowName: i.workflowName,
}
MdEventsArray.push(eventMD);
}
return MdEventsArray;
}
segmentChanged(ev: any) {
this.LoadToApproveEvents();
}
@@ -211,7 +152,6 @@ export class EventListPage implements OnInit {
this.eventsList = []
}
this.eventsList = this.eventsList
this.eventsList = this.eventsList
this.showLoader = false;
this.eventoaprovacaostore.save(segment.OwnerUserId, this.eventsList)
@@ -268,8 +208,8 @@ export class EventListPage implements OnInit {
setTimeout(() => {
this.LoadToApproveEvents();
try {
event?.target?.complete();
} catch(error) {}
event?.target?.complete();
} catch(error) {}
}, 1000);
}
@@ -277,13 +217,6 @@ export class EventListPage implements OnInit {
this.modalController.dismiss(null);
}
goBack() {
// if(this.router.url == '/home/agenda/event-list') {
// this.router.navigate(['/home/agenda']);
// }
// else if(this.router.url == '/home/gabinete-digital/event-list'){
// this.router.navigate(['/home/gabinete-digital']);
// }
this.RouteService.goBack()
}
@@ -278,58 +278,7 @@ export class GabineteDigitalPage implements OnInit {
this.LoadCounts();
}
addProcessToDB(data) {}
getAllProcessFromDB() {}
dataTranform(data) {
}
sortArrayISODate(myArray: any): any[] {
// return myArray.sort(function (a, b) {
// return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
// });
return myArray.sort((a,b) => Date.parse(b.CreateDate || b.taskStartDate) - Date.parse(a.CreateDate || a.taskStartDate))
}
setFormatDate(start: any, end: any, allday: boolean) {
let customDate;
const totalSeconds = Math.floor((end - (start)) / 1000);;
const totalMinutes = Math.floor(totalSeconds / 60);
const totalHours = Math.floor(totalMinutes / 60);
const totalDays = Math.floor(totalHours / 24);
if (totalDays == 0) {
if (allday) {
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " (todo dia)";
return customDate;
}
else {
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end);
return customDate;
}
}
else {
customDate = this.getCustomDate(start) + "," + this.getCustomHours(start) +
" (termina:" + this.getCustomDate(end) + "," + this.getCustomHours(end) + ")";
return customDate;
}
}
getCustomDate(thedate: Date) {
return thedate.getDate() + "/" +
(thedate.getMonth() + 1) + "/" +
thedate.getFullYear();
}
getCustomHours(thedate: Date) {
return thedate.getHours() + ":" +
thedate.getMinutes();
}
goto(url) {
this.router.navigate([url])
}
@@ -380,10 +329,6 @@ export class GabineteDigitalPage implements OnInit {
}
onSegmentVistaChange() {
}
checkUser() {
this.selectedElement = 'allProcessesTag';
this.showAllProcesses = true;
@@ -499,8 +444,10 @@ export class GabineteDigitalPage implements OnInit {
}
async LoadCounts() {
// this.skeletonLoader = true
await this.TaskService.LoadTask()
// this.skeletonLoader = false
}
doRefresh(event) {