<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>
			Pending Access Request List
		</div><a class="btn btn-sm btn-default button-alignment pull-right mb-1" title="Add New Access Request" href="{{ route('access_request_manager.create') }}"><span class="glyphicon glyphicon-plus"></span> New</a>
	</div>
	<div class="portlet-body table-responsive">
		<table class="table table-striped table-bordered" style="margin-bottom:0px;">
			<thead>
				<tr>
					<th class="text-center">S.#</th>
					<th class="text-center">Access Type</th>
					<th class="text-center">Contact Name</th>
					<th class="text-center">Organization</th>
					<th class="text-center">Client Email</th>
					<th class="text-center">Comments</th>
					<th class="text-center">Order No.</th>
					<th class="text-center">PD File</th>
					<th class="text-center">Date</th>
					<th class="text-center">Created By</th>
					<th class="text-center" width="100">Action</th>
					<th class="text-center">View Access File</th>
				</tr>
			</thead>
			<tbody>
				@if(count($access_list_new) > 0)
				@php $a=1; @endphp
				@foreach ($access_list_new as $row)
				<tr>
					<td>{{$a}}</td>
					<td>{{$row->access_type}}</td>
					<td>{!!$row->client_name!!}</td>
					<td>{!!$row->organization_name!!}</td>
					<td class="whitespace-normal">{{$row->contact_person_email}}</td>
					<td class="text-center"><button class="btn btn-raised btn-primary btn-sm  mb-1" data-toggle="modal" data-target="#ip{{ $row->request_id }}" title="View"><i class="livicon" data-name="eye-open" data-loop="true" data-color="#fff" data-hovercolor="white" data-size="16"></i></button></td>
					<td>{{$row->order_number}}</td>
					<td class="text-center">
						@if($row->pd_file_id != "")
						<a href="{{ route('access_request_manager.show', encrypt($row->request_id)) }}" class="btn btn-success btn-sm mb-1" title="Download File">
							<i class="livicon mt-2" data-name="download" data-loop="true" data-color="#fff" data-hovercolor="white" data-size="14"></i></a>
						@endif
					</td>
					<td>{{date('Y-m-d', $row->created_on)}}</td>
					<td>{{$row->name}}</td>
					<td>
						@if($editPermission)
						<a href="/admin/access_request_manager/{{encrypt($row->request_id)}}/edit" class="btn btn-primary btn-sm" title="Edit">
							<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
						</a>
						@endif
						@if($deletePermission)
						<button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#delete{{ $row->request_id }}" title="Delete">
							<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
						</button>
						<!-- Modal -->
						<div class="modal fade" id="delete{{ $row->request_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 action="/admin/access_request_manager_detail/view_access_file" method="Get" enctype="multipart/form-data">
											@csrf
											<input type="hidden" name="request_id" value="{{ encrypt($row->request_id) }}">
											<button class="btn btn-warning btn-sm" style="float:right;" type="submit">
												Click me!</button>
										</form>
									</div>
								</div>
							</div>
						</div>
						@endif
					</td>
					<div class="modal fade" id="ip{{ $row->request_id }}" role="dialog" aria-labelledby="modalLabelprimary">
						<div class="modal-dialog" role="document">
							<div class="modal-content">
								<div class="modal-header bg-primary">
									<h4 class="modal-title" id="modalLabelprimary">Comments</h4>
								</div>
								<div class="modal-body">
									<p>
										{!!$row->comments!!}
									</p>
								</div>
								<div class="modal-footer">
									<button class="btn  btn-primary" data-dismiss="modal">Close me!</button>
								</div>
							</div>
						</div>
					</div>
					<td class="text-center">
					<form action="/admin/access_request_manager_detail/view_access_file" method="Get" enctype="multipart/form-data">
							@csrf
							<input type="hidden" name="request_id" value="{{ encrypt($row->request_id) }}">
							<button class="btn btn-warning btn-sm" style="float:right;" type="submit">
							Click me!</button>
						</form>
						
					</td>
				</tr>
				@php $a++; @endphp
				@endforeach
				@else
				<tr>
					<td colspan="12" class="text-center"> No Record Found</td>
				</tr>
				@endif
			</tbody>
		</table>
		@if($page == "" && count($access_list_new) == 10)
		<a href="access_request_manager_detail/access_request_new" class="btn btn-info btn-sm" style="float:right;">
			View All
		</a>
		@else
		<div class="col-md-12  text-center">
			{{ $access_list_new->appends(request()->input())->links() }}
		</div>
		@endif

	</div>
</div>