@extends('admin/layouts/default')

{{-- Page title --}}
@section('title')
Add Volume
@parent
@stop

{{-- page level styles --}}
@section('header_styles')
     @include('admin.layouts.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">
    <link href="{{ asset('assets/vendors/datetimepicker/css/bootstrap-datetimepicker.min.css') }}" rel="stylesheet">
	
	<link href="{{ asset('assets/vendors/daterangepicker/css/daterangepicker.css') }}" rel="stylesheet" type="text/css" />
	<link href="{{ asset('assets/vendors/datetimepicker/css/bootstrap-datetimepicker.min.css') }}" rel="stylesheet" type="text/css" />	
	<link rel="stylesheet" href="{{ asset('assets/vendors/bootstrap-tagsinput/css/bootstrap-tagsinput.css') }}" />
	<link rel="stylesheet" href="{{ asset('assets/vendors/bootstrap-tagsinput/css/app.css') }}" />
	
<script type="text/javascript" src="{!! asset('js/angular.js') !!}"></script>	
<!-- <script type="text/javascript" src="{{ asset('js/author_affiliation.js') }}"></script>
 --><script>

	var MAMP = MAMP || {};
	MAMP.Subapp = MAMP.Subapp || {};

	MAMP.Subapp.Admin = angular.module('MAMP.Subapp.Admin', []);

	MAMP.Subapp.Admin.config(function($interpolateProvider) 
	{
		$interpolateProvider.startSymbol('{[{').endSymbol('}]}');
	});

</script>
	
@stop

{{-- Page content --}}
@section('content')

            <section class="content-header">
                <!--section starts-->
                <h1>
				
				{{ucfirst($page)}} eBook Volume 
				   
                </h1>
                <ol class="breadcrumb">
                    <li>
                        <a href="{{ route('admin.dashboard') }}">
                            <i class="livicon" data-loop="true" data-name="home" data-size="14">
                            </i>
                            Dashboard
                        </a>
                    </li>
					<li><a href="{{ URL::to('admin/ebook_volume') }}">Ebook List</a></li>
                    <li class="active">
                        {{ucfirst($page)}} eBook Volume
                    </li>
                </ol>
            </section>
			
            <!--section ends-->
            <section class="content paddingleft_right15">
                <!--main content-->
                <div class="row">
                    <div class="panel panel-primary ">
                        <div class="panel-heading">
                            <h3 class="panel-title">
                                <i class="livicon" data-c="#fff" data-hc="white" data-loop="true" data-name="gear" data-size="16">
                                </i>
                                {{ucfirst($page)}} eBook Volume
                            </h3>
                            <span class="pull-right clickable">
                                <i class="glyphicon glyphicon-chevron-up">
                                </i>
                            </span>
                        </div>
						
                        <div class="panel-body">
						@if ($errors->any())
                            <div class="row">
                                <div class="col-md-9 col-lg-offset-3 col-md-offset-3 pd-r lert alert-danger">
                                    <strong>Whoops!</strong> There were some problems with your input.<br>
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                            @endif
                            <div class="row acc-wizard">
							
                                <div class="col-md-2">
                                    <ol class="acc-wizard-sidebar">
                                        <li class="acc-wizard-todo "><a data-parent="#accordion-demo" data-toggle="collapse" href="#volume_form">Volume Form</a></li>
										<li class="acc-wizard-todo "><a data-parent="#accordion-demo" data-toggle="collapse" href="#cover_image" aria-expanded="true">Cover Image</a></li>
										<li class="acc-wizard-todo "><a data-parent="#accordion-demo" data-toggle="collapse" href="#upoload_file">Upload File</a></li>
										<li class="acc-wizard-todo "><a data-parent="#accordion-demo" data-toggle="collapse" href="#author_form">Authors</a></li>										<li class="acc-wizard-todo "><a data-parent="#accordion-demo" data-toggle="collapse" href="#references">References</a></li>
                                        <li class="acc-wizard-todo "><a data-parent="#accordion-demo" data-toggle="collapse" href="#meta">Meta Tags</a></li>
                                    </ol>
                                </div>
								
                                <div class="col-md-10 pd-r">
									<div class="panel-group" id="accordion-demo" ng-app="MAMP.Subapp.Admin">
									
									
										<!-- Volume Form Start-->
											@include('admin.ebook_volume.includes.volume_form')
										<!-- Volume Form End-->
										@isset($volume)
										<!-- Upload File Start-->
											@include('admin.ebook_volume.includes.cover_image')
										<!-- Upload File End-->
										
										<!-- Upload File Start-->
											@include('admin.ebook_volume.includes.upload_files')
										<!-- Upload File End-->
										
										<!-- Author Form Start-->
												@include('admin.ebook_volume.includes.author_form')
										<!-- Author Form End-->
										<!-- References Form Start-->
											@include('admin.ebook_volume.includes.references_form')
										<!-- References Form End-->

										<!-- Meta Tags Start-->
											@include('admin.ebook_volume.includes.meta_tag')
										<!-- Meta Tags End-->
										
										@endisset

										<!-- Article Form Start-->
											@include('admin.author.edit_author_affiliation')
										<!-- Article Form End-->	
									</div>
									
								</div>
                                       
                                </div>
									
								
                            </div>
                        </div>
                    </div>
                </div>
                <!--main content ends-->
            </section>
            <!-- content -->
            @stop

			
<script type="text/javascript" src="{!! asset('js/jquery.min.js') !!}"></script>
<script>
$(function () 
{
	
	  $(".select2").select2({
        theme:"bootstrap",
        placeholder:"",
        width: '100%'
    });

    $("#add_author").click(function()
    {   
        
        $("#author_values").empty();
        
        $("#author_values").css("border", "1px solid #ddd");
        $("#author_values").css("padding", "10px");
        
        if ($("#first_name").val() != '')
        {
            
            $("#author_values").append('<p><strong>First Name:</strong> '+$("#first_name").val()+'</p>');   
            $("#author_values").append('<p><strong>Initials:</strong> '+$("#initials").val()+'</p>');   
            $("#author_values").append('<p><strong>Last Name:</strong> '+$("#last_name").val()+'</p>'); 
            $("#author_values").append('<p><strong>Affiliation:</strong> '+$("#affiliation").val()+'</p>'); 
        }
    }); 
    
    $("#reset_author").click(function()
    {   
        $("#author_values").empty();
        $("#first_name").val('');
        $("#initials").val('');
        $("#last_name").val('');
        $("#affiliation").val('');
        $("#author_values").css("border", "none");
        $("#author_values").css("padding", "0px");
        
    });
    
});  
</script>
{{-- page level scripts --}}
@section('footer_scripts')
        @include('admin.layouts.js')
		
<script src="{{ asset('assets/vendors/select2/js/select2.js') }}" type="text/javascript"></script>    		
@if($page == 'update')
 <script src="{!! asset('js/filter.js') !!}"></script> 
@endif
<script>
$(function () {



	var select_ebook_type = $("#select_ebook_type").val();

	if (select_ebook_type == 'video')
	{
		$("#pdf_file_uploader").toggle();
	}

	$("#select_ebook_type").change(function()
	{
		$("#pdf_file_uploader").toggle();
		
	});

	$("#journal_id").select2({
		theme:"bootstrap",
		placeholder:"",
		width: '100%'
	});
	
	
	$("#publication_date").daterangepicker({
		 locale: {
            format: 'YYYY-MM-DD'
        },
        singleDatePicker: true,
        showDropdowns: true,
		
    });
	
	$("#volume_name").keyup(function()
	{

		var ebook_id = $('#ebook_id').val();
		var volume_name = $('#volume_name').val();
		
		if(ebook_id && volume_name)
		{
			
		  $.ajax({
				type: "GET",
				data: {ebook_id: ebook_id,volume_name: volume_name,ajx_search : true, ebook_exist:true},
				success: function( msg )
				{
					console.log(msg.volume_name);
				   if (msg.volume_name == volume_name)
					{
						$('#lbl_volume').html('Volume '+volume_name+' Already Exist');
						$('#lbl_volume').addClass("text-danger");
						$('#lbl_volume').removeClass("text-success");
					}
					else
					{
						$('#lbl_volume').html('Volume '+volume_name+' Available');
						$('#lbl_volume').removeClass("text-danger");
						$('#lbl_volume').addClass("text-success");
					}
				}
			});
		}
	});
    
});
</script>		

<script src="{{ asset('assets/vendors/daterangepicker/js/daterangepicker.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/vendors/datetimepicker/js/bootstrap-datetimepicker.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/js/pages/datepicker.js') }}" type="text/javascript"></script>
<script src="{{ asset('assets/vendors/bootstrap-tagsinput/js/bootstrap-tagsinput.js') }}"  type="text/javascript"></script>

		
@stop