diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index 0606c6531..c1636e4f7 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -15,9 +15,9 @@ - +
- +
Acções Presidenciais @@ -34,10 +34,10 @@
- +
- @@ -45,7 +45,7 @@
- +

{{viagem.Description}}

{{viagem.Detail}}

@@ -54,20 +54,20 @@
- + + - + + - -
+
-
Nenhuma ação presidencial selecionada
- + - - - \ No newline at end of file + diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index d864f1321..ea5c085a9 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -25,6 +25,7 @@ export class PublicationsPage implements OnInit { publication: Publication; publicationsEventFolderList: PublicationFolder[]; + actionsListStorage: PublicationFolder[] = new Array(); publicationsTravelFolderList: PublicationFolder[]; theDate:any; @@ -35,7 +36,7 @@ export class PublicationsPage implements OnInit { publicationEventFolderStorage = PublicationEventFolderStorage publicationTravelFolderService = PublicationTravelFolderStore - + desktopComponent: any = { showViewPublication: false, showAddNewPublication: false, @@ -55,7 +56,7 @@ export class PublicationsPage implements OnInit { showSlidingOptions = true; constructor( - private router: Router, + private router: Router, private modalController: ModalController, private animationController: AnimationController, private publications: PublicationsService, @@ -68,14 +69,14 @@ export class PublicationsPage implements OnInit { ngOnInit() { const pathname = window.location.pathname - + this.router.events.forEach((event) => { if(event instanceof NavigationEnd && event.url == pathname) { this.getActions(); } }); - this.hideRefreshButton(); + this.hideRefreshButton(); } hideRefreshButton(){ @@ -104,7 +105,7 @@ export class PublicationsPage implements OnInit { this.getActions(); }, 1500); } - + doRefresh(event) { this.getActions(); @@ -117,6 +118,11 @@ export class PublicationsPage implements OnInit { return window.innerWidth } + getDate(date) { + this.theDate = new Date(date); + return this.theDate.getDate() +" de " + ( this.months[this.theDate.getMonth()])+" de " +this.theDate.getFullYear() + } + getActions() { this.showLoader = true; this.publications.GetPublicationFolderList().subscribe(res=>{ @@ -125,14 +131,12 @@ export class PublicationsPage implements OnInit { this.publicationsTravelFolderList = new Array(); res.forEach(data => { - this.theDate = new Date(data.DateBegin); - this.theEndDate = new Date(data.DateEnd); let folder: PublicationFolder = { ProcessId: data.ProcessId, Description: data.Description, Detail: data.Detail, - DateBegin: this.theDate.getDate() +" de " + ( this.months[this.theDate.getMonth()])+" de " +this.theDate.getFullYear(), - DateEnd: this.theEndDate.getDate() +" de " + ( this.months[this.theEndDate.getMonth()])+" de " +this.theEndDate.getFullYear(), + DateBegin: data.DateBegin, + DateEnd: data.DateEnd, ActionType: data.ActionType, } @@ -145,7 +149,7 @@ export class PublicationsPage implements OnInit { this.showLoader = false; this.publicationEventFolderStorage.reset(this.publicationsEventFolderList) - this.publicationTravelFolderService.reset(this.publicationsTravelFolderList) + this.publicationTravelFolderService.reset(this.publicationsEventFolderList) }); @@ -186,7 +190,7 @@ export class PublicationsPage implements OnInit { } async AddPublicationFolder(item?:any) { - + this.closeDesktopComponent(); if(window.innerWidth <= 1024) { @@ -216,7 +220,7 @@ export class PublicationsPage implements OnInit { } else { this.closeDesktopComponent(); this.folderId = folderId - this.desktopComponent.showViewPublication = true; + this.desktopComponent.showViewPublication = true; } } @@ -246,7 +250,7 @@ export class PublicationsPage implements OnInit { const leaveAnimation = (baseEl: any) => { return enterAnimation(baseEl).direction('reverse'); } - + this.closeDesktopComponent(); @@ -269,12 +273,12 @@ export class PublicationsPage implements OnInit { } else { // open angular component this.folderId = folderId - this.desktopComponent.showViewPublication = true; + this.desktopComponent.showViewPublication = true; } } - // called from publications details + // called from publications details // Emittter goBackToViewPublications(){ @@ -308,16 +312,16 @@ export class PublicationsPage implements OnInit { if (folderId != undefined) { this.folderId = folderId; } - + this.publication = publication; - + this.desktopComponent.showAddNewPublication = true; } async openPublicationDetails(publicationId: string){ - + this.publicationId = publicationId; - + this.closeDesktopComponent(); this.desktopComponent.showPublicationDetail = true; @@ -326,7 +330,7 @@ export class PublicationsPage implements OnInit { async updateDesktopComponent(e?:any){ this.getActions(); } - + async closeDesktopComponent (xx?: any){ this.desktopComponent = { @@ -387,4 +391,4 @@ export class PublicationsPage implements OnInit { }); } -} \ No newline at end of file +} diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html index 9aa462180..71f9efd2f 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.html +++ b/src/app/pages/publications/view-publications/view-publications.page.html @@ -87,5 +87,5 @@
- + diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index 51a0ff274..f3c6666f4 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -28,7 +28,7 @@ export class ViewPublicationsPage implements OnInit { // publicationEventFolderStorage = PublicationEventFolderStorage publicationTravelFolderService = PublicationTravelFolderStore - + constructor( private modalController: ModalController, private publications: PublicationsService, @@ -39,7 +39,7 @@ export class ViewPublicationsPage implements OnInit { this.item = new PublicationFolder(); this.activatedRoute.paramMap.subscribe(params => { console.log(params); - + if(params["params"]) { this.folderId = params["params"].folderId; console.log(params["params"]); @@ -84,23 +84,24 @@ export class ViewPublicationsPage implements OnInit { } goBack() { - this.modalController.dismiss(); this.router.navigate(['/home/publications']); } getPublicationDetail() { + setTimeout(() => { let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list) - this.item = allActions.find((e)=> e.ProcessId == this.folderId) + this.item = allActions.find((e)=> e.ProcessId == this.folderId); + }, 100); } - + getPublications() { this.showLoader = true; const folderId = this.folderId this.publications.GetPublications(this.folderId).subscribe(res=>{ console.log(res); - + let data = []; - + res.forEach(element => { let itemImage = { title: 'Title', @@ -119,7 +120,7 @@ export class ViewPublicationsPage implements OnInit { "OriginalFileName": '', "FileExtension": '', } - + // this.publicationList.push(item); data.push(item) @@ -136,9 +137,9 @@ export class ViewPublicationsPage implements OnInit { } this.showLoader = false; - + }); - + } async AddPublication(publicationType:any, folderId:any) { diff --git a/src/app/store/publication-event-folder.service.ts b/src/app/store/publication-event-folder.service.ts index cabdba605..9c5d229ed 100644 --- a/src/app/store/publication-event-folder.service.ts +++ b/src/app/store/publication-event-folder.service.ts @@ -10,13 +10,13 @@ export class PublicationEventFolderService { // main data private _list: PublicationFolder[] = [] // local storage keyName - private keyName: string; + private keyName: string; constructor() { this.keyName = (SHA1(this.constructor.name+ 'PublicationEventFolder/local')).toString() - setTimeout(()=>{ + setTimeout(()=>{ let restore = localstoreService.get(this.keyName, []) this._list = restore }, 10) @@ -34,10 +34,10 @@ export class PublicationEventFolderService { } private save(list: PublicationFolder[]) { - setTimeout(()=> { + setTimeout(()=> { localstoreService.set(this.keyName, list) }, 10) } } -export const PublicationEventFolderStorage = new PublicationEventFolderService() \ No newline at end of file +export const PublicationEventFolderStorage = new PublicationEventFolderService()