openaire-library/utils/rangeFilter/rangeFilter.component.html

44 lines
2.5 KiB
HTML

<div class="uk-margin-small-bottom">
<div class="uk-margin-small-top uk-margin-bottom uk-grid uk-flex uk-flex-bottom">
<h5 class="uk-margin-bottom-remove">{{_formatTitle(filter.title)}}</h5>
<a *ngIf="filter.selectedFromValue || filter.selectedToValue" (click)="clearFilter()" class="portal-link">
Clear
</a>
</div>
<div aria-expanded="false">
<div>
<div class = "uk-animation-fade filterItem searchFilterItem uk-text-small">
<div class="searchFilterBoxValues ">
<form class="uk-inline uk-text-small form-group" #rangeForm="ngForm" fromYearAfterToYear>
<input class=" uk-input form-control uk-width-1-3" (focus)="focusedInput = 'from'" (blur)="focusedInput = ''"
[(ngModel)]="filter.selectedFromValue" name="yearFrom" #yearFrom="ngModel" inValidYear
placeholder="From"/>
<input class=" uk-input form-control uk-width-1-3 uk-margin-left" (focus)="focusedInput = 'to'" (blur)="focusedInput = ''"
[(ngModel)]="filter.selectedToValue" name="yearTo" #yearTo="ngModel" inValidYear
placeholder="To"/>
<button type="submit" (click)="yearChanged()"
[ngStyle]="{'cursor': rangeForm.valid ? 'pointer' : 'not-allowed'}" class="uk-icon uk-width-1-6 uk-text-right"
[disabled]="rangeForm.invalid">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"
icon="chevron-right" ratio="1">
<polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline>
</svg>
</button>
<div *ngIf="(yearFrom.invalid && focusedInput != 'from' && (yearFrom.dirty || yearFrom.touched)) ||
(yearTo.invalid && focusedInput != 'to' && (yearTo.dirty || yearTo.touched))"
class="alert alert-danger uk-margin-small-top">
<div *ngIf="(yearFrom.errors && yearFrom.errors.inValidYear) || (yearTo.errors && yearTo.errors.inValidYear)">
Year must be between {{yearMin}} and {{yearMax}}.
</div>
</div>
<div *ngIf="yearFrom.valid && yearTo.valid && rangeForm.errors?.fromYearAfterToYear && (rangeForm.touched || rangeForm.dirty)"
class="alert alert-danger uk-margin-small-top">
"From" year must be equal or greater than "To" year.
</div>
</form>
</div>
</div>
</div>
</div>
</div>