<style>
    .p-l{
        margin: 20px;
        background-color: rgba(255, 249, 242, 0.02);
        height: auto;
    }
    .p-l label{
        margin-left: 30px;
    }
    .div-b{
        margin-top: 20px;
    }
</style>

@if($template_check)
<div class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="form-inline p-l">
                            <form method="get" action="/message/templatelist">
                                <div style="text-align: center" class="div-b">

                                    @if($template_create)
                                        <a class="btn btn-primary btn-sm" href="/message/addtemplate" style="float: left; margin-left: 30px">新增消息模板</a>
                                    @endif

                                    <label>消息描述:</label>
                                    <input type="text" class="form-control" id="search-desc" placeholder="请输入消息描述" value="{{ $search_desc }}">
                                    <label>消息渠道:</label>
                                    <select class="form-control" name="inner-choose-type" id="choose-tpl">
                                        @for($i=0;$i<count($msg_channels);$i++)
                                            <option value="{{ $i }}" @if($i==$search_channel) selected @endif>{{ $msg_channels[$i] }}</option>
                                        @endfor
                                    </select>
                                    <input class="btn btn-primary btn-sm" id="search-btn" style="float: right; margin-right: 60px" value="搜索"/>
                                </div>
                            </form>
                        </div>
                    </div>

                    @if(count($info)>0)
                        <div class="ibox-content">
                            <div class="dataTables_wrapper form-inline dt-bootstrap">
                                <div class="row">
                                    <div class="col-sm-12">
                                        <table class="table table-striped table-bordered table-hover">
                                            <thead>
                                                <tr role="row">
                                                    <th style="width:100px;" class="text-center">模板编号</th>
                                                    <th style="width:100px;" class="text-center">模板标题</th>
                                                    <th style="width:150px;" class="text-center">消息描述</th>
                                                    <th style="width:100px;" class="text-center">消息渠道</th>
                                                    <th style="width:100px;" class="text-center">操作</th>
                                                </tr>
                                            </thead>

                                            <tbody>
                                                @for($i=0;$i<count($info);$i++)
                                                    <tr role="row" style="text-align: center">
                                                        <td>{{ $info[$i]->tpl_id }}</td>
                                                        <td>{{ $info[$i]->title }}</td>
                                                        <td>{{ $info[$i]->description }}</td>
                                                        <td>{{ $info[$i]->show_channels_str }}</td>
                                                        @if($template_edit)
                                                            <td><a href="{{url('message/addtemplate')}}?tpl_id={{$info[$i]->tpl_id}}" class="btn btn-xs btn-outline btn-primary">编辑</a></td>
                                                        @endif
                                                    </tr>
                                                @endfor
                                            </tbody>
                                        </table>
                                        {!! $info->links() !!}
                                    </div>
                                </div>
                                <div class="row" id="my_list_paginate"></div>
                            </div>
                        </div>
                    @else
                        <div style="text-align: center">
                            <label>很抱歉,暂无数据</label>
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </div>
</div>
@else
    <div style="text-align: center">
        <label style="margin-top: 30px">对不起,您没有权限查看此页面</label>
        <div>
            @if($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_local'))
                <a href="{{ Config('msgconfig.perm_domain_local').'/page/business/'.Config('msgconfig.perm_bid_local').'/request/template_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
            @elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_sz'))
                <a href="{{ Config('msgconfig.perm_domain_sz').'/page/business/'.Config('msgconfig.perm_bid_sz').'/request/template_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
            @elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_release'))
                <a href="{{ Config('msgconfig.perm_domain_release').'/page/business/'.Config('msgconfig.perm_bid_release').'/request/template_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
            @endif
        </div>
    </div>
@endif