@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_chapters.create') }}" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
创建
</button>

</div>
<div class="panel">
	<form action="local_book_import" method="POST" enctype="multipart/form-data">
        <label for="msg" style='color:red'><?php echo isset($_GET['msg'])?$_GET['msg']:'';?></label><br>
         <label>选择文件(txt格式)</label>
         <input type="file" id="file" name="file" /><br>
        <button type="submit" name="submit" class="btn btn-success">导入</button><br>
     </form>
</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>章节内容</th>
                    <th>创建时间<br>更新时间</th>
                </tr>
                @foreach ($share_chapters as $share_chapter)
                <tr >
                    <td>                       
                        <button type="button" href="{{ route('admin_share_chapters.edit',$share_chapter->id) }}" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
                          {{$share_chapter->chapter_name}}
                        </button><br>
                        {{$share_chapter->chapter_no}}
                     </td>
                    <td> 
                      {{$share_chapter->chapter_content}}
                    </td>
                    <td>{{ $share_chapter->created_at }}<br>
                    {{ $share_chapter->updated_at }}<br>
                    </td>
                </tr>
                @endforeach
            </table>
        </div>
        
        <div class="paging">
            总计：{{ $share_chapters->total() }}
            {!! $share_chapters->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
