mein-sterntours/resources/views/admin/users.blade.php
Kevin Adametz 881fc84207 08 2024
2024-08-05 11:58:09 +02:00

125 lines
No EOL
4.4 KiB
PHP

@extends('layouts.layout-2')
@section('content')
<h4 class="font-weight-bold py-3 mb-4">
{{ __('User') }}
</h4>
<div class="card">
<div class="table-responsive-track" id="datatables-users-scroll">
<div class="table-responsive-thumb" id="datatables-users-thumb">
</div>
</div>
<div class="card-datatable table-responsive py-2" id="datatables-users-table">
<div class="mr-4 mb-2 text-right">
<a href="{{ route('admin_user_edit', ['new']) }}" class="btn btn-sm btn-primary">Neuen User anlegen</a>
</div>
<table class="datatables-users table table-striped table-bordered" id="datatables-users">
<thead>
<tr>
<th>#</th>
<th>{{__('Name')}}</th>
<th>{{__('E-Mail')}}</th>
<th>{{__('Zugang')}}</th>
<th>{{__('Google2FA')}}</th>
<th>{{__('active')}}</th>
<th>{{__('delete')}}</th>
</tr>
</thead>
</table>
<div class="mr-4 mt-2 text-right">
<a href="{{ route('admin_user_edit', ['new']) }}" class="btn btn-sm btn-primary">Neuen User anlegen</a>
</div>
</div>
</div>
<div id="updateModalShow" class="modal fade in" tabindex="-1" role="dialog" aria-labelledby="myModalUpdate" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" id="update-modal-content">
</div>
</div>
</div>
<script>
function update_modal_data_show(e, $ele) {
e.preventDefault();
var ele = $ele,
url = ele.data('url'),
data = {id:ele.data('data'), action:ele.data('action')};
console.log(data);
console.log(url);
$.ajax({
url: url,
data: data,
type: "POST",
dataType: "html",
cache: false,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
encode: true,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(data) {
// do what ever you want here. add content to <div> if it was not 1 .
//console.log(data);
$('#update-modal-content').html(data);
$('.selectpicker').selectpicker(["refresh"]);
$('.input-daterange').datepicker({toggleActive: true,format: 'dd.mm.yyyy'});
// $.Nestable.init();
$('#updateModalShow').modal('show');
},
error: function(xhr, status, errorThrown) {
console.log(xhr);
console.log(xhr.responseText);
console.log(status);
console.log("Sorry, there was a problem!");
}
});
return false;
}
$( document ).ready(function() {
$('.datatables-users').dataTable({
"processing": true,
"serverSide": true,
"ajax": '{!! route('admin_users_data_table') !!}',
"columns": [
{ data: 'action_edit', orderable: false, searchable: false},
{ data: 'name', name: 'name' },
{ data: 'email', name: 'email' },
{ data: 'admin', name: 'admin' },
{ data: 'google2fa', name: 'google2fa' },
{ data: 'active', name: 'active' },
{ data: 'action_delete', orderable: false, searchable: false},
],
"bLengthChange": false,
"iDisplayLength": 50,
"language": {
"url": "/js/German.json"
},
"initComplete": function(settings, json) {
$(".update_modal_data_show").on('click', function (e) {
e.preventDefault();
update_modal_data_show(e, $(this));
});
},
drawCallback: function () {
dataTableScrollTrack('#datatables-users');
}
});
});
</script>
@endsection