@extends('layouts.master')

@section('page-title', 'Approve Artwork')

@section('meta_description', 'Approve Artwork to have it published for non-priviledged eyeballs to view.')

@section('page-top')
<section class="inner-page-banner bg-2 bg-image">
    <div class="container">
        <div class="inner text-center">
            <h1 class="title">Artwork Pending Approval</h1>
            <nav class="mt-4">
                <ol class="breadcrumb justify-content-center">
                    <li class="breadcrumb-item"><a href="/">Home</a></li>
                    <li class="breadcrumb-item active"><a href="/artworks">Explore Artwork</a></li>
                </ol>
            </nav>
        </div>
    </div>
</section>
@endsection
@section('page-content')
<section class="pt-120 pb-90 masonary-wrapper-activation">
    <div class="container">
        <div class="row">
            {{ $artworks->links() }}
        </div>
    </div>
    <div class="container">
        <div class="d-flex-between flex-wrap">
            <div
                class="button-group default-tab-list isotop-filter flex-wrap filters-button-group d-flex justify-content-start justify-content-lg-start mb-6 ">
                <button data-filter="*" class="is-checked"><span class="filter-text">View All</span></button>
                @foreach ($podcasts as $podcast)
                    <button data-filter=".podcast--{{ $podcast->slug }}"><span class="filter-text">{{ $podcast->name }}</span></button>
                @endforeach
            </div>
        </div>
        <div class="grid-filter-wrapper masonry-list">
            <div class="resizer"></div>
            @foreach ($artworks as $artwork)
                @php
                    $thisArtwork = $artwork;
                    $thisPodcast = $artwork->podcast;
                    $thisEpisode = $artwork->episode;
                @endphp
                <div class="grid-item podcast--{{ $artwork->podcast->slug }}">
                    <div class="explore-style-one">
                        <div class="thumb">
                            <img src="{{ config('app.static_asset_url') . '/thumbnails/' . $thisArtwork->filename ?? '#'}}"
                                alt="{{ $thisArtwork->title }} by {{ $thisArtwork->artist->name }}">
                        </div>
                        <div class="content">
                            <div class="header d-flex-between pt-4 pb-1">
                                <h3 class="title">&ldquo;{{ $thisArtwork->title }}&rdquo;</h3>
                            </div>
                            {{-- End .header --}}
                            <div class="product-owner py-1 d-flex-between">
                                <span class="bid-owner">Artwork By <br><strong><a
                                    href="/artist/{{ $thisArtwork->artist->slug }}">{{ $thisArtwork->artist->name ?? 'Unknown' }}</a></strong></span>
                                <span class="profile-share d-flex-center"><a href="/artist/{{ $thisArtwork->artist->slug }}"
                                    class="avatar" data-bs-toggle="tooltip"
                                    data-bs-placement="top"
                                    title="{{ $thisArtwork->artist->name }}">
                                        <img class="avatar_img" src="{{ $thisArtwork->artist->avatar() }}"
                                            alt="{{ $thisArtwork->artist->name }}"></a>
                                </span>
                            </div>
                            {{-- End .product-owner --}}
                            <div class="action-wrapper py-5 d-flex align-items-center justify-content-center">
                                @if (auth()->user()->artists->first()->id != $thisArtwork->artist_id)
                                <form action="/approve-artworks" method="POST" class="approve-artwork-form" name="approve-artwork-{{ $thisArtwork->id}}" enctype="multipart/form-data">
                                    @csrf
                                    <input name="artwork_id" type="hidden" value="{{ $thisArtwork->id }}">
                                    <button type="submit" class="btn btn-gradient btn-medium justify-content-center"><span>Approve and Publish</span></button>
                                </form>
                                @else
                                <p>You cannot approve your own</p>
                                @endif
                            </div>
                        </div>
                    </div>
                </div>

            @endforeach
        </div>
    </div>
    <div class="container">
        <div class="row">
            {{ $artworks->links() }}
        </div>
    </div>
</section>
@endsection



