@extends('layouts.app')
@section('title')
Issue {{$issue->title}}, Volume {{$volume->volume_name}} - {{$journal->title}}
@parent
@stop
@section('content')

<!----Banner Section Starts----> 
    
  <!----Banner Section Starts----> 
    @include('includes.journal_banner')
  <!----Banner Section Ends---->

<!----Banner Section Ends----> 

<!----Main Section Starts (where all content bodies exist)----> 
<main id="issue">
  
   <section>
    <div class="container">
      <div class="row">
        <div class="col-md-8 listing">
          @if(isset($issue_type))
          <h3>{{$issue_type}}</h3>
          @endif
          <h4 >Volume {{$volume->volume_name}}, Issue {{$issue->title}}</h4>
          <hr>
          @foreach($articles as $article)
         <div class="card bigbox-hvr-slow">
          <div class="card-body">
            <span class="badge badge-pill badge-info mb-2">{{$article->article_type_name}}</span>
            <h4 class="card-title"><a href ="{{url('article')}}/{{$article->article_id}}">{!! $article->title !!}</a></h4>
          <p>Page: {{$article->first_page}}-{{$article->last_page}}<br>
            {{$AuthorNames = ''}}
          @foreach($authors as $author)
            @if($author->article_id == $article->article_id)
              
              @if($author->is_principle==1)
                @php $AuthorNames .= $author->authors.'*'. ',  '@endphp
              @else
                @php $AuthorNames .= $author->authors. ',  '@endphp
              @endif
            
            @endif
          @endforeach
          @php
          $AuthorNames = rtrim($AuthorNames, ', ');

          $pos = strrpos($AuthorNames, ",");
          @endphp
          @if($pos)

            @php
            $str = substr($AuthorNames,0,$pos);
            $str2 = substr($AuthorNames,$pos+1,strlen($AuthorNames));
            $author_name = $str." and ".$str2;
            @endphp

            {{$author_name}}

          @else 
          
          {{$AuthorNames}}

         @endif
         <br>
         Doi: <a href="http://dx.doi.org/{{$article->doi}}">{{$article->doi}}</a>
         
         @if($article->graph_abs_sm_filename != "")
         <br>
         <img src="/images/graphical-abstract/{{$journal->subtitle}}/{{$volume->volume_name}}/{{$issue->title}}/{{$article->graph_abs_sm_filename}}" class="img-thumbnail" />
         @endif

          </p>
          </div>
          <div class="card-footer text-muted">
            <a href="#" class="card-link text-dark">Mark Item</a>
            <a href="#" class="card-link text-dark">Purchase PDF</a>
          </div>
        </div>
        @endforeach

        </div>
        <div class="col-md-4">
          
          <div class="card bg-spring-green bigbox-hvr-slow">
              <div class="card-header">
              </div>
              <div class="card-body p-5">
                  <span class="p-5 m-5">Ads</span>   
              </div>
          </div>
        </div>
      </div>
    </div>
  </section>
  
</main>
</div>
<!----Main Section Starts----> 
<script type="text/javascript">
  $(function () {
  $('[data-toggle="popover"]').popover()
})
</script>
@endsection