test/app/apps/events/templates/system_events.html
zakhy 5069a82ae6 Merge branch 'Idealizm'
Докеризация

# Conflicts:
#	app/apps/events/views/views_events.py
#	app/apps/gto/migrations/0027_auto_20250721_2141.py
#	app/apps/gto/migrations/0028_alter_modeltypeicons_model.py
#	app/apps/gto/models/model_gto_external_system.py
#	app/apps/management/templates/gto_icons.html
#	app/apps/management/templates/icon_add.html
#	app/apps/management/templates/icons/remove_icon.html
#	app/apps/management/views/views_general.py
#	app/apps/management/views/views_geoproc.py
#	app/apps/management/views/views_gto.py
#	app/apps/management/views/views_pla.py
#	app/apps/management/views/views_seismicproc.py
#	app/apps/management/views/views_wklocation.py
#	app/mfssogr/urls.py
#	apps/management/templates/gto/gto_icons.html
#	apps/management/templates/gto/icon_add.html
#	apps/management/templates/gto_icons.html
#	apps/management/templates/icon_add.html
2025-07-24 15:23:47 +07:00

278 lines
15 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "default.html" %}
{% load static %}
{% load mysettings %}
{% block header_link %}
<!-- Select2 -->
<link rel="stylesheet"
href="{% static 'lte/plugins/select2/css/select2.min.css' %}?ver={% settings_value 'APP_VER' %}">
<link rel="stylesheet"
href="{% static 'lte/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css' %}?ver={% settings_value 'APP_VER' %}">
<link rel="stylesheet" href="{% static 'js/ol/theme/default/ol.css' %}">
<link rel="stylesheet" href="{% static 'js/ol/theme/default/style.css' %}?ver={% settings_value 'APP_VER' %}">
<link rel="stylesheet" href="{% static 'js/ol/ol-ext/ol-ext.min.css' %}?ver={% settings_value 'APP_VER' %}">
<link rel="stylesheet" href="{% static 'js/ol/ol-ext/ol-layer-theme.css' %}?ver={% settings_value 'APP_VER' %}">
<link rel="stylesheet" href="{% static 'css/main_page.css' %}?ver={% settings_value 'APP_VER' %}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<style>.full-width-search {
width: 100%;
margin-bottom: 10px;
}
.full-width-search label {
width: 100%;
}
.full-width-search input {
width: 100%;
box-sizing: border-box;
}
table.dataTable thead .sorting:after {
font-family: "Font Awesome 6 Free";
content: "\f0dc"; /* fa-sort */
font-weight: 900;
padding-left: 5px;
}
table.dataTable thead .sorting_asc:after {
font-family: "Font Awesome 6 Free";
content: "\f0de"; /* fa-sort-up */
font-weight: 900;
padding-left: 5px;
}
table.dataTable thead .sorting_desc:after {
font-family: "Font Awesome 6 Free";
content: "\f0dd"; /* fa-sort-down */
font-weight: 900;
padding-left: 5px;
}
</style>
{% endblock header_link %}
{% block content %}
<section class="content">
<div class="container-fluid ">
<div class="row">
<div class="col-md-2">
<div class="card card-primary card-outline" style="height: 88vh;">
<div class="card-header">
<h3 class="card-title">Журналы событий</h3>
</div>
<div class="card-body">
<nav class="mt-2">
<ul
class="nav nav-pills nav-sidebar flex-column"
data-widget="treeview"
role="menu"
data-accordion="false"
>
<li class="nav-item">
<a class="nav-link" style="color: blue;">
<i class="nav-icon far fa-file-alt"></i>
<p><b>Система</b></p></a
>
</li>
<li class="nav-item">
<a href="/events/gto/" class="nav-link"
><i class="nav-icon far fa-file-alt"></i>
<p>Горнотранспортное</p></a
>
</li>
<li class="nav-item">
<a href="/events/workers/" class="nav-link"
><i class="nav-icon far fa-file-alt"></i>
<p>Персонал</p></a
>
</li>
<li class="nav-item">
<a href="/events/others/" class="nav-link"
><i class="nav-icon far fa-file-alt"></i>
<p>Прочие</p></a
>
</li>
</ul>
</nav>
</div>
<!-- /.card -->
</div>
</div> <!-- /.row -->
<div class="col-md-10">
<div class="card card-primary card-outline" style="height: 88vh;">
<div class="card-header">
<h3 class="card-title">Системные события</h3>
</div>
<div class="card-body table-responsive p-0" style="padding-left: 0;">
<table id="id_table" class="table table-bordered table-hover table-head-fixed text-nowrap">
<thead>
<tr role="row">
<th style="width:10px;"> </th>
<th style="width: 15px;">Дата события</th>
<th style="width: 15px;">Дата прочтения</th>
<th >Событие</th">
</tr>
</thead>
<tbody>
{% if page_object %}
{% for catalog in page_object.object_list %}
<tr>
<td style="width:10px;
{% if catalog.level_event == 0 %}
{% elif catalog.level_event == 1 %}
background-color:#EFFF00;
{% else %}
background-color:red;
{% endif %}
">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
<i class="fas fa-info"></i>
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.date_time }}
</a>
</td>
<td style="width: 15px;">
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.get_read_date_time}}
</a>
</td>
<td>
<a class="action-form" data-target="#modal-edit_{{catalog.id}}" data-toggle="modal" style="cursor:pointer;">
{{ catalog.text_event }}
</a>
</td>
</tr>
<div class="modal fade" id="modal-edit_{{catalog.id}}" data-id="{{catalog.id}}" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" {% if catalog.level_event > 2 %} style="background-color:red;" {%endif%} >
<h4 class="modal-title" >Дата события : {{ catalog.date_time }} </h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group row">
<label for="id_name" class="col-sm-3 col-form-label">Уровень : </label>
<div class="col-sm-9">
{% if catalog.level_event == 0 %}
<input class="form-control" type="text" readonly value="Информация">
{% elif catalog.level_event == 1 %}
<input class="form-control" type="text" readonly value="Предупреждение">
{% elif catalog.level_event == 2 %}
<input class="form-control" type="text" readonly value="Ошибка">
{% elif catalog.level_event == 3 %}
<input class="form-control" type="text" readonly value="Критическое">
{% elif catalog.level_event == 4 %}
<input class="form-control" type="text" readonly value="Авария">
{% endif %}
</div>
</div>
<div class="form-group row">
<label for="id_name" class="col-sm-3 col-form-label">Источник : </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="Система">
</div>
</div>
<div class="form-group row">
<label for="id_name" class="col-sm-3 col-form-label">Время получения: </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="{{ catalog.date_time}}">
</div>
</div>
<div class="form-group row">
<label for="id_name" class="col-sm-3 col-form-label">Время прочтения: </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="{{ catalog.get_read_date_time}}">
</div>
</div>
<div class="form-group row">
<label for="id_audio_file" class="col-sm-3 col-form-label">Подробности: </label>
<div class="col-sm-9">
<textarea class="form-control" disabled="">{{catalog.text_event}}</textarea>
</div>
</div>
<!--<div class="form-group row">
<label for="id_name" class="col-sm-3 col-form-label">Автор: </label>
<div class="col-sm-9">
<input class="form-control" type="text" readonly value="{{ catalog.autor}}">
</div>
</div>-->
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" onclick="exit_modal({{catalog.id}})">Закрыть</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
{% endfor %}
{% endif %}
</tbody>
</table>
</div> <!-- /.card-body -->
</div> <!-- /.card -->
</div> <!-- /.row -->
</div><!-- /.container-fluid -->
</div>
</section>
{% endblock %}
{% block script_footer %}
<script src="{% static 'js/moment.min.js' %}"></script>
<script src="{% static 'js/datatables/datetime-moment.js' %}"></script>
<script src="{% static 'js/datatables/dom-text.js' %}"></script>
<script>
// Регистрация пользовательского сортировщика
jQuery.extend(jQuery.fn.dataTable.ext.type.order, {
'cyrillic-pre': function (data) {
if (!data) return '';
// Удалим HTML, если есть
data = data.replace(/<\/?[^>]+(>|$)/g, "").trim();
// Преобразуем строку для сортировки
const firstChar = data[0] || '';
const isCyrillic = firstChar >= 'А' && firstChar <= 'я';
// Добавим приоритет: кириллица (0) → латиница (1)
return (isCyrillic ? '0' : '1') + data.toLowerCase();
}
});
async function exit_modal(id)
{
formdata = new FormData()
formdata.append('id',id)
const csrftoken = getCookie('csrftoken');
let response = await fetch('/events/event_viewer/', {
method: 'POST',
body: formdata,
headers: {"X-CSRFToken": csrftoken},
});
let result = await response.json();
console.log(result)
if (result.status=='ok'){
$('#modal-edit_'+id).modal('hide')
}
}
$('.modal').on('hidden.bs.modal', async function (e) {
exit_modal(e.currentTarget.getAttribute('data-id'))
location.reload()
})
</script>
{% endblock script_footer %}