<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>警告内容</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<?= RESOURCES ?>/layuiadmin/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="<?= RESOURCES ?>/layuiadmin/layuiadmin/style/admin.css" media="all">
    <!-- 编辑器配置文件 -->
    <script type="text/javascript" src="<?= RESOURCES ?>/js/ueditor/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="<?= RESOURCES ?>/js/ueditor/ueditor.all.js"></script>
</head>

<body layadmin-themealias="default">

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" id="showPic">
                <div class="layui-card-body">
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span>*&nbsp;</span>警告类型</label>
                        <div class="layui-input-inline">
                            <select name="type" id="type" lay-search="">
                                <option value="">请选择警告类型</option>
                                <?php foreach($warning_type as $k => $v){?>
                                    <option value="<?=$v['id']?>"><?=$v['name']?></option>
                                <?php }?>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span>*&nbsp;</span>警告内容</label>
                        <div class="layui-input-block">
                            <textarea name="content" placeholder="请输入警告内容" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer">
                            <button class="layui-btn" lay-submit="" lay-filter="save">提交</button>
                        </div>
                    </div>
                </div>

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

<script src="<?= RESOURCES ?>/layuiadmin/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '<?= RESOURCES ?>/layuiadmin/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate'], function () {
        var $ = layui.$,
            admin = layui.admin,
            element = layui.element,
            layer = layui.layer,
            laydate = layui.laydate,
            form = layui.form,
            index = parent.layer.getFrameIndex(window.name); //获取窗口索引;

        form.render(null, 'component-form-group');

        laydate.render({
            elem: '.ghy-date',//制定元素
            type: 'date',
            trigger: 'click',//定义鼠标悬停时弹出控件
            show: false,//默认显示
            calendar: true,//是否显示公历节日
        });

        /* 监听指定开关 */
        form.on('switch(component-form-switchTest)', function (data) {

            if (this.checked == false) {
                $(".table-set").show();
            } else {
                $(".table-set").hide();
            }

        });
        /* 监听提交 */
        form.on('submit(save)', function (data) {
            layer.msg(data.field);
            // 请求接口
            admin.req({
                url: '/<?= ADMIN_NAME ?>/liveMonitor/warningUser?id=<?=$user_number?>',
                data: data.field,
                type: 'post',
                done: function (res) {
                    console.log(res);
                    layer.msg(res.msg, {
                        offset: '15px',
                        icon: 1,
                        time: 1000
                    }, function () {
                        parent.location.reload();
                        parent.layer.close(index);
                    });

                }
            });
            return false;
        });
    });
</script>
<style id="LAY_layadmin_theme">
    .layui-side-menu,
    .layadmin-pagetabs .layui-tab-title li:after,
    .layadmin-pagetabs .layui-tab-title li.layui-this:after,
    .layui-layer-admin .layui-layer-title,
    .layadmin-side-shrink .layui-side-menu .layui-nav > .layui-nav-item > .layui-nav-child {
        background-color: #20222A !important;
    }

    .layui-nav-tree .layui-this,
    .layui-nav-tree .layui-this > a,
    .layui-nav-tree .layui-nav-child dd.layui-this,
    .layui-nav-tree .layui-nav-child dd.layui-this a {
        background-color: #FFB800 !important;
    }

    .layui-layout-admin .layui-logo {
        background-color: #20222A !important;
    }
</style>
</body>
</html>