<div>
    <h2 id="page-heading">
        <span jhiTranslate="faeBooApp.comment.home.title">Comments</span>
        <button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-comment" [routerLink]="['/comment/new']">
            <fa-icon [icon]="'plus'"></fa-icon>
            <span  jhiTranslate="faeBooApp.comment.home.createLabel">
            Create new Comment
            </span>
        </button>
    </h2>
    <jhi-alert></jhi-alert>
    <br/>
    <div class="table-responsive" *ngIf="comments">
        <table class="table table-striped">
            <thead>
            <tr>
            <th><span jhiTranslate="global.field.id">ID</span></th>
            <th><span jhiTranslate="faeBooApp.comment.content">Content</span></th>
            <th><span jhiTranslate="faeBooApp.comment.likes">Likes</span></th>
            <th><span jhiTranslate="faeBooApp.comment.dislikes">Dislikes</span></th>
            <th><span jhiTranslate="faeBooApp.comment.commenter">Commenter</span></th>
            <th><span jhiTranslate="faeBooApp.comment.post">Post</span></th>
            <th></th>
            </tr>
            </thead>
            <tbody>
            <tr *ngFor="let comment of comments ;trackBy: trackId">
                <td><a [routerLink]="['/comment', comment.id, 'view' ]">{{comment.id}}</a></td>
                <td>{{comment.content}}</td>
                <td>{{comment.likes}}</td>
                <td>{{comment.dislikes}}</td>
                <td>
                    {{comment.commenter?.email}}
                </td>
                <td>
                    <div *ngIf="comment.post">
                        <a [routerLink]="['../post', comment.post?.id, 'view' ]" >{{comment.post?.id}}</a>
                    </div>
                </td>
                <td class="text-right">
                    <div class="btn-group flex-btn-group-container">
                        <button type="submit"
                                [routerLink]="['/comment', comment.id, 'view' ]"
                                class="btn btn-info btn-sm">
                            <fa-icon [icon]="'eye'"></fa-icon>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/comment', comment.id, 'edit']"
                                class="btn btn-primary btn-sm">
                            <fa-icon [icon]="'pencil-alt'"></fa-icon>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/', { outlets: { popup: 'comment/'+ comment.id + '/delete'} }]"
                                replaceUrl="true"
                                queryParamsHandling="merge"
                                class="btn btn-danger btn-sm">
                            <fa-icon [icon]="'times'"></fa-icon>
                            <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
                        </button>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
