@if($pages=='registeredips' && !isset($request->id))

<div class="col-md-8 mt-xs-5">
    <nav aria-label="breadcrumb">
      <ol class="breadcrumb bg-transparent m-0 justify-content-end">
        <li class="breadcrumb-item"><a href="/home">Home</a></li>
        <li class="breadcrumb-item active" aria-current="page">User Registered IPs</li>
      </ol>
    </nav>
    <h2 class="h4 p-3 bg-dark text-white">
        User Registered IPs
    </h2>
    <div class="card bigbox-hvr-slow mt-4">
        <div class="card-body">
          <div class="table-responsive">

                    <table class="table table-striped table-bordered" id="article_table">
                        <thead>
                            <tr>
                                <th>S.#</th>
                                <?php /* <th>User Name</th> */ ?>
                                <th>Organization</th>
                                <th>IP Ranges</th>
                            </tr>
                        </thead>
                        <tbody>
                            @if (!empty($user_consortia_counter))
                            @php $a=1; @endphp
                            @foreach($user_consortia_counter as $key => $value)
                            <tr>
                                <td>{{ $a }}</td>
                                <!-- <td>{{ $value->user_name }}</td> -->
                                <td>{{ $value->organization_name }}</td>
                                <td>
                                    @if(isset($value->access_base_type) && $value->access_base_type == 1)
                                    <a href="/home/registeredips/{{ $value->id }}" class="nac-link" > <i class="fas fa-chart-area"></i> View </a>
                                    @endif
                                </td>
                            </tr>
                            @php $a++ @endphp
                            @endforeach
                            @else
                            <tr>
                                <td colspan="3">
                                    <center>Empty</center>
                                </td>
                            </tr>
                            @endif
                        </tbody>
                    </table>
                    @if (!empty($user_consortia_counter))
                    <center>{{ $user_consortia_counter->appends(request()->input())->links() }}</center>
                    @endif
        </div>
      </div>
    </div>
</div>
@elseif($pages=='registeredips' && isset($request->id))

<div class="col-md-8 mt-xs-5">
    <nav aria-label="breadcrumb">
      <ol class="breadcrumb bg-transparent m-0 justify-content-end">
        <li class="breadcrumb-item"><a href="/home">Home</a></li>
        <li class="breadcrumb-item"><a href="/home/registeredips">User List</a></li>
        <li class="breadcrumb-item active" aria-current="page">Registered IPs</li>
      </ol>
    </nav>
    <div class="row bg-dark text-white m-0 py-2">
        <h2 class="h4 col m-0 mt-1">
        Registered IPs
        </h2>
      <div class="col">  
        <form name="first" method="post" action="{{ route('home','registeredips') }}" enctype="multipart/form-data"> 
            @method('PUT')
            <input type="hidden" name="_token" value="<?=csrf_token()?>">
            <input type="hidden" name="id" value="{{$request->id}}">
            <div class="input-group input-group-sm">
                <input type="text" class="form-control" name="search_ip" placeholder="Search IP Here...">
                <div class="input-group-append">
                    <button class="btn btn-secondary" type="submit" name='submit_it'>
                    <i class="fa fa-search"></i>
                    </button>
                </div>
            </div>
        </form>
      </div>
    </div>
    
    <div class="card bigbox-hvr-slow mt-4">
        <div class="card-body">
          <div class="table-responsive">

                    <table class="table table-striped table-bordered" id="article_table">
                        <thead>
                            <tr>
                                <th>S.#</th>
                            <?php /*    <th>User Name</th> */ ?>
                                <th>Organization Name</th>
                                <th>IP From</th>
                                <th>IP To</th>
                            </tr>
                        </thead>
                        <tbody>
                            @if (!empty($registeredips))
                            @php $a=1; @endphp
                            @foreach($registeredips as $key => $value)
                            <tr>
                                <td>{{ $a }}</td>
                            <?php /*    <td>{{ $value->name }}</td> */ ?>
                                <td>{{ $value->organization_name }}</td>
                                <td>{{ long2ip($value->from_ip) }}</td>
                                <td>{{ long2ip($value->to_ip) }}</td>
                            </tr>
                            @php $a++ @endphp
                            @endforeach
                            @else
                            <tr>
                                <td colspan="4">
                                    <center>Empty</center>
                                </td>
                            </tr>
                            @endif
                        </tbody>
                    </table>
                    @if (!empty($registeredips))
                    <center>{{ $registeredips->appends(request()->input())->links() }}</center>
                    @endif
        </div>
      </div>
    </div>
</div>
@endif
