84 lines
3.1 KiB
HTML
84 lines
3.1 KiB
HTML
{% extends "base.html" %}
|
|
{% import "components/typography.html" as typography %}
|
|
{% import "components/cards.html" as cards %}
|
|
|
|
{% block title %}
|
|
{{ t!("book.edit.title_tag") }}
|
|
{% endblock %}
|
|
|
|
{% block main %}
|
|
{{ typography::heading(t!("book.edit.title")) }}
|
|
|
|
{% call cards::card() %}
|
|
<form method="post" action="/books/{{ book.id }}">
|
|
<div class="mb-3">
|
|
<label class="form-label" for="title">{{ t!("book.attributes.title") }}</label>
|
|
<input type="text" name="title" class="form-control" value="{{ book.title }}" required>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="authors" class="form-label">{{ t!("book.attributes.authors") }}</label>
|
|
<input type="text" name="authors" class="form-control" value="{{ book.authors }}" required>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="owner_id" class="form-label">{{ t!("book.attributes.owner") }}</label>
|
|
<select name="owner_id" class="form-control" required>
|
|
{% for user in users %}
|
|
{% if book.owner_id == user.id %}
|
|
<option value="{{ user.id }}" selected>{{ user.name }}</option>
|
|
{% else %}
|
|
<option value="{{ user.id }}">{{ user.name }}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="current_holder_id" class="form-label">{{ t!("book.attributes.current_holder") }}</label>
|
|
<select class="form-control" name="current_holder_id">
|
|
<option></option>
|
|
{% match book.current_holder_id %}
|
|
{% when Some with (current_holder_id) %}
|
|
{% for user in users %}
|
|
{% if *current_holder_id == user.id %}
|
|
<option value="{{ user.id }}" selected>{{ user.name }}</option>
|
|
{% else %}
|
|
<option value="{{ user.id }}">{{ user.name }}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% when None %}
|
|
{% for user in users %}
|
|
<option value="{{ user.id }}">{{ user.name }}</option>
|
|
{% endfor %}
|
|
{% endmatch %}
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="description" class="form-label">{{ t!("book.attributes.description") }}</label>
|
|
{% match book.description %}
|
|
{% when Some with (description) %}
|
|
<textarea name="description" class="form-control">{{ description }}</textarea>
|
|
{% when None %}
|
|
<textarea name="description" class="form-control"></textarea>
|
|
{% endmatch %}
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label" for="comment">{{ t!("book.attributes.comment") }}</label>
|
|
{% match book.comment %}
|
|
{% when Some with (comment) %}
|
|
<textarea name="comment" class="form-control">{{ comment }}</textarea>
|
|
{% when None %}
|
|
<textarea name="comment" class="form-control"></textarea>
|
|
{% endmatch %}
|
|
</div>
|
|
|
|
<div class="mt-4 text-center">
|
|
<input type="submit" value='{{ t!("book.edit.button") }}' class="btn btn-success">
|
|
</div>
|
|
</form>
|
|
{% endcall %}
|
|
{% endblock %}
|