diff --git a/src/app/guards/inactivity.guard.ts b/src/app/guards/inactivity.guard.ts index e4cd3f7a8..31daa8ec9 100644 --- a/src/app/guards/inactivity.guard.ts +++ b/src/app/guards/inactivity.guard.ts @@ -24,14 +24,22 @@ export class InactivityGuard implements CanActivate { if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events']); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + //If user has access permission to both Chat and Action, goes to Chat by default. + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)) { this.router.navigate(['/home/publications']); - } else { + } + else { this.alertController.create({ cssClass: 'my-custom-class', @@ -57,14 +65,22 @@ export class InactivityGuard implements CanActivate { else { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events']); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + //If user has access permission to both Chat and Action, goes to Chat by default. + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ this.router.navigate(['/home/publications']); - } else { + } + else { this.alertController.create({ cssClass: 'my-custom-class', header: 'Utilizador sem acesso a aplicação', diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index e98262be2..75227f2c7 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -1,8 +1,10 @@ - +
- + + + @@ -39,5 +41,8 @@ + +
+ diff --git a/src/app/home/home.page.scss b/src/app/home/home.page.scss index 2126a0282..a000a1538 100644 --- a/src/app/home/home.page.scss +++ b/src/app/home/home.page.scss @@ -40,12 +40,12 @@ ion-badge {/* */ } -@media only screen and (min-width: 1366px) { +// @media only screen and (min-width: 1366px) { - ion-tabs.tab .bottoms{ - display: none; - } -} +// ion-tabs.tab .bottoms{ +// display: none; +// } +// } ion-tab-button.active{ diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 668efb97f..14c1367ac 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -31,6 +31,9 @@ import { v4 as uuidv4 } from 'uuid' import { NativeNotificationService } from 'src/app/services/native-notification.service'; import { UserSession } from '../models/user.model'; import { PermissionList } from '../models/permission/permissionList'; +import { LoginUserRespose } from 'src/app/models/user.model'; +import { AuthService } from 'src/app/services/auth.service'; + @Component({ @@ -83,12 +86,14 @@ export class HomePage implements OnInit { audioName: string = ""; public user: UserSession; permissionList = new PermissionList(); + loggeduser: LoginUserRespose; + constructor( private router: Router, public modalCtrl: AlertController, private notificationsService: NotificationsService, - private platform: Platform, + public platform: Platform, private activeroute: ActivatedRoute, /* private webnotification: WebNotificationsService, */ public p: PermissionService, @@ -106,8 +111,9 @@ export class HomePage implements OnInit { public RouteService: RouteService, private WsChatService: WsChatService, private NativeNotificationService: NativeNotificationService, + private authService: AuthService, ) { - + this.loggeduser = authService.ValidatedUser; if (SessionStore.exist) { this.user = SessionStore.user; } diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 699ed9fa2..9e6a51349 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -111,7 +111,7 @@ - +
@@ -150,7 +150,7 @@
- +
diff --git a/src/app/pages/events/events.page.ts b/src/app/pages/events/events.page.ts index 752a14fe0..198635280 100644 --- a/src/app/pages/events/events.page.ts +++ b/src/app/pages/events/events.page.ts @@ -248,6 +248,21 @@ export class EventsPage implements OnInit { this.totalEvent = list.length; this.showLoader = false; + } else { + + if(this.loggeduser.OwnerCalendars.length >= 1) { + console.log('OWN caledare') + let onwEvent:any = await this.eventService.getAllOwnEvents(start, end) + this.listToPresent = onwEvent; + this.totalEvent = onwEvent.length; + this.showLoader = false; + } else { + console.log('ELSE') + } + + //if need share calendare + //this.eventService.genericGetAllSharedEvents + } diff --git a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html index 2fb25a676..39f4f7fd9 100644 --- a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html @@ -15,7 +15,7 @@
- + Por validar ... @@ -30,14 +30,14 @@ - +
-
+
- - +
-
-
Lista vazia
- + diff --git a/src/app/pages/inactivity/inactivity.page.ts b/src/app/pages/inactivity/inactivity.page.ts index 9d3c2387d..a6d0d98ef 100644 --- a/src/app/pages/inactivity/inactivity.page.ts +++ b/src/app/pages/inactivity/inactivity.page.ts @@ -205,9 +205,16 @@ export class InactivityPage implements OnInit { setTimeout(()=>{ if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events'], {replaceUrl: true}); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + //If user has access permission to both Chat and Action, goes to Chat by default. + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ @@ -228,9 +235,16 @@ export class InactivityPage implements OnInit { SessionStore.setPin(code); if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events']); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + //If user has access permission to both Chat and Action, goes to Chat by default. + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 655e60d2b..751c3cb26 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -163,9 +163,16 @@ export class LoginPage implements OnInit { this.router.navigate([pathName]); } else { if(this.p.userPermission(this.p.permissionList.Agenda.access) || this.p.userPermission(this.p.permissionList.Gabinete.access)){ - this.router.navigate(['/home/events']); + //When user has got access to Agenda but does not have their own calendar, goes to Agenda + if(this.p.userPermission(this.p.permissionList.Agenda.access) && SessionStore.user.OwnerCalendars.length == 0){ + this.router.navigate(['/home/agenda']); + } + else{ + this.router.navigate(['/home/events']); + } } - else if(this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)){ + //If user has access permission to both Chat and Action, goes to Chat by default. + else if((this.p.userPermission(this.p.permissionList.Chat.access) && this.p.userPermission(this.p.permissionList.Actions.access)) || this.p.userPermission(this.p.permissionList.Chat.access)){ this.router.navigate(['/home/chat']); } else if(this.p.userPermission(this.p.permissionList.Actions.access)){ diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index 8780bb626..6d8ae3d30 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -33,7 +33,7 @@ export class WsChatMethodsService { _dm: RoomService[] = [] _group: RoomService[] = [] - loadingWholeList = false + loadingWholeList = false; dmCount = 0; groupCount = 0; @@ -121,7 +121,7 @@ export class WsChatMethodsService { this._dm = [] this._group = [] - this.loadingWholeList = false + this.loadingWholeList = false; this.dmCount = 0; this.groupCount = 0; @@ -177,13 +177,13 @@ export class WsChatMethodsService { const roomId = this.getRoomId(roomData); if(roomData.t == 'd') { - + const res = await this.chatService.getMembers(roomId).toPromise(); - + const members = res['members']; const users = members.filter(data => data.username != this.loggedUser.me.username); rooms.result.update[index]['members'] = users - + await this.prepareRoom(roomData); } else { if (roomData.t === 'p') { @@ -209,7 +209,7 @@ export class WsChatMethodsService { console.log('save rooms', rooms) await this.storage.set('Rooms', rooms); - + setTimeout(()=>{ this.sortRoomList() }, 1000) @@ -218,7 +218,7 @@ export class WsChatMethodsService { setTimeout(()=>{ this.sortRoomList() }, 10000) - + this.loadingWholeList = false } diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.html b/src/app/shared/gabinete-digital/diplomas/diplomas.page.html index 7b85534a7..c9702e023 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.html @@ -10,7 +10,7 @@
- + Diplomas por validar @@ -23,7 +23,7 @@
-
+
-
+
-
+
@@ -169,6 +169,7 @@
+
diff --git a/src/app/shared/header/header.page.scss b/src/app/shared/header/header.page.scss index 3265696a1..fe999aaa4 100644 --- a/src/app/shared/header/header.page.scss +++ b/src/app/shared/header/header.page.scss @@ -121,16 +121,22 @@ display: none; } -@media only screen and (min-width: 1366px) { +// @media only screen and (min-width: 1366px) { - .mobile{ - display: none !important; - } - .desktop{ - display: block; - } +// .mobile{ +// display: none !important; +// } +// .desktop{ +// display: block; +// } -} +// } +.mobile{ + display: none !important; + } + .desktop{ + display: block; + } .tab{ height: 65px; diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index b91aa2d7a..e61de5c6c 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -39,7 +39,7 @@ export class HeaderPage implements OnInit { private modalController: ModalController, private animationController: AnimationController, private storageservice: StorageService, - private platform: Platform, + public platform: Platform, //private notificationsService: NotificationsService, private eventrigger: EventTrigger, public ThemeService: ThemeService,