@extends(getTemplate() .'.panel.layouts.panel_layout')

@section('content')
    <section>
        <div class="d-flex align-items-center justify-content-between mb-20">
            <h2 class="section-title">{{ trans('update.product_wishlist') }}</h2>
        </div>

        @if(!empty($favorites) && !$favorites->isEmpty())
            @foreach($favorites as $favorite)
                @php $p = $favorite->product; @endphp
                @if(!empty($p))
                    <div class="row mt-20">
                        <div class="col-12">
                            <div class="d-flex flex-column flex-md-row align-items-md-center justify-content-between webinar-card webinar-list p-15 p-md-25">
                                <div class="d-flex align-items-center w-100 mb-15 mb-md-0">
                                    <div class="image-box mr-15" style="width:140px;height:140px;border-radius:12px;">
                                        <img src="{{ $p->thumbnail }}" alt="{{ clean($p->title,'title') }}" class="img-cover rounded-lg">
                                    </div>
                                    <div>
                                        <a href="{{ $p->getUrl() }}" target="_blank" class="font-16 font-weight-bold text-dark-blue">{{ clean($p->title,'title') }}</a>
                                        @if(!empty($p->category))
                                            <div class="font-13 text-muted mt-5">{{ $p->category->title }}</div>
                                        @endif
                                    </div>
                                </div>
                                <div class="d-flex align-items-center">
                                    @if(!empty($p->price) && $p->price > 0)
                                        <span class="font-16 font-weight-bold text-dark">{{ handlePrice($p->price) }}</span>
                                    @else
                                        <span class="badge badge-secondary">{{ trans('public.free') }}</span>
                                    @endif
                                    <a href="/panel/product-favorites/{{ $favorite->id }}/delete"
                                       class="btn btn-outline-danger ml-15">{{ trans('public.remove') }}</a>
                                </div>
                            </div>
                        </div>
                    </div>
                @endif
            @endforeach

            <div class="mt-30">
                {{ $favorites->links() }}
            </div>
        @else
            <div class="text-center mt-40">
                {{ trans('update.no_products_found') }}
            </div>
        @endif
    </section>
@endsection
