86 lines
3.3 KiB
PHP
86 lines
3.3 KiB
PHP
@extends("admin.layout.base")
|
|
@extends("admin.layout.header")
|
|
|
|
@section("title")
|
|
ugentlige aktiviteter - Tilmeldte
|
|
@endsection
|
|
|
|
@section("path")
|
|
<a href="{{ route("events.index") }}" class="text-white">Vis Events</a> / <a href="" class="text-white">Vis Tilmeldte</a> /
|
|
@endsection
|
|
|
|
@section("content")
|
|
@foreach($multiEvent as $event)
|
|
<h1 class="text-center">{{ $event->name }}</h1>
|
|
<table class="tbl mt-1" id="table_id{{ $event->id }}">
|
|
<thead>
|
|
<th>Tilmeldtes Fornavn</th>
|
|
<th>Tilmeldtes Efternavn</th>
|
|
<th>Tilmeldtes Tlf Nr</th>
|
|
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (\App\UserEvent::join('users', 'users.id', '=', 'user_events.user_id')->where('multiple_event_id', '=', $event->id)->select('user_events.*', 'users.name_first', 'users.name_last', 'users.phone')->get() as $ue)
|
|
<tr id="row_{{ $ue->id }}">
|
|
<td>{{ $ue->name_first }}</td>
|
|
<td>{{ $ue->name_last }}</td>
|
|
<td>{{ $ue->phone }}</td>
|
|
<td>
|
|
@csrf
|
|
<a class="w-100 nostyle" onclick="delete_userevent({{ $ue->id }}, {{ $event->id }})"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
@endforeach
|
|
@endsection
|
|
@section('scripts')
|
|
<script>
|
|
@foreach($multiEvent as $event)
|
|
$(document).ready( function () {
|
|
$('#table_id'+{{ $event->id }}).DataTable({
|
|
columnDefs: [
|
|
{ orderable: false, targets: [-1] }
|
|
]
|
|
});
|
|
});
|
|
@endforeach
|
|
|
|
function delete_userevent(id, tableid) {
|
|
var token = $("input[name='_token']").val();
|
|
|
|
Swal.fire({
|
|
title: 'Er du sikker?',
|
|
text: "Dette kan ikke blive ændret tilbage!",
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
confirmButtonText: 'Fjern brugeren fra aktiviteten',
|
|
cancelButtonText: 'Annuller'
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "/multiple-events/"+id,
|
|
data:{'_token':token, _method: 'DELETE', 'signup': true},
|
|
success: function () {
|
|
$('#table_id'+tableid).DataTable().row($('#row_'+id)[0]).remove().draw();
|
|
|
|
Swal.fire(
|
|
'Brugeren er hermed fjernet fra aktiviteten!',
|
|
'',
|
|
'success'
|
|
)
|
|
},
|
|
error:function (data) {
|
|
console.log(data);
|
|
}
|
|
});
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
@endsection
|