53 lines
2.3 KiB
HTML
53 lines
2.3 KiB
HTML
<!--
|
|
|
|
Copyright © 2016-2023 The Thingsboard Authors
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
-->
|
|
<mat-form-field appearance="outline" [formGroup]="selectUserFormGroup" class="mat-block container">
|
|
<input matInput type="text" placeholder="{{ 'user.search' | translate }}"
|
|
#userInput
|
|
formControlName="user"
|
|
(focusin)="onFocus()"
|
|
[matAutocomplete]="userAutocomplete">
|
|
<mat-icon matSuffix>search</mat-icon>
|
|
<mat-autocomplete class="tb-assignee-autocomplete"
|
|
#userAutocomplete="matAutocomplete"
|
|
[displayWith]="displayUserFn"
|
|
(optionSelected)="selected($event)"
|
|
panelWidth="260px">
|
|
<mat-option [ngClass]="{'assigned': !assigneeId}" [value]="null">
|
|
<mat-icon class="unassigned-icon">account_circle</mat-icon>
|
|
<span style="margin-right: auto" translate>alarm.unassigned</span>
|
|
</mat-option>
|
|
<mat-option [ngClass]="{ 'assigned': assigneeId === user.id.id }"
|
|
*ngFor="let user of filteredUsers | async" [value]="user">
|
|
<span class="user-avatar" [innerHTML]="getUserInitials(user)"
|
|
[style.background-color]="getAvatarBgColor(user)">
|
|
</span>
|
|
<div class="user-display-name" fxLayout="column" fxLayoutGap="2px">
|
|
<span *ngIf="user.firstName || user.lastName"
|
|
[innerHTML]="getFullName(user) | highlight:searchText"></span>
|
|
<span [innerHTML]="user.email | highlight:searchText"></span>
|
|
</div>
|
|
</mat-option>
|
|
<mat-option *ngIf="!(filteredUsers | async)?.length" [value]="null">
|
|
<span style="white-space: normal">
|
|
{{ translate.get('user.no-users-matching', {entity: searchText}) | async }}
|
|
</span>
|
|
</mat-option>
|
|
</mat-autocomplete>
|
|
</mat-form-field>
|
|
|