paperless-ngx/src-ui/src/app/components/common/input/select/select.component.html

39 lines
1.4 KiB
HTML
Raw Normal View History

<div class="form-group paperless-input-select">
2020-10-28 18:02:30 +01:00
<label [for]="inputId">{{title}}</label>
<div [class.input-group]="allowCreateNew">
2021-04-04 19:57:16 -07:00
<ng-select name="inputId" [(ngModel)]="value"
[disabled]="disabled"
[style.color]="textColor"
[style.background]="backgroundColor"
[clearable]="allowNull"
[items]="items"
2021-04-04 19:57:16 -07:00
[addTag]="allowCreateNew && addItemRef"
2021-05-15 18:53:55 +02:00
addTagText="Add item"
2021-05-15 18:58:23 +02:00
i18n-addTagText="Used for both types and correspondents"
bindLabel="name"
bindValue="id"
(change)="onChange(value)"
(search)="onSearch($event)"
(focus)="clearLastSearchTerm()"
(clear)="clearLastSearchTerm()"
(blur)="onBlur()">
</ng-select>
<div *ngIf="allowCreateNew" class="input-group-append">
<button class="btn btn-outline-secondary" type="button" (click)="addItem()">
<svg class="buttonicon" fill="currentColor">
<use xlink:href="assets/bootstrap-icons.svg#plus" />
</svg>
</button>
</div>
</div>
2020-10-28 18:02:30 +01:00
<small *ngIf="hint" class="form-text text-muted">{{hint}}</small>
2021-01-29 16:48:51 +01:00
<small *ngIf="getSuggestions().length > 0">
2021-01-29 16:57:00 +01:00
<span i18n>Suggestions:</span>&nbsp;
2021-01-29 16:48:51 +01:00
<ng-container *ngFor="let s of getSuggestions()">
<a (click)="value = s.id; onChange(value)" [routerLink]="">{{s.name}}</a>&nbsp;
</ng-container>
2021-01-29 16:48:51 +01:00
</small>
</div>