v1.3.2 - Fixed table css and removed pagination in backend

This commit is contained in:
frederikpyt 2020-09-21 08:32:05 +02:00
parent 7b99cd7f4e
commit 13197b8be8
8 changed files with 60 additions and 70 deletions

View File

@ -7,9 +7,6 @@ use Illuminate\Http\Response;
class AboutController extends Controller class AboutController extends Controller
{ {
public function __construct() public function __construct()
{ {
$this->middleware(["auth"]); $this->middleware(["auth"]);

View File

@ -28,7 +28,6 @@ class ContactController extends Controller
*/ */
public function index(Request $request) public function index(Request $request)
{ {
$contact = Contact::query()->get(); $contact = Contact::query()->get();
return Response::detect("contacts.index", [ "contacts" => $contact]); return Response::detect("contacts.index", [ "contacts" => $contact]);

View File

@ -245,6 +245,7 @@ class EventController extends Controller
} }
} }
//Fixes tags that have been substringed
public function closetags($html) { public function closetags($html) {
preg_match_all('#<(?!meta|img|br|hr|input\b)\b([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result); preg_match_all('#<(?!meta|img|br|hr|input\b)\b([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);
$openedtags = $result[1]; $openedtags = $result[1];
@ -289,7 +290,6 @@ class EventController extends Controller
return 1; return 1;
} }
} }
} }

View File

@ -29,7 +29,7 @@ class FeedbackController extends Controller
*/ */
public function index(Request $request) public function index(Request $request)
{ {
$feedback = Feedbacks::query()->orderBy('created_at', 'desc')->paginate(20); $feedback = Feedbacks::query()->orderBy('created_at', 'desc')->get();
return Response::detect("feedbacks.index", [ "feedback" => $feedback ]); return Response::detect("feedbacks.index", [ "feedback" => $feedback ]);
} }

View File

@ -104,7 +104,7 @@ class ResourceController extends Controller
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @return Resource
*/ */
public static function storeMime(Request $request, ResourceCategory $category) public static function storeMime(Request $request, ResourceCategory $category)
{ {

View File

@ -6772,7 +6772,20 @@ nav > .pagination {
.tbl { .tbl {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
table-layout: fixed; }
div.dataTables_length,
div.dataTables_info {
margin-right: auto !important;
}
div.dataTables_paginate,
div.dataTables_filter {
margin-left: auto !important;
}
.col-sm-12 {
width: 100%;
} }
.tbl td, .tbl td,

View File

@ -1,7 +1,18 @@
.tbl { .tbl {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
table-layout: fixed; //table-layout: fixed;
}
div.dataTables_length, div.dataTables_info {
margin-right: auto !important;
}
div.dataTables_paginate, div.dataTables_filter {
margin-left: auto !important;
}
.col-sm-12 {
width: 100%;
} }
.tbl td, .tbl th { .tbl td, .tbl th {

View File

@ -11,73 +11,43 @@
@section("content") @section("content")
<table class="tbl" id="table_id">
<thead>
<div class="risRos">
<label for="risros">Vælg type feedback:</label>
<select name="risRosName" id="risRosValue">
<option selected="selected" name="all" value="all">Alle</option>
<option name="ris" value="Ris">Ris</option>
<option name="ros" value="Ros">Ros</option>
<option name="andet" value="Andet">Andet</option>
</select>
<!-- Dont delete me sir :(
<input class="checkbox-inline" type="checkbox" name="checkbox" id="ris" value="ris">
<label for="efternavn">Ris</label>
<input class="checkbox-inline" type="checkbox" name="checkbox" id="ros" value="ros">
<label for="efternavn">Ros</label>
-->
</div>
<table class="tbl">
<tr>
<th style="width: 6em;">Dato</th> <th style="width: 6em;">Dato</th>
<th>Feedback Besked</th> <th>Feedback Besked</th>
<th style="width: 7em;">Feedback type</th> <th style="width: 7em;">Feedback type</th>
@if(auth()->user()->can('feedback.delete')) @if(auth()->user()->can('feedback.delete'))
<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>
@endif @endif
</tr> </thead>
@foreach($feedback as $fb) <tbody>
<tr> @foreach($feedback as $fb)
<td>{{ date('d-m-Y', strtotime($fb->created_at)) }}</td> <tr>
<td>{{ $fb->message }}</td> <td>{{ date('d-m-Y', strtotime($fb->created_at)) }}</td>
<td>{{ $fb->suggestion_form }}</td> <td>{{ $fb->message }}</td>
@if(auth()->user()->can('feedback.delete')) <td>{{ $fb->suggestion_form }}</td>
<td><form method="post" action="{{ route("feedbacks.destroy", [ "feedback" => $fb ]) }}" class="w-100 nostyle"> @if(auth()->user()->can('feedback.delete'))
@csrf <td><form method="post" action="{{ route("feedbacks.destroy", [ "feedback" => $fb ]) }}" class="w-100 nostyle">
@method("delete") @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> <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> </form>
</td> </td>
@endif @endif
</tr> </tr>
@endforeach @endforeach
</tbody>
</table> </table>
@endsection
{{ $feedback->links() }} @section('scripts')
<script>
$(document).ready( function () {
<script> $('#table_id').DataTable({
$('#risRosValue').change(function () { columnDefs: [
$value = $('#risRosValue').find(":selected").val(); { orderable: false, targets: [-1] }
$.ajax({ ]
type: 'get', });
url: '{{route('feedbacks.search')}}', });
data: {'option':$value}, </script>
success:function (data) {
$('tbody').html(data);
},
error:function (data) {
console.log(data);
}
});
})
</script>
@endsection @endsection