@extends('admin.layout')

@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>导航栏设置</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <form method="GET" action="" accept-charset="UTF-8">

                                <div class="col-sm-4">
                                    <div class="input-group">
                                        <input type="text" value="{{Request::get('keyword')}}" placeholder="请输入ID/名称"
                                               name="keyword" class="input-sm form-control">
                                        <span class="input-group-btn">
									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
								</span>
                                    </div>
                                </div>
                            </form>
                            @if(role('Album/Nav/create'))
                                <div class="col-sm-3 pull-right">
                                    <a href="{{ U('Album/Nav/create')}}"
                                       class="btn btn-sm btn-primary pull-right">添加</a>
                                </div>
                            @endif
                        </div>

                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
                            <thead>
                            <tr>

                                <th class="sorting" data-sort="id"> ID</th>
                                <th class="sorting" data-sort="name"> 名称</th>
                                <th class="sorting" data-sort="open_type"> 打开方式</th>
                                <th class="sorting" data-sort="state"> 位置</th>
                                <th class="sorting" data-sort="pic_url"> 图标</th>
                                <th class="sorting" data-sort="pic_url_active"> 选中图标</th>
                                <th width="22%">相关操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(isset($list))
                                @foreach($list as $key => $item)
                                    <tr>

                                        <td>{{ $item->id }}</td>
                                        <td>{{ $item->name }}</td>
                                        @if($item->open_type == 1)
                                            <td>一键拨号</td>
                                        @elseif($item->open_type == 2)
                                            <td>一键导航</td>
                                        @elseif($item->open_type == 3)
                                            <td>跳转小程序</td>
                                        @elseif($item->open_type == 4)
                                            <td>跳转页面</td>
                                        @endif
                                        @if($item->state ==0 )
                                            <td>底部</td>
                                        @else
                                            <td>顶部</td>
                                        @endif
                                        <td><img src="{{ $item->pic_url }}" width="50"/></td>
                                        <td><img src="{{ $item->pic_url_active }}" width="50"/></td>
                                        <td>
                                            <div class="pull-left">
                                                @if(role('Album/Nav/update'))
                                                    <a href="{{ U('Album/Nav/update',['id'=>$item->id])}}" class="btn btn-sm btn-warning pull-right">修改</a>
                                                @endif
                                                @if(role('Album/Nav/destroy'))
                                                    <a href="{{ U('Album/Nav/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作？');" class="btn btn-sm btn-danger pull-right">删除</a>
                                                @endif
                                            </div>
                                            {{--@if(role('Album/Nav/view'))
                                                    <button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Album/Nav/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
                                                @endif--}}
                                        </td>
                                    </tr>
                                @endforeach
                            @endif

                            </tbody>
                        </table>
                        <div class="row">
                            <div class="col-sm-6">
                                <div class="dataTables_info" id="DataTables_Table_0_info"
                                     role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}
                                    条，共{{ $list->lastPage() }}页，总{{ $list->total() }}条。
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
                                    {!! $list->setPath('')->appends(Request::all())->render() !!}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection