@extends('layouts.admin')

@section('content')
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">书籍列表</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="panel">
<button type="button" href="{{ route('admin_share_books.create') }}" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
创建
</button>

</div>

<div class="panel panel-default">
    
    <div class="panel-heading">
        列表
    </div>
    <!-- /.panel-heading -->
    <div class="panel-body">
        <div class="dataTable_wrapper">
            <table class="table table-striped table-bordered table-hover" id="dataTables-example" style="text-align: center">
                <tr>
                    <th>书名<br>作者</th>
                    <th>分类<br>原文链接<br>书籍id<br>排序序列</th>
                    <th>是否审核<br>是否采集</th>
                    <th>创建时间<br>更新时间</th>
                </tr>
                @foreach ($share_books as $share_book)
                <tr >
                    <td>                       
                        <img style='width:100px;height:100px;' src='<?php echo $share_book->cover_img_url;?>'><br><br>
                        <button type="button" href="{{ route('admin_share_books.edit',$share_book->id) }}" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
                          {{$share_book->book_name}}
                        </button><br>           
                        {{$share_book->author}}
                     </td>
                    <td> 
                      {{$share_book->category}}
                      <br>
                      <a href='<?php echo $share_book->first_chapter_url;?>' target='_blank'>原文链接</a>
                      <br>
                      <span style='color:red'>{{ $share_book->id }}</span>
                    </td>
                    <td>
                    @if($share_book->is_check == 1)
                      <span style='color:red'>已审核</span>
                    @elseif($share_book->is_check == 2)
                      审核不通过
                    @elseif($share_book->is_check == 0)
                      未审核
                    @else
                      $share_book->is_check
                    @endif
                    <br>
                    @if($share_book->is_literature == 1)
                      免费已采集
                    @elseif($share_book->is_literature == 2)
                      收费
                    @elseif($share_book->is_literature == 0)
                      未采集
                    @else
                      $share_book->is_literature
                    @endif
                    </td>
                    <td>{{ $share_book->created_at }}<br>
                    {{ $share_book->updated_at }}<br>
                    </td>
                </tr>
                @endforeach
            </table>
        </div>
        
        <div class="paging">
            总计：{{ $share_books->total() }}
            {!! $share_books->links() !!}
         </div>
    </div>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">渠道代码</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<script>
    $('#myModal').on('hidden.bs.modal',function(e){
        $(this).removeData('bs.modal');
    });
</script>
@endsection
