profile bios

This commit is contained in:
Conkley 2022-07-11 19:01:25 +10:00
parent 916aee357b
commit 9c32b05638
4 changed files with 112 additions and 85 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
class PageController extends Controller
@ -63,19 +64,32 @@ class PageController extends Controller
public function users(Request $request)
{
if ($request->has('q')) {
$users = DB::table('users')->where('name', 'LIKE', '%'.$request->q.'%')->paginate(10);
$users = DB::table('users')->where('name', 'LIKE', '%' . $request->q . '%')->paginate(10);
} else {
$users = User::paginate(10);
}
return view('pages.users')->with('users', $users);
}
public function settings()
{
return view('misc.settings');
}
public function change_settings(Request $request)
{
$request->validate([
'bio' => 'required|min:3|max:2000'
]);
$user = Auth::user();
$user->blurb = $request->bio;
$user->save();
return redirect()->back()->with('success', 'Your bio has been updated.');
}
public function download()
{
return view('pages.download');

View File

@ -1,104 +1,114 @@
@extends('layouts.app')
@section('title')
<title>Settings - {{ env('APP_NAME') }}</title>
<title>Settings - {{ env('APP_NAME') }}</title>
@endsection
@section('titlediscord')
<meta content="Settings - {{env('APP_NAME')}}" property="og:title" />
<meta content="Settings - {{ env('APP_NAME') }}" property="og:title" />
@endsection
@section('descdiscord')
<meta content="ARCHBLOX is a work in progress revival." property="og:description" />
@endsection
@section('popup_content')
<div class="popupcontainer" id="invisible">
<div class="popup">
<h2>Test Dialog</h2>
<p class="warningtext">WARNING TEXT</p>
<p>DESCRIPTION OF THE SETTING YOU ARE ABOUT TO CHANGE</p>
<input type="text" placeholder="New Username Field">
<br>
<input type="password" placeholder="Old Password Field">
<input type="password" placeholder="New Password Field">
<input type="password" placeholder="Confirm New Password Field">
<br>
<input type="text" placeholder="Confirm Old E-Mail Field">
<input type="text" placeholder="New E-Mail Field">
<input type="text" placeholder="Confirm New E-Mail Field">
<br>
<input type="date">
<br>
<select name="Time Preference">
<option value="12hour">12 Hour</option>
<option value="24hour">24 Hour</option>
</select>
<br>
<select name="Date Preference">
<option value="DMY">DAY/MONTH/YEAR</option>
<option value="MDY">MONTH/DAY/YEAR</option>
<option value="YDM">YEAR/MONTH/DAY</option>
</select>
<br>
<button class="bluebutton">Confirm_Good</button>
<button class="redbutton">Cancel_Bad</button>
<button class="redbutton">Confirm_Bad</button>
<button class="bluebutton">Cancel_Good</button>
<div class="popupcontainer" id="invisible">
<div class="popup">
<h2>Test Dialog</h2>
<p class="warningtext">WARNING TEXT</p>
<p>DESCRIPTION OF THE SETTING YOU ARE ABOUT TO CHANGE</p>
<input type="text" placeholder="New Username Field">
<br>
<input type="password" placeholder="Old Password Field">
<input type="password" placeholder="New Password Field">
<input type="password" placeholder="Confirm New Password Field">
<br>
<input type="text" placeholder="Confirm Old E-Mail Field">
<input type="text" placeholder="New E-Mail Field">
<input type="text" placeholder="Confirm New E-Mail Field">
<br>
<input type="date">
<br>
<select name="Time Preference">
<option value="12hour">12 Hour</option>
<option value="24hour">24 Hour</option>
</select>
<br>
<select name="Date Preference">
<option value="DMY">DAY/MONTH/YEAR</option>
<option value="MDY">MONTH/DAY/YEAR</option>
<option value="YDM">YEAR/MONTH/DAY</option>
</select>
<br>
<button class="bluebutton">Confirm_Good</button>
<button class="redbutton">Cancel_Bad</button>
<button class="redbutton">Confirm_Bad</button>
<button class="bluebutton">Cancel_Good</button>
</div>
</div>
</div>
@endsection
@section('content')
<h1>Settings</h1>
<div class="content_special" style="align-content: flex-end; align-items: flex-start; width=100%;">
<div class="content_special" style="flex-wrap: wrap; flex-direction: column; width: 50%;">
<h3>Bio</h3>
<textarea style="resize: none; width: 100%; height: 75px;" placeholder="Hello!"></textarea>
<button class="bluebutton">Save</button>
<br>
<h1>Settings</h1>
<form action="{{ route('change_settings') }}" method="POST">
@csrf
<div class="content_special" style="align-content: flex-end; align-items: flex-start; width=100%;">
<div class="content_special" style="flex-wrap: wrap; flex-direction: column; width: 50%;">
<h3>Bio</h3>
<textarea style="resize: none; width: 100%; height: 75px;" name="bio">@if(!old('bio')){{ Auth::user()->blurb }}@else{{old('bio')}}@endif</textarea>
@if ($errors->any())
<span class="warningtext">{{ $errors->first() }}</span>
@endif
@if(session()->has('success'))
<span style="color:green">{{ session()->get('success') }}</span>
@endif
<button class="bluebutton" type="submit">Save</button>
</form>
<br>
</div>
<div class="content_special"
style="flex-wrap: wrap; flex-direction: row-reverse; width: 50%; text-align: end; align-content: flex-end;">
<p style="width: 100%;">Username: OnlyTwentyCharacters <button class="bluebutton">Edit</button></p>
<p style="width: 100%;">E-Mail: t****@ex********.com <button class="bluebutton">Edit</button></p>
<p style="width: 100%;">Date of Birth: 01/01/01 <button class="bluebutton">Edit</button></p>
<p style="width: 100%;">Username: {{ Auth::user()->name }} <button class="bluebutton">Edit</button></p>
<p style="width: 100%;">E-Mail: {{ Auth::user()->email }} <button class="bluebutton">Edit</button></p>
<p style="width: 100%;">Date of Birth: {{ Auth::user()->dob }} <button class="bluebutton">Edit</button></p>
<p style="width: 100%;">Password: ******** <button class="bluebutton">Edit</button></p>
<p style="width: 100%;">Date Display Preference: D/M/YY <button class="bluebutton">Edit</button></p>
<p style="width: 100%;">Time Display Preference: 12 Hour <button class="bluebutton">Edit</button></p>
</div>
</div>
<div class="content_special" style="align-content: flex-end; align-items: flex-start;">
<div class="content_special"
style="flex-wrap: wrap; flex-direction: column; width: 50%; align-content: flex-start;">
<h3>Invite Keys</h3>
<p>You can only create 1 invite every week. <br>Manage your keys and key history below.</p>
<p><button class="bluebutton"><a href="{{ route('key_index') }}" style="font-weight:normal;color:#fff">Create
Invite Key</a></button></p>
</div>
<div class="content_special"
style="flex-wrap: wrap; flex-direction: column; width: 50%; text-align: end; align-content: center;">
<h3>Theme</h3>
<p>Selected Theme: SKEUOMORPHIC</p>
<div class="content_special" style="width: 100%; flex-wrap: nowrap;">
<div class="custom-select" style="width: 90%;">
<select name="Theme" style="width: 100%;">
<option value="SKEUO">SKEUOMORPHIC</option>
<option value="FLAT">FLAT</option>
<option value="2013">2013</option>
<option value="2007">2007</option>
</select>
<div class="content_special" style="align-content: flex-end; align-items: flex-start;">
<div class="content_special"
style="flex-wrap: wrap; flex-direction: column; width: 50%; align-content: flex-start;">
<h3>Invite Keys</h3>
<p>You can only create 1 invite every week. <br>Manage your keys and key history below.</p>
<p><button class="bluebutton"><a href="{{ route('key_index') }}" style="font-weight:normal;color:#fff">Create
Invite Key</a></button></p>
</div>
<div class="content_special"
style="flex-wrap: wrap; flex-direction: column; width: 50%; text-align: end; align-content: center;">
<h3>Theme</h3>
<p>Selected Theme: SKEUOMORPHIC</p>
<div class="content_special" style="width: 100%; flex-wrap: nowrap;">
<div class="custom-select" style="width: 90%;">
<select name="Theme" style="width: 100%;">
<option value="SKEUO">SKEUOMORPHIC</option>
<option value="FLAT">FLAT</option>
<option value="2013">2013</option>
<option value="2007">2007</option>
</select>
</div>
<button style="width: max-content;" class="greenbutton">Save</button>
</div>
<button style="width: max-content;" class="greenbutton">Save</button>
</div>
</div>
</div>
<br>
<div style="flex-wrap: wrap; flex-direction: column;">
<h3>DANGER ZONE</h3>
<p style="color: darkred;">These are inactive for now.<br>In order to delete your account, please ask one of the Developers.</p>
<p>These buttons can fully delete data. Use with caution!</p>
<p>
<button class="redbutton" disabled>Delete Account</button>
<button class="redbutton" disabled>Delete All Places</button>
<button class="redbutton" disabled>Delete All Avatar Items</button>
</p>
</div>
@endsection
<br>
<div style="flex-wrap: wrap; flex-direction: column;">
<h3>DANGER ZONE</h3>
<p style="color: darkred;">These are inactive for now.<br>In order to delete your account, please ask one of the
Developers.</p>
<p>These buttons can fully delete data. Use with caution!</p>
<p>
<button class="redbutton" disabled>Delete Account</button>
<button class="redbutton" disabled>Delete All Places</button>
<button class="redbutton" disabled>Delete All Avatar Items</button>
</p>
</div>
@endsection

View File

@ -47,7 +47,9 @@
<div id="profileleftcontainer">
<p id="status">"I'm new to ARCHBLOX!"</p>
<img alt="profile image" src="{{ asset('img/reviewpending.png') }}" width="75%">
<p id="bio">{{ $data['user']->blurb }}</p>
<div id="bio"
style="min-width:350px;max-width:350px;text-align:center;margin:0 auto;max-height:275px;overflow-y: auto;">
{!! nl2br(e($data['user']->blurb)) !!}</div>
<br>
<div id="stats">
<h3>Joined: {{ $data['user']->created_at->format('d/m/Y') }}</h3>
@ -82,8 +84,8 @@
<div class="content_special" style="justify-content: center;">
<h2>Friends ({{ $data['user']->getFriendsCount() }})</h2>
@if ($data['user']->getFriendsCount() > 0)
<a href="{{ route('profile_friends', $data['user']->id) }}" style="margin-left: 5px"> <button class="bluebutton"
style="margin-top: 5px">View All</button></a>
<a href="{{ route('profile_friends', $data['user']->id) }}" style="margin-left: 5px"> <button
class="bluebutton" style="margin-top: 5px">View All</button></a>
</div>
<div id="profilefriendcontainer" class="content_special"
style="flex-wrap: nowrap;justify-content: space-evenly;flex-direction: row;display: inline-flex;align-content: center;align-items: center;">

View File

@ -29,6 +29,7 @@ Route::middleware(['auth'])->group(function () {
Route::get('/users', [App\Http\Controllers\PageController::class, 'users'])->name('users');
Route::post('/users', [App\Http\Controllers\PageController::class, 'users'])->name('users');
Route::get('/my/settings', [App\Http\Controllers\PageController::class, 'settings'])->name('settings');
Route::post('/my/settings', [App\Http\Controllers\PageController::class, 'change_settings'])->name('change_settings');
Route::get('/my/invites', [App\Http\Controllers\KeyController::class, 'index'])->name('key_index');
Route::post('/my/invites', [App\Http\Controllers\KeyController::class, 'create'])->name('key_create');
Route::get('/download', [App\Http\Controllers\PageController::class, 'download'])->name('download');