diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html
index 20503ed16..c340f97bc 100644
--- a/src/app/home/home.page.html
+++ b/src/app/home/home.page.html
@@ -1,39 +1,51 @@
-
-
-
-
-
- Início
-
-
-
-
-
- Agenda
-
-
-
-
-
-
- Gabinete
-
-
-
-
- Ações
-
-
-
-
- Chat
-
+
+
+
+
+
+ Início
+
+
+
+
+
+
+
+ Agenda
+
+
+
+
+
+
+
+
+
+ Gabinete
+
+
+
+
+
+
+ Ações
+
+
+
+
+
+
+
+ Chat
+
+
+
diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts
index a55b4459b..a6e8ca9d9 100644
--- a/src/app/home/home.page.ts
+++ b/src/app/home/home.page.ts
@@ -30,6 +30,7 @@ import { WsChatService } from 'src/app/services/chat/ws-chat.service';
import { environment } from 'src/environments/environment';
import { v4 as uuidv4 } from 'uuid'
import { NativeNotificationService } from 'src/app/services/native-notification.service';
+import { UserSession } from '../models/user.model';
@Component({
selector: 'app-home',
@@ -79,6 +80,7 @@ export class HomePage implements OnInit {
status: string = "";
audioName: string = "";
+ public user: UserSession;
constructor(
private router: Router,
@@ -102,12 +104,16 @@ export class HomePage implements OnInit {
private sqliteservice: SqliteService,
public RouteService: RouteService,
private WsChatService: WsChatService,
- private NativeNotificationService: NativeNotificationService,) {
+ private NativeNotificationService: NativeNotificationService) {
+
+ if (SessionStore.exist) {
+ this.user = SessionStore.user;
+ }
/* this.webNotificationPopupService.askNotificationPermission() */
this.NativeNotificationService.askForPermission()
-
+
this.router.events.subscribe((val) => {
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
document.querySelectorAll('popover-viewport').forEach((e: any) => e.remove())
diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts
index 779457497..b2790df57 100644
--- a/src/app/services/auth.service.ts
+++ b/src/app/services/auth.service.ts
@@ -18,6 +18,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
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';
@Injectable({
providedIn: 'root'
@@ -44,7 +45,8 @@ export class AuthService {
private NfService:NfService,
private processesService: ProcessesService,
private AttachmentsService: AttachmentsService,
- private storage: Storage ) {
+ private storage: Storage,
+ private initialsService: InitialsService ) {
this.headers = new HttpHeaders();
@@ -74,6 +76,8 @@ export class AuthService {
try {
response = await this.http.post(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
+ console.log(response);
+
if(saveSession) {
this.SetSession(response, user)
}
@@ -94,6 +98,9 @@ export class AuthService {
} else if(session.RoleID == 100000011) {
session.Profile = 'MDGPR'
}
+ else{
+ session.Profile = this.initialsService.getInitials(session.FullName);
+ }
session.Password = user.password
session.RochetChatUser = user.username.split('@')[0]
@@ -149,7 +156,7 @@ export class AuthService {
this.WsChatService.connect();
this.WsChatService.login().then((message: any) => {
-
+
SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save()
this.WsChatService.setStatus('online')
diff --git a/src/app/services/functions/initials.service.spec.ts b/src/app/services/functions/initials.service.spec.ts
new file mode 100644
index 000000000..7ecc24a60
--- /dev/null
+++ b/src/app/services/functions/initials.service.spec.ts
@@ -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();
+ });
+});
diff --git a/src/app/services/functions/initials.service.ts b/src/app/services/functions/initials.service.ts
new file mode 100644
index 000000000..3615f4124
--- /dev/null
+++ b/src/app/services/functions/initials.service.ts
@@ -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;
+ }
+}
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 2c9100ef6..79baa6103 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -4,11 +4,12 @@
export const environment = {
production: false,
- apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
- // apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
+ /* apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/',
- apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket',
- //apiChatUrl: 'https://www.tabularium.pt/api/v1/',
+ apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', */
+ 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/', */
domain: 'gabinetedigital.local', //gabinetedigital.local
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local