diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index d730cc84d..eaeeb0def 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -1,5 +1,5 @@ - + diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index aa3f2a3d8..81c726623 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -102,12 +102,19 @@ - - - @@ -218,11 +225,11 @@
-
Calendário do MDGPR
+
Calendário do MDGPR
-
Calendário do Presidente da República
+
Calendário do Presidente da República
diff --git a/src/app/pages/agenda/agenda.page.scss b/src/app/pages/agenda/agenda.page.scss index 39eab29b1..fc57c4e31 100644 --- a/src/app/pages/agenda/agenda.page.scss +++ b/src/app/pages/agenda/agenda.page.scss @@ -857,3 +857,26 @@ $font-size: 11pt; } } +.calendar-letters { + width: 36px; + height: 36px; + background-color: #f05d5e; + border-radius: 44px; + text-align: center; + align-items: center; + display: flex; + justify-content: center; + margin-top: -3px; + border: 1.5px solid black; + color: white; + .text{ + + } +} + + +.cal-reverse { + background: white !important; + color: black !important; + border-color: #f05d5e !important; +} \ No newline at end of file diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 512fb4bb4..91328044d 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -32,6 +32,7 @@ import { ChangeProfileService } from 'src/app/services/change-profile.service'; 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 { SessionStore } from 'src/app/store/session.service'; @Component({ @@ -163,6 +164,8 @@ export class AgendaPage implements OnInit { listToPresent array = [] + sessionStore = SessionStore; + constructor( private alertCtrl: AlertController, @Inject(LOCALE_ID) private locale: string, diff --git a/src/app/pages/agenda/view-event/view-event.page.ts b/src/app/pages/agenda/view-event/view-event.page.ts index 5901b2415..cf1ef745d 100644 --- a/src/app/pages/agenda/view-event/view-event.page.ts +++ b/src/app/pages/agenda/view-event/view-event.page.ts @@ -261,8 +261,6 @@ export class ViewEventPage implements OnInit { }); } else { - - alert('generic delete') this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => { const alert = await this.alertController.create({ diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 295b8e17f..a89589370 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -154,6 +154,8 @@ export class LoginPage implements OnInit { else { this.toastService._badRequest('Por favor, insira o seu nome de utilizador'); } + + } goback() { diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 5a3e6e3e1..4a8ecd238 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -132,6 +132,8 @@ export class AuthService { return true; } + + this.initialsService.getInitials(session.FullName); } //Login to rocketChat server2 @@ -298,8 +300,8 @@ export class AuthService { this.userData$.next(''); this.router.navigate(['']); }) */ - } + async presentAlert(message: string) { const alert = await this.alertController.create({ cssClass: 'my-custom-class', diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index cccf6fe89..d2512f28f 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -6,6 +6,7 @@ import { StorageService } from './storage.service'; import { HttpClient, HttpHeaderResponse } from '@angular/common/http'; import { environment } from 'src/environments/environment'; import { Storage } from '@ionic/storage'; +import { PermissionService } from './permission.service'; @Injectable({ @@ -29,15 +30,19 @@ export class ChatService { private authService: AuthService, private storage: Storage, private storageService:StorageService, + public p: PermissionService, ) { this.loggedUserChat = authService.ValidatedUserChat; this.headers = new HttpHeaders(); - this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId); - this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken); - this.options = { - headers: this.headers, - }; + + if(this.p.userPermission(this.p.permissionList.Chat.access)) { + this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId); + this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken); + this.options = { + headers: this.headers, + }; + } } diff --git a/src/app/services/permission.service.ts b/src/app/services/permission.service.ts index b0ebcf48f..cbd725923 100644 --- a/src/app/services/permission.service.ts +++ b/src/app/services/permission.service.ts @@ -35,6 +35,23 @@ export class PermissionService { return false; } + userPermissionCount(args) { + if(!Array.isArray(args)) { + args = [args] + } + + let count = 0 + + for(let permission of (this.SessionStore.user.UserPermissions || [])) { + if (args.includes(permission)) { + count++; + } + } + + + return count; + } + role(args: any) { let UserRoleIsValid = this.userRole(args) diff --git a/src/app/store/session.service.ts b/src/app/store/session.service.ts index 28d3af251..e4b2a691d 100644 --- a/src/app/store/session.service.ts +++ b/src/app/store/session.service.ts @@ -95,6 +95,18 @@ class SessionService { }) } + + + get getInitials() { + let names = this._user.FullName.split(' ') || ' ', + initials = names[0].substring(0, 1).toUpperCase(); + if (names.length > 1) { + initials += names[names.length - 1].substring(0, 1).toUpperCase(); + } + + return initials; + } + }