@extends('app.my-account.layout-lite')
@section('page')
    <div class="px-3">
        <div class="d-flex align-items-baseline border-bottom px-3 py-2 mb-2 m-neg-3 bg-light">
            <h2 class="font-size-16 text-secondary fw-bold m-0 me-3">Login Attempt Verification Pins</h2>
        </div>
        @include('app.my-account.admin.login-attempts.filters')
        <div class="table-responsive">
            <table class="table table-sm table-hover table-striped table-bordered mb-0">
                <thead class="fw-bold text-secondary bg-light">
                    <tr>
                        <th>Created At</th>
                        <th>Email Address</th>
                        <th>Name</th>
                        <th>Token</th>
                        <th>Phone</th>
                        <th>Last Sent</th>
                        <th>Pin Verified</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($records as $record)
                        <tr>
                            <td>{{ friendly_date($record->created_at ?? $record->updated_at) }}</td>
                            <td>{{ $record->email }}</td>
                            <td>{{ $record->displayName() }}</td>
                            <td>{{ $record->pin }}</td>
                            <td>{{ $record->phone_number }}</td>
                            <td>{{ $record->pin_last_updated_at ? friendly_date($record->pin_last_updated_at) : '---' }}
                            </td>
                            <td>
                                @if($record->was_pin_validation_successful)
                                    <span class="text-success">YES</span>
                                @else
                                    <span class="text-danger">NO</span>
                                @endif
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>

        <div class="mt-3">
            {{ $records->appends(request()->input())->links() }}
        </div>
    </div>
@endsection
