This commit is contained in:
Peter Maquiran
2022-12-20 17:14:23 +01:00
parent be617c0fe3
commit 5652043b8a
22 changed files with 285 additions and 234 deletions
+58 -50
View File
@@ -28,9 +28,9 @@ export class PublicationsPage implements OnInit {
publicationFolder: PublicationFolder;
publication: Publication;
publicationsEventFolderList: PublicationFolder[];
publicationsEventFolderList: PublicationFolder[] = [];
actionsListStorage: PublicationFolder[] = new Array();
publicationsTravelFolderList: PublicationFolder[];
publicationsTravelFolderList: PublicationFolder[] = [];
theDate: any;
theEndDate: any;
@@ -91,10 +91,6 @@ export class PublicationsPage implements OnInit {
});
this.hideRefreshButton();
/* this.backgroundservice.registerBackService('Online', () => {
this.getActions();
}) */
}
@@ -142,55 +138,67 @@ export class PublicationsPage implements OnInit {
return this.theDate.getDate() + " de " + (this.months[this.theDate.getMonth()]) + " de " + this.theDate.getFullYear()
}
loadList = false
getActions() {
this.showLoader = true;
this.skeletonLoader = true;
this.getFromDB()
this.publications.GetPublicationFolderList().subscribe(async res => {
let publicationsEventFolderList = new Array();
let publicationsTravelFolderList = new Array();
res.forEach(data => {
let folder: PublicationFolder = {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
DateBegin: data.DateBegin,
DateEnd: data.DateEnd,
ActionType: data.ActionType,
if(this.loadList == false) {
this.loadList = true
this.showLoader = true;
this.skeletonLoader = true;
this.getFromDB()
this.publications.GetPublicationFolderList().subscribe(async res => {
let publicationsEventFolderList = new Array();
let publicationsTravelFolderList = new Array();
res.forEach(data => {
let folder: PublicationFolder = {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
DateBegin: data.DateBegin,
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
this.addActionToDB(folder)
if (data.ActionType == "Evento") {
publicationsEventFolderList.push(folder);
}
else {
publicationsTravelFolderList.push(folder);
}
});
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
await this.storage.set('actionsEvents', publicationsEventFolderList);
await this.storage.set('actionsViagens', publicationsTravelFolderList);
this.getFromDB()
} else {
this.getFromDB()
}
this.addActionToDB(folder)
if (data.ActionType == "Evento") {
publicationsEventFolderList.push(folder);
}
else {
publicationsTravelFolderList.push(folder);
}
this.showLoader = false;
this.skeletonLoader = false;
this.loadList = false
}, (error) => {
// this.getFromDB();
this.showLoader = false;
this.skeletonLoader = false;
this.loadList = false
});
}
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
await this.storage.set('actionsEvents', publicationsEventFolderList);
await this.storage.set('actionsViagens', publicationsTravelFolderList);
this.getFromDB()
} else {
this.getFromDB()
}
this.showLoader = false;
}/* , (error) => {
this.getFromDB();
} */);
this.skeletonLoader = false;
}
addActionToStorage(events, viagens) {
@@ -253,7 +261,7 @@ export class PublicationsPage implements OnInit {
});
} else {
this.sqliteservice.getAllActions().then((actions: any[]) => {
this.sqliteservice.getAllActions().then((actions: any[] = []) => {