|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/sld.edukrypt.app/storage/framework/views/ |
Upload File : |
<?php $__env->startSection('content'); ?>
<!-- begin::main content -->
<main class="main-content">
<div class="container">
<!-- begin::page header -->
<div class="page-header">
<h3>Users</h3>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page">Users List</li>
</ol>
</nav>
</div>
<?php
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url = explode('?', $actual_link);
$queryUrl = '';
if (isset($url[1])) {
$queryUrl = '?' . $url[1];
}
?>
<!-- end::page header -->
<div class="card">
<?php if (isset($component)) { $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\FlashMessage::class, []); ?>
<?php $component->withName('flashMessage'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74)): ?>
<?php $component = $__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74; ?>
<?php unset($__componentOriginal8a5ba9c90b64d384232e9948b1023e746ba08e74); ?>
<?php endif; ?>
<div class="card-header">
<form method="get" action="<?php echo e(asset('/admin/users')); ?>">
<br>
<div class="row">
<div class="col-md-6">
<label>Start Date</label>
<input type="date" class="form-control"
value="<?php echo e(isset($_GET['from_date']) && !empty($_GET['from_date']) ? $_GET['from_date'] : ''); ?>"
name="from_date">
</div>
<div class="col-md-6">
<label>End Date</label>
<input type="date" class="form-control"
value="<?php echo e(isset($_GET['to_date']) && !empty($_GET['to_date']) ? $_GET['to_date'] : ''); ?>"
name="to_date">
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<input type="text" name="search"
value="<?php echo e(isset($_GET['search']) && !empty($_GET['search']) ? $_GET['search'] : ''); ?>"
class="form-control" style="margin-top: 2px;" placeholder="Search by Name,Email,Phone">
</div>
<div class="col-md-6">
<button type="submit" class="btn btn-primary pull-left mr-2">Filter</button>
<a href="<?php echo e(asset('/admin/users')); ?>" class="btn btn-primary text-white pull-left mr-2">
Reset Filter</a>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('add-user')){ ?>
<a href="<?php echo e(asset('admin/add-user')); ?>"
class="btn btn-success pull-right text-white mr-2">Add User</a>
<?php } ?>
<a class="btn btn-warning text-white pull-right mr-2"
href="<?php echo e(asset('admin/export' . $queryUrl)); ?>">Export
User</a>
</div>
</div>
</form>
</div>
<div class="card-header">
<div class="error_msg"></div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<select class="form-control" name="category" id="category">
<option value="">--select-category--</option>
<?php if(!empty($categories)): ?>
<?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($category->id); ?>"><?php echo e($category->name_en); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<select multiple class="form-control" name="policy[]" id="policy">
<option value="" selected disabled>--select-policy--</option>
</select>
</div>
</div>
<div class="col-md-3"></div>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('reset-mcq')){ ?>
<div class="col-md-3">
<button class="btn btn-primary text-white pull-right bulk_reset" type="button">Bulk Progress
Reset</button>
</div>
<?php } ?>
</div>
</div>
<div class="card-body">
<table id="adminuserstb" class="table table-striped table-bordered">
<thead>
<tr>
<th>
<input type="checkbox" class="all_check_user_id" name="all_check_user_id">
</th>
<th>#</th>
<th>Role</th>
<th>Username</th>
<th>Email</th>
<th>Phone</th>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('edit-user')){ ?>
<th>Status</th>
<?php } ?>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php if(!empty($admin_users)): ?>
<?php $__currentLoopData = $admin_users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $admin_user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td>
<input type="checkbox" value="<?php echo e($admin_user->id); ?>" class="check_user_id"
name="check_user_id[]">
</td>
<td><?php echo e($key + 1); ?></td>
<td>
<?php if(!empty($admin_user->role)): ?>
<?php $__currentLoopData = explode(',', $admin_user->role); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<span class="btn btn-sm btn-gradient-info">
<?php echo e($r); ?>
</span>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</td>
<td><?php echo e($admin_user->name); ?></td>
<td><?php echo e($admin_user->email); ?></td>
<td><?php echo e($admin_user->phone); ?></td>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('edit-user')){ ?>
<td>
<?php
$check_status = $admin_user->status == '1' ? '' : '';
if ($admin_user->status == '1') {
?>
<div class="custom-control custom-switch custom-checkbox-success">
<label class="switch"><input type="checkbox" name="admin_active" checked
data-id="<?php echo e($admin_user->id); ?>" value="1"
class="custom-control-input status-change" id="customSwitch2_">
<span class="slider round"></span>
</label>
</div>
<?php
} else {
?>
<div class="custom-control custom-switch custom-checkbox-success">
<label class="switch"><input type="checkbox" name="admin_active"
data-id="<?php echo e($admin_user->id); ?>" value="0"
class="custom-control-input status-change" id="customSwitch2_">
<span class="slider round"></span>
</label>
</div>
<?php
}
?>
</td>
<?php } ?>
<td>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('edit-user')){ ?>
<a title="user-mcq-list"
href="<?php echo e(asset('admin/user-mcq-list/' . $admin_user->id)); ?>"><i
class="fa fa-bar-chart fa-lg text-inverse"></i></a>
<?php }?>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('reset-mcq')){ ?>
<a title="Reset Mcq" class="delete-confirm"
href="<?php echo e(asset('admin/reset-user-mcq/' . $admin_user->id)); ?>"><i
class="fa fa-refresh fa-lg text-danger"></i></a>
<?php } ?>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('change-user-password')){ ?>
<a title="Change Password"
href="<?php echo e(asset('admin/reset-user-password/' . $admin_user->id)); ?>"><i
class="fa fa-undo fa-lg text-warning"></i></a>
<?php }?>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('view-user')){ ?>
<a title="View List"
href="<?php echo e(asset('admin/view-user/' . $admin_user->id)); ?>"><i
class="fa fa-eye fa-lg text-primary"></i></a>
<?php }?>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('edit-user')){ ?>
<a title="Edit User"
href="<?php echo e(asset('admin/edit-user/' . $admin_user->id)); ?>"><i
class="fa fa-edit text-success fa-lg "></i></a>
<?php }?>
<?php
if($admin_user->id != 2){
if(Auth::user()->hasRole('superadmin') || Auth::user()->can('delete-user')) {
// print_r($admin_user->id);
?>
<a title="Delete User"
href="<?php echo e(asset('admin/delete-user/' . $admin_user->id)); ?>"
class="delete-confirm">
<i class="fa fa-trash text-danger fa-lg"></i>
</a>
<?php }}?>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
</tbody>
</table>
<div class="pagination-block">
<?php echo e($admin_users->appends(request()->query())->links('includes.paginationlinks')); ?>
<label>Showing total <?php echo $admin_users->total(); ?> results</label>
</div>
</div>
</div>
</div>
</main>
<!-- end::main content -->
<?php $__env->stopSection(); ?>
<?php $__env->startPush('footer-script'); ?>
<!-- begin::dataTable -->
<script src="<?php echo e(asset('public/admin/vendors/dataTable/jquery.dataTables.min.js')); ?>"></script>
<script src="<?php echo e(asset('public/admin/vendors/dataTable/dataTables.bootstrap4.min.js')); ?>"></script>
<script src="<?php echo e(asset('public/admin/vendors/dataTable/dataTables.responsive.min.js')); ?>"></script>
<script src="<?php echo e(asset('public/admin/js/examples/datatable.js')); ?>"></script>
<script>
$(document).ready(function() {
$('.all_check_user_id').change(function(event) {
if (this.checked) {
// Iterate each checkbox
$(':checkbox').each(function() {
$('.check_user_id').prop('checked', true);
});
} else {
$(':checkbox').each(function() {
$('.check_user_id').prop('checked', false);
});
}
});
$('#category').select2({
tags: false
});
$('#policy').select2({
tags: false
});
// Get Section
$("#category").on('change', function() {
var URL = "<?php echo e(asset('admin/get-policy/')); ?>" + "/" + $(this).val();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: "GET",
url: URL,
dataType: "JSON",
beforeSend: function() {
$("#policy").empty();
$("#prefix").empty();
},
success: function(data) {
$.map(data, function(item) {
$("#policy").append("<option value='" + item.id + "'>" +
item.text +
"</option>");
});
},
complete: function() {
$("#policy").trigger('change');
}
});
});
$(".bulk_reset").click(function() {
var URL = "<?php echo e(asset('admin/bulk-reset-user-history')); ?>";
// user_ids
var student_ids = [];
$('.check_user_id:checkbox:checked').each(function() {
student_ids.push($(this).val());
});
// policy ids
var policy = $('#policy').val();
swal({
title: 'Are you sure?',
text: 'Once reset history, you will not be recover!',
icon: 'warning',
dangerMode: true,
buttons: ["Cancel", "Yes!"],
}).then(function(value) {
if (value) {
$('.error_msg').empty();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: "post",
data: {
"student_ids": student_ids,
"policy_ids": policy
},
url: URL,
dataType: "json",
success: function(result) {
console.log(result);
swal("success!", "Successfully deleted!", "success");
window.location.reload();
},
error: function(reject) {
$('.error_msg').empty();
if (reject.status === 422) {
var errors = $.parseJSON(reject.responseText);
$.each(errors, function(key, val) {
$('<div class="alert alert-danger">' +
val + '</div>')
.insertAfter(".error_msg");
});
}
}
});
}
});
});
$('#adminuserstb').DataTable({
responsive: false,
"lengthMenu": [
[25, 50, 75, 100, -1],
[25, 50, 75, 100, "All"]
],
'ordering': false,
'columnDefs': [{
"targets": [1, 3, 4, 5, 6, 7],
"orderable": false
}]
});
});
/* superadmin user status change */
$('.status-change').on('change', function(e) {
e.preventDefault();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
let id = $(this).data('id');
let ckb = $(this).is(':checked');
// alert(ckb);
$.ajax({
url: "<?php echo e(asset('admin/change-status')); ?>",
type: "POST",
dataType: "html",
data: {
id: id,
ckb: ckb
},
success: function(result) {
if (result == '1') {
toastr.success('User Activated!');
} else {
toastr.warning('User Deactivated!');
}
}
});
});
</script>
<!-- end::dataTable -->
<?php $__env->stopPush(); ?>
<?php echo $__env->make('admin.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/sld.edukrypt.app/resources/views/admin/users/list.blade.php ENDPATH**/ ?>