@section('meta_title', __('sections.Dashboard'))
@section('h1', __('sections.Dashboard'))
<x-private.layout>
    <div class="card border-0 shadow mb-4">
        <div class="card-body">
            @can('viewAny', \App\Models\CaptchaToken::class)
                <div id="chart-сaptcha-activity"></div>
                <div class="mt-4 table-responsive">
                    <table class="table table-centered table-nowrap mb-0 rounded">
                        <thead class="thead-light">
                        <tr>
                            <th class="border-0">{{ __('validation.attributes.date') }}</th>
                            <th class="border-0">Capctha</th>
                            <th class="border-0"></th>
                        </tr>
                        </thead>
                        <tbody id="captcha-log">
                        @foreach($items as $item)
                            <tr>
                                <td>{{ $item->created_at->timezone(\App\Helpers\Helpers::getUserTimeZone())->format("d.m.Y H:i:s") }}</td>
                                <td>
                                    @if($item->captcha && $item->captcha->captchaToken)
                                        <a href="{{ route('captcha-tokens.edit', ['captcha_token' => $item->captcha->captcha_token_id]) }}">{{ $item->captcha->captchaToken->title }}</a>
                                    @endif
                                    <p><strong>{{ $item->type->getTitle() }}</strong></p>
                                </td>
                                <td>
                                    <p><strong>IP:</strong>
                                        @demo
                                            <span style="border: 1px solid #ff1810; color: #ff1810; font-weight: bold; font-size: 18px; padding: 7px; text-align: center;">{{ __('Demo Mode') }}</span>
                                        @else
                                            {{ $item->ip }}
                                        @endif
                                    </p>
                                    <p><strong>User Agent:</strong>
                                        @demo
                                            <span style="border: 1px solid #ff1810; color: #ff1810; font-weight: bold; font-size: 18px; padding: 7px; text-align: center;">{{ __('Demo Mode') }}</span>
                                        @else
                                            {{ $item->user_agent }}
                                        @endif
                                    </p>
                                    <p><strong>referer:</strong> {{ $item->referer }}</p>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
            @endcan
        </div>
    </div>
</x-private.layout>