@extends('layouts.app')

@section('title')

Download Article

@parent
@stop

{{-- page level styles --}}
@section('header_styles')
<!--page level css -->
<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">


<!--end of page level css-->
@stop

@section('content')

<main>

  <section>
    <div class="container">

    @if(isset($download_type['content_type']) && $download_type['content_type'] == 'article')
    
      <h4>Download Article</h4>

    @elseif(isset($download_type['content_type']) && $download_type['content_type'] == 'chapter')
      
      <h4>Download Chapter</h4>
    
    @endif

      
      <div class="row">
          <div class="col-12 text-center ">
      @if (Session::get('message') == "Success")   
         <div  class="alert alert-success alert-dismissible fade show" role="alert">          
          
          @if(isset($download_type['content_type']) && $download_type['content_type'] == 'article')
          
			Downloading the article                   

          @elseif(isset($download_type['content_type']) && $download_type['content_type'] == 'chapter')
            
            Downloading the chapter

          @elseif(isset($download_type['content_type']) && $download_type['content_type'] == 'ebook_volume')
            
            Downloading the complete eBook
          
          @endif
          
          </div>
          <?php  Session::forget('message'); ?>
      @else   
         <div  class="alert alert-danger alert-dismissible fade show" role="alert">
          <b>Attention!</b> {{ Session::get('message') }}                   
		  <?php  Session::forget('message'); ?>
          </div>
      @endif

      @if(!empty($param))

        @if(isset($download_type['content_type']) && $download_type['content_type'] == 'article')
        
        {{ Form::open(array('method' => 'POST','route' => 'download_article','id' => 'download-form-pdf', 'id' => 'form1')) }}

        @elseif(isset($download_type['content_type']) && $download_type['content_type'] == 'chapter')
          
          {{ Form::open(array('method' => 'POST','route' => 'ebook_download_chapter','id' => 'download-form-pdf', 'id' => 'form1')) }}

        @elseif(isset($download_type['content_type']) && $download_type['content_type'] == 'ebook_volume')
          
          {{ Form::open(array('method' => 'POST','route' => 'download_volume_file','id' => 'download-form-pdf', 'id' => 'form1')) }}
        
        @endif
        
          <input type="hidden" name="param" value="{{$param}}">
          <input type="hidden" name="download_type" value="{{$download_type['type']}}">
          <input type="hidden" name="download_email" value="{{$download_type['user_email']}}">
          <input type="hidden" name="dduser" value="{{$download_type['user_id']}}">
        {{ Form::close() }}

        <script type="text/javascript">

          $('#form1').submit();

        </script>    
            
      @endif  
    </div>
  </div>
</div>
  </section>
</main>
  
  <!----Main Section Ends----> 

@endsection

{{-- page level scripts --}}
@section('footer_scripts')

@stop


