<!DOCTYPE html>
<!--解决idea thymeleaf 表达式模板报红波浪线-->
<!--suppress ALL -->
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- 引入公用部分 -->
    <script th:replace="common/head::static"></script>
</head>
<body>
<div class="layui-row layui-col-space15">
    <!-- 树 -->
    <div class="layui-col-md12">
        <div class="layui-card">
            <!--<div class="layui-card-header">背包列表</div>-->
            <div class="layui-card-body">
                <!-- 表格主体 -->
                <table class="layui-hide" id="mainTable" lay-filter="test"></table>
                <!-- 模板 -->
                <script type="text/html" id="mainTableToolbarDemo">
                    <div class="layui-btn-container" style="display: flex;align-items: center; margin-bottom: 10px;">
                        <button class="layui-btn layui-btn-sm " style="margin-bottom: 0;" lay-event="addNewRow">新增<i
                                class="layui-icon layui-icon-add-1"></i></button>
                        <input type="text" id="queryByInput" name="queryByInput" autocomplete="off"
                               placeholder="输入mac地址查询" class="layui-input layui-btn-sm "
                               style="width: 300px;margin-right: 10px;">
                        <button class="layui-btn layui-btn-sm " style="margin-bottom: 0;" lay-event="query">查询<i
                                class="layui-icon layui-icon-search"></i></button>
                    </div>
                </script>

                <script type="text/html" id="mainTableBarDemo">
                    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑<i class="layui-icon layui-icon-edit"></i></a>
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                </script>
                <script type="text/html" id="bindButton">
                    {{# if(d.bluetoothStatus == 1){}}
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="unBind">解除绑定用户</a>
                    {{#}else{}}
                    <a class="layui-btn layui-btn-disabled layui-btn-xs">尚未绑定用户</a>
                    {{#}}}
                </script>

                <!--<script type="text/html" id="itemTypeTpl">-->
                <!--    <select id="demoCity1" class="layui-border" lay-ignore>-->
                <!--        <option th:each="prop,iterStat : ${propList}"  th:value="${prop.id}" th:text="${prop.itemName }">-->
                <!--        </option>-->
                <!--    </select>-->
                <!--</script>-->
            </div>
        </div>

    </div>
    <!-- 操作表单 -->
    <div class="layui-col-md12" style="display:none;" id="show_div">
        <div class="layui-card">
            <div class="layui-card-body">
                <form id="comForm" class="layui-form layui-form-pane" lay-filter="comForm">
                    <div class="layui-form-item">
                        <label class="layui-form-label">蓝牙ID</label>
                        <div class="layui-input-block">
                            <input type="text" name="bluetoothId" autocomplete="off" placeholder="bluetoothId"
                                   class="layui-input" readonly="readonly">
                        </div>
                    </div>
                    <!--  id="tableId" -->
                    <div class="layui-form-item" hidden="hidden">
                        <label class="layui-form-label">用户ID</label>
                        <div class="layui-input-block">
                            <input type="text" name="userId" autocomplete="off" placeholder="userId"
                                   class="layui-input" readonly="readonly">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">蓝牙名字</label>
                        <div class="layui-input-block">
                            <input type="text" name="bluetoothName" autocomplete="off" placeholder="bluetoothName"
                                   class="layui-input" lay-verify="required">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">蓝牙地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="bluetoothMac" autocomplete="off" placeholder="bluetoothMac"
                                   class="layui-input" lay-verify="required">
                        </div>
                    </div>
                    <div class="layui-form-item" hidden="hidden">
                        <label class="layui-form-label">设备状态</label>
                        <div class="layui-input-block">
                            <input type="text" name="bluetoothStatus" autocomplete="off" placeholder="bluetoothStatus"
                                   class="layui-input" readonly="readonly" lay-verify="required">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">设备类型</label>
                        <div class="layui-input-block">
                            <select name="bluetoothType" id="bluetoothType" lay-verify="required" lay-filter="xmFilter">
                                <option value="">请选择</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否分享</label>
                        <div class="layui-input-block">
                            <select name="isShare" id="isShare" lay-verify="required" lay-filter="xmFilter">
                                <option value="">请选择</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item" hidden="hidden">
                        <label class="layui-form-label">设备标识</label>
                        <div class="layui-input-block">
                            <input type="text" name="identifier" autocomplete="off" placeholder="identifier"
                                   class="layui-input" readonly="readonly">
                        </div>
                    </div>

                    <div class="layui-form-item" id="tableTime">
                        <div class="layui-inline">
                            <label class="layui-form-label">创建时间</label>
                            <div class="layui-input-block">
                                <input type="text" name="createTime" autocomplete="off" class="layui-input"
                                       readonly="readonly">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item" id="tableTime">
                        <div class="layui-inline">
                            <label class="layui-form-label">更新时间</label>
                            <div class="layui-input-block">
                                <input type="text" name="updateTime" autocomplete="off" class="layui-input"
                                       readonly="readonly">
                            </div>
                        </div>
                    </div>
                    <!-- 隐藏域 -->
                    <!--<input type="text" name="userId" hidden="hidden"/>-->

                    <div class="layui-form-item">
                        <a id="saveBtn" class="layui-btn" type="submit" lay-submit lay-filter="comFilter">保存</a>
                    </div>
                </form>

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

    <div class="layui-col-md12" style="display:none;" id="show_add_div">
        <div class="layui-card">
            <div class="layui-card-body">
                <form id="addForm" class="layui-form layui-form-pane" lay-filter="addForm">
                    <div class="layui-form-item">
                        <label class="layui-form-label">蓝牙名字</label>
                        <div class="layui-input-block">
                            <input type="text" name="bluetoothName" autocomplete="off" placeholder="bluetoothName"
                                   class="layui-input" value="[[${defaultName}]]">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">蓝牙地址</label>
                        <div class="layui-input-block">
                            <input type="text" name="bluetoothMac" autocomplete="off" placeholder="bluetoothMac"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">设备类型</label>
                        <div class="layui-input-block">
                            <select name="bluetoothType" id="bluetoothTypeAdd" lay-verify="required"
                                    lay-filter="xmFilter">
                                <option value="">请选择</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否分享</label>
                        <div class="layui-input-block">
                            <select name="isShare" id="isShareAdd" lay-verify="required" lay-filter="xmFilter">
                                <option value="">请选择</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <a id="addBtn" class="layui-btn" type="submit" lay-submit lay-filter="comAddFilter">新增</a>
                    </div>
                </form>

            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" th:inline="javascript">
    //新增数据表单
    defaultBLEData = {"bluetoothName": [[${defaultName}]], "bluetoothMac": [[${defaultMac}]]};
</script>
<script th:src="@{/client/js/bluetoothInfo.js}"></script>
</html>