Update admin user views

This commit is contained in:
Daniel Supernault 2020-02-19 19:42:49 -07:00
parent 810dc2190f
commit fa97073478
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
8 changed files with 817 additions and 220 deletions

View File

@ -0,0 +1,84 @@
@extends('admin.partial.template-full')
@section('section')
<div class="title d-flex justify-content-between align-items-center">
<span><a href="/i/admin/users/show/{{$user->id}}" class="btn btn-outline-secondary btn-sm font-weight-bold">Back</a></span>
<span class="text-center">
<h3 class="font-weight-bold mb-0">&commat;{{$profile->username}}</h3>
<p class="mb-0 small text-muted text-uppercase font-weight-bold">
<span>{{$profile->statuses()->count()}} Posts</span>
<span class="px-1">|</span>
<span>{{$profile->followers()->count()}} Followers</span>
<span class="px-1">|</span>
<span>{{$profile->following()->count()}} Following</span>
</p>
</span>
<span>
<div class="dropdown">
<button class="btn btn-outline-secondary btn-sm font-weight-bold dropdown-toggle" type="button" id="userActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars"></i></button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userActions">
<a class="dropdown-item" href="/i/admin/users/show/{{$user->id}}">
<span class="font-weight-bold">Overview</span>
</a>
<a class="dropdown-item" href="/i/admin/users/message/{{$user->id}}">
<span class="font-weight-bold">Send Message</span>
</a>
<a class="dropdown-item" href="{{$profile->url()}}">
<span class="font-weight-bold">View Profile</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/edit/{{$user->id}}">
<span class="font-weight-bold">Edit</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modtools/{{$user->id}}">
<span class="font-weight-bold">Mod Tools</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modlogs/{{$user->id}}">
<span class="font-weight-bold">Mod Logs</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/delete/{{$user->id}}">
<span class="text-danger font-weight-bold">Delete Account</span>
</a>
</div>
</div>
</span>
</div>
<hr>
<div class="row mb-3">
<div class="col-12 col-md-8 offset-md-2">
<p class="title h4 font-weight-bold mt-2 py-2">Recent Activity</p>
<hr>
<div class="row">
<div class="col-12">
@if($logs->count() > 0)
<div class="list-group">
@foreach($logs as $log)
<div class="list-group-item d-flex justify-content-between align-items-center">
<div>
<p class="small text-muted font-weight-bold mb-0">{{$log->created_at->diffForHumans()}}</p>
<p class="lead mb-0">{{$log->message}}</p>
<p class="small text-muted font-weight-bold mb-0">
IP: {{$log->ip_address}}
</p>
</div>
<div>
<i class="fas fa-chevron-right fa-lg text-lighter"></i>
</div>
</div>
@endforeach
</div>
<div class="d-flex justify-content-center mt-3">
{{$logs->links()}}
</div>
@else
<div class="card card-body border shadow-none text-center">
No Activity found
</div>
@endif
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,60 @@
@extends('admin.partial.template-full')
@section('section')
<div class="title d-flex justify-content-between align-items-center">
<span><a href="/i/admin/users/show/{{$user->id}}" class="btn btn-outline-secondary btn-sm font-weight-bold">Back</a></span>
<span class="text-center">
<h3 class="font-weight-bold mb-0">&commat;{{$profile->username}}</h3>
<p class="mb-0 small text-muted text-uppercase font-weight-bold">
<span>{{$profile->statuses()->count()}} Posts</span>
<span class="px-1">|</span>
<span>{{$profile->followers()->count()}} Followers</span>
<span class="px-1">|</span>
<span>{{$profile->following()->count()}} Following</span>
</p>
</span>
<span>
<div class="dropdown">
<button class="btn btn-outline-secondary btn-sm font-weight-bold dropdown-toggle" type="button" id="userActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars"></i></button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userActions">
<a class="dropdown-item" href="/i/admin/users/show/{{$user->id}}">
<span class="font-weight-bold">Overview</span>
</a>
<a class="dropdown-item" href="/i/admin/users/activity/{{$user->id}}">
<span class="font-weight-bold">Activity</span>
</a>
<a class="dropdown-item" href="/i/admin/users/message/{{$user->id}}">
<span class="font-weight-bold">Send Message</span>
</a>
<a class="dropdown-item" href="{{$profile->url()}}">
<span class="font-weight-bold">View Profile</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/edit/{{$user->id}}">
<span class="font-weight-bold">Edit</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modtools/{{$user->id}}">
<span class="font-weight-bold">Mod Tools</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modlogs/{{$user->id}}">
<span class="font-weight-bold">Mod Logs</span>
</a>
</div>
</div>
</span>
</div>
<hr>
<div class="row">
<div class="col-12 col-md-8 offset-md-2">
<div class="card card-body">
<p class="lead text-center py-5">Are you sure you want to delete this account?</p>
<p class="mb-0">
<form method="post">
@csrf
<button type="submit" class="btn btn-danger btn-block font-weight-bold">DELETE ACCOUNT</button>
</form>
</p>
</div>
</div>
</div>
@endsection

