fix(ui): fix field name corruption (country_to_from -> country_from) and ensure all flag displays show country code

This commit is contained in:
2026-07-07 13:54:00 +08:00
parent fed060ea84
commit 599a95ee12
5 changed files with 13 additions and 13 deletions

View File

@@ -37,7 +37,7 @@
<img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy"> <img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy">
<div class="showcase-card-body"> <div class="showcase-card-body">
<div class="showcase-card-meta"> <div class="showcase-card-meta">
{% if pc.country_to_from and pc.country_to %}<span>{{ pc.country_to_from|flag }} {{ pc.country_to_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span> {% if pc.country_from and pc.country_to %}<span>{{ pc.country_from|flag }} {{ pc.country_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% elif pc.country_to %}<span>{{ pc.country_to|flag }} {{ pc.country_to }}</span> {% elif pc.country_to %}<span>{{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% endif %} {% endif %}
</div> </div>

View File

@@ -52,12 +52,12 @@
<dt>{{ 'pc_detail.status'|t(user.language) }}</dt><dd>{{ {'sent':'已寄出','delivered':'已送达','received':'已收到'}.get(postcard.status, postcard.status) if user.language=='zh' else {'sent':'Sent','delivered':'Delivered','received':'Received'}.get(postcard.status, postcard.status) }}</dd> <dt>{{ 'pc_detail.status'|t(user.language) }}</dt><dd>{{ {'sent':'已寄出','delivered':'已送达','received':'已收到'}.get(postcard.status, postcard.status) if user.language=='zh' else {'sent':'Sent','delivered':'Delivered','received':'Received'}.get(postcard.status, postcard.status) }}</dd>
{% if postcard.status in ('sent','delivered') %} {% if postcard.status in ('sent','delivered') %}
<dt>{{ 'pc_detail.recipient'|t(user.language) }}</dt><dd>{{ postcard.recipient_name or '-' }}</dd> <dt>{{ 'pc_detail.recipient'|t(user.language) }}</dt><dd>{{ postcard.recipient_name or '-' }}</dd>
<dt>{{ 'pc_detail.route'|t(user.language) }}</dt><dd>{% if postcard.country_to_from %}{{ postcard.country_to_from|flag }} {{ postcard.country_to_from }} → {% endif %}{{ postcard.country_to|flag }} {{ postcard.country_to or '-' }}</dd> <dt>{{ 'pc_detail.route'|t(user.language) }}</dt><dd>{% if postcard.country_from %}{{ postcard.country_from|flag }} {{ postcard.country_from }} → {% endif %}{{ postcard.country_to|flag }} {{ postcard.country_to or '-' }}</dd>
<dt>{{ 'pc_detail.send_time'|t(user.language) }}</dt><dd>{{ postcard.send_time.strftime('%Y-%m-%d') if postcard.send_time else '-' }}</dd> <dt>{{ 'pc_detail.send_time'|t(user.language) }}</dt><dd>{{ postcard.send_time.strftime('%Y-%m-%d') if postcard.send_time else '-' }}</dd>
<dt>{{ 'pc_detail.arrival_time'|t(user.language) }}</dt><dd>{{ postcard.arrival_time.strftime('%Y-%m-%d') if postcard.arrival_time else '-' }}</dd> <dt>{{ 'pc_detail.arrival_time'|t(user.language) }}</dt><dd>{{ postcard.arrival_time.strftime('%Y-%m-%d') if postcard.arrival_time else '-' }}</dd>
{% else %} {% else %}
<dt>{{ 'pc_detail.sender'|t(user.language) }}</dt><dd>{{ postcard.sender_name or '-' }}</dd> <dt>{{ 'pc_detail.sender'|t(user.language) }}</dt><dd>{{ postcard.sender_name or '-' }}</dd>
<dt>{{ 'pc_detail.route'|t(user.language) }}</dt><dd>{% if postcard.country_to_from %}{{ postcard.country_to_from|flag }} {{ postcard.country_to_from }} → {% endif %}{{ postcard.country_to|flag }} {{ postcard.country_to or '-' }}</dd> <dt>{{ 'pc_detail.route'|t(user.language) }}</dt><dd>{% if postcard.country_from %}{{ postcard.country_from|flag }} {{ postcard.country_from }} → {% endif %}{{ postcard.country_to|flag }} {{ postcard.country_to or '-' }}</dd>
<dt>{{ 'pc_detail.receive_time'|t(user.language) }}</dt><dd>{{ postcard.receive_time.strftime('%Y-%m-%d') if postcard.receive_time else '-' }}</dd> <dt>{{ 'pc_detail.receive_time'|t(user.language) }}</dt><dd>{{ postcard.receive_time.strftime('%Y-%m-%d') if postcard.receive_time else '-' }}</dd>
{% endif %} {% endif %}
<dt>{{ 'pc_detail.profile'|t(user.language) }}</dt><dd>{{ postcard.profile.nickname }}</dd> <dt>{{ 'pc_detail.profile'|t(user.language) }}</dt><dd>{{ postcard.profile.nickname }}</dd>

View File

@@ -32,7 +32,7 @@
</div> </div>
<label>{{ 'pc_form.country_from'|t(user.language) }}</label> <label>{{ 'pc_form.country_from'|t(user.language) }}</label>
<input type="text" name="country_from" id="input-country-from" value="{{ postcard.country_to_from if postcard and postcard.country_to_from else (profile.country if profile else '') }}" maxlength="2" style="width:80px;text-transform:uppercase" oninput="this.value=this.value.toUpperCase()"> <input type="text" name="country_from" id="input-country-from" value="{{ postcard.country_from if postcard and postcard.country_from else (profile.country if profile else '') }}" maxlength="2" style="width:80px;text-transform:uppercase" oninput="this.value=this.value.toUpperCase()">
<label>{{ 'pc_form.country'|t(user.language) }} *</label> <label>{{ 'pc_form.country'|t(user.language) }} *</label>
<input type="text" name="country_to" id="input-country-to" value="{{ postcard.country_to if postcard else '' }}" maxlength="2" placeholder="JP" style="width:80px;text-transform:uppercase" oninput="this.value=this.value.toUpperCase()"> <input type="text" name="country_to" id="input-country-to" value="{{ postcard.country_to if postcard else '' }}" maxlength="2" placeholder="JP" style="width:80px;text-transform:uppercase" oninput="this.value=this.value.toUpperCase()">

View File

@@ -41,7 +41,7 @@
<div class="postcard-row-info"> <div class="postcard-row-info">
<strong>{{ pc.card_number }}</strong> <strong>{{ pc.card_number }}</strong>
<div class="postcard-row-detail"> <div class="postcard-row-detail">
<span>{% if pc.country_to_from %}{{ pc.country_to_from|flag }}→{% endif %}{{ pc.country_to|flag }} {{ pc.country_to or '-' }}</span> <span>{% if pc.country_from %}{{ pc.country_from|flag }}→{% endif %}{{ pc.country_to|flag }} {{ pc.country_to or '-' }}</span>
<span>→ {{ pc.recipient_name or '-' }}</span> <span>→ {{ pc.recipient_name or '-' }}</span>
</div> </div>
<span class="badge badge-{{ pc.status }}">{{ {'sent':'已寄出','delivered':'已送达'}.get(pc.status) if user.language=='zh' else {'sent':'Sent','delivered':'Delivered'}.get(pc.status) }}</span> <span class="badge badge-{{ pc.status }}">{{ {'sent':'已寄出','delivered':'已送达'}.get(pc.status) if user.language=='zh' else {'sent':'Sent','delivered':'Delivered'}.get(pc.status) }}</span>

View File

@@ -49,8 +49,8 @@
<img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy"> <img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy">
<div class="showcase-card-body"> <div class="showcase-card-body">
<div class="showcase-card-meta"> <div class="showcase-card-meta">
{% if pc.country_to_from and pc.country_to %}<span>{{ pc.country_to_from|flag }} {{ pc.country_to_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span> {% if pc.country_from and pc.country_to %}<span>{{ pc.country_from|flag }} {{ pc.country_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% elif pc.country_to %}<span>{{ pc.country_to|flag }}</span> {% elif pc.country_to %}<span>{{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% endif %} {% endif %}
{% if pc.send_time %}<span>{{ pc.send_time.strftime('%Y-%m-%d') }}</span>{% endif %} {% if pc.send_time %}<span>{{ pc.send_time.strftime('%Y-%m-%d') }}</span>{% endif %}
</div> </div>
@@ -74,8 +74,8 @@
<img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy"> <img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy">
<div class="showcase-card-body"> <div class="showcase-card-body">
<div class="showcase-card-meta"> <div class="showcase-card-meta">
{% if pc.country_to_from and pc.country_to %}<span>{{ pc.country_to_from|flag }} {{ pc.country_to_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span> {% if pc.country_from and pc.country_to %}<span>{{ pc.country_from|flag }} {{ pc.country_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% elif pc.country_to %}<span>{{ pc.country_to|flag }}</span> {% elif pc.country_to %}<span>{{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% endif %} {% endif %}
{% if pc.send_time %}<span>{{ pc.send_time.strftime('%Y-%m-%d') }}</span>{% endif %} {% if pc.send_time %}<span>{{ pc.send_time.strftime('%Y-%m-%d') }}</span>{% endif %}
</div> </div>
@@ -100,8 +100,8 @@
<img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy"> <img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy">
<div class="showcase-card-body"> <div class="showcase-card-body">
<div class="showcase-card-meta"> <div class="showcase-card-meta">
{% if pc.country_to_from and pc.country_to %}<span>{{ pc.country_to_from|flag }} {{ pc.country_to_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span> {% if pc.country_from and pc.country_to %}<span>{{ pc.country_from|flag }} {{ pc.country_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% elif pc.country_to %}<span>{{ pc.country_to|flag }}</span> {% elif pc.country_to %}<span>{{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% endif %} {% endif %}
{% if pc.receive_time %}<span>{{ pc.receive_time.strftime('%Y-%m-%d') }}</span>{% endif %} {% if pc.receive_time %}<span>{{ pc.receive_time.strftime('%Y-%m-%d') }}</span>{% endif %}
</div> </div>
@@ -125,8 +125,8 @@
<img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy"> <img src="{{ pc.image_front }}" alt="" class="showcase-card-img" loading="lazy">
<div class="showcase-card-body"> <div class="showcase-card-body">
<div class="showcase-card-meta"> <div class="showcase-card-meta">
{% if pc.country_to_from and pc.country_to %}<span>{{ pc.country_to_from|flag }} {{ pc.country_to_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span> {% if pc.country_from and pc.country_to %}<span>{{ pc.country_from|flag }} {{ pc.country_from }} → {{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% elif pc.country_to %}<span>{{ pc.country_to|flag }}</span> {% elif pc.country_to %}<span>{{ pc.country_to|flag }} {{ pc.country_to }}</span>
{% endif %} {% endif %}
{% if pc.receive_time %}<span>{{ pc.receive_time.strftime('%Y-%m-%d') }}</span>{% endif %} {% if pc.receive_time %}<span>{{ pc.receive_time.strftime('%Y-%m-%d') }}</span>{% endif %}
</div> </div>