91 lines
4.9 KiB
HTML
91 lines
4.9 KiB
HTML
|
{% 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_owner %} Просмотр владельца {% 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_owner %} value="{{ current_owner.name }}" {% endif %}/></label>
|
|||
|
</div>
|
|||
|
<div class="row mb-3">
|
|||
|
<label class="h4">Фамилия: <input type="text" name="surname" {% if current_owner %} value="{{ current_owner.surname }}" {% endif %}/></label>
|
|||
|
</div>
|
|||
|
<div class="row mb-3">
|
|||
|
<label class="h4">Отчество: <input type="text" name="middlename" {% if current_owner %} value="{{ current_owner.middlename }}" {% endif %}/></label>
|
|||
|
</div>
|
|||
|
<div class="row mb-3">
|
|||
|
<label class="h4">Номер телефона: <input type="text" name="phone" pattern="8\d{10}" {% if current_owner %} value="{{ current_owner.phone }}" {% else %} value="8" {% endif %}/></label>
|
|||
|
</div>
|
|||
|
<div class="row mb-5">
|
|||
|
<button class="button primary is-center">{% if current_owner %} Изменить {% else %} Зарегистрировать клиента {% endif %}</button>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
<div class="col"></div>
|
|||
|
</div>
|
|||
|
{% if current_owner %}
|
|||
|
<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 car in cars|sort(attribute="brand")|sort(attribute="model")|sort(attribute="price") %}
|
|||
|
{% if car.owner_id == current_owner.id %}
|
|||
|
<tr>
|
|||
|
<td class="h4">{{ car.brand }}</td>
|
|||
|
<td class="h4">{{ car.model }}</td>
|
|||
|
<td class="h4">{{ car.price }}</td>
|
|||
|
<td class="h4"><a href="{{ url_for('owners', id=car.owner_id) }}">Перейти к владельцу</a></td>
|
|||
|
<td>
|
|||
|
<div class="row">
|
|||
|
<a href="{{ url_for("rents", car=car.id) }}" class="button primary outline col">Арендовать</a>
|
|||
|
<a href="{{ url_for("cars", id=car.id) }}" class="button primary outline col">Посмотреть</a>
|
|||
|
</div>
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
{% endif %}
|
|||
|
{% endfor %}
|
|||
|
</table>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
{% endif %}
|
|||
|
<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 owner in owners|sort(attribute="surname")|sort(attribute="name")|sort(attribute="middlename") %}
|
|||
|
<tr>
|
|||
|
<td class="h4">{{ owner.phone }}</td>
|
|||
|
<td class="h4">{{ owner.surname }}</td>
|
|||
|
<td class="h4">{{ owner.name }}</td>
|
|||
|
<td class="h4">{{ owner.middlename }}</td>
|
|||
|
<td>
|
|||
|
<div class="row">
|
|||
|
<a href="{{ url_for("cars", owner=owner.id) }}" class="button primary outline col">Добавить автомобиль</a>
|
|||
|
<a href="{{ url_for("owners", id=owner.id) }}" class="button primary outline col">Посмотреть</a>
|
|||
|
</div>
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
{% endfor %}
|
|||
|
</table>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
{% endblock %}
|