Commit 80b040c0 authored by ZeMKI's avatar ZeMKI
Browse files

Debug fixed + UI

* improved invites UI.
* Fixed debugging.
parent d277255c
......@@ -30,3 +30,5 @@ public/mix-manifest.json
.idea/
/resources/lang/
composer.lock
public/vendor/livewire/manifest.json
public/vendor/livewire/livewire.js.map
......@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Helpers\NewsletterStatus;
use App\User;
use Auth;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
......@@ -22,18 +23,18 @@ class HomeController extends Controller
public function asuser($userid)
{
Auth::logout();
Auth::loginUsingId($userid);
$data['studies'] = Auth::user()->studies()->with('sortings')->get();
$data['invited_studies'] = Auth::user()->invites;
if(!auth()->user()->isAdmin()) abort(401);
$data['studies'] = User::findOrFail(7)->studies()->with('sortings')->get();
$data['invited_studies'] = User::findOrFail(7)->invites;
$data['breadcrumb'] = ['Home'];
if (auth()->user()->profile()->exists())
if (User::findOrFail(7)->profile()->exists())
{
$data['newsletter'] = Auth::user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
$data['newsletter'] = auth()->user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
} else
{
$profile = auth()->user()->addProfile(auth()->user());
$data['newsletter'] = Auth::user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
$profile = User::findOrFail(7)->addProfile(User::findOrFail(7));
$data['newsletter'] = User::findOrFail(7)->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
}
return view('home', $data);
......@@ -46,16 +47,16 @@ class HomeController extends Controller
*/
public function index()
{
$data['studies'] = Auth::user()->studies()->with('sortings')->get();
$data['invited_studies'] = Auth::user()->invites;
$data['studies'] = auth()->user()->studies()->with('sortings')->get();
$data['invited_studies'] = auth()->user()->invites;
$data['breadcrumb'] = ['Home'];
if (auth()->user()->profile()->exists())
{
$data['newsletter'] = Auth::user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
$data['newsletter'] = auth()->user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
} else
{
$profile = auth()->user()->addProfile(auth()->user());
$data['newsletter'] = Auth::user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
$data['newsletter'] = auth()->user()->profile->newsletter === config('enums.newsletter_status.NOT DECIDED');
}
return view('home', $data);
......
......@@ -428,7 +428,7 @@ class StudyController extends Controller
if (!App::environment('local')) {
WebhookCall::create()
->url('https://chat.zemki.uni-bremen.de/hooks/Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3')
->payload(['text' => 'User '.$data['email'].' has registered on Mesort. We have a total of '.User::all()->count().' users!'])
->payload(['text' => 'User '.$request->email.' has registered on Mesort. We have a total of '.User::all()->count().' users!'])
->useSecret('Jj3dDY2KzSFDS2kxZ/SvbmjdswXTASAXxC2GfgfTpFooK5Eo4kFBGPyDRrtsWmgED3')
->dispatch();
}
......
This diff is collapsed.
{"/livewire.js":"/livewire.js?id=a4a06c089f1a93dbe075"}
\ No newline at end of file
{"/livewire.js":"/livewire.js?id=113e213167e044b8bb85"}
\ No newline at end of file
......@@ -4,14 +4,14 @@
<label class="block text-gray-900 text-sm font-bold mb-2" for="invited">
{{ trans('Enter an email to invite a researcher to work with in this study, then press enter') }}
</label>
<input type="email" name="invited" class="block w-1/3 appearance-none border py-2 px-3 text-gray-700 leading-tight focus:outline-none"
<input type="email" name="invited" class="block w-2/3 appearance-none border py-2 px-3 text-gray-700 leading-tight focus:outline-none"
v-model="toInvite" autocomplete="off"
@keydown.enter.prevent="invite">
</div>
<div class="block w-full text-gray-900">
<div class="mt-6 block p-2" v-for="user in invitedlist">
<div class="w-1/2 border-r-8 border-black inline-block py-1">
<div class="block" v-for="user in invitedlist">
<div class="w-1/2 px-2 inline-block">
{{ user.email }}
</div>
<div class="w-1/4 inline-block">
......
......@@ -63,6 +63,7 @@ Route::group(['prefix' => 'admin', 'middleware' => ['haspowers','auth', 'verifie
Route::group(['middleware' => ['auth', 'verified']], static function () {
Route::get('/', 'HomeController@index')->name('home');
Route::get('/asuser/{user}', 'HomeController@asuser');
Route::get('switch/{locale}', 'HomeController@changeLanguage');
......
Markdown is supported
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