@extends('admin/layouts/default')

{{-- Page title --}}
@section('title')
Article MetaData
@parent
@stop

{{-- page level styles --}}
@section('header_styles')
    <link href="{{ asset('assets/css/pages/tables.css') }}" rel="stylesheet" type="text/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

{{-- Page content --}}
@section('content')
<script type="text/javascript" src="{!! asset('js/jquery.min.js') !!}"></script>
<script>
$(function () 
{
        $("#section_id").change(function()
        {
            var section_id = $('#section_id').val();
            
            if (section_id == 0)
            {               
                $("#issue_id").removeAttr("disabled", "disabled");
            }           
            else
            {
                $("#issue_id").empty();
                $("#issue_id").attr("disabled", "disabled");
            }
        });

        $("#journal_id").change(function(){
        
            var link_id = $('#link_id').val();
            var journal_id = $('#journal_id').val();
            
              $.ajax({
                    type: "GET",
                    url: '',
                    data: {journal_id: journal_id},
                    success: function( msg ) 
                    {
                        var data = msg['volume'];
                        $('#volume_id').empty();                        
                        $('#issue_id').empty();                        
                            
                        
                        $.each(data, function(key,value) 
                        {   
                            $("#volume_id").append('<option selected="true" disabled="disabled" hidden>Select Volume</option>');
                            $("#volume_id").append('<option value="'+value['volume_id']+'" >'+value['volume_name']+'</option>');
                        });                 
                    }
                });                     
        });
        
        $("#volume_id").change(function(){
                    
            var volume_id = $('#volume_id').val();

              $.ajax({
                    type: "GET",
                    url: '',
                    data: {volume_id: volume_id},
                    success: function( msg ) 
                    {
                        var data = msg['issues'];
                        $('#issue_id').empty();                     
                        
                        
                        $.each(data, function(key,value) 
                        {       
                            var section_id = $('#section_id').val();                            
                            if (section_id == 0)
                            {   
                                $("#issue_id").append('<option selected="true" disabled="disabled" hidden>Select Issue</option>');
                                $("#issue_id").append('<option value="'+value['issue_id']+'" >'+value['title']+'</option>');
                            }
                        });                 
                    }
                });                     
        });
        
});
  
</script>

<section class="content-header">
    <!--section starts-->
    <h1>Filter</h1>
    <ol class="breadcrumb">
        <li>
            <a href="{{ route('admin.dashboard') }}">
                <i class="livicon" data-name="home" data-size="18" data-loop="true"></i>
                Dashboard
            </a>
        </li>
        <li class="active">Filter List</li>
    </ol>
