+ *ngFor="let publication of publicationList"
+ (click)="goToPublicationDetail(publication.DocumentId)"
+ >
30" class="post-img">
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 1f5df530a..4995b61bb 100644
--- a/src/app/pages/publications/view-publications/view-publications.page.ts
+++ b/src/app/pages/publications/view-publications/view-publications.page.ts
@@ -5,6 +5,8 @@ import { Publication } from 'src/app/models/publication';
import { PublicationFolder } from 'src/app/models/publicationfolder';
import { LoadingService } from 'src/app/services/loading.service';
import { PublicationsService } from 'src/app/services/publications.service';
+import { PresidentialActionsStore } from 'src/app/store/presidential-actions-store.service';
+import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
import { NewPublicationPage } from '../new-publication/new-publication.page';
import { PublicationDetailPage } from './publication-detail/publication-detail.page';
@@ -22,24 +24,27 @@ export class ViewPublicationsPage implements OnInit {
folderId:string;
error: any;
+ presidentialActionsStore = PresidentialActionsStore
+ publicationTravelFolderStore = PublicationTravelFolderStore
+
constructor( private loadingController: LoadingService,
private modalController: ModalController,
private publications: PublicationsService,
private activatedRoute: ActivatedRoute,
private router: Router )
{
- this.item = new PublicationFolder();
- this.activatedRoute.paramMap.subscribe(params => {
- console.log(params);
-
- if(params["params"]) {
- this.folderId = params["params"].folderId;
- console.log(params["params"]);
- }
-
- });
- }
+ this.item = new PublicationFolder();
+ this.activatedRoute.paramMap.subscribe(params => {
+ console.log(params);
+
+ if(params["params"]) {
+ this.folderId = params["params"].folderId;
+ console.log(params["params"]);
+ }
+
+ });
+ }
ngOnInit() {
@@ -94,8 +99,10 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = true;
this.publications.GetPublications(this.folderId).subscribe(res=>{
- this.publicationList = new Array();
console.log(res);
+
+ let data = [];
+
res.forEach(element => {
let itemImage = {
title: 'Title',
@@ -114,15 +121,19 @@ export class ViewPublicationsPage implements OnInit {
"OriginalFileName": '',
"FileExtension": '',
}
- this.publicationList.push(item);
+
+ // this.publicationList.push(item);
+ data.push(item)
+
});
- console.log(this.publicationList);
+ this.presidentialActionsStore.reset(data)
+
this.showLoader = false;
},
(error)=>{
if(error.status == '404'){
this.error = 'Sem publicações disponíveis!';
- this.publicationList=null;
+ this.publicationList= [];
}
this.showLoader = false;
diff --git a/src/app/shared/publication/view-publications/view-publications.page.ts b/src/app/shared/publication/view-publications/view-publications.page.ts
index 3cb0a5e9a..433f2dff6 100644
--- a/src/app/shared/publication/view-publications/view-publications.page.ts
+++ b/src/app/shared/publication/view-publications/view-publications.page.ts
@@ -34,7 +34,6 @@ export class ViewPublicationsPage implements OnInit {
private publications: PublicationsService,
) {
this.item = new PublicationFolder();
-
}
ngOnInit() {
@@ -68,6 +67,7 @@ export class ViewPublicationsPage implements OnInit {
event.target.complete();
}, 3000);
}
+
close(){
this.closeDesktopComponent.emit();
}
@@ -79,7 +79,7 @@ export class ViewPublicationsPage implements OnInit {
});
}
- getPublications(){
+ getPublications() {
this.showLoader = true;
this.publications.GetPublications(this.folderId).subscribe(res=>{
@@ -116,8 +116,8 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = false;
- });
-
+ })
+
}
async AddPublication(publicationType:any, folderId:any) {
@@ -145,7 +145,6 @@ export class ViewPublicationsPage implements OnInit {
}
-
async viewPublicationDetail(publicationId:string) {
console.log(publicationId);
@@ -170,5 +169,4 @@ export class ViewPublicationsPage implements OnInit {
}
-
}
diff --git a/src/app/store/expediente-storage-service.service.ts b/src/app/store/expediente-storage-service.service.ts
index 181a737a8..d4c91a99d 100644
--- a/src/app/store/expediente-storage-service.service.ts
+++ b/src/app/store/expediente-storage-service.service.ts
@@ -40,8 +40,8 @@ class ExpedienteStorageServiceService {
setTimeout(()=>{
localstoreService.set(this.keyName, list)
}, 10)
-
}
+
}
diff --git a/src/app/store/presidential-actions-store.service.spec.ts b/src/app/store/presidential-actions-store.service.spec.ts
new file mode 100644
index 000000000..eade32cff
--- /dev/null
+++ b/src/app/store/presidential-actions-store.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { PresidentialActionsStoreService } from './presidential-actions-store.service';
+
+describe('PresidentialActionsStoreService', () => {
+ let service: PresidentialActionsStoreService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(PresidentialActionsStoreService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/store/presidential-actions-store.service.ts b/src/app/store/presidential-actions-store.service.ts
new file mode 100644
index 000000000..9e48b54f5
--- /dev/null
+++ b/src/app/store/presidential-actions-store.service.ts
@@ -0,0 +1,46 @@
+import { Injectable } from '@angular/core';
+import { localstoreService } from './localstore.service'
+import { AES, enc, SHA1 } from 'crypto-js'
+import { Publication } from 'src/app/models/publication';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class PresidentialActionsStoreService {
+
+ // main data
+ private _list: Publication[] = []
+ // local storage keyName
+ private keyName: string;
+
+ constructor() {
+
+ this.keyName = (SHA1(this.constructor.name+ 'presidentialActions/local')).toString()
+
+ setTimeout(()=>{
+ let restore = localstoreService.get(this.keyName, [])
+ this._list = restore
+ }, 10)
+
+ }
+
+ get list() {
+ return this._list
+ }
+
+ reset(list: Publication[]) {
+ this._list = list
+
+ this.save(this._list)
+ }
+
+ private save(list: Publication[]) {
+ setTimeout(()=> {
+ localstoreService.set(this.keyName, list)
+ }, 10)
+ }
+
+}
+
+
+export const PresidentialActionsStore = new PresidentialActionsStoreService()
\ No newline at end of file
diff --git a/src/app/store/publication-event-folder.service.spec.ts b/src/app/store/publication-event-folder.service.spec.ts
new file mode 100644
index 000000000..61516ad83
--- /dev/null
+++ b/src/app/store/publication-event-folder.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { PublicationEventFolderService } from './publication-event-folder.service';
+
+describe('PublicationEventFolderService', () => {
+ let service: PublicationEventFolderService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(PublicationEventFolderService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/store/publication-event-folder.service.ts b/src/app/store/publication-event-folder.service.ts
new file mode 100644
index 000000000..cabdba605
--- /dev/null
+++ b/src/app/store/publication-event-folder.service.ts
@@ -0,0 +1,43 @@
+import { Injectable } from '@angular/core';
+import { localstoreService } from './localstore.service'
+import { SHA1 } from 'crypto-js'
+import { PublicationFolder } from '../models/publicationfolder';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class PublicationEventFolderService {
+ // main data
+ private _list: PublicationFolder[] = []
+ // local storage keyName
+ private keyName: string;
+
+ constructor() {
+
+ this.keyName = (SHA1(this.constructor.name+ 'PublicationEventFolder/local')).toString()
+
+ setTimeout(()=>{
+ let restore = localstoreService.get(this.keyName, [])
+ this._list = restore
+ }, 10)
+
+ }
+
+ get list() {
+ return this._list
+ }
+
+ reset(list: PublicationFolder[]) {
+ this._list = list
+
+ this.save(this._list)
+ }
+
+ private save(list: PublicationFolder[]) {
+ setTimeout(()=> {
+ localstoreService.set(this.keyName, list)
+ }, 10)
+ }
+}
+
+export const PublicationEventFolderStorage = new PublicationEventFolderService()
\ No newline at end of file
diff --git a/src/app/store/publication-list.service.spec.ts b/src/app/store/publication-list.service.spec.ts
new file mode 100644
index 000000000..c87726648
--- /dev/null
+++ b/src/app/store/publication-list.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { PublicationListService } from './publication-list.service';
+
+describe('PublicationListService', () => {
+ let service: PublicationListService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(PublicationListService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/store/publication-list.service.ts b/src/app/store/publication-list.service.ts
new file mode 100644
index 000000000..3dc061079
--- /dev/null
+++ b/src/app/store/publication-list.service.ts
@@ -0,0 +1,42 @@
+import { Injectable } from '@angular/core'
+import { Publication } from 'src/app/models/publication'
+import { localstoreService } from './localstore.service'
+import { SHA1 } from 'crypto-js'
+
+@Injectable({
+ providedIn: 'root'
+})
+export class PublicationListService {
+
+ // main data
+ private _list: Publication[] = []
+ // local storage keyName
+ private keyName: string;
+
+ constructor() {
+
+ this.keyName = (SHA1(this.constructor.name+ ' PublicationTravelFolder/local')).toString()
+
+ setTimeout(()=>{
+ let restore = localstoreService.get(this.keyName, [])
+ this._list = restore
+ }, 10)
+
+ }
+
+ get list() {
+ return this._list
+ }
+
+ reset(list: Publication[]) {
+ this._list = list
+
+ this.save(this._list)
+ }
+
+ private save(list: Publication[]) {
+ setTimeout(()=> {
+ localstoreService.set(this.keyName, list)
+ }, 10)
+ }
+}
diff --git a/src/app/store/publication-travel-folder.service.spec.ts b/src/app/store/publication-travel-folder.service.spec.ts
new file mode 100644
index 000000000..19bfb9971
--- /dev/null
+++ b/src/app/store/publication-travel-folder.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { PublicationTravelFolderService } from './publication-travel-folder.service';
+
+describe('PublicationTravelFolderService', () => {
+ let service: PublicationTravelFolderService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(PublicationTravelFolderService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/store/publication-travel-folder.service.ts b/src/app/store/publication-travel-folder.service.ts
new file mode 100644
index 000000000..7bd4dadaa
--- /dev/null
+++ b/src/app/store/publication-travel-folder.service.ts
@@ -0,0 +1,46 @@
+import { Injectable } from '@angular/core';
+import { localstoreService } from './localstore.service'
+import { SHA1 } from 'crypto-js'
+import { Publication } from 'src/app/models/publication';
+import { PublicationFolder } from '../models/publicationfolder';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class PublicationTravelFolderService {
+
+ // main data
+ private _list: PublicationFolder[] = []
+ // local storage keyName
+ private keyName: string;
+
+ constructor() {
+
+ this.keyName = (SHA1(this.constructor.name+ ' PublicationTravelFolder/local')).toString()
+
+ setTimeout(()=>{
+ let restore = localstoreService.get(this.keyName, [])
+ this._list = restore
+ }, 10)
+
+ }
+
+ get list() {
+ return this._list
+ }
+
+ reset(list: PublicationFolder[]) {
+ this._list = list
+
+ this.save(this._list)
+ }
+
+ private save(list: PublicationFolder[]) {
+ setTimeout(()=> {
+ localstoreService.set(this.keyName, list)
+ }, 10)
+ }
+}
+
+
+export const PublicationTravelFolderStore = new PublicationTravelFolderService()
\ No newline at end of file