edit_game.html fixed
This commit is contained in:
parent
171719a85f
commit
3b3e43d9af
172
setup.sh
172
setup.sh
|
@ -898,13 +898,6 @@ def edit_game(game_id):
|
|||
game.steam_appid = request.form.get('steam_appid', '')
|
||||
game.redeem_date = safe_parse_date(request.form.get('redeem_date', ''))
|
||||
|
||||
# Zeitzonen-korrekte Umwandlung
|
||||
game.redeem_date_local = (
|
||||
game.redeem_date.astimezone(local_tz)
|
||||
if game.redeem_date
|
||||
else None
|
||||
)
|
||||
|
||||
# Token-Logik
|
||||
if game.status == 'geschenkt':
|
||||
# Vorhandene Tokens löschen
|
||||
|
@ -1918,7 +1911,7 @@ cat <<HTML_END > templates/edit_game.html
|
|||
{% block content %}
|
||||
<div class="card p-4 shadow-sm">
|
||||
<h2 class="mb-4">{{ _('Spiel bearbeiten') }}</h2>
|
||||
|
||||
|
||||
<!-- Flash-Nachrichten -->
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
|
@ -1932,11 +1925,11 @@ cat <<HTML_END > templates/edit_game.html
|
|||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
<form method="POST" aria-label="{{ _('Spiel bearbeiten') }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<div class="row g-3">
|
||||
<!-- Hauptformularfelder -->
|
||||
<!-- Formularfelder -->
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">{{ _('Name') }} <span class="text-danger">*</span></label>
|
||||
<input type="text" name="name" class="form-control" value="{{ game.name }}" required>
|
||||
|
@ -1945,9 +1938,7 @@ cat <<HTML_END > templates/edit_game.html
|
|||
<label for="game_platform" class="form-label">{{ _('Platform') }} <span class="text-danger">*</span></label>
|
||||
<select id="game_platform" name="platform" class="form-select" required>
|
||||
{% for value, label in platforms %}
|
||||
<option value="{{ value }}" {% if game.platform == value %}selected{% endif %}>
|
||||
{{ _(label) }}
|
||||
</option>
|
||||
<option value="{{ value }}" {% if game.platform == value %}selected{% endif %}>{{ _(label) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -1955,9 +1946,7 @@ cat <<HTML_END > templates/edit_game.html
|
|||
<label for="game_status" class="form-label">{{ _('Status') }} <span class="text-danger">*</span></label>
|
||||
<select id="game_status" name="status" class="form-select" required>
|
||||
{% for value, label in statuses %}
|
||||
<option value="{{ value }}" {% if game.status == value %}selected{% endif %}>
|
||||
{{ _(label) }}
|
||||
</option>
|
||||
<option value="{{ value }}" {% if game.status == value %}selected{% endif %}>{{ _(label) }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -1966,69 +1955,34 @@ cat <<HTML_END > templates/edit_game.html
|
|||
<input type="text" name="steam_key" class="form-control" value="{{ game.steam_key }}" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
|
||||
<input type="text"
|
||||
id="game_appid"
|
||||
name="steam_appid"
|
||||
class="form-control"
|
||||
value="{{ game.steam_appid or '' }}">
|
||||
<label for="game_appid" class="form-label">{{ _('Steam AppID') }}</label>
|
||||
<input type="text" id="game_appid" name="steam_appid" class="form-control" value="{{ game.steam_appid or '' }}">
|
||||
</div>
|
||||
|
||||
<!-- Redeem Date -->
|
||||
<div class="col-md-6">
|
||||
<label for="game_redeem_date" class="form-label">{{ _('Redeem by') }}</label>
|
||||
<input type="date"
|
||||
id="game_redeem_date"
|
||||
name="redeem_date"
|
||||
class="form-control"
|
||||
value="{{ game.redeem_date.strftime('%Y-%m-%d') if game.redeem_date else '' }}">
|
||||
<label for="game_redeem_date" class="form-label">{{ _('Redeem by') }}</label>
|
||||
<input type="date" id="game_redeem_date" name="redeem_date" class="form-control" value="{{ game.redeem_date.strftime('%Y-%m-%d') if game.redeem_date else '' }}">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="game_recipient" class="form-label">{{ _('Recipient') }}</label>
|
||||
<input type="text" id="game_recipient" name="recipient" class="form-control" value="{{ game.recipient }}">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="game_url" class="form-label">{{ _('Shop URL') }}</label>
|
||||
<input type="url" id="game_url" name="url" class="form-control" value="{{ game.url }}">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="game_notes" class="form-label">{{ _('Notes') }}</label>
|
||||
<textarea id="game_notes" name="notes" class="form-control" rows="3">{{ game.notes }}</textarea>
|
||||
</div>
|
||||
|
||||
<!-- Recipient -->
|
||||
<div class="col-12">
|
||||
<label for="game_recipient" class="form-label">{{ _('Recipient') }}</label>
|
||||
<input type="text"
|
||||
id="game_recipient"
|
||||
name="recipient"
|
||||
class="form-control"
|
||||
value="{{ game.recipient }}">
|
||||
</div>
|
||||
|
||||
<!-- Shop URL -->
|
||||
<div class="col-12">
|
||||
<label for="game_url" class="form-label">{{ _('Shop URL') }}</label>
|
||||
<input type="url"
|
||||
id="game_url"
|
||||
name="url"
|
||||
class="form-control"
|
||||
value="{{ game.url }}">
|
||||
</div>
|
||||
|
||||
<!-- Notes -->
|
||||
<div class="col-12">
|
||||
<label for="game_notes" class="form-label">{{ _('Notes') }}</label>
|
||||
<textarea id="game_notes"
|
||||
name="notes"
|
||||
class="form-control"
|
||||
rows="3">{{ game.notes }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Externe Daten Card -->
|
||||
<div class="col-12">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>🔄 {{ _('Externe Daten') }}</span>
|
||||
<form method="POST" action="{{ url_for('update_game_data', game_id=game.id) }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<input type="hidden" name="steam_appid_to_update" value="{{ game.steam_appid }}">
|
||||
<button type="submit"
|
||||
formaction="{{ url_for('update_game_data', game_id=game.id) }}"
|
||||
name="update_data"
|
||||
value="1"
|
||||
class="btn btn-secondary">
|
||||
Update Data
|
||||
</button>
|
||||
</form>
|
||||
<a href="{{ url_for('update_game_data', game_id=game.id) }}" class="btn btn-secondary">
|
||||
Update Data
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if game.release_date %}
|
||||
|
@ -2037,33 +1991,24 @@ cat <<HTML_END > templates/edit_game.html
|
|||
{{ game.release_date|strftime('%d.%m.%Y') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Preisanzeige -->
|
||||
<td>
|
||||
<td>
|
||||
{% if game.current_price %}
|
||||
<div class="text-center mb-2">
|
||||
<span class="badge bg-primary d-block">{{ _('Now') }}</span>
|
||||
<div class="fw-bold" style="font-size:1.1em;">
|
||||
{{ "%.2f"|format(game.current_price) }} €
|
||||
</div>
|
||||
{% if game.current_price %}
|
||||
<div class="text-center mb-2">
|
||||
<span class="badge bg-primary d-block">{{ _('Now') }}</span>
|
||||
<div class="fw-bold" style="font-size:1.1em;">
|
||||
{{ "%.2f"|format(game.current_price) }} €
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if game.historical_low %}
|
||||
<div class="text-center">
|
||||
<span class="badge bg-secondary d-block">{{ _('Hist. Low') }}</span>
|
||||
<div class="fw-bold" style="font-size:1.1em;">
|
||||
{{ "%.2f"|format(game.historical_low) }} €
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if game.historical_low %}
|
||||
<div class="text-center">
|
||||
<span class="badge bg-secondary d-block">{{ _('Hist. Low') }}</span>
|
||||
<div class="fw-bold" style="font-size:1.1em;">
|
||||
{{ "%.2f"|format(game.historical_low) }} €
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<!-- ITAD-Link -->
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if game.itad_slug %}
|
||||
<a href="https://isthereanydeal.com/game/{{ game.itad_slug }}/info/"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="btn btn-outline-info">
|
||||
<a href="https://isthereanydeal.com/game/{{ game.itad_slug }}/info/" target="_blank" rel="noopener" class="btn btn-outline-info mt-2">
|
||||
🔗 {{ _('View on IsThereAnyDeal') }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
@ -2077,37 +2022,29 @@ cat <<HTML_END > templates/edit_game.html
|
|||
<div class="card mb-3">
|
||||
<div class="card-header">{{ _('Einlöse-Links') }}</div>
|
||||
<div class="card-body">
|
||||
{% for token in game.redeem_tokens if not token.is_expired() %}
|
||||
<div class="input-group mb-3">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
value="{{ url_for('redeem', token=token.token, _external=True) }}"
|
||||
readonly
|
||||
id="redeem-link-{{ loop.index }}">
|
||||
<button type="button"
|
||||
class="btn btn-outline-secondary copy-btn"
|
||||
data-clipboard-target="#redeem-link-{{ loop.index }}">
|
||||
{{ _('Copy') }}
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
{{ _('Expires at') }}: {{ token.expires.astimezone(local_tz).strftime('%d.%m.%Y %H:%M') }}
|
||||
</small>
|
||||
{% else %}
|
||||
<p class="text-muted mb-0">{{ _('No active redeem links') }}</p>
|
||||
{% endfor %}
|
||||
{% for token in game.redeem_tokens if not token.is_expired() %}
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" value="{{ url_for('redeem', token=token.token, _external=True) }}" readonly id="redeem-link-{{ loop.index }}">
|
||||
<button type="button" class="btn btn-outline-secondary copy-btn" data-clipboard-target="#redeem-link-{{ loop.index }}">
|
||||
{{ _('Copy') }}
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
{{ _('Expires at') }}: {{ token.expires.astimezone(local_tz).strftime('%d.%m.%Y %H:%M') }}
|
||||
</small>
|
||||
{% else %}
|
||||
<p class="text-muted mb-0">{{ _('No active redeem links') }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<a href="{{ url_for('game_details', game_id=game.id) }}"
|
||||
class="btn btn-info ms-2">
|
||||
🔍 {{ _('View Details') }}
|
||||
</a>
|
||||
|
||||
<!-- Buttons -->
|
||||
<div class="col-12">
|
||||
<button type="submit" class="btn btn-primary">{{ _('Save') }}</button>
|
||||
<a href="{{ url_for('index') }}" class="btn btn-outline-secondary ms-2">{{ _('Cancel') }}</a>
|
||||
<a href="{{ url_for('game_details', game_id=game.id) }}" class="btn btn-info ms-2">🔍 {{ _('View Details') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -2129,7 +2066,6 @@ document.querySelectorAll('.copy-btn').forEach(btn => {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
HTML_END
|
||||
|
|
Loading…
Reference in New Issue