Upload via Git Manager GUI
This commit is contained in:
@@ -1163,8 +1163,20 @@ class WBF_Shortcodes {
|
||||
?>
|
||||
<tr class="wbf-shop-order-row <?php echo $row_class; ?>" data-idx="<?php echo $i; ?>">
|
||||
<td><?php echo date_i18n('d.m.Y H:i', strtotime($order->created_at)); ?></td>
|
||||
<td style="text-align:center"><?php echo (int)$order->quantity; ?></td>
|
||||
<td style="text-align:right"><?php echo number_format($order->price * $order->quantity); ?> <?php echo esc_html(get_option('wis_currency_name', 'Coins')); ?></td>
|
||||
<td style="text-align:center"><?php
|
||||
$qty_display = (int)$order->quantity;
|
||||
if (!empty($order->response)) {
|
||||
$pl = json_decode($order->response, true);
|
||||
if (is_array($pl)) {
|
||||
$cnt = 0;
|
||||
foreach ($pl['items'] ?? [] as $it) $cnt += (int)($it['amount'] ?? 1);
|
||||
foreach ($pl['commands'] ?? [] as $c) $cnt += 1;
|
||||
if ($cnt > 0) $qty_display = $cnt;
|
||||
}
|
||||
}
|
||||
echo $qty_display;
|
||||
?></td>
|
||||
<td style="text-align:right"><?php echo number_format($order->price); ?> <?php echo esc_html(get_option('wis_currency_name', 'Coins')); ?></td>
|
||||
<td style="text-align:center">
|
||||
<button class="wbf-btn wbf-btn--sm wbf-shop-order-toggle" data-idx="<?php echo $i; ?>"><i class="fas fa-chevron-down"></i></button>
|
||||
</td>
|
||||
@@ -1172,32 +1184,65 @@ class WBF_Shortcodes {
|
||||
<tr class="wbf-shop-order-details" id="wbf-shop-order-details-<?php echo $i; ?>" style="display:none">
|
||||
<td colspan="4">
|
||||
<div class="wbf-shop-order-details-inner">
|
||||
<?php /* Artikel-Zeile entfernt, da Item-Liste folgt */ ?>
|
||||
<strong>Einzelpreis:</strong> <?php echo number_format($order->price); ?> <?php echo esc_html(get_option('wis_currency_name', 'Coins')); ?><br>
|
||||
<strong>Status:</strong> <?php echo esc_html(ucfirst($order->status)); ?><br>
|
||||
<?php if (!empty($order->server)): ?><strong>Server:</strong> <?php echo esc_html($order->server); ?><br><?php endif; ?>
|
||||
<?php
|
||||
// Antwort als JSON-Items/Coupon anzeigen
|
||||
$response = $order->response;
|
||||
$decoded = null;
|
||||
if (!empty($response)) {
|
||||
$decoded = json_decode($response, true);
|
||||
}
|
||||
if (is_array($decoded) && isset($decoded['items'])) {
|
||||
echo '<strong>Gekaufte Items:</strong><ul style="margin:.3em 0 .7em 1.2em">';
|
||||
foreach ($decoded['items'] as $item) {
|
||||
$item_id = isset($item['id']) ? $item['id'] : '';
|
||||
$item_id = preg_replace('/^minecraft:/', '', $item_id);
|
||||
$amount = isset($item['amount']) ? (int)$item['amount'] : 1;
|
||||
echo '<li><span style="color:var(--c-primary)">' . esc_html($item_id) . '</span> <span style="color:var(--c-muted)">x' . $amount . '</span></li>';
|
||||
$decoded = !empty($response) ? json_decode($response, true) : null;
|
||||
|
||||
if (is_array($decoded)) {
|
||||
$has_content = false;
|
||||
|
||||
// Normale Minecraft-Items
|
||||
if (!empty($decoded['items'])) {
|
||||
$has_content = true;
|
||||
echo '<strong>Gekaufte Items:</strong><ul style="margin:.3em 0 .7em 1.2em">';
|
||||
foreach ($decoded['items'] as $item) {
|
||||
$item_id = preg_replace('/^minecraft:/', '', $item['id'] ?? '');
|
||||
$amount = (int)($item['amount'] ?? 1);
|
||||
echo '<li><span style="color:var(--c-primary)">' . esc_html($item_id) . '</span> <span style="color:var(--c-muted)">x' . $amount . '</span></li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
echo '</ul>';
|
||||
if (isset($decoded['coupon']['code'])) {
|
||||
|
||||
// Commands: Fly & Rang
|
||||
if (!empty($decoded['commands'])) {
|
||||
$has_content = true;
|
||||
echo '<strong>Enthaltene Leistungen:</strong><ul style="margin:.3em 0 .7em 1.2em">';
|
||||
foreach ($decoded['commands'] as $cmd) {
|
||||
$type = $cmd['type'] ?? '';
|
||||
if ($type === 'fly') {
|
||||
$label = $cmd['label'] ?? '';
|
||||
if (empty($label) && !empty($cmd['duration_sec'])) {
|
||||
$sec = (int)$cmd['duration_sec'];
|
||||
$h = floor($sec / 3600);
|
||||
$m = floor(($sec % 3600) / 60);
|
||||
$label = $h > 0 ? $h . 'h Fly' : $m . ' Min. Fly';
|
||||
}
|
||||
echo '<li>✈ <span style="color:var(--c-primary)">' . esc_html($label ?: 'Fly-Gutschein') . '</span></li>';
|
||||
} elseif ($type === 'rank') {
|
||||
$label = $cmd['label'] ?? ($cmd['rank_id'] ?? '');
|
||||
$days = (int)($cmd['days'] ?? 0);
|
||||
$dauer = $days === 0 ? 'dauerhaft' : $days . ' Tag(e)';
|
||||
echo '<li>👑 <span style="color:var(--c-primary)">' . esc_html($label) . '</span> <span style="color:var(--c-muted)">(' . esc_html($dauer) . ')</span></li>';
|
||||
} elseif ($type === 'generic' && !empty($cmd['cmd'])) {
|
||||
echo '<li>⚙ <span style="color:var(--c-muted)">' . esc_html($cmd['cmd']) . '</span></li>';
|
||||
}
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
// Coupon
|
||||
if (!empty($decoded['coupon']['code'])) {
|
||||
$c = $decoded['coupon'];
|
||||
echo '<div style="margin:.2em 0 .5em 0"><strong>Coupon:</strong> <span style="color:var(--c-success)">' . esc_html($c['code']) . '</span>';
|
||||
if (isset($c['discount'])) echo ' <span style="color:var(--c-muted)">(' . intval($c['discount']) . '% Rabatt)</span>';
|
||||
if (isset($c['discount'])) echo ' <span style="color:var(--c-muted)">(-' . intval($c['discount']) . ' Rabatt)</span>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
if (!$has_content) {
|
||||
echo '<span style="color:var(--c-muted);font-size:.85em">Keine Detailinfos verfügbar.</span>';
|
||||
}
|
||||
} elseif (!empty($response)) {
|
||||
echo '<strong>Antwort:</strong> ' . esc_html($response) . '<br>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user