@extends('admin/layouts/default')

{{-- Page title --}}
@section('title')
    Content Access
    @parent
@stop

{{-- page level styles --}}
@section('header_styles')
    <!--page level css -->
    <link href="{{ asset('assets/vendors/jasny-bootstrap/css/jasny-bootstrap.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendors/select2/css/select2.min.css') }}" type="text/css" rel="stylesheet">
    <link href="{{ asset('assets/vendors/select2/css/select2-bootstrap.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendors/datetimepicker/css/bootstrap-datetimepicker.min.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/vendors/iCheck/css/all.css') }}"  rel="stylesheet" type="text/css" />
    <link href="{{ asset('assets/css/pages/wizard.css') }}" rel="stylesheet">
	<link href="{{ asset('assets/css/pages/tables.css') }}" rel="stylesheet">
	
	<script src="{{ asset('js/jquery.min.js') }}" type="text/javascript"></script>
	
	<link href="{{ asset('assets/vendors/pickadate/css/default.css') }}" rel="stylesheet" type="text/css"/>
    <link href="{{ asset('assets/vendors/pickadate/css/default.date.css') }}" rel="stylesheet" type="text/css"/>
    <link href="{{ asset('assets/vendors/pickadate/css/default.time.css') }}" rel="stylesheet" type="text/css"/>
    <link href="{{ asset('assets/vendors/airDatepicker/css/datepicker.min.css') }}" rel="stylesheet" type="text/css"/>
    <link href="{{ asset('assets/vendors/flatpickrCalendar/css/flatpickr.min.css') }}" rel="stylesheet" type="text/css"/>
    <link href="{{ asset('assets/css/pages/adv_date_pickers.css') }}" rel="stylesheet" type="text/css"/>
	
	
	
    <!--end of page level css-->
@stop

{{-- Page content --}}
@section('content')



    <section class="content-header">
        <h1>User Access</h1>
        <ol class="breadcrumb">
            <li>
                <a href="{{ route('admin.dashboard') }}">
                    <i class="livicon" data-name="home" data-size="14" data-color="#000"></i>
                    Dashboard
                </a>
            </li>
            <li><a href="#"> Users</a></li>
            <li class="active">Access Request Form</li>
        </ol>
    </section>
	
	<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>
                                    Add Organization User & IP 
                                </div>			
                            </div>
							
							<div class="portlet-body table-responsive">		

                                @if ($errors->any())
                                    <div class="row">
                                        <div class="col-md-12 alert alert-danger">
                                            <strong>Whoops!</strong> There were some problems with your input.<br>
                                            <ul>
                                                @foreach ($errors->all() as $error)
                                                    <li>{{ $error }}</li>
                                                @endforeach
                                            </ul>
                                        </div>
                                        @if(Session::has('user_access'))
                                        <div class="col-md-12">
                                            <table class="table table-striped table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th>Access Type</th>
                                                        <th>Access On</th>
                                                        <th>Access Duration</th>
                                                        <th>Access Base</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    @foreach(Session::get('user_access') as $access)
                                                    <tr>
                                                        <td>{{$access->access_type_title}}</td>
                                                        <td>
                                                            @php 
                                                                $access_type_on = explode(',',$access->access_type_on); 
                                                            @endphp
                                                            @if (in_array('v', $access_type_on)) Volume <br /> @endif
                                                            @if (in_array('e', $access_type_on)) eBook Volume <br /> @endif
                                                            @if (in_array('i', $access_type_on)) Issue <br /> @endif
                                                            @if (in_array('c', $access_type_on)) Chapter <br /> @endif
                                                            @if (in_array('a', $access_type_on)) Article <br /> @endif
                                                        </td>
                                                        <td>@if($access->access_date_from !='' && $access->access_date_to !='') 
                                                                {{$access->access_date_from}} - {{$access->access_date_to}} 
                                                            @elseif($access->perpetual=='1') Perpetual
                                                            @endif
                                                        </td>
                                                        <td>@if($access->access_base_type=='0') User Base
                                                            @elseif($access->access_base_type=='1') IP Base 
                                                            @endif
                                                        </td>
                                                    </tr>
                                                    @endforeach
                                                </tbody>
                                            </table>
                                                
                                        </div>
                                        @endif
                                    </div>
                                @endif
                                
							
								{{ Form::open(array('url' => 'admin/user_access')) }}

									@csrf()

                                    <input type="hidden" name="section" value="access_ip_range_form"/>
                                    <input type="hidden" name="request_id" value="{{$request_id}}"/>
									
                                    @include('admin.user_access.includes.organization_details')
									@include('admin.user_access.includes.user_details')
									@include('admin.user_access.includes.ip_range')
									
									
									<div class="form-group col-md-12">
									<hr>
										<div class="form-row text-right">
											<div class="form-group col-md-12">
												{{ Form::submit('Submit', array('class' => 'btn btn-primary','value' => 'submit' , 'id' => 'ip_range_submit' , 'name' => 'ip_range_submit' )) }}
											</div>
										</div>
									</div>

								{{ Form::close() }}		
								
							</div>	
							
                           
						</div>							
										
						@isset($message)
						
								{{$message}}
						@else
							
						@endisset 		

                            
							
                        
                        <!-- END SAMPLE TABLE PORTLET-->
                    </div>
                </div>
            </section>

@stop

{{-- page level scripts --}}
@section('footer_scripts')
<script>
   $(function () {
   
    $(".select2").select2({
        theme:"bootstrap",
        placeholder:"Select Access Type On",
        width: '100%'
    });
       
   });
   
</script>
	<script src="{!! asset('js/user_access.js') !!}"></script>

    <script src="{{ asset('assets/vendors/iCheck/js/icheck.js') }}"></script>
    <script src="{{ asset('assets/vendors/moment/js/moment.min.js') }}" ></script>    
    <script src="{{ asset('assets/vendors/select2/js/select2.js') }}" type="text/javascript"></script>    
	<script src="{{ asset('assets/js/pages/table-advanced2.js') }}" type="text/javascript"></script>    
    <script src="{{ asset('assets/vendors/datetimepicker/js/bootstrap-datetimepicker.min.js') }}" type="text/javascript"></script>
	
	<script src="{{ asset('assets/vendors/pickadate/js/picker.js') }}" type="text/javascript"></script>
    <script src="{{ asset('assets/vendors/pickadate/js/picker.date.js') }}" type="text/javascript"></script>
    <script src="{{ asset('assets/vendors/pickadate/js/picker.time.js') }}" type="text/javascript"></script>
    <script src="{{ asset('assets/vendors/flatpickrCalendar/js/flatpickr.min.js') }}" type="text/javascript"></script>
    <script src="{{ asset('assets/vendors/airDatepicker/js/datepicker.min.js') }}" type="text/javascript"></script>
    <script src="{{ asset('assets/vendors/airDatepicker/js/datepicker.en.js') }}" type="text/javascript"></script>
    <script src="{{ asset('assets/js/pages/custom_datepicker.js') }}" type="text/javascript"></script>  
    
@stop

