@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">Ebook Volume Level Access</li>
        </ol>
    </section>
	
	<section class="content">
                <div class="row">
				
				@include('admin/user_access.includes.access_info_section')
				
                    <div class="col-md-12">
		
										
							@if (isset($ebook_volume_list) && isset($user_access))

							<div class="panel panel-primary">
							
								<div class="panel-heading">
								
								 <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>
										Ebook Volume level User Access Form

										<span class="pull-right">
											<form action="{{ route('user_access.index')}}" method="Get"  enctype="multipart/form-data">
											<div class="btn-group btn-group-xs">
									            <input type="hidden" name="section" value="access_ip_range_list"/>
									            <input type="hidden" name="user_name" value="{{$user_access->name}}"/>
									            <input type="hidden" name="request_id" value="{{$request_id}}"/>
									            <input type="hidden" name="go_back" value="yes"/>
												<button type="submit" class="btn btn-warning btn_sizes" name="frm_search" value ="true"><span class="glyphicon glyphicon-backward"></span> Go Back</button>
							                </div>
											</form>
										</span>


									</div>	
								</div>
								
								</div>
								<div class="panel-body">
								
		{{ Form::open(array('url' => 'admin/user_access')) }}		

<input type="hidden" name="section" value="access_form"/>
<input type="hidden" name="request_id" value="{{$request_id}}"/>
<input type="hidden" name="user_name" value="{{$user_access->name}}"/>
<input type="hidden" name="user_access" value="{{encrypt($user_access->user_access_id)}}"/>

			<table class="table table-striped table-bordered" style="width:100%">
	
				<thead>
					<tr>
					@if(isset($request_id))
						<th class="align-text-top text-center">Select&nbsp;&nbsp;<input id="acces_all_check" type="checkbox"></th>
					@endif
						<th class="align-text-top text-center ">Ebook</th>
						<th class="align-text-top text-center ">Ebook Volume From</th>
						<th class="align-text-top text-center ">Ebook Volume To</th>
						
					</tr>
				</thead>
				<tbody>
				
					@foreach($ebook_volume_list as $value)
					<tr>
					@if(isset($request_id))
					<td class="text-center"  width="10%">
							<input  id="access_check_{{ $value->ebook_id }}" name="volume_range[{{$value->ebook_id}}][check]" type="checkbox" value="1">
						</td>
					@endif
						<td class="text-left"  width="60%">{{$value->title}}</td>
						<td class="text-center" width="15%">
							<select class="form-control" name="volume_range[{{$value->ebook_id}}][from]">
								@if ($value->volume_range != "")
								  @foreach(explode(',', $value->volume_range) as $vol) 
								  
									<option value="{{explode('-',$vol)[1]}}">{{explode('-',$vol)[1]}} ({{explode('-',$vol)[2]}})</option>
								  @endforeach
								@endif
							</select>			
						</td>
						<td class="text-center"  width="15%">
						<select class="form-control" name="volume_range[{{$value->ebook_id}}][to]">
							@if ($value->volume_range != "")
							  @foreach(array_reverse(explode(',', $value->volume_range)) as $vol) 
								<option value="{{explode('-',$vol)[1]}}">{{explode('-',$vol)[1]}} ({{explode('-',$vol)[2]}})</option>
							  @endforeach
							@endif
						</select>			
						
						</td>
						
					</tr>
					
					
				@endforeach   
				
				<tr>
				<td colspan="4" class="text-center">
				 @if(isset($request_id))	
					{{ Form::submit('Submit', array('class' => 'btn btn-primary','value' => 'submit' , 'id' => 'add_ebook_volume_list' , 'name' => 'add_ebook_volume_list' )) }}
				@endif	
				</td>
				</tr>
				
			</tbody>		
			</table>	

			
{{ Form::close() }}				
							
			</div>
			</div>								
							
@endif
                        
                        <!-- END SAMPLE TABLE PORTLET-->
                    </div>
                </div>
            </section>

@stop

{{-- page level scripts --}}
@section('footer_scripts')
	
	<script src="{{ asset('js/user_access.js') }}" type="text/javascript"></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
