@extends('admin/layouts/default')
{{-- Page title --}}
@section('title')
Volumes
@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>Volume</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">Volume 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>
                        Volume List
                    </div>                    <a class="btn btn-sm btn-default button-alignment pull-right mb-1" title="Add Volume" href="{{ URL::to('admin/volumes/add') }}">
                    <span class="glyphicon glyphicon-plus"></span> New</a>
                </div>
                <div class="portlet-body table-responsive">
					<form action="{{ route('volumes.index') }}" method="Get"  enctype="multipart/form-data">
						<div class="form-group">
							<label class="control-label" for="select21">Journal:</label>
							<select class="form-control select2" id="journal_id" name="journal_id">
								<option selected="true" disabled="disabled" hidden>Select Journal</option>
								@foreach($journal_search as $key => $value)
								<option value="{{$key}}" @isset($param) @if($param['journal_id'] == $key) selected @endif @endisset>{{$value}}</option>
								@endforeach	
							</select>
						</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>
							<button type="button" id="btn_reset" class="btn btn-link">Reset</button>
						</div>
					</form>
					
					@if (session('delete_msg'))
			 <div class="alert alert-danger">
				 {{ session('delete_msg') }}
			 </div>
			@endif
			
                    <table class="table table-striped table-bordered" >
                        <thead>
                            <tr>
                                <th>journals</th>
                                <th>Volume Name</th>
                                <th>Year</th>
                                <th>No. Issues</th>
                                <th width="180px">Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach($volume_list as $key => $value)
                            <tr>
                                <td>{{ $value->subtitle }}</td>
                                <td>{{ $value->volume_name }}</td>
                                <td>{{ $value->year }}</td>
                                <td>{{ $value->total_no_of_issues }}</td>
                                <td >
                                    @if($editPermission)                                    <a href="{{ URL::to('admin/volumes/' . $value->volume_id. '/edit') }}" class="btn btn-primary btn-sm pull-left mb-1">
                                    <i class="livicon" data-name="pen" data-loop="true" data-color="#fff" data-hovercolor="White" data-size="14"></i>
                                    Edit
                                    </a>
                                    @endif                                    <!-- <a href="{{ URL::to('admin/volumes/' . $value->volume_id. '/destroy') }}" class="btn btn-danger">
                                        <i class="livicon" data-name="trash" data-loop="true" data-color="#000" data-hovercolor="black" data-size="14"></i>
                                            Delete
                                        </a> -->
                                    @if($deletePermission)
                                    <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#{{ $value->volume_id}}"><i class="livicon" data-name="trash" data-loop="true" data-color="#fff" data-hovercolor="white" data-size="14"></i>DELETE</button>
                                    <!-- Modal -->
                                    <div class="modal fade" id="{{ $value->volume_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>
                                                    <h4 class="modal-title">Warning</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <p>Do you really want to delete valume: {{ $value->volume_name }}</p>
                                                </div>
                                                <div class="modal-footer">
                                                    {{ Form::open([ 'method'  => 'delete', 'route' => [ 'volumes.destroy', $value->volume_id] ]) }}
                                                    {{ Form::hidden('id', $value->volume_id) }}
                                                    {{ Form::submit('Delete', ['class' => 'btn btn-danger']) }}
                                                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                                    {{ Form::close() }}
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    @endif
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                    <div class="col-md-4">
                        Showing {{ $volume_list->firstItem() }} to {{ $volume_list->lastItem() }} of {{  $volume_list->total() }} entries
                    </div>                    <div class="col-md-8  text-right">         
                        {{ $volume_list->appends(request()->input())->links() }}
                    </div>
                </div>
            </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>
$("#journal_id").select2({
	theme:"bootstrap",
	placeholder:"Select Journal",
	width: '100%',
	height: '50px'
}); 
$("#btn_reset").click(function(){
	$('#journal_id').val(0);
	$("#journal_id").append('<option selected="true" disabled="disabled" hidden>Select Journal</option>');
});		
</script>
@stop