pr eftu<r despachp

This commit is contained in:
Eudes Inácio
2023-02-27 22:52:33 +01:00
16 changed files with 527 additions and 541 deletions
@@ -91,7 +91,7 @@ export class EventListPage implements OnInit {
this.color = 'mdgpr'
}
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
let genericEvents = await this.processes.eventsToApprove(SessionStore.user.UserId,'mobile agenda').toPromise()
try {
this.eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
@@ -197,9 +197,7 @@ ion-content{
left: 0 !important;
bottom: 0 !important;
right: 0 !important;
top: calc(100% - 160px) !important;
max-height: 160px;
min-height: 160px;
bottom: 0px !important;
}
@@ -86,7 +86,7 @@ export class EventsToApprovePage implements OnInit {
this.color = 'mdgpr'
}
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
let genericEvents = await this.processes.eventsToApprove(SessionStore.user.UserId,'mobile agenda').toPromise()
try {
this.eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
@@ -8,7 +8,7 @@
<div class="buttons">
<button class="btn-cancel" shape="round" >Adicionar</button>
<button (click)="leaveGroup()" class="btn-cancel" shape="round" >Sair do Grupo</button>
<button *ngIf="isAdmin" (click)="openChangeGroupName()" class="btn-cancel" shape="round" >Alterar nome do grupo</button>
<button *ngIf="isAdmin" (click)="openChangeGroupName()" class="btn-cancel btn-cancel mt-10" shape="round" >Alterar nome do grupo</button>
<div class="solid"></div>
<button (click)="close('cancel')" full class="btn-cancel mobile-only" shape="round" >Cancelar</button>
<button *ngIf="isAdmin" (click)="deleteGroup()" class="btn-delete" shape="round">Apagar grupo</button>
@@ -1,18 +1,18 @@
<ion-header class="ion-no-border">
<div class="main-header">
<div class="title-content">
<div *ngIf="item" class="div-title width-100 flex-grow-1">
<div *ngIf="publicationItem[folderId]" class="div-title width-100 flex-grow-1">
<div class="title">
<ion-label>{{item.Description}}</ion-label>
<ion-label>{{publicationItem[folderId].Description}}</ion-label>
</div>
<div class="actions-icon">
<!-- <ion-icon (click)="AddPublication('1',item.ProcessId)" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon> -->
<button *ngIf="p.userPermission([p.permissionList.Actions.editPost])" class="btn-no-color" (click)="openEditPublication(item.ProcessId)">
<button *ngIf="p.userPermission([p.permissionList.Actions.editPost])" class="btn-no-color" (click)="openEditPublication(publicationItem[folderId].ProcessId)">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="edit" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="edit" slot="end" src="assets/images/theme/gov/icons-edit.svg" ></ion-icon>
</button>
<button *ngIf="p.userPermission([p.permissionList.Actions.deletePost])" class="btn-no-color" (click)="deletePublication(item.ProcessId)">
<button *ngIf="p.userPermission([p.permissionList.Actions.deletePost])" class="btn-no-color" (click)="deletePublication(publicationItem[folderId].ProcessId)">
<ion-icon class="delete" src='assets/images/theme/gov/icons-delete.svg'></ion-icon>
</button>
<button class="btn-no-color cursor-pointer" (click)="doRefresh($event)">
@@ -21,8 +21,8 @@
</div>
</div>
<div class="div-body width-100">
<p class="item-content-detail">{{item.Detail}}</p>
<p class="item-content-date">{{ item.DateBegin | date: 'dd-MM-yy HH:mm'}}</p>
<p class="item-content-detail">{{publicationItem[folderId].Detail}}</p>
<p class="item-content-date">{{ publicationItem[folderId].DateBegin | date: 'dd-MM-yy HH:mm'}}</p>
</div>
</div>
@@ -35,8 +35,8 @@
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-container px-20">
<ion-card *ngFor="let publication of publicationList let i = index"
<div class="main-container px-20" *ngIf="publicationItem[folderId]">
<ion-card *ngFor="let publication of publicationList[folderId] let i = index"
(click)="viewPublicationDetail(publication.DocumentId)">
<ion-card-content>
<div class="post-img">
@@ -84,8 +84,8 @@
</ion-list> -->
</div>
<!-- fab placed to the bottom end -->
<ion-fab *ngIf="p.userPermission([p.permissionList.Actions.create])" vertical="bottom" horizontal="end">
<ion-fab-button title="Nova Publicação" (click)="AddPublication('2',item.ProcessId)">
<ion-fab *ngIf="p.userPermission([p.permissionList.Actions.create]) && publicationItem[folderId]" vertical="bottom" horizontal="end">
<ion-fab-button title="Nova Publicação" (click)="AddPublication('2',publicationItem[folderId].ProcessId)">
<ion-icon name="add"></ion-icon>
</ion-fab-button>
</ion-fab>
@@ -22,8 +22,8 @@ export class ViewPublicationsPage implements OnInit {
showLoader: boolean;
loading: any;
publicationList: Publication[];
item: PublicationFolder;
publicationList: {[key: string]: Publication[] } = {};
publicationItem: {[key: string]: PublicationFolder } = {};
getpublication = [];
error: any;
@@ -47,7 +47,10 @@ export class ViewPublicationsPage implements OnInit {
public p:PermissionService,
private httpErrorHandle: HttpErrorHandle
) {
this.item = new PublicationFolder();
if(!this.publicationList[this.folderId]) {
this.publicationList[this.folderId] = []
this.publicationItem[this.folderId] = new PublicationFolder();
}
}
ngOnInit() {
@@ -55,10 +58,14 @@ export class ViewPublicationsPage implements OnInit {
this.folderId = this.folderId['ProcessId']
}
//this.getPublicationsIds();
if(!this.publicationList[this.folderId]) {
this.publicationList[this.folderId] = []
this.publicationItem[this.folderId] = new PublicationFolder();
}
window['app-view-publications-page-doRefresh'] = this.doRefresh
this.getPublicationDetail();
this.getFromDB();
}
ngOnChanges(changes: any): void {
@@ -66,23 +73,24 @@ export class ViewPublicationsPage implements OnInit {
if(typeof(this.folderId) == 'object') {
this.folderId = this.folderId['ProcessId']
}
//setTimeout(()=>{
this.getPublicationDetail();
this.getPublicationsIds();
if(!this.publicationList[this.folderId]) {
this.publicationList[this.folderId] = []
this.publicationItem[this.folderId] = new PublicationFolder();
}
//}, 100)
this.getFromDB();
this.getPublicationDetail();
this.getPublicationsIds();
}
doRefresh =(event) => {
this.getPublicationsIds();
setTimeout(() => {
this.getPublicationDetail();
}, 3000);
this.getPublicationDetail();
this.getPublicationsIds();
}
close() {
@@ -90,88 +98,84 @@ export class ViewPublicationsPage implements OnInit {
}
getPublicationDetail() {
this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{
this.item = res;
this.showLoader = true;
const folderId = this.folderId
this.publications.GetPresidentialAction(folderId).subscribe(res=>{
this.showLoader = false;
this.publicationItem[folderId] = res
this.storage.set(folderId+"name", res)
}, (error) => {
this.showLoader = false;
// this.httpErroHandle.httpStatusHandle(error)
});
}
getPublicationsIds() {
async getPublicationsIds() {
this.showLoader = true;
const folderId = this.folderId
//this.getFromDB()
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
this.publicationList = new Array();
/* for(let i = 0; i < res.length; i++) {
this.publications.GetPublicationById(res[i]).subscribe(ress => {
let item: Publication = this.publicationPipe.itemList(ress)
this.publicationList.push(item);
})
} */
res.forEach(element => {
this.publications.GetPublicationById(element).subscribe(ress => {
let item: Publication = this.publicationPipe.itemList(ress)
this.publicationList.push(item);
})
});
this.storage.remove('view_publications');
this.storage.set('view_publications', this.publicationList);
this.getpublication = this.publicationList;
try {
const res = await this.publications.GetPublicationsImages(folderId).toPromise();
let publicationList = []
for (let element of res) {
let ress = await this.publications.GetPublicationById(element).toPromise();
let item: Publication = this.publicationPipe.itemList(ress)
publicationList.push(item);
}
this.showLoader = false;
},() => {
this.getFromDB();
});
this.publicationList[folderId] = publicationList
this.storage.set(folderId, publicationList);
this.getpublication = publicationList;
} catch(error) {
this.showLoader = false;
}
}
getFromDB() {
this.storage.get('view_publications').then((viewPublications) => {
this.publicationList = viewPublications;
})
}
getPublications() {
this.showLoader = true;
const folderId = this.folderId
this.publicationList = new Array();
//this.getFromDB();
this.publications.GetPublications(folderId).subscribe(async res=> {
res.forEach(element => {
let item: Publication = this.publicationPipe.itemList(element)
this.publicationList.push(item);
});
await this.storage.remove('view_publications');
await this.storage.set('view_publications', this.publicationList);
//this.getFromDB();
this.showLoader = false;
},
(error)=>{
if(error.status == '404') {
this.error = 'Sem publicações disponíveis!';
this.publicationList= [];
}
this.showLoader = false;
this.storage.get(folderId).then((viewPublications) => {
this.publicationList[folderId] = viewPublications
})
this.storage.get(folderId+"name").then((viewPublications) => {
this.publicationItem[folderId] = viewPublications
})
}
// getPublications() {
// this.showLoader = true;
// const folderId = this.folderId
// this.publicationList = new Array();
// this.publications.GetPublications(folderId).subscribe(async res=> {
// res.forEach(element => {
// let item: Publication = this.publicationPipe.itemList(element)
// this.publicationList.push(item);
// });
// this.showLoader = false;
// await this.storage.remove(folderId);
// await this.storage.set(folderId, this.publicationList);
// //this.getFromDB();
// },
// (error)=>{
// if(error.status == '404') {
// this.error = 'Sem publicações disponíveis!';
// this.publicationList= [];
// }
// this.showLoader = false;
// })
// }
async AddPublication(publicationType:any, folderId:any) {
if( window.innerWidth < 701) {