@extends($activeTemplate . 'layouts.master')
@section('content')
    <div class="body-wrapper">
        <div class="table-content">
            <div class="row">
                <div class="col-lg-12">
                    <div class="dashboard-card-wrap mt-0">
                        <div class="table-area">
                            <div class="row justify-content-center">
                                <div class="col-xl-12">
                                    <div class="table-area">
                                        <table class="custom-table">
                                            <thead>
                                                <tr>
                                                    <th class="text-center">@lang('#')</th>
                                                    <th>@lang('Preview')</th>
                                                    <th>@lang('Title')</th>
                                                    <th>@lang('Category')</th>
                                                    <th>@lang('Mark At')</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                @forelse ($wishlists as $item)
                                                    @php
                                                        $file = App\Models\File::where('id', $item->file_id)
                                                            ->with('category')
                                                            ->first();
                                                    @endphp
                                                    @if (isset($file))
                                                        <tr>
                                                            <td data-label="#" class="text-center">
                                                                {{ $loop->iteration }}
                                                            </td>
                                                            <td data-label="preview" class="info"><img
                                                                    src="{{ getImage(getFilePath('media') . @$file->file) }}"
                                                                    alt="image">
                                                            </td>
                                                            <td data-label="Title" class="info">
                                                                @if (strlen(@$file->title) < 21)
                                                                    <span class="fw-bold">
                                                                        {{ @$file->title }}
                                                                    </span>
                                                                @else
                                                                    <span class="fw-bold">
                                                                        {{ substr(@$file->title, 0, 20) }}...
                                                                    </span>
                                                                @endif
                                                            </td>
                                                            <td data-label="Category">
                                                                {{ @$file->category->name }}
                                                            </td>
                                                            <td data-label="Submitted On">
                                                                {{ showDateTime(@$item->created_at, 'h:i A, M Y') }}
                                                            </td>
                                                        </tr>
                                                    @endif
                                                @empty
                                                    <tr>
                                                        <td class="text-muted text-center" colspan="100%">
                                                            {{ __($emptyMessage) }}</td>
                                                    </tr>
                                                @endforelse
                                            </tbody>
                                        </table>
                                        @if ($wishlists->hasPages())
                                            <div class="text-end">
                                                {{ $wishlists->links() }}
                                            </div>
                                        @endif
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
