Commit f32c313a authored by hasan khaddour's avatar hasan khaddour

fix side bar

parent 4e3b3a70
<li class="nav-item">
<a class="nav-link " [class.collapsed]="item.haschild" data-bs-target="#components-nav" data-bs-toggle="collapse" href="#">
<a class="nav-link " [class.collapsed]="true" [routerLink]="[item.routing]">
<i class="fe fe-menu"></i><span>{{item.name}}</span><i class="bi bi-chevron-down ms-auto"></i>
</a>
<ul *ngFor="let i of item.child">
<nav-item [item]="i"></nav-item>
</ul>
</li><!-- End Components Nav -->
\ No newline at end of file
......@@ -2,10 +2,15 @@ import { Component, Input } from '@angular/core';
export interface NavItem {
name : string ,
child : NavItem []| null,
haschild:boolean
isCollapsed:boolean
requiredRole : string ,
icon : string ,
isBar :boolean,
queryParams: string
routing : string
}
@Component({
selector: 'nav-item',
templateUrl: './nav-item.component.html',
......
import { NavItem } from "../componenets/nav-item/nav-item.component";
export const sideItems : NavItem[] =[
{
name:'الصفحة الرئيسية',
icon:'fe fe-grid',
routing:'/',
isCollapsed:true,
isBar:false ,
queryParams:'',
requiredRole:'employee'
},
{
name:'المتابعة',
icon:'',
routing:'',
isCollapsed:true,
isBar:true,
requiredRole:'employee',
queryParams:'',
},
{
name:'المتابعات غير المكتملة',
icon:'fe-menu',
routing:'/tracks/uncompleted',
isCollapsed:false,
isBar:false,
requiredRole:'employee',
queryParams:'',
},
{
name:'عمليات المتابعة',
icon:'fe-flag',
routing:'/tracks',
isCollapsed:false,
isBar:false,
requiredRole:'employee',
queryParams:'',
},
{
name:'أنواع المشاريع',
icon:'',
routing:'',
isCollapsed:false,
isBar:true,
requiredRole:'planner',
queryParams:'',
},
{
name:'استعراض أنواع المشاريع',
icon:'fe-map',
routing:'/types',
isCollapsed:false,
isBar:false,
requiredRole:'employee',
queryParams:'',
},
{
name:'إضافة نوع جديد',
icon:'fe-edit-2',
routing:'/types/create',
isCollapsed:false,
isBar:false,
requiredRole:'planner',
queryParams:'',
},
{
name:'الجهات الطارحة',
icon:'',
routing:'',
isCollapsed:false,
isBar:true,
requiredRole:'planner',
queryParams:'',
},
{
name:'استعراض الجهات الطارحة',
icon:'fe-map',
routing:'/customers',
isCollapsed:false,
isBar:false,
requiredRole:'employee',
queryParams:'',
},
{
name:'إضافة جهة طارحة',
icon:'fe-edit-2',
routing:'/customers/create',
isCollapsed:false,
isBar:false,
requiredRole:'planner',
queryParams:'',
},
{
name:'إدارة المشاريع',
icon:'',
routing:'',
isCollapsed:false,
isBar:true,
requiredRole:'employee',
queryParams:''
}
,
{
name:'طرح مشروع',
icon:'fe-plus',
routing:'/projects/create',
isCollapsed:false,
isBar:false,
queryParams:'',
requiredRole:'employee'
},
{
name:'استعراض المشاريع',
icon:'fe-map',
routing:'/projects',
queryParams:"{ listType: 'all'}",
isCollapsed:false,
isBar:false,
requiredRole:'scientific-deputy'
},
{
name:'المشاريع التي أدريرها',
icon:'fe-edit-2',
routing:'/customers/create',
isCollapsed:false,
isBar:false,
queryParams:"{ listType: 'managed'}",
requiredRole:'planner'
},
{
name:'المشاريع التي أرأسها',
icon:'fe-edit-2',
routing:'/customers/create',
isCollapsed:false,
isBar:false,
queryParams:"{ listType: 'leaded'}",
requiredRole:'planner'
},
{
name:'العمل',
icon:'',
routing:'',
isCollapsed:false,
isBar:true,
requiredRole:'employee',
queryParams:''
}
,
{
name:'استعراض مساهماتي',
icon:'fe-plus',
routing:'/projects/create',
isCollapsed:false,
isBar:false,
queryParams:'',
requiredRole:'employee'
},
{
name:'ملفي الشخصي',
icon:'fe-map',
routing:'/projects',
queryParams:"{ listType: 'all'}",
isCollapsed:false,
isBar:false,
requiredRole:'employee'
},
]
\ No newline at end of file
......@@ -2,6 +2,7 @@
<aside dir="rtl" id="sidebar" class="sidebar" [class.toggled]="isToggled">
<ul class="sidebar-nav" id="sidebar-nav">
<li class="nav-item">
<a class="nav-link" [routerLink]="['/']">
<i class="fe fe-grid"></i>
......@@ -11,19 +12,12 @@
<li class="nav-heading">المتابعة</li>
<li class="nav-item">
<a class="nav-link collapsed" data-bs-target="#components-nav" data-bs-toggle="collapse" >
<i class="fe fe-menu"></i><span>إدارة المتابعة</span><i class="bi bi-chevron-down ms-auto"></i>
</a>
<ul id="components-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">
<li>
<a [routerLink]="['/tracks/uncompleted']">
<i class="fe fe-circle"></i><span>المتابعات غير المكتملة</span>
<a class="nav-link collapsed"
[routerLink]="['/tracks/uncompleted']"
>
<i class="fe fe-airplay"></i><span>المتابعات غير المكتملة</span>
</a>
</li>
</ul>
</li><!-- End Components Nav -->
<li class="nav-item">
<a class="nav-link collapsed " [routerLink]="['/tracks']">
......@@ -37,8 +31,14 @@
<i class="fe fe-map"></i><span> استعراض أنواع المشاريع</span>
</a>
</li>
<li class="nav-item">
<a [routerLink]="['/types/create']" class="nav-link collapsed " >
<li class="nav-item"
*ngIf="hasRole('Planner')"
>
<a [routerLink]="['/types/create']" class="nav-link collapsed "
>
<i class="fe fe-edit-2"></i><span>إضافة نوع جديد</span>
</a>
</li>
......@@ -59,7 +59,7 @@
<li class="nav-item">
<a [routerLink]="['/projects/create']" class="nav-link collapsed" >
<i class="bi bi-circle"></i><span>طرح مشروع</span>
<i class="bi fe-plus"></i><span>طرح مشروع</span>
</a>
</li>
<li class="nav-item">
......
import { Component, Input, input, OnInit } from '@angular/core';
import { NavItem } from '../../componenets/nav-item/nav-item.component';
import { UserService } from '../../../core/services/authentication/user.service';
import { lastValueFrom } from 'rxjs';
@Component({
selector: 'app-sidebar',
......@@ -11,11 +12,22 @@ import { UserService } from '../../../core/services/authentication/user.service'
export class SidebarComponent implements OnInit {
id : number
roles :string[]
constructor(private userService : UserService){}
@Input() isToggled: Boolean;
ngOnInit(): void {
this.roles=this.userService.getCurrentUser().roles
this.id= this.userService.getEmployeeId();
}
hasRole(roleName: string): boolean {
return this.roles.filter(e => e == roleName).length != 0
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment