Polevoy_SUBD/frontend/templates/clients.html

59 lines
3.1 KiB
HTML
Raw Normal View History

{% extends "base.html" %}
{% block content %}
<div class="row is-vertical-align">
<div class="col"></div>
<form class="col card is-vertical-align" method="post">
<h3 class="is-center mb-5">{% if current_client %} Просмотр клиента {% else %} Регистрация клиента {% endif %}</h3>
{% if errors %}
<div class="alert alert-danger mb-3 h4" role="alert">
{{ errors }}
</div>
{% endif %}
<div class="row mb-3">
<label class="h4">Имя: <input type="text" name="name" {% if current_client %} value="{{ current_client.name }}" {% endif %}/></label>
</div>
<div class="row mb-3">
<label class="h4">Фамилия: <input type="text" name="surname" {% if current_client %} value="{{ current_client.surname }}" {% endif %}/></label>
</div>
<div class="row mb-3">
<label class="h4">Отчество: <input type="text" name="middlename" {% if current_client %} value="{{ current_client.middlename }}" {% endif %}/></label>
</div>
<div class="row mb-3">
<label class="h4">Номер телефона: <input type="text" name="phone" pattern="8\d{10}" {% if current_client %} value="{{ current_client.phone }}" {% else %} value="8" {% endif %}/></label>
</div>
<div class="row mb-5">
<button class="button primary is-center">{% if current_client %} Изменить {% else %} Зарегистрировать клиента {% endif %}</button>
</div>
</form>
<div class="col"></div>
</div>
<div class="row is-vertical-align mt-5">
<div class="card col table table-striped">
<h2 class="is-center mb-4">Все клиенты</h2>
<table>
<tr>
<th class="h4">Номер телефона</th>
<th class="h4">Фамилия</th>
<th class="h4">Имя</th>
<th class="h4">Отчество</th>
<th class="h4">Действия</th>
</tr>
{% for client in clients|sort(attribute="surname")|sort(attribute="name")|sort(attribute="middlename") %}
<tr>
<td class="h4">{{ client.phone }}</td>
<td class="h4">{{ client.surname }}</td>
<td class="h4">{{ client.name }}</td>
<td class="h4">{{ client.middlename }}</td>
<td>
<div class="row">
<a href="{{ url_for("rents", client=client.id) }}" class="button primary outline col">Перейти к аренде</a>
<a href="{{ url_for("clients", id=client.id) }}" class="button primary outline col">Посмотреть</a>
</div>
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endblock %}