argos/dmp-frontend/src/app/ui/admin/user/listing/role-editor/user-role-editor.component....

40 lines
1.8 KiB
HTML

<form class="row user-role-editor" *ngIf="formGroup" [formGroup]="formGroup" (ngSubmit)="formSubmit()">
<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, 'tenant-manager': role == appRole.TenantManager, 'admin': role == appRole.Admin, 'tenant-description-template-editor': role == appRole.TenantDescriptionTemplateEditor, 'tenant-admin': role == appRole.TenantAdmin, 'tenant-user': role == appRole.TenantUser}">
{{enumUtils.toAppRoleString(role)}}
</span>
</div>
</div>
</div>
<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>
</form>