View File

@ -1,101 +1,100 @@
@extends('admin.partial.template')
@extends('admin.partial.template-full')
@section('section')
<div class="title d-flex justify-content-between">
<h3 class="font-weight-bold">Edit User</h3>
<span><a href="{{route('admin.users')}}" class="btn btn-outline-primary btn-sm font-weight-bold">Back</a></span>
</div>
<hr>
<div class="title d-flex justify-content-between align-items-center">
<span><a href="/i/admin/users/show/{{$user->id}}" class="btn btn-outline-secondary btn-sm font-weight-bold">Back</a></span>
<span class="text-center">
<h3 class="font-weight-bold mb-0">&commat;{{$profile->username}}</h3>
<p class="mb-0 small text-muted text-uppercase font-weight-bold">
<span>{{$profile->statuses()->count()}} Posts</span>
<span class="px-1">|</span>
<span>{{$profile->followers()->count()}} Followers</span>
<span class="px-1">|</span>
<span>{{$profile->following()->count()}} Following</span>
</p>
</span>
<span>
<div class="dropdown">
<button class="btn btn-outline-secondary btn-sm font-weight-bold dropdown-toggle" type="button" id="userActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars"></i></button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userActions">
<a class="dropdown-item" href="/i/admin/users/show/{{$user->id}}">
<span class="font-weight-bold">Overview</span>
</a>
<a class="dropdown-item" href="/i/admin/users/activity/{{$user->id}}">
<span class="font-weight-bold">Activity</span>
</a>
<a class="dropdown-item" href="/i/admin/users/message/{{$user->id}}">
<span class="font-weight-bold">Send Message</span>
</a>
<a class="dropdown-item" href="{{$profile->url()}}">
<span class="font-weight-bold">View Profile</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/modtools/{{$user->id}}">
<span class="font-weight-bold">Mod Tools</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modlogs/{{$user->id}}">
<span class="font-weight-bold">Mod Logs</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/delete/{{$user->id}}">
<span class="text-danger font-weight-bold">Delete Account</span>
</a>
</div>
</div>
</span>
</div>
<hr>
<div class="row mb-3">
<div class="col-12 col-md-3">
<div class="card">
<div class="card-body text-center">
<p class="h4 mb-0 font-weight-bold">{{$profile->statusCount()}}</p>
<p class="text-muted font-weight-bold small mb-0">Posts</p>
</div>
</div>
</div>
<div class="col-12 col-md-3">
<div class="card">
<div class="card-body text-center">
<p class="h4 mb-0 font-weight-bold">{{$profile->likes()->count()}}</p>
<p class="text-muted font-weight-bold small mb-0">Likes</p>
</div>
</div>
</div>
<div class="col-12 col-md-3">
<div class="card">
<div class="card-body text-center">
<p class="h4 mb-0 font-weight-bold">{{$profile->reports()->count()}}</p>
<p class="text-muted font-weight-bold small mb-0">Reports</p>
</div>
</div>
</div>
<div class="col-12 col-md-3">
<div class="card">
<div class="card-body text-center">
<p class="h4 mb-0 font-weight-bold">{{PrettyNumber::size($profile->media()->sum('size'))}}</p>
<p class="text-muted font-weight-bold small mb-0">Storage Used</p>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-8 offset-md-2">
<p class="title h4 font-weight-bold mt-2 py-2">Edit</p>
<hr>
<div class="row">
<div class="col-12">
<form method="post">
@csrf
<div class="form-group">
<label class="font-weight-bold text-muted">Display Name</label>
<input type="text" class="form-control" name="name" value="{{$user->name}}">
</div>
<div class="form-group">
<label class="font-weight-bold text-muted">Username</label>
<input type="text" class="form-control" name="username" value="{{$user->username}}">
</div>
<div class="form-group">
<label class="font-weight-bold text-muted">Email address</label>
<input type="email" class="form-control" name="email" value="{{$user->email}}" placeholder="Enter email">
<p class="help-text small text-muted font-weight-bold">
@if($user->email_verified_at)
<span class="text-success">Verified</span> for {{$user->email_verified_at->diffForHumans()}}
@else
<span class="text-danger">Unverified</span> email.
@endif
</p>
</div>
<div class="form-group">
<label class="font-weight-bold text-muted">Bio</label>
<textarea class="form-control" rows="4" name="bio" placeholder="Empty bio">{{$profile->bio}}</textarea>
</div>
<div class="form-group">
<label class="font-weight-bold text-muted">Website</label>
<input type="text" class="form-control" name="website" value="{{$user->website}}" placeholder="No website added">
</div>
<div class="form-group">
<label class="font-weight-bold text-muted">Admin</label>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="customSwitch1" {{$user->is_admin ? 'checked="checked"' : ''}}>
<label class="custom-control-label" for="customSwitch1"></label>
</div>
<p class="help-text small text-muted font-weight-bold">For security reasons, you cannot change admin status on this form. Use the CLI instead.</p>
</div>
<hr>
<p class="float-right">
<button type="submit" class="btn btn-primary font-weight-bold py-1">SAVE</button>
</p>
</form>
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12 col-md-4">
<div class="card">
<div class="card-body text-center">
<img src="{{$profile->avatarUrl()}}" class="img-thumbnail rounded-circle" width="128px" height="128px">
</div>
<div class="card-footer bg-white">
<p class="font-weight-bold mb-0 small">Last updated: {{$profile->avatar->updated_at->diffForHumans()}}</p>
</div>
</div>
</div>
<div class="col-12 col-md-8">
<div class="card">
<div class="card-body p-5 d-flex justify-content-center align-items-center">
<div class="text-center py-3">
<p class="font-weight-bold mb-0">
{{$profile->username}}
</p>
<p class="h3 font-weight-bold">
{{$profile->emailUrl()}}
</p>
<p class="font-weight-bold mb-0 text-muted">
Member Since: {{$profile->created_at->format('M Y')}}
</p>
</div>
</div>
</div>
</div>
</div>
<hr>
<div class="mx-3">
<div class="sub-title h4 font-weight-bold mb-4">
Account Settings
</div>
<form>
<div class="form-group">
<label class="font-weight-bold text-muted">Display Name</label>
<input type="text" class="form-control" value="{{$user->name}}">
</div>
<div class="form-group">
<label class="font-weight-bold text-muted">Username</label>
<input type="text" class="form-control" value="{{$user->username}}">
</div>
<div class="form-group">
<label class="font-weight-bold text-muted">Email address</label>
<input type="email" class="form-control" value="{{$user->email}}" placeholder="Enter email">
<p class="help-text small text-muted font-weight-bold">
@if($user->email_verified_at)
<span class="text-success">Verified</span> for {{$user->email_verified_at->diffForHumans()}}
@else
<span class="text-danger">Unverified</span> email.
@endif
</p>
</div>
</form>
</div>
@endsection

