@extends('admin/layouts/default')
{{-- Page title --}}
@section('title')
Report
@parent
@stop
{{-- page level styles --}}
@section('header_styles')
<!--page level css -->
<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>Report</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">Downloaded Chapters</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>
                        Downloaded Chapters 
                    </div>
                </div>
                <div class="portlet-body table-responsive">
                   <form action="{{ route('admin.report','downloaded_chapters') }}" 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" id="title_search" name="title_search" value="{{$param['title_search']}}" class="form-control" placeholder="Search by article title...">
						</div>
						
						@include('search.ebook_search')
						@include('search.ebook_volume_search')
						
                        <div class="form-group">
                            <label class="control-label" for="select21">User Name</label>
                            <input type="text" id="user_name" name="user_name" value="{{$param['user_name']}}" class="form-control" placeholder="Search by User Name...">
                        </div>

						<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/report/downloaded_chapters') }}"  id="btn_reset" class="btn btn-default">Reset</a>
						</div>
                        
						
                    </form>
                    <br>
                    <table class="table table-striped table-bordered" id="article_table">
                        <thead>
                            <tr>
                                <th>Ebooks</th>
                                <th>Volumes</th>
                                <th>Chapters</th>
                                <th>User</th>
                                <th>IP</th>
                                <th>Total Downloads</th>
                            </tr>
                        </thead>
                        <tbody>
                            @if (count($chapter_list) > 0)
                            @foreach($chapter_list as $chapter)
                            <tr>
                                <td>{!! $chapter->ebook !!}</td>
                                <td>{{ $chapter->volume }}</td>
                                <td>{!! $chapter->title !!}</td>
                                <td>{{ $chapter->deo }}</td>
                                <td>{{ $chapter->ip_address }}</td>
                                <td>{{ $chapter->total_download }}</td>
                            </tr>
                            @endforeach
                            @else
                            <tr>
                                <td colspan="6">
                                    <center>Empty</center>
                                </td>
                            </tr>
                            @endif
                        </tbody>
                    </table>
                    @if (count($chapter_list) > 0)
                    <center>{{ $chapter_list->appends(request()->input())->links() }}</center>
                    @endif
                </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>

 $(document).ready(function(){
    $('#ebook_id').prop('required',false);
    $('#ebook_volume_id').prop('required',false);
});   
    
$("#ebook_id").select2({
	theme:"bootstrap",
	placeholder:"Select eBook",
	width: '100%',
	height: '50px'
});
$("#ebook_volume_id").select2({
	theme:"bootstrap",
	placeholder:"Select Volume",
	width: '100%',
	height: '50px'
});    		
</script>
@stop