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

35 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2024-04-23 00:44:42 +02:00
<?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();
2024-04-27 21:21:33 +02:00
if(!empty($character)){
2024-04-23 00:44:42 +02:00
?>
<div class="bg-glass shadow p-auto flex flex-col gap-auto order-last">
2024-04-26 17:47:19 +02:00
<h1 class="text-xl font-bold text-center"><?= $this->title ?></h1>
2024-04-23 00:44:42 +02:00
<?php if(!empty($character->ID)): ?>
<?php foreach ($raids as $raid) : ?>
<?php
?>
2024-04-23 22:43:54 +02:00
<div class="border shadow p-auto flex flex-col gap-2" style="background-position:center;background-size: cover;background-image:url('<?=$raid->thumbnail?>')">
2024-04-26 17:47:19 +02:00
<h2 class="text-xl font-bold text-center"><a href="<?=$raid->link?>"><?= $raid->title ?></a></h2>
2024-04-23 00:44:42 +02:00
<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;?>
2024-04-27 21:21:33 +02:00
</div>
<?php }