109 lines
7.1 KiB
HTML
109 lines
7.1 KiB
HTML
<div class="uk-margin-small-bottom">
|
|
<div class="uk-margin-small-top uk-margin-bottom uk-grid uk-flex uk-flex-bottom">
|
|
<h6 class="uk-margin-bottom-remove">{{_formatTitle(filter.title)}}</h6>
|
|
<a *ngIf="filter.selectedFromValue || filter.selectedToValue" (click)="clearFilter()"
|
|
[class]="(isDisabled ? 'uk-disabled' : '') + ' uk-text-small'">
|
|
Clear
|
|
</a>
|
|
</div>
|
|
<div aria-expanded="false">
|
|
<div>
|
|
<div class = "uk-animation-fade filterItem searchFilterItem uk-text-small">
|
|
<div class="searchFilterBoxValues ">
|
|
<form [class]="(isDisabled ? 'uk-disabled' : '') + ' uk-flex uk-flex-middle uk-flex-wrap'" [formGroup]="rangeForm" >
|
|
<div input [formInput]="rangeForm.get('yearFrom')" [placeholder]="{label: 'e.g. ' + yearMin, static: true}"
|
|
inputClass="inner x-small" class=" uk-width-1-3"></div>
|
|
<span class="uk-margin-small-left uk-margin-small-right">-</span>
|
|
<div input [formInput]="rangeForm.get('yearTo')" [placeholder]="{label: 'e.g. ' + yearMax, static: true}"
|
|
inputClass="inner x-small" class=" uk-width-1-3"></div>
|
|
<button type="submit" (click)="yearChanged()"
|
|
[ngStyle]="{'cursor': (rangeForm.valid && (rangeForm.get('yearFrom').dirty || rangeForm.get('yearTo').dirty)) ? 'pointer' : 'default'}"
|
|
class="uk-icon uk-icon-button uk-button-default uk-margin-small-left"
|
|
[class.uk-disabled]="isDisabled || rangeForm.invalid || (!rangeForm.get('yearFrom').dirty && !rangeForm.get('yearTo').dirty)
|
|
|| rangeForm.get('yearFrom').invalid || rangeForm.get('yearTo').invalid"
|
|
[disabled]="isDisabled || rangeForm.invalid || (!rangeForm.get('yearFrom').dirty && !rangeForm.get('yearTo').dirty)
|
|
|| rangeForm.get('yearFrom').invalid || rangeForm.get('yearTo').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>
|
|
<span class="visually-hidden">GO</span>
|
|
</button>
|
|
<div *ngIf="(rangeForm.get('yearFrom').invalid && rangeForm.get('yearFrom').dirty && rangeForm.get('yearFrom').touched) ||
|
|
(rangeForm.get('yearTo').invalid && rangeForm.get('yearTo').dirty && rangeForm.get('yearTo').touched)"
|
|
class="uk-text-danger uk-margin-small-top uk-margin-remove-bottom uk-width-1-1">
|
|
<div *ngIf="(rangeForm.get('yearFrom').errors && rangeForm.get('yearFrom').errors['inValidYear']) || (rangeForm.get('yearTo').errors && rangeForm.get('yearTo').errors['inValidYear'])">
|
|
Year must be between {{yearMin}} and {{yearMax}}.
|
|
</div>
|
|
</div>
|
|
<div *ngIf="rangeForm.get('yearFrom').valid && rangeForm.get('yearTo').valid && rangeForm.errors && rangeForm.errors['fromYearAfterToYear'] && (rangeForm.touched || rangeForm.dirty)"
|
|
class="uk-text-danger uk-margin-small-top uk-margin-remove-bottom uk-width-1-1">
|
|
Starting year must be greater than or equal to ending year.
|
|
</div>
|
|
<div *ngIf="rangeForm.get('yearFrom').valid && rangeForm.get('yearTo').valid && rangeForm.errors && !rangeForm.errors['fromYearAfterToYear'] &&
|
|
(rangeForm.touched || rangeForm.dirty) && mandatoryRange && rangeForm.errors['rangeRequired']"
|
|
class="uk-text-danger uk-margin-small-top uk-margin-remove-bottom uk-width-1-1">
|
|
Both starting and ending year are required
|
|
</div>
|
|
<div *ngIf="showQuickButtons" class="uk-width-1-1">
|
|
<div class="uk-margin-small uk-margin-top uk-text-left">
|
|
<ul class="uk-text-small uk-grid uk-grid-small uk-grid-divider" uk-grid>
|
|
<!-- + (isDisabled ? ' uk-disabled uk-text-muted' : '')"-->
|
|
<li>
|
|
<a *ngIf="actionRoute" [routerLink]="getRoute()"
|
|
[queryParams]="getParams(0,(stringToNum(filter.selectedToValue) ==
|
|
currentYear
|
|
&&stringToNum(filter.selectedFromValue) == currentYear))"
|
|
[class]="'uk-text-center '
|
|
+ ((stringToNum(filter.selectedFromValue) == currentYear && stringToNum(filter.selectedToValue) == currentYear) ? ' uk-text-bold' : '')
|
|
"
|
|
(click)="yearChanged(0)"
|
|
>This year</a>
|
|
<a *ngIf="!actionRoute"
|
|
[class]="'uk-text-center '
|
|
+ ((stringToNum(filter.selectedFromValue) == currentYear && stringToNum(filter.selectedToValue) == currentYear) ? ' uk-text-bold' : '')
|
|
"
|
|
(click)="yearChanged(0)"
|
|
>This year</a>
|
|
</li>
|
|
<li><a *ngIf="actionRoute" [routerLink]="getRoute()"
|
|
[queryParams]="getParams(4,(stringToNum(filter.selectedToValue) == currentYear
|
|
&&stringToNum(filter.selectedFromValue) == currentYear-4))"
|
|
[class]="'uk-text-center '
|
|
+ ((stringToNum(filter.selectedToValue) == currentYear && stringToNum(filter.selectedFromValue) == currentYear-4) ? ' uk-text-bold' : '')
|
|
"
|
|
(click)="yearChanged(4)"
|
|
>Last 5 years</a>
|
|
<a *ngIf="!actionRoute"
|
|
[class]="'uk-text-center '
|
|
+ ((stringToNum(filter.selectedToValue) == currentYear && stringToNum(filter.selectedFromValue) == currentYear-4) ? ' uk-text-bold' : '')
|
|
"
|
|
(click)="yearChanged(4)"
|
|
>Last 5 years</a>
|
|
</li>
|
|
<li><a *ngIf="actionRoute" [routerLink]="getRoute()"
|
|
[queryParams]="getParams(9,(stringToNum(filter.selectedToValue) == currentYear &&stringToNum(filter.selectedFromValue) == currentYear-9))"
|
|
[class]="'uk-text-center '
|
|
+ ((stringToNum(filter.selectedToValue) == currentYear && stringToNum(filter.selectedFromValue) == currentYear-9) ? ' uk-text-bold' : '')
|
|
"
|
|
(click)="yearChanged(9)"
|
|
>Last 10 years</a>
|
|
<a *ngIf="!actionRoute"
|
|
[class]="'uk-text-center '
|
|
+ ((stringToNum(filter.selectedToValue) == currentYear && stringToNum(filter.selectedFromValue) == currentYear-9) ? ' uk-text-bold' : '')
|
|
"
|
|
(click)="yearChanged(9)"
|
|
>Last 10 years</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<!-- End of Natalia's suggestion -->
|
|
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|