v0.5.3 - Added Locations and a location_id to washing machines
This commit is contained in:
parent
9b631843b0
commit
5452711665
|
@ -0,0 +1,133 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Location;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
class LocationController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware([ "auth" ]);
|
||||||
|
|
||||||
|
$this->middleware([ "check.auth:locations.list" ])->only("index");
|
||||||
|
$this->middleware([ "check.auth:locations.show" ])->only("show");
|
||||||
|
$this->middleware([ "check.auth:locations.create" ])->only("create", "store");
|
||||||
|
$this->middleware([ "check.auth:locations.edit" ])->only("edit", "update");
|
||||||
|
$this->middleware([ "check.auth:locations.delete" ])->only("delete");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$locations = Location::query()->paginate($request->input("limit", 20));
|
||||||
|
|
||||||
|
return Response::detect("locations.index", [ "locations" => $locations ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return Response::detect("locations.create");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->validate([
|
||||||
|
"name" => "required",
|
||||||
|
]);
|
||||||
|
|
||||||
|
$location = new Location($data);
|
||||||
|
|
||||||
|
$locations = Location::query()->where('name', '=', $request->name)->get();
|
||||||
|
|
||||||
|
// If there already is a washing machine with that name, then don't add it
|
||||||
|
if (count($locations) > 0)
|
||||||
|
return redirect()->route("locations.store")->with('NameExists', '<p><b>Der findes allerede en lokation med det navn!</b></p>');
|
||||||
|
else { // Else - Add it
|
||||||
|
$location->save();
|
||||||
|
$locations = Location::query()->paginate($request->input("limit", 20));
|
||||||
|
return redirect()->route("locations.index", ['locations' => $locations]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Location $location
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(Location $location)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Location $location
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(Location $location)
|
||||||
|
{
|
||||||
|
return Response::detect("locations.edit", [ "location" => $location] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Location $location
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$data = $request->validate([
|
||||||
|
"name" => "required",
|
||||||
|
]);
|
||||||
|
|
||||||
|
$location = Location::find($id);
|
||||||
|
|
||||||
|
|
||||||
|
$allMachines = Location::query()->where('name', '=', $request->name)->where('id', '!=', $id)->get();
|
||||||
|
|
||||||
|
// If there already is a washing machine with that name, then don't change it
|
||||||
|
if (count($allMachines) > 0)
|
||||||
|
return redirect()->route("locations.store")->with('NameExists', '<p><b>Der findes allerede en lokation med det navn!</b></p>');
|
||||||
|
else { // Else - Change the name
|
||||||
|
$location->update($data);
|
||||||
|
$location->save();
|
||||||
|
|
||||||
|
$locations = Location::query()->paginate($request->input("limit", 20));
|
||||||
|
return redirect()->route("locations.index", ["locations" => $locations]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Location $location
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(Location $location)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Location;
|
||||||
use App\WashingReservation;
|
use App\WashingReservation;
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
|
@ -44,7 +45,9 @@ class WashingMachineController extends Controller
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return Response::detect("washing-machines.create");
|
$locations = Location::all();
|
||||||
|
|
||||||
|
return Response::detect("washing-machines.create", ["locations" => $locations] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,12 +59,13 @@ class WashingMachineController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
"name" => "required"
|
"name" => "required",
|
||||||
|
"location_id" => "required"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$machine = new WashingMachine($data);
|
$machine = new WashingMachine($data);
|
||||||
|
|
||||||
$allMachines = WashingMachine::query()->where('name', '=', $request->name)->get();
|
$allMachines = WashingMachine::query()->where('name', '=', $request->name)->where('location_id', "=", $request->location_id)->get();
|
||||||
|
|
||||||
// If there already is a washing machine with that name, then don't add it
|
// If there already is a washing machine with that name, then don't add it
|
||||||
if (count($allMachines) > 0)
|
if (count($allMachines) > 0)
|
||||||
|
@ -81,11 +85,7 @@ class WashingMachineController extends Controller
|
||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$machine = WashingMachine::find($id);
|
|
||||||
|
|
||||||
return Response::detect("washing-machines.show", [
|
|
||||||
"machine" => $machine
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,9 +97,11 @@ class WashingMachineController extends Controller
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$machine = WashingMachine::find($id);
|
$machine = WashingMachine::find($id);
|
||||||
|
$locations = Location::all();
|
||||||
|
|
||||||
return Response::detect("washing-machines.edit", [
|
return Response::detect("washing-machines.edit", [
|
||||||
"machine" => $machine
|
"machine" => $machine,
|
||||||
|
"locations" => $locations
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,13 +115,14 @@ class WashingMachineController extends Controller
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
"name" => "required"
|
"name" => "required",
|
||||||
|
"location_id" => "required",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$machine = WashingMachine::find($id);
|
$machine = WashingMachine::find($id);
|
||||||
|
|
||||||
|
|
||||||
$allMachines = WashingMachine::query()->where('name', '=', $request->name)->where('id', '!=', $id)->get();
|
$allMachines = WashingMachine::query()->where('name', '=', $request->name)->where('location_id', "=", $request->location_id)->where('id', '!=', $id)->get();
|
||||||
|
|
||||||
// If there already is a washing machine with that name, then don't change it
|
// If there already is a washing machine with that name, then don't change it
|
||||||
if (count($allMachines) > 0)
|
if (count($allMachines) > 0)
|
||||||
|
|
|
@ -103,10 +103,7 @@ class WashingReservationController extends Controller
|
||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$reservation = WashingReservation::query()->find($id);
|
|
||||||
$machines = WashingMachine::all();
|
|
||||||
|
|
||||||
return Response::detect("washing-reservations.edit", ['washing_reservation' => $reservation, 'machines' => $machines ]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,26 +115,7 @@ class WashingReservationController extends Controller
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
$data = $request->validate([
|
|
||||||
"time" => "required",
|
|
||||||
"machine" => "required"
|
|
||||||
]);
|
|
||||||
|
|
||||||
$machineReservation = WashingReservation::find($id);
|
|
||||||
|
|
||||||
$machineReservation->update($data);
|
|
||||||
|
|
||||||
$saved = $machineReservation->save();
|
|
||||||
|
|
||||||
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]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -246,4 +224,3 @@ class WashingReservationController extends Controller
|
||||||
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
|
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Location extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'name'
|
||||||
|
];
|
||||||
|
}
|
|
@ -14,6 +14,6 @@ class WashingMachine extends Model
|
||||||
{
|
{
|
||||||
//protected variable which contains name of database field(s) to be filled.
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name'
|
'name', 'location_id'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateLocationsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('locations', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string("name")->unique();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('locations');
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,8 +17,11 @@ class CreateWashingMachines extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('washing_machines', function (Blueprint $table) {
|
Schema::create('washing_machines', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string("name")->unique();
|
$table->string("name");
|
||||||
|
|
||||||
|
$table->foreignId("location_id")->constrained("locations", "id");
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
$table->unique(['name', 'location_id']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,6 @@ class DatabaseSeeder extends Seeder
|
||||||
$this->call(RoleSeeder::class);
|
$this->call(RoleSeeder::class);
|
||||||
$this->call(UserSeeder::class);
|
$this->call(UserSeeder::class);
|
||||||
$this->call(ContactSeeder::class);
|
$this->call(ContactSeeder::class);
|
||||||
|
$this->call(LocationSeeder::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class LocationSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$locationdata = [
|
||||||
|
[
|
||||||
|
"name" => "Bygning B"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"name" => "Bygning E"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($locationdata as $data) {
|
||||||
|
$location = new \App\Location();
|
||||||
|
|
||||||
|
$location->name = $data["name"];
|
||||||
|
|
||||||
|
$location->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ class PermissionSeeder extends Seeder
|
||||||
"ownuser.edit" => "Allows editing of your own user",
|
"ownuser.edit" => "Allows editing of your own user",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CALENDAR specific permissions
|
* The CALENDAR specific permissions //TODO: Do we use them?
|
||||||
*/
|
*/
|
||||||
"calendar.create" => "Create a new event.",
|
"calendar.create" => "Create a new event.",
|
||||||
"calendar.list" => "Shows all events.",
|
"calendar.list" => "Shows all events.",
|
||||||
|
@ -51,63 +51,109 @@ class PermissionSeeder extends Seeder
|
||||||
"event.edit" => "Allows editing of events",
|
"event.edit" => "Allows editing of events",
|
||||||
"event.delete" => "Allows deletion of events",
|
"event.delete" => "Allows deletion of events",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The CONTACT specific permissions
|
||||||
|
*/
|
||||||
"contact.create" => "Creates a new contact",
|
"contact.create" => "Creates a new contact",
|
||||||
"contact.list" => "Shows all contacts",
|
"contact.list" => "Shows all contacts",
|
||||||
"contact.show" => "Shows a specific contact",
|
"contact.show" => "Shows a specific contact",
|
||||||
"contact.edit" => "allows editing of contacts",
|
"contact.edit" => "allows editing of contacts",
|
||||||
"contact.delete" => "Allows deletion of contacts",
|
"contact.delete" => "Allows deletion of contacts",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The FEEDBACK specific permissions
|
||||||
|
*/
|
||||||
"feedback.create" => "Creates a new feedback message",
|
"feedback.create" => "Creates a new feedback message",
|
||||||
"feedback.list" => "Shows all feedback messages",
|
"feedback.list" => "Shows all feedback messages",
|
||||||
"feedback.show" => "Shows a specific feedback message",
|
"feedback.show" => "Shows a specific feedback message",
|
||||||
"feedback.edit" => "allows editing of feedback messages",
|
"feedback.edit" => "allows editing of feedback messages",
|
||||||
"feedback.delete" => "allows deletion of feedback messages",
|
"feedback.delete" => "allows deletion of feedback messages",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The MENUPLAN specific permissions
|
||||||
|
*/
|
||||||
"menuplan.create" => "Create a new menuplan",
|
"menuplan.create" => "Create a new menuplan",
|
||||||
"menuplan.list" => "Shows all menuplans",
|
"menuplan.list" => "Shows all menuplans",
|
||||||
"menuplan.show" => "Shows a specific menuplan",
|
"menuplan.show" => "Shows a specific menuplan",
|
||||||
"menuplan.edit" => "Allows editing of menuplans",
|
"menuplan.edit" => "Allows editing of menuplans",
|
||||||
"menuplan.delete" => "Allows deletion of menuplans",
|
"menuplan.delete" => "Allows deletion of menuplans",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The RESOURCE CATEGORY specific permissions
|
||||||
|
*/
|
||||||
"resource.category.create" => "Create a new resource category",
|
"resource.category.create" => "Create a new resource category",
|
||||||
"resource.category.list" => "Shows all resource categories",
|
"resource.category.list" => "Shows all resource categories",
|
||||||
"resource.category.show" => "Shows a specific resource category",
|
"resource.category.show" => "Shows a specific resource category",
|
||||||
"resource.category.edit" => "Allows editing of resource categories",
|
"resource.category.edit" => "Allows editing of resource categories",
|
||||||
"resource.category.delete" => "Allows deletion of resource categories",
|
"resource.category.delete" => "Allows deletion of resource categories",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The RESOURCE EXTENSION specific permissions
|
||||||
|
*/
|
||||||
"resource.extension.create" => "Create a new resource extension",
|
"resource.extension.create" => "Create a new resource extension",
|
||||||
"resource.extension.list" => "Shows all resource extensions",
|
"resource.extension.list" => "Shows all resource extensions",
|
||||||
"resource.extension.show" => "Shows a specific resource extension",
|
"resource.extension.show" => "Shows a specific resource extension",
|
||||||
"resource.extension.edit" => "Allows editing of resource extensions",
|
"resource.extension.edit" => "Allows editing of resource extensions",
|
||||||
"resource.extension.delete" => "Allows deletion of resource extensions",
|
"resource.extension.delete" => "Allows deletion of resource extensions",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The RESOURCE specific permissions
|
||||||
|
*/
|
||||||
"resource.create" => "Create a new resource",
|
"resource.create" => "Create a new resource",
|
||||||
"resource.list" => "Shows all resources",
|
"resource.list" => "Shows all resources",
|
||||||
"resource.show" => "Shows a specific resource",
|
"resource.show" => "Shows a specific resource",
|
||||||
"resource.edit" => "Allows editing of resources",
|
"resource.edit" => "Allows editing of resources",
|
||||||
"resource.delete" => "Allows deletion of resources",
|
"resource.delete" => "Allows deletion of resources",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The WASHING MACHINE specific permissions
|
||||||
|
*/
|
||||||
"washing.machine.create" => "Create a new washing machine",
|
"washing.machine.create" => "Create a new washing machine",
|
||||||
"washing.machine.list" => "Shows all washing machines",
|
"washing.machine.list" => "Shows all washing machines",
|
||||||
"washing.machine.show" => "Shows a specific washing machine",
|
"washing.machine.show" => "Shows a specific washing machine",
|
||||||
"washing.machine.edit" => "Allows editing of washing machines",
|
"washing.machine.edit" => "Allows editing of washing machines",
|
||||||
"washing.machine.delete" => "Allows deletion of washing machines",
|
"washing.machine.delete" => "Allows deletion of washing machines",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The WASHING MACHINE RESERVATION specific permissions
|
||||||
|
*/
|
||||||
"washing.machine.reservation.create" => "Create a new washing machine reservation",
|
"washing.machine.reservation.create" => "Create a new washing machine reservation",
|
||||||
"washing.machine.reservation.list" => "Shows all washing machine reservations",
|
"washing.machine.reservation.list" => "Shows all washing machine reservations",
|
||||||
"washing.machine.reservation.show" => "Shows a specific washing machine reservation",
|
"washing.machine.reservation.show" => "Shows a specific washing machine reservation",
|
||||||
"washing.machine.reservation.edit" => "Allows editing of washing machine reservations",
|
"washing.machine.reservation.edit" => "Allows editing of washing machine reservations",
|
||||||
"washing.machine.reservation.delete" => "Allows deletion of washing machine reservations",
|
"washing.machine.reservation.delete" => "Allows deletion of washing machine reservations",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ROLES specific permissions
|
||||||
|
*/
|
||||||
"roles.create" => "Create a new role",
|
"roles.create" => "Create a new role",
|
||||||
"roles.list" => "Shows all roles",
|
"roles.list" => "Shows all roles",
|
||||||
"roles.show" => "Shows a specific role",
|
"roles.show" => "Shows a specific role",
|
||||||
"roles.edit" => "Allows editing of roles",
|
"roles.edit" => "Allows editing of roles",
|
||||||
"roles.delete" => "Allows deletion of roles",
|
"roles.delete" => "Allows deletion of roles",
|
||||||
|
|
||||||
//Allows access to the admin panel
|
/**
|
||||||
"admin.panel.show" => "Allows access to administration panel",
|
* The GUIDE specific permissions
|
||||||
|
*/
|
||||||
|
"guides.create" => "Create a new guide",
|
||||||
|
"guides.list" => "Shows all guides",
|
||||||
|
"guides.show" => "Shows a specific guide",
|
||||||
|
"guides.edit" => "Allows editing of guides",
|
||||||
|
"guides.delete" => "Allows deletion of guides",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The LOCATION specific permissions
|
||||||
|
*/
|
||||||
|
"locations.create" => "Create a new location",
|
||||||
|
"locations.list" => "Shows all locations",
|
||||||
|
"locations.show" => "Shows a specific location",
|
||||||
|
"locations.edit" => "Allows editing of locations",
|
||||||
|
"locations.delete" => "Allows deletion of locations",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ADMIN PANEL specific permissions
|
||||||
|
*/
|
||||||
|
"admin.panel.show" => "Allows access to administration panel",
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($permissions as $key => $value) {
|
foreach ($permissions as $key => $value) {
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
<div class="segment">
|
<div class="segment">
|
||||||
<h3 class="text-white"><a href="{{ route("events.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Aktiviteter</span></a></h3>
|
<h3 class="text-white"><a href="{{ route("events.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Aktiviteter</span></a></h3>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="segment">
|
||||||
|
<h3 class="text-white"><a href="{{ route("locations.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Lokationer</span></a></h3>
|
||||||
|
</div>
|
||||||
<div class="segment">
|
<div class="segment">
|
||||||
<h3 class="text-white"><a href="{{ route("washing-machines.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Vaskemaskiner</span></a></h3>
|
<h3 class="text-white"><a href="{{ route("washing-machines.index") }}" class="text-white"><i class="fa fa-link"></i><span style="margin-left: 4px;">Vaskemaskiner</span></a></h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
@extends("admin.layout.base")
|
||||||
|
@extends("admin.layout.header")
|
||||||
|
|
||||||
|
@section("title")
|
||||||
|
Opret Lokation
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("path")
|
||||||
|
<a href="{{ route('locations.create') }}" class="text-white">Opret Lokation</a> /
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("content")
|
||||||
|
<h1>Opret Lokation</h1>
|
||||||
|
<form method="post" action="{{ route("locations.store") }}">
|
||||||
|
@csrf
|
||||||
|
<label for="name">Lokationsnavn:</label>
|
||||||
|
<input type="text" name="name" id="name" placeholder="Bygning A" required>
|
||||||
|
<input type="submit" class="btn btn-dark text-white" value="Opret">
|
||||||
|
</form>
|
||||||
|
@endsection
|
|
@ -0,0 +1,13 @@
|
||||||
|
@extends("admin.layout.base")
|
||||||
|
@extends("admin.layout.header")
|
||||||
|
|
||||||
|
@section("title")
|
||||||
|
Vejledning - Fjern
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("path")
|
||||||
|
<a href="{{ route('guides.delete') }}" class="text-white">Fjern Guide</a> /
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("content")
|
||||||
|
@endsection
|
|
@ -0,0 +1,21 @@
|
||||||
|
@extends("admin.layout.base")
|
||||||
|
@extends("admin.layout.header")
|
||||||
|
|
||||||
|
@section("title")
|
||||||
|
Lokation - Rediger
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("path")
|
||||||
|
<a href="{{route('locations.edit', ['location' => $location ])}}" class="text-white">Rediger lokation</a> /
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("content")
|
||||||
|
<h1>Rediger Lokation</h1>
|
||||||
|
<form method="post" action="{{ route("locations.update", ['location' => $location ]) }}">
|
||||||
|
@csrf
|
||||||
|
@method("put")
|
||||||
|
<label for="name">Lokationsnavn:</label>
|
||||||
|
<input type="text" name="name" id="name" value="{{ $location->name }}" required>
|
||||||
|
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||||
|
</form>
|
||||||
|
@endsection
|
|
@ -0,0 +1,38 @@
|
||||||
|
@extends("admin.layout.base")
|
||||||
|
@extends("admin.layout.header")
|
||||||
|
|
||||||
|
@section("title")
|
||||||
|
Vis Lokationer
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("path")
|
||||||
|
<a href="{{ route('locations.index') }}" class="text-white">Vis lokationer</a> /
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("content")
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('locations.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Lokation</a>
|
||||||
|
</div>
|
||||||
|
<table class="tbl mt-2">
|
||||||
|
<tr>
|
||||||
|
<th>Navn</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($locations as $location)
|
||||||
|
<tr>
|
||||||
|
<td>{{$location->name}}</td>
|
||||||
|
<td><a href="{{ route("locations.edit", [ "location" => $location ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
|
||||||
|
<td><form method="post" action="{{ route("locations.destroy", [ "location" => $location ]) }}" 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>
|
||||||
|
|
||||||
|
{{ $locations->links() }}
|
||||||
|
@endsection
|
|
@ -0,0 +1,14 @@
|
||||||
|
@extends("admin.layout.base")
|
||||||
|
@extends("admin.layout.header")
|
||||||
|
|
||||||
|
@section("title")
|
||||||
|
Vejledning - Opret
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("path")
|
||||||
|
<a href="{{ route('guides.create') }}" class="text-white">Opret vejledning</a> /
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("content")
|
||||||
|
vejledning blev (ikke) oprettet.
|
||||||
|
@endsection
|
|
@ -0,0 +1,14 @@
|
||||||
|
@extends("admin.layout.base")
|
||||||
|
@extends("admin.layout.header")
|
||||||
|
|
||||||
|
@section("title")
|
||||||
|
Vejledning - Rediger
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("path")
|
||||||
|
<a href="{{ route('guides.edit', ["guide" => $link]) }}" class="text-white">Vejledning</a> /
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section("content")
|
||||||
|
Din vejledning blev (ikke) redigeret.
|
||||||
|
@endsection
|
|
@ -56,7 +56,6 @@
|
||||||
<option {{ $selected }} value="{{ $role->name }}">{{ $role->name }}</option>
|
<option {{ $selected }} value="{{ $role->name }}">{{ $role->name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -15,6 +15,17 @@
|
||||||
@csrf
|
@csrf
|
||||||
<label for="name_first">Vaskemaskine Navn:</label>
|
<label for="name_first">Vaskemaskine Navn:</label>
|
||||||
<input type="text" name="name" id="name" max="60" placeholder="Vaskemaskine nr. 1" required>
|
<input type="text" name="name" id="name" max="60" placeholder="Vaskemaskine nr. 1" required>
|
||||||
|
<label for="location_id">Lokation:</label>
|
||||||
|
<select name="location_id" id="location_id" class="mb-2" required>
|
||||||
|
<option disabled selected value> -- Vælg Lokation -- </option>
|
||||||
|
@if(count($locations) > 0)
|
||||||
|
@foreach($locations as $location)
|
||||||
|
<option value="{{ $location->id }}">{{ $location->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
@else
|
||||||
|
<option disabled> Der er ingen lokationer oprettet!</option>
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
<input type="submit" class="btn btn-dark text-white" value="Opret">
|
<input type="submit" class="btn btn-dark text-white" value="Opret">
|
||||||
</form>
|
</form>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -15,6 +15,16 @@
|
||||||
@method("put")
|
@method("put")
|
||||||
<label for="name_first">Vaskemaskine Navn:</label>
|
<label for="name_first">Vaskemaskine Navn:</label>
|
||||||
<input type="text" name="name" id="name" max="60" value="{{$machine->name}}" required>
|
<input type="text" name="name" id="name" max="60" value="{{$machine->name}}" required>
|
||||||
|
<select class="w-100" name="location_id" id="location_id" class="mb-2" required>
|
||||||
|
<option disabled> -- Vælg Lokation -- </option>
|
||||||
|
@foreach($locations as $location)
|
||||||
|
{{ $selected = "" }}
|
||||||
|
@if($machine->location_id == $location->id)
|
||||||
|
{{ $selected = "selected" }}
|
||||||
|
@endif
|
||||||
|
<option {{ $selected }} value="{{ $location->id }}">{{ $location->name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||||
</form>
|
</form>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -17,12 +17,14 @@
|
||||||
<table class="tbl mt-2">
|
<table class="tbl mt-2">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Navn</th>
|
<th>Navn</th>
|
||||||
|
<th>Lokation</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/pencil.svg') }}" alt="Update"></th>
|
||||||
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
|
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($machines as $machine)
|
@foreach($machines as $machine)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$machine->name}}</td>
|
<td>{{$machine->name}}</td>
|
||||||
|
<td>{{\App\Location::query()->where("id", "=", $machine->location_id)->first()->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><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">
|
<td><form method="post" action="{{ route('washing-machines.destroy', [ 'washing_machine' => $machine ]) }}" class="w-100 nostyle">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
|
@ -54,3 +54,4 @@ Route::resource("resource-extensions", "ResourceExtensionController");
|
||||||
Route::resource("resource-categories", "ResourceCategoryController");
|
Route::resource("resource-categories", "ResourceCategoryController");
|
||||||
Route::resource("roles", "RolesController");
|
Route::resource("roles", "RolesController");
|
||||||
Route::resource("guides", "GuideController");
|
Route::resource("guides", "GuideController");
|
||||||
|
Route::resource("locations", "LocationController");
|
||||||
|
|
Loading…
Reference in New Issue