98 lines
4.2 KiB
HTML
98 lines
4.2 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Мои запросы{% endblock %}
|
|
|
|
|
|
{% block content %}
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h4 class="fw-normal">Мои запросы на секрет</h4>
|
|
<a href="{{ url_for('request_secret_form') }}" class="btn btn-secondary">
|
|
<i class="bi"></i> Создать запрос
|
|
</a>
|
|
</div>
|
|
|
|
{% if requests %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Примечание</th>
|
|
<th>Создан</th>
|
|
<th>Срок действия</th>
|
|
<th>Статус</th>
|
|
<th class="text-center">Действия</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for req in requests %}
|
|
<tr>
|
|
<td>
|
|
<code class="text-muted small">{{ req.token[:18] }}...</code>
|
|
</td>
|
|
<td style="white-space: pre-wrap; word-break: break-word; max-width: 150px;">{% if req.note %}<span
|
|
class="text-muted small">{{ req.note }}</span>{% else %}<span class="text-muted fst-italic small">Без примечания</span>{%
|
|
endif %}
|
|
</td>
|
|
<td>
|
|
<span class="text-muted small">{{ req.created_at|format_datetime }}</span>
|
|
</td>
|
|
<td>
|
|
{% if req.ttl_seconds > 0 %}<span class="text-muted small">{{ req.ttl_hours }} ч.</span> {% else %}<span
|
|
class="text-muted small">Истек</span>{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if req.ttl_seconds > 0 %}<span class="badge bg-success">Активен</span>{% else %}<span
|
|
class="badge bg-secondary">Истек</span>{% endif %}
|
|
</td>
|
|
<td class="text-center">
|
|
<div class="btn-group btn-group-sm"> {% if req.ttl_seconds > 0 %} <a href="{{ req.link }}"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="btn btn-outline-secondary"
|
|
title="Открыть ссылку"> <i
|
|
class="bi bi-box-arrow-up-right"></i></a>
|
|
<button type="button" class="btn btn-outline-danger delete-request-btn"
|
|
data-url="{{ url_for('request_secret_delete', token=req.token) }}" title="Удалить запрос"><i
|
|
class="bi bi-trash"></i></button>
|
|
{% else %} <span class="text-muted small">Истек</span> {% endif %}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div class="text-center py-5">
|
|
<i class="bi bi-inbox display-1 text-secondary"></i>
|
|
<p class="text-secondary mt-3">У вас пока нет запросов на секрет</p>
|
|
<a href="{{ url_for('request_secret_form') }}" class="btn btn-secondary">Создать первый запрос</a>
|
|
</div>
|
|
{% endif %}
|
|
<form id="globalDeleteForm" method="POST" style="display: none;">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
</form>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
var deleteButtons = document.querySelectorAll('.delete-request-btn');
|
|
var globalForm = document.getElementById('globalDeleteForm');
|
|
|
|
deleteButtons.forEach(function (button) {
|
|
button.addEventListener('click', function () {
|
|
if (confirm('Вы уверены, что хотите удалить этот запрос?')) {
|
|
var deleteUrl = this.getAttribute('data-url');
|
|
if (deleteUrl && globalForm) {
|
|
globalForm.action = deleteUrl;
|
|
globalForm.submit();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|