v1.5.20 - Removed event_end & Updated Migration

Updated Delete of multiple event
Started on deletion of single event & multiple-event edit
Removed userevent $key variable
Updated multipdf
Fixed web.php
This commit is contained in:
Anders
2021-05-04 12:32:24 +02:00
parent c617012187
commit 6cc43257b7
11 changed files with 138 additions and 92 deletions
@@ -6,45 +6,80 @@
@endsection
@section("path")
<a href="{{ route("multiple-events.index") }}" class="text-white">Vis Events</a> / <a href="" class="text-white">Vis Tilmeldte - {{ $multiEvent[0]->name }}</a> /
<a href="{{ route("events.index") }}" class="text-white">Vis Events</a> / <a href="" class="text-white">Vis Tilmeldte</a> /
@endsection
@section("content")
<table class="tbl mt-1" id="table_id">
<thead>
@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($multiEvent as $event)
@if ($event->name_first != null && $event->name_last != null && $event->phone != null && $event->multiple_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("multiple-events.destroy", [ "multiEvent" => $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
</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>
</tbody>
</table>
@endforeach
@endsection
@section('scripts')
<script>
$(document).ready( function () {
$('#table_id').DataTable({
columnDefs: [
{ orderable: false, targets: [-1] }
]
@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