Prechádzať zdrojové kódy

Merge branch 'master' of https://git.swopt.com/swopt/fisapp-ui into swopt-eLeave

tigger 2 mesiacov pred
rodič
commit
8518a74cde

+ 3 - 1
src/app/dashboard/dashboard.component.html

@@ -19,7 +19,9 @@
             <mat-divider></mat-divider>
             <div class="dashitems">
               <leave-submission-dashitem></leave-submission-dashitem>
-              <leave-approval-dashitem></leave-approval-dashitem>
+              @if (accessRight.leave?.approval|async) {
+                <leave-approval-dashitem></leave-approval-dashitem>
+              }
               <leave-info-dashitem></leave-info-dashitem>
             </div>
           </div>

+ 14 - 18
src/app/dashboard/dashboard.component.ts

@@ -1,23 +1,19 @@
 import { Component, computed, inject, OnInit, Signal } from '@angular/core';
 import { RouterModule } from '@angular/router';
-import { BaseComponent } from 'angularlib/base.component';
+import { BaseComponent, untilDestroy } from 'angularlib/base.component';
 import { LoginModule } from 'angularlib/login';
 import { Store } from '@ngxs/store';
 import { LoginService } from 'angularlib/login/login.service';
-import { MasterMenuComponent } from 'angularlib/menu/master.menu/master.menu.component';
 import { CommonModule } from '@angular/common';
 import { ComponentService } from 'angularlib/component.service';
 import { LabelModule } from 'angularlib/labels/label.module';
 import { masterMenu } from '../menu/menu';
 import { InputModule } from 'angularlib/input/input.module';
 import { EventI } from 'fis-commons/event/event';
-import { DashboardItemComponent } from 'angularlib/dashboard/dashboard-item/dashboard-item.component';
 import { LeaveModule } from 'fis/leave';
-import { MatDivider } from "@angular/material/divider";
 import { MatModule } from 'angularlib/mat.module';
 import { TenderModule } from 'fis/tender/tender.module';
 import { FISAccess } from 'fis/fis.access';
-import { FISMessaging } from 'fis/index';
 
 @Component({
     selector: 'spts-sales-submission-dashitem',
@@ -27,12 +23,11 @@ import { FISMessaging } from 'fis/index';
         MatModule,
         LoginModule,
         LabelModule,
-        MasterMenuComponent,
         InputModule,
         LeaveModule,
         TenderModule
     ],
-    providers: [ComponentService, FISAccess],
+    providers: [ComponentService],
     templateUrl: './dashboard.component.html',
     styleUrl: './dashboard.component.scss'
 })
@@ -44,9 +39,7 @@ export class DashboardComponent extends BaseComponent implements OnInit{
     return GIVEN_NAME || FIS_NAME;
   });
   protected access = inject(FISAccess);
-  protected hasAccess = {
-    leaveApproval: false
-  };
+  protected accessRight:any = {};
 
   protected goto = {
     field: {
@@ -94,13 +87,16 @@ export class DashboardComponent extends BaseComponent implements OnInit{
 
   ngOnInit(): void {
     super.ngOnInit();
-    const run = async () => {
-      const leaveApproval = await this.access.canActivate({data:{serviceId:'09 - Leave Application',accessRight:['canread','canapprove'],noprompt:true}},undefined);
-      this.hasAccess = {
-        ...this.hasAccess,
-        leaveApproval: leaveApproval
-      };
-    }
-    run();
+  }
+  
+  ngAfterViewInit() {
+    this.loginService.user$.pipe(untilDestroy(this)).subscribe({
+      next: res => {
+        this.accessRight = {
+          ...this.accessRight,
+          leave: {approval: this.access.canActivate({data:{serviceId:'09 - Leave Application',accessRight:['canread','canapprove'],noprompt:true}},undefined)}
+        };
+      }
+    })
   }
 }

+ 1 - 1
src/dependencies/fis

@@ -1 +1 @@
-Subproject commit a758ba54267c04106738f2fa1c2b14bb1dfb0039
+Subproject commit 135f715385281850c5b45d799d0493eeb8f3b72f