64 lines
2.3 KiB
HTML
64 lines
2.3 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<div class="page-header">
|
|
<div>
|
|
<h1>{{ item.name }}</h1>
|
|
<p class="muted">位于箱子 <a href="/boxes/{{ item.box.id }}">{{ item.box.name }}</a> 中</p>
|
|
</div>
|
|
<div class="actions">
|
|
<a href="/boxes/{{ item.box.id }}">返回箱子</a>
|
|
<a href="/items/{{ item.id }}/edit">编辑物品</a>
|
|
</div>
|
|
</div>
|
|
|
|
<section class="card">
|
|
{% if item.image_blob %}
|
|
<img src="/items/{{ item.id }}/image" alt="{{ item.name }}" class="detail-image">
|
|
{% endif %}
|
|
<p><strong>是否容器:</strong> {{ "是" if item.is_container else "否" }}</p>
|
|
<p><strong>数量:</strong> {{ item.quantity if item.quantity is not none else '-' }}</p>
|
|
<p><strong>备注:</strong> {{ item.note or '-' }}</p>
|
|
<div class="actions">
|
|
<form method="post" action="/items/{{ item.id }}/delete">
|
|
<button type="submit" class="link-button">删除物品</button>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
|
|
{% if item.is_container %}
|
|
<section class="stack">
|
|
<div class="page-header">
|
|
<h2>子物品</h2>
|
|
<a class="button" href="/items/{{ item.id }}/subitems/new">添加子物品</a>
|
|
</div>
|
|
{% if item.subitems %}
|
|
{% for subitem in item.subitems %}
|
|
<article class="card">
|
|
{% if subitem.image_blob %}
|
|
<img src="/subitems/{{ subitem.id }}/image" alt="{{ subitem.name }}" class="thumb-image">
|
|
{% endif %}
|
|
<h3>{{ subitem.name }}</h3>
|
|
{% if subitem.quantity is not none %}<p><strong>数量:</strong> {{ subitem.quantity }}</p>{% endif %}
|
|
{% if subitem.note %}<p><strong>备注:</strong> {{ subitem.note }}</p>{% endif %}
|
|
<div class="actions">
|
|
<a href="/subitems/{{ subitem.id }}/edit">编辑</a>
|
|
<form method="post" action="/subitems/{{ subitem.id }}/delete">
|
|
<button type="submit" class="link-button">删除</button>
|
|
</form>
|
|
</div>
|
|
</article>
|
|
{% endfor %}
|
|
{% else %}
|
|
<section class="card">
|
|
<p>还没有子物品。</p>
|
|
</section>
|
|
{% endif %}
|
|
</section>
|
|
{% else %}
|
|
<section class="card">
|
|
<p>这个物品不是容器,因此不能包含子物品。</p>
|
|
</section>
|
|
{% endif %}
|
|
{% endblock %}
|