Conflicts:
	skolehjem/routes/web.php
This commit is contained in:
Vedde 2020-07-01 09:13:43 +02:00
commit cb927b9637
43 changed files with 369 additions and 261 deletions

View File

@ -1,19 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="laravel" uuid="666d3dad-499f-4d99-8988-fd376e6db9e6">
<data-source source="LOCAL" name="laravel.sqlite" uuid="bf392a85-1584-4a27-a552-e491a55b9410">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/skolehjem/database/laravel.sqlite</jdbc-url>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.31.1/license.txt</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.31.1/sqlite-jdbc-3.31.1.jar</url>
</library>
</libraries>
</data-source>
</component>
</project>

View File

@ -113,9 +113,10 @@ class ContactController extends Controller
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/
public function destroy(Contact $id)
public function destroy($id)
{
$id->delete();
$contact = Contact::find($id);
$contact->delete();
return redirect()->route("contacts.index");
}
}

View File

@ -52,6 +52,7 @@ class MenuPlanController extends Controller
public function store(Request $request)
{
$requestMenuPlanCreate = $request->validate([
"week" => "required|max:2",
"monday" => "required|max:255",
"tuesday" => "required|max:255",
"wednesday" => "required|max:255",

View File

@ -0,0 +1,105 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Spatie\Permission\Models\Role;
class rolesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$roles = Role::query()->paginate($request->input("limit", 20));
return Response::detect("roles.index", [ "roles" => $roles]);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return Response::detect("roles.create");
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$requestRole = $request->validate([
"name" => "required|max:255",
"description" => "required|max:255"
]);
$role = new Role($requestRole);
$role->save();
return Response::detect("roles.store");
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
return Response::detect("roles.show", [ "role" => $id]);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
$role = Role::find($id);
return Response::detect("roles.edit", ["role" => $role]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$data = $request->all();
$role = Role::find($id);
$role->update($data);
$role->save();
return Response::detect("roles.update", [ "role" => $role ]);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$role = Role::find($id);
$role->delete();
return redirect()->route("roles.index");
}
}

View File

@ -8,6 +8,7 @@ use Illuminate\Http\Response;
use App\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Spatie\Permission\Models\Role;
class UserController extends Controller
@ -44,7 +45,9 @@ class UserController extends Controller
*/
public function create()
{
return Response::detect("users.create");
$roles = Role::all();
return Response::detect("users.create", ['roles' => $roles]);
}
/**
@ -63,6 +66,7 @@ class UserController extends Controller
"email" => "required|email|unique:users",
"password" => "required|max:60",
"phone" => "required|unique:users",
"roles" => "max:255"
]);
@ -102,10 +106,12 @@ class UserController extends Controller
*/
public function edit($id)
{
$roles = Role::all();
$user = User::find($id);
return Response::detect("users.edit", [
"user" => $user
"user" => $user,
"roles" => $roles,
]);
}
@ -147,6 +153,13 @@ class UserController extends Controller
/** @var User $user */
$user->update($data);
$user->roles()->detach();
$user->forgetCachedPermissions();
foreach ($request->roles as $role){
$user->assignRole($role);
}
$user->save();
// }
@ -224,5 +237,13 @@ class UserController extends Controller
return redirect()->route('users.login');
}
public function account()
{
return Response::detect("users.account");
}
public function accountedit()
{
return Response::detect("users.edit");
}
}

View File

@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class MenuPlan extends Model
{
protected $fillable = [
'monday', "tuesday", 'wednesday', 'thursday'
'week', 'monday', "tuesday", 'wednesday', 'thursday'
];
}

View File

@ -1,45 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
use Spatie\Permission\Traits\HasRoles;
class Staff extends Model
{
use Notifiable;
use HasRoles;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name_first', "name_last", 'email', 'password', "phone"
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function setPasswordAttribute($password) {
$this->attributes["password"] = Hash::make($password);
}
}

View File

