newmediamonitoring/management/templates/management/add-group-admin-and-user.html

275 lines
18 KiB
HTML

{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block content %}
<body class=" ">
<!-- START TOPBAR -->
<!-- START CONTAINER -->
<div class="page-container row-fluid">
<div class="page-sidebar ">
{% include 'dashboard/base/left.html' %}
</div>
<section id="main-content" class=" ">
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
{% if messages %}
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
{% for message in messages %}
{{ message }}.<br/>
{% endfor %}
</div>
{% endif %}
<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
<div class="page-title">
<div class="pull-left">
<h1 class="title">编辑矩阵</h1></div>
</div>
</div>
<div class="clearfix"></div>
<div class="col-lg-12 col-md-12 col-xs-12 col-sm-12">
<section class="box ">
<header class="panel_header">
<h2 class="title pull-left">矩阵信息表单</h2>
</header>
<div class="content-body">
<div class="row">
<div class="col-md-8 col-sm-9 col-xs-10">
<form method="post"
action="{% url 'group-management-update' group.id %}"
enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="name">矩阵名称</label>
<div class="controls">
<input type="text" class="form-control" name="name"
value="{{ group.name }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="presentation">矩阵介绍</label>
<div class="controls">
<input type="text" class="form-control"
name="presentation" value="{{ group.presentation }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="image">图标
<div class="controls">
<input type="file" name="image"><img
src="{{ group.image.url }}"
style="width: 80px;height: 80px;"
class="img-circle">
</div>
</label>
</div>
<div class="form-group">
<label class="form-label" for="type">矩阵类型</label>
<div class="controls">
<select class="form-control" name="type">
<option value="{{ group.type.id }}">{{ group.type }}</option>
{% for g in group_type %}
<option value="{{ g.id }}">{{ g.type }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="status">矩阵状态</label>
<div class="controls">
<select class="form-control" name="status">
<option value="{{ group.status }}">{{ group.status }}</option>
{% for g in group_status_choices_list %}
<option value="{{ g }}">{{ g }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="administrativedivision">行政区划</label>
<div class="controls">
<select id="province" name="province">
<option value="{{ group.province }}">{{ p }}</option>
</select>
<select id="city" name="city" style="margin-left: 20px">
<option value="{{ group.cities }}">{{ c }}</option>
</select>
<select id="district" name="district" style="margin-left: 20px">
<option value="{{ group.district }}">{{ d }}</option>
</select>
<select id="town" name="town" style="margin-left: 20px">
<option value="{{ group.town }}">{{ t }}</option>
</select>
<select id="village" name="village" style="margin-left: 20px">
<option value="{{ group.village }}">{{ v }}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="stauts">管理员</label>
<div class="controls" style="margin-left: 5%">
<a href="{% url 'group-admin-create' group.id %}"><span
class="glyphicon glyphicon-plus" aria-hidden="true">添加管理员</span></a>
<table class="table table-hover" style="margin-top: 20px">
<thead>
<tr>
<th style="text-align: center">头像</th>
<th style="text-align: center">用户名</th>
<th style="text-align: center">姓名</th>
<th style="text-align: center">单位名称</th>
<th style="text-align: center">行政区划</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
{% for g_a in g_a_list %}
<tr>
<td style="vertical-align: middle;text-align: center"><img
src="{{ g_a.image }}"
style="width: 80px;height: 80px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ g_a.username }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_a.name }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_a.organization }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_a.administrativedivision }}</td>
<td style="vertical-align: middle;text-align: center">
<a href="{% url 'group-admin-delete' g_a.id group.id %}"
class="btn btn-danger btn-mini">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="form-group">
<label class="form-label" for="stauts">成员</label>
<div class="controls" style="margin-left: 5%">
<a href="{% url 'group-user-create' group.id %}"><span
class="glyphicon glyphicon-plus" aria-hidden="true">添加成员</span></a>
<table class="table table-hover" style="margin-top: 20px">
<thead>
<tr>
<th style="text-align: center">头像</th>
<th style="text-align: center">用户名</th>
<th style="text-align: center">姓名</th>
<th style="text-align: center">单位名称</th>
<th style="text-align: center">行政区划</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
{% for g_u in g_u_list %}
<tr>
<td style="vertical-align: middle;text-align: center"><img
src="{{ g_u.image }}"
style="width: 80px;height: 80px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ g_u.username }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_u.name }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_u.organization }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_u.administrativedivision }}</td>
<td style="vertical-align: middle;text-align: center">
<a href="{% url 'group-user-delete' g_u.id group.id %}"
class="btn btn-danger btn-mini">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<button type="submit" class="btn btn-success">提交</button>
</form>
</div>
</div>
</div>
</section>
</div>
</section>
</section>
<div class="chatapi-windows "></div>
</div>
</body>
{% endblock %}
{% block add_js %}
<script>
$(function () {
$.get('/get/province/', function (data) {
for (var i = 0, len = data.province.length; i < len; i++) {
$new = $("<option value=" + data.province[i][0] + ">" + data.province[i][1] + "</option>");
$("#province").append($new);
}
})
//当省份改变后
$("#province").change(function () {
$("#city").empty().append('<option value="">请选择市</option>');
$("#district").empty().append('<option value="">请选择区/县</option>');
$("#town").empty().append('<option value="">请选择乡/镇</option>');
$("#village").empty().append('<option value="">请选择村/街道</option>');
$.ajax({
url: '/get/city/',
type: 'get',
data: {"code": $(this).val()}
}).done(function (data) {
for (var i = 0, len = data.city.length; i < len; i++) {
$new = $("<option value=" + data.city[i][0] + ">" + data.city[i][1] + "</option>");
$("#city").append($new);
}
})
})
//当城市改变后
$("#city").change(function () {
$("#district").empty().append('<option value="">请选择区/县</option>');
$("#town").empty().append('<option value="">请选择乡/镇</option>');
$("#village").empty().append('<option value="">请选择村/街道</option>');
$.ajax({
url: '/get/district/',
type: 'get',
data: {"code": $(this).val()}
}).done(function (data) {
for (var i = 0, len = data.district.length; i < len; i++) {
$new = $("<option value=" + data.district[i][0] + ">" + data.district[i][1] + "</option>");
$("#district").append($new);
}
})
})
//当县改变后
$("#district").change(function () {
$("#town").empty().append('<option value="">请选择乡/镇</option>');
$("#village").empty().append('<option value="">请选择村/街道</option>');
$.ajax({
url: '/get/town/',
type: 'get',
data: {"code": $(this).val()}
}).done(function (data) {
for (var i = 0, len = data.town.length; i < len; i++) {
$new = $("<option value=" + data.town[i][0] + ">" + data.town[i][1] + "</option>");
$("#town").append($new);
}
})
})
//当乡改变后
$("#district").change(function () {
$("#village").empty().append('<option value="">请选择村/街道</option>');
$.ajax({
url: '/get/village/',
type: 'get',
data: {"code": $(this).val()}
}).done(function (data) {
for (var i = 0, len = data.village.length; i < len; i++) {
$new = $("<option value=" + data.village[i][0] + ">" + data.village[i][1] + "</option>");
$("#village").append($new);
}
})
})
})
</script>
{% endblock %}