@extends('admin/layouts/default')

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

{{-- page level styles --}}
@section('header_styles')
<!--page level css -->
@include('admin.access_request_manager.includes.user_access_header')
<!--end of page level css-->
@stop

{{-- Page content --}}
@section('content')
<section class="content-header">
	<h1>Access Request File</h1>
</section>

<section class="content">
	<div class="row">
		<div class="col-md-12">
			@if(isset($request_id))
			@if(!empty($request_data->ip_addresses))
			<button class="btn btn-warning btn-md m-l-5" data-toggle="modal" data-target="#ip_list" title="View" style="float:right;">View IP's List</button>
			<div class="modal fade" id="ip_list" role="dialog" aria-labelledby="modalLabelprimary">
				<div class="modal-dialog" role="document">
					<div class="modal-content">
						<form method="POST" action="{{ url('admin/useraccess/add') }}">
						@csrf()
						<input type="hidden" name="request_id" value="{{encrypt($request_id)}}" />
						<div class="modal-header bg-primary">
							<h4 class="modal-title" id="modalLabelprimary">IP's Lists</h4>
						</div>
						<div class="modal-body">
							<textarea id="ip_addresses" name="ip_addresses" class="form-control">{{$request_data->ip_addresses}}</textarea>
						</div>
						<div class="modal-footer">
							<button type="submit" name="btn_access_file" value="access_file" class="btn btn-success btn-md">
								Click to Proceed!
							</button>
						</div>
						</form>
					</div>
				</div>
			</div>
			@else
			<form method="POST" action="{{ url('admin/useraccess/add') }}">
			@csrf()
			<input type="hidden" name="request_id" value="{{encrypt($request_id)}}" />
			<button type="submit" name="btn_access_file" value="access_file" class="btn btn-success btn-md" style="float:right;">
				Click to Proceed!
			</button>
			</form>
			@endif
			@endisset
			<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>
						Access Request File List
					</div>
				</div>
				<div class="portlet-body table-responsive">
					<table class="table table-striped table-bordered">
						<thead>
							<tr>
								<th class="text-center">S.#</th>
								<th class="text-center">Subscriber Name</th>
								<th class="text-center">Subscriber Country</th>
								<th class="text-center">Email</th>
								<th class="text-center">Journal / Ebook ISBN</th>
								<th class="text-center">Old Jounral Subtitle</th>
								<th class="text-center">Start Date</th>
								<th class="text-center">End Date</th>
								<th class="text-center">List Date</th>
								<th class="text-center">Year</th>
							</tr>
						</thead>
						<tbody>
							@if(count($data_arr) > 0)
							@php $a=1; @endphp
							@foreach ($data_arr as $row)
							<tr>
								<td>{{$a}}</td>
								<td>{{$row['subscriber_name']}}</td>
								<td>{{$row['country']}}</td>
								<td>{{$row['email']}}</td>
								<td>{{$row['journal']}}</td>
								@if(isset($row['old_subtitle']))
								@if($row['old_subtitle'] == "")
								<td>(NULL)</td>
								@else
								<td class="bg-danger">{{$row['old_subtitle']}}</td>
								@endif
								@else
								<td>(NULL)</td>
								@endif
								<td>{{$row['start_date']}}</td>
								<td>{{$row['end_date']}}</td>
								<td>{{$row['list_date']}}</td>
								<td>{{$row['year']}}</td>
							</tr>
							@php $a++; @endphp
							@endforeach
							@else
							<tr>
								<td colspan="11" class="text-center"> No Record Found</td>
							</tr>
							@endif
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</section>
@stop
{{-- page level scripts --}}
@include('admin.access_request_manager.includes.user_access_footer')
@section('footer_scripts')
@stop