MINI Sh3ll
@extends('layouts.main')
@section('title', 'All Users')
@section('content')
<div class="m-content">
<div class="row">
<div class="m-portlet m-portlet--mobile filter_row">
<div class="m-portlet__head">
<div class="m-portlet__head-caption">
<div class="m-portlet__head-title">
<h3 class="m-portlet__head-text">
Users
</h3>
</div>
</div>
<div class="m-portlet__head-tools">
<a href="{{ route('all-users.create') }}" class="btn btn-sm btn-accent m-btn m-btn--custom m-btn--icon m-btn--air">
<span>
<i class="la la-user"></i>
<span>
Invite User
</span>
</span>
</a>
</div>
</div>
<div class="m-portlet__body">
<!--begin: Datatable -->
<div class="m_datatable" id="local_data">
<table id="user_data" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Email ID</th>
<th>Mobile number</th>
<th>Registration status</th>
<th>Registration Date</th>
<th>Company</th>
<th>Invited By</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
</table>
</div>
<!--end: Datatable -->
</div>
</div>
</div>
</div>
@endsection
@section('script')
<script>
var base_url = window.location.origin;
var url = '{{ route('getAllUsers') }}';
loadDataTable(url);
function loadDataTable(url){
$('#user_data').DataTable({
"order": [],
"bAutoWidth": false,
"processing": false,
"serverSide": false,
"bDestroy": true,
"scrollX": true,
"aLengthMenu": [[10, 20, 50, -1], [10, 20, 50, "All"]],
"pageLength": 10,
"columnDefs": [{
"targets": 'no-sort',
"orderable": false,
}],
"ajax": url,
language: {
search: "_INPUT_",
searchPlaceholder: "Search...",
"lengthMenu": "Show _MENU_"
}
})
}
$(document).on('click', '.delete_user', function (event) {
var id = $(this).attr("data-id");
var deleteUrl = '{{ route("deleteInvitedUser") }}';
$('#deleteModal').modal('show');
$(".delete").click(function (e) {
e.preventDefault();
$.ajax({
type: "POST",
url: deleteUrl,
dataType: "json",
data: {
"id": id,
"_token": "{{ csrf_token() }}",
},
success: function (response) {
if (response.status == 1) {
$('#deleteModal').modal('hide');
location.reload(true);
toastr.success(response.success);
}
}
});
});
});
</script>
@endsection
OHA YOOOO