phone_notification.html 4.8 KB
{% extends 'admin/admin.html' %}
{% import "common/admin_page.html" as pg %}
{% block content %}
<!--内容-->
<section class="content-header">
    <h1>安监物联管理系统</h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 报警管理</a></li>
        <li class="active">短信通知</li>
    </ol>
</section>
<section class="content" id="showcontent">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header">
                    <h3 class="box-title">通知列表</h3>

                    <div class="box-tools">
                        <form action="" method="GET">
                        <div class="input-group input-group-sm" style="width: 150px;">
                            <input type="text" name="keyword" class="form-control pull-right"
                                   placeholder="请输入手机号">

                            <div class="input-group-btn">
                                <button type="submit" class="btn btn-default"><i class="fa fa-search"></i>
                                </button>
                            </div>
                        </div>
                        </form>
                    </div>
                </div>
                <div class="box-body table-responsive no-padding">
                    {% for msg in get_flashed_messages(category_filter=["ok"]) %}
                        <div class="alert alert-success alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
                            </button>
                            <h4><i class="icon fa fa-check"></i> 操作成功</h4>
                            {{ msg }}
                        </div>
                    {% endfor %}
                    <table class="table table-hover" id="table">
                        <tbody>
                        <tr>
                            <th>编号</th>
                            <th>昵称</th>
                            <th>手机</th>
                            <th>头像</th>
                            <th>选择</th>
                            <th>操作</th>
                        </tr>
                        {% for v in page_data.items %}
                            <tr>
                                <td>{{ v.id }}</td>
                                <td>{{ v.username }}</td>
                                <td>{{ v.phone }}</td>
                                <td>
                                    <img style="width: 50px;height: 50px;"
                                         src="{{ url_for('static', filename='uploads/users/huazai.jpg') }}"
                                         class="img-responsive center-block" alt="">
                                </td>

                                <td>
                                    {% if v.phonenotification == 1 %}
                                    <input type="checkbox" id="check{{ v.id }}" checked="checked">
                                    {% else %}
                                    <input type="checkbox" id="check{{ v.id }}">
                                    {% endif %}
                                </td>
                                <td>

                                    <button onclick="submit_btn(this)" id="{{ v.id }}" class="btn btn-info btn-xs">保存</button>
                                </td>
                        </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {{ pg.page(page_data,'admin.user_list') }}
                </div>
            </div>
        </div>
    </div>
</section>
<!--内容-->
{% endblock %}

{% block js %}
<script>
    $(document).ready(function(){
        $("#g-5").addClass("active");
        $("#g-5-1").addClass("active");
    });

    function  submit_btn(obj) {


        var id = $(obj).attr("id");

        try {
            var check = document.getElementById("check"+id).checked;
            var c = 1;
            if (check)
            {
                c = 1;
            }
            else
            {
               c = 0;
            }
            var s_url = "{{  s_url }}";
            $.ajax({
                type: "GET",
                url: s_url + "/phonenotification_edit",
                data: {id:id, phone:c},
                dataType: "json",
                success: function (result) {
                    alert("保存成功");
                },
                error: function (e) {
                    alert("error");
                }
            });

        }

        catch (e) {
            alert(e);
        }

    }

</script>
{% endblock %}