<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sptg="http://www.thymeleaf.org">
<head>
    <script th:replace="common/head"></script>
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto" style="padding:0;">
                <div class="layui-form-item border-b">
                    <div class="layui-inline">
                        <label class="layui-form-label">广告名称</label>
                        <div class="layui-input-block">
                            <input type="text" id="selectedAdTitle" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline" style="margin-left: 38px;">
                        <button class="layui-btn layuiadmin-btn-useradmin"  lay-submit lay-filter="query">查询</button>
                        <button class="layui-btn  layui-btn-primary"  lay-submit lay-filter="reset">重置</button>
                    </div>
                </div>
                <!-- 表格+头部按钮 -->
                <div class="layui-card-body" style="padding:0;">
                    <div style="padding-bottom: 10px;">
                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="add" sptg:security="ad:push:offline:insert">发布广告</button>
<!--                        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="threshold">阈值配置</button>-->
                    </div>
                    <table id="table-id" lay-filter="table-id"></table>
                </div>
            </div>



            <!--操作-->
            <script type="text/html" id="table-operate-id">
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="task_detail">详情</a>
                <!--发布状态{ -1：发布失败，0：待发布，1：发布成功，2：已撤销 }-->
                {{# if(d.pushStatus==0){ }}
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="cancel" sptg:security="ad:offline:push:delete">删除</a>
                <a class="layui-btn layui-btn-xs" lay-event="push">上刊</a>
                {{# }else if(d.pushStatus == 1){ }}
                <a class="layui-btn layui-btn-xs" lay-event="down">下刊</a>
                {{# } }}
            </script>

            <input type="hidden" id="fastDfsServer" th:value="${fastDfsServer}"/>
            <script type="text/html" id="materialFileTemplate">
                <img src="{{fastDfsServer + d.adMaterialFile}}"
                     style="display: inline-block; width: 80%; height: 100%;cursor: zoom-in">
            </script>
            <script type="text/html" id="pushTypeTemplate">
                {{#  if(d.pushType == 1){ }}
                <span>按小区</span>
                {{#  } else if(d.pushType == 2){ }}
                <span>按广告位</span>
                {{#  } else if(d.pushType == 3){ }}
                <span>按区域</span>
                {{#  }  }}
            </script>
            <!-- 发布结果 -->
            <script type="text/html" id="pushStatus">
             {{# if(d.pushStatus == 0){ }}
                <span style="color: blue">待上刊</span>
                {{#  } else if(d.pushStatus == 1){ }}
                <span style="color: green">已上刊</span>
                {{#  } else if(d.pushStatus == 2){ }}
                <span style="color: gray">已下刊</span>
                {{#  }  }}
            </script>

        </div>
    </div>
    <!-- javascript -->
    <script th:src="@{'/layui/layui.js'}" charset="utf-8"></script>
    <script>
        layui.config({
            base: '/' //静态资源所在路径
        });
        var fastDfsServer = document.getElementById("fastDfsServer").value;
    </script>
    <script th:src="@{'/js/ad/ad-offline-push-manage.js'}" charset="utf-8"></script>
</body>

</html>