@ -15,6 +15,7 @@ class CreateMenuPlans extends Migration
{
Schema::create('menu_plans', function (Blueprint $table) {
$table->id();
$table->string('week', 2);
$table->string('monday', 255);
$table->string('tuesday', 255);
$table->string('wednesday', 255);

View File

@ -16,6 +16,7 @@ class CreateAlbumsTable extends Migration
Schema::create('albums', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->foreignId('user_id')->constrained();
});
}

View File

@ -21,11 +21,13 @@ class UserSeeder extends Seeder
Log::debug("YEET");
if(User::where("name_first", "admin"))
{
return;
}
Log::debug("OPRET");
$user = new \App\User();

View File

@ -6,7 +6,7 @@
@endsection
@section("path")
<a href="" class="text-white">Opret Kontakt</a> /
<a href="{{ route('contacts.create') }}" class="text-white">Opret Kontakt</a> /
@endsection
@section("content")

View File

@ -6,7 +6,7 @@
@endsection
@section("path")
<a href="" class="text-white">Slet Kontakt</a> /
<a href="{{ route('contacts.destroy') }}" class="text-white">Slet Kontakt</a> /
@endsection
@section("content")

View File

@ -6,7 +6,7 @@
@endsection
@section("path")
<a href="" class="text-white">Vis Kontakter</a> /
<a href="{{ route('contacts.index', [ 'contacts' => $contacts ]) }}" class="text-white">Vis Kontakter</a> /
@endsection
@section("content")
@ -30,7 +30,7 @@
@csrf
@method("delete")
<button class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>

View File

@ -6,7 +6,7 @@
@endsection
@section("path")
<a href="" class="text-white">Slet Kontakt</a> /
<a href="{{ route('contacts.destroy') }}" class="text-white">Slet Kontakt</a> /
@endsection
@section("content")

View File

@ -6,7 +6,7 @@
@endsection
@section("path")
<a href="" class="text-white">Opbevar Kontakt</a> /
<a href="{{ route('contacts.store') }}" class="text-white">Opbevar Kontakt</a> /
@endsection
@section("content")

View File

@ -28,7 +28,7 @@
@csrf
@method("delete")
<button class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>

View File

@ -26,7 +26,7 @@
@csrf
@method("delete")
<button class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>

View File

@ -19,6 +19,15 @@
<a href="{{ route('users.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Bruger</a>
</div>
</div>
<div class="segment">
<h3 class="text-white">Roller</h3>
<div class="row">
<a href="{{ route("roles.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Roller</a>
</div>
<div class="row">
<a href="{{ route('roles.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Rolle</a>
</div>
</div>
<div class="segment">
<h3 class="text-white">Menuplan</h3>
<div class="row">
@ -67,6 +76,15 @@
{{-- <a href="{{ route('staff.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Personal</a>--}}
{{-- </div>--}}
{{-- </div>--}}
<div class="segment">
<h3 class="text-white">Kontakter</h3>
<div class="row">
<a href="{{ route("contacts.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Kontakter</a>
</div>
<div class="row">
<a href="{{ route('contacts.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Kontakt</a>
</div>
</div>
<div class="segment">
<h3 class="text-white">Feedback</h3>
<div class="row">

View File

@ -13,6 +13,8 @@
<h1>Opret Menuplan:</h1>
<form action="{{ action('MenuPlanController@store') }}" method="post">
@csrf
<label for="week">Uge nr.</label>
<input type="number" name="week" id="week" min="1" max="53" placeholder="1" required>
<label for="monday">Mandag:</label>
<input type="text" name="monday" id="monday" placeholder="Hawaii Pizza" required>
<label for="tuesday">Tirsdag:</label>

View File

@ -14,6 +14,8 @@
<form method="post" action="{{ route("menu-plans.update", [ "menu_plan" => $menuplan ]) }}">
@csrf
@method("PUT")
<label for="mandag">Uge:</label>
<input type="number" name="week" id="week" min="1" max="53" value="{{ $menuplan->week }}" required>
<label for="mandag">Mandag:</label>
<input type="text" name="monday" id="mandag" value="{{ $menuplan->monday }}" required>
<label for="tirsdag">Tirsdag:</label>
@ -23,6 +25,6 @@
<label for="torsdag">Torsdag:</label>
<input type="text" name="thursday" id="torsdag" value="{{ $menuplan->thursday }}" required>
<input type="submit" class="btn btn-dark text-white" value="Opret Menuplan">
<input type="submit" class="btn btn-dark text-white" value="Rediger Menuplan">
</form>
@endsection

View File

@ -12,6 +12,7 @@
@section("content")
<table class="tbl">
<tr>
<th>Uge</th>
<th>Mandag</th>
<th>Tirsdag</th>
<th>Onsdag</th>
@ -21,6 +22,7 @@
</tr>
@foreach($menuPlans as $menuplan)
<tr>
<td>{{$menuplan->week}}</td>
<td>{{$menuplan->monday}}</td>
<td>{{$menuplan->tuesday}}</td>
<td>{{$menuplan->wednesday}}</td>
@ -30,7 +32,7 @@
@csrf
@method("delete")
<button class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>

View File

@ -0,0 +1,22 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Opret
@endsection
@section("path")
<a href="{{ route('roles.create') }}" class="text-white">Opret Rolle</a> /
@endsection
@section("content")
<h1>Opret Rolle:</h1>
<form method="post" action="{{ route("roles.store") }}">
@csrf
<label for="name">Navn:</label>
<input type="text" name="name" id="name" placeholder="Admin" required>
<label for="name">Beskrivelse:</label>
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" required>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>
@endsection

View File

@ -2,13 +2,12 @@
@extends("admin.layout.header")
@section("title")
Home - Logud
Rolle - Fjern
@endsection
@section("path")
<a href="{{ route('staff.logout') }}" class="text-white">Logud</a> /
<a href="{{ route('roles.delete') }}" class="text-white">Fjern Rolle</a> /
@endsection
@section("content")
@endsection

View File

@ -0,0 +1,23 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Rediger
@endsection
@section("path")
<a href="{{ route('roles.edit', ['role' => $role]) }}" class="text-white">Rediger Rolle</a> /
@endsection
@section("content")
<h1>Rediger Rolle:</h1>
<form method="post" action="{{ route("roles.update", ['role' => $role]) }}">
@csrf
@method("put")
<label for="name">Navn:</label>
<input type="text" name="name" id="name" placeholder="Admin" value="{{ $role->name }}" required>
<label for="name">Beskrivelse:</label>
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" value="{{ $role->description }}" required>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection

View File

@ -0,0 +1,35 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Rolle - Vis
@endsection
@section("path")
<a href="{{ route('roles.index') }}" class="text-white">Vis Roller</a> /
@endsection
@section("content")
<table class="tbl">
<tr>
<th>Navn</th>
<th>Beskrivelse</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@foreach($roles as $role)
<tr>
<td>{{ $role->name }}</td>
<td>{{ $role->description }}</td>
<td><a href="{{ route("roles.edit", [ "role" => $role->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route("roles.destroy", [ "role" => $role ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete?');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>
@endforeach
</table>
@endsection

View File

@ -2,11 +2,11 @@
@extends("admin.layout.header")
@section("title")
Personal - Vis
Rolle - Vis
@endsection
@section("path")
<a href="{{ route('staff.index') }}" class="text-white">Vis Personal</a> /
<a href="{{ route('rolle.index') }}" class="text-white">Vis Brugere</a> /
@endsection
@section("content")

View File

@ -2,12 +2,13 @@
@extends("admin.layout.header")
@section("title")
Personal - Fjern
Rolle - Opret
@endsection
@section("path")
<a href="{{ route('staff.delete') }}" class="text-white">Fjern Personal</a> /
<a href="{{ route('roles.create') }}" class="text-white">Opret Roller</a> /
@endsection
@section("content")
Rollen blev (ikke) oprettet.
@endsection

View File

@ -2,13 +2,13 @@
@extends("admin.layout.header")
@section("title")
Personal - Rediger
Rolle - Rediger
@endsection
@section("path")
<a href="{{ route('staff.edit') }}" class="text-white">Rediger Personal</a> /
<a href="{{ route('roles.edit', ['role' => $role]) }}" class="text-white">Rediger Rolle</a> /
@endsection
@section("content")
Din Personal blev (ikke) redigeret.
Din rolle blev (ikke) redigeret.
@endsection

View File

@ -1,30 +0,0 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Personal - Opret
@endsection
@section("path")
<a href="{{ route('staff.create') }}" class="text-white">Opret Personal</a> /
@endsection
@section("content")
<h1>Opret Personal:</h1>
<form method="post" action="{{ route("staff.store") }}">
@csrf
<label for="name_first">Fornavn:</label>
<input type="text" name="name_first" id="name_first" placeholder="Fornavn" required>
<label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" placeholder="Efternavn" required>
<label for="email">Email:</label>
<input type="email" name="email" id="email" placeholder="x@y.z" required>
<label for="password1">Password:</label>
<input type="password" name="password" placeholder="Password" id="password1" required>
<label for="password2">Bekræft Password:</label>
<input type="password" id="password2" placeholder="Bekræft Password" required>
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" placeholder="12345678" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" required>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>
@endsection

View File

@ -1,31 +0,0 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Personal - Rediger
@endsection
@section("path")
<a href="{{ route('staff.edit', ['staff' => $staff]) }}" class="text-white">Rediger Personal</a> /
@endsection
@section("content")
<h1>Rediger Personal:</h1>
<form method="post" action="{{ route("staff.update", ['staff' => $staff]) }}">
@csrf
@method("put")
<label for="name_first">Fornavn:</label>
<input type="text" name="name_first" id="name_first" value="{{ $staff->name_first }}" required>
<label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" value="{{ $staff->name_last }}" required>
<label for="email">Email:</label>
<input type="email" name="email" id="email" value="{{ $staff->email }}" required>
<label for="password1">Password:</label>
<input type="password" name="password" id="password1" value="" required>
<label for="password2">Confirm Password:</label>
<input type="password" id="password2" value="" required>
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" value="{{ $staff->phone }}" required>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection

View File

@ -1,41 +0,0 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Personal - Vis
@endsection
@section("path")
<a href="{{ route('staff.index') }}" class="text-white">Vis Personal</a> /
@endsection
@section("content")
<table class="tbl">
<tr>
<th>Fornavn</th>
<th>Efternavn</th>
<th>Email</th>
<th>Tlf nr</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@foreach($staffs as $staff)
<tr>
<td>{{ $staff->name_first }}</td>
<td>{{ $staff->name_last }}</td>
<td>{{ $staff->email }}</td>
<td>{{ $staff->phone }}</td>
<td><a href="{{ route("staff.edit", [ "staff" => $staff->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route("staff.destroy", [ "staff" => $staff->id ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>
@endforeach
</table>
{{ $staffs->links() }}
@endsection

View File

@ -1,27 +0,0 @@
@extends("app.layout.base")
@section("title")
Login
@endsection
@section("content")
<main style="background-color: #00788a; height: 100%;">
<div class="brand">
<img src="{{URL::asset('/images/logos/Logo-hvid.svg')}}" alt="Syddansk Erhvervsskole">
</div>
<form action="" method="post">
@csrf
<input class="appinput" type="email" name="email" placeholder="Email" required>
<input class="appinput" type="password" name="password" placeholder="Password" required>
<label class="toggle">
<input class="toggle__input" type="checkbox" name="rememberpassword">
<span class="toggle__label">
<span class="toggle__text text-white">Remember password</span>
</span>
</label>
<input class="btn btn-dark" type="submit" value="Sign in">
<button class="btn" onclick="window.location = '';">Sign up</button>
</form>
<a class="text-white text-center" href="">Forgot password?</a>
</main>
@endsection

View File

@ -1,14 +0,0 @@
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Personal - Opret
@endsection
@section("path")
<a href="{{ route('staff.create') }}" class="text-white">Opret Personal</a> /
@endsection
@section("content")
Personal blev (ikke) oprettet.
@endsection

View File

@ -25,11 +25,12 @@
<input type="password" id="password2" placeholder="Bekræft Password" required>
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" placeholder="12345678" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" required>
<label for="role">Rolle:</label>
<select name="role" id="role" class="mb-2" required>
<option value="admin">Admin</option>
<option value="staff">Personale</option>
<option value="resident">Beboer</option>
<label for="roles">Rolle:</label>
<select name="roles[]" id="roles" class="mb-2" multiple="multiple" required>
<option disabled selected value> -- Vælg Rolle(r) -- </option>
@foreach($roles as $role)
<option value="{{ $role->name }}">{{ $role->name }}</option>
@endforeach
</select>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>

View File

@ -27,10 +27,11 @@
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" value="{{ $user->phone }}" required>
<label for="role">Rolle:</label>
<select name="role" id="role" class="mb-2" required>
<option value="admin">Admin</option>
<option value="staff">Personale</option>
<option value="resident">Beboer</option>
<select name="roles[]" id="roles" class="mb-2" multiple="multiple" required>
<option disabled selected value> -- Vælg Rolle(r) -- </option>
@foreach($roles as $role)
<option value="{{ $role->name }}">{{ $role->name }}</option>
@endforeach
</select>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>

View File

@ -16,7 +16,7 @@
<th>Efternavn</th>
<th>Email</th>
<th>Tlf nr</th>
<th>Rolle</th>
<th>Rolle(r)</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@ -26,13 +26,21 @@
<td>{{ $user->name_last }}</td>
<td>{{ $user->email }}</td>
<td>{{ $user->phone }}</td>
<td>{{ $user->roles }}</td>
<td>
@for($i = 0; $i < count($user->roles); $i++)
@if(count($user->roles)-1 != $i)
{{$user->roles[$i]->name}},
@else
{{$user->roles[$i]->name}}
@endif
@endfor
</td>
<td><a href="{{ route("users.edit", [ "user" => $user->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route("users.destroy", [ "user" => $user ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>

View File

@ -20,7 +20,13 @@
<tr>
<td>{Navn}</td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>
<td><form method="post" action="{{ route("washing-machines.destroy", [ "machine" => $machine ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>
@endforeach
</table>

View File

@ -30,7 +30,7 @@
@csrf
@method("delete")
<button class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>

View File

@ -45,10 +45,13 @@
<img src="{{URL::asset('/images/icons/Vagttelefon-hvid.svg')}}" alt="Vagttelefon">
Vagttelefon
</a>
<a href="#">
<a href="{{ route("users.account") }}">
<img src="{{URL::asset('/images/icons/user-hvid.svg')}}" alt="Konto">
Konto
</a>
<a href="{{ route('users.logout') }}">
Log Ud
</a>
</div>
@yield("content")

View File

@ -5,26 +5,39 @@
@endsection
@section("content")
<main>
<h1 class="text-center sde-blue mb-0">Menuplan</h1>
<span class="text-center sde-black-80 bold" id="week">Uge x</span>
<div class="col w-100 mt-auto">
<div class="w-100" id="mandag">
<h3 class="sde-blue bold text-center">Mandag</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p>
</div>
<div class="w-100" id="tirsdag">
<h3 class="sde-blue bold text-center">Tirsdag</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p>
</div>
<div class="w-100" id="onsdag">
<h3 class="sde-blue bold text-center">Onsdag</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p>
</div>
<div class="w-100" id="torsdag">
<h3 class="sde-blue bold text-center">Torsdag</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p>
</div>
</div>
<?php
$Week = date('W'); //Current week
?>
<main onload="myFunction()">
@if($menuPlans->contains('week', $Week)) {{-- If any of the menues in the menu table has the number of the week in the 'week' column, do this --}}
@foreach($menuPlans as $menuplan)
@if($menuplan->week == $Week)
<h1 class="text-center sde-blue mb-0">Menuplan</h1>
<span class="text-center sde-black-80 bold">Uge: {{$menuplan->week}}</span>
<div class="col w-100 mt-auto text-center">
<div class="w-100" id="mandag">
<h3 class="sde-blue bold mb-0">Mandag</h3>
<p>{{$menuplan->monday}}</p>
</div>
<div class="w-100" id="tirsdag">
<h3 class="sde-blue bold mb-0">Tirsdag</h3>
<p>{{$menuplan->tuesday}}</p>
</div>
<div class="w-100" id="onsdag">
<h3 class="sde-blue bold mb-0">Onsdag</h3>
<p>{{$menuplan->wednesday}}</p>
</div>
<div class="w-100" id="torsdag">
<h3 class="sde-blue bold mb-0">Torsdag</h3>
<p>{{$menuplan->thursday}}</p>
</div>
</div>
@endif
@endforeach
@else
<h1 class="text-center sde-blue mb-0">Menuplan</h1>
<p class="text-center">Der er ingen menuplaner denne uge!</p>
@endif
</main>
{{ $menuPlans->links() }}
@endsection

View File

@ -0,0 +1,15 @@
@extends("app.layout.base")
@section("title")
Account
@endsection
@section("content")
<main>
<h1 class="text-center sde-blue mt-0">Konto</h1>
<h4 class="mt-0">Navn: {{ Auth::user()->name_first . " " . Auth::user()->name_last }}</h4>
<h4 class="mt-0">Email: {{ Auth::user()->email }}</h4>
<h4 class="mt-0">Telefon Nr.: {{ Auth::user()->phone }}</h4>
<a class="btn text-center btn-sde-blue mt-1" href="{{ route("users.accountedit") }}">Rediger Oplysninger</a>
</main>
@endsection

View File

@ -0,0 +1,20 @@
@extends("app.layout.base")
@section("title")
Account
@endsection
@section("content")
<main>
<h1 class="text-center sde-blue mt-0">Konto</h1>
<form action="">
<span>Navn:</span>
<input type="text" name="name" id="name" value="{{ Auth::user()->name_first . " " . Auth::user()->name_last }}" disabled>
<span>Email:</span>
<input type="email" name="email" id="email" value="{{ Auth::user()->email }}" required>
<span>Telefon Nr.:</span>
<input type="text" name="phone" id="phone" value="{{ Auth::user()->phone }}" required>
<button type="submit" class="btn text-center btn-sde-blue mt-1">Rediger</button>
</form>
</main>
@endsection

View File

@ -18,14 +18,15 @@ use Illuminate\Support\Facades\Route;
//});
Route::get("/", "RootController@index")->name("root.index");
Route::get("/home", "RootController@index")->name("root.index");
Route::get("/login", "UserController@showLogin")->name("users.show-login");
Route::post("/login", "UserController@login")->name("users.login");
Route::get("/logout", "UserController@logout")->name("users.logout");
Route::get("/forgot", "UserController@showForgot")->name("users.show-forgot");
Route::post("/forgot", "UserController@forgot")->name("users.forgot");
Route::get("/account", "UserController@account")->name("users.account");
Route::get("/account/edit", "UserController@accountedit")->name("users.accountedit");
Route::get("phones", "PhoneController@index")->name("phones.index");
@ -39,4 +40,4 @@ Route::resource("washing-reservations", "WashingReservationController");
Route::resource("feedbacks", "FeedbackController");
Route::resource("external-links", "ExternalLinkController");
Route::resource("resource-extensions", "ResourceExtensionController");
Route::resource("resource-categories", "ResourceCategoryController");
Route::resource("roles", "RolesController");