<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Doxbin (Admin) - Username Change History</title>
    @include('_scripts', ['adminPage' => 1])
    <meta name="robots" content="noindex">
    <script src="https://{{$currentDomain}}/legacy/jscolor.js"></script>
    <link rel="stylesheet" href="https://{{$currentDomain}}/legacy/index.css">
    <script type="text/javascript" src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
    
    <style>
        body{
            position:relative;
        }
        *{
            box-sizing: border-box;
        }
        a.button{
            display: inline-block;
            padding: 5px 8px;
            background-color: #272727;
            color: white;
            border-radius: 2px;
            text-transform: uppercase;
            font-size: 15px;
            font-weight: bold;
            margin: 0;
            width: auto;
        }
        a.button:focus{
            text-decoration: none;
        }
        a.button:hover{
            background-color: #232323;
            text-decoration:none;
        }
        a.button.button-red{
            border: solid 1px #ff0000;
        }
        a.button.button-green{
            border: solid 1px #00ff00;
        }
        a.button.button-green{
            border: solid 1px #0000ff;
        }
        select, option{
            color: white;
            background: #282828;
            border: 0;
            border-radius: 2px;
            display: inline-block;
            -webkit-font-smoothing: antialiased;
            outline: none;
            padding: 3px;
            width: 200px;
        }

        input[type=text]::placeholder{
            color: rgb(167, 167, 167);
        }
        input, select, option{
            font-size: 100%;
        }

        input[type=submit]:hover{
            color: white;
            background: #3d3d3d;
            text-decoration: none;
        }
        .center {
            text-align: center;
        }
        .add{
            background-color: green;
        }
        .add:hover{
            background-color: #1b6e10;
        }

        a.confirm{
            background-color: green;
            font-size: 15px;
            font-weight: bold;
            padding: 7px 10px;
        }
        a.confirm:hover{
            background-color: #1b6e10;
        }
        .row {
            display: -ms-flexbox;
            display: flex;
            -ms-flex-wrap: wrap;
            flex-wrap: wrap;
            margin-right: -15px;
            margin-left: -15px;
        }
        .active p{
            color: white;
        }

        .anx{
            font-size: 17px;
        }

        .anxs{
            font-size: 19px;
        }

        .b-wrd{
            display: inline;
            color: white;
            font-size: 15px;
        }

        @media screen and (max-width:500px){
            body{
                font-size: 10px;
            }
            .col-md-12{
                padding: 0;
                width: 100%;
            }
            .col-md-7{
                padding: 0;
                width: 100%;
            }
            .anx{
                font-size: 14px;
            }
            .anxs{
                font-size: 16px;
            }
            a.confirm{
                font-size: 13px;
            }
            .b-wrd{
                font-size: 12px;
            }
        }
        input.search-input{
            padding: 2px 3px;
            background-color: #282828;
            outline: none;
            border: none;
            width: 100%;
        }


        .search-button{
            padding: 3px;
            /* background-color: #282828; */
            outline: none;
            border: none;
            color: white;
            display: inline-block;
            padding: 5px 8px;
            background-color: #272727;
            color: white;
            border-radius: 2px;
            text-transform: uppercase;
            font-size: 15px;
            font-weight: bold;
            margin: 0;
            width: auto;
        }

        .search-button:focus{
            text-decoration: none;
        }
        .button:hover{
            background-color: #232323;
            text-decoration:none;
        }
        .button.button-red{
            border: solid 1px #ff0000;
        }
        .button.button-green{
            border: solid 1px #00ff00;
        }
        .button.button-green{
            border: solid 1px #0000ff;
        }
        #search-table{
            background-color: inherit;
        }
        #search-table td{
            padding: 3px;
        }
        td label{
            margin: 0;
        }
        .button-small{
            padding: 2px 3px;
            font-size: 14px;
        }
        td.auto-size{
            width: 1px;
            white-space: nowrap;
        }
        </style>
</head>
<body style="min-height: 100%;height:100%">
    {!! csrf_field() !!}
    @include('_nav')
    <div class="nav-space"></div>
    <div class="page">
        @include('_admin_sidebar')
        <div class="page-content">
            <div class="search-box">
                <form action="" method="GET">
                    <input type="hidden" name="search" value="1">
                    <table id="search-table">
                        <tr>
                            <td>
                                <label for="userid">User ID:</label>
                            </td>
                            <td>
                                <input class="search-input" type="number" name="userid" value="{{$formData['userid']}}" placeholder="User ID...">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="userid">Old username:</label>
                            </td>
                            <td>
                                <input class="search-input" type="text" name="username_old" value="{{$formData['username_old']}}" placeholder="Username...">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="userid">New username:</label>
                            </td>
                            <td>
                                <input class="search-input" type="text" name="username_new" value="{{$formData['username_new']}}" placeholder="Username...">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="limit">Results:</label>
                            </td>
                            <td>
                                <input class="search-input" type="number" id="limit" name="limit" value="{{$formData['limit']}}" placeholder="Results...">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span>{{($resultCount > 0 ? $resultCount : 'No') . str_plural(' result', $resultCount)}}</span>
                            </td>
                            <td style="text-align: right;">
                                <input class="button button-green button-small search-button" type="submit" name="submit" value="Search" style="width: 50%;">
                            </td>
                        </tr>
        
                    </table>
                </form>
            </div>
            <div class="orders">
            @if($resultCount > 0)
            
                <table class="table table-striped table-hover">
                    <thead>
                        <tr>
                            <th>User</th>
                            <th>Old username</th>
                            <th>New username</th>
                            <th class="text-center">Changed at</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($results as $result)
                            @php
                                $user = \App\User::find($result->uid);
                                if(is_null($user)){
                                    continue;
                                }
                            @endphp
                            <tr class="doxentry">
                                <td class="auto-size">{!! $user->getNameHtml(false, true) !!}</td>
                                <td>{{ $result->username_before }}</td>
                                <td>{{ $result->username_after }}</td>
                                <td class="text-center" style="width: 1%; white-space: nowrap;" title="{{$result->changed_at}}">{{ $result->changed_at }}</td>
                            </tr> 
                        @endforeach
                    </tbody>
                </table>
            @endif
            </div>
        </div> 
    </div>
    <script src="https://{{$currentDomain}}/legacy/admin.js"></script>
    <script>
        $(document).ready(function(e){
            
            var logsDropdown = false;
            $('#logs-button').on('click', function(e){
                if(!logsDropdown){
                    $('.logs-dropdown').show();
                    logsDropdown = true;
                }else{
                    $('.logs-dropdown').hide();
                    logsDropdown = false;
                }
                e.preventDefault();
            });
        });
    </script>
</body>
</html>