WowPress-Tailwind/theme/pages/charlists.php

58 lines
2.3 KiB
PHP

<?php
use WoWPress\Api\BattleNet;
use WoWPress\Database\Cache;
use WoWPress\Frontend\Icon;
use WoWPress\Models\Character;
use WoWPress\Models\CharacterList;
global $widget_area;
set_sidebar_status('top', false);
$characters = Character::orderBy('rank')->get();
get_header();
?>
<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">
<?= $GLOBALS['wowpress']['page_title'] ?>
</div>
</div>
<section id="primary" x-data="{char:null}">
<main id="main" class="flex flex-row gap-2 flex-wrap">
<?php foreach (CharacterList::all() as $list) : ?>
<a class="bg-glass shadow p-auto text-center" href="/list/<?=$list->ID?>">
<div class="text-2xl"><?= $list->list_name ?></div>
<div class="text-small text-slate-700">(<?= $list->characters()->groupBy('ID')->get()->count() ?> Charaktere)</div>
</a>
<?php endforeach; ?>
</main><!-- #main -->
<?php
if (current_user_can('wowpress_edit_raids')) : ?>
<template x-teleport="#sidebar_right">
<div class="bg-glass shadow p-auto order-1">
<h4 class="text-xl font-bold text-center mb-2">Liste hinzufügen</h4>
<form action="/request" method="POST">
<div class="flex flex-col gap-2">
<?php wp_nonce_field('addList', 'addList_nonce'); ?>
<input type="hidden" name="action" value="addList">
<input type="text" class="bg-white bg-opacity-0 border-alliance" placeholder="Listenname" name="list_name">
<input type="text" class="bg-white bg-opacity-0 border-alliance" placeholder="CSS-Farbe der Einträge" name="border_color">
<label for="notify" class="flex flex-row gap-1 items-center justify-between">Spieler bei Eintrag benachrichtigen? <input class="accent-orange-500" type="checkbox" name="notify" id="notify"></label>
<button type="submit" class="btn btn-outline btn-orange"><?= Icon::get('o-plus') ?> Hinzufügen</a>
</div>
</form>
</div>
</template>
<?php
endif;
?>
</section><!-- #primary -->
<?php
get_footer();