@extends('layouts.app')
@section('title')
Payment Checkout
@parent
@stop
{{-- Page content --}}
@section('content')
<!----Banner Section Starts----> 
<style>
.btn-orange{
  color: #333;
  font-weight: 500;
  background: #f9bc43;
}
.btn-orange:hover, .btn-orange:focus{
  opacity: .9;
  color: #333;
}
</style>

<main id="cart">
  

  <section>
    <div class="container">
      
<div class="alert alert-info alert-dismissible fade show" role="alert">
 <b>Attention!</b> Your order is almost complete. Please review the details below and click 'Pay Via Card' if all the information is correct. You may use the 'Back' button to make changes to your order if necessary.
  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>

 
      <div class="row">
        
        <div class="col-md-8 shopitems">
          <h2 class="h4 p-3 bg-dark-light text-primary-light">Order Review </h2>
<?php
  $subtotal=0;
  $origional_subtotal=0;
?>        
@foreach($orderlist as $row)     
<div class="card bigbox-hvr-slow mt-4">
  <div class="card-body">   
    @if($row->discount!='N')
    <span class="badge badge-pill badge-info mb-2">Discounted Item</span>
    @endif
    @if($row->item_type=='article')
    <h6 class="card-title"><a href="/node/{{$row->nid}}"><strong>Article:</strong> {{$row->item_title}}</a></h6>  
    <p>Journal: {{$row->journal_ebook_title}}</p>
    <div class="row">
      <div class="col-md-3"><p><strong>Volume:</strong> {{$row->volume}}</p></div>
      <div class="col-md-3"><p><strong>Issue:</strong> {{$row->issue}}</p></div>      
      <div class="col-md-3"> <p><strong>Qty:</strong> {{$row->qty}}</p></div>
    </div>  
    <span class="pricetag">$ {{$row->item_price*$row->qty}}.00</span>
    <?php
        $subtotal = round(($row->item_price*$row->qty)+$subtotal);
        $origional_subtotal = round(($row->item_cost*$row->qty)+$origional_subtotal);
    ?>
    @endif
    @if($row->item_type=='chapter')
    <h6 class="card-title"><a href="/node/{{$row->nid}}"><strong>Chapter:</strong> {{$row->item_title}}</a></h6>  
    <p><strong>Book:</strong> {{$row->journal_ebook_title}}</p>
    <div class="row">
      <div class="col-md-3"><p><strong>Volume:</strong> {{$row->volume}}</p></div>       
      <div class="col-md-3"> <p><strong>Qty:</strong> {{$row->qty}}</p></div>
    </div>  
    <span class="pricetag">$ {{$row->item_price*$row->qty}}.00</span>
    <?php
        $subtotal = round(($row->item_price*$row->qty)+$subtotal);
        $origional_subtotal = round(($row->item_cost*$row->qty)+$origional_subtotal);
    ?>
    @endif
    @if($row->item_type=='ebook_volume')
    <h6 class="card-title"><a href="/node/{{$row->nid}}"><strong>Complete Book:</strong> {{$row->journal_ebook_title}}</a></h6>      
    <div class="row">
      <div class="col-md-3"><p><strong>Volume:</strong> {{$row->volume}}</p></div>       
      <div class="col-md-3"> <p><strong>Qty:</strong> {{$row->qty}}</p></div>
    </div>  
    <span class="pricetag">
      @if($row->discount!='N' && session()->has('original_price'))
      <del class="text-red"><?php
            $original_price = session()->get('original_price');
      ?>
        $ {{$original_price}}.00
      </del> 
      @endif
      $ {{$row->item_price*$row->qty}}.00</span>
    <?php
        $subtotal = round(($row->item_price*$row->qty)+$subtotal);
        $origional_subtotal = round(($row->item_cost*$row->qty)+$origional_subtotal);
    ?>
    @endif
  </div>
</div>

@endforeach

        </div>
        <div class="col-md-4">
        <h4 class="text-primary-light">Payment Information</h4>
            
            <hr> 
          
          <div class="card bg-spring-green bigbox-hvr-slow">
              
              <ul class="list-group list-group-flush">                
  <li class="list-group-item lead py-4">Subtotal <span class="badge badge-primary-light text-white float-right mt-1">$ {{$origional_subtotal}}.00</span></li>  
@if($promodiscount && !(session()->has('original_price')))
  <li class="list-group-item lead py-4">Promotion Discount <span class="badge badge-primary-light float-right mt-1">{{$promodiscount}}% 
  @endif
<?php $total = $subtotal;
      $origional_total = $origional_subtotal;
?>

  <li class="list-group-item lead py-4"><strong>Total <span class="float-right mt-1">$ {{$total}}.00</span></strong></li>
</ul>
          </div>

          <form id="addtocartForm" action="{{ url('/cart/proceed') }}" method="POST">
          <input type="hidden" name="_token" value="{{ csrf_token() }}">
          <input type="hidden" name="param" value="{{Crypt::encrypt($order_id)}}">
          <button type="submit" name="back" value="back" class="btn bg-primary-light btn-block mt-4 btn-lg text-white"><i class="fas fa-angle-left"></i> Back </button>
          <button type="submit" name="paypal" value="paypal" class="btn btn-orange btn-block btn-lg">Payment Via PayPal <i class="fab fa-cc-paypal"></i></button>
          
          <button type="submit" name="migs" value="migs" class="btn btn-dark btn-block btn-lg">Pay Via Card <i class="fas fa-credit-card"></i></button>
          </form> 

        </div>
      </div>
      <br><br>
<span class=" text-danger">In case of any problems in card payments please pay via PayPal. If you still have any problems please contact us at <a href="mailto:support@benthamscience.net">support@benthamscience.net</a>.</span>

       



    </div>
  </section>
  
</main>

<!----Main Section Starts----> 
@endsection