|
|
@@ -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)}
|
|
|
+ };
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|