This commit is contained in:
Peter Maquiran
2022-04-07 14:24:07 +01:00
parent 34580da026
commit e8ffcca028
10 changed files with 83 additions and 14 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
<ion-tabs class="tab">
<ion-tabs class="tab" *ngIf="p.userPermissionCount([permissionList.Agenda.access, permissionList.Gabinete.access, permissionList.Actions.access, permissionList.Chat.access]) >= 2">
<ion-tab-bar class="bottoms" slot="bottom">
<ion-tab-button *ngIf="p.userPermission([permissionList.Agenda.access]) || p.userPermission([permissionList.Gabinete.access])" tab="events" [class.active]="pathname === '/home/events'">
+11 -4
View File
@@ -103,11 +103,18 @@
</ion-row>
<ion-row class="ion-align-items-center">
<button *ngIf="profile == 'mdgpr' && eventService.calendarOwnerIds.length >= 2 " (click)="changeProfile()" class="d-md-none btn-no-color resize">
<!-- <div *ngIf="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR'" class="calendar-letters"> -->
<div class="calendar-letters cal-reverse" *ngIf="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR' && eventService.calendarOwnerIds.length >= 2" class="calendar-letters" [class.cal-reverse]="loggeduser.Profile != 'PR' && loggeduser.Profile != 'MDGPR' && profile == 'mdgpr' " (click)="changeProfile()">
<div class="text">
{{ sessionStore.getInitials }}
</div>
</div>
<button *ngIf="profile == 'mdgpr' && eventService.calendarOwnerIds.length >= 2 && ( loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR') " (click)="changeProfile()" class="d-md-none btn-no-color resize">
<ion-icon class="right-icons" src="assets/images/icons-profile-calendar-md.svg"></ion-icon>
</button>
<button title="Mudar de Agenda" *ngIf="profile == 'pr'&& eventService.calendarOwnerIds.length >= 2 " (click)="changeProfile()" class="btn-no-color resize">
<button title="Mudar de Agenda" *ngIf="profile == 'pr'&& eventService.calendarOwnerIds.length >= 2 && ( loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR')" (click)="changeProfile()" class="btn-no-color resize">
<ion-icon class="right-icons d-md-none" src="assets/images/icons-profile-calendar-pr.svg"></ion-icon>
</button>
@@ -218,11 +225,11 @@
<div class="calendar-title-container px-20 d-none d-md-flex" *ngIf="loggeduser.Profile == 'MDGPR'">
<div class="calendar-title-description flex-grow-1 text-grey d-flex justify-center align-center">
<div>Calendário do MDGPR</div>
<div *ngIf="loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR'">Calendário do MDGPR</div>
</div>
<div class="calendar-title-description text-black align-center">
<div class="flex-grow-1 text-grey d-flex justify-center align-center">
<div>Calendário do Presidente da República</div>
<div *ngIf="loggeduser.Profile == 'PR' || loggeduser.Profile == 'MDGPR'">Calendário do Presidente da República</div>
</div>
</div>
</div>
+23
View File
@@ -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;
}
+3
View File
@@ -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,
@@ -262,8 +262,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({
cssClass: 'my-custom-class',
+2
View File
@@ -154,6 +154,8 @@ export class LoginPage implements OnInit {
else {
this.toastService._badRequest('Por favor, insira o seu nome de utilizador');
}
}
goback() {
+3 -1
View File
@@ -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',
+5
View File
@@ -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();
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,
};
}
}
+17
View File
@@ -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)
+12
View File
@@ -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;
}
}