<ion-header>
    <ion-toolbar>
        <ion-buttons slot="start">
            <ion-back-button [text]="'core.back' | translate"></ion-back-button>
        </ion-buttons>
        <ion-title>
            <h1>{{ 'addon.mod_feedback.responses' |translate }}</h1>
        </ion-title>
    </ion-toolbar>
</ion-header>
<ion-content>
    <ion-refresher slot="fixed" [disabled]="!loaded" (ionRefresh)="refreshFeedback($event.target)">
        <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
    </ion-refresher>
    <core-loading [hideUntil]="loaded">
        <ion-list class="ion-no-margin">
            <core-group-selector [groupInfo]="groupInfo" [(selected)]="selectedGroup" (selectedChange)="loadAttempts(selectedGroup)"
                [courseId]="courseId">
            </core-group-selector>

            <ion-item-divider>
                <ion-label>
                    <h2>{{ 'addon.mod_feedback.non_respondents_students' | translate : {$a: total } }}</h2>
                </ion-label>
            </ion-item-divider>
            <ng-container *ngIf="total > 0">
                <ion-item *ngFor="let user of users" class="ion-text-wrap">
                    <core-user-avatar [user]="user" slot="start"></core-user-avatar>
                    <ion-label>
                        <p class="item-heading">{{ user.fullname }}</p>
                        <p>
                            <ion-badge color="success" *ngIf="user.started">
                                {{ 'addon.mod_feedback.started' | translate}}
                            </ion-badge>
                            <ion-badge color="danger" *ngIf="!user.started">
                                {{ 'addon.mod_feedback.not_started' | translate}}
                            </ion-badge>
                        </p>
                    </ion-label>
                </ion-item>
            </ng-container>

            <core-infinite-loading [enabled]="canLoadMore" (action)="loadAttempts(undefined, $event)" [error]="loadMoreError">
            </core-infinite-loading>
        </ion-list>
    </core-loading>
</ion-content>
