|
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/tcl/admintcl.edukrypt.app/resources/views/user/ |
Upload File : |
@extends('layout')
@section('content')
<?php
$adminType = App\Helpers\PermissionActivity::adminType();
?>
<!-- begin::main content -->
<main class="main-content">
<div class="container">
<!-- begin::page header -->
<div class="page-header">
<h3>User List</h3>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{asset(''.$adminType.'/dashboard')}}">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page">User List</li>
</ol>
</nav>
</div>
<!-- end::page header -->
<div class="card">
<x-flashMessage/>
<div class="card-header">
<form method="get" action="{{asset('/'.$adminType.'/user-list')}}">
<div class="row">
<div class="col-md-4">
<select class="form-control" name="sort">
<option value="" disabled selected>Select Sorting</option>
<option value="asc" <?php
if (isset($_GET['sort'])) {
if ($_GET['sort'] == 'asc') {
echo "selected";
}
}
?>>Asceding</option>
<option value="desc" <?php
if (isset($_GET['sort'])) {
if ($_GET['sort'] == 'desc') {
echo "selected";
}
}
?>>Descending</option>
</select>
</div>
<div class="col-md-4">
<select class="form-control" style="margin-top: 2px;" name="entry">
<option value="" disabled selected>All</option>
<!-- <option value="25" >25</option> -->
<option value="50" <?php
if (isset($_GET['entry'])) {
if ($_GET['entry'] == '50') {
echo "selected";
}
}
?>>50</option>
<option value="100" <?php
if (isset($_GET['entry'])) {
if ($_GET['entry'] == '100') {
echo "selected";
}
}
?>>100</option>
<option value="1000" <?php
if (isset($_GET['entry'])) {
if ($_GET['entry'] == '1000') {
echo "selected";
}
}
?>>1000</option>
<option value="5000" <?php
if (isset($_GET['entry'])) {
if ($_GET['entry'] == '5000') {
echo "selected";
}
}
?>>5000</option>
<option value="10000" <?php
if (isset($_GET['entry'])) {
if ($_GET['entry'] == '10000') {
echo "selected";
}
}
?>>10000</option>
</select>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<label>Start Date</label>
<input type="date" class="form-control"
value="{{(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="{{(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="{{(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-2">
<button type="submit" class="btn btn-primary" style="margin-top: 2px;">Filter</button>
</div>
<div class="col-md-2">
<a href="{{asset(''.$adminType.'/user-list')}}" class="btn btn-primary" style="margin-left: -76px;">Reset Filter</a>
</div>
</div>
</form>
</div>
<?php
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url = explode('?', $actual_link);
$queryUrl = '';
if (isset($url[1])) {
$queryUrl = '?' . $url[1];
}
?>
<div class="col-md-6 pull-right" style="margin-top: 25px;">
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('add-user')){ ?>
<a href="{{asset(''.$adminType.'/add-student-user')}}" class="form-group btn btn-primary"><i class="fa fa-plus"></i> Add User</a>
<?php } ?>
<a href="{{asset(''.$adminType.'/export-user-csv'.$queryUrl)}}" class="form-group btn btn-primary"><i class="fa-solid fa-file-export"></i> Export User</a>
</div>
<div class="card-body">
@if(isset($users))
<table id="example1" class="table table-striped table-bordered">
<thead>
<tr>
<th>Id</th>
<th>Role</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
{{-- <th>User Unique Id</th> --}}
{{-- <th>Dob</th> --}}
{{-- <th>Enable/Disable</th> --}}
<th>Status</th>
<th>Created On</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@if(!empty($users))
@php $i=1; @endphp
@foreach($users as $user)
<tr>
<td>@php echo $i;$i++; @endphp</td>
<td>
@if (!empty($user->role))
@foreach (explode(',', $user->role) as $r)
<span class="btn btn-sm btn-gradient-info">
{{ $r }}
</span>
@endforeach
@endif
</td>
<td>{{$user->name}}</td>
<td>{{$user->email}}</td>
<td>{{$user->phone}}</td>
{{-- <td>{{$user->logUsername}}</td> --}}
{{-- <td>{{date("d-m-Y",strtotime($user->dob))}}</td> --}}
{{-- <td><?php
$check_status = ($user->status == "1") ? 'checked' : '';
echo '<div class="custom-control custom-switch custom-checkbox-success">
<label class="switch">
<input type="checkbox" name="admin_active" '.$check_status.' data-id="'.$user->id.'" value="1" class="custom-control-input status-change" id="customSwitch2_">
<span class="slider round"></span>
</label>
</div>';
?></td> --}}
<td>
@if($user->status == 1)
<label for="" class="text-success">Active</label>
@endif
@if($user->status == 0)
<label for="" class="text-danger">Inactive</label>
@endif
</td>
<td>{{date("d-m-Y",strtotime($user->created_at))}}</td>
<td>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('view-user')){ ?>
<div class="tooltip">
<a href="{{asset(''.$adminType.'/show-activity-result/'.$user->id)}}"><i class="fa fa-list-alt fa-lg text-primary"></i><span class="tooltiptext">Activity Result List</span></a>
</div>
<?php } ?>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('change-user-password')){ ?>
<div class="tooltip">
<a href="{{asset(''.$adminType.'/reset-user-password/'.$user->id)}}"><i class="fa fa-undo fa-lg text-primary"></i><span class="tooltiptext">Reset Password</span></a>
</div>
<?php } ?>
{{-- <a href="{{asset('admin/user-device-list/'.$user->id)}}"><i class="fa fa-android text-inverse"></i></a> --}}
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('view-user')){ ?>
<div class="tooltip">
<a href="{{asset(''.$adminType.'/view-user/'.$user->id)}}"><i class="fa fa-eye fa-lg text-primary"></i><span class="tooltiptext">View User</span></a>
</div>
<?php } ?>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('edit-user')){ ?>
<div class="tooltip">
<a href="{{asset(''.$adminType.'/edit-user/'.$user->id)}}"><i class="fa fa-edit fa-lg text-success"></i><span class="tooltiptext">Edit User</span></a>
</div>
<?php } ?>
<?php if(Auth::user()->hasRole('superadmin') || Auth::user()->can('delete-user')){ ?>
<div class="tooltip">
<a href="{{asset(''.$adminType.'/delete-user/'.$user->id)}}" class="delete-confirm" ><i class="fa fa-trash fa-lg text-danger"></i><span class="tooltiptext">Delete</span></a>
<?php } ?>
</div>
</td>
</tr>
@endforeach
@else
<h1>No Record Found!!</h1>
@endif
</tbody>
</table>
<div class="pagination-block">
{{ $users->appends(request()->query())->links('includes.paginationlinks') }}
<label>Showing total <?php echo $users->total(); ?> results</label>
</div>
@endif
</div>
</div>
</div>
</main>
<!-- end::main content -->
@endsection
@push('footer-script')
<!-- begin::dataTable -->
<script>
$('.status-change').on('change', function (e) {
e.preventDefault();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var id = $(this).data('id');
var ckb = $(this).is(':checked');
$.ajax({
type:"post",
data:{
"id":id,
"ckb":ckb
},
url:"{{ asset(''.$adminType.'/user-change-status/') }}",
success:function(result)
{
// console.log(result);
if (ckb && data) {
toastr.success('Successfully Activated!');
}
else if (ckb == false && data) {
toastr.warning('Successfully Deactivated!');
}
else {
toastr.warning('Please Try Again!');
}
}
});
});
$(document).ready(function () {
var start = moment().subtract(29, 'days');
var end = moment();
function cb(start, end) {
$('.reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
}
$('.reportrange').daterangepicker({
startDate: start,
endDate: end,
// ranges: {
// 'Today': [moment(), moment()],
// 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
// 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
// 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
// 'This Month': [moment().startOf('month'), moment().endOf('month')],
// 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
// }
}, cb);
cb(start, end);
});
$(document).on('click','.applyBtn',function(){
var a = $('.drp-selected').html();
window.location.href = "<?php asset(''.$adminType.'/user-list') ?>"+"?date="+a;
})
</script>
<!-- end::dataTable -->
@endpush