</section>
<!--section ends-->
<section class="content">
                <div class="row">
                    <div class="col-md-12">
                        <!-- BEGIN SAMPLE TABLE PORTLET-->
                        <div class="portlet box primary">
                            <div class="portlet-title">
                                <div class="caption">
                                    <i class="livicon" data-name="responsive" data-size="16" data-loop="true" data-c="#fff" data-hc="white"></i>
                                    Filter List 
                                </div>                          
                            </div>
                            
                            <div class="portlet-body table-responsive">
                            
                               <div class="panel-body">
                                
                                {{ Form::open(array('url' => 'admin/metadata/article','id' => 'article_frm')) }}
                                
                                    <div class="my-3" id="e-book">

                                                            
                                        <div class="form-group">
                                        
                                            <label class="control-label" for="select21">Section: *</label>
                                            
                                            <select class="form-control select2"  name="section_id" id="section_id">
                                                <option title="Normal" value="0" @isset($param) @if($param['is_epub'] == 0) selected @endif @endisset>Normal</option>
                                                <option title="Epub Abstract" value="4"  @isset($param) @if($param['is_epub'] == 4) selected @endif @endisset>Epub Abstract</option>
                                                <option title="Epub Full Text Article" value="1"  @isset($param) @if($param['is_epub'] == 1) selected @endif @endisset>Epub Full Text Article</option>
                                            </select>
                                            
                                            <input type="hidden" id="link_id" name="link_id" value='edit'>
                                        </div>
                                        
                                        <div class="form-group">
                                                <label class="control-label" for="select21">Journal: *</label>
                                                <select class="form-control select2"  name="journal_id" id="journal_id">
                                                <option selected="true" disabled="disabled" hidden>Select Journal</option>
                                                @isset($journal)
                                                    @foreach($journal as $key => $value)
                                                        <option value="{{$key}}"  @isset($param) @if($param['journal_id'] == $key) selected @endif @endisset>{{$value}}</option>
                                                    @endforeach
                                                @endisset
                                                </select>
                                                  <input type="hidden" id="link_id" name="link_id" value='edit'>
                                            </div>
                                        
                                        <div class="form-group">
                                            <label class="control-label" for="select21">Volume: *</label>
                                            <select class="form-control select2"  name="volume_id" id="volume_id">
                                            <option selected="true" disabled="disabled" hidden>Select Volume</option>
                                                @isset($volume)
                                                    @foreach($volume as $volume_value)
                                                        <option value="{{$volume_value->volume_id}}"  @isset($param) @if($param['volume_id'] == $volume_value->volume_id) selected @endif @endisset>{{$volume_value->volume_name}}</option>
                                                    @endforeach
                                                @endisset
                                            </select>
                                        </div>
                                        
                                        <div class="form-group">
                                            <label class="control-label" for="">Issue Type: *</label>
                                            <select @if($param['is_epub']!=0) disabled="disabled" @endif class="form-control select2"  name="issue_id" id="issue_id">
                                            <option selected="true" disabled="disabled" hidden>Select Issue</option>
                                                @isset($issue)
                                                    @foreach($issue as $issue_value)
                                                        <option value="{{$issue_value->issue_id}}" @isset($param) @if($param['issue_id'] == $issue_value->issue_id) selected @endif @endisset>{{$issue_value->title}}</option>
                                                    @endforeach
                                                @endisset
                                            </select>
                                        </div>
                                        
                                        
                                        {{ Form::submit('Search', array('class' => 'btn btn-primary','value' => 'submit')) }}
                                        <button type="button" id="btn_reset" class="btn btn-link" onclick="javascript: document.getElementById('article_frm').reset()">Reset</button>
                                    </div>
                                                <!--/.panel-body -->
                                    {{ Form::close() }}
                                </div>
                                    
                                                        <!-- BEGIN SAMPLE TABLE PORTLET-->
                        <div class="portlet box primary">
                           
                            <div class="portlet-body ">

                                <table class="table table-striped table-bordered" id="Issue_table">
                                    <thead>
                                        <tr>
                                            <th width="300">Article Title</th>                                                                                  
                                            <th width="105">Date</th>
                                            @if($param['is_epub']==4)
                                        <th>Generate Medline Metadata</th>
                                        <th>Generate Linkout file</th>
                                        <th>Generate DOI file</th>
                                            @endif

                                            @if($param['is_epub']==0)
                                            <th>Generate MetaData</th>
                                            <th>Generate JST MetaData</th>                                          
                                            <th>Generate TIB MetaData</th>
                                            <th>Generate CrossRef</th>                             
                                            <th>Generate Jats MetaData</th>                             
                                            @endif

                                            @if($param['is_epub']==1)
                                        <th>Generate Medline Metadata</th>
                                        <th>Generate Linkout file</th>
                                        <th>Generate CCC Metadata</th>
                                        <th>Generate JST Metadata</th>
                                        <th>Generate DOI file Metadata</th>
                                        <th>Generate Infotrive Metadata</th>
                                        <th>Generate Jats file</th>
                                            @endif
                                                                                    
                                            
                                        </tr>
                                    </thead>
                                    <tbody>
                                    @if($articles_list)
                                    @foreach($articles_list as $key => $value)
                                        <tr>
                                            
                                            <td >{{ $value->title }}</td>
                                            <td>{{ strftime("%d-%b-%Y",$value->created) }}</td>
                                            @if($param['is_epub']==4)
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/'. $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/2/'.$param['is_epub']) }}" class="btn btn-link">
                                                           Epub Abstract Metadata
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                           
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/3/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             Epub Abstract Linkout
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                           
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/4/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             Epub Abstract DOI
                                                        </a>  
                                                </td>
                                            @endif

                                            @if($param['is_epub']==0)
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/'.$value->issue_id.'/'. $value->article_id. '/1/'.$param['is_epub']) }}" class="btn btn-link">
                                                            CCC MetaData
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/'.$value->issue_id.'/'. $value->article_id. '/5/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             JST MetaData
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/'.$value->issue_id.'/'. $value->article_id. '/7/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             TIB MetaData
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/'.$value->issue_id.'/'. $value->article_id. '/8/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             CrossRef MetaData
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/'.$value->issue_id.'/'. $value->article_id. '/9/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             Jats MetaData
                                                        </a>  
                                                </td>
                                            @endif
                                            @if($param['is_epub']==1)
                                                <td class="numeric">                                            
                                            <a href="{{ URL::to('admin/metadata/article/'. $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/2/'.$param['is_epub']) }}" class="btn btn-link">
                                                Epub Abstract Metadata
                                            </a>
                                        </td>
                                        <td class="numeric">
                                            <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/3/'.$param['is_epub']) }}" class="btn btn-link">
                                                Epub Abstract Linkout
                                            </a>
                                        </td>
                                        <td class="numeric">
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/1/'.$param['is_epub']) }}" class="btn btn-link">
                                                            CCC Metadata
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/5/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             JST Metadata
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/4/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             Epub Abstract DOI
                                                        </a>  
                                                </td>
                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/6/'.$param['is_epub']) }}" class="btn btn-link">                        
                                                             Infotrive Metadat
                                                        </a>  
                                                </td>

                                                <td class="numeric">                                            
                                                        <a href="{{ URL::to('admin/metadata/article/' . $value->journal_id.'/'. $value->volume_id.'/0/'. $value->article_id. '/10/'.$param['is_epub']) }}" class="btn btn-link">                         
                                                             Jats Epub MetaData
                                                        </a>  
                                                </td>
                                            @endif
                                        </tr>
                                        @endforeach
                                        @endif
                                    </tbody>
                                </table>
                                
                                
                                

                            </div>
                        </div>
                        <!-- END SAMPLE TABLE PORTLET-->
            
                               
                            </div>                          
                        </div>
                        <!-- END SAMPLE TABLE PORTLET-->
                    </div>
                </div>
            </section>

@stop

{{-- page level scripts --}}
@section('footer_scripts')
    <script src="{{ asset('assets/js/pages/table-responsive.js') }}"></script>
        <script src="{!! asset('assets/vendors/select2/js/select2.js') !!}"></script>    
    <script>
$("#journal_id").select2({
    theme:"bootstrap",
    placeholder:"Select Journal",
    width: '100%',
    height: '50px'
});
</script>
@stop
