<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <title>{{.SeoTitle}} - {{.SITE_NAME}}</title>

    <link href="{{$.StaticDomain}}/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="{{$.StaticDomain}}/static/font-awesome/css/font-awesome.min.css" rel="stylesheet">

    <link href="/static/css/main.css?version={{$.Version}}" rel="stylesheet">
{{/*<script src="/static/html5shiv/3.7.3/html5shiv.min.js"></script>*/}}
    <script src="{{$.StaticDomain}}/static/html5shiv/3.7.3/html5shiv.min.js"></script>
{{/*<script src="/static/respond.js/1.4.2/respond.min.js"></script>*/}}
    <script src="{{$.StaticDomain}}/static/respond.js/1.4.2/respond.min.js"></script>

    <link rel="stylesheet" href="/static/css/toast.css">
    <style>
        .box-body img{width: 400px;}
        .input-group{margin-bottom: 5px;}
    </style>
</head>
<body>
<div class="manual-reader">
    {{template "widgets/header.html" .}}
    <div class="container manual-body">
        <div class="row">
            <div class="page-left">
                {{template "manager/menu.html" .}}
            </div>
            <div class="page-right">
                <div class="m-box">
                    <div class="box-head">
                        <strong class="box-title">{{.SeoTitle}}</strong>
                        <a href="JavaScript:void(0);" class="pull-right btn btn-success" data-toggle="modal" data-target="#FlModal">新增横幅</a>
                    </div>
                </div>
                <div class="box-body" id="bookList">
                    <table class="table table-hover table-striped">
                        <caption>说明：排序，数值越大越靠前；同一分类下的横幅，尺寸务必相同</caption>
                        <thead>
                        <tr>
                            <th>图片</th>
                            <th>信息</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                            {{range .Banners}}
                                <tr>
                                    <td>
                                        <img src="{{showImg .Image}}" alt="横幅">
                                    </td>
                                    <td>
                                        <div class="input-group">
                                            <span class="input-group-addon">分类</span>
                                            <select name="type" class="form-control change-update" data-url="{{urlfor "ManagerController.UpdateBanner"}}?id={{.Id}}">
                                                <option value="wechat">移动端/小程序横幅</option>
                                                <option value="pc">PC横幅</option>
                                            </select>
                                        </div>
                                        <div class="input-group">
                                            <span class="input-group-addon">名称</span>
                                            <input type="text" class="form-control change-update" data-url="{{urlfor "ManagerController.UpdateBanner"}}?id={{.Id}}" name="title" value="{{.Title}}">
                                        </div>
                                        <div class="input-group">
                                            <span class="input-group-addon">链接</span>
                                            <input type="text" class="form-control change-update" data-url="{{urlfor "ManagerController.UpdateBanner"}}?id={{.Id}}"name="link" value="{{.Link}}">
                                        </div>
                                        <div class="input-group">
                                            <span class="input-group-addon">排序</span>
                                            <input type="number" class="form-control change-update" data-url="{{urlfor "ManagerController.UpdateBanner"}}?id={{.Id}}" name="sort" value="{{.Sort}}">
                                        </div>
                                    </td>
                                    <td>
                                        {{if .Status}}
                                            <span class="text-success">启用</span>
                                        {{else}}
                                            <span class="text-danger">关闭</span>
                                        {{end}}
                                    </td>
                                    <td>
                                        {{if .Status}}
                                            <a href="{{urlfor "ManagerController.UpdateBanner"}}?id={{.Id}}&field=status&value=0" class="ajax-get">关闭</a>
                                        {{else}}
                                            <a href="{{urlfor "ManagerController.UpdateBanner"}}?id={{.Id}}&field=status&value=1" class="ajax-get">启用</a>
                                        {{end}}
                                        <br>
                                        <br>
                                        <a href="{{urlfor "ManagerController.DeleteBanner"}}?id={{.Id}}" class="text-danger confirm ajax-get">删除</a>
                                    </td>
                                </tr>
                            {{end}}
                        </tbody>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="FlModal" tabindex="-1" role="dialog" aria-labelledby="FlModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <form action="{{urlfor "ManagerController.UploadBanner"}}" enctype="multipart/form-data" class="ajax-form" method="post">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="FlModalLabel">新增横幅</h4>
                </div>
                <div class="modal-body">
                    <div class="input-group">
                        <span class="input-group-addon">分类</span>
                        <select name="type" class="form-control">
                            <option value="wechat">移动端/小程序横幅</option>
                            <option value="pc">PC横幅</option>
{{/*                            <option value="mobi">移动端横幅</option>*/}}
                        </select>
                    </div>
                    <div class="input-group">
                        <span class="input-group-addon">名称</span>
                        <input type="text" class="form-control" name="title" value="">
                    </div>
                    <div class="input-group">
                        <span class="input-group-addon">链接</span>
                        <input type="text" class="form-control"name="link" value="">
                    </div>
                    <div class="input-group">
                        <span class="input-group-addon">排序</span>
                        <input type="number" class="form-control" name="sort" value="">
                    </div>
                    <div class="input-group">
                        <span class="input-group-addon">图片</span>
                        <input type="file" class="form-control" name="image" accept="image/png,image/jpeg,image/jpg,image/gif" value="">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消新增</button>
                    <button type="submit" class="btn btn-success">新增横幅</button>
                </div>
            </form>
        </div>
    </div>
</div>

<iframe src="javascript:void(0);" class="hidden" name="notarget" id="notarget"></iframe>

{{/*<script src="/static/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>*/}}
<script src="{{$.StaticDomain}}/static/jquery/1.12.4/jquery.min.js" type="text/javascript"></script>
{{/*<script src="/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>*/}}
<script src="{{$.StaticDomain}}/static/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{$.StaticDomain}}/static/js/toast.script.js"></script>
<script src="/static/js/main.js?version={{$.Version}}" type="text/javascript"></script>
</body>
</html>