diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index 17b45ac9f..f8c5cbbda 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; import { Observable } from 'rxjs'; import { AuthService } from '../services/auth.service'; +import { PermissionService } from '../services/permission.service'; import { LocalstoreService } from '../store/localstore.service'; import { SessionStore } from '../store/session.service'; @@ -13,6 +14,7 @@ export class AuthGuard implements CanActivate { private router:Router, private localstoreService: LocalstoreService, private authService: AuthService, + public p: PermissionService, ){} canActivate( @@ -29,7 +31,10 @@ export class AuthGuard implements CanActivate { this.router.navigate(['/']); return false } else { - this.authService.loginChat(); + if(this.p.userPermission(this.p.permissionList.Chat.access) == true){ + this.authService.loginChat(); + } + return true; } } diff --git a/src/app/modals/add-note/add-note.page.ts b/src/app/modals/add-note/add-note.page.ts index 21f62129c..8376d76a3 100644 --- a/src/app/modals/add-note/add-note.page.ts +++ b/src/app/modals/add-note/add-note.page.ts @@ -50,7 +50,7 @@ export class AddNotePage implements OnInit { component: SearchPage, cssClass: 'modal-width-100-width-background modal', componentProps: { - type: 'AccoesPresidenciais & ArquivoDespachoElect', + typety: 'AccoesPresidenciais & ArquivoDespachoElect', showSearchInput: true, select: true } diff --git a/src/app/models/permission/actions.permission.ts b/src/app/models/permission/actions.permission.ts index 8dcbc9a83..fcdc95e7c 100644 --- a/src/app/models/permission/actions.permission.ts +++ b/src/app/models/permission/actions.permission.ts @@ -1,9 +1,9 @@ export class ActionsPermission{ access = 534; create = 535; - remove = 536; + delete = 536; edit = 537; createPost = 538; - removePost = 539; + deletePost = 539; editPost = 540; } diff --git a/src/app/pages/agenda/agenda-routing.module.ts b/src/app/pages/agenda/agenda-routing.module.ts index b177d8a24..dd917765c 100644 --- a/src/app/pages/agenda/agenda-routing.module.ts +++ b/src/app/pages/agenda/agenda-routing.module.ts @@ -1,42 +1,46 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { AgendaPage } from './agenda.page'; - -const routes: Routes = [ - { - path: '', - component: AgendaPage - }, - { - path: 'approve-event-modal', - loadChildren: () => import('../gabinete-digital/event-list/approve-event-modal/approve-event-modal.module').then( m => m.ApproveEventModalPageModule) - }, - { - path: 'event-actions-popover', - loadChildren: () => import('./event-actions-popover/event-actions-popover.module').then( m => m.EventActionsPopoverPageModule) - }, - { - path: 'emend-message-modal', - loadChildren: () => import('./emend-message-modal/emend-message-modal.module').then( m => m.EmendMessageModalPageModule) - }, - { - path: 'new-event', - loadChildren: () => import('./new-event/new-event.module').then( m => m.NewEventPageModule) - }, - { - path: 'edit-event', - loadChildren: () => import('./edit-event/edit-event.module').then( m => m.EditEventPageModule) - }, - { - path: 'view-event', - loadChildren: () => import('./view-event/view-event.module').then( m => m.ViewEventPageModule) +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { AgendaPage } from './agenda.page'; + +const routes: Routes = [ + { + path: '', + component: AgendaPage + }, + { + path: 'approve-event-modal', + loadChildren: () => import('../gabinete-digital/event-list/approve-event-modal/approve-event-modal.module').then( m => m.ApproveEventModalPageModule) + }, + { + path: 'event-actions-popover', + loadChildren: () => import('./event-actions-popover/event-actions-popover.module').then( m => m.EventActionsPopoverPageModule) + }, + { + path: 'emend-message-modal', + loadChildren: () => import('./emend-message-modal/emend-message-modal.module').then( m => m.EmendMessageModalPageModule) + }, + { + path: 'new-event', + loadChildren: () => import('./new-event/new-event.module').then( m => m.NewEventPageModule) + }, + { + path: 'edit-event', + loadChildren: () => import('./edit-event/edit-event.module').then( m => m.EditEventPageModule) + }, + { + path: 'view-event', + loadChildren: () => import('./view-event/view-event.module').then( m => m.ViewEventPageModule) + }, { + path: 'evandre', + loadChildren: () => import('./evandre/evandre.module').then( m => m.EvandrePageModule) } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class AgendaPageRoutingModule {} + +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class AgendaPageRoutingModule {} diff --git a/src/app/pages/agenda/evandre/evandre-routing.module.ts b/src/app/pages/agenda/evandre/evandre-routing.module.ts new file mode 100644 index 000000000..3fb00a40b --- /dev/null +++ b/src/app/pages/agenda/evandre/evandre-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { EvandrePage } from './evandre.page'; + +const routes: Routes = [ + { + path: '', + component: EvandrePage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class EvandrePageRoutingModule {} diff --git a/src/app/pages/agenda/evandre/evandre.module.ts b/src/app/pages/agenda/evandre/evandre.module.ts new file mode 100644 index 000000000..8a20cd1c2 --- /dev/null +++ b/src/app/pages/agenda/evandre/evandre.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { EvandrePageRoutingModule } from './evandre-routing.module'; + +import { EvandrePage } from './evandre.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + EvandrePageRoutingModule + ], + declarations: [EvandrePage] +}) +export class EvandrePageModule {} diff --git a/src/app/pages/agenda/evandre/evandre.page.html b/src/app/pages/agenda/evandre/evandre.page.html new file mode 100644 index 000000000..0cc537051 --- /dev/null +++ b/src/app/pages/agenda/evandre/evandre.page.html @@ -0,0 +1,9 @@ + + + evandre + + + + + + diff --git a/src/app/pages/agenda/evandre/evandre.page.scss b/src/app/pages/agenda/evandre/evandre.page.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/pages/agenda/evandre/evandre.page.spec.ts b/src/app/pages/agenda/evandre/evandre.page.spec.ts new file mode 100644 index 000000000..adce8c07c --- /dev/null +++ b/src/app/pages/agenda/evandre/evandre.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { EvandrePage } from './evandre.page'; + +describe('EvandrePage', () => { + let component: EvandrePage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ EvandrePage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(EvandrePage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/agenda/evandre/evandre.page.ts b/src/app/pages/agenda/evandre/evandre.page.ts new file mode 100644 index 000000000..ff0b84c65 --- /dev/null +++ b/src/app/pages/agenda/evandre/evandre.page.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-evandre', + templateUrl: './evandre.page.html', + styleUrls: ['./evandre.page.scss'], +}) +export class EvandrePage implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html index b0af3b7a3..d713c4f80 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html @@ -79,25 +79,25 @@
-
Responder ao PR
- +
Responder ao PR
+ -
Reencaminhar para Área jurídica
- +
Reencaminhar para Área jurídica
+ -
Outras opções
- - - - +
Outras opções
+ + + + - +
- - - - + + + +
diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts index 11887369d..25c1c6c86 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts @@ -24,6 +24,7 @@ import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service' import { RouteService } from 'src/app/services/route.service'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ selector: 'app-despacho-pr', @@ -45,7 +46,8 @@ export class DespachoPrPage implements OnInit { intervenientes: any; cc: any = []; - constructor(private activateRoute: ActivatedRoute, + constructor( + private activateRoute: ActivatedRoute, private processes: ProcessesService, private iab: InAppBrowser, private attachmentsService: AttachmentsService, @@ -62,7 +64,8 @@ export class DespachoPrPage implements OnInit { private backgroundservice: BackgroundService, private platform: Platform, public ThemeService: ThemeService, - private RouteService: RouteService + private RouteService: RouteService, + public p: PermissionService, ) { this.activatedRoute.paramMap.subscribe(params => { if (params["params"].SerialNumber) { diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html index f2eb86e87..17c082711 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html @@ -14,7 +14,7 @@
{{ task.Folio}}
-
+
@@ -96,7 +96,7 @@
- +
@@ -106,7 +106,7 @@
- +
@@ -115,7 +115,7 @@
- +
diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts index 719139cf0..66d55bad0 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts @@ -63,7 +63,7 @@ export class DespachoPage implements OnInit { private sqliteservice: SqliteService, private platform: Platform, private backgroundservice: BackgroundService, - public ThemeService: ThemeService + public ThemeService: ThemeService, ) { diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html index 9d96e8231..da21dfe05 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html @@ -90,26 +90,26 @@ -
+
-
Enviar para o PR
- -
Solicitar revisão
- -
Outras opções
+
Enviar para o PR
+ +
Solicitar revisão
+ +
Outras opções
- - - + + + - +
-
+
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html index 71556f4dc..27cdc2ed7 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.html +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html @@ -101,7 +101,7 @@

{{ allProcessesList.length }} Documentos

-
+
@@ -128,24 +128,24 @@
-

Pendentes

-

Meus Pendentes

+

Pendentes

+

Meus Pendentes

{{pendentesstore.count}} Documentos

-
+
-

Despacho do Presidente da República

-

Despachos criados por mim

+

Despacho do Presidente da República

+

Despachos criados por mim

{{ despachoprstore.count }} Documentos

-
+
@@ -163,8 +163,8 @@
-

Pedidos de Parecer

-

Pedidos de Parecer solicitados por mim

+

Pedidos de Parecer

+

Pedidos de Parecer solicitados por mim

{{pedidosstore.countparecer}} Documentos

@@ -193,7 +193,7 @@
--> -
+
@@ -208,31 +208,31 @@
-
+
-

Diplomas por Validar

-

Diplomas por Assinar

+

Diplomas por Validar

+

Diplomas por Assinar

{{ deplomasStore.deplomasReviewCount }} Documentos

-
+
-

Diplomas assinados PR

-

Diplomas

+

Diplomas assinados PR

+

Diplomas

{{ deplomasStore.countDiplomasAssinadoListCount }} Documentos

-
+
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index fa90ee7a4..5634ab2ec 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -128,7 +128,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck { private activatedRoute: ActivatedRoute, private router: Router, authService: AuthService, - public p: PermissionService, public waitForDomService: WaitForDomService, //private notificationsService: NotificationsService, private despachoRule: DespachoService, @@ -139,7 +138,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck { public ThemeService: ThemeService, private sortService: SortService, private dataService: DataService, - private storage: Storage + private storage: Storage, + public p: PermissionService, ) { this.loggeduser = authService.ValidatedUser; diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html index 9801094f5..4f33afd8d 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html @@ -89,7 +89,7 @@ - +
@@ -99,7 +99,7 @@ - +
@@ -110,14 +110,14 @@ - +
- +
@@ -127,7 +127,7 @@ - +
diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index a520405d6..9802d08ac 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -8,6 +8,7 @@ import { AlertController } from '@ionic/angular'; import { NotificationsService } from 'src/app/services/notifications.service'; import { SessionStore } from 'src/app/store/session.service'; import { ThemeService } from 'src/app/services/theme.service'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ selector: 'app-inactivity', @@ -31,6 +32,7 @@ export class InactivityPage implements OnInit { private toastService: ToastService, public alertController: AlertController, public ThemeService: ThemeService, + public p: PermissionService, ) {} loop = false @@ -115,10 +117,15 @@ export class InactivityPage implements OnInit { if (attempt) { + // if current attemp is equal to the current user if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); - this.authService.loginChat(); + + if(this.p.userPermission(this.p.permissionList.Chat.access)){ + this.authService.loginChat(); + } + this.getToken(); SessionStore.setInativity(true) diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 75492fc7e..295b8e17f 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -44,7 +44,7 @@ export class LoginPage implements OnInit { private changeProfileService: ChangeProfileService, public ThemeService: ThemeService, private storageservice: StorageService, - public permissionService: PermissionService, + public p: PermissionService, ) {} ngOnInit() { @@ -104,11 +104,20 @@ export class LoginPage implements OnInit { // login to API successfully if (attempt) { + if (attempt.UserId == SessionStore.user.UserId) { await this.authService.SetSession(attempt, this.userattempt); - await this.authService.loginChat(); - await this.authService.loginToChatWs(); + + console.log(this.p.userPermission(this.permissionList.Chat.access)); + + + if(this.p.userPermission(this.permissionList.Chat.access)){ + alert('RC IN') + await this.authService.loginChat(); + await this.authService.loginToChatWs(); + } + this.getToken(); SessionStore.setInativity(true); @@ -124,8 +133,11 @@ export class LoginPage implements OnInit { this.changeProfileService.run(); - await this.authService.loginChat(); - await this.authService.loginToChatWs(); + if(this.p.userPermission(this.permissionList.Chat.access)){ + await this.authService.loginChat(); + await this.authService.loginToChatWs(); + } + this.getToken(); this.router.navigateByUrl('/pin', { replaceUrl: true }); @@ -149,13 +161,13 @@ export class LoginPage implements OnInit { if(pathName) { this.router.navigate([pathName]); } else { - if(this.permissionService.userPermission(this.permissionList.Agenda.access) || this.permissionService.userPermission(this.permissionList.Gabinete.access)){ + if(this.p.userPermission(this.permissionList.Agenda.access) || this.p.userPermission(this.permissionList.Gabinete.access)){ this.router.navigate(['/home/events']); } - else if(this.permissionService.userPermission(this.permissionList.Chat.access) && this.permissionService.userPermission(this.permissionList.Actions.access)){ + else if(this.p.userPermission(this.permissionList.Chat.access) && this.p.userPermission(this.permissionList.Actions.access)){ this.router.navigate(['/home/chat']); } - else if(this.permissionService.userPermission(this.permissionList.Actions.access)){ + else if(this.p.userPermission(this.permissionList.Actions.access)){ this.router.navigate(['/home/publications']); } } diff --git a/src/app/pages/publications/publication-detail/publication-detail.page.html b/src/app/pages/publications/publication-detail/publication-detail.page.html index ea16990a6..d778e071d 100644 --- a/src/app/pages/publications/publication-detail/publication-detail.page.html +++ b/src/app/pages/publications/publication-detail/publication-detail.page.html @@ -56,12 +56,12 @@ - + - + diff --git a/src/app/pages/publications/publication-detail/publication-detail.page.ts b/src/app/pages/publications/publication-detail/publication-detail.page.ts index 17681b2cc..84b8746e0 100644 --- a/src/app/pages/publications/publication-detail/publication-detail.page.ts +++ b/src/app/pages/publications/publication-detail/publication-detail.page.ts @@ -10,6 +10,7 @@ import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service' import { RouteService } from 'src/app/services/route.service'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ selector: 'app-publication-detail', @@ -31,7 +32,8 @@ export class PublicationDetailPage implements OnInit { private RouteService: RouteService, private sqliteservice: SqliteService, private backgroundservice: BackgroundService, - public ThemeService: ThemeService ) { + public ThemeService: ThemeService, + public p:PermissionService ) { this.publicationId = this.navParams.get('publicationId'); /* this.folderId = this.navParams.get('folderIdId'); */ diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html index 3abc2e9ec..622dd150e 100644 --- a/src/app/pages/publications/publications.page.html +++ b/src/app/pages/publications/publications.page.html @@ -25,7 +25,7 @@ Acções Presidenciais
- @@ -92,14 +92,14 @@
- + - + diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index 77f1df29a..4baeee66c 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -15,6 +15,7 @@ import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service' import { Storage } from '@ionic/storage'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ @@ -68,7 +69,8 @@ export class PublicationsPage implements OnInit { private backgroundservice: BackgroundService, private platform: Platform, public ThemeService: ThemeService, - private storage: Storage + private storage: Storage, + public p: PermissionService, ) { this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html index dd6e0bbb6..7b06bd70d 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html @@ -61,12 +61,12 @@ - + - + diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts index 15afbe6e2..9929de9ef 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts @@ -10,6 +10,7 @@ import { Location } from '@angular/common'; import { ThemeService } from 'src/app/services/theme.service' import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { RouteService } from 'src/app/services/route.service'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ selector: 'app-publication-detail', @@ -31,7 +32,8 @@ export class PublicationDetailPage implements OnInit { private activatedRoute: ActivatedRoute, private router: Router, private RouteService: RouteService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + public p:PermissionService, ) { this.activatedRoute.paramMap.subscribe(params => { 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 847b460c5..8ed7372e8 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.html +++ b/src/app/pages/publications/view-publications/view-publications.page.html @@ -15,7 +15,7 @@

{{item.Detail}}

-
+
@@ -33,7 +33,9 @@ -->
- +
@@ -57,10 +59,10 @@ *ngFor="let publication of getpublication" (click)="goToPublicationDetail(publication.DocumentId)" > - +
- +
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 b8c63dfb3..5a7bb8264 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -12,6 +12,7 @@ import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service' import { forkJoin } from 'rxjs'; import { ToastService } from 'src/app/services/toast.service'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ selector: 'app-view-publications', @@ -42,7 +43,8 @@ export class ViewPublicationsPage implements OnInit { private sqliteservice: SqliteService, private backgroundservice: BackgroundService, public ThemeService: ThemeService, - private toastService: ToastService,) { + private toastService: ToastService, + public p: PermissionService,) { this.item = new PublicationFolder(); this.activatedRoute.paramMap.subscribe(params => { @@ -259,7 +261,7 @@ export class ViewPublicationsPage implements OnInit { publicationArray.push(publicationlis); }); - + this.publicationList = publicationArray; }) } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index b3348d24f..5a3e6e3e1 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -19,6 +19,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service'; import { RoomService } from './chat/room.service'; import { Storage } from '@ionic/storage'; import { InitialsService } from './functions/initials.service'; +import { PermissionService } from './permission.service'; @Injectable({ providedIn: 'root' @@ -46,16 +47,17 @@ export class AuthService { private processesService: ProcessesService, private AttachmentsService: AttachmentsService, private storage: Storage, - private initialsService: InitialsService ) { + private initialsService: InitialsService, + public p: PermissionService, ) { this.headers = new HttpHeaders(); if (SessionStore.exist) { this.ValidatedUser = SessionStore.user - // console.log('login', SessionStore.user.RochetChatUser, SessionStore.user.Password) - this.loginToChatWs() - + if(this.p.userPermission(this.p.permissionList.Chat.access) == true ){ + this.loginToChatWs() + } } if (localStorage.getItem("userChat") != null) { diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index f2c3d780d..afbefda73 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -86,86 +86,86 @@ export class NotificationsService { } requestPermissions() { - // PushNotifications.requestPermissions().then(result => { - // if (result.receive === 'granted') { - // // Register with Apple / Google to receive push via APNS/FCM - // PushNotifications.register(); - // } else { - // // Show some error - // } - // }); + PushNotifications.requestPermissions().then(result => { + if (result.receive === 'granted') { + // Register with Apple / Google to receive push via APNS/FCM + PushNotifications.register(); + } else { + // Show some error + } + }); } getAndpostToken(username) { - // if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - // console.log('Notifications not supported') - // } else { - // const geturl = environment.apiURL + 'notifications/token'; - // PushNotifications.addListener('registration', - // (token: Token) => { - // console.log('token: ', token.value) - // this.storageService.store(username, token.value); - // this.storageService.get(username).then(value => { - // console.log('STORAGE TOKEN', value) - // this.storageService.get(AuthConnstants.USER).then(res => { - // console.log('USERID', res); - // const headers = { 'Authorization': SessionStore.user.BasicAuthKey }; - // const body = { - // UserId: res.UserId, - // TokenId: token.value, - // Status: 1, - // Service: 1 - // }; + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + console.log('Notifications not supported') + } else { + const geturl = environment.apiURL + 'notifications/token'; + PushNotifications.addListener('registration', + (token: Token) => { + console.log('token: ', token.value) + this.storageService.store(username, token.value); + this.storageService.get(username).then(value => { + console.log('STORAGE TOKEN', value) + this.storageService.get(AuthConnstants.USER).then(res => { + console.log('USERID', res); + const headers = { 'Authorization': SessionStore.user.BasicAuthKey }; + const body = { + UserId: res.UserId, + TokenId: token.value, + Status: 1, + Service: 1 + }; - // this.http.post(`${geturl}`, body, { headers }).subscribe(data => { - // console.log('TOKEN USER MIDLE', data); - // }, (error) => { - // console.log('Post token to backend', error) - // }) - // }); + this.http.post(`${geturl}`, body, { headers }).subscribe(data => { + console.log('TOKEN USER MIDLE', data); + }, (error) => { + console.log('Post token to backend', error) + }) + }); - // }); - // } - // ); - // } + }); + } + ); + } } registrationError() { - // PushNotifications.addListener('registrationError', - // (error: any) => { - // console.log('Error on registration: ' + JSON.stringify(error)); - // } - // ); + PushNotifications.addListener('registrationError', + (error: any) => { + console.log('Error on registration: ' + JSON.stringify(error)); + } + ); } onReciveForeground() { - // PushNotifications.addListener('pushNotificationReceived', - // (notification: PushNotificationSchema) => { - // console.log('Push received: ' + JSON.stringify(notification)); - // this.DataArray.push(notification) - // console.log("On ReceiveNotification", this.DataArray) - // this.storageService.store("Notifications", this.DataArray) - // this.eventtrigger.publishSomeData({ - // notification: "recive" - // }) - // } - // ); + PushNotifications.addListener('pushNotificationReceived', + (notification: PushNotificationSchema) => { + console.log('Push received: ' + JSON.stringify(notification)); + this.DataArray.push(notification) + console.log("On ReceiveNotification", this.DataArray) + this.storageService.store("Notifications", this.DataArray) + this.eventtrigger.publishSomeData({ + notification: "recive" + }) + } + ); } onReciveBackground() { - // PushNotifications.addListener('pushNotificationActionPerformed', - // (notification: ActionPerformed) => { - // console.log('Push action performed: ' + JSON.stringify(notification)); - // /* this.DataArray.push(notification.notification) - // console.log("On ReceiveNotification", this.DataArray) - // this.storageService.store("Notifications", this.DataArray) - // this.eventtrigger.publishSomeData({ - // notification: "recive" - // }) */ - // this.notificatinsRoutes(notification) - // } - // ); + PushNotifications.addListener('pushNotificationActionPerformed', + (notification: ActionPerformed) => { + console.log('Push action performed: ' + JSON.stringify(notification)); + /* this.DataArray.push(notification.notification) + console.log("On ReceiveNotification", this.DataArray) + this.storageService.store("Notifications", this.DataArray) + this.eventtrigger.publishSomeData({ + notification: "recive" + }) */ + this.notificatinsRoutes(notification) + } + ); } tempClearArray() { @@ -175,51 +175,51 @@ export class NotificationsService { notificatinsRoutes = (notification) => { - // console.log('Push action performed 2222: ' + JSON.stringify(notification.data)); + console.log('Push action performed 2222: ' + JSON.stringify(notification.data)); - // if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) { - // console.log("Id Lenght", notification.notification.data.IdObject.length) - // this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda'])); - // } - // else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expediente") { - // this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital'])); - // } - // else if (notification.notification.data.Service === "agenda" && notification.notification.data.Object === "event-list") { - // //this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda'])); - // this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.notification.data.IdObject, 'agenda'])); + if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) { + console.log("Id Lenght", notification.notification.data.IdObject.length) + this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expediente") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "agenda" && notification.notification.data.Object === "event-list") { + //this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda'])); + this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.notification.data.IdObject, 'agenda'])); - // } else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") { + } else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") { - // this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true })); - // } - // else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true })); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") { - // this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); - // } - // else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") { - // this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); - // } - // else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") { - // this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital'])); - // } - // else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") { - // this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject])); - // } - // else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") { - // this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject])); - // } - // else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") { - // this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital'])); - // } - // else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") { + this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject])); + } + else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") { + this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") { - // this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital'])); - // } - // else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") { - // this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital'])); - // } + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital'])); + } } diff --git a/src/app/services/permission.service.ts b/src/app/services/permission.service.ts index a02dd401a..b0ebcf48f 100644 --- a/src/app/services/permission.service.ts +++ b/src/app/services/permission.service.ts @@ -1,4 +1,5 @@ import { Injectable } from '@angular/core'; +import { PermissionList } from '../models/permission/permissionList'; import { SessionStore } from '../store/session.service'; @Injectable({ @@ -6,6 +7,7 @@ import { SessionStore } from '../store/session.service'; }) export class PermissionService { + permissionList = new PermissionList(); SessionStore = SessionStore constructor() { } diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 5c0223cfb..3b014bc37 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -156,9 +156,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } ngOnInit() { - console.log(this.roomId); - this.loggedUser = this.loggedUserChat; - this.loggedUser=this.loggedUserChat; setTimeout(() => { this.getRoomInfo(); @@ -168,7 +165,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe VoiceRecorder.requestAudioRecordingPermission(); this.deleteRecording(); this.loadFiles(); - } showDateDuration(start: any) { diff --git a/src/app/shared/popover/deploma-options/deploma-options.page.ts b/src/app/shared/popover/deploma-options/deploma-options.page.ts index f388b9636..9ba87b910 100644 --- a/src/app/shared/popover/deploma-options/deploma-options.page.ts +++ b/src/app/shared/popover/deploma-options/deploma-options.page.ts @@ -8,6 +8,7 @@ import { ProcessesService } from 'src/app/services/processes.service'; import { ToastService } from 'src/app/services/toast.service'; import { Location } from '@angular/common'; import { RouteService } from 'src/app/services/route.service'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ selector: 'app-deploma-options', @@ -23,7 +24,8 @@ export class DeplomaOptionsPage implements OnInit { fulltask: any - constructor(public popoverController: PopoverController, + constructor( + public popoverController: PopoverController, private modalController: ModalController, private activatedRoute: ActivatedRoute, private processes: ProcessesService, @@ -31,7 +33,8 @@ export class DeplomaOptionsPage implements OnInit { private toastService: ToastService, private router: Router, private deplomaService: DeplomaService, - private RouteService: RouteService) { + private RouteService: RouteService, + public p: PermissionService,) { this.serialNumber = this.navParams.get('serialNumber'); this.task = this.navParams.get('task'); this.fulltask = this.navParams.get('fulltask'); @@ -138,7 +141,7 @@ export class DeplomaOptionsPage implements OnInit { modal.onDidDismiss(); } - + async askSignature(note:string, documents:any) { let body = { "serialNumber": this.serialNumber, @@ -162,7 +165,7 @@ export class DeplomaOptionsPage implements OnInit { loader.remove() } - } + } async sign(note:string, documents:any) { diff --git a/src/app/shared/popover/despachos-options/despachos-options.page.html b/src/app/shared/popover/despachos-options/despachos-options.page.html index 1a33fae72..7e0840c6a 100644 --- a/src/app/shared/popover/despachos-options/despachos-options.page.html +++ b/src/app/shared/popover/despachos-options/despachos-options.page.html @@ -28,7 +28,7 @@
- +
@@ -40,7 +40,7 @@
- +
@@ -51,7 +51,7 @@
- +
@@ -60,7 +60,7 @@
- +
diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html index f46731c61..1bf5ad3aa 100644 --- a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html @@ -9,27 +9,27 @@
- - - - - - + + + + + +
- + - - + +
- - - - + + + +
diff --git a/src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page.html b/src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page.html index d4515ed1b..34f938ca0 100644 --- a/src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page.html +++ b/src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page.html @@ -8,7 +8,7 @@
-
+
@@ -17,7 +17,7 @@
-
+
diff --git a/src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page.ts b/src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page.ts index fb91e2029..ba8850156 100644 --- a/src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page.ts +++ b/src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page.ts @@ -15,6 +15,7 @@ import { ToastService } from 'src/app/services/toast.service'; import { Location } from '@angular/common' import { ThemeService } from 'src/app/services/theme.service' import { RouteService } from 'src/app/services/route.service'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ selector: 'app-opts-expediente-pr', @@ -51,7 +52,8 @@ export class OptsExpedientePrPage implements OnInit { private animationController: AnimationController, private toastService: ToastService, private RouteService: RouteService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + public p: PermissionService, ) { diff --git a/src/app/shared/popover/opts-expediente/opts-expediente.page.html b/src/app/shared/popover/opts-expediente/opts-expediente.page.html index c8a439597..c10130669 100644 --- a/src/app/shared/popover/opts-expediente/opts-expediente.page.html +++ b/src/app/shared/popover/opts-expediente/opts-expediente.page.html @@ -6,27 +6,27 @@
-
+
- - - - - + + + + +
- - - + + + - +
-
+
diff --git a/src/app/shared/popover/request-options/request-options.page.html b/src/app/shared/popover/request-options/request-options.page.html index d76118df8..eab5b99a6 100644 --- a/src/app/shared/popover/request-options/request-options.page.html +++ b/src/app/shared/popover/request-options/request-options.page.html @@ -7,7 +7,7 @@ - +
@@ -18,7 +18,7 @@ - +
@@ -30,7 +30,7 @@ - +
@@ -39,8 +39,8 @@
- - + + @@ -51,7 +51,7 @@ - +
diff --git a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html index 42a9de4f1..25b3c03a0 100644 --- a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html +++ b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html @@ -56,12 +56,12 @@ - + - + diff --git a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts index f9e8f9f19..798297717 100644 --- a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts +++ b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts @@ -9,6 +9,7 @@ import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.p import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { ThemeService } from 'src/app/services/theme.service' import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; +import { PermissionService } from 'src/app/services/permission.service'; @Component({ selector: 'app-publication-detail-shared', @@ -31,7 +32,8 @@ export class PublicationDetailPage implements OnInit { private publications:PublicationsService, private animationController: AnimationController, private toastService: ToastService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + public p:PermissionService, ) { /* this.folderId = this.navParams.get('folderIdId'); */ diff --git a/src/app/shared/publication/view-publications/view-publications.page.html b/src/app/shared/publication/view-publications/view-publications.page.html index 81573e3ce..4d2b13b4b 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.html +++ b/src/app/shared/publication/view-publications/view-publications.page.html @@ -11,11 +11,11 @@
- -