Merge branch 'master' into LiveSearch

This commit is contained in:
Neerholt 2020-07-27 14:23:13 +02:00 committed by GitHub
commit 519bd70ace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 439 additions and 134 deletions

View File

@ -1,11 +1,18 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none needed. the class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class Album extends Model
{
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
'name'
];

View File

@ -1,9 +1,15 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class CalendarDate extends Model
{
//

View File

@ -1,9 +1,16 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class CalendarEvent extends Model
{
//

View File

@ -1,12 +1,20 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class Contact extends Model
{
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
'name_first', "name_last", 'email', 'phone'
'contactname', "title", 'email', 'phone'
];
}

View File

@ -1,9 +1,16 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class Event extends Model
{
/**
@ -11,6 +18,7 @@ class Event extends Model
*
* @var array
*/
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
"name", "description", "date"
];

View File

@ -1,9 +1,16 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class ExternalLink extends Model
{
/**
@ -11,6 +18,7 @@ class ExternalLink extends Model
*
* @var array
*/
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
'name', "link"
];

View File

@ -1,9 +1,16 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class Feedbacks extends Model
{
protected $fillable = [

View File

@ -7,7 +7,7 @@ use Illuminate\Http\Response;
use App\Contact;
use Illuminate\Support\Facades\DB;
use phpDocumentor\Reflection\Types\Context;
//hello
class ContactController extends Controller
{
public function __construct()
@ -54,8 +54,8 @@ class ContactController extends Controller
public function store(Request $request)
{
$requestContact = $request->validate([
"name_first" => "required|max:255",
"name_last" => "required|max:255",
"contactname" => "required|max:255",
"title" => "required|max:255",
"email" => "required|max:255",
"phone" => "required|max:255",
]);

View File

@ -29,8 +29,11 @@ class EventController extends Controller
*/
public function index(Request $request)
{
$events = Event::query()->paginate($request->input("limit", 20));
//returns the function with events index page and a parameter of events.
//also Response::detect checks screen size to determine if user is on a computer or mobile.
return Response::detect("events.index", [ "events" => $events]);
}
@ -41,6 +44,7 @@ class EventController extends Controller
*/
public function create()
{
//returns "create event" blade
return Response::detect("events.create");
}
@ -58,6 +62,7 @@ class EventController extends Controller
"date" => "required"
]);
//creates a new Event model with the given parameter
$event = new Event($requestBody);
$saved = $event->save();

View File

@ -2,6 +2,8 @@
namespace App\Http\Controllers;
use App\Resource;
use App\ResourceExtension;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -23,9 +25,11 @@ class ResourceController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function index()
public function index(Request $request)
{
$resources = Resource::query()->paginate($request->input("limit", 20));
return Response::detect("resources.index", [ "resources" => $resources ]);
}
/**
@ -35,7 +39,7 @@ class ResourceController extends Controller
*/
public function create()
{
//
return Response::detect("resources.create");
}
/**
@ -46,7 +50,33 @@ class ResourceController extends Controller
*/
public function store(Request $request)
{
//
// $data = $request->validate([
// "" => ""
// ]);
// $resource = new Resource($data);
$file = $request->file("resource");
$resourceExtension = ResourceExtension::where("extension", "=", $file->extension())->first();
if($resourceExtension === null) {
//TODO: Create new resourceExtension!
}
else {
$resource = new Resource();
$resource->resourceExtension()->save($resourceExtension);
$resource->save();
}
return Response::detect("resources.store");
}
/**

View File

@ -8,6 +8,7 @@ use Illuminate\Http\Response;
use App\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Log;
use Spatie\Permission\Models\Role;
@ -77,6 +78,7 @@ class UserController extends Controller
// Log::debug("CREATED USER [NOT PERSISTED YET]");
$user->assignRole([ "R1", "R2" ]);
$user->save();
// Log::debug("SAVED USER");
@ -151,19 +153,36 @@ class UserController extends Controller
// else if(Auth::user()->hasPermissionTo("user.edit")) {
$user = User::find($id);
/** @var User $user */
$user->update($data);
if ($request->roles != null) {
if ($request->roles != null) { //You can only edit roles on the admin site, so if there is an input roles, then update user info and edit roles
/** @var User $user */
$user->update($data);
$user->roles()->detach();
$user->forgetCachedPermissions();
foreach ($request->roles as $role){
$user->assignRole($role);
}
//$user->save();
} else { // Else if you're not on the admin site (user site)
if ($request->input('password') != null) { // If you're editing the password
if ($request->input('password') != $request->input('confirmpassword')) { // If new password and new password confirm is not the same, go back.
return Response::detect("users.editpass");
} elseif (!Hash::check($request->input('oldpassword'), $user->password)) { // If the written current password and current password in DB is not the same, go back.
return Response::detect("users.editpass");
} else { // If new password and current password is the same AND current written and current DB password is the same. Then update and logout.
/** @var User $user */
$user->update($data);
Auth::logout();
return redirect()->route("users.login");
}
} else { // Else if you're not editing the password but anything else (Email, Phone Number). Then update user.
$user->update($data);
}
}
$user->save();
// }
$users = User::query()->paginate(20);

View File

@ -2,10 +2,13 @@
namespace App\Http\Controllers;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\WashingMachine;
use Illuminate\View\View;
class WashingMachineController extends Controller
{
@ -24,11 +27,11 @@ class WashingMachineController extends Controller
* Display a listing of the resource.
*
* @param Request $request
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function index(Request $request)
{
$machines = WashingMachine::query()->paginate($request->query("page", 1));
$machines = WashingMachine::query()->paginate($request->query("limit", 20));
return Response::detect("washing-machines.index", [ "machines" => $machines ]);
}
@ -36,7 +39,7 @@ class WashingMachineController extends Controller
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function create()
{
@ -47,25 +50,30 @@ class WashingMachineController extends Controller
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function store(Request $request)
{
$data = $request->validate([
"time" => "required"
"name" => "required"
]);
$machine = new WashingMachine($data);
$machine->save();
$saved = $machine->save();
return Response::detect("washing-machines.store");
if(!$saved){
return Response::detect("washing-machines.store");
}else{
$machines = WashingMachine::query()->paginate($request->input("limit", 20));
return Response::detect("washing-machines.index", ['machines' => $machines]);
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function show($id)
{
@ -80,7 +88,7 @@ class WashingMachineController extends Controller
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function edit($id)
{
@ -96,36 +104,43 @@ class WashingMachineController extends Controller
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function update(Request $request, $id)
{
$data = $request->validate([
"time" => "required"
"name" => "required"
]);
$machine = WashingMachine::find($id);
$machine->update($data);
$machine->save();
$saved = $machine->save();
return Response::detect("washing-machines.edit", [
"machine" => $machine
]);
if(!$saved){
return Response::detect("washing-machines.update", [
"machine" => $machine
]);
} else {
$machines = WashingMachine::query()->paginate($request->input("limit", 20));
return Response::detect("washing-machines.index", [
"machines" => $machines
]);
}
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @param $id
* @return Response
*/
public function destroy($id)
{
$machine = WashingMachine::find($id);
$machine->delete();
return Response::detect("washing-machines.destroy");
return redirect()->route("washing-machines.index");
}
}

View File

@ -2,10 +2,15 @@
namespace App\Http\Controllers;
use App\WashingMachine;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\WashingReservation;
use Illuminate\View\View;
class WashingReservationController extends Controller
{
@ -24,11 +29,11 @@ class WashingReservationController extends Controller
* Display a listing of the resource.
*
* @param Request $request
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function index(Request $request)
{
$reservations = WashingReservation::query()->paginate($request->query("page", 1));
$reservations = WashingReservation::query()->paginate($request->query("limit", 20));
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
}
@ -36,36 +41,48 @@ class WashingReservationController extends Controller
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function create()
{
return Response::detect("washing-reservations.create");
$machines = WashingMachine::all();
return Response::detect("washing-reservations.create", [ 'machines' => $machines ]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function store(Request $request)
{
$data = $request->validate([
"time" => "required"
"time" => "required",
"machine" => "required"
]);
$machineReservation = new WashingReservation($data);
$machineReservation->save();
return Response::detect("washing-reservations.store");
$saved = $machineReservation->save();
if(!$saved){
return Response::detect("washing-reservations.store", [
"washing_reservation" => $machineReservation
]);
}else{
$reservations = WashingReservation::query()->paginate($request->input("limit", 20));
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function show($id)
{
@ -80,11 +97,14 @@ class WashingReservationController extends Controller
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function edit($id)
{
return Response::detect("washing-reservations.edit");
$reservation = WashingReservation::query()->find($id);
$machines = WashingMachine::all();
return Response::detect("washing-reservations.edit", ['washing_reservation' => $reservation, 'machines' => $machines ]);
}
/**
@ -92,36 +112,45 @@ class WashingReservationController extends Controller
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return Application|Factory|View
*/
public function update(Request $request, $id)
{
$data = $request->validate([
"time" => "required"
"time" => "required",
"machine" => "required"
]);
$machineReservation = WashingReservation::find($id);
$machineReservation->update($data);
$machineReservation->save();
$saved = $machineReservation->save();
return Response::detect("washing-reservations.edit", [
"washingReservation" => $machineReservation
]);
if(!$saved){
return Response::detect("washing-reservations.update", [
"washing_reservation" => $machineReservation
]);
}else{
$reservations = WashingReservation::query()->paginate($request->query("limit", 20));
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
}
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @return RedirectResponse
*/
public function destroy($id)
{
$machineReservation = WashingReservation::find($id);
$machineReservation->delete();
return Response::detect("washing-reservations.delete");
$reservations = WashingReservation::query()->paginate( 20);
return redirect()->route("washing-reservations.index", [ "reservations" => $reservations]);
}
}

View File

@ -10,9 +10,11 @@ class CheckAuth
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param $permissions
* @return mixed
* @throws \Exception
*/
public function handle($request, Closure $next, $permissions)
{

View File

@ -1,11 +1,19 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class MenuPlan extends Model
{
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
'week', 'monday', "tuesday", 'wednesday', 'thursday'
];

View File

@ -1,10 +1,22 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class Resource extends Model
{
//
public function resourceExtension() {
return $this->belongsTo("App\ResourceExtension");
}
public function resourceCategory() {
return $this->hasOneThrough("App\ResourceCategory", "App\ResourceExtension");
}
}

View File

@ -1,10 +1,18 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class ResourceCategory extends Model
{
//
public function resourceExtensions() {
return $this->hasMany("App\ResourceExtension");
}
}

View File

@ -1,10 +1,18 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class ResourceExtension extends Model
{
//
public function resources() {
return $this->hasMany("App\Resource");
}
}

View File

@ -1,7 +1,12 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of many libraries.
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
@ -10,6 +15,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Spatie\Permission\Traits\HasRoles;
//Class of which should extend Model Library
class User extends Authenticatable
{
use Notifiable;
@ -20,6 +26,7 @@ class User extends Authenticatable
*
* @var array
*/
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
'name_first', "name_last", 'email', 'password', "phone"
];

View File

@ -1,10 +1,19 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class WashingMachine extends Model
{
//
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
'name'
];
}

View File

@ -1,10 +1,19 @@
<?php
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
//Reference to where the file belongs.
namespace App;
//allows the use of Model library
use Illuminate\Database\Eloquent\Model;
//Class of which should extend Model Library
class WashingReservation extends Model
{
//
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
'time', 'machine'
];
}

View File

@ -17,6 +17,8 @@ class CreateWashingReservations extends Migration
$table->id();
$table->timestamp("time");
$table->timestamps();
$table->unsignedBigInteger('machine');
$table->foreign("machine")->references('id')->on('washing_machines');
});
}

View File

@ -16,8 +16,8 @@ class CreateContact extends Migration
Schema::create('contacts', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('name_first', 255);
$table->string('name_last', 255);
$table->string('contactname', 255);
$table->string('title', 255);
$table->string('email', 255);
$table->integer('phone');
//$table->unique('email');

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateResourceCategory extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('resource_categories', function (Blueprint $table) {
$table->id();
$table->string("name", 60)->unique();
$table->text("description");
$table->string("slug", 255)->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('resource_categories');
}
}

View File

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateResourceExtensions extends Migration
class CreateResourceExtension extends Migration
{
/**
* Run the migrations.
@ -15,9 +15,12 @@ class CreateResourceExtensions extends Migration
{
Schema::create('resource_extensions', function (Blueprint $table) {
$table->id();
$table->string("extension")->unique();
$table->string("extension", 60)->unique();
$table->text("description");
$table->unsignedInteger("resource_category_id");
$table->timestamps();
$table->foreign("resource_category_id")->references("id")->on("resource_categories");
});
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateResource extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('resources', function (Blueprint $table) {
$table->id();
$table->string("filename")->unique();
$table->unsignedInteger("extension_id");
$table->timestamps();
$table->foreign("extension_id")->references("id")->on("resource_extensions");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('resources');
}
}

View File

@ -17,6 +17,7 @@ class PermissionSeeder extends Seeder
/**
* The USER specific permissions
*/
"user.create" => "Creation of new user",
"user.list" => "Access to list the users.",
"user.show" => "Shows another user profile.",
"user.edit" => "Allows editing of other users.",

View File

@ -19,13 +19,13 @@ class UserSeeder extends Seeder
// } catch (Exception $e) {
// }
Log::debug("YEET");
if(User::where("name_first", "admin"))
/*if(User::where("name_first", "admin"))
{
return;
}
}*/

View File

@ -13,10 +13,10 @@
<h1>Opret Kontakt:</h1>
<form method="post" action="{{ route("contacts.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="contactname">Kontakt Navn:</label>
<input type="text" name="contactname" id="contactname" placeholder="Navn" required>
<label for="title">Titel:</label>
<input type="text" name="title" id="title" placeholder="Titel" required>
<label for="email">Email:</label>
<input type="email" name="email" id="email" placeholder="x@y.z" required>
<label for="tel">Telefon nr:</label>

View File

@ -14,10 +14,10 @@
<form method="post" action="{{ route("contacts.update", ['contact' => $contact]) }}">
@csrf
@method("put")
<label for="name_first">Fornavn:</label>
<input type="text" name="name_first" id="name_first" placeholder="Fornavn" value="{{ $contact->name_first }}" required>
<label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" placeholder="Efternavn" value="{{ $contact->name_last }}" required>
<label for="contactname">Kontakt Navn:</label>
<input type="text" name="contactname" id="contactname" placeholder="Navn" value="{{ $contact->contactname }}" required>
<label for="title">Titel:</label>
<input type="text" name="title" id="title" placeholder="Titel" value="{{ $contact->title }}" required>
<label for="email">Email:</label>
<input type="email" name="email" id="email" placeholder="x@y.z" value="{{ $contact->email }}" required>
<label for="tel">Telefon nr:</label>

View File

@ -32,8 +32,8 @@
</tr>
@foreach($contacts as $contact)
<tr>
<td>{{ $contact->name_first }}</td>
<td>{{ $contact->name_last }}</td>
<td>{{ $contact->contactname }}</td>
<td>{{ $contact->title }}</td>
<td>{{ $contact->email }}</td>
<td>{{ $contact->phone }}</td>
<td><a href="{{ route("contacts.edit", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>

View File

@ -19,20 +19,35 @@
<label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" value="{{ $user->name_last }}" required>
<label for="email">Email:</label>
<input type="email" name="email" id="email" value="{{ $user->name_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>
<input type="email" name="email" id="email" value="{{ $user->email }}" required>
<label for="password1">Password: (Forblives blank, hvis password ikke skal ændres)</label>
<input type="password" name="password" id="password1" value="">
<label for="password2">Confirm Password: (Forblives blank, hvis password ikke skal ændres)</label>
<input type="password" id="password2" value="">
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" value="{{ $user->phone }}" required>
<label for="role">Rolle:</label>
<label for="role">Rolle: (Brug ctrl og shift til at vælge flere)</label>
<select name="roles[]" id="roles" class="mb-2" multiple="multiple" required>
<option disabled selected value> -- Vælg Rolle(r) -- </option>
<option value>Ingen Rolle</option>
@foreach($roles as $role)
<option value="{{ $role->name }}">{{ $role->name }}</option>
@endforeach
@if(count($user->roles) == 0)
<option disabled selected> -- Vælg Rolle(r) -- </option>
<option value>Ingen Rolle</option>
@foreach($roles as $role)
<option value="{{ $role->name }}">{{ $role->name }}</option>
@endforeach
@else
<option disabled> -- Vælg Rolle(r) -- </option>
<option value>Ingen Rolle</option>
@foreach($roles as $role)
{{ $selected = "" }}
@foreach($user->roles as $userRole)
@if($userRole->id == $role->id)
{{ $selected = "selected" }}
@endif
@endforeach
<option {{ $selected }} value="{{ $role->name }}">{{ $role->name }}</option>
@endforeach
@endif
</select>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>

View File

@ -6,7 +6,7 @@
@endsection
@section("path")
<a href="{{ route('washing-machines.delete') }}" class="text-white">Fjern Vaskemaskine</a> /
<a href="{{ route('washing-machines.destroy') }}" class="text-white">Fjern Vaskemaskine</a> /
@endsection
@section("content")

View File

@ -6,14 +6,15 @@
@endsection
@section("path")
<a href="{{ route('washing-machines.edit', ['id' => $user->id]) }}" class="text-white">Rediger Vaskemaskiner</a> /
<a href="{{ route('washing-machines.edit', ['washing_machine' => $machine]) }}" class="text-white">Rediger Vaskemaskiner</a> /
@endsection
@section("content")
<form method="post" action="{{ route("washing-machines.store") }}">
<form method="post" action="{{ route("washing-machines.update", [ 'washing_machine' => $machine]) }}">
@csrf
@method("put")
<label for="name_first">Vaskemaskine Navn:</label>
<input type="text" name="name" id="name" max="60" required>
<input type="submit" class="btn btn-dark text-white" value="Opret">
<input type="text" name="name" id="name" max="60" value="{{$machine->name}}" required>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection

View File

@ -21,9 +21,9 @@
</tr>
@foreach($machines as $machine)
<tr>
<td>{Navn}</td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route("washing-machines.destroy", [ "machine" => $machine ]) }}" class="w-100 nostyle">
<td>{{$machine->name}}</td>
<td><a href="{{ route('washing-machines.edit', [ 'washing_machine' => $machine ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route('washing-machines.destroy', [ 'washing_machine' => $machine ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
@ -33,6 +33,4 @@
</tr>
@endforeach
</table>
{{ $machines->links() }}
@endsection

View File

@ -6,21 +6,21 @@
@endsection
@section("path")
<a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Vaske Reservationer</a> /
<a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Vaskemaskine Reservation</a> /
@endsection
@section("content")
<h1>Opret Booking:</h1>
<h1>Opret Reservation:</h1>
<form method="post" action="{{ route("washing-reservations.store") }}">
@csrf
<label for="name_first">Fornavn:</label>
<input type="text" name="name_first" id="name_first" required>
<label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" required>
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" required>
<select name="machine_choice">
<option>Vaskemaskine 1</option>
<label for="time">Tidspunkt:</label>
<input type="datetime-local" name="time" id="time" required>
<label for="machine">Vaskemaskine:</label>
<select name="machine" id="machine" required>
<option disabled selected value> -- Vælg Vaskemaskine -- </option>
@foreach($machines as $machine)
<option value="{{ $machine->id }}">{{ $machine->name }}</option>
@endforeach
</select>
<input type="submit" class="btn btn-dark text-white" value="Opret">
</form>

View File

@ -6,22 +6,26 @@
@endsection
@section("path")
<a href="{{ route('washing-reservations.edit', ['id' => $reservations->id]) }}" class="text-white">Rediger Vaske Reservationer</a> /
<a href="{{ route('washing-reservations.edit', ['washing_reservation' => $washing_reservation]) }}" class="text-white">Rediger Vaske Reservationer</a> /
@endsection
@section("content")
<h1>Rediger Booking:</h1>
<form method="post" action="">
<form method="post" action="{{ route('washing-reservations.update', ['washing_reservation' => $washing_reservation ]) }}">
@csrf
<label for="name_first">Fornavn:</label>
<input type="text" name="name_first" id="name_first" value="{Fornavn}" required>
<label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" value="{Efternavn}" required>
<input type="password" id="password2" value="{Password}" required>
<label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" value="{Telefon}" required>
<select>
<option>Vaskemaskine 1</option>
@method("put")
<label for="time">Tidspunkt:</label>
<input type="datetime-local" name="time" id="time" value="{{ $washing_reservation->time }}" required>
<label for="machine">Vaskemaskine:</label>
<select name="machine" id="machine" required>
<option disabled value> -- Vælg Vaskemaskine -- </option>
@foreach($machines as $machine)
@if($machine->id == $washing_reservation->machine)
<option selected value="{{ $machine->id }}">{{ $machine->name }}</option>
@else
<option value="{{ $machine->id }}">{{ $machine->name }}</option>
@endif
@endforeach
</select>
<input type="submit" class="btn btn-dark text-white" value="Rediger">
</form>

View File

@ -21,21 +21,17 @@
</div>
<table class="tbl mt-2">
<tr>
<th>Fornavn</th>
<th>Efternavn</th>
<th>Tlf nr</th>
<th>Vaskemaskine</th>
<th>Time</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($reservations as $reservation)
<tr>
<td>{Fornavn}</td>
<td>{Efternavn}</td>
<td>{Tlf Nr}</td>
<td>{Vaskemaskine Nr.}</td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="" class="w-100 nostyle">
<td>{{ \App\WashingMachine::query()->find($reservation->machine)->name }}</td>
<td>{{ $reservation->time }}</td>
<td><a href="{{ route('washing-reservations.edit', ['washing_reservation' => $reservation]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route('washing-reservations.destroy', ['washing_reservation' => $reservation]) }}" class="w-100 nostyle">
@csrf
@method("delete")

View File

@ -2,13 +2,13 @@
@extends("admin.layout.header")
@section("title")
Vaske Reservationer - Rediger
Vaskemaskine Reservationer - Rediger
@endsection
@section("path")
<a href="{{ route('washing-reservations.edit') }}" class="text-white">Rediger Vaske Reservationer</a> /
<a href="{{ route('washing-reservations.edit', ['washing_reservation' => $washing_reservation]) }}" class="text-white">Rediger Vaskemaskine Reservationer</a> /
@endsection
@section("content")
Din Vaske Reservationer blev (ikke) redigeret.
Din Vaskemaskine Reservationer blev (ikke) redigeret.
@endsection

View File

@ -7,11 +7,15 @@
@section("content")
<main>
<h1 class="text-center sde-blue mb-0">Aktiviteter</h1>
@foreach($events as $event)
<h3 class="sde-blue bold text-center mb-0">{{$event->name}}</h3>
<p class="text-center mt-0">{{$event->date}}</p>
<p>{{$event->description}}</p>
<a class="btn text-center btn-sde-blue btn-disabled" id="tilmeld">Tilmeld</a>
@endforeach
@if(!$events->isEmpty())
@foreach($events as $event)
<h3 class="sde-blue bold text-center mb-0">{{$event->name}}</h3>
<p class="text-center mt-0">{{$event->date}}</p>
<p class="text-center">{{$event->description}}</p>
<a class="btn text-center btn-sde-blue" id="tilmeld">Tilmeld</a>
@endforeach
@else
<p class="text-center">Der er ingen aktiviteter!</p>
@endif
</main>
@endsection

View File

@ -33,11 +33,11 @@
Reservationer
</a>
{{-- IKKE SLETTES!!!! --}}
{{-- <a href="#">--}}
{{-- <a href="# ">--}}
{{-- <img src="{{URL::asset('/images/icons/Galleri.svg')}}" alt="Galleri">--}}
{{-- Galleri--}}
{{-- </a>--}}
<a href="#">
<a href="{{ route("contacts.index") }}">
<img src="{{URL::asset('/images/icons/Kontoret.svg')}}" alt="Kontoret">
Kontoret
</a>