@extends(Theme::viewName('layout'))
@section('title', 'Welcome')

@section('content')
    <div class="container-fluid">
        <div class="row">
            <div class="col-xl-8 ml-xl-auto mr-xl-auto">
                @if (count($albums) > 0)
                    <div class="row album-photo-cards">
                        @foreach ($albums as $album)
                            <div class="col-sm-6 col-md-4">
                                <div class="card">
                                    <a href="{{ $album->url() }}"><img class="card-img-top" src="{{ $album->thumbnailUrl('preview') }}"/></a>
                                    <div class="card-body">
                                        <h4 class="card-title"><a href="{{ $album->url() }}">{{ $album->name }}</a></h4>
                                        <p class="card-text">{!! nl2br(e($album->description)) !!}</p>

                                        @can('edit', $album)
                                            <a href="{{ route('albums.show', ['id' => $album->id]) }}" class="card-link">@lang('gallery.manage_album_link')</a>
                                        @endcan
                                    </div>
                                    <div class="card-footer">
                                        <small class="text-muted">
                                            <i class="fa fa-fw fa-photo"></i> {{ number_format($album->photos_count) }} {{ trans_choice('gallery.photos', $album->photos_count) }}

                                            @if ($album->children_count > 0)
                                            <i class="fa fa-fw fa-book ml-2"></i> {{ number_format($album->children_count) }} {{ trans_choice('gallery.child_albums', $album->children_count) }}
                                            @endif

                                            @if (UserConfig::get('social_user_profiles'))
                                                <i class="fa fa-fw fa-user ml-2"></i>
                                                @can('view', $album->user)
                                                    <a href="{{ $album->user->profileUrl() }}">{{ $album->user->publicDisplayName() }}</a>
                                                @else
                                                    {{ $album->user->publicDisplayName() }}
                                                @endif
                                            @endif
                                        </small>
                                    </div>
                                </div>
                            </div>
                        @endforeach
                    </div>

                    <div class="row" style="margin-top: 15px;">
                        <div class="col text-center">
                            {{ $albums->links() }}
                        </div>
                    </div>
                @else
                    <div class="text-center">
                        <h1>@lang('gallery.index_no_results_heading')</h1>
                        <p style="margin-bottom: 30px; line-height: 2em;">@lang('gallery.index_no_results_text', ['admin_link' => sprintf('<a href="%s">%s</a>', route('admin'), trans('admin.title'))])</p>

                        <img src="{{ asset('themes/base/images/take-a-photo.jpg') }}" class="img-fluid rounded" style="display: inline;" />
                    </div>
                @endif
            </div>
        </div>
    </div>
@endsection