View File

@ -2,141 +2,112 @@
@section('header')
<div class="bg-primary">
<div class="container">
<div class="my-5"></div>
</div>
<div class="container">
<div class="my-5">test</div>
</div>
</div>
@endsection
@section('section')
<div class="title">
<h3 class="font-weight-bold">Users</h3>
</div>
<hr>
<div class="table-responsive">
<table class="table">
<thead class="bg-light">
<tr class="text-center">
<th scope="col" class="border-0" width="10%">
<span>ID</span>
</th>
<th scope="col" class="border-0" width="30%">
<span>Username</span>
</th>
<th scope="col" class="border-0" width="15%">
<span>Statuses</span>
</th>
<th scope="col" class="border-0" width="15%">
<span>Storage</span>
</th>
<th scope="col" class="border-0" width="30%">
<span>Actions</span>
</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr class="font-weight-bold text-center user-row">
<th scope="row">
<span class="{{$user->status == 'deleted' ? 'text-danger':''}}">{{$user->id}}</span>
</th>
<td class="text-left">
<img src="{{$user->profile ? $user->profile->avatarUrl() : '/storage/avatars/default.png?v=1'}}" width="28px" class="rounded-circle mr-2" style="border:1px solid #ccc">
<span title="{{$user->username}}" data-toggle="tooltip" data-placement="bottom">
<span class="{{$user->status == 'deleted' ? 'text-danger':''}}">{{$user->username}}</span>
@if($user->is_admin)
<i class="text-danger fas fa-certificate" title="Admin"></i>
@endif
</span>
</td>
<td>
<span class="{{$user->status == 'deleted' ? 'text-danger':''}}">{{$user->profile ? $user->profile->statusCount() : 0}}</span>
</td>
<td>
<span class="{{$user->status == 'deleted' ? 'text-danger':''}}"><p class="human-size mb-0" data-bytes="{{App\Media::whereUserId($user->id)->sum('size')}}"></p></span>
</td>
<td>
<span class="action-row font-weight-lighter">
<a href="{{$user->url()}}" class="pr-2 text-muted small font-weight-bold" title="View Profile" data-toggle="tooltip" data-placement="bottom">
View
</a>
<div class="title">
<h3 class="font-weight-bold">Users</h3>
</div>
<hr>
<div class="table-responsive">
<table class="table">
<thead class="bg-light">
<tr class="text-center">
<th scope="col" class="border-0" width="10%">
<span>ID</span>
</th>
<th scope="col" class="border-0" width="30%">
<span>Username</span>
</th>
<th scope="col" class="border-0" width="30%">
<span>Actions</span>
</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
@if($user->status == 'deleted')
<tr class="font-weight-bold text-center user-row">
<th scope="row">
<span class="text-danger" class="text-monospace">{{$user->id}}</span>
</th>
<td class="text-left">
<img src="/storage/avatars/default.png?v=3" width="28px" class="rounded-circle mr-2" style="border:1px solid #ccc">
<span title="{{$user->username}}" data-toggle="tooltip" data-placement="bottom">
<span class="text-danger">{{$user->username}}</span>
</span>
</td>
<td>
<span class="font-weight-bold small">
<span class="text-danger">Account Deleted</span>
</span>
</td>
</tr>
@else
<tr class="font-weight-bold text-center user-row">
<th scope="row">
<span class="text-monospace">{{$user->id}}</span>
</th>
<td class="text-left">
<img src="{{$user->profile->avatarUrl()}}" width="28px" class="rounded-circle mr-2" style="border:1px solid #ccc">
<span title="{{$user->username}}" data-toggle="tooltip" data-placement="bottom">
<span>{{$user->username}}</span>
@if($user->is_admin)
<i class="text-danger fas fa-certificate" title="Admin"></i>
@endif
</span>
</td>
<td>
<span class="action-row font-weight-lighter">
<a href="{{$user->url()}}" class="pr-2 text-muted small font-weight-bold" title="View Profile" data-toggle="tooltip" data-placement="bottom">
Profile
</a>
<a href="/i/admin/users/edit/{{$user->id}}" class="pr-2 text-muted small font-weight-bold" title="Edit Profile" data-toggle="tooltip" data-placement="bottom">
Edit
</a>
<a href="/i/admin/users/show/{{$user->id}}" class="pr-2 text-muted small font-weight-bold" title="Profile Review" data-toggle="tooltip" data-placement="bottom">
Review
</a>
<a href="#" class="text-muted action-btn small font-weight-bold" title="Delete Profile" data-toggle="tooltip" data-placement="bottom" data-id="{{$user->id}}" data-action="delete">
Delete
</a>
</span>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="d-flex justify-content-center mt-5 small">
{{$users->links()}}
</div>
<a href="/i/admin/users/modlogs/{{$user->id}}" class="pr-2 text-muted small font-weight-bold" title="Moderation Logs" data-toggle="tooltip" data-placement="bottom">
Mod Logs
</a>
</span>
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
<div class="d-flex justify-content-center mt-5 small">
{{$users->links()}}
</div>
@endsection
@push('styles')
<style type="text/css">
.jqstooltip {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
border: 0 !important;
border-radius: 2px;
max-width: 20px;
}
.user-row .action-row {
display: none;
}
.user-row:hover {
background-color: #eff8ff;
}
.user-row:hover .action-row {
display: block;
}
.user-row:hover .last-active {
display: none;
}
.user-row:hover {
background-color: #eff8ff;
}
.user-row:hover .action-row {
display: block;
}
.user-row:hover .last-active {
display: none;
}
</style>
@endpush
@push('scripts')
<script type="text/javascript">
$(document).ready(function() {
$('.human-size').each(function(d,a) {
let el = $(a);
let size = el.data('bytes');
el.text(filesize(size, {round: 0}));
});
$(document).on('click', '.action-btn', function(e) {
e.preventDefault();
let el = $(this);
let id = el.data('id');
let action = el.data('action');
switch(action) {
case 'view':
window.location.href = el.data('url');
break;
case 'edit':
let redirect = '/i/admin/users/edit/' + id;
window.location.href = redirect;
break;
case 'delete':
swal('Error', 'Sorry this action is not yet available', 'error');
break;
}
});
});
</script>
<script type="text/javascript">
$(document).ready(function() {
$('.human-size').each(function(d,a) {
let el = $(a);
let size = el.data('bytes');
el.text(filesize(size, {round: 0}));
});
});
</script>
@endpush

