boerse
This commit is contained in:
147
modules/boersenchecker/partials/home.php
Normal file
147
modules/boersenchecker/partials/home.php
Normal file
@@ -0,0 +1,147 @@
|
||||
<div class="card bc-hero" data-bc-home data-chart-endpoint="<?= e($chartEndpoint) ?>">
|
||||
<script type="application/json" data-bc-instruments-json><?= json_encode(array_map(static function (array $position): array {
|
||||
return [
|
||||
'instrument_id' => (int) ($position['instrument_id'] ?? 0),
|
||||
'instrument_name' => (string) ($position['instrument_name'] ?? ''),
|
||||
'symbol' => (string) ($position['symbol'] ?? ''),
|
||||
'isin' => (string) ($position['isin'] ?? ''),
|
||||
];
|
||||
}, $positions), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) ?></script>
|
||||
<div class="pill">Boersenchecker</div>
|
||||
<h1 style="margin-top:.75rem;">Startseite</h1>
|
||||
<p class="muted">Depotauswahl, Aktienauswahl und animierte Kurscharts auf Basis von Schlusskursen.</p>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="card" style="margin-top:1rem; border-color:#ffb4a8; background:#fff5f3; color:#7a2114;"><?= e($error) ?></div>
|
||||
<?php elseif ($notice): ?>
|
||||
<div class="card" style="margin-top:1rem; border-color:var(--accent-2);"><?= e($notice) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="bc-toolbar" style="margin-top:1rem;">
|
||||
<?php if ($isAdmin): ?>
|
||||
<form class="bc-surface" method="get">
|
||||
<strong>Benutzer</strong>
|
||||
<label class="setup-field muted" style="margin-top:.75rem;">
|
||||
<span>Scope</span>
|
||||
<select name="owner_sub">
|
||||
<?php foreach ($availableOwners as $owner): ?>
|
||||
<option value="<?= e((string) $owner['sub']) ?>" <?= (string) $ownerSub === (string) $owner['sub'] ? 'selected' : '' ?>><?= e((string) $owner['label']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<button class="cta-button" type="submit">Anzeigen</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<form class="bc-surface" method="get">
|
||||
<?php if ($isAdmin): ?><input type="hidden" name="owner_sub" value="<?= e((string) $ownerSub) ?>"><?php endif; ?>
|
||||
<strong>Depot</strong>
|
||||
<?php if ($portfolios === []): ?>
|
||||
<div class="muted" style="margin-top:.75rem;">Keine Depots vorhanden.</div>
|
||||
<?php else: ?>
|
||||
<label class="setup-field muted" style="margin-top:.75rem;">
|
||||
<span>Auswahl</span>
|
||||
<select name="portfolio_id" onchange="this.form.submit()">
|
||||
<?php foreach ($portfolios as $portfolio): ?>
|
||||
<option value="<?= e((string) $portfolio['id']) ?>" <?= (string) $selectedPortfolioId === (string) $portfolio['id'] ? 'selected' : '' ?>>
|
||||
<?= e((string) $portfolio['name']) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
|
||||
<form class="bc-surface" method="get">
|
||||
<?php if ($isAdmin): ?><input type="hidden" name="owner_sub" value="<?= e((string) $ownerSub) ?>"><?php endif; ?>
|
||||
<input type="hidden" name="portfolio_id" value="<?= e((string) $selectedPortfolioId) ?>">
|
||||
<strong>Aktie</strong>
|
||||
<?php if ($positions === []): ?>
|
||||
<div class="muted" style="margin-top:.75rem;">Keine Aktien im ausgewaehlten Depot.</div>
|
||||
<?php else: ?>
|
||||
<label class="setup-field muted" style="margin-top:.75rem;">
|
||||
<span>Auswahl</span>
|
||||
<select name="instrument_id" data-bc-instrument>
|
||||
<?php foreach ($positions as $position): ?>
|
||||
<option value="<?= e((string) $position['instrument_id']) ?>" <?= (string) $selectedInstrumentId === (string) $position['instrument_id'] ? 'selected' : '' ?>>
|
||||
<?= e((string) $position['instrument_name']) ?><?= !empty($position['symbol']) ? ' (' . e((string) $position['symbol']) . ')' : '' ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
|
||||
<form class="bc-surface" method="post">
|
||||
<input type="hidden" name="action" value="refresh_current_quotes_home">
|
||||
<input type="hidden" name="portfolio_id" value="<?= e((string) $selectedPortfolioId) ?>">
|
||||
<input type="hidden" name="owner_sub" value="<?= e((string) $ownerSub) ?>">
|
||||
<strong>Aktuelle Kurse</strong>
|
||||
<p class="muted" style="margin:.75rem 0 1rem;">Abruf der aktuellen Kurse fuer das gewaehlte Depot.</p>
|
||||
<button class="cta-button" type="submit" <?= $selectedPortfolioId > 0 ? '' : 'disabled' ?>>Aktuelle Kurse abrufen</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="bc-card-grid" style="margin-top:1rem;">
|
||||
<?php foreach (array_slice($positions, 0, 4) as $position): ?>
|
||||
<div class="bc-stat">
|
||||
<div class="muted"><?= e((string) $position['instrument_name']) ?></div>
|
||||
<div class="bc-stat-value"><?= $position['latest_price'] !== null ? e(number_format((float) $position['latest_price'], 2, ',', '.')) . ' ' . e((string) $position['latest_currency']) : 'n/a' ?></div>
|
||||
<div class="muted" style="margin-top:6px;"><?= e((string) ($position['latest_quoted_at'] ?: 'kein Kurs')) ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="bc-surface" style="margin-top:1rem;">
|
||||
<div style="display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; align-items:center;">
|
||||
<div>
|
||||
<strong data-bc-instrument-name><?= e((string) ($selectedInstrument['instrument_name'] ?? 'Keine Aktie ausgewaehlt')) ?></strong>
|
||||
<?php if ($selectedInstrument): ?>
|
||||
<div class="muted" data-bc-instrument-meta><?= e((string) ($selectedInstrument['symbol'] ?? '')) ?> · <?= e((string) ($selectedInstrument['isin'] ?? '-')) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="bc-range-list">
|
||||
<button type="button" class="bc-range-button" data-range="1d" aria-pressed="false">Tag</button>
|
||||
<button type="button" class="bc-range-button" data-range="5d" aria-pressed="false">5 Tage</button>
|
||||
<button type="button" class="bc-range-button" data-range="1m" aria-pressed="true">Monat</button>
|
||||
<button type="button" class="bc-range-button" data-range="3m" aria-pressed="false">3 Monate</button>
|
||||
<button type="button" class="bc-range-button" data-range="6m" aria-pressed="false">6 Monate</button>
|
||||
<button type="button" class="bc-range-button" data-range="1y" aria-pressed="false">Jahr</button>
|
||||
<button type="button" class="bc-range-button" data-range="5y" aria-pressed="false">5 Jahre</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="muted" data-bc-chart-status style="margin-top:.75rem;">Chartdaten werden geladen...</div>
|
||||
<div class="bc-stat-value" data-bc-chart-summary style="margin-top:.35rem;">-</div>
|
||||
<div class="bc-chart-shell" data-bc-chart style="margin-top:1rem;"></div>
|
||||
</div>
|
||||
|
||||
<div class="bc-surface" style="margin-top:1rem;">
|
||||
<strong>Aktien im Depot</strong>
|
||||
<?php if ($positions === []): ?>
|
||||
<div class="muted" style="margin-top:.75rem;">Keine Aktien im ausgewaehlten Depot.</div>
|
||||
<?php else: ?>
|
||||
<div class="bc-position-list" style="margin-top:1rem;">
|
||||
<?php foreach ($positions as $position): ?>
|
||||
<div class="bc-position-row">
|
||||
<div>
|
||||
<strong><?= e((string) $position['instrument_name']) ?></strong>
|
||||
<div class="muted"><?= e((string) ($position['symbol'] ?? '')) ?> · <?= e((string) ($position['isin'] ?? '-')) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="muted">Stueckzahl</div>
|
||||
<div><?= e(number_format((float) $position['quantity'], 6, ',', '.')) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="muted">Kaufpreis</div>
|
||||
<div><?= e(number_format((float) $position['purchase_price'], 2, ',', '.')) ?> <?= e((string) $position['purchase_currency']) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="muted">Letzter Kurs</div>
|
||||
<div><?= $position['latest_price'] !== null ? e(number_format((float) $position['latest_price'], 2, ',', '.')) . ' ' . e((string) $position['latest_currency']) : 'n/a' ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user