diff --git a/skolehjem/app/Contact.php b/skolehjem/app/Contact.php index c035b2a..353a325 100644 --- a/skolehjem/app/Contact.php +++ b/skolehjem/app/Contact.php @@ -6,5 +6,7 @@ use Illuminate\Database\Eloquent\Model; class Contact extends Model { - // + protected $fillable = [ + 'name_first', "name_last", 'email', 'phone' + ]; } diff --git a/skolehjem/app/Http/Controllers/ContactController.php b/skolehjem/app/Http/Controllers/ContactController.php index 63eea17..2fb0e54 100644 --- a/skolehjem/app/Http/Controllers/ContactController.php +++ b/skolehjem/app/Http/Controllers/ContactController.php @@ -18,7 +18,7 @@ class ContactController extends Controller $contact = Contact::query()->paginate($request->input("limit", 20)); - return Response::detect("contact.index", [ "contact" => $contact]); + return Response::detect("contacts.index", [ "contacts" => $contact]); } /** @@ -28,7 +28,8 @@ class ContactController extends Controller */ public function create() { - // + return Response::detect("contacts.create"); + } /** @@ -39,7 +40,17 @@ class ContactController extends Controller */ public function store(Request $request) { - // + $requestContact = $request->validate([ + "name_first" => "required|max:255", + "name_last" => "required|max:255", + "email" => "required|max:255", + "phone" => "required|max:255", + ]); + + $contact = new Contact($requestContact); + $contact->save(); + + return Response::detect("contacts.store"); } /** @@ -50,7 +61,8 @@ class ContactController extends Controller */ public function show($id) { - // + return Response::detect("contacts.show", [ "contacts" => $id]); + } /** @@ -61,7 +73,8 @@ class ContactController extends Controller */ public function edit($id) { - // + $contact = Contact::find($id); + return Response::detect("contacts.edit", ["contact" => $contact]); } /** @@ -73,7 +86,13 @@ class ContactController extends Controller */ public function update(Request $request, $id) { - // + + $data = $request->all(); + $contact = Contact::find($id); + $contact->update($data); + $contact->save(); + + return Response::detect("contacts.update", [ "contacts" => $contact ]); } /** @@ -84,6 +103,9 @@ class ContactController extends Controller */ public function destroy($id) { - // + + $contact = Contact::find($id); + $contact->delete(); + return redirect()->route("contacts.index"); } } diff --git a/skolehjem/app/Http/Controllers/StaffController.php b/skolehjem/app/Http/Controllers/StaffController.php new file mode 100644 index 0000000..c5fbf78 --- /dev/null +++ b/skolehjem/app/Http/Controllers/StaffController.php @@ -0,0 +1,203 @@ +<?php + +namespace App\Http\Controllers; + +use App\Staff; +use Illuminate\Http\Request; +use Illuminate\Http\Response; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Log; + + +class StaffController extends Controller +{ + public function __construct() + { +// $this->middleware([ "auth" ])->only("logout"); +// $this->middleware([ "guest" ])->only("login"); +// +// $this->middleware([ "permission:staff.list", "role:admin" ])->only("index"); +// $this->middleware([ "permission:staff.show", "role:admin" ])->only("show"); +// $this->middleware([ "permission:staff.edit", "role:admin" ])->only([ "edit", "update" ]); +// $this->middleware([ "permission:staff.delete", "role:admin" ])->only("delete"); + } + + /** + * Display a listing of the resource. + * + * @param Request $request + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function index(Request $request) + { + $staffs = Staff::query()->paginate($request->query("page", 20)); + + return Response::detect("staff.index", [ "staffs" => $staffs ]); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function create() + { + return Response::detect("staff.create"); + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + 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", + + ]); + + 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"); + } + + /** + * Display the specified resource. + * + * @param int $id + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function show($id) + { + $staff = Staff::find($id); + + return Response::detect("staff.show", [ + "staff" => $staff + ]); + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function edit($id) + { + $staff = Staff::find($id); + + return Response::detect("staff.edit", [ + "staff" => $staff + ]); + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function update(Request $request, $id) + { + $data = $request->all(); + +// $data = $request->validate([ +// "name_first" => "max:255", +// "name_last" => "max:255", +// "email" => "email|unique:staff", +// "password" => "max:60", +// "phone" => "unique:staff", +// ]); + + // Validates if the staff is updating itself or another staff. +// if($id === Auth::id()) { +// $staff = Auth::staff(); +// +// $staff->update($data); +// +// $staff->save(); +// return Response::detect("staff.edit", [ +// "staff" => $staff +// ]); +// } + + //TODO: Implement when security's ready!!! +// else if(Auth::staff()->hasPermissionTo("staff.edit")) { + $staff = Staff::find($id); + + /** @var Staff $staff */ + $staff->update($data); + + $staff->save(); +// } + + $staffs = Staff::query()->paginate(20); + + return Response::detect("staff.index", [ + "staffs" => $staffs + ]); + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function destroy($id) + { +// if($id === Auth::id()) { +// $user = Auth::user(); +// $user->delete(); +// } +// else if(Auth::user()->hasPermissionTo("user.delete")) { + $staff = Staff::find($id); + + $staff->delete(); +// } + + return redirect()->route("staff.index"); + } + + /*******************************************/ + /* Authentication */ + /*******************************************/ + + public function showLogin() { + return view("admin.staff.login"); + } + + public function login(Request $request) { + $data = $request->only("email", "password"); + + if(Auth::attempt($data)) { + //TODO: Implement home? + return redirect()->route("staff.index"); + } + + return redirect()->back(303); + } + + public function logout(Request $request) { + Auth::logout(); + + return redirect()->to("/"); + } +} diff --git a/skolehjem/app/Staff.php b/skolehjem/app/Staff.php new file mode 100644 index 0000000..841134d --- /dev/null +++ b/skolehjem/app/Staff.php @@ -0,0 +1,45 @@ +<?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); + } +} diff --git a/skolehjem/database/migrations/2020_06_29_065007_create_contact.php b/skolehjem/database/migrations/2020_06_29_065007_create_contact.php index 01a3235..233c7e3 100644 --- a/skolehjem/database/migrations/2020_06_29_065007_create_contact.php +++ b/skolehjem/database/migrations/2020_06_29_065007_create_contact.php @@ -13,9 +13,14 @@ class CreateContact extends Migration */ public function up() { - Schema::create('contact', function (Blueprint $table) { + Schema::create('contacts', function (Blueprint $table) { $table->id(); $table->timestamps(); + $table->string('name_first', 255); + $table->string('name_last', 255); + $table->string('email', 255); + $table->integer('phone'); + //$table->unique('email'); }); } diff --git a/skolehjem/resources/views/admin/contacts/create.blade.php b/skolehjem/resources/views/admin/contacts/create.blade.php new file mode 100644 index 0000000..9e95044 --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/create.blade.php @@ -0,0 +1,26 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakter - Opret +@endsection + +@section("path") + <a href="" class="text-white">Opret Kontakt</a> / +@endsection + +@section("content") + <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="email">Email:</label> + <input type="email" name="email" id="email" placeholder="x@y.z" 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 diff --git a/skolehjem/resources/views/admin/contacts/delete.blade.php b/skolehjem/resources/views/admin/contacts/delete.blade.php new file mode 100644 index 0000000..b126821 --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/delete.blade.php @@ -0,0 +1,14 @@ +@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") + Din kontakt blev slettet +@endsection diff --git a/skolehjem/resources/views/admin/contacts/edit.blade.php b/skolehjem/resources/views/admin/contacts/edit.blade.php new file mode 100644 index 0000000..5167abf --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/edit.blade.php @@ -0,0 +1,27 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakt - Rediger +@endsection + +@section("path") + <a href="{{ route('contacts.edit', ['contact' => $contact]) }}" class="text-white">Rediger Kontakt</a> / +@endsection + +@section("content") + <h1>Rediger Kontakt:</h1> + <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="email">Email:</label> + <input type="email" name="email" id="email" placeholder="x@y.z" value="{{ $contact->email }}" required> + <label for="tel">Telefon nr:</label> + <input type="tel" name="phone" id="tel" placeholder="12345678" value="{{ $contact->phone }}" 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 diff --git a/skolehjem/resources/views/admin/contacts/index.blade.php b/skolehjem/resources/views/admin/contacts/index.blade.php new file mode 100644 index 0000000..36b034a --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/index.blade.php @@ -0,0 +1,33 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Events - Vis +@endsection + +@section("path") + <a href="" class="text-white">Vis Kontakter</a> / +@endsection + +@section("content") + <table class="tbl"> + <tr> + <th>Kontakt Navn</th> + <th>Titel</th> + <th>E-mail</th> + <th>Tlf</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($contacts as $contact) + <tr> + <td>{{ $contact->name_first }}</td> + <td>{{ $contact->name_last }}</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> + <td><a href="{{ route("contacts.destroy", [ "contact" => $contact ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> + </tr> + @endforeach + </table> +@endsection diff --git a/skolehjem/resources/views/admin/contacts/store.blade.php b/skolehjem/resources/views/admin/contacts/store.blade.php new file mode 100644 index 0000000..d6adde7 --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/store.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakter - Opret +@endsection + +@section("path") + <a href="" class="text-white">Opbevar Kontakt</a> / +@endsection + +@section("content") + Kontakten blev (ikke) oprettet. +@endsection diff --git a/skolehjem/resources/views/admin/contacts/update.blade.php b/skolehjem/resources/views/admin/contacts/update.blade.php new file mode 100644 index 0000000..f10aa0f --- /dev/null +++ b/skolehjem/resources/views/admin/contacts/update.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Kontakt - Rediger +@endsection + +@section("path") + <a href="{{ route('contacts.update', ["contact" => $contact]) }}" class="text-white">Rediger Bruger</a> / +@endsection + +@section("content") + Kontakten blev (ikke) redigeret. +@endsection diff --git a/skolehjem/resources/views/admin/layout/base.blade.php b/skolehjem/resources/views/admin/layout/base.blade.php index 0706b73..e3398e2 100644 --- a/skolehjem/resources/views/admin/layout/base.blade.php +++ b/skolehjem/resources/views/admin/layout/base.blade.php @@ -28,6 +28,15 @@ <a href="{{ route("menu-plans.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Menuplan</a> </div> </div> + <div class="segment"> + <h3 class="text-white">Aktiviteter</h3> + <div class="row"> + <a href="{{ route("events.index") }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Aktiviteter</a> + </div> + <div class="row"> + <a href="{{ route("events.create") }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Aktivitet</a> + </div> + </div> <div class="segment"> <h3 class="text-white">Vaskemaskiner</h3> <div class="row"> @@ -45,6 +54,18 @@ <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">Personale</h3> + <div class="row"> + <a href="{{ route('staff.index') }}" class="text-white"><img src="{{ asset('/images/icons/eye.svg') }}" alt="Read">Vis Personale</a> + </div> + <div class="row"> + <a href="{{ route('staff.create') }}" class="text-white"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Personal</a> + </div> </div> </div> <div class="w-85" style="background-color: #cccccc;"> diff --git a/skolehjem/resources/views/admin/menuplans/create.blade.php b/skolehjem/resources/views/admin/menuplans/create.blade.php index fab76ef..925a315 100644 --- a/skolehjem/resources/views/admin/menuplans/create.blade.php +++ b/skolehjem/resources/views/admin/menuplans/create.blade.php @@ -14,19 +14,13 @@ <form action="{{ action('MenuPlanController@store') }}" method="post"> @csrf <label for="monday">Mandag:</label> - <input type="text" name="monday" id="monday" required> + <input type="text" name="monday" id="monday" placeholder="Hawaii Pizza" required> <label for="tuesday">Tirsdag:</label> - <input type="text" name="tuesday" id="tuesday" required> + <input type="text" name="tuesday" id="tuesday" placeholder="Pasta Bolognese" required> <label for="wednesday">Onsdag:</label> - <input type="text" name="wednesday" id="wednesday" required> + <input type="text" name="wednesday" id="wednesday" placeholder="Pandekager" required> <label for="thursday">Torsdag:</label> - <input type="text" name="thursday" id="thursday" required> - <label for="friday">Fredag:</label> - <input type="text" name="friday" id="friday" required> - <label for="saturday">Lørdag:</label> - <input type="text" name="saturday" id="saturday" required> - <label for="sunday">Søndag:</label> - <input type="text" name="sunday" id="sunday" required> + <input type="text" name="thursday" id="thursday" placeholder="Bøf med løg" required> <input type="submit" class="btn btn-dark text-white" value="Opret Menuplan"> </form> diff --git a/skolehjem/resources/views/admin/menuplans/edit.blade.php b/skolehjem/resources/views/admin/menuplans/edit.blade.php index 97cf74b..a8a8cc3 100644 --- a/skolehjem/resources/views/admin/menuplans/edit.blade.php +++ b/skolehjem/resources/views/admin/menuplans/edit.blade.php @@ -22,12 +22,6 @@ <input type="text" name="wednesday" id="onsdag" value="{{ $menuplan->wednesday }}" required> <label for="torsdag">Torsdag:</label> <input type="text" name="thursday" id="torsdag" value="{{ $menuplan->thursday }}" required> - <label for="fredag">Fredag:</label> - <input type="text" name="friday" id="fredag" value="{{ $menuplan->friday }}" required> - <label for="lørdag">Lørdag:</label> - <input type="text" name="saturday" id="lørdag" value="{{ $menuplan->saturday }}" required> - <label for="søndag">Søndag:</label> - <input type="text" name="sunday" id="søndag" value="{{ $menuplan->sunday }}" required> <input type="submit" class="btn btn-dark text-white" value="Opret Menuplan"> </form> diff --git a/skolehjem/resources/views/admin/menuplans/index.blade.php b/skolehjem/resources/views/admin/menuplans/index.blade.php index c42d8e0..e165a9b 100644 --- a/skolehjem/resources/views/admin/menuplans/index.blade.php +++ b/skolehjem/resources/views/admin/menuplans/index.blade.php @@ -16,9 +16,6 @@ <th>Tirsdag</th> <th>Onsdag</th> <th>Torsdag</th> - <th>Fredag</th> - <th>Lørdag</th> - <th>Søndag</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> @@ -28,9 +25,6 @@ <td>{{$menuplan->tuesday}}</td> <td>{{$menuplan->wednesday}}</td> <td>{{$menuplan->thursday}}</td> - <td>{{$menuplan->friday}}</td> - <td>{{$menuplan->saturday}}</td> - <td>{{$menuplan->sunday}}</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"> diff --git a/skolehjem/resources/views/admin/menuplans/show.blade.php b/skolehjem/resources/views/admin/menuplans/show.blade.php index 5a8b198..fb7f9ab 100644 --- a/skolehjem/resources/views/admin/menuplans/show.blade.php +++ b/skolehjem/resources/views/admin/menuplans/show.blade.php @@ -16,9 +16,6 @@ <th>Tirsdag</th> <th>Onsdag</th> <th>Torsdag</th> - <th>Fredag</th> - <th>Lørdag</th> - <th>Søndag</th> <th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> <th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> </tr> @@ -27,9 +24,6 @@ <td>{Tirsdag}</td> <td>{Onsdag}</td> <td>{Torsdag}</td> - <td>{Fredag}</td> - <td>{Lørdag}</td> - <td>{Søndag}</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> </tr> diff --git a/skolehjem/resources/views/admin/staff/create.blade.php b/skolehjem/resources/views/admin/staff/create.blade.php new file mode 100644 index 0000000..3430725 --- /dev/null +++ b/skolehjem/resources/views/admin/staff/create.blade.php @@ -0,0 +1,30 @@ +@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 diff --git a/skolehjem/resources/views/admin/staff/delete.blade.php b/skolehjem/resources/views/admin/staff/delete.blade.php new file mode 100644 index 0000000..4c3f81e --- /dev/null +++ b/skolehjem/resources/views/admin/staff/delete.blade.php @@ -0,0 +1,13 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Fjern +@endsection + +@section("path") + <a href="{{ route('staff.delete') }}" class="text-white">Fjern Personal</a> / +@endsection + +@section("content") +@endsection diff --git a/skolehjem/resources/views/admin/staff/edit.blade.php b/skolehjem/resources/views/admin/staff/edit.blade.php new file mode 100644 index 0000000..fe8271d --- /dev/null +++ b/skolehjem/resources/views/admin/staff/edit.blade.php @@ -0,0 +1,31 @@ +@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->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> + <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 diff --git a/skolehjem/resources/views/admin/staff/index.blade.php b/skolehjem/resources/views/admin/staff/index.blade.php new file mode 100644 index 0000000..88f80ff --- /dev/null +++ b/skolehjem/resources/views/admin/staff/index.blade.php @@ -0,0 +1,42 @@ +@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 ]) }}" 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> + </tr> + @endforeach + </table> + + {{ $staffs->links() }} +@endsection diff --git a/skolehjem/resources/views/admin/staff/login.blade.php b/skolehjem/resources/views/admin/staff/login.blade.php new file mode 100644 index 0000000..5accdac --- /dev/null +++ b/skolehjem/resources/views/admin/staff/login.blade.php @@ -0,0 +1,27 @@ +@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 diff --git a/skolehjem/resources/views/admin/staff/logout.blade.php b/skolehjem/resources/views/admin/staff/logout.blade.php new file mode 100644 index 0000000..d364bbd --- /dev/null +++ b/skolehjem/resources/views/admin/staff/logout.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Home - Logud +@endsection + +@section("path") + <a href="{{ route('staff.logout') }}" class="text-white">Logud</a> / +@endsection + +@section("content") + +@endsection diff --git a/skolehjem/resources/views/admin/staff/show.blade.php b/skolehjem/resources/views/admin/staff/show.blade.php new file mode 100644 index 0000000..5563064 --- /dev/null +++ b/skolehjem/resources/views/admin/staff/show.blade.php @@ -0,0 +1,14 @@ +@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") + show.blade.php +@endsection diff --git a/skolehjem/resources/views/admin/staff/store.blade.php b/skolehjem/resources/views/admin/staff/store.blade.php new file mode 100644 index 0000000..43ae210 --- /dev/null +++ b/skolehjem/resources/views/admin/staff/store.blade.php @@ -0,0 +1,14 @@ +@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 diff --git a/skolehjem/resources/views/admin/staff/update.blade.php b/skolehjem/resources/views/admin/staff/update.blade.php new file mode 100644 index 0000000..7f7a25f --- /dev/null +++ b/skolehjem/resources/views/admin/staff/update.blade.php @@ -0,0 +1,14 @@ +@extends("admin.layout.base") +@extends("admin.layout.header") + +@section("title") + Personal - Rediger +@endsection + +@section("path") + <a href="{{ route('staff.edit') }}" class="text-white">Rediger Personal</a> / +@endsection + +@section("content") + Din Personal blev (ikke) redigeret. +@endsection diff --git a/skolehjem/resources/views/admin/washing-machines/create.blade.php b/skolehjem/resources/views/admin/washing-machines/create.blade.php index b8915bb..c81e7c9 100644 --- a/skolehjem/resources/views/admin/washing-machines/create.blade.php +++ b/skolehjem/resources/views/admin/washing-machines/create.blade.php @@ -14,28 +14,7 @@ <form method="post" action="{{ route("washing-machines.store") }}"> @csrf <label for="name_first">Vaskemaskine Navn:</label> - <input type="text" name="name" id="name" max="60" required> + <input type="text" name="name" id="name" max="60" placeholder="Vaskemaskine nr. 1" required> <input type="submit" class="btn btn-dark text-white" value="Opret"> </form> - -{{-- <table class="tbl">--}} -{{-- <tr>--}} -{{-- <th>ID</th>--}} -{{-- <th>Fornavn</th>--}} -{{-- <th>Efternavn</th>--}} -{{-- <th>Email</th>--}} -{{-- <th>Tlf nr</th>--}} -{{-- <th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>--}} -{{-- <th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>--}} -{{-- </tr>--}} -{{-- <tr>--}} -{{-- <td>{ID}</td>--}} -{{-- <td>{Fornavn}</td>--}} -{{-- <td>{Efternavn}</td>--}} -{{-- <td>{Email}</td>--}} -{{-- <td>{TLF}</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>--}} -{{-- </tr>--}} -{{-- </table>--}} @endsection diff --git a/skolehjem/resources/views/admin/washing-reservations/create.blade.php b/skolehjem/resources/views/admin/washing-reservations/create.blade.php index 5460e31..01d38ad 100644 --- a/skolehjem/resources/views/admin/washing-reservations/create.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/create.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Opret + Vaske Reservationer - Opret @endsection @section("path") - <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Booking</a> / + <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/delete.blade.php b/skolehjem/resources/views/admin/washing-reservations/delete.blade.php index faf2283..1fdbf71 100644 --- a/skolehjem/resources/views/admin/washing-reservations/delete.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/delete.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Fjern + Vaske Reservationer - Fjern @endsection @section("path") - <a href="" class="text-white">Fjern Booking</a> / + <a href="" class="text-white">Fjern Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/edit.blade.php b/skolehjem/resources/views/admin/washing-reservations/edit.blade.php index 036dbf0..66e0edb 100644 --- a/skolehjem/resources/views/admin/washing-reservations/edit.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/edit.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Rediger + Vaske Reservationer - Rediger @endsection @section("path") - <a href="{{ route('washing-reservations.edit', ['id' => $reservations->id]) }}" class="text-white">Rediger Booking</a> / + <a href="{{ route('washing-reservations.edit', ['id' => $reservations->id]) }}" class="text-white">Rediger Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/show.blade.php b/skolehjem/resources/views/admin/washing-reservations/show.blade.php index 9971c49..a77b6b7 100644 --- a/skolehjem/resources/views/admin/washing-reservations/show.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/show.blade.php @@ -2,11 +2,11 @@ @extends("admin.layout.header") @section("title") - Booking - Vis + Vaske Reservationer - Vis @endsection @section("path") - <a href="{{ route('washing-reservations.index') }}" class="text-white">Vis Booking</a> / + <a href="{{ route('washing-reservations.index') }}" class="text-white">Vis Vaske Reservationer</a> / @endsection @section("content") diff --git a/skolehjem/resources/views/admin/washing-reservations/store.blade.php b/skolehjem/resources/views/admin/washing-reservations/store.blade.php index 616c3e8..85ed1d7 100644 --- a/skolehjem/resources/views/admin/washing-reservations/store.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/store.blade.php @@ -2,13 +2,13 @@ @extends("admin.layout.header") @section("title") - Booking - Opret + Vaske Reservationer - Opret @endsection @section("path") - <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Booking</a> / + <a href="{{ route('washing-reservations.create') }}" class="text-white">Opret Vaske Reservationer</a> / @endsection @section("content") - Booking blev (ikke) oprettet. + Vaske Reservationer blev (ikke) oprettet. @endsection diff --git a/skolehjem/resources/views/admin/washing-reservations/update.blade.php b/skolehjem/resources/views/admin/washing-reservations/update.blade.php index 9dd8408..f890995 100644 --- a/skolehjem/resources/views/admin/washing-reservations/update.blade.php +++ b/skolehjem/resources/views/admin/washing-reservations/update.blade.php @@ -2,13 +2,13 @@ @extends("admin.layout.header") @section("title") - Booking - Rediger + Vaske Reservationer - Rediger @endsection @section("path") - <a href="{{ route('washing-reservations.edit') }}" class="text-white">Rediger Booking</a> / + <a href="{{ route('washing-reservations.edit') }}" class="text-white">Rediger Vaske Reservationer</a> / @endsection @section("content") - Din booking blev (ikke) redigeret. + Din Vaske Reservationer blev (ikke) redigeret. @endsection diff --git a/skolehjem/resources/views/app/menuplans/index.blade.php b/skolehjem/resources/views/app/menuplans/index.blade.php index cbd4249..f66d484 100644 --- a/skolehjem/resources/views/app/menuplans/index.blade.php +++ b/skolehjem/resources/views/app/menuplans/index.blade.php @@ -25,18 +25,6 @@ <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 class="w-100" id="fredag"> - <h3 class="sde-blue bold text-center">Fredag</h3> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p> - </div> - <div class="w-100" id="lørdag"> - <h3 class="sde-blue bold text-center">Lørdag</h3> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p> - </div> - <div class="w-100" id="søndag"> - <h3 class="sde-blue bold text-center">Søndag</h3> - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p> - </div> </div> </main> @endsection diff --git a/skolehjem/resources/views/app/root/index.blade.php b/skolehjem/resources/views/app/root/index.blade.php index df2b1fe..1984f5d 100644 --- a/skolehjem/resources/views/app/root/index.blade.php +++ b/skolehjem/resources/views/app/root/index.blade.php @@ -21,11 +21,14 @@ {{--@extends("app.washing-reservations.index")--}} {{--Menuplan--}} -{{----}}@extends("app.menuplans.index") +{{--@extends("app.menuplans.index")--}} {{--Contact--}} {{--@extends("app.contact.index")--}} +{{--Account--}} +{{----}}@extends("app.users.index") + {{----}} {{------Admin Panel {{----}} diff --git a/skolehjem/routes/web.php b/skolehjem/routes/web.php index 260a3f8..ef7c2dd 100644 --- a/skolehjem/routes/web.php +++ b/skolehjem/routes/web.php @@ -29,6 +29,7 @@ Route::get("/logout", "UserController@logout")->name("users.logout"); Route::resource("contacts", "ContactController"); Route::resource("menu-plans", "MenuPlanController"); Route::resource("users", "UserController"); +Route::resource("staff", "StaffController"); Route::resource("events", "EventController"); Route::resource("washing-machines", "WashingMachineController"); Route::resource("washing-reservations", "WashingReservationController");