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",
Manager = "Manager",
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.Manager: return this.language.instant('TYPES.APP-ROLE.MANAGER');
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,32 +1,39 @@
<form class="row user-role-editor" *ngIf="formGroup" [formGroup]="formGroup" (ngSubmit)="formSubmit()">
<div class="row align-items-center">
<div *ngIf="!this.nowEditing"class="roles col">
<ng-container *ngFor="let role of this.formGroup.get('roles').value">
<div>
<span class="user-role" [ngClass]="{'user': role == appRole.User, 'manager': role == appRole.Manager, 'admin': role == appRole.Admin, 'description-template-editor': role == appRole.DescriptionTemplateEditor}">
{{enumUtils.toAppRoleString(role)}}
</span>
<div class="container-fluid">
<div class="row align-items-center">
<div *ngIf="!this.nowEditing"class="roles col-8">
<div *ngFor="let role of this.formGroup.get('roles').value" class="row">
<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, 'tenant-admin': role == appRole.TenantAdmin}">
{{enumUtils.toAppRoleString(role)}}
</span>
</div>
</div>
</div>
</ng-container>
</div>
<div class="col-8">
<mat-form-field *ngIf="this.nowEditing" class="w-100">
<mat-select formControlName="roles" multiple required>
<ng-container *ngFor="let role of appRoleEnumValues">
<mat-option [value]="role">{{enumUtils.toAppRoleString(role)}}</mat-option>
</ng-container>
</mat-select>
<mat-error *ngIf="formGroup.get('roles').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<div *ngIf="this.nowEditing" class="pl-0 col-8">
<mat-form-field class="w-100">
<mat-select formControlName="roles" [panelWidth]="auto" multiple required>
<ng-container *ngFor="let role of appRoleEnumValues">
<mat-option [value]="role">{{enumUtils.toAppRoleString(role)}}</mat-option>
</ng-container>
</mat-select>
<mat-error *ngIf="formGroup.get('roles').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<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>
<span class="row-action"></span>
</button>
</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>
</button>
</div>
</div>
</div>
<button *ngIf="!this.nowEditing" class="col" mat-icon-button color="primary" type="button" (click)="editItem()">
<mat-icon class="mat-24" matTooltip="{{'USER-LISTING.ACTIONS.EDIT' | translate}}">edit</mat-icon>
<span class="row-action"></span>
</button>
<button *ngIf="this.nowEditing" class="col-auto save-button" mat-icon-button color="primary" type="submit">
<mat-icon class="mat-24" matTooltip="{{'USER-LISTING.ACTIONS.SAVE' | translate}}">save</mat-icon>
</button>
</div>
</form>

View File

@ -85,6 +85,24 @@
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 {
// display: flex;
// justify-content: center;

View File

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