View File

@ -0,0 +1,112 @@
@extends('admin.partial.template-full')
@section('section')
<div class="title d-flex justify-content-between align-items-center">
<span><a href="/i/admin/users/show/{{$user->id}}" class="btn btn-outline-secondary btn-sm font-weight-bold">Back</a></span>
<span class="text-center">
<h3 class="font-weight-bold mb-0">&commat;{{$profile->username}}</h3>
<p class="mb-0 small text-muted text-uppercase font-weight-bold">
<span>{{$profile->statuses()->count()}} Posts</span>
<span class="px-1">|</span>
<span>{{$profile->followers()->count()}} Followers</span>
<span class="px-1">|</span>
<span>{{$profile->following()->count()}} Following</span>
</p>
</span>
<span>
<div class="dropdown">
<button class="btn btn-outline-secondary btn-sm font-weight-bold dropdown-toggle" type="button" id="userActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars"></i></button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userActions">
<a class="dropdown-item" href="/i/admin/users/show/{{$user->id}}">
<span class="font-weight-bold">Overview</span>
</a>
<a class="dropdown-item" href="{{$profile->url()}}">
<span class="font-weight-bold">View Profile</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/edit/{{$user->id}}">
<span class="font-weight-bold">Edit</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modtools/{{$user->id}}">
<span class="font-weight-bold">Mod Tools</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modlogs/{{$user->id}}">
<span class="font-weight-bold">Mod Logs</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/delete/{{$user->id}}">
<span class="text-danger font-weight-bold">Delete Account</span>
</a>
</div>
</div>
</span>
</div>
<hr>
<div class="row mb-3">
<div class="col-12 col-md-8 offset-md-2">
<p class="title h4 font-weight-bold mt-2 py-2">Send Message</p>
<hr>
<div class="row">
<div class="col-12">
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form method="post" id="messageForm">
@csrf
<div class="form-group">
<textarea class="form-control" rows="8" placeholder="Message body ..." id="message" name="message"></textarea>
<p class="help-text mb-0 small text-muted">
<span>Plain text only, html will not be rendered.</span>
<span class="float-right msg-counter"><span class="msg-count">0</span>/500</span>
</p>
</div>
<p class="float-right">
<button type="button" class="btn btn-primary py-1 font-weight-bold" onclick="submitWarning()"><i class="fas fa-message"></i> SEND</button>
</p>
</form>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
$('#message').on('keyup change paste submit', function(e) {
let len = e.target.value.length;
$('.msg-count').text(len);
});
function submitWarning() {
let msg = document.querySelector('#message');
if(msg.value.length < 5) {
swal('Oops!', 'Your message must be longer than 5 characters.', 'error');
return;
}
if(msg.value.length > 500) {
swal('Oops!', 'Your message must be shorter than 500 characters.', 'error');
return;
}
swal({
title: "Are you sure?",
text: "Are you sure you want to send this message to {{$user->username}}?",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((sendMessage) => {
if (sendMessage) {
$('#messageForm').submit();
} else {
return;
}
});
}
</script>
@endpush

View File

@ -0,0 +1,143 @@
@extends('admin.partial.template-full')
@section('section')
<div class="title d-flex justify-content-between align-items-center">
<span><a href="/i/admin/users/show/{{$user->id}}" class="btn btn-outline-secondary btn-sm font-weight-bold">Back</a></span>
<span class="text-center">
<h3 class="font-weight-bold mb-0">&commat;{{$profile->username}}</h3>
<p class="mb-0 small text-muted text-uppercase font-weight-bold">
<span>{{$profile->statuses()->count()}} Posts</span>
<span class="px-1">|</span>
<span>{{$profile->followers()->count()}} Followers</span>
<span class="px-1">|</span>
<span>{{$profile->following()->count()}} Following</span>
</p>
</span>
<span>
<div class="dropdown">
<button class="btn btn-outline-secondary btn-sm font-weight-bold dropdown-toggle" type="button" id="userActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars"></i></button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userActions">
<a class="dropdown-item" href="/i/admin/users/show/{{$user->id}}">
<span class="font-weight-bold">Overview</span>
</a>
<a class="dropdown-item" href="/i/admin/users/activity/{{$user->id}}">
<span class="font-weight-bold">Activity</span>
</a>
<a class="dropdown-item" href="/i/admin/users/message/{{$user->id}}">
<span class="font-weight-bold">Send Message</span>
</a>
<a class="dropdown-item" href="{{$profile->url()}}">
<span class="font-weight-bold">View Profile</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/edit/{{$user->id}}">
<span class="font-weight-bold">Edit</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modtools/{{$user->id}}">
<span class="font-weight-bold">Mod Tools</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/delete/{{$user->id}}">
<span class="text-danger font-weight-bold">Delete Account</span>
</a>
</div>
</div>
</span>
</div>
<hr>
<div class="row mb-3">
<div class="col-12 col-md-8 offset-md-2">
<p class="title h4 font-weight-bold mt-2 py-2">Moderation Logs</p>
<hr>
<div class="row">
<div class="col-12">
<div class="card card-body shadow-none border mb-3">
<form method="post">
@csrf
<div class="form-group">
<textarea class="form-control" name="message" id="message" rows="4" style="resize: none;" placeholder="Send a message to other admins and mods, they will be notified"></textarea>
@if ($errors->any())
@foreach ($errors->all() as $error)
<p class="invalid-feedback mb-0" style="display:block;">
<strong>{{ $error }}</strong>
</p>
@endforeach
@endif
</div>
<div>
<span class="small text-muted font-weight-bold">
<span class="msg-count">0</span>/500
</span>
<span class="float-right">
<button class="btn btn-primary btn-sm py-1 font-weight-bold">SEND</button>
</span>
</div>
</form>
</div>
@if($logs->count() > 0)
<div class="list-group">
@foreach($logs as $log)
<div class="list-group-item d-flex justify-content-between align-items-center">
@if($log->message != null)
<div class="d-flex justify-content-between">
<div class="mr-3">
<img src="{{$log->admin->profile->avatarUrl()}}" width="40px" height="40px" class="border p-1 rounded-circle">
</div>
<div style="min-width: 400px;">
@if($log->user_id != Auth::id())
<div class="p-3 bg-primary rounded">
<p class="mb-0 text-white" style="font-weight: 500;">{{$log->message}}</p>
</div>
@else
<div class="p-3 bg-light rounded">
<p class="mb-0 text-dark" style="font-weight: 500;">{{$log->message}}</p>
</div>
@endif
<div class="d-flex justify-content-between small text-muted font-weight-bold mb-0">
<span class="mr-4">
&commat;{{$log->user_username}}
</span>
<span>
{{$log->created_at->diffForHumans()}}
</span>
</div>
</div>
</div>
@else
<div>
<p class="small text-muted font-weight-bold mb-0">{{$log->created_at->diffForHumans()}}</p>
<p class="lead mb-0">{{$log->actionToText()}}</p>
<p class="small text-muted font-weight-bold mb-0">
by: {{$log->user_username}}
</p>
</div>
<div>
<i class="fas fa-chevron-right fa-lg text-lighter"></i>
</div>
@endif
</div>
@endforeach
</div>
<div class="d-flex justify-content-center mt-3">
{{$logs->links()}}
</div>
@else
<div class="card card-body border shadow-none text-center">
No Activity found
</div>
@endif
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
$('#message').on('keyup change paste submit', function(e) {
let len = e.target.value.length;
$('.msg-count').text(len);
});
</script>
@endpush

View File

@ -0,0 +1,107 @@
@extends('admin.partial.template-full')
@section('section')
<div class="title d-flex justify-content-between align-items-center">
<span><a href="/i/admin/users/show/{{$user->id}}" class="btn btn-outline-secondary btn-sm font-weight-bold">Back</a></span>
<span class="text-center">
<h3 class="font-weight-bold mb-0">&commat;{{$profile->username}}</h3>
<p class="mb-0 small text-muted text-uppercase font-weight-bold">
<span>{{$profile->statuses()->count()}} Posts</span>
<span class="px-1">|</span>
<span>{{$profile->followers()->count()}} Followers</span>
<span class="px-1">|</span>
<span>{{$profile->following()->count()}} Following</span>
</p>
</span>
<span>
<div class="dropdown">
<button class="btn btn-outline-secondary btn-sm font-weight-bold dropdown-toggle" type="button" id="userActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars"></i></button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userActions">
<a class="dropdown-item" href="/i/admin/users/show/{{$user->id}}">
<span class="font-weight-bold">Overview</span>
</a>
<a class="dropdown-item" href="/i/admin/users/activity/{{$user->id}}">
<span class="font-weight-bold">Activity</span>
</a>
<a class="dropdown-item" href="/i/admin/users/message/{{$user->id}}">
<span class="font-weight-bold">Send Message</span>
</a>
<a class="dropdown-item" href="{{$profile->url()}}">
<span class="font-weight-bold">View Profile</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/edit/{{$user->id}}">
<span class="font-weight-bold">Edit</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modlogs/{{$user->id}}">
<span class="font-weight-bold">Mod Logs</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/delete/{{$user->id}}">
<span class="text-danger font-weight-bold">Delete Account</span>
</a>
</div>
</div>
</span>
</div>
<hr>
<div class="row mb-3">
<div class="col-12 col-md-8 offset-md-2">
<p class="title h4 font-weight-bold mt-2 py-2">Mod Tools</p>
<hr>
<div class="row">
<div class="col-12 col-md-6">
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
@csrf
<input type="hidden" name="profile_id" value="{{$profile->id}}">
<button class="btn btn-outline-primary py-0 font-weight-bold">Enforce CW</button>
<p class="help-text text-muted font-weight-bold small">Adds a CW to every post made by this account.</p>
</form>
</div>
<div class="col-12 col-md-6">
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
@csrf
<input type="hidden" name="profile_id" value="{{$profile->id}}">
<button class="btn btn-outline-primary py-0 font-weight-bold">Unlisted Posts</button>
<p class="help-text text-muted font-weight-bold small">Removes account from public/network timelines.</p>
</form>
</div>
<div class="col-12 col-md-6">
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
@csrf
<input type="hidden" name="profile_id" value="{{$profile->id}}">
<button class="btn btn-outline-primary py-0 font-weight-bold">No Autolinking</button>
<p class="help-text text-muted font-weight-bold small">Do not transform mentions, hashtags or urls into HTML.</p>
</form>
</div>
<div class="col-12 col-md-6">
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
@csrf
<input type="hidden" name="profile_id" value="{{$profile->id}}">
<button class="btn btn-outline-primary py-0 font-weight-bold">Disable Account</button>
<p class="help-text text-muted font-weight-bold small">Temporarily disable account until next time user log in.</p>
</form>
</div>
<div class="col-12 col-md-6">
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
@csrf
<input type="hidden" name="profile_id" value="{{$profile->id}}">
<button class="btn btn-outline-primary py-0 font-weight-bold">Suspend Account</button>
<p class="help-text text-muted font-weight-bold small">This prevents any new interactions, without deleting existing data.</p>
</form>
</div>
<div class="col-12 col-md-6">
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
@csrf
<input type="hidden" name="profile_id" value="{{$profile->id}}">
<button class="btn btn-outline-danger py-0 font-weight-bold">Lock down Account</button>
<p class="help-text text-muted font-weight-bold small">This disables the account and changes the password, forcing account to reset password via verified email.</p>
</form>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,121 @@
@extends('admin.partial.template-full')
@section('section')
<div class="title d-flex justify-content-between align-items-center">
<span><a href="{{route('admin.users')}}" class="btn btn-outline-secondary btn-sm font-weight-bold">Back</a></span>
<span class="text-center">
<h3 class="font-weight-bold mb-0">&commat;{{$profile->username}}</h3>
<p class="mb-0 small text-muted text-uppercase font-weight-bold">
<span>{{$profile->statuses()->count()}} Posts</span>
<span class="px-1">|</span>
<span>{{$profile->followers()->count()}} Followers</span>
<span class="px-1">|</span>
<span>{{$profile->following()->count()}} Following</span>
</p>
</span>
<span>
<div class="dropdown">
<button class="btn btn-outline-secondary btn-sm font-weight-bold dropdown-toggle" type="button" id="userActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-bars"></i></button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userActions">
<a class="dropdown-item" href="/i/admin/users/activity/{{$user->id}}">
<span class="font-weight-bold">Activity</span>
</a>
<a class="dropdown-item" href="/i/admin/users/message/{{$user->id}}">
<span class="font-weight-bold">Send Message</span>
</a>
<a class="dropdown-item" href="{{$profile->url()}}">
<span class="font-weight-bold">View Profile</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/edit/{{$user->id}}">
<span class="font-weight-bold">Edit</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modtools/{{$user->id}}">
<span class="font-weight-bold">Mod Tools</span>
</a>
<a class="dropdown-item" href="/i/admin/users/modlogs/{{$user->id}}">
<span class="font-weight-bold">Mod Logs</span>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/i/admin/users/delete/{{$user->id}}">
<span class="text-danger font-weight-bold">Delete Account</span>
</a>
</div>
</div>
</div>
<hr>
<div class="row mb-3">
<div class="col-12 col-md-4">
<div class="card shadow-none border">
<div class="card-body text-center">
<img src="{{$profile->avatarUrl()}}" class="box-shadow rounded-circle" width="128px" height="128px">
<p class="mt-3 mb-0 lead">
<span class="font-weight-bold">{{$profile->name}}</span>
</p>
@if($user->is_admin == true)
<p class="mb-0">
<span class="badge badge-danger badge-sm">ADMIN</span>
</p>
@endif
<p class="mb-0 text-center text-muted">
Joined {{$profile->created_at->diffForHumans()}}
</p>
</div>
<table class="table mb-0">
<tbody>
<tr>
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">bookmarks</th>
<td class="text-right font-weight-bold">{{$profile->bookmarks()->count()}}</td>
</tr>
<tr>
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">collections</th>
<td class="text-right font-weight-bold">{{$profile->collections()->count()}}</td>
</tr>
<tr>
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">likes</th>
<td class="text-right font-weight-bold">{{$profile->likes()->count()}}</td>
</tr>
<tr>
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">reports</th>
<td class="text-right font-weight-bold">{{$profile->reports()->count()}}</td>
</tr>
<tr>
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">reported</th>
<td class="text-right font-weight-bold">{{$profile->reported()->count()}}</td>
</tr>
<tr>
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">Active stories</th>
<td class="text-right font-weight-bold">{{$profile->stories()->count()}}</td>
</tr>
<tr>
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">storage used</th>
<td class="text-right font-weight-bold">{{PrettyNumber::size($profile->media()->sum('size'))}}<span class="text-muted"> / {{PrettyNumber::size(config('pixelfed.max_account_size') * 1000)}}</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-12 col-md-8">
<p class="title h4 font-weight-bold mt-2 py-2">Recent Posts</p>
<hr>
<div class="row">
@foreach($profile->statuses()->whereHas('media')->latest()->take(9)->get() as $item)
<div class="col-12 col-md-4 col-sm-6 px-0" style="margin-bottom: 1px;">
<a href="{{$item->url()}}">
<img src="{{$item->thumb(true)}}" width="200px" height="200px">
</a>
</div>
@endforeach
@if($profile->statuses()->whereHas('media')->count() == 0)
<div class="col-12">
<div class="card card-body border shadow-none bg-transparent">
<p class="text-center mb-0 text-muted">No statuses found</p>
</div>
</div>
@endif
</div>
</div>
</div>
@endsection