Commit dbb4cf5a authored by ZeMKI's avatar ZeMKI
Browse files

New admin layout -> studies

parent d09d1c23
......@@ -33,6 +33,15 @@ class AdminController extends Controller
return view('admin.dashboard', $data);
}
public function showStudies()
{
$data['studies'] = Study::all();
return view('admin.studies',$data);
}
public function formatBytes($size, $precision = 2)
{
$base = log($size, 1024);
......
......@@ -187,7 +187,7 @@ class User extends Authenticatable implements MustVerifyEmail
public function notOwnerNorInvited($study)
{
return auth()->user()->isNot($study->creator()) && !in_array($study->id, auth()->user()->invites()->pluck('study_id')->toArray()) ;
return auth()->user()->isNot($study->creator()) && !auth()->user()->isAdmin() && !in_array($study->id, auth()->user()->invites()->pluck('study_id')->toArray()) ;
}
......
......@@ -76,10 +76,10 @@
</a>
</li>
<li class="mr-6 my-2 md:my-0">
<a :class="url == '' ? 'text-blue-400' :'text-gray-500'" href="{{url('admin/downloadbackup')}}"
<a :class="url == '' ? 'text-blue-400' :'text-gray-500'" href="{{url('admin/studies')}}"
target="_blank"
class="block py-1 md:py-3 pl-1 align-middle no-underline hover:text-gray-100 border-b-2 border-gray-900 hover:border-purple-400">
<i class="fa fa-envelope fa-fw mr-3"></i><span class="pb-1 md:pb-0 text-sm">Download Database Backup</span>
<i class="fa fa-envelope fa-fw mr-3"></i><span class="pb-1 md:pb-0 text-sm">Studies</span>
</a>
</li>
<li class="mr-6 my-2 md:my-0">
......
@extends('admin.layout')
@section('content')
<!-- Table -->
<table class='mx-auto w-full whitespace-nowrap rounded-lg bg-white divide-y divide-gray-300 overflow-hidden'>
<thead class="bg-gray-50">
<tr class="text-gray-600 text-left">
<th class="font-semibold text-sm uppercase px-6 py-4">
Title
</th>
<th class="font-semibold text-sm uppercase px-6 py-4">
Author
</th>
<th class="font-semibold text-sm uppercase px-6 py-4 text-center">
Creation Date
</th>
<th class="font-semibold text-sm uppercase px-6 py-4 text-center">
Link
</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach($studies as $study)
<tr>
<td class="w-64 h-25">
<p class="overflow-scroll break-words">
{{$study->name}}
</p>
</td>
<td class="px-6 py-4">
<p class="w-1/6">
{{$study->creator()->email ?? ''}}
</p>
</td>
<td class="px-6 py-4">
<p class="">
{{$study->created_at}}
</p>
</td>
<td class="px-6 py-4">
<p class="">
<a class="select-none text-black mt-2 inline min-w-full hover:no-underline uppercase md:lowercase sm:lowercase sm:text-base md:text-xl lg:text-2xl font-extrabold"
href="{{url('studies/'.$study->id)}}"
>
Manage
</a>
</p>
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection
......@@ -52,6 +52,7 @@ Route::group(['prefix' => 'admin', 'middleware' => ['haspowers','auth', 'verifie
Route::post('/createdummystudy/{user}', 'StudyController@store');
Route::post('/deletestudiesbyuser/{user}', 'StudyController@deleteallbyuser');
Route::get('/users', 'AdminController@indexUsers');
Route::get('/studies', 'AdminController@showStudies');
Route::get('/downloadbackup', 'AdminController@downloadBackup');
Route::get('/downloadyesterdaybackup', 'AdminController@downloadYesterdayBackup');
Route::get('/supervisor', 'AdminController@supervisorindex');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment