@extends('layouts.admin')

@section('content')
<!-- content @s -->
                <div class="nk-content nk-content-fluid">
                    <div class="container-xl wide-lg">
                        <div class="nk-content-body">
                            <div class="nk-block-head nk-block-head-sm">
                                <div class="nk-block-between">
                                    <div class="nk-block-head-content">
                                        <h3 class="nk-block-title page-title">Users Lists</h3>
                                        <div class="nk-block-des text-soft">
                                            <p>You have total {{$totalUsers}} users.</p>
                                        </div>
                                    </div><!-- .nk-block-head-content -->
                                    
                                </div><!-- .nk-block-between -->
                            </div><!-- .nk-block-head -->
                            <div class="nk-block">
                                <div class="card card-bordered card-stretch">
                                    <div class="card-inner-group">
                                         
                                        <div class="card-inner p-0">
                                            <div class="nk-tb-list nk-tb-ulist">
                                                <div class="nk-tb-item nk-tb-head">
                                                    <div class="nk-tb-col nk-tb-col-check">
                                                       ID
                                                    </div>
                                                    <div class="nk-tb-col"><span class="sub-text">User/Email</span></div>
                                                     
                                                    <div class="nk-tb-col tb-col-md"><span class="sub-text">Phone</span></div>
                                                    <div class="nk-tb-col tb-col-lg"><span class="sub-text">Verified</span></div>
                                                    <div class="nk-tb-col tb-col-lg"><span class="sub-text">Join Date</span></div>
                                                     
                                                    <div class="nk-tb-col tb-col-md"><span class="sub-text">Status</span></div>
                                                    <div class="nk-tb-col nk-tb-col-tools text-end">
                                                        Action
                                                    </div>
                                                </div><!-- .nk-tb-item -->
                                                
                                                
                                                
                                                 @foreach($users as $user)
                                                <div class="nk-tb-item">
                                                    <div class="nk-tb-col nk-tb-col-check">
                                                        {{ $user->id }}
                                                    </div>
                                                    <div class="nk-tb-col">
                                                        @if ($user->is_admin == '1')                   <a href="#">
                                                            <div class="user-card">
                                                                <div class="user-avatar bg-primary">
                                                                     @if ($user->profile_pic)
        <img src="{{ asset('storage/app/public/' . $user->profile_pic) }}" alt="{{ $user->name }}" style="height: 45px;width: 45px;">
    @else
        <img src="{{ asset('storage/user_default.png') }}" alt="{{ $user->name }}" style="height: 45px;width: 45px;">
    @endif
                                                                </div>
                                                                <div class="user-info">
                                                                    <span class="tb-lead">{{ $user->name }} <span class="dot dot-success d-md-none ms-1"></span></span>
                                                                    <span>{{ $user->email }}</span>
                                                                </div>
                                                            </div>
                                                        </a>
                                              @else
                                                                          <a href="{{ route('admin.editUser', $user->id) }}">
                                                            <div class="user-card">
                                                                <div class="user-avatar bg-primary">
                                                                   @if ($user->profile_pic)
        <img src="{{ asset('storage/app/public/' . $user->profile_pic) }}" alt="{{ $user->name }}" style="height: 45px;width: 45px;">
    @else
        <img src="{{ asset('storage/user_default.png') }}" alt="{{ $user->name }}" style="height: 45px;width: 45px;">
    @endif
                                                                </div>
                                                                <div class="user-info">
                                                                    <span class="tb-lead">{{ $user->name }} <span class="dot dot-success d-md-none ms-1"></span></span>
                                                                    <span>{{ $user->email }}</span>
                                                                </div>
                                                            </div>
                                                        </a>
                                                                             
                                                   @endif
                                                        
                                                    </div>
                                                     
                                                    <div class="nk-tb-col tb-col-md">
                                                        <span>{{ $user->phone_number }}</span>
                                                    </div>
                                                    <div class="nk-tb-col tb-col-lg">
                                                        <ul class="list-status">
                                                            <li>
                                                         @if ($user->email_verified == '1')       
                                                                <em class="icon text-success ni ni-check-circle"></em>
                                                                @else
                                                                <em class="icon ni ni-alert-circle"></em>
                                                                @endif
                                                                <span>Email</span></li>
                                                            <li>@if ($user->kyc_verified == '1')       
                                                                <em class="icon text-success ni ni-check-circle"></em>
                                                        @elseif ($user->kyc_verified == '2')
                                                   <em class="icon text-warning ni ni-alert-circle"></em>     
                                                                @else
                                                                <em class="icon ni ni-alert-circle"></em>
                                                                @endif <span>KYC</span></li>
                                                        </ul>
                                                    </div>
                                                    <div class="nk-tb-col tb-col-lg">
                                                        <span>{{ $user->created_at }}</span>
                                                    </div>
                                                    <div class="nk-tb-col tb-col-md">
                                                     @if ($user->status == 'active')
                                                        <span class="tb-status text-success">Active</span>
                                                     @else   
                                                        <span class="tb-status text-warning">InActive</span>
                                                        @endif
                                                    </div>
                                                    <div class="nk-tb-col nk-tb-col-tools">
                                                        <ul class="nk-tb-actions gx-1">
                                                           {{-- <li class="nk-tb-action-hidden">
                                                                <a href="#" class="btn btn-trigger btn-icon" data-bs-toggle="tooltip" data-bs-placement="top" title="Wallet">
                                                                    <em class="icon ni ni-wallet-fill"></em>
                                                                </a>
                                                            </li>
                                                            <li class="nk-tb-action-hidden">
                                                                <a href="#" class="btn btn-trigger btn-icon" data-bs-toggle="tooltip" data-bs-placement="top" title="Send Email">
                                                                    <em class="icon ni ni-mail-fill"></em>
                                                                </a>
                                                            </li>
                                                            <li class="nk-tb-action-hidden">
                                                                <a href="#" class="btn btn-trigger btn-icon" data-bs-toggle="tooltip" data-bs-placement="top" title="Suspend">
                                                                    <em class="icon ni ni-user-cross-fill"></em>
                                                                </a>
                                                            </li>--}}
                                                            <li>
                                                                <div class="drodown">
                                                                    <a href="#" class="dropdown-toggle btn btn-icon btn-trigger" data-bs-toggle="dropdown"><em class="icon ni ni-more-h"></em></a>
                                                                    <div class="dropdown-menu dropdown-menu-end">
                                                                        <ul class="link-list-opt no-bdr">
                                              @if ($user->is_admin == '1')                    <li><a href="#"><em class="icon ni ni-info"></em><span>Edit Admin Block</span></a></li>
                                              @else
                                                                            <li><a href="{{ route('admin.editUser', $user->id) }}"><em class="icon ni ni-eye"></em><span>View Details</span></a></li>
                                        
                                        <li>
                                            <form action="{{ route('admin.users.destroy', $user->id) }}" method="POST" style="display:inline;">
                        @csrf
                        @method('DELETE')
                        <button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this user?');">
                           <em class="icon ni ni-trash"></em><span>Delete User</span></button>
