
@extends('layouts.app')
@section('title')
Journal - {{$journal->title}}
@parent
@stop
@section('content')

@include('includes.journal_banner')
<!----Main Section Starts (where all content bodies exist)----> 
<main>

  <section>
    <div class="container">
      <div class="row">
	  
        <div class="col-md-12">
          <h2 class="h4">Article Rental</h2>
          <hr>
        </div>
        <div class="col-lg-12 mb-2"> 
		  @if(isset($migs_transaction) && $migs_transaction == 'Success')
			<div class="alert alert-success">
			
			  <strong>Thank You </strong> <br>

				Thank you so much for your time and rental article. 
				Use the links below to get to where you want to go! 

				@if (Auth::guest())
				    <a href="{{ route('login') }}">Login</a>
				@else
					@php 
						$param=encrypt(array('readrentalpdf',$detail['article_id'],config('constants.admin.token')));
					@endphp
   				    <a href="{{route('article', ['article_id' => $detail['article_id'],'param' => $param])}}">[ View Rental Article ]</a>
				@endif
			</div>	
			
		@elseif(isset($migs_transaction) && $migs_transaction == 'Cancel')
		
			<div class="alert alert-danger">
			  <strong>Cancelled </strong> <br> The transaction Cancelled
			</div>	
			@include('form.rental_request_paypal_form')
			
		@elseif(isset($paypal_transaction) && $paypal_transaction == 'Success')
			<div class="alert alert-success">
			
			  <strong>Thank You </strong> <br>

				Thank you so much for your time and rental article. Use the links above to get to where you want to go! <br>
				
				@if (Auth::guest())
				    <a class="btn btn-success btn-sm" href="{{ route('login') }}"><i class="far fa-file-alt"></i> Login</a>
				@else
					@php 
						$param=encrypt(array('readrentalpdf',$detail['article_id'],config('constants.admin.token')));
					@endphp
   				    <a href="{{route('article', ['article_id' => $detail['article_id'],'param' => $param])}}">[ View Rental Article ]</a>
				@endif
			</div>	
		@elseif(isset($paypal_transaction) && $paypal_transaction == 'Cancel')
		
			<div class="alert alert-warning">
			  <strong>Cancelled </strong> <br> The transaction Cancelled
			</div>	

		@elseif(isset($paypal_transaction) && $paypal_transaction == 'Failed')
		
			<div class="alert alert-danger">
			  <strong>Error while Transaction with Paypal</strong><br> The transaction has been failed,It appears that there is some issue in the processing of your transaction at the bank.
			</div>	
		@endif	

	</div>

	<div class="col-lg-6 mb-4">
          	 <div class="card bigbox-hvr-slow">
				  <div class="card-body">

   <h5>Article Detail:</h5>
	   <hr>
			<div class="form-group row border-bottom pb-2">
				<label class="control-label col-xl-2 col-lg-3 align-top"><strong>Title:</strong></label>
				<label class="control-label col-xl-10 col-lg-9">{{$article->title}}</label>
			</div>
			<div class="form-group row border-bottom pb-2">
				<label class="control-label col-xl-2 col-lg-3"><strong>Abstract:</strong></label>
				<div class="col-xl-10 col-lg-9">
				<button href="#" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#abstract_{{ $article->article_id }}">View Abstract</button></div>
			</div>
			<div class="form-group row border-bottom pb-2">
				<label class="control-label col-xl-2 col-lg-3"><strong>Journal:</strong></label>
				<label class="control-label col-xl-10 col-lg-9">{{$journal->title}}</label>
			</div>
			<div class="form-group row border-bottom pb-2">
				<label class="control-label col-xl-2 col-lg-3 align-top"><strong>Volume:</strong></label>
				<label class="control-label col-xl-10 col-lg-9">{{$volume->volume_name}}</label>
			</div>
			@if(!empty($issue->title))
			<div class="form-group row border-bottom pb-2">
				<label class="control-label col-xl-2 col-lg-3 align-top"><strong>Issue:</strong></label>
				<label class="control-label col-xl-10 col-lg-9">{{$issue->title}}</label>
			</div>
			@endif
		</div>
		
		
			<!--View Abstract -->
			<!---------------------------------------------------------------------->
			<!---------------------------------------------------------------------->
			<div class="modal fade" id="abstract_{{$article->article_id}}" tabindex="-1" role="dialog" aria-hidden="true">
				<div class="modal-dialog modal-lg" role="document">
					<div class="modal-content">
						<div class="modal-header">
						<h5 class="modal-title"> Abstract</h5>
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
						</button>
						</div>
						<div class="modal-body">

						<p>{!! html_entity_decode($article->abstract) !!}</p>

						</div>
						<div class="modal-footer">
						<button type="button" class="btn btn-outline-dark" data-dismiss="modal">Close</button>
						</div>
					</div>
				</div>
			</div>
			<!---------------------------------------------------------------------->
			<!---------------------------------------------------------------------->
			

</div>
</div>


<div class="col-lg-6"> 
<div class="card bigbox-hvr-slow">
<div class="card-body">
	

			@if ($errors->any())
			
			<div class="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>
		
			@endif

			<h5>Rental Order Detail</h5>
				
				<hr>
			<div class="form-group row border-bottom pb-2">
				<label class="control-label col-xl-2 col-lg-4 col-md-4 align-top">Display Name:</label>
				<label class="control-label col-xl-10 col-lg-8 col-md-8">{{$detail['display_name']}} </label>
			</div>
			<div class="form-group row border-bottom pb-2">
				<label class="control-label col-xl-2 col-lg-4 col-md-4 align-top">Email:</label>
				<label class="control-label col-xl-10 col-lg-8 col-md-8">{{$detail['email']}}</label>
			</div>
			<div class="form-group row border-bottom pb-2">
				<label class="control-label col-xl-2 col-lg-4 col-md-4 align-top">Country:</label>
				<label class="control-label col-xl-10 col-lg-8 col-md-8">@if(!empty($detail['country_name'])) {{$detail['country_name']}} @else {{$detail['country']}} @endif</label>
			</div>
			<div class="form-group row pb-2">
				<label class="control-label col-xl-2 col-lg-4 col-md-4 align-top">Rental Package:</label>
				<label class="control-label col-xl-10 col-lg-8 col-md-8">Hour: {{$rental[0]->rental_hours}} &nbsp; Price: ${{$rental[0]->rental_price}}</label>
			</div>
			

		@if(isset($paypal_transaction) && $paypal_transaction == 'failed')
		
			
			<div class="alert alert-danger">
			  <strong>Error while Transaction with Paypal</strong><br> The transaction has been failed,It appears that there is some issue in the processing of your transaction at the bank.
			</div>	
			
		@endif
		
		@if(!(isset($paypal_transaction)) && !(isset($migs_transaction)) )	
			
			<form method="POST" action="{{ url('rental-request/'.$article->article_id) }}">			@csrf

			<input name="display_name" type="hidden" value="{{$detail['display_name']}}">			
			<input name="email" type="hidden" value="{{$detail['email']}}">
			<input name="country" type="hidden" value="{{$detail['country']}}">
			<input name="rental" type="hidden" value="{{$rental[0]->rental_id}}">
			<hr>
		<div class="text-center">
			<a class="btn btn-outline-dark" href="/rental-request/{{$article->article_id}}">Back</a>
			<input class="btn btn-primary" name="article_rental_purchase_form" type="submit" value="Submit">
		</div>
			
			</form>		

		
		@endif
		

	 
	  
	</div>
				
        </div>

    </div>
    
      </div>
    </div>
  </section>
  
</main>
@endsection