<ion-header>
    <ion-toolbar>
        <ion-title>
            <h1>{{ 'core.search.filterheader' | translate }}</h1>
        </ion-title>
        <ion-buttons slot="end">
            <ion-button fill="clear" (click)="close()" [attr.aria-label]="'core.close' | translate">
                <ion-icon name="fas-xmark" slot="icon-only" aria-hidden="true" />
            </ion-button>
        </ion-buttons>
    </ion-toolbar>
</ion-header>
<ion-content [fullscreen]="true">
    <ion-refresher slot="fixed" (ionRefresh)="refreshFilters($event.target)">
        <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}" />
    </ion-refresher>
    <ion-list>
        <ng-container *ngIf="searchAreaCategories.length > 0">
            <core-spacer />
            <ion-item class="ion-text-wrap help">
                <ion-label>
                    {{ 'core.search.filtercategories' | translate }}
                </ion-label>
            </ion-item>
            <ion-item class="ion-text-wrap">
                <ion-checkbox labelPlacement="start" [(ngModel)]="allSearchAreaCategories"
                    [indeterminate]="allSearchAreaCategories === null" (ionChange)="allSearchAreaCategoriesUpdated()">{{
                    'core.search.allcategories' | translate }}</ion-checkbox>
            </ion-item>
            <ion-item class="ion-text-wrap" *ngFor="let searchAreaCategory of searchAreaCategories">
                <ion-checkbox labelPlacement="start" [(ngModel)]="searchAreaCategory.checked"
                    (ionChange)="onSearchAreaCategoryInputChanged(searchAreaCategory)"><core-format-text
                        [text]="searchAreaCategory.name" /></ion-checkbox>
            </ion-item>
        </ng-container>
        <ng-container *ngIf="!hideCourses && courses.length > 0">
            <core-spacer />
            <ion-item class="ion-text-wrap help">
                <ion-label>
                    {{ 'core.search.filtercourses' | translate }}
                </ion-label>
            </ion-item>
            <ion-item class="ion-text-wrap">
                <ion-checkbox labelPlacement="start" [(ngModel)]="allCourses" [indeterminate]="allCourses === null"
                    (ionChange)="allCoursesUpdated()">
                    {{ 'core.search.allcourses' | translate }}</ion-checkbox>
            </ion-item>
            <ion-item class="ion-text-wrap" *ngFor="let course of courses">
                <ion-checkbox labelPlacement="start" [(ngModel)]="course.checked"
                    (ionChange)="onCourseInputChanged(course)"><core-format-text [text]="course.shortname" /></ion-checkbox>
            </ion-item>
        </ng-container>
    </ion-list>
</ion-content>
