ui fixes on users listing > role editor

This commit is contained in:
Sofia Papacharalampous 2024-04-15 15:48:21 +03:00
parent e7d6615fbc
commit 2905feca07
5 changed files with 56 additions and 28 deletions

View File

@ -2,5 +2,6 @@ export enum AppRole {
Admin = "Admin", Admin = "Admin",
Manager = "Manager", Manager = "Manager",
User = "User", User = "User",
DescriptionTemplateEditor = "DescriptionTemplateEditor" DescriptionTemplateEditor = "DescriptionTemplateEditor",
TenantAdmin = "TenantAdmin"
} }

View File

@ -62,6 +62,7 @@ export class EnumUtils {
case AppRole.User: return this.language.instant('TYPES.APP-ROLE.USER'); case AppRole.User: return this.language.instant('TYPES.APP-ROLE.USER');
case AppRole.Manager: return this.language.instant('TYPES.APP-ROLE.MANAGER'); case AppRole.Manager: return this.language.instant('TYPES.APP-ROLE.MANAGER');
case AppRole.DescriptionTemplateEditor: return this.language.instant('TYPES.APP-ROLE.DESCRIPTION-TEMPLATE-EDITOR'); case AppRole.DescriptionTemplateEditor: return this.language.instant('TYPES.APP-ROLE.DESCRIPTION-TEMPLATE-EDITOR');
case AppRole.TenantAdmin: return this.language.instant('TYPES.APP-ROLE.TENANT-ADMIN');
} }
} }

View File

@ -1,17 +1,18 @@
<form class="row user-role-editor" *ngIf="formGroup" [formGroup]="formGroup" (ngSubmit)="formSubmit()"> <form class="row user-role-editor" *ngIf="formGroup" [formGroup]="formGroup" (ngSubmit)="formSubmit()">
<div class="container-fluid">
<div class="row align-items-center"> <div class="row align-items-center">
<div *ngIf="!this.nowEditing"class="roles col"> <div *ngIf="!this.nowEditing"class="roles col-8">
<ng-container *ngFor="let role of this.formGroup.get('roles').value"> <div *ngFor="let role of this.formGroup.get('roles').value" class="row">
<div> <div class="col-auto p-0">
<span class="user-role" [ngClass]="{'user': role == appRole.User, 'manager': role == appRole.Manager, 'admin': role == appRole.Admin, 'description-template-editor': role == appRole.DescriptionTemplateEditor}"> <span class="user-role" [ngClass]="{'user': role == appRole.User, 'manager': role == appRole.Manager, 'admin': role == appRole.Admin, 'description-template-editor': role == appRole.DescriptionTemplateEditor, 'tenant-admin': role == appRole.TenantAdmin}">
{{enumUtils.toAppRoleString(role)}} {{enumUtils.toAppRoleString(role)}}
</span> </span>
</div> </div>
</ng-container>
</div> </div>
<div class="col-8"> </div>
<mat-form-field *ngIf="this.nowEditing" class="w-100"> <div *ngIf="this.nowEditing" class="pl-0 col-8">
<mat-select formControlName="roles" multiple required> <mat-form-field class="w-100">
<mat-select formControlName="roles" [panelWidth]="auto" multiple required>
<ng-container *ngFor="let role of appRoleEnumValues"> <ng-container *ngFor="let role of appRoleEnumValues">
<mat-option [value]="role">{{enumUtils.toAppRoleString(role)}}</mat-option> <mat-option [value]="role">{{enumUtils.toAppRoleString(role)}}</mat-option>
</ng-container> </ng-container>
@ -20,13 +21,19 @@
</mat-form-field> </mat-form-field>
</div> </div>
<button *ngIf="!this.nowEditing" class="col" mat-icon-button color="primary" type="button" (click)="editItem()"> <div *ngIf="!this.nowEditing" class="col-2 p-0">
<button mat-icon-button color="primary" type="button" (click)="editItem()">
<mat-icon class="mat-24" matTooltip="{{'USER-LISTING.ACTIONS.EDIT' | translate}}">edit</mat-icon> <mat-icon class="mat-24" matTooltip="{{'USER-LISTING.ACTIONS.EDIT' | translate}}">edit</mat-icon>
<span class="row-action"></span> <span class="row-action"></span>
</button> </button>
<button *ngIf="this.nowEditing" class="col-auto save-button" mat-icon-button color="primary" type="submit"> </div>
<div *ngIf="this.nowEditing" class="col-2 p-0">
<button class="save-button" mat-icon-button color="primary" type="submit">
<mat-icon class="mat-24" matTooltip="{{'USER-LISTING.ACTIONS.SAVE' | translate}}">save</mat-icon> <mat-icon class="mat-24" matTooltip="{{'USER-LISTING.ACTIONS.SAVE' | translate}}">save</mat-icon>
</button> </button>
</div> </div>
</div>
</div>
</form> </form>

View File

@ -85,6 +85,24 @@
padding-right: 10px; padding-right: 10px;
} }
.tenant-admin {
// display: flex;
// justify-content: center;
// align-items: center;
min-width: 77px;
min-height: 28px;
color: #ffa631;
background: #ffe6c6 0% 0% no-repeat padding-box;
border-radius: 44px;
letter-spacing: 0.11px;
font-weight: 400;
opacity: 1;
margin-top: 0.5em;
margin-bottom: 0.5em;
padding-left: 10px;
padding-right: 10px;
}
.description-template-editor { .description-template-editor {
// display: flex; // display: flex;
// justify-content: center; // justify-content: center;

View File

@ -1578,7 +1578,8 @@
"ADMIN": "Admin", "ADMIN": "Admin",
"USER": "User", "USER": "User",
"MANAGER": "Manager", "MANAGER": "Manager",
"DESCRIPTION-TEMPLATE-EDITOR": "Description Template Editor" "DESCRIPTION-TEMPLATE-EDITOR": "Description Template Editor",
"TENANT-ADMIN": "Tenant Admin"
}, },
"IS-ACTIVE": { "IS-ACTIVE": {
"ACTIVE": "Active", "ACTIVE": "Active",