- Raids: "Max. Spieler" only whole numbers up to groups x 5 (max. 10 groups / 50), gearscore only a number; fixed +1 Lumipunkt per participation, other values only with the new raids.points permission; pick an existing premade per group when creating a raid; unchanged legacy values no longer block editing - Raid page updates itself every 15 s while visible (raids_live.php, cards rendered by includes/raid_card.php), open editors and confirm dialogs are kept - Restore takes the new raid_id from the bot (archived messages are now deleted in Discord) and moves settings, attendance and awards; website signups send the server display name - Premades: dissolve by leadership needs a reason, lead gets DMs on join/assign/decline/remove (source/actor_id sent to the bot), transfer picker skips players who already lead a group, website accept keeps the one-group rule, no commas in names - Site-wide Lumina dialog (assets/js/confirm-dialog.js) replaces confirm/prompt/alert via data-confirm; error flashes are a dialog you confirm with OK - Calendar: audience per entry (all / leadership takes part / internal) with the new calendar.leadership permission; day cells list all entries and scroll - Gear planner: main-hand picker filtered by the set's class, mismatches marked, "keine Klasse" option, link to an external skill/Daevanion plan per set - Map: correct kisk icons (Elyos on Verteron/Abyss, Altgard fixed), per-map max zoom and bounded panning, German texts, data source note - Tactics: toolbar as a uniform grid, whole-tactic copy, automatic versions with restore and a 90-day trash, official tactics protected - Global thin gold scrollbars, readable hover colours, "Sedes Luminis" spelling, patch notes and README, schema version 34 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
130 lines
8.5 KiB
PHP
130 lines
8.5 KiB
PHP
<?php
|
||
/**
|
||
* Eine Bestellung als Zeile - fuer "Meine Antraege" (shop.php) und die Antragsliste der
|
||
* Verwaltung (shop_orders.php, dort mit $orderView = 'manage' und den Bearbeitungsknoepfen).
|
||
*
|
||
* @var array $order
|
||
* @var string|null $orderView
|
||
* @var string|null $orderReturn Ruecksprung nach einer Aktion
|
||
* @var array<int, int|null>|null $itemStocks Bestand je Shop-Gegenstand (Verwaltung, null = unbegrenzt)
|
||
*/
|
||
$isManageView = ($orderView ?? 'member') === 'manage';
|
||
$status = (string) $order['status'];
|
||
$badgeClass = [
|
||
'pending' => 'badge-pending',
|
||
'approved' => 'shop-badge-approved',
|
||
'delivered' => 'badge-active',
|
||
'rejected' => 'badge-disabled',
|
||
'cancelled' => '',
|
||
][$status] ?? '';
|
||
$return = $orderReturn ?? '/shop.php#antraege';
|
||
$requested = shop_requested_quantity($order);
|
||
$quantity = (int) $order['quantity'];
|
||
// Bestand fuer die Bewilligung: vorbelegt wird hoechstens, was da ist.
|
||
$stockNow = null;
|
||
$hasStockInfo = $isManageView && $status === 'pending' && $order['item_id'] !== null && array_key_exists((int) $order['item_id'], $itemStocks ?? []);
|
||
if ($hasStockInfo) {
|
||
$stockNow = $itemStocks[(int) $order['item_id']];
|
||
}
|
||
$approveDefault = $stockNow !== null ? max(1, min($quantity, $stockNow)) : $quantity;
|
||
?>
|
||
<article class="shop-order shop-order-<?= e($status) ?>">
|
||
<span class="shop-order-icon"><?= warehouse_icon_html($order['icon'] ?? null, (string) $order['item_name'], 44) ?></span>
|
||
<div class="shop-order-body">
|
||
<div class="shop-order-title">
|
||
<strong><?= e(shop_order_label($order)) ?></strong>
|
||
<span class="badge <?= e($badgeClass) ?>"><?= e(shop_status_label($status)) ?></span>
|
||
<span class="text-muted">#<?= (int) $order['id'] ?></span>
|
||
</div>
|
||
<div class="shop-order-meta text-muted">
|
||
<?php if ($isManageView): ?>
|
||
<strong class="shop-order-buyer"><?= e((string) $order['buyer']) ?></strong> ·
|
||
<?php endif; ?>
|
||
beantragt am <?= e(contribution_format_time($order['created_at'])) ?>
|
||
<?php if ($quantity > 1): ?>
|
||
· <?= $quantity ?> × <?= contribution_format((int) $order['unit_price']) ?>
|
||
<?php endif; ?>
|
||
<?php if ($requested > $quantity): ?>
|
||
· <strong class="shop-order-partial"><?= $quantity ?> von <?= $requested ?> bewilligt</strong>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php if ($hasStockInfo): ?>
|
||
<div class="shop-order-meta shop-order-stock<?= $stockNow !== null && $stockNow < $quantity ? ' is-short' : '' ?>">
|
||
Bestand: <?= $stockNow === null ? 'unbegrenzt' : number_format($stockNow, 0, ',', '.') ?>
|
||
<?= $stockNow !== null && $stockNow < $quantity ? ' – reicht nicht für alle, nur einen Teil bewilligen' : '' ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php if (!empty($order['note'])): ?>
|
||
<div class="shop-order-note"><span class="text-muted">Bemerkung:</span> <?= e((string) $order['note']) ?></div>
|
||
<?php endif; ?>
|
||
<?php if ($order['decided_at'] !== null): ?>
|
||
<div class="shop-order-meta text-muted">
|
||
<?= $status === 'rejected' ? 'Abgelehnt' : ($status === 'cancelled' ? 'Storniert' : 'Bewilligt') ?>
|
||
am <?= e(contribution_format_time($order['decided_at'])) ?>
|
||
<?php if (!empty($order['decider'])): ?>von <?= e((string) $order['decider']) ?><?php endif; ?>
|
||
<?php if ($order['delivered_at'] !== null): ?>
|
||
· übergeben am <?= e(contribution_format_time($order['delivered_at'])) ?>
|
||
<?php if (!empty($order['deliverer'])): ?>von <?= e((string) $order['deliverer']) ?><?php endif; ?>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php elseif ($status === 'cancelled'): ?>
|
||
<div class="shop-order-meta text-muted">Vom Mitglied zurückgezogen.</div>
|
||
<?php endif; ?>
|
||
<?php if (!empty($order['decision_note'])): ?>
|
||
<div class="shop-order-note"><span class="text-muted">Grund:</span> <?= e((string) $order['decision_note']) ?></div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<div class="shop-order-price<?= in_array($status, ['approved', 'delivered'], true) ? ' is-paid' : '' ?>" data-order-price="<?= (int) $order['id'] ?>" title="<?= in_array($status, ['approved', 'delivered'], true) ? 'Abgezogen' : ($status === 'pending' ? 'Vorgemerkt' : 'Nicht abgezogen') ?>">
|
||
<?= contribution_coin(18) ?> <?= contribution_format((int) $order['total_price']) ?>
|
||
</div>
|
||
<div class="shop-order-actions">
|
||
<?php if ($isManageView): ?>
|
||
<?php if ($status === 'pending'): ?>
|
||
<form method="post" action="/shop_action.php" class="shop-approve-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="approve">
|
||
<input type="hidden" name="order_id" value="<?= (int) $order['id'] ?>">
|
||
<input type="hidden" name="return" value="<?= e($return) ?>">
|
||
<?php if ($quantity > 1): ?>
|
||
<input type="number" name="approve_quantity" min="1" max="<?= $quantity ?>" value="<?= $approveDefault ?>"
|
||
class="shop-approve-quantity" title="Anzahl, die bewilligt wird (höchstens <?= $quantity ?>)"
|
||
aria-label="Anzahl bewilligen" data-unit-price="<?= (int) $order['unit_price'] ?>">
|
||
<span class="text-muted shop-approve-of">von <?= $quantity ?></span>
|
||
<?php endif; ?>
|
||
<button type="submit" class="button-success button-small" title="Lumipunkte abziehen und zur Übergabe freigeben"><?= icon('check') ?> Bewilligen</button>
|
||
</form>
|
||
<form method="post" action="/shop_action.php" data-confirm="Das Mitglied bekommt die Lumipunkte nicht abgezogen." data-confirm-title="Antrag ablehnen" data-confirm-ok="Ablehnen" data-confirm-danger data-confirm-input="reason" data-confirm-placeholder="Grund (optional, sieht das Mitglied)">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="reject">
|
||
<input type="hidden" name="order_id" value="<?= (int) $order['id'] ?>">
|
||
<input type="hidden" name="reason" value="">
|
||
<input type="hidden" name="return" value="<?= e($return) ?>">
|
||
<button type="submit" class="button-secondary button-small"><?= icon('x') ?> Ablehnen</button>
|
||
</form>
|
||
<?php elseif ($status === 'approved'): ?>
|
||
<form method="post" action="/shop_action.php">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="deliver">
|
||
<input type="hidden" name="order_id" value="<?= (int) $order['id'] ?>">
|
||
<input type="hidden" name="return" value="<?= e($return) ?>">
|
||
<button type="submit" class="button-small" title="Im Spiel übergeben"><?= icon('check') ?> Übergeben</button>
|
||
</form>
|
||
<form method="post" action="/shop_action.php" data-confirm="Die Lumipunkte gehen zurück an das Mitglied und der Bestand wird wieder aufgefüllt." data-confirm-title="Bestellung stornieren?" data-confirm-ok="Stornieren" data-confirm-danger data-confirm-input="reason" data-confirm-placeholder="Grund (optional)">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="revoke">
|
||
<input type="hidden" name="order_id" value="<?= (int) $order['id'] ?>">
|
||
<input type="hidden" name="reason" value="">
|
||
<input type="hidden" name="return" value="<?= e($return) ?>">
|
||
<button type="submit" class="icon-button icon-button-danger" title="Stornieren" aria-label="Stornieren"><?= icon('restore') ?></button>
|
||
</form>
|
||
<?php endif; ?>
|
||
<?php elseif ($status === 'pending'): ?>
|
||
<form method="post" action="/shop_action.php" data-confirm="Dein Antrag wird zurückgezogen." data-confirm-title="Antrag zurückziehen?" data-confirm-ok="Zurückziehen">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="cancel">
|
||
<input type="hidden" name="order_id" value="<?= (int) $order['id'] ?>">
|
||
<button type="submit" class="button-secondary button-small">Zurückziehen</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
</article>
|