<ion-item-group *ngFor="let dayEvents of filteredEvents">
    <ion-item-divider [color]="dayEvents.color">
        <h2>{{ dayEvents.dayTimestamp * 1000 | coreFormatDate:"LL" }}</h2>
    </ion-item-divider>
    <ng-container *ngFor="let event of dayEvents.events">
        <a ion-item text-wrap detail-none class="core-course-module-handler item-media" (click)="action($event, event)" [title]="event.action.actionable ? event.action.name: event.name">
            <img item-start [src]="event.iconUrl" core-external-content alt="" role="presentation" *ngIf="event.iconUrl" class="core-module-icon">
            <h2><core-format-text [text]="event.name"></core-format-text></h2>
            <p *ngIf="showCourse">
                <core-format-text [text]="event.course.fullnamedisplay"></core-format-text>
            </p>
            <ion-badge color="light" item-end>{{event.timesort * 1000 | coreFormatDate:"LT" }}</ion-badge>
        </a>
    </ng-container>
</ion-item-group>

<div padding text-center *ngIf="canLoadMore && !empty">
    <!-- Button and spinner to show more attempts. -->
    <button ion-button block (click)="loadMoreEvents()" color="light" *ngIf="!loadingMore">
        {{ 'core.loadmore' | translate }}
    </button>
    <ion-spinner *ngIf="loadingMore"></ion-spinner>
</div>

<core-empty-box *ngIf="empty" image="assets/img/icons/activities.svg" [message]="'addon.block_timeline.noevents' | translate" [inline]="!showCourse"></core-empty-box>
