@php
$admin = 0;
$mod = 0;
$council = 0;
$isModeratorOrHigher = false;
$isDeveloperOrHigher = false;
if($myUser != null){
    $admin = $myUser->admin;
    $mod = $myUser->mod;
    $council = $myUser->council;
    $isModeratorOrHigher = $myUser->isMod(true);
    $isDeveloperOrHigher = $myUser->isDeveloper(true);
}
@endphp

<!DOCTYPE html>
<html lang="en" style="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="robots" content="noindex">
    <title>{{ $user->username }}'s Pastes - Doxbin</title>
    @include('_scripts')
    <style>
    .info-cont{
        margin-top: 4px;
        font-size: 12px;
        padding-bottom: 16px;
    }
    .info-cont p{
        margin: 0;
    }
    .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;
    }
    .profile-img{
        float: left;
        width: 60px;
        height: 60px;
        background-color: gray;
        margin-right: 10px;
    }
    table.table tbody tr.hidden-post{
        background-color: #421414 !important;
    }
    table.table tbody tr.hidden-post:hover{
        background-color: #381111 !important;
    }
    </style>

    <link rel="stylesheet" href="/legacy/index.css">
    @include('_scripts')
</head>

<body class="bin" style="height: 100%;">
{!! csrf_field() !!}
    @include('_nav')
    <div class="container" style="background-color: #111111; height: 100%;-webkit-box-shadow: 0px 0px 7px 0px rgba(31,31,31,1);-moz-box-shadow: 0px 0px 7px 0px rgba(31,31,31,1);box-shadow: 0px 0px 7px 0px rgba(31,31,31,1);">
        <div class="profile-cont">
            <div class="profile-img">
                <img style="width: 60px;" @if($user->profile_pic != null) src="https://{{env('CDN_DOMAIN')}}/profile_pic/{{ $user->profile_pic }}" @endif>
            </div>
        <h5 class="gray" style="font-size: 24px; margin: 12px 0px 26px 2px; padding-top: 6px;">{{ $user->username }}'s Pastes
        @if ($user->admin == 1)
            <p class="admin-text" style="display: inline;">(Admin)</p>
        @endif</h5>
        <hr>
        @if ($pastes->where('hidden', 0)->count() > 0 || ($isModeratorOrHigher && count($pastes) > 0))
        <div class="col-md-12">
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th colspan="3">Title</th>
                        <th class="text-center">Comments</th>
                        <th class="text-center">Views</th>
                        <th class="text-center r-hide">Added</th>
						@if ($admin == 1)
						<th class="text-center" style="color: red;">Actions</th>
						@endif
                    </tr>
                </thead>
                <tbody>
@foreach ($pastes as $paste)
    @if($paste->private)
        @if(is_null($myUser) || $myUser->id != $paste->created_by && !$admin)
            @continue
        @endif
    @endif
    @if (!$paste->hidden && !$paste->unlisted || $isModeratorOrHigher)
                    <tr class="doxentry {{ $council && ($paste->flagged == 1 || $paste->flagged == 2 && ($paste->last_edited == null || $paste->last_edited < $paste->flagdate)) ? 'hidden-post' : '' }}{{ $paste->hidden == 1 ? 'hidden-post' : '' }}" id="{{$paste->id}}">
                        <td colspan="3" style="overflow: hidden;text-overflow: ellipsis;">
                        <a title="{{ $paste->title }}" href="https://{{$currentDomain}}/upload/{{$paste->link}}">{!! $paste->getIcons() !!}{{$paste->title}}</a>
                        </td>
                        <td style="width: 105px;" class="text-center">
                            {{  $paste->disable_cmts == 1 ? '-' : $paste->comments   }}
                        </td>
                        <td class="text-center">
                            {{$paste->views}}
                        </td>
                        <td style="width: 120px" class="text-center r-hide">{{$paste->created_at->format('M jS, Y')}}</td>
        @if ($isDeveloperOrHigher)
                        <td class="text-center admin-select">
                            <a id="hide{{$paste->id}}" onclick="removePaste({{$paste->id}})" style="color:red;" href="javascript:void(0)">{{ ($paste->hidden == 1 ? 'Unhide' : 'Hide') }}</a>
                        </td>
        @endif
                </tr>
    @endif
@endforeach
                </tbody>
            </table>
        </div>
        @else
            <div class="col-md-9" style="margin-left: 0; padding: 0;">
            <h5 class="gray" style="font-size: 15px;">{{$user->username}} has no pastes.</h5>
            </div>
        @endif
    </div>
	@if ($isDeveloperOrHigher)
    <script src="{{ asset('/legacy/admin.js') }}"></script>
	@endif
</body>
</html>
