ysdsd
All checks were successful
Deploy / deploy-staging (push) Successful in 6s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-29 02:21:22 +02:00
parent a0f19ff6b4
commit 4ead35047a
7 changed files with 180 additions and 4 deletions

View File

@@ -12,11 +12,13 @@ if ($assets) {
$settings = module_fn('fx-rates', 'settings');
$service = module_fn('fx-rates', 'service');
$latest = $service->latestStatus();
$recentFetches = $service->recentFetches(12);
$preferredCurrencies = is_array($settings['preferred_currencies'] ?? null) ? $settings['preferred_currencies'] : [];
$pageData = json_encode([
'settings' => $settings,
'latest' => $latest,
'preferred_currencies' => $preferredCurrencies,
'recent_fetches' => $recentFetches,
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
?>
<?= module_shell_header('fx-rates', ['title' => 'Waehrungskurse']) ?>
@@ -28,9 +30,6 @@ $pageData = json_encode([
<h1>Waehrungskurse</h1>
<p>Zentrale Quelle fuer FX-Snapshots, Zeitabfragen und manuelle Aktualisierung.</p>
</div>
<div class="fx-actions">
<button type="button" class="fx-button fx-button--primary" data-action="refresh-rates">Aktuelle Kurse abrufen</button>
</div>
</div>
<div class="fx-meta-grid">
<div><strong>Standard-Basis:</strong> <span data-bind="default-base"><?= e((string) ($settings['default_base_currency'] ?? 'EUR')) ?></span></div>
@@ -42,7 +41,7 @@ $pageData = json_encode([
</div>
<div class="fx-card">
<h2>Anzeige und Waehrungen</h2>
<h2>Setup</h2>
<p>Die Auswahl wird in den Modul-Settings gespeichert und steuert den Standardaufruf der letzten Kurse.</p>
<div class="fx-form-grid">
<label>
@@ -60,9 +59,38 @@ $pageData = json_encode([
</label>
<div class="fx-actions">
<button type="button" class="fx-button" data-action="save-settings">Auswahl speichern</button>
<button type="button" class="fx-button fx-button--primary" data-action="refresh-rates">Aktuelle Kurse abrufen</button>
</div>
</div>
<div class="fx-card">
<h2>Umrechnung</h2>
<p>Umrechnung auf Basis des letzten verfuegbaren Kurses zwischen den bevorzugten Waehrungen.</p>
<div class="fx-form-grid">
<label>
<span>Quellwaehrung</span>
<select name="convert_from">
<?php foreach ($preferredCurrencies as $currency): ?>
<option value="<?= e((string) $currency) ?>"><?= e((string) $currency) ?></option>
<?php endforeach; ?>
</select>
</label>
<label>
<span>Zielwaehrung</span>
<select name="convert_to">
<?php foreach ($preferredCurrencies as $currency): ?>
<option value="<?= e((string) $currency) ?>" <?= (string) $currency === (string) ($preferredCurrencies[1] ?? $preferredCurrencies[0] ?? '') ? 'selected' : '' ?>><?= e((string) $currency) ?></option>
<?php endforeach; ?>
</select>
</label>
<label>
<span>Betrag</span>
<input type="number" name="convert_amount" min="0" step="0.00000001" value="1">
</label>
</div>
<div class="fx-convert-result" data-bind="convert-result">Noch keine Umrechnung berechnet.</div>
</div>
<div class="fx-card">
<h2>Letzter Snapshot</h2>
<div class="fx-table-wrap">
@@ -78,6 +106,33 @@ $pageData = json_encode([
</tbody>
</table>
</div>
<div class="fx-history-block">
<h3>Letzte Abrufe</h3>
<div class="fx-table-wrap">
<table class="fx-table">
<thead>
<tr>
<th>Datum</th>
<th>Basis</th>
<th>Provider</th>
</tr>
</thead>
<tbody data-bind="fetches-body">
<?php if ($recentFetches === []): ?>
<tr><td colspan="3">Noch keine Abrufe vorhanden.</td></tr>
<?php else: ?>
<?php foreach ($recentFetches as $fetch): ?>
<tr>
<td><?= e((string) ($fetch['fetched_at'] ?? '')) ?></td>
<td><?= e((string) ($fetch['base_currency'] ?? '')) ?></td>
<td><?= e((string) ($fetch['provider'] ?? '')) ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>