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

This commit is contained in:
2026-05-04 03:03:30 +02:00
parent c81e89dc3f
commit c3ba24e939
4 changed files with 318 additions and 298 deletions

View File

@@ -58,80 +58,99 @@ $pageData = json_encode([
'preferred_currencies' => $preferredCurrencies,
'recent_fetches' => $recentFetches,
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$tabs = [
['label' => 'Ueberblick', 'href' => '/module/fx-rates', 'active' => true],
['label' => 'Waehrungen', 'href' => '/module/fx-rates/currencies'],
];
?>
<?= module_shell_header('fx-rates', [
'title' => 'Waehrungskurse',
'actions' => [
['label' => 'Setup', 'href' => '/modules/setup/fx-rates', 'variant' => 'secondary', 'size' => 'sm'],
['label' => 'Aktuelle Kurse abrufen', 'href' => '/module/fx-rates?refresh=1', 'variant' => 'secondary', 'size' => 'sm'],
],
]) ?>
<div id="fx-rates-app" data-page='<?= e(is_string($pageData) ? $pageData : '{}') ?>'>
<div class="fx-stack">
<div class="fx-card">
<?php if ($notice !== ''): ?>
<div class="fx-message is-success"><?= e($notice) ?></div>
<?php elseif ($error !== ''): ?>
<div class="fx-message is-error"><?= e($error) ?></div>
<?php endif; ?>
<p class="fx-api-note">
API-Self-Describe-Endpoint:
<a href="<?= e($apiDescribeUrl) ?>" target="_blank" rel="noopener noreferrer"><?= e($apiDescribeUrl) ?></a>
</p>
<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">
<div class="fx-card-head">
<div>
<h2>Kursverlauf</h2>
<p>Neueste Abrufe zuerst. Verlauf der bevorzugten Waehrungen relativ zur Anzeige-Basiswaehrung.</p>
</div>
<div class="fx-card-meta">
<div><strong>Anzeige-Basis:</strong> <?= e((string) ($settings['display_base_currency'] ?? $settings['default_base_currency'] ?? '')) ?></div>
<div><strong>Letzter Abruf:</strong> <?= e((string) ($latest['fetched_at_display'] ?? $latest['fetched_at'] ?? 'noch keiner')) ?></div>
</div>
</div>
<div class="fx-table-wrap">
<table class="fx-table">
<thead data-bind="history-head">
<tr>
<th>Datum</th>
<th>Kurse</th>
</tr>
</thead>
<tbody data-bind="history-body">
<tr><td colspan="2">Noch keine Verlaufsdaten geladen.</td></tr>
</tbody>
</table>
<div class="submenu-box">
<div class="fx-submenu-row">
<nav class="module-tabs" aria-label="Unterseiten von Waehrungskurse">
<?php foreach ($tabs as $tab): ?>
<a
class="<?= !empty($tab['active']) ? 'module-button module-button--tab-active' : 'module-button module-button--tab' ?>"
href="<?= e((string) $tab['href']) ?>"
><?= e((string) $tab['label']) ?></a>
<?php endforeach; ?>
</nav>
<div class="module-submenu-actions">
<a class="module-button module-button--secondary module-button--small" href="/modules/setup/fx-rates">Setup</a>
<a class="module-button module-button--secondary module-button--small" href="/module/fx-rates?refresh=1">Aktuelle Kurse abrufen</a>
</div>
</div>
</div>
</div>
<?= module_shell_footer() ?>
<?php if ($notice !== ''): ?>
<section class="section-box">
<div class="fx-message is-success"><?= e($notice) ?></div>
</section>
<?php elseif ($error !== ''): ?>
<section class="section-box">
<div class="fx-message is-error"><?= e($error) ?></div>
</section>
<?php endif; ?>
<section class="section-box">
<div class="fx-section-head">
<div>
<h2>Umrechnung</h2>
<p>Umrechnung auf Basis des letzten verfuegbaren Kurses zwischen den bevorzugten Waehrungen.</p>
</div>
</div>
<p class="fx-api-note">
API-Self-Describe-Endpoint:
<a href="<?= e($apiDescribeUrl) ?>" target="_blank" rel="noopener noreferrer"><?= e($apiDescribeUrl) ?></a>
</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>
</section>
<section class="section-box">
<div class="fx-card-head">
<div>
<h2>Kursverlauf</h2>
<p>Neueste Abrufe zuerst. Verlauf der bevorzugten Waehrungen relativ zur Anzeige-Basiswaehrung.</p>
</div>
<div class="fx-card-meta">
<div><strong>Anzeige-Basis:</strong> <?= e((string) ($settings['display_base_currency'] ?? $settings['default_base_currency'] ?? '')) ?></div>
<div><strong>Letzter Abruf:</strong> <?= e((string) ($latest['fetched_at_display'] ?? $latest['fetched_at'] ?? 'noch keiner')) ?></div>
</div>
</div>
<div class="fx-table-wrap">
<table class="fx-table">
<thead data-bind="history-head">
<tr>
<th>Datum</th>
<th>Kurse</th>
</tr>
</thead>
<tbody data-bind="history-body">
<tr><td colspan="2">Noch keine Verlaufsdaten geladen.</td></tr>
</tbody>
</table>
</div>
</section>
</div>