Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp
Conflicts: skolehjem/app/Http/Controllers/ContactController.php
This commit is contained in:
commit
a3209bc422
|
@ -4,7 +4,7 @@ namespace App;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Feedback extends Model
|
||||
class Feedbacks extends Model
|
||||
{
|
||||
//
|
||||
}
|
|
@ -95,9 +95,16 @@ class ContactController extends Controller
|
|||
return Response::detect("contacts.update", [ "contacts" => $contact ]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy(Contact $id)
|
||||
{
|
||||
$id->delete();
|
||||
return Response::detect("contacts.destroy");}
|
||||
return redirect()->route("contacts.index");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Feedback;
|
||||
use App\Feedbacks;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
|
@ -17,9 +17,9 @@ class FeedbackController extends Controller
|
|||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$feedback = Feedback::query()->paginate($request->input("limit", 20));
|
||||
$feedback = Feedbacks::query()->paginate($request->input("limit", 20));
|
||||
|
||||
return Response::detect("feedback.index", [ "feedback" => $feedback ]);
|
||||
return Response::detect("feedbacks.index", [ "feedback" => $feedback ]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ class FeedbackController extends Controller
|
|||
"link" => "required|max:255"
|
||||
]);
|
||||
|
||||
$feedback = new Feedback($requestBody);
|
||||
$feedback = new Feedbacks($requestBody);
|
||||
$feedback->save();
|
||||
|
||||
return Response::detect("feedback.store");
|
||||
|
@ -70,7 +70,7 @@ class FeedbackController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$feedback = Feedback::find($id);
|
||||
$feedback = Feedbacks::find($id);
|
||||
|
||||
return Response::detect("feedbacks.edit", [
|
||||
"feedback" => $feedback
|
||||
|
@ -90,7 +90,7 @@ class FeedbackController extends Controller
|
|||
"time" => "required"
|
||||
]);
|
||||
|
||||
$feedback = Feedback::find($id);
|
||||
$feedback = Feedbacks::find($id);
|
||||
|
||||
$feedback->update($data);
|
||||
|
||||
|
@ -109,7 +109,7 @@ class FeedbackController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$feedback = Feedback::find($id);
|
||||
$feedback = Feedbacks::find($id);
|
||||
$feedback->delete();
|
||||
|
||||
return Response::detect("feedbacks.destroy");
|
||||
|
|
|
@ -53,28 +53,19 @@ class StaffController extends Controller
|
|||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
Log::debug("STORE FUNCTION");
|
||||
|
||||
$data = $request->validate([
|
||||
"name_first" => "required|max:255",
|
||||
"name_last" => "required|max:255",
|
||||
"email" => "required|email|unique:staff",
|
||||
"password" => "required|max:60",
|
||||
"phone" => "required|unique:staff",
|
||||
"phone" => "required|unique:staff"
|
||||
|
||||
]);
|
||||
|
||||
Log::debug("FINISHED VALIDATION?");
|
||||
|
||||
$staff = new Staff($data);
|
||||
|
||||
Log::debug("CREATED STAFF [NOT PERSISTED YET]");
|
||||
|
||||
$staff->save();
|
||||
|
||||
Log::debug("SAVED STAFF");
|
||||
|
||||
return view("staff.store");
|
||||
return Response::detect("staff.store");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,18 +152,9 @@ class StaffController extends Controller
|
|||
* @param int $id
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy(Staff $id)
|
||||
{
|
||||
// if($id === Auth::id()) {
|
||||
// $user = Auth::user();
|
||||
// $user->delete();
|
||||
// }
|
||||
// else if(Auth::user()->hasPermissionTo("user.delete")) {
|
||||
$staff = Staff::find($id);
|
||||
|
||||
$staff->delete();
|
||||
// }
|
||||
|
||||
$id->delete();
|
||||
return redirect()->route("staff.index");
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class UserController extends Controller
|
|||
|
||||
Log::debug("SAVED USER");
|
||||
|
||||
return view("users.store");
|
||||
return Response::detect("users.store");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,7 @@ class CreateFeedbacks extends Migration
|
|||
Schema::create('feedbacks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string("message");
|
||||
$table->string("suggestion_form"); //Skriver om det er Ris el. Ros
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateStaffTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('staff', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name_first');
|
||||
$table->string('name_last');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->integer("phone")->unique();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('staff');
|
||||
}
|
||||
}
|
|
@ -6608,12 +6608,16 @@ main {
|
|||
.tbl {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.tbl td,
|
||||
.tbl th {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tbl tr:nth-child(even) {
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
.tbl {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.tbl td, .tbl th {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tbl tr:nth-child(even){background-color: rgba(0, 0, 0, 0.1);}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
@extends("admin.layout.base")
|
||||
@extends("admin.layout.header")
|
||||
|
||||
@section("title")
|
||||
Kontakter - Opret
|
||||
@endsection
|
||||
|
||||
@section("path")
|
||||
<a href="" class="text-white">Slet Kontakt</a> /
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
@endsection
|
|
@ -6,7 +6,7 @@
|
|||
@endsection
|
||||
|
||||
@section("path")
|
||||
<a href="{{ route('contacts.update', ["contact" => $contact]) }}" class="text-white">Rediger Bruger</a> /
|
||||
<a href="{{ route('contacts.update', ['contact' => $contacts]) }}" class="text-white">Rediger Bruger</a> /
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
@extends("admin.layout.base")
|
||||
@extends("admin.layout.header")
|
||||
|
||||
@section("title")
|
||||
Feedback - Vis
|
||||
@endsection
|
||||
|
||||
@section("path")
|
||||
<a href="{{ route('feedbacks.index') }}" class="text-white">Vis Feedback</a> /
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<table class="tbl">
|
||||
<tr>
|
||||
<th>Feedback Besked</th>
|
||||
<th>Ris el. Ros</th>
|
||||
</tr>
|
||||
@foreach($feedback as $fb)
|
||||
<tr>
|
||||
<td>{{ $fb->message }}</td>
|
||||
<td>{{ $fb->suggestion_form }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
||||
{{ $feedback->links() }}
|
||||
@endsection
|
|
@ -67,6 +67,12 @@
|
|||
<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">Feedback</h3>
|
||||
<div class="row">
|
||||
<a href="{{ route('feedbacks.index') }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Feedback</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-85" style="background-color: #cccccc;">
|
||||
<div class="directorypath text-white">
|
||||
|
|
|
@ -26,14 +26,7 @@
|
|||
<td>{{$menuplan->wednesday}}</td>
|
||||
<td>{{$menuplan->thursday}}</td>
|
||||
<td><a href="{{ route("menu-plans.edit", [ "menu_plan" => $menuplan ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
|
||||
<td>
|
||||
<form method="post" action="{{ route("menu-plans.destroy", [ "menu_plan" => $menuplan ]) }}" class="w-100">
|
||||
@csrf
|
||||
@method("delete")
|
||||
|
||||
<button class="w-100" type="submit"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
|
||||
</form>
|
||||
</td>
|
||||
<td><a href="{{ route("menu-plans.destroy", [ "menu_plan" => $menuplan ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<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->name_email }}" required>
|
||||
<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>
|
||||
|
|
|
@ -26,14 +26,7 @@
|
|||
<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 ]) }}" class="w-100">
|
||||
@csrf
|
||||
@method("delete")
|
||||
|
||||
<button type="submit"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
|
||||
</form>
|
||||
</td>
|
||||
<td><a href="{{ route("staff.destroy", [ "staff" => $staff->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
|
|
@ -26,14 +26,7 @@
|
|||
<td>{{ $user->email }}</td>
|
||||
<td>{{ $user->phone }}</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">
|
||||
@csrf
|
||||
@method("delete")
|
||||
|
||||
<button type="submit"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
|
||||
</form>
|
||||
</td>
|
||||
<td><a href="{{ route("users.destroy", [ "user" => $user ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
|
|
@ -44,5 +44,8 @@
|
|||
<h4 class="mt-0">Kollegieassistent</h4>
|
||||
<span class="text-center sde-black-20 mt-1">+45 24 62 94 50</span>
|
||||
<a class="btn text-center btn-sde-blue mt-1" href="tel:+4524629450">Ring</a>
|
||||
|
||||
<span class="text-center sde-black-20 mt-1">Send feedback omkring hvem el. hvad som helst</span>
|
||||
<a class="btn text-center btn-sde-blue mt-1" href="feedbacks">Giv Feedback</a>
|
||||
</main>
|
||||
@endsection
|
|
@ -0,0 +1,19 @@
|
|||
@extends("app.layout.base")
|
||||
|
||||
@section("title")
|
||||
Feedback - Ris/Ros
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<main class="h-100 text-center">
|
||||
<form action="" method="post" required>
|
||||
<span>Ris el. Ros?</span>
|
||||
<select name="choose_suggestion" class="mb-2">
|
||||
<option>Ros</option>
|
||||
<option>Ris</option>
|
||||
</select>
|
||||
<textarea name="feedback_message" placeholder="Skriv Ris/Ros besked her" required></textarea>
|
||||
<button class="btn btn-sde-blue mt-2" onclick="window.location = '';">Send Ris/Ros</button>
|
||||
</form>
|
||||
</main>
|
||||
@endsection
|
|
@ -3,7 +3,7 @@
|
|||
{{----}}
|
||||
|
||||
{{--Index--}}
|
||||
{{--@extends("app.users.index")--}}
|
||||
{{----}}@extends("app.users.index")
|
||||
|
||||
{{--Login--}}
|
||||
{{--@extends("app.users.login")--}}
|
||||
|
@ -27,7 +27,10 @@
|
|||
{{--@extends("app.contact.index")--}}
|
||||
|
||||
{{--Account--}}
|
||||
{{----}}@extends("app.users.index")
|
||||
{{--@extends("app.users.index")--}}
|
||||
|
||||
{{--Feedback--}}
|
||||
{{--@extends("app.feedbacks.index")--}}
|
||||
|
||||
{{----}}
|
||||
{{------Admin Panel
|
||||
|
|
Loading…
Reference in New Issue