219 lines
14 KiB
HTML
219 lines
14 KiB
HTML
{% extends "base_AdminLTE.html" %}
|
|
{% block title %}Docklet | Notification{% endblock %}
|
|
|
|
{% block panel_title %}Notifications{% endblock %}
|
|
|
|
{% block panel_list %}
|
|
<ol class="breadcrumb">
|
|
<li>
|
|
<a href="/dashboard/"><i class="fa fa-dashboard"></i>Home</a>
|
|
</li>
|
|
<li class="active">
|
|
<strong>Notifications</strong>
|
|
</li>
|
|
</ol>
|
|
{% endblock %}
|
|
|
|
{% block css_src %}
|
|
<link href="/static/dist/css/modalconfig.css" rel="stylesheet">
|
|
{% endblock %}
|
|
|
|
{##}
|
|
{% block content %}
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="box box-info">
|
|
<div class="box-header with-border">
|
|
<h3 class="box-title">Notifications</h3>
|
|
|
|
<div class="box-tools pull-right">
|
|
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
|
<i class="fa fa-minus"></i>
|
|
</button>
|
|
<button type="button" class="btn btn-box-tool" data-widget="remove">
|
|
<i class="fa fa-times"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="box-body" style="white-space:normal;word-break:break-all;word-wrap:break-word;">
|
|
<p>
|
|
<a href="/notification/create/">
|
|
<button type="button" class="btn btn-primary"><i class="fa fa-plus"></i> Add new notification</button>
|
|
</a>
|
|
</p>
|
|
<div class="table table-responsive">
|
|
<table id="notificationTable" class="table table-striped table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Title</th>
|
|
<th>Content</th>
|
|
<th>Groups</th>
|
|
<th>Create Date</th>
|
|
<th>Status</th>
|
|
<th>Command</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for notify in notifications %}
|
|
<tr>
|
|
<td>{{ notify['id'] }}</td>
|
|
<td>{{ notify['title'] }}</td>
|
|
<td>{{ notify['content']|truncate(30) }}</td>
|
|
<td>
|
|
{% for group_name in notify['groups'] %}<code>{{ group_name }}</code> {% endfor %}
|
|
</td>
|
|
<td>{{ notify['create_date'] }}</td>
|
|
<td>{{ notify['status'] }}</td>
|
|
<td>
|
|
<a class="btn btn-xs btn-success" data-toggle="modal" data-target="#detailModal_{{ notify['id'] }}"><i class="fa fa-plus"></i> details</a>
|
|
<a class="btn btn-xs btn-info" data-toggle="modal" data-target="#editModal_{{ notify['id'] }}"><i class="fa fa-pencil"></i> edit</a>
|
|
<a class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal_{{ notify['id'] }}"><i class="fa fa-times"></i> delete</a>
|
|
</td>
|
|
<!-- Modal Dialog -->
|
|
<div class="modal inmodal" id="detailModal_{{ notify['id'] }}" role="dialog" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">
|
|
<span aria-hidden="true">×</span>
|
|
<span class="sr-only">Close</span>
|
|
</button>
|
|
<i class="fa fa-envelope modal-icon"></i>
|
|
<h4 class="modal-title">Notification Details</h4>
|
|
<small class="font-bold">Show the details of the notification</small>
|
|
</div>
|
|
<div class="modal-body">
|
|
<h4><i class="fa fa-star"></i> Title</h4>
|
|
<p>{{ notify['title'] }}</p>
|
|
<br>
|
|
<h4><i class="fa fa-star"></i> Content</h4>
|
|
<p>{{ notify['content'] }}</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal inmodal" id="editModal_{{ notify['id'] }}" role="dialog" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">
|
|
<span aria-hidden="true">×</span>
|
|
<span class="sr-only">Close</span>
|
|
</button>
|
|
<i class="fa fa-envelope modal-icon"></i>
|
|
<h4 class="modal-title">Edit Notification</h4>
|
|
<small class="font-bold">Edit the details of the notification</small>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="modifyNotificationForm_{{ notify['id'] }}" action="/notification/modify/" method="post">
|
|
<div class="form-group">
|
|
<label>Title</label>
|
|
<input type="text" class="form-control" name="title" value="{{ notify['title'] }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Content</label>
|
|
<textarea class="form-control" name="content">{{ notify['content'] }}</textarea>
|
|
</div>
|
|
<div class="form-group" style="margin-bottom: 0">
|
|
<label>Groups</label>
|
|
<input type="text" class="form-control" name="notify_id" style="display: none" value="{{ notify['id'] }}">
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="checkbox col-sm-10">
|
|
<label style="display: none"><input type="checkbox" checked name="groups" value="none" style="display: none"></label>
|
|
{% if 'all' in notify['groups'] %}
|
|
<label><input type="checkbox" checked name="groups" value="all">all </label>
|
|
{% else %}
|
|
<label><input type="checkbox" name="groups" value="all">all </label>
|
|
{% endif %}
|
|
{% for group_name in groups %}
|
|
{% if group_name in notify['groups'] %}
|
|
<label><input type="checkbox" checked name="groups" value="{{ group_name }}">{{ group_name }} </label>
|
|
{% else %}
|
|
<label><input type="checkbox" name="groups" value="{{ group_name }}">{{ group_name }} </label>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
<div class="row"></div>
|
|
<div class="form-group">
|
|
<h5>
|
|
<b>Status</b>
|
|
</h5>
|
|
<div class="radio">
|
|
{% if 'open' == notify['status'] %}
|
|
<label><input type="radio" name="status" checked value="open">open</label>
|
|
<label><input type="radio" name="status" value="closed">closed</label>
|
|
{% else %}
|
|
<label><input type="radio" name="status" value="open">open</label>
|
|
<label><input type="radio" name="status" checked value="closed">closed</label>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<h5>
|
|
<b>Also send email</b>
|
|
</h5>
|
|
<input type="checkbox" name="sendMail" value="true">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary" onClick="sendModifyNotification({{ notify['id'] }});">Save</button>
|
|
<button type="button" class="btn btn-white" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal inmodal" id="deleteModal_{{ notify['id'] }}" role="dialog" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal">
|
|
<span aria-hidden="true">×</span>
|
|
<span class="sr-only">Close</span>
|
|
</button>
|
|
<h4 class="modal-title">Delete Notification </h4>
|
|
<small class="font-bold">Delete this notification</small>
|
|
</div>
|
|
<div class="modal-body">
|
|
<strong class="text-center">Are you sure to do this?</strong>
|
|
<form id="deleteNotificationForm_{{ notify['id'] }}" style="display: none" action="/notification/delete/" method="post">
|
|
<input type="text" class="form-control" name="notify_id" style="display: none" value="{{ notify['id'] }}">
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-danger" onClick="sendDeleteNotification({{ notify['id'] }});">Delete</button>
|
|
<button type="button" class="btn btn-white" data-dismiss="modal">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block script_src %}
|
|
<script type="text/javascript">
|
|
function sendModifyNotification(notifyId) {
|
|
$('#modifyNotificationForm_'+notifyId).submit();
|
|
}
|
|
function sendDeleteNotification(notifyId) {
|
|
$('#deleteNotificationForm_'+notifyId).submit();
|
|
}
|
|
</script>
|
|
{% endblock %}
|