WowPress-Tailwind/theme/template-parts/widgets/raid_signup.php

34 lines
1.3 KiB
PHP

<?php
use WoWPress\Models\Raid;
use WoWPress\Models\Signup;
use WoWPress\Models\User;
#dd($instance['count']);
$user = User::find(get_current_user_id());
$raids = Raid::where('start', '>', date('Y-m-d H:i', strtotime('NOW')))->get()->take(intval($instance['count']) ?: 1);
$character = $user->raiders->first();
?>
<div class="bg-glass shadow p-auto flex flex-col gap-auto order-last">
<h3 class="text-xl font-bold text-center"><?= $this->title ?></h3>
<?php if(!empty($character->ID)): ?>
<?php foreach ($raids as $raid) : ?>
<?php
?>
<div class="border shadow p-auto flex flex-col gap-2" style="background-position:center;background-size: cover;background-image:url('<?=$raid->thumbnail?>')">
<h1 class="text-xl font-bold text-center"><?= $raid->title ?></h1>
<div class="text-center text-<?= $raid->color ?>"><?= $raid->difficulty ?></div>
<div class="flex gap-1 justify-center">
<div class="text-center text-white"><?= format_date($raid->start, 'E, dd.MM.') ?></div>
<div class="text-center text-white"><?= format_date($raid->start, 'HH:mm') ?> - <?= format_date($raid->end, 'HH:mm') ?></div>
</div>
<?php
$raid->showSignup($character,false, true, true);
?>
</div>
<?php endforeach; endif;?>
</div>