@extends('admin.layouts.app')

@section('panel')
    <div class="row">

        <div class="col-lg-12">
            <div class="card">
                <div class="card-body p-0">

                    <div class="table-responsive--sm table-responsive">
                        <table class="table table--light style--two">
                            <thead>
                                <tr>
                                    <th>@lang('User')</th>
                                    <th>@lang('Title')</th>
                                    <th>@lang('Created_At')</th>
                                    <th>@lang('Action')</th>
                                </tr>
                            </thead>
                            <tbody>
                                @forelse($generatedWebsites as $website)
                                    <tr>

                                        <td>
                                            <span class="fw-bold">{{ $website->user->fullname }}</span>
                                            <br>
                                            <span class="small"> <a href="{{ route('admin.users.detail', $website->user_id) }}"><span>@</span>{{ $website?->user?->username }}</a> </span>
                                        </td>
                                        <td>
                                            <span class="fw-bold">{{ $website?->websiteType?->name ?? '' }}</span>
                                        </td>
                                        <td>
                                            {{ showDateTime($website->created_at) }} <br> {{ diffForHumans($website->created_at) }}
                                        </td>
                                        <td>
                                            <div class="button--group">
                                                <a class="btn btn-sm btn-outline--primary" href="{{ route('admin.report.website.preview', $website->folder_name) }}" target="_blank">
                                                    <i class="las la-eye"></i>@lang('Preview')
                                                </a>

                                                <a class="btn btn-sm btn-outline--info" href="{{ route('admin.report.website.download', $website->id) }}">
                                                    <i class="las la-download"></i> @lang('Download')
                                                </a>
                                            </div>

                                        </td>
                                    </tr>
                                @empty
                                    <tr>
                                        <td class="text-muted text-center" colspan="100%">{{ __($emptyMessage) }}</td>
                                    </tr>
                                @endforelse

                            </tbody>
                        </table><!-- table end -->
                    </div>
                </div>
                @if ($generatedWebsites->hasPages())
                    <div class="card-footer py-4">
                        {{ paginateLinks($generatedWebsites) }}
                    </div>
                @endif
            </div><!-- card end -->
        </div>
    </div>
@endsection

@push('breadcrumb-plugins')
    <x-search-form placeholder="Search here..." />
@endpush
