@extends('admin/layouts/default')

{{-- Page title --}}
@section('title')
Ebook 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();						
							
						
						$.each(data, function(key,value) 
						{	
							$("#volume_id").append('<option selected="true" disabled="disabled" hidden>Select Volume</option>');
							$("#volume_id").append('<option value="'+key+'" >'+value+'</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="'+key+'" >'+value+'</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/ebook')) }}
								
									<div class="my-3" id="e-book">															
															
										<div class="form-group">
											<label class="control-label" for="">Ebook Title: *</label>
											<select class="form-control select2"  name="ebook_id" id="ebook_id">
											<option selected="true" disabled="disabled" hidden>Select Ebook</option>
											
												@foreach($ebook as $key => $value)
													<option value="{{$key}}" @isset($param['ebook_id']) @if($param['ebook_id'] == $key) selected @endif @endisset>{{$value}}</option>
												@endforeach
											
											</select>
										</div>
									
									
									{{ Form::submit('Search', array('class' => 'btn btn-primary','value' => 'submit')) }}
									</div>
                                                <!--/.panel-body -->
									{{ Form::close() }}
								</div>
									
								                        <!-- BEGIN SAMPLE TABLE PORTLET-->
                        <div class="portlet box primary">
                           
                            <div class="portlet-body table-responsive">
                                <table class="table table-striped table-bordered" id="Issue_table">
                                    <thead>
                                       <tr>
                                            <th class="text-center" >Ebook</th>
											<th class="text-center" >Volume</th>
											<th class="text-center" >Medline</th>
											<th class="text-center" >CrossRef</th>
											<th class="text-center" >Onix</th>
											<th class="text-center" >Series</th>
											<th class="text-center" >EBSCO</th>
											<th class="text-center" >KOBO</th>
											<th class="text-center" >Infotrive</th>
											<th class="text-center" >TIB</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    @if($ebook_list)	
									@foreach($ebook_list as $key => $value)
                                        <tr>
											<td class="text-center" >{{ $value->title }}</td>
											<td class="text-center" >vol {{ $value->name }}</td>
											<td class="text-center numeric" >
												<a href="{{ URL::to('admin/metadata/ebook/' . $value->ebook_id.'/'.$value->volume_id. '/1') }}" >Medline Metadata</a>  
											</td>
											<td class="text-center numeric" >
												<a href="{{ URL::to('admin/metadata/ebook/' . $value->ebook_id.'/'.$value->volume_id. '/2') }}" >CrossRef Metadata</a>  
											</td>
											<td class="text-center numeric" >
												<a href="{{ URL::to('admin/metadata/ebook/' . $value->ebook_id.'/'.$value->volume_id. '/3') }}" >Onix Metadata</a>  
											</td>
											<td class="text-center numeric" >
												<a href="{{ URL::to('admin/metadata/ebook/' . $value->ebook_id.'/'.$value->volume_id. '/4') }}" >Series Ebook Metadata</a>  
											</td>
											<td class="text-center numeric" >
												<a href="{{ URL::to('admin/metadata/ebook/' . $value->ebook_id.'/'.$value->volume_id. '/5') }}" >EBSCO Metadata</a>  
											</td>
											<td class="text-center numeric" >
												<a href="{{ URL::to('admin/metadata/ebook/' . $value->ebook_id.'/'.$value->volume_id. '/6') }}" >KOBO Metadata</a>  
											</td>
											<td class="text-center numeric" >
												<a href="{{ URL::to('admin/metadata/ebook/' . $value->ebook_id.'/'.$value->volume_id. '/7') }}" >Infotrive Metadata</a>  
											</td>
											<td class="text-center numeric" >
												<a href="{{ URL::to('admin/metadata/ebook/' . $value->ebook_id.'/'.$value->volume_id. '/8') }}" >TIB Metadata</a>  
											</td>
                                        </tr>
										@endforeach
										@else
										<tr><td colspan="10" align="center"> --empty--</td></tr>
										@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>
$("#ebook_id").select2({
    theme:"bootstrap",
    placeholder:"Select Ebook",
    width: '100%',
    height: '50px'
});
</script>
@stop
