@extends(get_theme().'.layouts')

@section('content')
    <h1 class="mb-4">{{ $title }}</h1>
    <div class="row">
        @foreach ($data as $item)
            @if ($type == 'tv')
                <div class="col-md-3 mb-3">
                    <div class="media position-relative">
                        <img class="mr-3" width="50" src="{{ img_poster($item->poster_path) }}" alt="Image {{ $item->name }}" title="Image {{ $item->name }} ({{ to_year($item->first_air_date ?? '') }})">
                        <div class="media-body">
                            <a href="{{ mopie_route('tv.single',['id' => $item->id, 'slug' => str_slug($item->original_name)]) }}" rel="bookmark" title="{{ $item->name }} ({{ to_year($item->first_air_date ?? '') }})" class="stretched-link">
                                <h2 class="card-title h6 m-1">{{ $item->name }}</h2>
                            </a>
                            <p class="small text-secondary">{{ $item->first_air_date }}</p>
                        </div>
                    </div>
                </div>
            @elseif($type == 'people')
                <div class="col-6 col-md-3 mb-3">
                    <div class="card">
                        <img class="img-fluid rounded" src="{{ img_poster($item->profile_path) }}" alt="Image {{ $item->name }}">
                        <div class="card-body">
                            <h5 class="card-title h5">
                                <a href="{{ mopie_route('people.single', ['id' => $item->id]) }}" class="stretched-link" rel="bookmark">{{ $item->name }}</a>
                            </h5>
                        </div>
                    </div>
                </div>
            @else
                <div class="col-md-3 mb-3">
                    <div class="media position-relative">
                        <img class="mr-3" width="50" src="{{ img_poster($item->poster_path) }}" alt="Image {{ $item->title }}" title="Image {{ $item->title }} ({{ to_year($item->release_date ?? '') }})">
                        <div class="media-body">
                            <a href="{{ mopie_route('movie.single',['id' => $item->id, 'slug' => str_slug($item->original_title)]) }}" rel="bookmark" title="{{ $item->title }} ({{ to_year($item->release_date ?? '') }})" class="stretched-link">
                                <h2 class="card-title h6 m-1">{{ $item->title }}</h2>
                            </a>
                            <p class="small text-secondary">{{ $item->release_date }}</p>
                        </div>
                    </div>
                </div>
            @endif
        @endforeach
    </div>

    <div class="row">
        <div class="col-12 text-center pagenate">
            {!! $data->links() !!}
        </div>
    </div>
@endsection