@php
$admin = 0;
$mod = 0;
if($myUser != null){
    $admin = $myUser->admin;
    $mod = $myUser->mod;
}
@endphp

<!DOCTYPE html>
<html lang="en" style="min-height: 100%;">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description" content="Profile of {{ $user->username}}">
	
    @include('_scripts')
	
    <title>Doxbin - {{ $user->username }}</title>
    <style>
    .info-cont{
        margin: 4px 0 15px 0;
        font-size: 13px;
    }
    .info-cont p{
        margin: 0;
        line-height: 16px;
    }
    .info-cont p b{
        margin-right: 6px;
    }
    .admin-text{
        color: red;
        font-weight: bold;
    }
    .profile-cont{
        margin-bottom: 50px;
        margin-top: 60px;
        padding-top: 1px;
    }
    .gray{
        color: #bfbfbf;
        margin-top: 5px;
    }
    .admin-text{
        color: red;
        font-weight: bold;
    }
    .profile-img{
        float: left;
        width: 120px;
        height: 120px;
        background-color: gray;
        margin-right: 10px;
        -webkit-box-shadow: inset 0px 0px 5px 0px rgba(0,0,0,0.75);
        -moz-box-shadow: inset 0px 0px 5px 0px rgba(0,0,0,0.75);
        box-shadow: inset 0px 0px 5px 0px rgba(0,0,0,0.75);
        border-radius: 2px;
    }
    .button{
        line-height: 1.2;
        color: white;
        background: #b21c1c;
        border: 0;
        border-radius: 2px;
        display: inline-block;
        -webkit-font-smoothing: antialiased;
        outline: none;
        padding: 5px 5px 3px 5px;
        vertical-align: top;
        margin-top: 8px;
    }
    .button:hover{
        text-decoration: none;
        color: white;
		background: #8c1c1c;
    }
    .follow-button{
        display: inline-block;
        padding: 5px 8px;
        border: solid 1px #00ff00;
        background-color: #272727;
        color: white;
        border-radius: 2px;
        text-transform: uppercase;
        font-size: 15px;
        font-weight: bold;
        
        margin-top: 42px;
        float: right;
    }

    .follow-button:hover{
        text-decoration: none;
        color: white;
        background-color: #1D1D1D;
    }

    .follow-button:focus{
        color: white;
        text-decoration: none;
    }

    .admin-dropdown-btn{
        color: white;
        font-size: 25px;
        right: 0;
        position: absolute;
    }
    div.rcta{
        height: 100%;
        float:right;
    }
    div.uinfo{
        height: 100%;
        margin-bottom:20px;
    }
    .uinfo .uinfo-row{
        text-align: right;
        color: #bfbfbf;
        padding: 4px;
        font-size: 13px;
        border-bottom: 1px solid #282828;
    }
    .uinfo .uinfo-h{
        text-align: left;
        font-weight: bold;
        float:left;
    }
    .uinfo .uinfo-i{
        
    }
    div.pastes{
        margin-left: 0px;
        padding: 0 15px;
        border-right: 1px solid #282828;
    }
    
    div.profile-padding{
        padding: 0 15px;
        position:relative;
    }

    .edituser{
        margin-top: 0px;
        right:15px;
        position:absolute;
    }

    @media only screen and (max-width: 992px){
        div.rcta{
            border-left: none;
            padding-top: 10px;
            padding: 0;
            float: none;
        }
        div.uinfo{
            border-right: none;
            padding-top: 10px;
            padding: 0;
        }
        div.pastes{
            padding: 0;
            border: none;
        }
        .edituser{
            right: 0;
        }
        div.profile-padding{
            padding: 0;
        }
    }
    </style>
    <link rel="stylesheet" href="/legacy/index.css">
    {{-- <link rel="stylesheet" href="/legacy/profile.css"> --}}
</head>

<body class="bin" style="min-height: 100vh;">
{!! csrf_field() !!}
    @include('_nav')
    <div class="container" style="background-color: #111111; min-height: 100vh;border: 1px #282828;border-style: none solid;padding-bottom: 20px;">
        <div class="profile-cont" style="position:relative;">
            <div class="profile-padding">
                <div class="profile-img">
                    <img style="height: 120px; width: 120px;" src="https://{{env('CDN_DOMAIN')}}/profile_pic/{{ $user->profile_pic != null ? $user->profile_pic : 'default.jpg' }}">
                </div>
            {{-- a h5 tag and a display: inline-block has been adding to fix the glitter issue for Rich ranks. This does not affect other ranks from my testing. --}}
            <h5 class="gray" style="font-size: 24px; margin: 0px 20px 0px 2px; display: inline-block; padding-top: 0px;{!! $user->getNameStyle('#bfbfbf') !!}">{{ $user->username }}
                {!! $user->getRankHtml() !!}
            </h5>
            <a class="follow-button" href="/user/{{$user->username}}">View Profile</a>

            @if($admin == 1) 
            <a class="button edituser" href="/user/{{ $user->username }}/edit">Manage</a>
            @endif
        </div>
        <div class="info-cont">
            
            <p style="font-size: 15px; min-height: 87px;">
                {!! $user->getBioHtml() !!}
            </p>
            
        </div>
        <hr style="margin: 15px 0;">
            <div>
                <div class="col-md-12" style="margin-left: 0; padding: 0;">
                    <h4 class="gray" style="font-size: 20px;font-weight:bold;text-align: center;">Following</h4>
                <div class="db-cell-container">
                    <table class="table table-striped table-hover">
                        <thead>
                            <tr>
                                <th></th>
                                <th>Username</th>
                                <th class="text-center">Followed</th>
                            </tr>
                        </thead>
@foreach($following as $follower)
@php
    $u = createUserFromObjectWithUserInfo($follower, 'uid');
    if(is_null($u)){
        continue;
    }
@endphp
                        
                        <tbody>
                            <tr class="doxentry">
                                <td style="width: 1%;white-space: nowrap;"><img style="height: 50px; width: 50px;" src="https://{{env('CDN_DOMAIN')}}/profile_pic/{{ $u->getProfilePicture(true) }}"></td>
                                <td style="vertical-align: middle;">{!! $u->getNameHtml(true, true) !!}</td>
                                <td style="width: 1%;white-space: nowrap;vertical-align:middle;" class="text-center">{{ date('M jS, Y', $follower->followed_at) }}</td>
                            </tr>   
                        </tbody>
@endforeach
                    </table>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
