This commit is contained in:
Sebastian Davaris 2020-06-29 14:50:08 +02:00
commit 4d35b368c6
13 changed files with 52 additions and 103 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true"> <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="Laravel.sqlite" uuid="428bc9e4-1a43-4d98-aec6-555a9cf65fb5"> <data-source source="LOCAL" name="laravel.sqlite" uuid="2ea08053-eec3-43f2-8f7e-59e448f603dd">
<driver-ref>sqlite.xerial</driver-ref> <driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize> <synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver> <jdbc-driver>org.sqlite.JDBC</jdbc-driver>

View File

@ -12,6 +12,6 @@ class Event extends Model
* @var array * @var array
*/ */
protected $fillable = [ protected $fillable = [
"name", "description" "name", "description", "date"
]; ];
} }

View File

@ -42,7 +42,8 @@ class EventController extends Controller
{ {
$requestBody = $request->validate([ $requestBody = $request->validate([
"name" => "required|unique:events|max:255", "name" => "required|unique:events|max:255",
"description" => "required|max:255" "description" => "required|max:255",
"date" => "required"
]); ]);
$event = new Event($requestBody); $event = new Event($requestBody);
@ -101,10 +102,10 @@ class EventController extends Controller
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws \Exception * @throws \Exception
*/ */
public function destroy(Event $id) public function destroy($id)
{ {
$id->delete(); $link = Event::find($id);
$link->delete();
return Response::detect("events.destroy"); return redirect()->route("events.index");
} }
} }

View File

@ -17,6 +17,7 @@ class CreateEvents extends Migration
$table->id(); $table->id();
$table->string("name"); $table->string("name");
$table->string("description"); $table->string("description");
$table->dateTime("date");
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -2,19 +2,23 @@
@extends("admin.layout.header") @extends("admin.layout.header")
@section("title") @section("title")
Vaskemaskiner - Vis Aktivitet - Vis
@endsection @endsection
@section("path") @section("path")
<a href="" class="text-white">Opret Vaskemaskine</a> / <a href="{{ route('events.create') }}" class="text-white">Opret Aktivitet</a> /
@endsection @endsection
@section("content") @section("content")
<h1>Opret Bruger:</h1> <h1>Opret Aktivitet:</h1>
<form method="post" action="{{ route("washing-machines.store") }}"> <form method="post" action="{{ route("events.store") }}">
@csrf @csrf
<label for="name_first">Navn:</label> <label for="name">Navn:</label>
<input type="text" name="name" id="name" max="60" required> <input type="text" name="name" id="name" max="60" required>
<label for="description">Beskrivelse:</label>
<input type="text" name="description" id="description" max="500" required>
<label for="date">Aktivitet dato:</label>
<input type="date" name="date" id="date" required>
<input type="submit" class="btn btn-dark text-white" value="Opret"> <input type="submit" class="btn btn-dark text-white" value="Opret">
</form> </form>

View File

@ -2,30 +2,12 @@
@extends("admin.layout.header") @extends("admin.layout.header")
@section("title") @section("title")
Vaskemaskiner - Vis Aktivitet - Fjern
@endsection @endsection
@section("path") @section("path")
<a href="" class="text-white">Vis Vaskemaskiner</a> / <a href="{{ route('events.destroy') }}" class="text-white"> fjern aktivitet</a>
@endsection @endsection
@section("content") @section("content")
<table class="tbl">
<tr>
<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>{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 @endsection

View File

@ -6,26 +6,18 @@
@endsection @endsection
@section("path") @section("path")
<a href="{{ route("events.index") }}" class="text-white">Vis Events</a> / <a href="" class="text-white">Vis Events</a> /
@endsection @endsection
@section("content") @section("content")
<table class="tbl"> <h1>Rediger Link:</h1>
<tr> <form method="post" action="{{route("events.update", ["event" => $event])}}">
<th>Fornavn</th> @csrf
<th>Efternavn</th> @method("PUT")
<th>Email</th> <label for="title">Titel:</label>
<th>Tlf nr</th> <input value="{{$event->name}}" type="text" name="title" id="title" required>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> <label for="link">Linket:</label>
<th style="width: 1px;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <input value="{{$event->description}}" type="text" name="link" id="link" required>
</tr> <input type="submit" class="btn btn-dark text-white" value="Rediger">
<tr> </form>
<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 @endsection

View File

@ -14,6 +14,7 @@
<tr> <tr>
<th>Event Navn</th> <th>Event Navn</th>
<th>Event Beskrivelse</th> <th>Event Beskrivelse</th>
<th>Event Dato</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>
@ -21,8 +22,14 @@
<tr> <tr>
<td>{{ $event->name }}</td> <td>{{ $event->name }}</td>
<td>{{ $event->description }}</td> <td>{{ $event->description }}</td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td>{{ $event->date }}</td>
<td><a href=""><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> <td><a href="{{ route("events.edit", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><form method="post" action="{{ route("events.destroy", [ "event" => $event ]) }}" 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>
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -6,26 +6,9 @@
@endsection @endsection
@section("path") @section("path")
<a href="" class="text-white">Vis Vaskemaskiner</a> / <a href="{{ route('events.create') }}" class="text-white">Opret External Link</a> /
@endsection @endsection
@section("content") @section("content")
<table class="tbl"> Link blev (ikke) oprettet.
<tr>
<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>{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 @endsection

View File

@ -6,26 +6,9 @@
@endsection @endsection
@section("path") @section("path")
<a href="" class="text-white">Vis Vaskemaskiner</a> / <a href="{{ route('events.edit', ["event" => $event]) }}" class="text-white">External link</a> /
@endsection @endsection
@section("content") @section("content")
<table class="tbl"> Din link blev (ikke) redigeret.
<tr>
<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>{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 @endsection

View File

@ -7,15 +7,11 @@
@section("content") @section("content")
<main> <main>
<h1 class="text-center sde-blue mb-0">Aktiviteter</h1> <h1 class="text-center sde-blue mb-0">Aktiviteter</h1>
@foreach($events as $event)
<h3 class="sde-blue bold text-center mb-0">{Aktivitet}</h3> <h3 class="sde-blue bold text-center mb-0">{{$event->name}}</h3>
<p class="text-center mt-0">{Dato}</p> <p class="text-center mt-0">{{$event->date}}</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p> <p>{{$event->description}}</p>
<a class="btn text-center btn-sde-blue btn-disabled" id="tilmeld">Tilmeld</a>
<h3 class="sde-blue bold text-center mb-0">{Aktivitet2}</h3>
<p class="text-center mt-0">{Dato}</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p>
<a class="btn text-center btn-sde-blue btn-disabled" id="tilmeld">Tilmeld</a> <a class="btn text-center btn-sde-blue btn-disabled" id="tilmeld">Tilmeld</a>
@endforeach
</main> </main>
@endsection @endsection

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long