add image flow

This commit is contained in:
2026-04-19 12:54:25 +02:00
parent 57800f2123
commit 5fdf3f4ab2
14 changed files with 606 additions and 21 deletions
+19 -1
View File
@@ -6,7 +6,7 @@
<a href="/boxes">返回箱子列表</a>
</div>
<form method="post" action="{{ form_action }}" class="stack">
<form method="post" action="{{ form_action }}" class="stack" enctype="multipart/form-data">
<label>
名称
<input type="text" name="name" value="{{ box.name if box else '' }}" required>
@@ -23,6 +23,24 @@
备注
<textarea name="note" rows="4">{{ box.note if box and box.note else '' }}</textarea>
</label>
<label>
图片
<input type="file" name="image_file" accept="image/*">
</label>
{% if box and box.image_blob %}
<section class="card">
<p><strong>当前图片:</strong></p>
<img src="/boxes/{{ box.id }}/image" alt="{{ box.name }}" class="detail-image">
<button
type="submit"
class="link-button"
formaction="/boxes/{{ box.id }}/image/delete"
formmethod="post"
>
删除当前图片
</button>
</section>
{% endif %}
<button type="submit">{{ submit_label }}</button>
</form>
{% endblock %}
+6
View File
@@ -13,6 +13,9 @@
</div>
<section class="card">
{% if box.image_blob %}
<img src="/boxes/{{ box.id }}/image" alt="{{ box.name }}" class="detail-image">
{% endif %}
<p><strong>房间:</strong> {{ box.room or '-' }}</p>
<p><strong>状态:</strong> {{ box.status or '-' }}</p>
<p><strong>备注:</strong> {{ box.note or '-' }}</p>
@@ -29,6 +32,9 @@
{% if box.items %}
{% for item in box.items %}
<article class="card">
{% if item.image_blob %}
<img src="/items/{{ item.id }}/image" alt="{{ item.name }}" class="thumb-image">
{% endif %}
<h3><a href="/items/{{ item.id }}">{{ item.name }}</a></h3>
<p><strong>是否容器:</strong> {{ "是" if item.is_container else "否" }}</p>
{% if item.quantity is not none %}<p><strong>数量:</strong> {{ item.quantity }}</p>{% endif %}
+19 -1
View File
@@ -9,7 +9,7 @@
<a href="/boxes/{{ box.id }}">返回箱子</a>
</div>
<form method="post" action="{{ form_action }}" class="stack">
<form method="post" action="{{ form_action }}" class="stack" enctype="multipart/form-data">
<label>
名称
<input type="text" name="name" value="{{ item.name if item else '' }}" required>
@@ -26,6 +26,24 @@
备注
<textarea name="note" rows="4">{{ item.note if item and item.note else '' }}</textarea>
</label>
<label>
图片
<input type="file" name="image_file" accept="image/*">
</label>
{% if item and item.image_blob %}
<section class="card">
<p><strong>当前图片:</strong></p>
<img src="/items/{{ item.id }}/image" alt="{{ item.name }}" class="detail-image">
<button
type="submit"
class="link-button"
formaction="/items/{{ item.id }}/image/delete"
formmethod="post"
>
删除当前图片
</button>
</section>
{% endif %}
<button type="submit">{{ submit_label }}</button>
</form>
{% endblock %}
+6
View File
@@ -13,6 +13,9 @@
</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>
@@ -32,6 +35,9 @@
{% 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 %}
+19 -1
View File
@@ -9,7 +9,7 @@
<a href="/items/{{ item.id }}">返回物品</a>
</div>
<form method="post" action="{{ form_action }}" class="stack">
<form method="post" action="{{ form_action }}" class="stack" enctype="multipart/form-data">
<label>
名称
<input type="text" name="name" value="{{ subitem.name if subitem else '' }}" required>
@@ -22,6 +22,24 @@
备注
<textarea name="note" rows="4">{{ subitem.note if subitem and subitem.note else '' }}</textarea>
</label>
<label>
图片
<input type="file" name="image_file" accept="image/*">
</label>
{% if subitem and subitem.image_blob %}
<section class="card">
<p><strong>当前图片:</strong></p>
<img src="/subitems/{{ subitem.id }}/image" alt="{{ subitem.name }}" class="detail-image">
<button
type="submit"
class="link-button"
formaction="/subitems/{{ subitem.id }}/image/delete"
formmethod="post"
>
删除当前图片
</button>
</section>
{% endif %}
<button type="submit">{{ submit_label }}</button>
</form>
{% endblock %}