v1.2.1 - Fixed Category for guides

This commit is contained in:
Anders
2020-09-14 08:57:31 +02:00
parent cab8ad604c
commit 580c38e940
3 changed files with 40 additions and 27 deletions
@@ -6,17 +6,17 @@
@endsection
@section("path")
<a href="{{route('guides-category.edit', ['guidesCategory' => $guideCategory ])}}" class="text-white">Rediger kategori</a> /
<a href="{{route('guides-category.edit', $guideCategory )}}" class="text-white">Rediger kategori</a> /
@endsection
@section("content")
<h1>Rediger vejlednings kategori</h1>
<form method="post" action="{{ route("guides-category.update", ['guidesCategory' => $guideCategory ]) }}">
<form method="post" action="{{ route("guides-category.update", $guideCategory) }}">
@csrf
@method("put")
<label for="name">Kategori navn:</label>
<label hidden id="error" for="errormesseages">kategorien findes allerede</label>
<input type="text" name="name" id="name" value="{{ $guideCategory->name }}" required>
<label hidden id="error" for="errormesseages">Kategorien findes allerede</label>
<input type="text" name="guidesCategoryName" id="guidesCategoryName" value="{{ $guideCategory->guidesCategoryName }}" required>
<input type="submit" id="disable" class="btn btn-dark text-white" value="Rediger">
</form>
@endsection
@@ -33,7 +33,7 @@
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
$(document).ready(function () {
$value = $('#name').val();
$value = $('#guidesCategoryName').val();
$.ajax({
type: 'get',
url: '{{route('guides-category.nameCheckUpdate')}}',
@@ -57,7 +57,7 @@
});
});
$('#name').on('keyup', function () {
$('#guidesCategoryName').on('keyup', function () {
$value = $(this).val();
$.ajax({
type: 'get',
@@ -65,6 +65,18 @@
@foreach(\App\GuidesCategory::query()->get() as $guideCategory)
<tr>
<td>{{$guideCategory->guidesCategoryName}}</td>
@if(auth()->user()->can('guides.edit'))
<td><a href="{{ route("guides-category.edit", $guideCategory) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update2"></a></td>
@endif
@if(auth()->user()->can('guides.delete'))
<td><form method="post" action="{{ route("guides-category.destroy", $guideCategory) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button onclick="return confirm('Are you sure you want to delete? You will also delete all guides with this category!');" class="w-100 nostyle" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
@endif
</tr>
@endforeach
</table>