@extends('admin/layouts/default')



{{-- Page title --}}

@section('title')

IP List For WebServices

@parent

@stop



{{-- page level styles --}}

@section('header_styles')     

    <link href="{{ asset('assets/css/pages/tables.css') }}" rel="stylesheet" type="text/css" />

    <!-- end of page level css-->

@stop



{{-- Page content --}}

@section('content')



<section class="content-header">

    <!--section starts-->

    <h1>IP Access</h1>

    <ol class="breadcrumb">

        <li>

            <a href="{{ route('admin.dashboard') }}">

                <i class="livicon" data-name="home" data-size="18" data-loop="true"></i>

                Dashboard

            </a>

        </li>

        <li class="active">IP Access</li>

    </ol>

</section>

<!--section ends-->

<section class="content">

                <div class="row">

                    <div class="col-md-12">

                        <!-- BEGIN SAMPLE TABLE PORTLET-->

                        <div class="portlet box primary">

                            <div class="portlet-title">

                                <div class="caption">

                                    <i class="livicon" data-name="responsive" data-size="16" data-loop="true" data-c="#fff" data-hc="white"></i>

                                    IP List For WebServices

                                </div><a class="btn btn-sm btn-default button-alignment pull-right mb-1" title="Add New Campaign" href="{{ route('ipaccess.create') }}"><span class="glyphicon glyphicon-plus"></span> New</a>

                            </div>

                            <div class="portlet-body table-responsive">

                                @if ($message = Session::get('success'))

                                    <div class="alert alert-success alert-dismissable">

                                        <p>{{ $message }}</p>

                                    </div>

                                @endif

                                @if ($message = Session::get('error'))

                                    <div class="alert alert-danger alert-dismissable">

                                        <p>{{ $message }}</p>

                                    </div>

                                @endif

                        <form action="{{ route('ipaccess.index') }}" method="Get"  enctype="multipart/form-data">

                            @csrf



                            <div class="input-group mb-5">

                          <input type="text" name="search" autocomplete="off" class="form-control" placeholder="Search for...">

                          <span class="input-group-btn">

                            <button class="btn btn-info" type="submit"><span class="glyphicon glyphicon-search"> Go</span></button>

                          </span>

                        </div><!-- /input-group -->

                        </form>                           

                                <table class="table table-striped table-bordered" >

                                    <thead>

                                        <tr>

                                            <th>IP Address</th>

                                            <th>Domain Name</th>

                                            <th>Description</th>

                                            <th >Authentication Type</th>                                            

                                            <th>Status</th>                                            

                                            <th>Toggle Status</th>

                                            <th width="150">Action</th>

                                        </tr>

                                    </thead>

                                    <tbody>

                                        @foreach($ipaccess_list as $ipaccess)

                                        <tr>

                                            <td>{{$ipaccess->ip_address}}</td>

                                            <td>{{$ipaccess->domain_name}}</td>

                                            <td>{{$ipaccess->description}}</td>

                                            <td>{{$ipaccess->auth_type}}</td>                                           

                                            <td>

                                                @if($ipaccess->isactive==1)

                                                        <?php $status = "Active"; ?>

                                                        <?php $status_val = 0; ?>

                                                        <?php $status_txt = "Suspend";?>

                                                        <?php $class = "success";?>

                                                @elseif($ipaccess->isactive==0)

                                                        <?php $status = "Suspended"; ?>

                                                        <?php $status_val = 1;?>

                                                        <?php $status_txt = "Activate";?>

                                                        <?php $class = "warning";?>

                                                @elseif($ipaccess->isactive==2)

                                                        <?php $status = "Deleted"; ?>

                                                        <?php $status_val = 2;?>

                                                        <?php $status_txt = "Deleted";?>

                                                        <?php $class = "danger";?>

                                                @endif

                                                <label class="label label-{{$class}}">{{$status}}</label>

                                            </td>                                            

                                            <td><a href="javascript: void();" class="btn btn-link" data-toggle="modal" data-target="#campstatus{{ $ipaccess->id }}">{{$status_txt}}</a>



                                                    <div class="modal fade" id="campstatus{{ $ipaccess->id }}" role="dialog">

                                                        <div class="modal-dialog">

                                                        

                                                          <!-- Modal content-->

                                                          <div class="modal-content">

                                                            <div class="modal-header">

                                                              <button type="button" class="close" data-dismiss="modal">&times;</button>

                                                              <h3 class="modal-title text-danger">Confirmation</h3>

                                                            </div>

                                                            <div class="modal-body">

                                                              <p><strong>Are you sure you want to change Status?</strong></p>

                                                            </div>

                                                            <div class="modal-footer">                                                    

                                                             {{ Form::open([ 'method'  => 'post', 'route' => [ 'ipaccess.status'] ]) }}

                                                                {{ Form::hidden('id', $ipaccess->id) }}

                                                                {{ Form::hidden('status', $status_val) }}

                                                                {{ Form::submit('Yes', ['class' => 'btn btn-danger']) }}

                                                                <button type="button" class="btn btn-primary" data-dismiss="modal">No</button>

                                                            {{ Form::close() }} 

                                                            

                                                        

                                                            

                                                            </div>

                                                          </div>

                                                          

                                                        </div>

                                                      </div>

                                            </td>

                                            

                                            <td width="180px">

                                                @if($editPermission)

                                                <a href="{{ route('ipaccess.edit',$ipaccess->id) }}" class="btn btn-primary btn-sm pull-left">

                                                        <i class="livicon mt-2" data-name="pen" data-loop="true" data-color="#fff" data-hovercolor="white" data-size="14"></i>

                                                        Edit

                                                    </a> 

                                                 @endif       

                                                   

                                                @if($deletePermission)

                                                    <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#camp{{ $ipaccess->id }}"><i class="livicon mt-2" data-name="trash" data-loop="true" data-color="#fff" data-hovercolor="white" data-size="14"></i>Delete</button>

                                                        <!-- Modal -->

                                                      <div class="modal fade" id="camp{{ $ipaccess->id }}" role="dialog">

                                                        <div class="modal-dialog">

                                                        

                                                          <!-- Modal content-->

                                                          <div class="modal-content">

                                                            <div class="modal-header">

                                                              <button type="button" class="close" data-dismiss="modal">&times;</button>

                                                              <h3 class="modal-title text-danger">Confirmation</h3>

                                                            </div>

                                                            <div class="modal-body">

                                                              <p><strong>Are you sure you want to delete this record?</strong></p>

                                                            </div>

                                                            <div class="modal-footer">                                                    

                                                             {{ Form::open([ 'method'  => 'delete', 'route' => [ 'ipaccess.destroy', $ipaccess->id] ]) }}

                                                                {{ Form::hidden('id', $ipaccess->id) }}

                                                                {{ Form::submit('Yes', ['class' => 'btn btn-danger']) }}

                                                                <button type="button" class="btn btn-primary" data-dismiss="modal">No</button>

                                                            {{ Form::close() }} 

                                                            

                                                        

                                                            

                                                            </div>

                                                          </div>

                                                          

                                                        </div>

                                                      </div>

                                                    @endif    



                                            </td>

                                        </tr>

                                        @endforeach

                                    </tbody>

                                </table>

                               <div class="col-md-4">

                     Showing {{ $ipaccess_list->firstItem() }} to {{ $ipaccess_list->lastItem() }} of {{  $ipaccess_list->total() }} entries

                 </div>

                        <div class="col-md-8  text-right">         {{ $ipaccess_list->appends(request()->input())->links() }}

                          </div>  

                            </div>

                        </div>

                        <!-- END SAMPLE TABLE PORTLET-->

                    </div>

                </div>

                



            </section>



@stop



{{-- page level scripts --}}

@section('footer_scripts')

    

    

    <script>        

        function ChangeStatus(url){

    

             var SeqConfirm = confirm("Are you sure you want to change Status?");

                if (SeqConfirm == true) {

                    location.href=url;

                }   

                

        }

    </script>

@stop

