Files
Inv_web/source/templates/cabinets.html
2026-02-23 20:59:05 +03:00

49 lines
1.7 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 "base.html" %}
{% block body_class %}page-bg bg-cabinets{% endblock %}
{% block content %}
<h3>Кабинеты</h3>
{% if session.get('role') != 'admin' %}
<div class="alert alert-secondary">Режим просмотра: изменения доступны только администратору.</div>
{% endif %}
{% if session.get('role') == 'admin' %}
<form method="post" action="/cabinets/add" class="row g-2 mb-3">
<div class="col-md-6">
<input name="name" class="form-control" placeholder="Например: 101, 2-14, Каб. директора">
</div>
<div class="col-md-2 d-grid">
<button class="btn btn-success">Добавить</button>
</div>
</form>
{% endif %}
<table class="table table-striped">
<tr><th>#</th><th>Название</th><th></th></tr>
{% for id, name in rows %}
<tr>
<td>{{ id }}</td>
<td>
{% if session.get('role') == 'admin' %}
<form method="post" action="/cabinets/edit" class="d-flex gap-2">
<input type="hidden" name="id" value="{{ id }}">
<input name="name" value="{{ name }}" class="form-control form-control-sm">
<button class="btn btn-sm btn-outline-primary">Сохранить</button>
</form>
{% else %}
{{ name }}
{% endif %}
</td>
<td class="text-nowrap">
{% if session.get('role') == 'admin' %}
<form method="post" action="/cabinets/delete" onsubmit="return confirm('Удалить кабинет?')" class="d-inline">
<input type="hidden" name="id" value="{{ id }}">
<button class="btn btn-sm btn-outline-danger">Удалить</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
{% endblock %}