Ekapp/skolehjem/resources/views/admin/events/signups.blade.php

66 lines
2.4 KiB
PHP

@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Events - Tilmeldte
@endsection
@section("path")
<a href="{{ route("events.index") }}" class="text-white">Vis Events</a> / <a href="" class="text-white">Vis Tilmeldte - {{ $events[0]->name }}</a> /
@endsection
@section("content")
<div class="row align-items-center">
<form method="post" action="{{ route("events.store") }}">
@csrf
<input type="text" class="form-controller" id="search" name="search" placeholder="Søg på Evt Navn, Evt Dato"></input>
</form>
</div>
<table class="tbl mt-2">
<tr>
<th>Tilmeldtes Fornavn</th>
<th>Tilmeldtes Efternavn</th>
<th>Tilmeldtes Tlf Nr</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr>
@foreach($events as $event)
@if ($event->name_first != null && $event->name_last != null && $event->phone != null && $event->event_id != null && $event->user_id != null)
<tr>
<td>{{ $event->name_first }}</td>
<td>{{ $event->name_last }}</td>
<td>{{ $event->phone }}</td>
<td><form method="post" action="{{ route("events.destroy", [ "event" => $event->event_id ]) }}" class="w-100 nostyle">
@csrf
@method("delete")
<button name="signup" value="{{ $event->user_id }}" class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form>
</td>
</tr>
@endif
@endforeach
</table>
<script>
$('#search').on('keyup', function () {
$value = $(this).val();
$.ajax({
type: 'get',
url: '{{route('events.search')}}',
data: {'search':$value},
success:function (data) {
$('tbody').html(data);
console.log(data);
},
error:function (data) {
console.log(data);
}
});
})
</script>
@endsection