Add monitoring PF service
This commit is contained in:
86
app/templates/employees.html
Normal file
86
app/templates/employees.html
Normal file
@@ -0,0 +1,86 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Сотрудники — DLD Monitor{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
<h3>Сотрудники</h3>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<b>Как подключить Telegram:</b>
|
||||
<ol class="mb-0">
|
||||
<li>Сотрудник пишет боту в Telegram команду <code>/whoami</code> — бот вернёт его <code>chat_id</code>.</li>
|
||||
<li>Вставьте этот <code>chat_id</code> в поле справа от имени и нажмите «Сохранить».</li>
|
||||
</ol>
|
||||
Если сотрудник пока не знает свой chat_id — пусть просто отправит <code>/start</code>, бот ответит и пришлёт id.
|
||||
</div>
|
||||
|
||||
<form method="post" action="{{ url_path('/employees') }}" class="row g-2 mb-4 bg-white p-3 rounded shadow-sm">
|
||||
<div class="col-md-5">
|
||||
<input name="name" required class="form-control" placeholder="Имя сотрудника">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input name="tg_username" class="form-control" placeholder="@username (опционально)">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button class="btn btn-primary w-100">Добавить</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if not request.state.is_admin %}
|
||||
<div class="alert alert-secondary py-2 small">
|
||||
🔒 Редактирование и удаление сотрудников доступно только в режиме админа.
|
||||
<a href="{{ url_path('/admin/login?next=/employees') }}">Войти</a>.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table bg-white rounded shadow-sm align-middle">
|
||||
<thead class="table-light">
|
||||
<tr><th>Имя</th><th>@username</th><th>Chat ID</th><th>Проектов</th>{% if request.state.is_admin %}<th style="width:1%"></th>{% endif %}</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for e in employees %}
|
||||
{% if request.state.is_admin %}
|
||||
<tr>
|
||||
<form method="post" action="{{ url_path('/employees/' ~ e.id ~ '/update') }}">
|
||||
<td>
|
||||
<input name="name" value="{{ e.name }}" class="form-control form-control-sm" required>
|
||||
</td>
|
||||
<td>
|
||||
<input name="tg_username" value="{{ e.tg_username or '' }}" class="form-control form-control-sm" placeholder="username">
|
||||
</td>
|
||||
<td>
|
||||
<div class="input-group input-group-sm">
|
||||
<input name="tg_chat_id" value="{{ e.tg_chat_id or '' }}" class="form-control"
|
||||
placeholder="например 123456789">
|
||||
{% if e.tg_chat_id %}
|
||||
<span class="input-group-text text-success">✓</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ e.projects|length }}</td>
|
||||
<td class="text-nowrap">
|
||||
<button class="btn btn-sm btn-primary">Сохранить</button>
|
||||
</form>
|
||||
<form method="post" action="{{ url_path('/employees/' ~ e.id ~ '/delete') }}" class="d-inline"
|
||||
onsubmit="return confirm('Удалить сотрудника?');">
|
||||
<button class="btn btn-sm btn-outline-danger">Удалить</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td>{{ e.name }}</td>
|
||||
<td>{% if e.tg_username %}@{{ e.tg_username }}{% else %}—{% endif %}</td>
|
||||
<td>
|
||||
{% if e.tg_chat_id %}<code>{{ e.tg_chat_id }}</code> <span class="text-success">✓</span>
|
||||
{% else %}<span class="text-muted">не задан</span>{% endif %}
|
||||
</td>
|
||||
<td>{{ e.projects|length }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user