This commit is contained in:
tiago.kayaya
2022-03-28 13:34:01 +01:00
parent dd488c32e3
commit 80ddf8c764
6 changed files with 99 additions and 39 deletions
+43 -31
View File
@@ -1,39 +1,51 @@
<ion-tabs class="tab"> <ion-tabs class="tab">
<ion-tab-bar class="bottoms" slot="bottom"> <ion-tab-bar class="bottoms" slot="bottom">
<ion-tab-button tab="events" [class.active]="pathname === '/home/events' ">
<!-- <ion-icon name="home"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/events'" class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/events'" class="nav-icon" src="assets/images/nav-hover/icons-nav-home-active.svg"></ion-icon>
<!-- <ion-badge color="danger">{{toDayEventStorage.eventsList.length + expedienteGdStore.count}}</ion-badge> -->
<ion-label>Início</ion-label>
</ion-tab-button>
<ion-tab-button tab="agenda" [class.active]="pathname === '/home/agenda' ">
<!-- <ion-icon name="calendar"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/agenda'" class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/agenda'" class="nav-icon" src="assets/images/nav-hover/icons-nav-agenda-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Agenda</ion-label>
</ion-tab-button>
<ion-tab-button (click)="goto('/home/gabinete-digital')" [class.active]="pathname === '/home/gabinete-digital' ">
<!-- <ion-icon name="file-tray-stacked"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/gabinete-digital'" class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/gabinete-digital'" class="nav-icon" src="assets/images/nav-hover/icons-nav-gabinete-active.svg"></ion-icon>
<!-- <ion-badge color="danger" *ngIf="!p.userRole(['PR'])" >{{ documentCounterService.mdTotalDocument }}</ion-badge>
<ion-badge color="danger" *ngIf="p.userRole(['PR'])" >{{ documentCounterService.prTotalDocument }}</ion-badge> -->
<ion-label>Gabinete</ion-label>
</ion-tab-button>
<ion-tab-button tab="publications" [class.active]="pathname === '/home/publications' "> <ion-tab-button tab="events" [class.active]="pathname === '/home/events'">
<ion-icon *ngIf="pathname != '/home/publications'" class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon> <!-- <ion-icon name="home"></ion-icon> -->
<ion-icon *ngIf="pathname == '/home/publications'" class="nav-icon" src="assets/images/nav-hover/icons-nav-actions-active.svg"></ion-icon> <ion-icon *ngIf="pathname != '/home/events'" class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Ações</ion-label> <ion-icon *ngIf="pathname == '/home/events'" class="nav-icon" src="assets/images/nav-hover/icons-nav-home-active.svg"></ion-icon>
</ion-tab-button> <!-- <ion-badge color="danger">{{toDayEventStorage.eventsList.length + expedienteGdStore.count}}</ion-badge> -->
<ion-tab-button tab="chat" [class.active]="pathname === '/home/chat' "> <ion-label>Início</ion-label>
<ion-icon *ngIf="pathname != '/home/chat'" class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon> </ion-tab-button>
<ion-icon *ngIf="pathname == '/home/chat'" class="nav-icon" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon>
<ion-label>Chat</ion-label> <div *ngFor="let permission of user.UserPermissions">
</ion-tab-button> <ion-tab-button *ngIf="permission == 530" tab="agenda" [class.active]="pathname === '/home/agenda' ">
<!-- <ion-icon name="calendar"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/agenda'" class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/agenda'" class="nav-icon" src="assets/images/nav-hover/icons-nav-agenda-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Agenda</ion-label>
</ion-tab-button>
</div>
<div *ngFor="let permission of user.UserPermissions">
<ion-tab-button *ngIf="permission == 531" (click)="goto('/home/gabinete-digital')" [class.active]="pathname === '/home/gabinete-digital' ">
<!-- <ion-icon name="file-tray-stacked"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/gabinete-digital'" class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/gabinete-digital'" class="nav-icon" src="assets/images/nav-hover/icons-nav-gabinete-active.svg"></ion-icon>
<!-- <ion-badge color="danger" *ngIf="!p.userRole(['PR'])" >{{ documentCounterService.mdTotalDocument }}</ion-badge>
<ion-badge color="danger" *ngIf="p.userRole(['PR'])" >{{ documentCounterService.prTotalDocument }}</ion-badge> -->
<ion-label>Gabinete</ion-label>
</ion-tab-button>
</div>
<div *ngFor="let permission of user.UserPermissions">
<ion-tab-button *ngIf="permission == 534" tab="publications" [class.active]="pathname === '/home/publications' ">
<ion-icon *ngIf="pathname != '/home/publications'" class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/publications'" class="nav-icon" src="assets/images/nav-hover/icons-nav-actions-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Ações</ion-label>
</ion-tab-button>
</div>
<div *ngFor="let permission of user.UserPermissions">
<ion-tab-button *ngIf="permission == 541" tab="chat" [class.active]="pathname === '/home/chat' ">
<ion-icon *ngIf="pathname != '/home/chat'" class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/chat'" class="nav-icon" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon>
<ion-label>Chat</ion-label>
</ion-tab-button>
</div>
</ion-tab-bar> </ion-tab-bar>
</ion-tabs> </ion-tabs>
+7 -1
View File
@@ -30,6 +30,7 @@ import { WsChatService } from 'src/app/services/chat/ws-chat.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { NativeNotificationService } from 'src/app/services/native-notification.service'; import { NativeNotificationService } from 'src/app/services/native-notification.service';
import { UserSession } from '../models/user.model';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@@ -79,6 +80,7 @@ export class HomePage implements OnInit {
status: string = ""; status: string = "";
audioName: string = ""; audioName: string = "";
public user: UserSession;
constructor( constructor(
private router: Router, private router: Router,
@@ -102,7 +104,11 @@ export class HomePage implements OnInit {
private sqliteservice: SqliteService, private sqliteservice: SqliteService,
public RouteService: RouteService, public RouteService: RouteService,
private WsChatService: WsChatService, private WsChatService: WsChatService,
private NativeNotificationService: NativeNotificationService,) { private NativeNotificationService: NativeNotificationService) {
if (SessionStore.exist) {
this.user = SessionStore.user;
}
/* this.webNotificationPopupService.askNotificationPermission() */ /* this.webNotificationPopupService.askNotificationPermission() */
+8 -1
View File
@@ -18,6 +18,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { AttachmentsService } from 'src/app/services/attachments.service'; import { AttachmentsService } from 'src/app/services/attachments.service';
import { RoomService } from './chat/room.service'; import { RoomService } from './chat/room.service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { InitialsService } from './functions/initials.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -44,7 +45,8 @@ export class AuthService {
private NfService:NfService, private NfService:NfService,
private processesService: ProcessesService, private processesService: ProcessesService,
private AttachmentsService: AttachmentsService, private AttachmentsService: AttachmentsService,
private storage: Storage ) { private storage: Storage,
private initialsService: InitialsService ) {
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
@@ -74,6 +76,8 @@ export class AuthService {
try { try {
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise(); response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
console.log(response);
if(saveSession) { if(saveSession) {
this.SetSession(response, user) this.SetSession(response, user)
} }
@@ -94,6 +98,9 @@ export class AuthService {
} else if(session.RoleID == 100000011) { } else if(session.RoleID == 100000011) {
session.Profile = 'MDGPR' session.Profile = 'MDGPR'
} }
else{
session.Profile = this.initialsService.getInitials(session.FullName);
}
session.Password = user.password session.Password = user.password
session.RochetChatUser = user.username.split('@')[0] session.RochetChatUser = user.username.split('@')[0]
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { InitialsService } from './initials.service';
describe('InitialsService', () => {
let service: InitialsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(InitialsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class InitialsService {
constructor() { }
getInitials(name:string){
let names = name.split(' '),
initials = names[0].substring(0, 1).toUpperCase();
if (names.length > 1) {
initials += names[names.length - 1].substring(0, 1).toUpperCase();
}
return initials;
}
}
+5 -4
View File
@@ -4,11 +4,12 @@
export const environment = { export const environment = {
production: false, production: false,
apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', /* apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/',
apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', */
//apiChatUrl: 'https://www.tabularium.pt/api/v1/', apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
apiChatUrl: 'https://www.tabularium.pt/api/v1/',
apiWsChatUrl: 'wss://www.tabularium.pt/websocket',
/* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */ /* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */
domain: 'gabinetedigital.local', //gabinetedigital.local domain: 'gabinetedigital.local', //gabinetedigital.local
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local