2024-04-22 15:38:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Wenprise\Eloquent\Database;
|
|
|
|
use Wenprise\Eloquent\Facades\DB;
|
2024-04-23 00:44:42 +02:00
|
|
|
use WoWPress\Frontend\Icon;
|
2024-05-02 23:31:44 +02:00
|
|
|
use WoWPress\Models\Log;
|
2024-04-22 15:38:22 +02:00
|
|
|
use WoWPress\Models\SKS;
|
2024-09-20 20:02:10 +02:00
|
|
|
use WoWPress\Models\SKSHistory;
|
2024-05-02 23:31:44 +02:00
|
|
|
|
2024-04-22 15:38:22 +02:00
|
|
|
set_sidebar_status('top', false);
|
2024-09-20 20:02:10 +02:00
|
|
|
get_header();
|
2024-04-22 15:38:22 +02:00
|
|
|
|
2024-09-20 20:02:10 +02:00
|
|
|
if (empty($GLOBALS['wowpress']['liste'])):
|
|
|
|
$listen = SKSHistory::groupBy('list_name')->get();
|
2024-04-22 15:38:22 +02:00
|
|
|
?>
|
2024-04-23 00:44:42 +02:00
|
|
|
<div class="top-title flex flex-row gap-2" style="margin-top:calc(-1 * var(--wowp-gap))">
|
|
|
|
<div class="text-3xl font-bold bg-glass shadow p-3 text-center w-full">
|
2024-09-20 20:02:10 +02:00
|
|
|
<?= $GLOBALS['wowpress']['page_title'] ?>
|
2024-04-22 15:38:22 +02:00
|
|
|
</div>
|
2024-04-23 00:44:42 +02:00
|
|
|
</div>
|
|
|
|
<section id="primary">
|
|
|
|
<main id="main">
|
2024-09-20 20:02:10 +02:00
|
|
|
<div class="bg-glass shadow p-auto flex flex-col gap-3">
|
2024-04-23 00:44:42 +02:00
|
|
|
<?php foreach ($listen as $list) : ?>
|
2024-04-23 22:43:54 +02:00
|
|
|
<a class="btn btn-outline" href="/sks/<?= $list->list_name ?>"><?= $list->list_name ?></a>
|
2024-04-23 00:44:42 +02:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
</section>
|
2024-09-20 20:02:10 +02:00
|
|
|
<?php else:
|
|
|
|
$liste = SKSHistory::getLatestList($GLOBALS['wowpress']['liste']);
|
2024-04-22 15:38:22 +02:00
|
|
|
?>
|
2024-09-20 20:02:10 +02:00
|
|
|
<div class="top-title flex flex-col gap-2" style="margin-top:calc(-1 * var(--wowp-gap))">
|
2024-04-23 00:44:42 +02:00
|
|
|
<div class="text-3xl font-bold bg-glass shadow p-3 text-center w-full">
|
2024-09-20 20:02:10 +02:00
|
|
|
SKS-Liste "<?= $liste->list_name ?>"
|
2024-04-23 00:44:42 +02:00
|
|
|
</div>
|
2024-09-20 20:02:10 +02:00
|
|
|
<?php if (current_user_can('wowpress_edit_raids')) : ?>
|
|
|
|
<div class="flex flex-row justify-center gap-2">
|
|
|
|
<?php
|
|
|
|
if ($prevList = $liste->getPreviousList()):
|
|
|
|
?>
|
|
|
|
<form action="/request" method="POST" class="hidden" id="undoSKS">
|
|
|
|
<?php wp_nonce_field('undoSKS', 'undoSKS_nonce'); ?>
|
|
|
|
<input type="hidden" name="action" value="undoSKS">
|
|
|
|
<input type="hidden" name="list_name" value="<?= $liste['list_name'] ?>">
|
|
|
|
</form>
|
|
|
|
<button type="submit" form="undoSKS" class="btn btn-outline btn-deepblue text-white hover:text-alliance">
|
|
|
|
Rückgängig (Stand vom <?= format_date($prevList->created_at, "dd.MM.yyyy HH:mm") ?>)
|
|
|
|
</button>
|
|
|
|
<?php endif;
|
|
|
|
if ($nextList = $liste->getNextList()):
|
|
|
|
?>
|
|
|
|
<form action="/request" method="POST" class="hidden" id="redoSKS">
|
|
|
|
<?php wp_nonce_field('redoSKS', 'redoSKS_nonce'); ?>
|
|
|
|
<input type="hidden" name="action" value="redoSKS">
|
|
|
|
<input type="hidden" name="list_name" value="<?= $liste['list_name'] ?>">
|
|
|
|
</form>
|
|
|
|
<button type="submit" form="redoSKS" class="btn btn-outline btn-deepblue text-white hover:text-alliance">
|
|
|
|
Wiederherstellen (Stand vom <?= format_date($nextList->created_at, "dd.MM.yyyy HH:mm") ?>)
|
|
|
|
</button>
|
|
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
|
|
<? endif; ?>
|
2024-04-23 00:44:42 +02:00
|
|
|
</div>
|
|
|
|
<section id="primary">
|
|
|
|
<main id="main">
|
2024-09-20 20:02:10 +02:00
|
|
|
<div class="bg-glass shadow p-auto flex flex-col gap-2">
|
2024-04-23 00:44:42 +02:00
|
|
|
<table class="table-auto w-full">
|
|
|
|
<thead>
|
|
|
|
<tr class="bg-glass">
|
|
|
|
<th class="p-auto w-40">Rang</th>
|
|
|
|
<th class="p-auto">Charakter</th>
|
|
|
|
<th class="p-auto hidden lg:table-cell">Server</th>
|
|
|
|
<?php if (current_user_can('wowpress_edit_raids')) : ?>
|
2024-04-23 22:43:54 +02:00
|
|
|
<th class="p-auto hidden lg:table-cell">Status</th>
|
|
|
|
|
2024-04-23 00:44:42 +02:00
|
|
|
<th class="p-auto w-0">Aktion</th>
|
|
|
|
<?php endif; ?>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2024-09-20 20:02:10 +02:00
|
|
|
<?php foreach ($liste->list_array as $list_item) :
|
|
|
|
switch ($list_item['rank']) {
|
|
|
|
case 1:
|
|
|
|
$rank_color = "text-[#bfac1d]";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$rank_color = "text-[#9c9b9a]";
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$rank_color = "text-[#9e4f00]";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$rank_color = "text-white";
|
|
|
|
}
|
|
|
|
$char = $liste->getCharData($list_item['char']);
|
|
|
|
?>
|
|
|
|
|
|
|
|
<tr class="text-<?= $list_item['active'] ? $char->color : "slate-500" ?> odd:bg-slate-900">
|
|
|
|
|
|
|
|
<td class="p-auto text-center <?= $rank_color ?>"><?= $list_item['rank'] ?></td>
|
|
|
|
<td class="p-auto text-center" style="font-size:1.3em"><?= $char->name ?></td>
|
|
|
|
<td class="p-auto text-center hidden lg:table-cell" style="font-size:1.3em"><?= $char->realm ?></td>
|
2024-04-23 00:44:42 +02:00
|
|
|
|
2024-09-20 20:02:10 +02:00
|
|
|
<?php if (current_user_can('wowpress_edit_raids')) : ?>
|
|
|
|
<td class="p-auto text-center hidden lg:table-cell">
|
|
|
|
<form action="/request" method="POST">
|
|
|
|
<?php wp_nonce_field('toggleSKS', 'toggleSKS_nonce'); ?>
|
|
|
|
<input type="hidden" name="action" value="toggleSKS">
|
|
|
|
<input type="hidden" name="list_name" value="<?= $liste['list_name'] ?>">
|
|
|
|
<input type="hidden" name="rank" value="<?= $list_item['rank'] ?>">
|
|
|
|
<button type="submit" class="btn w-full btn-outline btn-<?= $list_item['active'] ? $char->color : "slate" ?>"><?= $list_item['active'] ? "Aktiv" : "Inaktiv" ?></button>
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
<td class="p-auto">
|
|
|
|
<div class="flex gap-2 flex-col lg:flex-row justify-end">
|
|
|
|
<?php if ($list_item['active']) : ?>
|
|
|
|
<form action="/request" method="POST">
|
|
|
|
<?php wp_nonce_field('lootSKS', 'lootSKS_nonce'); ?>
|
|
|
|
<input type="hidden" name="action" value="lootSKS">
|
|
|
|
<input type="hidden" name="list_name" value="<?= $liste['list_name'] ?>">
|
|
|
|
<input type="hidden" name="char" value="<?= $list_item['char'] ?>">
|
|
|
|
<button type="submit" title="Looten" class="btn btn-outline btn-<?= $char->color ?>"><?= Icon::get('o-sparkles') ?></button>
|
|
|
|
</form>
|
|
|
|
<?php else : ?>
|
|
|
|
<form action="/request" method="POST">
|
|
|
|
<?php wp_nonce_field('deleteSKS', 'deleteSKS_nonce'); ?>
|
|
|
|
<input type="hidden" name="action" value="deleteSKS">
|
|
|
|
<input type="hidden" name="list_name" value="<?= $liste['list_name'] ?>">
|
|
|
|
<input type="hidden" name="char" value="<?= $list_item['char'] ?>">
|
|
|
|
<button type="submit" title="Löschen" class="btn btn-outline btn-red"><?= Icon::get('o-trash') ?></button>
|
|
|
|
</form>
|
|
|
|
<? endif; ?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
<?php endif; ?>
|
|
|
|
</tr>
|
2024-04-23 00:44:42 +02:00
|
|
|
|
|
|
|
|
2024-09-20 20:02:10 +02:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</table>
|
2024-04-23 00:44:42 +02:00
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
</section>
|
2024-09-20 20:02:10 +02:00
|
|
|
<?php
|
|
|
|
if (current_user_can('wowpress_edit_raids')) : ?>
|
2024-04-23 22:43:54 +02:00
|
|
|
<div x-data>
|
|
|
|
<template x-teleport="#sidebar_right">
|
|
|
|
<div class="bg-glass shadow p-auto order-1">
|
|
|
|
<h4 class="text-xl font-bold text-center mb-2">Charakter Hinzufügen</h4>
|
|
|
|
<form action="/request" method="POST">
|
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
<?php wp_nonce_field('addSKS', 'addSKS_nonce'); ?>
|
|
|
|
<input type="hidden" name="action" value="addSKS">
|
2024-09-20 20:02:10 +02:00
|
|
|
<input type="hidden" name="list_name" value="<?=$liste->list_name?>">
|
|
|
|
|
2024-04-23 22:43:54 +02:00
|
|
|
<input type="text" name="name" placeholder="Name" class="text-black">
|
|
|
|
<input type="text" name="realm" placeholder="Server" class="text-black">
|
|
|
|
|
|
|
|
<button type="submit" class="btn btn-outline btn-hunter">Hinzufügen</a>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
2024-04-23 00:44:42 +02:00
|
|
|
|
2024-04-22 15:38:22 +02:00
|
|
|
<?php
|
2024-04-23 22:43:54 +02:00
|
|
|
endif;
|
2024-09-20 20:02:10 +02:00
|
|
|
endif;
|
2024-04-23 22:43:54 +02:00
|
|
|
|
|
|
|
get_footer();
|