</form> </li>                                    
                                                                             
                                                   @endif                     </ul>
                                                                    </div>
                                                                </div>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div><!-- .nk-tb-item -->
                                                
                                                 @endforeach
                                                
                                                
                                                
                                                
                                                
                                                
                                                
                                                
                                                
                                                
                                                 
                                            </div><!-- .nk-tb-list -->
                                        </div><!-- .card-inner -->
                                        <div class="card-inner">
                                            <div class="nk-block-between-md g-3">
                                                <div class="g">
                                               <!--     <ul class="pagination justify-content-center justify-content-md-start">
                                                        <li class="page-item"><a class="page-link" href="#">Prev</a></li>
                                                        <li class="page-item"><a class="page-link" href="#">1</a></li>
                                                        <li class="page-item"><a class="page-link" href="#">2</a></li>
                                                        <li class="page-item"><span class="page-link"><em class="icon ni ni-more-h"></em></span></li>
                                                        <li class="page-item"><a class="page-link" href="#">6</a></li>
                                                        <li class="page-item"><a class="page-link" href="#">7</a></li>
                                                        <li class="page-item"><a class="page-link" href="#">Next</a></li>
                                                    </ul> .pagination -->
                                                </div>
                                               <!--  <div class="g">
                                                    <div class="pagination-goto d-flex justify-content-center justify-content-md-start gx-3">
                                                        <div>Page</div>
                                                        <div>
                                                            <select class="form-select js-select2" data-search="on" data-dropdown="xs center">
                                                                <option value="page-1">1</option>
                                                                <option value="page-2">2</option>
                                                                <option value="page-4">4</option>
                                                                <option value="page-5">5</option>
                                                                <option value="page-6">6</option>
                                                                <option value="page-7">7</option>
                                                                <option value="page-8">8</option>
                                                                <option value="page-9">9</option>
                                                                <option value="page-10">10</option>
                                                                <option value="page-11">11</option>
                                                                <option value="page-12">12</option>
                                                                <option value="page-13">13</option>
                                                                <option value="page-14">14</option>
                                                                <option value="page-15">15</option>
                                                                <option value="page-16">16</option>
                                                                <option value="page-17">17</option>
                                                                <option value="page-18">18</option>
                                                                <option value="page-19">19</option>
                                                                <option value="page-20">20</option>
                                                            </select>
                                                        </div>
                                                        <div>OF 102</div>
                                                    </div>
                                                </div>.pagination-goto -->
                                            </div><!-- .nk-block-between -->
                                        </div><!-- .card-inner -->
                                    </div><!-- .card-inner-group -->
                                </div><!-- .card -->
                            </div><!-- .nk-block -->
                        </div>
                    </div>
                </div>
                <!-- content @e -->
@endsection
