diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index 5c632b74f..43c3d51b6 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -15,7 +15,7 @@
- +
@@ -37,14 +37,11 @@
- - -
- +
{ - - - - let publicationsEventFolderList = new Array(); - let publicationsTravelFolderList = new Array(); - - res.forEach(data => { - let folder: PublicationFolder = { + + const folders: any = res.map((data): PublicationFolder => { + return { ProcessId: data.ProcessId, Description: data.Description, Detail: data.Detail, @@ -162,24 +156,14 @@ export class PublicationsPage implements OnInit { DateEnd: data.DateEnd, ActionType: data.ActionType, } - - this.addActionToDB(folder) - - if (data.ActionType == "Evento") { - - publicationsEventFolderList.push(folder); - } - else { - - publicationsTravelFolderList.push(folder); - } - - }); + + this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento') + this.publicationsTravelFolderList = folders.filter((e)=>e.ActionType != 'Evento') if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - await this.storage.set('actionsEvents', publicationsEventFolderList); - await this.storage.set('actionsViagens', publicationsTravelFolderList); + await this.storage.set('actionsEvents', this.publicationsEventFolderList); + await this.storage.set('actionsViagens', this.publicationsTravelFolderList); this.getFromDB() } else { this.getFromDB() @@ -190,7 +174,6 @@ export class PublicationsPage implements OnInit { this.loadList = false }, (error) => { - // this.getFromDB(); this.showLoader = false; this.skeletonLoader = false; this.loadList = false @@ -217,16 +200,28 @@ export class PublicationsPage implements OnInit { } } + + getPublicationFolderMap(events: any):PublicationFolder[] { + return events.map((data) : PublicationFolder => { + return { + ProcessId: data.ProcessId, + Description: data.Description, + Detail: data.Detail, + DateBegin: data.DateBegin, + DateEnd: data.DateEnd, + ActionType: data.ActionType, + } + }); + } + getFromDB() { if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - this.publicationsEventFolderList = new Array(); - this.publicationsTravelFolderList = new Array(); this.storage.get('actionsEvents').then((events = []) => { if(Array.isArray(events)) { - events.forEach(data => { - let folder: PublicationFolder = { + const folders: PublicationFolder[] = events.map((data) : PublicationFolder => { + return { ProcessId: data.ProcessId, Description: data.Description, Detail: data.Detail, @@ -234,18 +229,18 @@ export class PublicationsPage implements OnInit { DateEnd: data.DateEnd, ActionType: data.ActionType, } - - this.publicationsEventFolderList.push(folder); - this.showLoader = false; }); + + this.showLoader = false; + this.publicationsEventFolderList = folders } }); this.storage.get('actionsViagens').then((viagens = []) => { if(Array.isArray(viagens)) { - viagens.forEach(data => { - let folder: PublicationFolder = { + const folders: PublicationFolder[] = viagens.map((data): PublicationFolder => { + return { ProcessId: data.ProcessId, Description: data.Description, Detail: data.Detail, @@ -253,23 +248,18 @@ export class PublicationsPage implements OnInit { DateEnd: data.DateEnd, ActionType: data.ActionType, } - - this.publicationsTravelFolderList.push(folder); - this.showLoader = false; }); + + this.publicationsTravelFolderList = folders + this.showLoader = false; } }); } else { this.sqliteservice.getAllActions().then((actions: any[] = []) => { - - - this.publicationsEventFolderList = new Array(); - this.publicationsTravelFolderList = new Array(); - - actions.forEach(data => { - let folder: PublicationFolder = { + const folders: any = actions.map((data): PublicationFolder => { + return { ProcessId: data.ProcessId, Description: data.Description, Detail: data.Detail, @@ -277,16 +267,12 @@ export class PublicationsPage implements OnInit { DateEnd: data.DateEnd, ActionType: data.ActionType, } - - if (data.ActionType == "Evento") { - this.publicationsEventFolderList.push(folder); - } - else { - this.publicationsTravelFolderList.push(folder); - } - this.showLoader = false; }); + this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento') + this.publicationsTravelFolderList = folders.filter((e)=>e.ActionType != 'Evento') + this.showLoader = false; + }) } } diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index e37f55ce1..e3161d1fe 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -12,9 +12,6 @@ export const environment = { apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket', // apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/', // apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket', - /* apiChatUrl: 'https://www.tabularium.pt/api/v1/', - apiWsChatUrl: 'wss://www.tabularium.pt/websocket', */ - // apiChatUrl: 'https://www.tabularium.pt/api/v1/', production: true, domain: 'gabinetedigital.local', defaultuser: 'eqformacao@oapr.gov.ao',//paulo.pinto@gabinetedigital.local diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 573222045..56998ebab 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,22 +1,19 @@ import { versionData } from '../../version/git-version' export const environment = { // apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', - apiURL: 'https://gd-api.oapr.gov.ao/api/', - //apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/', + //apiURL: 'https://gd-api.oapr.gov.ao/api/', + apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/', // apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', // apiChatUrl: 'http://192.168.0.29:3000/api/v1/', // apiWsChatUrl: 'wss://192.168.0.29:3000/websocket', - apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/', - apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket', - //apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/', - //apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket', - /* apiChatUrl: 'https://www.tabularium.pt/api/v1/', - apiWsChatUrl: 'wss://www.tabularium.pt/websocket', */ - // apiChatUrl: 'https://www.tabularium.pt/api/v1/', + //apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/', + //apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket', + apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/', + apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket', production: true, domain: 'paulo.pinto@gabinetedigital.local', - defaultuser: 'eqformacao@oapr.gov.ao',//paulo.pinto@gabinetedigital.local - defaultuserpwd: 'M@p2022', //tabteste@006, + defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto@gabinetedigital.local + defaultuserpwd: 'tabteste@006', //tabteste@006, chatOffline: true, presidencia: false, version: versionData, diff --git a/version/git-version.ts b/version/git-version.ts index 8b27d0a0a..1ed805d35 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "e350cd24d", - "SHA": "e350cd24da31173a89cef80b84961576a8d7cebe", + "shortSHA": "fe6a3099a", + "SHA": "fe6a3099a9e52ebc4417844b213e0206f27d71e5", "branch": "develop_bitOut-fix", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Wed Dec 28 14:05:59 2022 +0100'", - "lastCommitMessage": "add husky", - "lastCommitNumber": "4589", + "lastCommitTime": "'Wed Dec 28 14:15:49 2022 +0100'", + "lastCommitMessage": "add prepare script", + "lastCommitNumber": "4590", "change": "", - "changeStatus": "On branch develop_bitOut-fix\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: package.json", + "changeStatus": "On branch develop_bitOut-fix\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/pages/publications/publications.page.html\n\tmodified: src/app/pages/publications/publications.page.ts\n\tmodified: src/environments/environment.prod.ts\n\tmodified: src/environments/environment.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file