2018-08-18 11:41:59 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
{% set active_page = "admin_history" %}
|
|
|
|
{% block title %}
|
2018-08-18 15:42:18 +00:00
|
|
|
<title>History - {{ SITE_NAME }}</title>
|
2016-04-22 07:06:01 +00:00
|
|
|
{% endblock %} {% block dashboard_stat %}
|
|
|
|
<!-- Content Header (Page header) -->
|
|
|
|
<section class="content-header">
|
2016-06-18 04:41:01 +00:00
|
|
|
<h1>
|
2019-12-02 03:32:03 +00:00
|
|
|
History <small>Recent events</small>
|
2016-06-18 04:41:01 +00:00
|
|
|
</h1>
|
|
|
|
<ol class="breadcrumb">
|
2019-12-02 03:32:03 +00:00
|
|
|
<li><a href="{{ url_for('dashboard.dashboard') }}"><i class="fa fa-dashboard"></i> Home</a></li>
|
2016-06-18 04:41:01 +00:00
|
|
|
<li class="active">History</li>
|
|
|
|
</ol>
|
2016-04-22 07:06:01 +00:00
|
|
|
</section>
|
|
|
|
{% endblock %} {% block content %}
|
|
|
|
<section class="content">
|
2016-06-18 04:41:01 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-xs-12">
|
|
|
|
<div class="box">
|
|
|
|
<div class="box-header">
|
|
|
|
<h3 class="box-title">History Management</h3>
|
|
|
|
</div>
|
|
|
|
<div class="box-body clearfix">
|
2019-12-02 03:32:03 +00:00
|
|
|
<button type="button" class="btn btn-flat btn-danger pull-right" data-toggle="modal"
|
|
|
|
data-target="#modal_clear_history"
|
|
|
|
{% if current_user.role.name != 'Administrator' %}disabled{% endif %}>
|
2016-06-18 04:41:01 +00:00
|
|
|
Clear History <i class="fa fa-trash"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="box-body">
|
|
|
|
<table id="tbl_history" class="table table-bordered table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Changed by</th>
|
|
|
|
<th>Content</th>
|
|
|
|
<th>Time</th>
|
|
|
|
<th>Detail</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for history in histories %}
|
|
|
|
<tr class="odd gradeX">
|
|
|
|
<td>{{ history.created_by }}</td>
|
|
|
|
<td>{{ history.msg }}</td>
|
|
|
|
<td>{{ history.created_on }}</td>
|
|
|
|
<td width="6%">
|
2019-12-02 03:32:03 +00:00
|
|
|
<button type="button" class="btn btn-flat btn-primary history-info-button"
|
|
|
|
value='{{ history.detail }}'>Info <i class="fa fa-info"></i>
|
2016-06-18 04:41:01 +00:00
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<!-- /.box-body -->
|
|
|
|
</div>
|
|
|
|
<!-- /.box -->
|
|
|
|
</div>
|
|
|
|
<!-- /.col -->
|
|
|
|
</div>
|
|
|
|
<!-- /.row -->
|
2016-04-22 07:06:01 +00:00
|
|
|
</section>
|
2018-11-21 03:24:33 +00:00
|
|
|
{% endblock %}
|
2016-04-22 07:06:01 +00:00
|
|
|
{% block extrascripts %}
|
|
|
|
<script>
|
2016-06-18 04:41:01 +00:00
|
|
|
// set up history data table
|
|
|
|
$("#tbl_history").DataTable({
|
2019-12-02 03:32:03 +00:00
|
|
|
"paging": true,
|
|
|
|
"lengthChange": false,
|
|
|
|
"searching": true,
|
|
|
|
"ordering": true,
|
|
|
|
"info": true,
|
|
|
|
"autoWidth": false,
|
|
|
|
"order": [
|
|
|
|
[2, "desc"]
|
|
|
|
],
|
|
|
|
"columnDefs": [{
|
|
|
|
"type": "time",
|
|
|
|
"render": function (data, type, row) {
|
|
|
|
return moment.utc(data).local().format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
},
|
|
|
|
"targets": 2
|
|
|
|
}]
|
2016-06-18 04:41:01 +00:00
|
|
|
});
|
2019-12-02 03:32:03 +00:00
|
|
|
$(document.body).on('click', '.history-info-button', function () {
|
2016-06-18 04:41:01 +00:00
|
|
|
var modal = $("#modal_history_info");
|
|
|
|
var info = $(this).val();
|
2016-08-21 14:46:23 +00:00
|
|
|
$('#modal-code-content').html(json_library.prettyPrint(info));
|
2016-06-18 04:41:01 +00:00
|
|
|
modal.modal('show');
|
|
|
|
});
|
2015-12-13 09:34:12 +00:00
|
|
|
</script>
|
2018-11-21 03:24:33 +00:00
|
|
|
{% endblock %}
|
2016-04-22 07:06:01 +00:00
|
|
|
{% block modals %}
|
|
|
|
<!-- Clear History Confirmation Box -->
|
|
|
|
<div class="modal fade modal-warning" id="modal_clear_history">
|
2016-06-18 04:41:01 +00:00
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2019-12-02 03:32:03 +00:00
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
2016-06-18 04:41:01 +00:00
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
<h4 class="modal-title">Confirmation</h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<p>Are you sure you want to remove all history?</p>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2019-12-02 03:32:03 +00:00
|
|
|
<button type="button" class="btn btn-flat btn-default pull-left" data-dismiss="modal">Close</button>
|
|
|
|
<button type="button" class="btn btn-flat btn-danger"
|
|
|
|
onclick="applyChanges({'_csrf_token': '{{ csrf_token() }}'}, $SCRIPT_ROOT + '/admin/history', false, true);">Clear
|
|
|
|
History</button>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /.modal-content -->
|
|
|
|
</div>
|
|
|
|
<!-- /.modal-dialog -->
|
2016-04-22 07:06:01 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal fade" id="modal_history_info">
|
2016-06-18 04:41:01 +00:00
|
|
|
<div class="modal-dialog">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2019-12-02 03:32:03 +00:00
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
2016-06-18 04:41:01 +00:00
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
<h4 class="modal-title">History Details</h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
2016-08-21 14:46:23 +00:00
|
|
|
<pre><code id="modal-code-content"></code></pre>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2019-12-02 03:32:03 +00:00
|
|
|
<button type="button" class="btn btn-flat btn-default pull-right" data-dismiss="modal">Close</button>
|
2016-06-18 04:41:01 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /.modal-content -->
|
|
|
|
</div>
|
|
|
|
<!-- /.modal-dialog -->
|
2016-04-22 07:06:01 +00:00
|
|
|
</div>
|
|
|
|
<!-- /.modal -->
|
2015-12-13 09:34:12 +00:00
|
|
|
{% endblock %}
|