@php $banner_list = GetBanner($ebook_volume_details[0]->ebook_volume_id,"eBook_volume"); @endphp

@php
$image_file_name=$ebook_volume_details[0]->image_file_name;
if(empty($image_file_name)) $image_file_name= 'no_image.jpg';
if(!(file_exists('images/bentham/'.$image_file_name))){
			$image_file_name = 'no_image.jpg';
}
	$image_url= 'http://'.$_SERVER['HTTP_HOST'].'/images/bentham/'.$image_file_name;
	$url='http://'.$_SERVER['HTTP_HOST'].'/'.$ebook_volume_details[0]->nid.'/volume/'.$ebook_volume_details[0]->volume_name;
	$ebook_title = $ebook->title;
	$subtitle = $ebook->subtitle;
	$isbn = $ebook_volume_details[0]->isbn;
	$CountMultipleVolumeExist = 0;
	$CountMultipleVolumeExist =  App\Models\EbookVolume::CountMultipleVolumeExist($ebook->ebook_id,$ebook_volume_details[0]->ebook_volume_id);
	if($CountMultipleVolumeExist > 0){
		$volumeLabel = 'Volume: '.$ebook_volume_details[0]->volume_name;
	}
	else{
		$volumeLabel = '';
	}
@endphp

<section id="ebook-banner" class="ebook_volume">

      <div class="container" >
        <div class="row">
          <div class="col-md-2">
		  <img 
		  src="{{'/images/bentham/'.$ebook_volume_details[0]->image_file_name}}"
		  width="160" height="211"
		  class="img-fluid" alt="">		  
		  
			@if($ebook_volume_details[0]->flyer_link != "")
			<!--a class="btn btn-outline-light btn-sm btn-block mt-3" href="/DownloadFlyer/{{Crypt::encrypt(config('constants.admin.root_path').'E-books/BEN/'.$ebook_volume_details[0]->eisbn.'/'.$ebook_volume_details[0]->volume_name.'/EBOOK/'.$ebook_volume_details[0]->flyer_link)}}" name="language_btn">Download PDF Flyer</a-->
			
			<a class="btn btn-outline-light btn-sm btn-block mt-3" href="/images/ebook-flyer/{{$ebook_volume_details[0]->flyer_link}}" name="language_btn">Download PDF Flyer</a>
			@endif
		  </div>
          <div class="col-md-5">
			
            <h1 class="h4">{!! $ebook->title !!}</h1>
			<h5 class="h5">{!! $ebook_volume_details[0]->ebook_subtitle !!}</h5>
			<h3 class="h5">{{$volumeLabel}}</h3>
			<!-- ebook volume authors -->
			@if (isset($ebook_volume_details) && $ebook_volume_details[0]->ebook_volume_id)
				
				@php ($author_name = null) @endphp
				@php ($co_author_name = null) @endphp
				@php ($editor_name = null) @endphp
				@php ($co_editor_name = null) @endphp
				@php ($guest_name = null) @endphp

				@foreach ($ebook_volume_details as $author)
					@if($author->iseditorcoeditor == 'a') 
						@php $author_name .= ucfirst($author->first_name).' '.ucfirst($author->initials).' '.ucfirst($author->last_name).', '; @endphp
					@elseif($author->iseditorcoeditor == 'ca') 
						@php $co_author_name .= ucfirst($author->first_name).' '.ucfirst($author->initials).' '.ucfirst($author->last_name).', '; @endphp
					@elseif($author->iseditorcoeditor == 'e') 
						@php $editor_name .= ucfirst($author->first_name).' '.ucfirst($author->initials).' '.ucfirst($author->last_name).', '; @endphp
					@elseif($author->iseditorcoeditor == 'ce') 
						@php $co_editor_name .= ucfirst($author->first_name).' '.ucfirst($author->initials).' '.ucfirst($author->last_name).', '; @endphp
					@elseif($author->iseditorcoeditor == 'ge')
						@php $guest_name .= ucfirst($author->first_name).' '.ucfirst($author->initials).' '.ucfirst($author->last_name).', '; @endphp
					@endif
				@endforeach
				<h6>
				@if($author_name) Authors(s) : {!! rtrim($author_name,', ') !!}<br> @endif
				@if($co_author_name) Co-Author(s) : {!! rtrim($co_author_name,', ') !!}<br> @endif
				@if($editor_name) Editor(s) : {!! rtrim($editor_name,', ') !!}<br> @endif
				@if($co_editor_name) Co-Editor(s) : {!! rtrim($co_editor_name,', ') !!}<br> @endif
				@if($guest_name) Guest-Editor(s) : {!! rtrim($guest_name,', ') !!}<br> @endif
				</h6>
				
				
			<p>
				@if($ebook_volume_details[0]->doi != "")
				DOI: <a href="https://doi.org/{{ $ebook_volume_details[0]->doi }}" target=
                    "_blank" class="text-white">{{ $ebook_volume_details[0]->doi }}</a>
				@endif	

				@if($ebook_volume_details[0]->eisbn != "")
				<br />eISBN: {{ $ebook_volume_details[0]->eisbn }}, 
				@endif	

				{{ $ebook_volume_details[0]->year }}

				@if($ebook_volume_details[0]->isbn != "")
				<br />ISBN: {{ $ebook_volume_details[0]->isbn }}
				@endif	

				@if($ebook_volume_details[0]->issn != "")
				<br />ISSN: {{ $ebook_volume_details[0]->issn }} <strong>(Print)</strong>
				@endif	

				@if($ebook_volume_details[0]->eissn != "")
				<br />ISSN: {{ $ebook_volume_details[0]->eissn }} <strong>(Online)</strong>
				@endif	
				
				
			</p>	
			
			<p class="text-light"><?php echo DisplaySocialNetworkLink($subtitle,$image_url,$ebook_title,$url)?></p>
		  <p><a class="btn btn-outline-light btn-sm" href="javascript: history.back()">Back</a>			
		  	<a class="btn btn-outline-light btn-sm" href="mailto:?subject=Library%20Recommendation:%20<?php echo strip_tags($ebook_title);?>&body=%0ALibrary%20Name:%0ALibrary%20Address:%0ALibrary%20Email:%0APhone:%0AFax:%0A%0ADear%20____%5BPLEASE%20INSERT%20THE%20NAME%20OF%20YOUR%20LIBRARIAN%20/%20INFORMATION%20SPECIALIST%5D%0A%0AI%20would%20like%20to%20recommend%20the%20following%20Bentham%20eBook%20for%20our%20library.%20I%20believe%20that%20this%20would%20be%20a%20valuable%20addition%20to%20our%20on-line%20/%20print%20collection.%20Please%20contact%20the%20publisher%20at%20ebooks@benthamscience.org%20for%20further%20purchase%20related%20details.%20The%20book's%20details%20are%20below.%0A%0AeBook%20Title:%20<?php echo strip_tags($ebook_title);?>%0AeISBN:%20<?php echo strip_tags($isbn);?>%0AeBook%20URL:%20<?php echo $url;?>%0A%0AThank%20you.%0A%0ASincerely,%0A%5BPLEASE%20INSERT%20YOUR%20NAME%20AND%20CONTACT%20ADDRESS%5D">Recommend this Book to your Library</a></p> 
				
			
			@endif
        </div>
			
	        @if(empty($bundle_content) || $bundle_content->ebook==0)
			<div class="col-md-4 offset-md-1 d-flex align-items-center">
				<div class="list-group bg-transparent">	
				<div href="#" class="list-group-item list-group-item-action bg-siteblue text-white">
				  <h5 class="m-0">Book Web Price: <span class="float-right">US $</span></h5>
				</div>								
					
							  {{ Form::open(array('id'=>"addtocartForm",'method' => 'POST','route' => 'cart.store')) }}
								<input type="hidden" value="{{csrf_token()}}" name="_token">
								<input type="hidden" name="param" value="{{Crypt::encrypt($ebook_volume_details[0]->nid)}}">
								<button type="submit" class="list-group-item list-group-item-action hvr-grow">Buy Personal Book
					<span class="badge badge-secondary float-right">{{ $ebook_volume_details[0]->ebook_price }}</span>
					</button>
							  {{ Form::close() }}
				  

					@if(($ebook_volume_details[0]->ebook_price * 4) > 0)		  
				  <a href="/order_ebook/{{ $ebook_volume_details[0]->ebook_volume_id }}" class="list-group-item list-group-item-action hvr-grow">Order Library eBook <span class="badge badge-secondary float-right">{{ $ebook_volume_details[0]->ebook_price * 4 }}</span></a>
				  @endif
				  	
					@if ($ebook_volume_details[0]->ebook_price_pod > 0)
						
				  <a href="/order_print_version/{{ $ebook_volume_details[0]->ebook_volume_id }}/POD" class="list-group-item list-group-item-action hvr-grow">Order Printed Copy <span class="badge badge-secondary float-right">{{ $ebook_volume_details[0]->ebook_price_pod }}</span></a>
				  @endif

				  @if ($ebook_volume_details[0]->ebook_price_podandpdf > 0)
				  <a class="list-group-item list-group-item-action bg-siteblue text-white hvr-grow" href="/order_print_version/{{ $ebook_volume_details[0]->ebook_volume_id }}/PODandPDF">
				  Order Ebook + Hard Copy  
				  <span class="badge badge-secondary float-right"><del>{{ $discount['total_net_price'] }}</del></span><br> 
				  <h5>After {{ $discount['total_net_discount'] }}% Discount <span class="badge badge-light float-right">{{ $ebook_volume_details[0]->ebook_price_podandpdf }}</span> 
				  <i class="fas fa-arrow-circle-down"></i></h5></a>
				  @endif

				
				@if(!empty($ebook_volume_details[0]->amazon_kindle))
				  <a href="{{$ebook_volume_details[0]->amazon_kindle}}" class="list-group-item list-group-item-action hvr-grow">Also available on Amazon Kindle <i class="fab fa-amazon float-right"></i></a>
				@endif

				@if(!empty($ebook_volume_details[0]->amazon_paperback))
				  <a href="{{$ebook_volume_details[0]->amazon_paperback}}" class="list-group-item list-group-item-action hvr-grow">Also available on Amazon Paperback<i class="fab fa-amazon float-right"></i></a>
				@endif
				
				</div>
			</div>
	        @else
			<div class="col-md-4 offset-md-1 d-flex align-items-top">
				<div class="list-group bg-transparent">

				  <div href="#" class="list-group-item list-group-item-action bg-siteblue text-white">
				  <h5 class="m-0">Book Web Price: <span class="float-right">US $</span></h5>
				  
				  </div>					  
					{{ Form::open(array('method' => 'POST','route' => 'download_volume_bundle_file','id' => 'download-form-pdf')) }}
					<input type="hidden" name="agree-flag" id="agree-flag" value="1">
		            <input type="hidden" name="bundle_offer_order_id" id="bundle_offer_order_id" value="{{$bundle_content->bundle_offer_order_id}}"> 
					<input type="hidden" name="param" value="{{Crypt::encrypt($ebook_volume_details[0]->ebook_volume_id.'||'.'pdf'.'||'.$bundle_content->content_download_type.'||')}}">

					<button type="submit" id="pdf" class="list-group-item list-group-item-action hvr-grow">Download PDF File <i class="fas fa-download"></i></button>
					{{ Form::close() }}


				</div>
			</div>								

	        @endif
		</div>
      </div>
    </section>
      @if (Session::has('message'))
      <div class="alert alert-danger alert-dismissible fade show" data-auto-dismiss="5000" role="alert">
      <b>Attention!</b>{{ Session::get('message') }}         
         <button type="button" class="close" data-dismiss="alert" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      @endif
