Files
mailova/app/templates/postcard_detail.html

67 lines
3.5 KiB
HTML

{% extends "base.html" %}
{% block title %}明信片详情 - 明信片管理器{% endblock %}
{% block content %}
<div class="section-header">
<div class="detail-title-row">
<a href="/profiles/{{ postcard.profile_id }}/postcards" class="btn btn-back"></a>
<h1>{{ postcard.card_number }}</h1>
</div>
<div class="detail-actions">
<a href="/postcards/{{ postcard.id }}/edit" class="btn">编辑</a>
{% if postcard.status == 'sent' %}
<form method="post" action="/postcards/{{ postcard.id }}/mark-delivered" class="inline">
<button type="submit" class="btn btn-primary" onclick="return confirm('确认已送达?')">已送达</button>
</form>
{% endif %}
<form method="post" action="/postcards/{{ postcard.id }}/delete" class="inline">
<button type="submit" class="btn btn-danger" onclick="return confirm('确定删除?')">删除</button>
</form>
</div>
</div>
<span class="badge badge-{{ postcard.status }}">{{ {'sent':'已寄出','delivered':'已送达','received':'已收到'}.get(postcard.status, postcard.status) }}</span>
<div class="detail-grid">
<div class="detail-images">
<div class="image-block">
<h3>正面</h3>
{% if postcard.image_front %}
<img src="{{ postcard.image_front }}" alt="正面" class="detail-img">
{% else %}
<div class="detail-img placeholder">📷 未上传正面图片</div>
{% endif %}
<form method="post" action="/postcards/{{ postcard.id }}/image/front" enctype="multipart/form-data" class="inline upload-form">
<input type="file" name="file" accept="image/*" required>
<button type="submit" class="btn btn-sm">上传正面</button>
</form>
</div>
<div class="image-block">
<h3>反面</h3>
{% if postcard.image_back %}
<img src="{{ postcard.image_back }}" alt="反面" class="detail-img">
{% else %}
<div class="detail-img placeholder">📷 未上传反面图片</div>
{% endif %}
<form method="post" action="/postcards/{{ postcard.id }}/image/back" enctype="multipart/form-data" class="inline upload-form">
<input type="file" name="file" accept="image/*" required>
<button type="submit" class="btn btn-sm">上传反面</button>
</form>
</div>
</div>
<div class="detail-meta">
<dl>
<dt>编号</dt><dd>{{ postcard.card_number }}</dd>
<dt>状态</dt><dd>{{ {'sent':'已寄出','delivered':'已送达','received':'已收到'}.get(postcard.status, postcard.status) }}</dd>
{% if postcard.status in ('sent','delivered') %}
<dt>收件人</dt><dd>{{ postcard.recipient_name or '-' }}</dd>
<dt>国家/地区</dt><dd>{{ postcard.country|flag }} {{ postcard.country or '-' }}</dd>
<dt>寄出时间</dt><dd>{{ postcard.send_time.strftime('%Y-%m-%d') if postcard.send_time else '-' }}</dd>
<dt>到达时间</dt><dd>{{ postcard.arrival_time.strftime('%Y-%m-%d') if postcard.arrival_time else '-' }}</dd>
{% else %}
<dt>发件人</dt><dd>{{ postcard.sender_name or '-' }}</dd>
<dt>收到时间</dt><dd>{{ postcard.receive_time.strftime('%Y-%m-%d') if postcard.receive_time else '-' }}</dd>
{% endif %}
<dt>所属 Profile</dt><dd>{{ postcard.profile.nickname }}</dd>
</dl>
</div>
</div>
{% endblock %}