(Update) Staff Notes System

- closes #267
- Ability to delete staff notes
- Created At column added and displayed in human format
This commit is contained in:
HDVinnie
2018-04-27 20:51:44 -04:00
parent 3a95b6ccaf
commit 802daeaf3f
6 changed files with 78 additions and 50 deletions
+11 -1
View File
@@ -53,7 +53,17 @@ class NoteController extends Controller
// Activity Log
\LogActivity::addToLog("Staff Member {$staff->username} has added a note on {$user->username} account.");
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('Your Staff Note Has Successfully Posted', 'Yay!', ['options']));
return redirect()->route('profile', ['username' => $user->username, 'id' => $user->id])->with(Toastr::success('Note Has Successfully Posted', 'Yay!', ['options']));
}
public function deleteNote($id)
{
$note = Note::findOrFail($id);
$note->delete();
return redirect()
->back()
->with(Toastr::success('Note Has Successfully Been Deleted', 'Yay!', ['options']));
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ return [
'torrent-moderation' => 'Torrent Moderation',
'user-tools' => 'User Tools',
'user-search' => 'User Search',
'user-notes' => 'User Notes',
'user-notes' => 'User Notes Log',
'user-gifting' => 'User Gifting',
'mass-pm' => 'Mass PM',
'logs' => 'Logs',
+44 -30
View File
@@ -30,36 +30,50 @@
<div class="col-sm-12">
<h2>Notes <span class="text-blue"><strong><i class="fa fa-note"></i> {{ $notes->count() }} </strong></span>
</h2>
<table class="table table-condensed table-striped table-bordered table-hover">
<thead>
<tr>
<th>User</th>
<th>Staff</th>
<th>Message</th>
</tr>
</thead>
<tbody>
@if(count($notes) == 0)
<p>The are no notes in database for this user!</p>
@else
@foreach($notes as $n)
<tr>
<td>
<a class="name"
href="{{ route('profile', ['username' => $n->noteduser->username, 'id' => $n->user_id ]) }}">{{ $n->noteduser->username }}</a>
</td>
<td>
<a class="name"
href="{{ route('profile', ['username' => $n->staffuser->username, 'id' => $n->staff_id ]) }}">{{ $n->staffuser->username }}</a>
</td>
<td>
{{ $n->message }}
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<div class="table-responsive">
<table class="table table-condensed table-striped table-bordered table-hover">
<thead>
<tr>
<th>User</th>
<th>Staff</th>
<th>Message</th>
<th>Created On</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
@if(count($notes) == 0)
<p>The are no notes in database for this user!</p>
@else
@foreach($notes as $n)
<tr>
<td>
<a class="name"
href="{{ route('profile', ['username' => $n->noteduser->username, 'id' => $n->user_id ]) }}">{{ $n->noteduser->username }}</a>
</td>
<td>
<a class="name"
href="{{ route('profile', ['username' => $n->staffuser->username, 'id' => $n->staff_id ]) }}">{{ $n->staffuser->username }}</a>
</td>
<td>
{{ $n->message }}
</td>
<td>
{{ $n->created_at->toDayDateTimeString() }}
({{ $n->created_at->diffForHumans() }})
</td>
<td>
<a href="{{ route('deleteNote', ['id' => $n->id]) }}"
class="btn btn-xs btn-danger">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
</div>
<div class="text-center">{{ $notes->links() }}</div>
+17 -13
View File
@@ -10,18 +10,9 @@
@section('breadcrumb')
<li>
<a href="{{ route('staff_dashboard') }}" itemprop="url" class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">Staff Dashboard</span>
</a>
</li>
<li>
<a href="{{ route('user_search') }}" itemprop="url" class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">User Search</span>
</a>
</li>
<li>
<a href="{{ route('user_results') }}" itemprop="url" class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">User Search Results</span>
<a href="{{ route('profile', ['username' => $user->username, 'id' => $user->id]) }}" itemprop="url"
class="l-breadcrumb-item-link">
<span itemprop="title" class="l-breadcrumb-item-link-title">{{ $user->username }}</span>
</a>
</li>
<li>
@@ -33,7 +24,9 @@
@section('content')
<div class="container">
<h1 class="title"><i class="fa fa-gear"></i> Edit User {{ $user->username }}</h1>
<h1 class="title"><i class="fa fa-gear"></i> Edit User <a
href="{{ route('profile', ['username' => $user->username, 'id' => $user->id]) }}">{{ $user->username }}</a>
</h1>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#account" aria-controls="account" role="tab"
data-toggle="tab" aria-expanded="true">Account</a></li>
@@ -181,6 +174,8 @@
<th>User</th>
<th>Staff</th>
<th>Message</th>
<th>Created On</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
@@ -198,6 +193,15 @@
<td>
{{ $n->message }}
</td>
<td>
{{ $n->created_at->toDayDateTimeString() }} ({{ $n->created_at->diffForHumans() }})
</td>
<td>
<a href="{{ route('deleteNote', ['id' => $n->id]) }}"
class="btn btn-xs btn-danger">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
@endforeach
@endif
@@ -41,7 +41,6 @@
<li class="nav-header head"><i class="fa fa-wrench"></i> {{ trans('staff.user-tools') }}</li>
<li><a href="{{ route('user_search') }}"><i class="fa fa-users"></i> {{ trans('staff.user-search') }}</a>
</li>
<li><a href="{{ route('getNotes') }}"><i class="fa fa-comment"></i> {{ trans('staff.user-notes') }}</a></li>
<li><a href="{{ route('systemGift') }}"><i class="fa fa-gift"></i> {{ trans('staff.user-gifting') }}</a>
</li>
<li><a href="{{ route('massPM') }}"><i class="fa fa-mail-forward"></i> {{ trans('staff.mass-pm') }}</a></li>
@@ -52,7 +51,8 @@
<li><a href="{{ route('getFailedAttemps') }}"><i
class="fa fa-file"></i> {{ trans('staff.failed-login-log') }}</a></li>
<li><a href="{{ route('getInvites') }}"><i class="fa fa-file"></i> {{ trans('staff.invites-log') }}</a></li>
@if(auth()->user()->group->is_admin)
<li><a href="{{ route('getNotes') }}"><i class="fa fa-file"></i> {{ trans('staff.user-notes') }}</a></li>
@if(auth()->user()->group->is_admin)
<li><a href="/staff/log-viewer"><i class="fa fa-file"></i> {{ trans('staff.laravel-log') }}</a></li>
@endif
<li><a href="{{ route('getReports') }}"><i class="fa fa-file"></i> {{ trans('staff.reports-log') }}</a></li>
+3 -3
View File
@@ -374,9 +374,9 @@ Route::group(['middleware' => 'language'], function () {
Route::any('/request/{id}/reset', 'ModerationController@resetRequest')->name('resetRequest');
// User Staff Notes
Route::any('/notes/{username}.{id}', 'NoteController@postNote')->name('postNote');
Route::any('/notes', 'NoteController@getNotes')->name('getNotes');
Route::get('/notes/{note_id}', 'NoteController@getNote')->name('getNote');
Route::get('/notes', 'NoteController@getNotes')->name('getNotes');
Route::post('/note/{username}.{id}', 'NoteController@postNote')->name('postNote');
Route::get('/note/{id}', 'NoteController@deleteNote')->name('deleteNote');
// Reports
Route::any('/reports', 'ReportController@getReports')->name('getReports');