
@extends('Admin.master_page')

@section('title') <h5 class="m-0 font-weight-bold text-primary" style="float: left;">User List</h5> 

@endsection

@section('content')


 

 <div class="overflow-x-auto"> 

<br>
 	<div>
 	    
 	    <div class="col-lg-12 row">
 	        
 	        	<form method="get" class="col-lg-6">
 			<div class="" >
                <input type="text" name="search" class="form-control" placeholder="Search..."> 
            </div>
 		</form>
 		<br>
 		<form method="get" class="col-lg-6">
 			<div class="">
                <input type="text" name="pin" class="form-control" placeholder="Enter Support PIN..."> 
            </div>
 		</form>
 	        
 	    </div>
 	
 		
 			<div style="padding:10px;">
 	    
 	    <div class="total_suspend table-responsive">
 	        <table class="table">
 	            
 	            <tr>
 	                <th><a href="/admin/Users">Total User</a></th><td>{{ $total_user }}</td><th><a href="?search=suspended">Total Suspended</a></th><td>{{ $total_suspend }}</td><th><a href="?search=activeFA">Total Active 2FA</a></th><td>{{ $total_google }}</td>
 	            </tr>
 	            
 	        </table>

 	    </div>
 	</div>
 	
 
 	    
 	    
 	</div>

 	<br>
 	<br>
 	<br>
 <div class="table-responsive">
 		<table class="table">
 	 <thead>
 	  <tr>
 	   <th class="">#</th>
 	    <th class="">Support PIN</th>
 	    <th class="">First Name</th>
 	     <th class="">Last Name</th>
 	      <th class="">Email</th>
 	      <th class="">Phone Number</th>
 	      <th class="">Google 2FA</th>
 	      <th class="">Services</th>
 	      <th class="">Suspended</th>
 	      <th class="">Change</th>
 	      <th class="">Delete</th>
 	       </tr>
 	        </thead> 
 	        <tbody>
 	        @foreach($users as $user)		
 	         <tr>
 	          <td class="">{{ $user->id }}</td>
 	          <td class="">{{ $user->support_pin }}</td>
 	           <td class="">{{ $user->name }}</td>
 	            <td class="">{{ $user->lastname }}</td>
 	             <td class="">{{ $user->email }}</td> 
 	             <td class="">{{ $user->phone_number }}</td>
 	             <td class="">
 	                 @if($user->googlef2_status == 1)
 	                  <a href="{{route('manage-users.disable.google2fa', $user->id)}}"><i class="fas fa-check"></i></a>
 	                 @else
 	                 <i class="fas fa-times"></i>
 	                 @endif
 	             </td>
 	             
 	             <td >
                    <a href="{{route('manage-users.change.sms.status', $user->id)}}" class="btn btn-sm btn-danger">
                        {{ $user->sms_status != 1 ? 'SMS':'Suspend SMS' }}
                    </a>
 	             </td>
 	             <td class="">
                    <a href="{{route('manage-users.suspend',$user->id)}}" class="btn btn-sm btn-success">
                        {{ $user->suspend == 1 ? 'Suspend' : 'Suspended' }}
                    </a>             	
 	             </td> 


 	             <td class="">
                    <a  href="{{ route('manage-users.change.password.view', $user->id) }}" style="text-align:center !important;">
                        <i class="fas fa-user-edit"></i>
                    </a>
 	             </td> 
 	             
 	              <td class="">
			<a  href="{{ route('manage-users.delete', $user->id) }}" style="text-align:center !important;">
			    <i class="fas fa-trash-alt"></i>
			</a>
 	             </td>
 	             
 	             
 	         </tr>
 	         @endforeach


 	                 </tbody> 
 	             </table> 

 	             	@if(isset($_GET['search'])) 
		<br>
		<br>
		<div class="container">
			<div class="row justify-content-center">
			{{ $users->appends([
				'search'=>$_GET['search']
				])->links() }}
		</div>
		</div> 

		<br>
		<br>
		<br>

		@else
		<br>
		<br>
		<div class="container">
			<div class="row justify-content-center">
			{{ $users->links() }}
		</div>
		</div>

		<br>
		<br>
		<br>
		@endif
 </div>

 	             

 	         </div> 



	@endsection