<form class="d-flex user-role-editor" [formGroup]="formGroup" (ngSubmit)="formSubmit()">
	<div *ngIf="!this.nowEditing"class="roles">
		<div *ngFor="let role of this.formGroup.get('appRoles').value" [ngClass]="{'user': role == 0, 'manager': role == 1, 'admin': role == 2}">
			{{getPrincipalAppRoleWithLanguage(role)}}
		</div>
	</div>
	<mat-form-field *ngIf="this.nowEditing" class="select-role roles-width-180">
		<mat-select formControlName="appRoles" multiple required>
			<mat-option *ngFor="let role of getPrincipalAppRoleValues()" [value]="role">{{getPrincipalAppRoleWithLanguage(role)}}</mat-option>
		</mat-select>
		<mat-error *ngIf="getFormControl('appRoles').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
	</mat-form-field>

	<button *ngIf="!this.nowEditing" mat-icon-button color="primary" type="button" (click)="editItem()">
		<!-- <mat-icon class="mat-24">edit</mat-icon> -->
		<span class="row-action">{{'USERS.ACTIONS.EDIT' | translate}}</span>
	</button>
	<button *ngIf="this.nowEditing" mat-icon-button color="primary" type="submit">
		<!-- <mat-icon class="mat-24">save</mat-icon> -->
		<span class="row-action">{{'USERS.ACTIONS.SAVE' | translate}}</span>
	</button>
</form>
