@extends(Theme::viewName('layout'))
@section('title', trans('admin.list_comments_title'))

@section('breadcrumb')
    <li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
    <li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
    <li class="breadcrumb-item active">@lang('navigation.breadcrumb.comments')</li>
@endsection

@section('content')
    <div class="container">
        <div class="row">
            <div class="col">
                <h1>@yield('title')</h1>
                <div class="alert alert-info" style="margin-bottom: 30px;">
                    <i class="fa fa-fw fa-info"></i> @lang('admin.list_comments_intro')
                </div>

                @if (count($comments) == 0)
                    <div class="text-center">
                        <h4 class="text-danger"><b>@lang('admin.no_comments_title')</b></h4>
                        <p>@lang('admin.no_comments_text')</p>
                        <p style="margin-top: 40px;">
                            <a href="{{ route('comments.create') }}" class="btn btn-lg btn-success">@lang('admin.create_comment')</a>
                        </p>
                    </div>
                @else
                    <table class="table table-hover table-striped">
                        <tbody>
                        @foreach ($comments as $comment)
                            <tr>
                                <td class="text-center" style="width: 40px;"><input type="checkbox" name="comment_id" value="{{ $comment->id }}" /></td>
                                <td>
                                    <p>
                                        <a href="{{ route('comments.edit', ['id' => $comment->id]) }}"><span style="font-size: 1.3em;">{{ $comment->name }}</span></a><br/>
                                        <span class="text-muted" style="font-size: smaller;">{{ trans('admin.comment_summary', ['album_name' => $comment->photo->album->name, 'photo_name' => $comment->photo->name, 'comment_date' => date(UserConfig::get('date_format'), strtotime($comment->created_at))])  }}</span>
                                    </p>
                                    <blockquote>{!! $comment->textAsHtml() !!}</blockquote>
                                </td>
                                <td class="text-right">
                                    <a href="{{ route('comments.delete', ['id' => $comment->id]) }}" class="btn btn-danger">@lang('forms.delete_action')</a>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>

                    <div class="text-center">
                        {{ $comments->links() }}
                    </div>
                @endif
            </div>
        </div>
    </div>
@endsection