@extends('admin/layouts/default')
{{-- Page title --}}
@section('title')
Chapter List
@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')
<section class="content-header">
    <!--section starts-->
    <h1>Chapters</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">Chapter 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>
                        Chapter List
                    </div>
                    <a class="btn btn-sm btn-default button-alignment pull-right mb-1" title="Add New Journal" href="{{ route('chapters.create') }}"><span class="glyphicon glyphicon-plus"></span> New</a>
                </div>
                <div class="portlet-body table-responsive">
                    @if ($message = Session::get('success'))
                    <div class="alert alert-success alert-dismissable">
                        <p>{{ $message }}</p>
                    </div>
                    @endif
                    @if ($message = Session::get('error'))
                    <div class="alert alert-danger alert-dismissable">
                        <p>{{ $message }}</p>
                    </div>
                    @endif
										 <form action="{{ route('chapters.index') }}" method="Get" id="article_frm" enctype="multipart/form-data">
				   
						<div class="form-group">
							<label class="control-label" for="select21">Chapter Title</label>
							
							<input type="text" name="title_search" class="form-control" placeholder="Search by ebook title..."
							
							@isset($param) value="{{ $param['title_search'] }}" @endisset
							>
						</div>
						
						@include('search.ebook_search')
						@include('search.ebook_volume_search')
						
						<div class="form-group">
							<button type="submit" class="btn btn-primary" name="frm_search" value ="true">
								<span class="glyphicon glyphicon-search"></span>  Search
							</button>							<a href="{{ URL::to('admin/chapters') }}"  id="btn_reset" class="btn btn-default">Reset</a>
						</div>
						
                    </form>
                    <br>
					
			
                    <table class="table table-striped table-bordered" >
                        <thead>
                            <tr>
                                <th>Chapter Title</th>
								<th>Volume</th>
                                <th>Chapter No</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($chapter as $chapters)
                            <tr>
                                <td>{{$chapters->title}}</td>
								<td>{{$chapters->volume_name}}</td>
                                <td>{{$chapters->chapter_no}}  @if($chapters->select_ebook_type == 'video') - ({{$chapters->select_ebook_type}}) @endif</td>
                                <td width="180px">
                                    @if($editPermission)                                    <a href="{{ route('chapters.edit',$chapters->chapter_id) }}" class="btn btn-primary btn-sm pull-left mb-1" target="_blank">
                                    <i class="livicon mt-2" data-name="pen" data-loop="true" data-color="#fff" data-hovercolor="white" data-size="14"></i>
                                    </a>
                                    @endif
                                    @if($deletePermission)
                                    <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#{{ $chapters->chapter_id }}"><i class="livicon mt-2" data-name="trash" data-loop="true" data-color="#fff" data-hovercolor="white" data-size="14"></i></button>
                                    <!-- Modal -->
                                    <div class="modal fade" id="{{ $chapters->chapter_id }}" role="dialog">
                                        <div class="modal-dialog">
                                            <!-- Modal content-->
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                                                    <h3 class="modal-title text-danger">Confirmation</h3>
                                                </div>
                                                <div class="modal-body">
                                                    <p><strong>Are you sure you want to delete this record?</strong></p>
                                                </div>
                                                <div class="modal-footer">                                                    {{ Form::open([ 'method'  => 'delete', 'route' => [ 'chapters.destroy', $chapters->chapter_id] ]) }}
                                                    {{ Form::hidden('nid', $chapters->nid) }}
                                                    {{ Form::submit('Yes', ['class' => 'btn btn-danger']) }}
                                                    <button type="button" class="btn btn-primary" data-dismiss="modal">No</button>
                                                    {{ Form::close() }}
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    @endif
                                    <a href="{{ URL::to('/chapter/' . $chapters->chapter_id ) }}" class="btn btn-success btn-sm pull-left mb-1" target="_blank">
                                    <i class="livicon" data-name="eye-open" data-loop="true" data-color="#fff" data-hovercolor="white" data-size="14"></i>
                                    </a> 

                                    <a href="{{ URL::to('/admin/chapter_generate_sgml/' . $chapters->chapter_id ) }}" class="btn btn-link pull-left mb-1" target="_blank">
                                    Generate SGML
                                    </a> 
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                    <div class="col-md-4">
                        Showing {{ $chapter->firstItem() }} to {{ $chapter->lastItem() }} of {{  $chapter->total() }} entries
                    </div>
                    <div class="col-md-8  text-right">         {{ $chapter->appends(request()->input())->links() }}
                    </div>
                </div>
            </div>
            <!-- END SAMPLE TABLE PORTLET-->
        </div>
    </div>
</section>
@stop

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