adaptive ui

master
Boris Voropaev 2023-12-19 15:16:04 +03:00
parent 0258670450
commit 11a366f6f6
6 changed files with 35 additions and 31 deletions

View File

@ -4,7 +4,9 @@
</div>
<div class="tabs default">
<button type="button" *ngFor="let tab of tabs" [class.active]="tab.active" routerLink="/administrate/{{tab.name}}">{{tab.title}}</button>
<div *ngFor="let tab of tabs" >
<button type="button"[class.active]="tab.active" *ngIf="showTab(tab)" routerLink="/administrate/{{tab.name}}">{{tab.title}}</button>
</div>
</div>
<div [ngSwitch]="tab.name">
<administrate-company *ngSwitchCase="'company'" [companyId]="'main'"></administrate-company>

View File

@ -35,7 +35,10 @@ export class AdministrationPageComponent {
makeTabs() {
//this.tabs = [{name: 'company', title: 'Структура ФАУ «ФЦС»'}, {name: 'committee', title: 'Структура ТК 465'}];
//if (this.authService.isSuperAdmin) this.tabs.push({name: 'site-pages', title: 'Структура сайта'});
this.tabs = [{name: 'site-pages', title: 'Структура сайта'}, {name: 'users', title: 'Пользователи'}, {name: 'licence', title: 'Данные о лицензии'}];
this.tabs = [
{name: 'site-pages', title: 'Структура сайта', access: ["admin", "editor"]},
{name: 'users', title: 'Пользователи', access: ["admin"]},
{name: 'licence', title: 'Данные о лицензии', access: ["admin"]}];
this.switchTab(this.route.snapshot.paramMap.get('tab'));
}
@ -43,4 +46,12 @@ export class AdministrationPageComponent {
this.tabs.map(tab => {tab.active = tab.name === name});
}
showTab(tab){
return tab.access.filter(role=>this.privileges[role]).length
}
get privileges(){
return this.authService.user?.privileges
}
}

View File

@ -9,7 +9,7 @@
<div class="row">Личный кабинет</div>
</div>
<!-- <li *ngIf="isJournalVisible" (click)="link('applications')">Журнал заявок</li> -->
<div class="type" *ngIf="authService.isAdmin" (click)="link('administrate')">
<div class="type" *ngIf="authService.isAdmin||authService.isEditor" (click)="link('administrate')">
<div class="row">Панель управления</div>
</div>
<div class="type" (click)="logout()">

View File

@ -57,7 +57,9 @@ export class AuthenticationService {
get isMainCompanyMember() {
return this.privileges?.mainCompanyMember;
}
get isEditor() {
return this.privileges?.editor;
}
signup(data: any): Observable<any> {

View File

@ -49,9 +49,21 @@
}
administrate-site-pages>pages-tree{
administrate-site-pages{
>pages-tree{
display: block;
margin-bottom: 128px;
}
@media screen and (max-width: 1330px) {
.page-control {
display: none;
}
.logo, .page-lable{
display: none !important;
}
}
}
ico.page-control{
@ -166,32 +178,6 @@ pages-tree{
@media screen and (max-width: 1330px) {
.item {
.bar {
.mid {
padding: 0 12px;
.info .logo {
display: none;
}
}
.right {
display: none;
}
}
.items {
padding-left: 16px;
}
&.company {
.items {
padding-left: 40px;
}
}
}
}
}

View File

@ -196,6 +196,9 @@ pages-menu-item{
right-content, left-content{
display: none;
}
.jumbotron-edit-field{
display: none;
}
}