@extends('layouts.app')
@section('title')
{{ $user->name }}
@parent
@stop
@section('header_styles')
<meta name="csrf_token" content="{{ csrf_token() }}">
<link href="{{ asset('assets/vendors/jasny-bootstrap/css/jasny-bootstrap.css') }}" rel="stylesheet"/>
<link href="{{ asset('assets/vendors/x-editable/css/bootstrap-editable.css') }}" rel="stylesheet"/>
<link href="{{ asset('assets/css/pages/user_profile.css') }}" rel="stylesheet"/>
<style type="text/css">
.text-warning{
  color: var(--orange) !important;
}
.text-success{
  color: var(--teal) !important;
}
.card:hover, .text-success:hover, .text-warning:hover {
  opacity: 0.9;
  color: inherit;
}
.text-wrap{
  white-space: normal;
  word-break: break-all;
}
</style>
@stop
{{-- Page content --}}
@section('content')
<main id="users_ac">
   <!--section ends-->
   <section>
      <div class="container">
         <div class="row">
            
            <div class="col-md-12 mt-xs-5">
                
               <div class="card">

                  <div class="card-header w-100 d-flex  text-left bg-dark-light" >
                        
                       <h4 class="col m-0"> <a href="{{route('crm.dashboard')}}"><i class="fa fa-home"></i> Dashboard </a> | <span class="mt-2 ml-2"> subscribed journal(s) List</span></h4>
                        
                    </div>
                  </div>
                  <div class="card-body w-100 text-center mt-4">
                    <div class="table-responsive"> 

					@if(auth()->user()->id == "611344")
						<a class="btn btn-success float-right" href="{{route('crm.user.subscribejournal',['param'=>\Crypt::encryptString($user_id),'type'=>\Crypt::encryptString($access_type),'access_on'=>\Crypt::encryptString($access_type_on),'export'=>'export'])}}">Export<i class="fa-solid fa-download ml-2"></i></a>
					@endif
			  
                      <table class="table table-bordered table-hover table-striped" border="1">
                        
                        <tbody>
                              @if(!empty($subscribedata))
                               
                                  @php $cnt=0; @endphp
                                  <thead>
                                      <tr>
                                      <th>S.No </th>
                                      <th>Title</th>
                                      <th>Code</th>
                                      <th>Cost</th>
                      <th>View Content</th>
                                      </tr>
                                  </thead>
                                  @foreach($subscribedata as $row)
                                    <tr>
                                      <td>{{++$cnt}}</td>
                                      <td>{{$row->title}}</td>
                                      <td>{{$row->subtitle}}</td>
                                      <td>{{$row->cost}}</td>
                    @php
                    $volume = explode(',', $row->volume);
                    $year = explode(',', $row->years);
                    @endphp
                    <td class="text-wrap"><button type="button" class="btn btn-info btn-md" data-toggle="modal" data-target="#open_request_{{ $row->title }}">
                        View </button></td>
                                    </tr>
                  <!-- ******************************************* Volumes/Years ******************************************** -->
                  <div class="modal fade bd-example-modal-lg" role="dialog" id="open_request_{{ $row->title }}" aria-hidden="true">
                    <div class="modal-dialog modal-lg">
                      <div class="modal-content">
                        <div class="modal-body">
                          <div class="col-md-12 mt-xs-5">
                            <div class="row">
                              <div class="col-md-12">
                                <h2 class="h4 p-3 bg-dark-light text-primary-light">{{$row->title}}</h2>
                                <hr>
                                <div class="row">
                                  <div class="col-md-6"><span class="border-bottom p-1 d-block"><strong>Volume</strong></span></div>
                                  <div class="col-md-6"><span class="border-bottom p-1 d-block"><strong>Year</strong></span></div>
                                  <div class="col-md-6 border-right">
                                    @foreach($volume as $volumes)
                                    <span class="border-bottom p-1 d-block">{{$volumes}}</span>
                                    @endforeach
                                  </div>
                                  <div class="col-md-6">
                                    @foreach($year as $years)
                                    <span class="border-bottom p-1 d-block">{{$years}}</span>
                                    @endforeach
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                                  @endforeach

                                
                              @else
                              <tr><td colspan="5">No subscribed journal found !!!. </td></tr>
                              @endif

                        </tbody>
                      </table> 
                    </div>
                  </div>
                
                </div>
               
            </div>
            </divs>
            
            
         </div>
      </div>
      </div>
   </section>
</main>





@stop
