v1.5.15a - Changes by Anders
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<td>{{ $event->week}}</td>
|
||||
<td><a id="preview" onclick="modalEventContent({{$event->id}})" style="cursor: pointer"><img class="w-100" src="{{ asset('/images/icons/preview-dark.svg') }}" alt="preview"></a></td>
|
||||
@if(auth()->user()->can('event.edit'))
|
||||
<td><a href="{{ route("events.edit", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
|
||||
<td><a href="#"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
|
||||
@endif
|
||||
@if(auth()->user()->can('event.delete'))
|
||||
<td>
|
||||
@@ -38,8 +38,109 @@
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="eventModal" class="modal zindex-100">
|
||||
<div id="modal-content" class="modal-content text-black d-block w-50">
|
||||
<span class="close" onclick="closeModal()">×</span>
|
||||
<center>
|
||||
<h1 id="week"></h1>
|
||||
<hr>
|
||||
<strong><label>Aktiviteter</label></strong>
|
||||
<hr>
|
||||
<img id="eventimg">
|
||||
<p id="description"></p>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('scripts')
|
||||
<script>
|
||||
var modalEvent = document.getElementById("eventModal");
|
||||
|
||||
function modalEventContent(id) {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('multiple-events.preview')}}',
|
||||
data: {'preview':id},
|
||||
dataType: 'JSON',
|
||||
success:function (data) {
|
||||
modalEvent.style.display = "flex";
|
||||
$("#week").html(data[0].week);
|
||||
if (data[0].resource_id != null)
|
||||
$("#eventimg").attr('src', data[0].filename);
|
||||
/*var l = JSON.parse(data);
|
||||
$("#name").html(l.name);
|
||||
$("#date").html(l.date);
|
||||
$("#accountable").html(l.accountable);
|
||||
$("#description").html(l.description);
|
||||
|
||||
if (l.filename)
|
||||
$("#eventimg").attr('src', l.filename);*/
|
||||
},
|
||||
error:function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
modalEvent.style.display = "none";
|
||||
|
||||
$("#name").html('');
|
||||
$("#date").html('');
|
||||
$("#accountable").html('');
|
||||
$("#description").html('');
|
||||
$("#eventimg").attr('src', '');
|
||||
}
|
||||
|
||||
window.onmousedown = function(event) {
|
||||
if (event.target == modalEvent) {
|
||||
modalEvent.style.display = "none";
|
||||
|
||||
$("#name").html('');
|
||||
$("#date").html('');
|
||||
$("#accountable").html('');
|
||||
$("#description").html('');
|
||||
$("#eventimg").attr('src', '');
|
||||
}
|
||||
}
|
||||
|
||||
function delete_event(id) {
|
||||
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: 'Slet Aktiviteten',
|
||||
cancelButtonText: 'Annuller'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "multiple-events/"+id,
|
||||
data:{'_token':token, _method: 'DELETE'},
|
||||
success: function () {
|
||||
$('#table_id').DataTable().row($('#row_'+id)[0]).remove().draw();
|
||||
|
||||
Swal.fire(
|
||||
'Aktiviteten er slettet!',
|
||||
'',
|
||||
'success'
|
||||
)
|
||||
},
|
||||
error:function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user