 <div class="row">

   <div class="col-md-8 listing order-1">

     @if(!empty($searchvalue))
     <h2 class="h4">Search Result @if($searchvalue)<span class="text-primary">"{{$searchvalue}}"</span>@endif</h2>
     @endif
     @if($found>0)

     <form id="downloadFile" method="post" action="{{ route('searchdownloadfiles') }}" style="display: none;">
       @csrf
       <input type="hidden" id="articleIds" name="articleIds">
       <input type="hidden" id="chapterIds" name="chapterIds">
       <label class="d-inline-flex mt-3"><input type="checkbox" class="main-checkbox mr-2" style="width: 18px; height: 18px;"> Check All</label>
       <button class="btn btn-success exportButton ml-2" type="submit" name="exportButton" value="exportButton">Download<i class="fa-solid fa-download ml-2"></i></button>
       <a class="btn btn-success ml-2" href="javascript:void(0);" data-toggle="modal" data-target="#citeExportWindow">Export<i class="fa-solid fa-download ml-2"></i></a>
     </form>

     <!-- Cite Modal for all article -->
     <div class="modal fade" id="citeExportWindow" role="dialog">
       <div class="modal-dialog">
         <div class="modal-content">
           <div class="modal-header">
             <h4 class="modal-title">Export Options</h4>
             <button type="button" class="close" data-dismiss="modal" aria-label="Close">
               <span aria-hidden="true">&times;</span>
             </button>
           </div>
           <div class="modal-body">
             <form id="citedownloadFile" method="post" action="{{ route('searchcitation') }}" enctype="multipart/form-data" accept-charset="UTF-8">
               @csrf
               <input type="hidden" id="citearticleIds" name="citearticleIds">

               <div class="form-group">
                 <label><strong>Export File:</strong></label>
                 <div class="custom-control custom-radio">
                   <input type="radio" id="export-file-ris" name="export_file" value="ris" checked class="custom-control-input">
                   <label class="custom-control-label" for="export-file-ris">RIS (for EndNote, Reference Manager, ProCite)</label>
                 </div>
                 <div class="custom-control custom-radio">
                   <input type="radio" id="export-file-bibtex" name="export_file" value="bibtex" class="custom-control-input">
                   <label class="custom-control-label" for="export-file-bibtex">BibTeX</label>
                 </div>
                 <div class="custom-control custom-radio">
                   <input type="radio" id="export-file-text" name="export_file" value="text" class="custom-control-input">
                   <label class="custom-control-label" for="export-file-text">Text</label>
                 </div>
               </div>

               <div class="form-group">
                 <label><strong>Content:</strong></label>
                 <div class="custom-control custom-radio">
                   <input type="radio" id="content-citation" name="content" value="citation" class="custom-control-input">
                   <label class="custom-control-label" for="content-citation">Citation Only</label>
                 </div>
                 <div class="custom-control custom-radio">
                   <input type="radio" id="content-citation-abstract" name="content" value="citation_abstract" checked class="custom-control-input">
                   <label class="custom-control-label" for="content-citation-abstract">Citation and Abstract</label>
                 </div>
               </div>

               <input type="submit" name="op" id="citeExport" value="Export" class="btn btn-outline-primary float-right citeExport">
               <input type="hidden" name="export_file_hidden" id="edit-export-file-hidden" value="">
               <input type="hidden" name="content_hidden" id="edit-content-hidden" value="">
               <input type="hidden" name="form_build_id" id="form" value="form">
               <input type="hidden" name="form_id" id="edit-export-citation-form" value="export_citation_form">
             </form>
           </div>
         </div>
       </div>
     </div>

     @endif
     <hr>
     @php $custom_from_year="";
     $custom_to_year="";
     @endphp
     @if($found>0)




     @if(isset($journal_title) && !empty($journal_title))
     <div class="card bigbox-hvr-slow">

       <div class="card-body">

         <h4 class="card-title"><a href="{{url('journal')}}/{{strtolower($journal_title->subtitle)}}"><strong>Journal:</strong> {!!$journal_title->title!!}</a></h4>
         <p class="mb-2"><strong>ISSN (Print):</strong> {{$journal_title->issn}}<br>
           <strong>ISSN (Online):</strong> {{$journal_title->eissn}}<br>

           @isset($latest_issue[0]->issue_id)
           <strong> Volume</strong> {{$latest_issue[0]->volume_name}} , <strong>Issues</strong> {{$latest_issue[0]->total_no_of_issues}}, {{$latest_issue[0]->year}}
           @endisset
         </p>
       </div>
     </div>
     @endif


     @for($i = 0; $i < $size; $i++) <?php

                                    $author = '';

                                    $first_page = '';

                                    $last_page = '';

                                    $title = '';

                                    if (isset($print->hits->hit[$i]->fields->title)) {

                                      $title = $print->hits->hit[$i]->fields->title;
                                    }

                                    if (isset($print->hits->hit[$i]->fields->first_page)) {

                                      $first_page = $print->hits->hit[$i]->fields->first_page;

                                      $last_page  = $print->hits->hit[$i]->fields->last_page;
                                    }

                                    if (isset($print->hits->hit[$i]->fields->author)) {

                                      $author     = $print->hits->hit[$i]->fields->author ? $print->hits->hit[$i]->fields->author : array(0);

                                      $author     = implode(',', $author);
                                    }

                                    $doi        = $print->hits->hit[$i]->fields->doi;

                                    $art_obj = \App\Models\Article::GetArticleByDOI($doi);
                                    $nid        = $print->hits->hit[$i]->fields->nid;
                                    if (empty($art_obj)) {
                                      $article_id        = $print->hits->hit[$i]->fields->id;
                                    } else {
                                      $article_id        = $art_obj->article_id;
                                    }

                                    $genre        = $print->hits->hit[$i]->fields->genre;

                                    $journal_ebook_title = $print->hits->hit[$i]->fields->journal_ebook_title;

                                    $volume_title = $print->hits->hit[$i]->fields->volume_title;

                                    $issue_title = $print->hits->hit[$i]->fields->issue_title;

                                    $volumeyear = $print->hits->hit[$i]->fields->volumeyear;
                                    $facets = $print->facets;

                                    // Sort the volumeyear bucket by the 'value(year)' key
                                    usort($facets->volumeyear->buckets, function ($a, $b) {
                                      return $b->value <=> $a->value;
                                    });




                                    //$title = preg_replace("/\p{L}*?".preg_quote($searchvalue)."\p{L}*/ui", "<strong><i>$0</i></strong>", $title);
                                    $title = preg_replace("/" . preg_quote($searchvalue, "/") . "/ui", "<strong style='background-color:yellow'><i>$0</i></strong>", $title);
                                    if ($genre == 'article') {

                                      $article = \App\Models\Article::where(['article_id' => $article_id])->first();

                                      if ($article) {


                                        $data = app('App\Http\Controllers\SearchController')->GetSearchArticleAccess($article_id);

                                        $param = encrypt(array('readpdf', $data['article']->article_id, config('constants.admin.token'), $data['content_download_type']));

                                    ?> <div class="card bigbox-hvr-slow">

       <div class="card-body">
         <span class="badge badge-pill badge-info mb-2">{{$data['article']->type_name}}</span>
         <span class="badge badge-pill badge-danger float-right">{{$data['access_base_text']}}</span>

         <h4 class="card-title"><a href="{{url('article')}}/{{$article_id}}">{!!$title!!}</a></h4>

         <p class="details"><strong>Journal:</strong> {!!$journal_ebook_title!!}<br>

           <strong>Volume:</strong> {{$volume_title}} <strong>Issue:</strong> {{$issue_title}} <strong>Year:</strong> {{$volumeyear}} <strong>Page:</strong> {{$first_page}}-{{$last_page}}<br>

           <strong>Author(s):</strong> {{$author}} <!--br>

              <strong>Doi:</strong> <a href="http://dx.doi.org/{{$doi}}">{{$doi}}</a-->

         </p>
       </div>
       <div class="card-footer text-muted d-flex p-0">

         @if(isset($data['DownloadAccess']) && $data['DownloadAccess'] > 0)

         @if($data['DownloadAccess']) {{-- Trail Access Show Popup --}}

         @php $checklicense = '';//'javascript:return CheckLicense(this.id)'; @endphp

         @else {{-- Single/Multiple Token Access Show Login Popup --}}

         @php
         $checklicense ='';
         $D_key = false;

         if (isset($data['type']) && ($data['type'] == 444 || $data['type'] == 555))
         {
         $D_key = true;

         }

         if($data['access_base_text']==="Token Based Access" && $D_key == true){
         $checklicense ="javascript:return LoginToDownload('download_hide_".$data['article']->article_id."')";
         }
         @endphp

         @endif

         <form class="mb-0" method="POST" action="{{ route('download_article') }}" id="download-form-{{ $data['article']->article_id }}">
         <input type="hidden" value="{{csrf_token()}}" name="_token">
         <input type="hidden" name="agree-flag" id="agree-flag" value="1">
         <input type="hidden" name="param" value="{{Crypt::encrypt($data['article']->article_id.'||'.'pdf'.'||'.$data['content_download_type'].'||'.$data['restricted_user_access_key'].'||'.$data['user_access_id'] )}}">

         <!-- if User Access Info View Option is zero than allow to download-->
         @if($data['view_option']==0)
         <div class="input-group input-group-md">
           <div class="input-group-prepend">
             <div class="input-group-text">
               <input type="checkbox" class="download-article-file sub-checkbox" data-type="article" value="{{Crypt::encrypt($data['article']->article_id.'||'.'pdf'.'||'.$data['content_download_type'].'||'.$data['restricted_user_access_key'].'||'.$data['user_access_id'] )}}"> <i class="fa-solid fa-file-pdf fa-1x ml-2"></i>
             </div>
             <button type="submit" id="{{$data['article']->article_id}}" name="download{{$data['article']->article_id}}" class="btn btn-primary bg-siteblue" onclick="{{$checklicense}}">Download <i class="fa-solid fa-download ml-1"></i></button>
           </div>
         </div>
         @elseif($val->view_option==1)
         <a type="button" id="readpdf_{{$data['article']->article_id}}" name="download{{$data['article']->article_id}}" class="card-link btn btn-outline-primary border-0 py-2 px-4" href="{{route('article', ['article_id' => $data['article']->article_id,'param' => $param])}}" onclick="{{$checklicense}}">Read Article</a>
         @endif
         </form>

         <!-- Model Window Start -->
         <form method="POST" action="{{ route('download_article') }}" id="download-form-pdf">
           @csrf
         <input type="hidden" name="agree-flag" id="agree-flag" value="1">
         <input type="hidden" name="param" value="{{Crypt::encrypt($data['article']->article_id.'||'.'pdf'.'||'.$data['content_download_type'].'||'.$data['restricted_user_access_key'].'||'.$data['user_access_id'] )}}">
         <div class="modal fade" id="download_hide_{{$data['article']->article_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
           <div class="modal-dialog">
             <div class="modal-content">
               <div class='modal-header bg-primary'>
                 <h4 class="modal-title text-white" id="modalLabelprimary">Restricted Access Panel</h4>
                 <button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button>
               </div>
               <div class='modal-body'>
                 <label class="control-label">Content Access Key</label>
                 <input type="text" name="user_name" class="form-control">
                 <label class="control-label">Password</label>
                 <input type="password" name="password" class="form-control">
               </div> <!-- /.modal-body -->
               <div class="modal-footer">
                 <button type="submit" class="btn btn-primary" onclick="javascript: $('#download_hide_{{$data['article']->article_id}}').modal('hide');"><span class="glyphicon glyphicon-remove-circle"></span> Login to Download</button>
                 <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove-circle"></span> Close</button>

               </div>
             </div>
           </div>
         </div>
         </form>
         <!-- Model Window End -->

         @else
         @if(empty($data['bundle_content']) || $data['bundle_content']->article==0)
         <!--button href="#" class="card-link text-dark">Add to Wish List</button-->
         @if($data['checkIfMarked'])
         @endif
         @else
         <form class="mb-0" method="POST" action="{{ route('download_bundle_file') }}" id="download-form-{{ $data['article']->article_id }}">
         <input type="hidden" value="{{csrf_token()}}" name="_token">
         <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="{{$data['bundle_content']->bundle_offer_order_id}}">
         <input type="hidden" name="param" value="{{Crypt::encrypt($data['article']->article_id.'||'.'pdf'.'||'.$data['bundle_content']->content_download_type.'||'.$data['restricted_user_access_key'].'||'.$data['user_access_id'] )}}">
         <button type="submit" id="{{$data['article']->article_id}}" name="download{{$data['article']->article_id}}" class="card-link text-dark">Download PDF File</button>
         </form>
         @endif

         @endif

         <a class="btn btn-outline-dark align-content-center rights-link" href="javascript:void(0);" data-issn="{{ str_replace('-', '', $article->issn) }}" data-doi="{{ $article->doi }}">Rights & Permissions</a>
         <a class="btn btn-outline-dark align-content-center" href="javascript:void(0);" data-toggle="modal" data-target="#ExportWindow{{ $article->article_id }}">Cite</a>

         <!-- Cite Modal for each article -->
         <div class="modal fade" id="ExportWindow{{ $article->article_id }}" role="dialog">
           <div class="modal-dialog">
             <div class="modal-content">
               <div class="modal-header">
                 <h4 class="modal-title">Export Options</h4>
                 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                   <span aria-hidden="true">&times;</span>
                 </button>
               </div>
               <div class="modal-body">
                 <form method="post" action="{{ route('citation') }}" enctype="multipart/form-data" accept-charset="UTF-8" id="export-citation-form-{{ $article->article_id }}">
                   @csrf
                   <input type="hidden" name="article_id" value="{{ $article->article_id }}">

                   <div class="form-group">
                     <label><strong>Export File:</strong></label>
                     <div class="custom-control custom-radio">
                       <input type="radio" id="export-file-ris-{{ $article->article_id }}" name="export_file" value="ris" checked class="custom-control-input">
                       <label class="custom-control-label" for="export-file-ris-{{ $article->article_id }}">RIS (for EndNote, Reference Manager, ProCite)</label>
                     </div>
                     <div class="custom-control custom-radio">
                       <input type="radio" id="export-file-bibtex-{{ $article->article_id }}" name="export_file" value="bibtex" class="custom-control-input">
                       <label class="custom-control-label" for="export-file-bibtex-{{ $article->article_id }}">BibTeX</label>
                     </div>
                     <div class="custom-control custom-radio">
                       <input type="radio" id="export-file-text-{{ $article->article_id }}" name="export_file" value="text" class="custom-control-input">
                       <label class="custom-control-label" for="export-file-text-{{ $article->article_id }}">Text</label>
                     </div>
                   </div>

                   <div class="form-group">
                     <label><strong>Content:</strong></label>
                     <div class="custom-control custom-radio">
                       <input type="radio" id="content-citation-{{ $article->article_id }}" name="content" value="citation" class="custom-control-input">
                       <label class="custom-control-label" for="content-citation-{{ $article->article_id }}">Citation Only</label>
                     </div>
                     <div class="custom-control custom-radio">
                       <input type="radio" id="content-citation-abstract-{{ $article->article_id }}" name="content" value="citation_abstract" checked class="custom-control-input">
                       <label class="custom-control-label" for="content-citation-abstract-{{ $article->article_id }}">Citation and Abstract</label>
                     </div>
                   </div>

                   <input type="submit" name="op" id="edit-export" value="Export" onclick="return checkciteradio('{{ $article->article_id }}')" class="btn btn-outline-primary float-right">
                   <input type="hidden" name="export_file_hidden" id="edit-export-file-hidden-{{ $article->article_id }}" value="">
                   <input type="hidden" name="content_hidden" id="edit-content-hidden-{{ $article->article_id }}" value="">
                   <input type="hidden" name="form_build_id" id="form-{{ $article->article_id }}" value="form-{{ $article->article_id }}">
                   <input type="hidden" name="form_id" id="edit-export-citation-form-{{ $article->article_id }}" value="export_citation_form">
                 </form>
               </div>
             </div>
           </div>
         </div>

       </div>

       <!-- --------------Trial Trial Terms Condition------------------------- -->
       @if (isset($val->type) && $val->type == 111)
		   {{--
        <!-------------By Jalil Sahib Instruction------------
                Email Subject: Fwd: Changes Suggested on Eurekaselecet
                Dated: From Mohammad Azhar on 2022-02-08 18:01
                ---------------------------------------------------->
       <a id="license{{$data['article']->article_id}}" href="{{route('termstrial', ['access_type' => $data['type'],'content_id' => $data['article']->article_id,'param' => $param])}}"></a>
	   --}}
       @else
		{{--
       <a id="license{{$data['article']->article_id}}" href="{{route('terms', ['content_id' => $data['article']->article_id,'param' => $param])}}"></a>
	   --}}
       @endif



       <div style="text-align:left;" class="modal fade" id="TnCModal" tabindex="-1" role="dialog" aria-labelledby="TnCModalLabel" aria-hidden="true">
         <div class="modal-dialog modal-lg">
           <div class="modal-content">
           </div> <!-- /.modal-content -->
         </div> <!-- /.modal-dialog -->
       </div>

       <input type="hidden" name="license_downloadid" id="license_downloadid" value="0">

   </div>

 <?php }
                                    }
                                    if ($genre == 'chapter') {

                                      $chapter_id = $article_id;

                                      $cdata = app('App\Http\Controllers\SearchController')->GetSearchChapterAccess($chapter_id);
                                      if ($cdata) {
                                        $DownloadAccess = $cdata['DownloadAccess'];
                                        $terms_popup = $cdata['terms_popup'];
                                        $chapter_details = $cdata['chapter_details'];
                                        $view_option = $cdata['view_option'];
                                        $access_base_text = $cdata['access_base_text'];
                                        $checkLoginFlag = false;
                                        $content_download_type = $cdata['content_download_type'];

  ?>

   <div class="card bigbox-hvr-slow">

     <div class="card-body">
       <span class="badge badge-pill badge-danger float-right">{{$access_base_text}}</span>
       <h4 class="card-title"><a href="{{url('chapter')}}/{{$chapter_id}}">{!!$title!!}</a></h4>

       <p class="details"><strong>Ebook:</strong> {!!$journal_ebook_title!!}<br>

         <strong>Volume:</strong> {{$volume_title}} <strong>Year:</strong> {{$volumeyear}} <br>

         <strong>Author(s):</strong> {{$author}} <br>

         <strong>Doi:</strong> <a href="http://dx.doi.org/{{$doi}}">{{$doi}}</a>
       </p>
     </div>
     <div class="card-footer text-muted p-0">
       @if((isset($DownloadAccess) && $DownloadAccess > 0))

       @if($terms_popup)
       @php
       $checklicense = 'javascript:return CheckLicense(this.id)';
       @endphp
       @else
       @php
       $checklicense ='';
       @endphp
       @endif
       @endif
       @if((isset($DownloadAccess) && $DownloadAccess > 0) && $view_option==0)
       <form class="mb-0" method="POST" action="{{ route('ebook_download_chapter') }}" id="download-form-pdf">
         @csrf
       <input type="hidden" name="agree-flag" id="agree-flag" value="1">
       <input type="hidden" name="param" value="{{Crypt::encrypt($chapter_details->chapter_id.'||'.'pdf'.'||'.$content_download_type.'||'.$chapter_details->restricted_user_access_key.'||'.$chapter_details->user_access_id)}}">
       @if($view_option==0)
       <div class="input-group input-group-md">
         <div class="input-group-prepend">
           <div class="input-group-text">
             <input type="checkbox" class="download-chapter-file sub-checkbox" data-type="chapter" value="{{Crypt::encrypt($chapter_details->chapter_id.'||'.'pdf'.'||'.$content_download_type.'||'.$chapter_details->restricted_user_access_key.'||'.$chapter_details->user_access_id)}}"> <i class="fa-solid fa-file-pdf fa-1x ml-2"></i>
           </div>
           <button type="submit" id="{{$chapter_details->chapter_id}}" name="download{{$chapter_details->chapter_id}}" class="btn btn-primary bg-siteblue" onclick="{{$checklicense}}">Download <i class="fa-solid fa-download ml-1"></i></button>
         </div>
       </div>
       @elseif($view_option==1)
       <a type="button" id="readpdf_{{$chapter_details->chapter_id}}" name="download{{$chapter_details->chapter_id}}" class="card-link btn btn-outline-primary border-0 py-2 px-4" href="{{route('article', ['article_id' => $data['article']->article_id,'param' => $param])}}" onclick="{{$checklicense}}">Read Chapter</a>
       @endif
       </form>

       @elseif((isset($DownloadAccess) && $DownloadAccess > 0) && ($content_download_type != 'F' && $content_download_type != 'FO') && $view_option==1)
       @php
       $cparam=encrypt(array('readchapterpdf',$chapter_details->chapter_id,config('constants.admin.token'),$content_download_type));
       @endphp


       <a class="card-link btn btn-outline-primary border-0 py-2 px-4" id="readpdf_{{$chapter_details->chapter_id}}" href="{{route('chapter', ['id' => $chapter_details->chapter_id,'param' => $cparam])}}" role="button" id="dropdownMenuLink" aria-haspopup="true" aria-expanded="false" onclick="{{$checklicense}}">
         Read Chapter
       </a>


       @endif







     </div>

   </div>

 <?php }
                                    }
                                    if ($genre == 'ebookvolume') {

                                      $ebook_volume_id = $article_id;

                                      $edata = app('App\Http\Controllers\SearchController')->GetSearchEbookVolumeAccess($ebook_volume_id);
                                      if ($edata) {
                                        $VolumeDownloadAccess = $edata['VolumeDownloadAccess'];
                                        $terms_popup = $edata['terms_popup'];
                                        $ebook_volume_details = $edata['ebook_volume_details'];
                                        $view_option = $edata['view_option'];
                                        $access_base_text = $edata['access_base_text'];
                                        $restricted_user_access_key = $edata['restricted_user_access_key'];
                                        $user_access_id = $edata['user_access_id'];
                                        $checkLoginFlag = false;
                                        $content_download_type = $edata['content_download_type'];
  ?>

   <div class="card bigbox-hvr-slow">

     <div class="card-body">
       <span class="badge badge-pill badge-danger float-right">{{$access_base_text}}</span>
       <h4 class="card-title"><a href="{{url('ebook_volume')}}/{{$ebook_volume_id}}">{!!$title!!}</a></h4>

       <p class="details"><strong>Ebook:</strong> {!!$journal_ebook_title!!}<br></p>

       <strong>Volume:</strong> {{$volume_title}} <strong>Year:</strong> {{$volumeyear}} <br>

       <strong>Author(s):</strong> {{$author}} <br>

       <strong>Doi:</strong> <a href="http://dx.doi.org/{{$doi}}">{{$doi}}</a>
     </div>
     <div class="card-footer text-muted p-0">
       @if((isset($VolumeDownloadAccess) && $VolumeDownloadAccess > 0))

       @if($terms_popup)
       @php
       $checklicense = 'javascript:return CheckLicense(this.id)';
       @endphp
       @else
       @php
       $checklicense ='';
       @endphp
       @endif
       @endif

       @if((isset($VolumeDownloadAccess) && $VolumeDownloadAccess > 0) && $view_option==0)
       <form class="mb-0" method="POST" action="{{ route('download_volume_file') }}" id="download-form-pdf">
         @csrf
       <input type="hidden" name="agree-flag" id="agree-flag" value="1">
       <input type="hidden" name="param" value="{{Crypt::encrypt($ebook_volume_details->ebook_volume_id.'||'.'pdf'.'||'.$content_download_type.'||'.$restricted_user_access_key.'||'.$user_access_id)}}">

       <button type="submit" id="{{$ebook_volume_details->ebook_volume_id}}" name="download{{$ebook_volume_details->ebook_volume_id}}" class="card-link btn btn-outline-primary border-0 py-2 px-4" onclick="{{$checklicense}}">Download Book </button>
       @endif
       </form>





     </div>

   </div>

 <?php }
                                    } ?>



 @endfor



 @include('pagination')

 @endif


 </div>


 @if(isset($facets))
 @php
 parse_str($pagename, $pagenameVars);
 $custom_from_year = $pagenameVars['fromyear'];
 $custom_to_year = $pagenameVars['toyear'];
 $article_type_id = $pagenameVars['article_type_id'];
 $journal_id = $pagenameVars['journal_id'];
 $subject_id = $pagenameVars['subject_id'];
 $include = $pagenameVars['include'];
 @endphp
 <div class="col-md-4 order-0">

   <div class="card bg-spring-green ">
     <div class="card-header bg-siteblue text-white">
       <h4 class="mb-0">Apply Filters <i class="fa fa-filter float-right"></i></h4>
     </div>
     <div class="card-body">
       @if(count($facets->volumeyear->buckets) > 0)
       <span class="mt-3 pb-1 font-20 fw-bold d-block">Volume Years </span>
       <ul class="list-group list-group-flush">
         @php
         parse_str($pagename, $pagenameVars);
         $cnt = 0;
         $collapseStarted = false;
         $fromyear_check=$pagenameVars['fromyear'];
         $toyear_check=$pagenameVars['toyear'];
         @endphp
         @foreach($facets->volumeyear->buckets as $vyear)
         @php
         unset($pagenameVars['/search?xe']);
         $pagenameVars['fromyear']=$vyear->value;
         $pagenameVars['toyear']=$vyear->value;
         $pagenameVars['btnjournalsearch']='advance_search';
         if($pagenameVars['article_type_id'] == 0 && $pagenameVars['journal_id'] == 0 && $pagenameVars['include'] == 0){
         $pagenameVars['include'] = 1;
         }
         $pagename = http_build_query($pagenameVars,'&amp;','&');
         @endphp
         @if($cnt < 3) <div class="list-group-item custom-control custom-checkbox pl-4">
           <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox1{{$vyear->value}}" @if($fromyear_check==$toyear_check && $fromyear_check==$vyear->value && $toyear_check == $vyear->value) checked @endif>
           <label class="custom-control-label font-16" for="checkbox1{{$vyear->value}}">{{$vyear->value}} <span class="badge badge-secondary ml-2 py-1">{{$vyear->count}}</span></label>
     </div>
     @else
     @if (!$collapseStarted)
     <div class="collapse" id="collapseVolumeYear">
       @php
       $collapseStarted = true;
       @endphp
       @endif
       <div class="list-group-item custom-control custom-checkbox pl-4">
         <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox1{{$vyear->value}}">
         <label class="custom-control-label font-16" for="checkbox1{{$vyear->value}}">{{$vyear->value}} <span class="badge badge-secondary ml-2 py-1">{{$vyear->count}}</span></label>
       </div>
       @endif
       @php
       $cnt++;
       @endphp
       @endforeach
       @if ($collapseStarted)
     </div>
     @endif
     </ul>
     @if(count($facets->volumeyear->buckets) > 3)
     <a class="btn btn-link d-flex text-dark" data-toggle="collapse" href="#collapseVolumeYear" role="button" aria-expanded="false" aria-controls="collapseVolumeYear">
       <span class="volume-year">See more</span><i class="fa fa-chevron-right ml-1 mt-1"></i>
     </a>
     @endif
     @endif



     @if(count($article_type_facet) > 0)
     <span class="mt-4 pb-1 font-20 fw-bold d-block">Article Type</span>
     <ul class="list-group list-group-flush">
       @php
       $cnt = 0;
       $collapseStarted = false;
       $article_type_id_check=$pagenameVars['article_type_id'];
       @endphp
       @foreach($article_type_facet as $typecount)

       @php
       unset($pagenameVars['/search?xe']);
       $pagenameVars['fromyear']=$custom_from_year;
       $pagenameVars['toyear']=$custom_to_year;
       $pagenameVars['journal_id']=$journal_id;
       $pagenameVars['subject_id']=$subject_id;
       $pagenameVars['article_type_id']=$typecount['article_type_id'];
       $pagenameVars['include']=2;

       $pagenameVars['btnjournalsearch']='advance_search';
       $pagename = http_build_query($pagenameVars,'&amp;','&');
       @endphp

       @if($cnt < 3) <div class="list-group-item custom-control custom-checkbox pl-4">
         <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox2{{$typecount['article_type_name']}}" @if($article_type_id_check !=0) && $article_type_id_check==$typecount['article_type_id'] checked @endif>
         <label class="custom-control-label font-16" for="checkbox2{{$typecount['article_type_name']}}">{{$typecount['article_type_name']}} <span class="badge badge-secondary ml-2 py-1">{{$typecount['count']}}</span></label>
   </div>
   @else
   @if (!$collapseStarted)
   <div class="collapse" id="collapseArticleType">
     @php
     $collapseStarted = true;
     @endphp
     @endif
     <div class="list-group-item custom-control custom-checkbox pl-4">
       <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox2{{$typecount['article_type_name']}}">
       <label class="custom-control-label font-16" for="checkbox2{{$typecount['article_type_name']}}">{{$typecount['article_type_name']}} <span class="badge badge-secondary ml-2 py-1">{{$typecount['count']}}</span></label>
     </div>
     @endif
     @php
     $cnt++;
     @endphp
     @endforeach
     @if ($collapseStarted)
   </div>
   </ul>
   @if(count($article_type_facet) > 3)
   <a class="btn btn-link d-flex text-dark" data-toggle="collapse" href="#collapseArticleType" role="button" aria-expanded="false" aria-controls="collapseArticleType">
     <span class="article-type">See more</span><i class="fa fa-chevron-right ml-1 mt-1"></i>
   </a>
   @endif
   @endif
   @endif



   @if(count($journal_title_facet) > 0)
   <span class="mt-4 pb-1 font-20 fw-bold d-block">Publication Title</span>
   <ul class="list-group list-group-flush">
     @php
     $cnt = 0;
     $collapseStarted = false;
     $journal_id_check=$pagenameVars['journal_id'];
     @endphp
     @foreach($journal_title_facet as $typecount)

     @php
     unset($pagenameVars['/search?xe']);
     $pagenameVars['fromyear']=$custom_from_year;
     $pagenameVars['toyear']=$custom_to_year;
     $pagenameVars['article_type_id']=$article_type_id;
     $pagenameVars['subject_id']=$subject_id;
     $pagenameVars['journal_id']=$typecount['journal_id'];
     $pagenameVars['include']=2;
     $pagenameVars['btnjournalsearch']='advance_search';
     $pagename = http_build_query($pagenameVars,'&amp;','&');
     @endphp

     @if($cnt < 3) <div class="list-group-item custom-control custom-checkbox pl-4">
       <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox3{{$typecount['title']}}" {{ !empty($journal_filter_list) && in_array($typecount['journal_id'], $journal_filter_list) ? 'checked' : '' }} @if($journal_id_check !=0) && $journal_id_check==$typecount['journal_id'] checked @endif>
       <label class="custom-control-label font-16" for="checkbox3{{$typecount['title']}}">{{$typecount['title']}} <span class="badge badge-secondary ml-2 py-1">{{$typecount['count']}}</span></label>
 </div>
 @else
 @if (!$collapseStarted)
 <div class="collapse" id="collapsepublicationTitle">
   @php
   $collapseStarted = true;
   @endphp
   @endif
   <div class="list-group-item custom-control custom-checkbox pl-4">
     <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox3{{$typecount['title']}}">
     <label class="custom-control-label font-16" for="checkbox3{{$typecount['title']}}">{{$typecount['title']}} <span class="badge badge-secondary ml-2 py-1">{{$typecount['count']}}</span></label>
   </div>
   @endif
   @php
   $cnt++;
   @endphp
   @endforeach
   @if ($collapseStarted)
 </div>
 </ul>
 @if(count($journal_title_facet) > 3)
 <a class="btn btn-link d-flex text-dark" data-toggle="collapse" href="#collapsepublicationTitle" role="button" aria-expanded="false" aria-controls="collapsepublicationTitle">
   <span class="publication-title">See more</span><i class="fa fa-chevron-right ml-1 mt-1"></i>
 </a>
 @endif
 @endif
 @endif


 @if(count($subject_title_facet) > 0)
 <span class="mt-4 pb-1 font-20 fw-bold d-block">Subject Title</span>
 <ul class="list-group list-group-flush">
   @php
   $cnt = 0;
   $collapseStarted = false;
   $subject_id_check=$pagenameVars['subject_id'];
   @endphp
   @foreach($subject_title_facet as $typecount)

   @php
   unset($pagenameVars['/search?xe']);
   $pagenameVars['fromyear']=$custom_from_year;
   $pagenameVars['toyear']=$custom_to_year;
   $pagenameVars['article_type_id']=$article_type_id;
   $pagenameVars['journal_id']=$journal_id;
   $pagenameVars['subject_id']=$typecount['subject_id'];
   $pagenameVars['btnjournalsearch']='advance_search';
   if($pagenameVars['article_type_id'] == 0 && $pagenameVars['journal_id'] == 0){
   $pagenameVars['include'] = 1;
   }
   $pagename = http_build_query($pagenameVars,'&amp;','&');
   @endphp

   @if($cnt < 3) <div class="list-group-item custom-control custom-checkbox pl-4">
     <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox4{{$typecount['title']}}" @if($subject_id_check !=0) && $subject_id_check==$typecount['subject_id'] checked @endif>
     <label class="custom-control-label font-16" for="checkbox4{{$typecount['title']}}">{{$typecount['title']}} <span class="badge badge-secondary ml-2 py-1">{{$typecount['count']}}</span></label>
     </div>
     @else
     @if (!$collapseStarted)
     <div class="collapse" id="collapsesubjectTitle">
       @php
       $collapseStarted = true;
       @endphp
       @endif
       <div class="list-group-item custom-control custom-checkbox pl-4">
         <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox4{{$typecount['title']}}">
         <label class="custom-control-label font-16" for="checkbox4{{$typecount['title']}}">{{$typecount['title']}} <span class="badge badge-secondary ml-2 py-1">{{$typecount['count']}}</span></label>
       </div>
       @endif
       @php
       $cnt++;
       @endphp
       @endforeach
       @if ($collapseStarted)
     </div>
 </ul>
 @if(count($subject_title_facet) > 3)
 <a class="btn btn-link d-flex text-dark " data-toggle="collapse" href="#collapsesubjectTitle" role="button" aria-expanded="false" aria-controls="collapsesubjectTitle">
   <span class="subject-title">See more</span><i class="fa fa-chevron-right ml-1 mt-1"></i>
 </a>
 @endif
 @endif
 @endif

 </div>
 </div>

 <div class="card bg-spring-green bigbox-hvr-slow mb-5 mt-5">
   <div class="card-header bg-siteblue text-white">
     <h4 class="mb-0">Content Type </h4>
   </div>
   <div class="card-body list-group-item">
     @if($include !=3)
     @php
     unset($pagenameVars['/search?xe']);
     $pagenameVars['fromyear']=$custom_from_year;
     $pagenameVars['toyear']=$custom_to_year;
     $pagenameVars['article_type_id']=$article_type_id;
     $pagenameVars['journal_id']=$journal_id;
     $pagenameVars['subject_id']=$subject_id;
     $pagenameVars['include']=2;

     $pagenameVars['btnjournalsearch']='advance_search';
     $pagename = http_build_query($pagenameVars,'&amp;','&');
     @endphp
     <div class="custom-control custom-checkbox pl-4">
       <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox5Journal">
       <label class="custom-control-label font-16" for="checkbox5Journal">Journal</label>
     </div>
     <br>
     @endif
     @if($include !=2)
     @php
     unset($pagenameVars['/search?xe']);
     $pagenameVars['fromyear']=$custom_from_year;
     $pagenameVars['toyear']=$custom_to_year;
     $pagenameVars['article_type_id']=$article_type_id;
     $pagenameVars['journal_id']=$journal_id;
     $pagenameVars['subject_id']=$subject_id;
     $pagenameVars['include']=3;

     $pagenameVars['btnjournalsearch']='advance_search';
     $pagename = http_build_query($pagenameVars,'&amp;','&');
     @endphp
     <div class="custom-control custom-checkbox pl-4">
       <input type="checkbox" class="item-checkbox custom-control-input checkbox-type" data-href="/search?xe=1&{{$pagename}}" id="checkbox6Book">
       <label class="custom-control-label font-16" for="checkbox6Book">Books</label>
     </div>
     @endif
   </div>

 </div>


 <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>
 @endif


 </div>