master
Seph 2024-06-19 21:10:42 +02:00
parent 4b9a73238c
commit 53062fbae1
8 changed files with 157 additions and 91 deletions

View File

@ -62,7 +62,7 @@ add_action('template_redirect', function () {
<div style="display:flex;flex-direction:column;gap:1em;">
<div>Message: <?=$log->message?></div>
<div>Action: <?=$log->action?></div>
<div>Logged: <?=format_date($log->created_at,"dd.mm.YY HH:MM")?></div>
<div>Logged: <?=format_date($log->created_at,"dd.MM.YY HH:mm")?></div>
</div>
<hr style="width:100%">
<?php

View File

@ -42,6 +42,26 @@
"Shaman": "Schamane",
"Elemental": "Elementar",
"Enhancement": "Verstärkung",
"Restoration": "Wiederherstellung"
"Restoration": "Wiederherstellung",
"Death Knight": "Todesritter",
"Blood" : "Blut",
"Frost" : "Frost",
"Unholy": "Unheilig",
"Mage": "Magier",
"_Frost": "Frost",
"Fire": "Feuer",
"Arcane": "Arkan",
"Demon Hunter": "Dämonenjäger",
"Havoc": "Verwüstung",
"Vengeance": "Rachsucht",
"Druid": "Druide",
"Guardian": "Wächter",
"Balance":"Gleichgewicht",
"Feral":"Wildheit",
"_Restoration": "Wiederherstellung"
}

View File

View File

@ -15,8 +15,13 @@ set_sidebar_status('right', false);
global $user;
if ($raid->id_wowaudit) {
$raid->sync(true);
if($raid->sync(true)){
$raid->save();
}else{
$raid->status = "Cancelled";
$raid->save();
}
}
@ -36,6 +41,15 @@ get_header();
<?php endif; ?>
</div>
<section id="primary">
<?php if($raid->status == "Cancelled"): ?>
<main id="main">
<div class="flex flex-col lg:flex-row gap-auto">
<div class="bg-glass shadow p-auto w-full text-center">
<h1 class="text-3xl font-bold text-red">Raid abgesagt!</h1>
</div>
</div>
</main>
<?php else: ?>
<main id="main">
<div class="flex flex-col lg:flex-row gap-auto" x-data="{encounter:<?= $raid->encounters[0]['id'] ?>}">
<div class="bg-glass shadow p-auto w-full lg:w-1/5 order-2 lg:order-1">
@ -86,7 +100,7 @@ get_header();
<div class="bg-glass shadow p-auto flex flex-col gap-auto">
<h3 class="text-xl font-bold text-center"><?= $role ?></h3>
<?php foreach ($signups as $signup) : ?>
<?= $signup->showForm(false, true, false, $encounter['id'] == 0) ?>
<?= $signup->showForm(false, true, false, $encounter['id'] == 0,true) ?>
<?php endforeach; ?>
</div>
<?php
@ -119,6 +133,7 @@ get_header();
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</main>
</section>
<?php

View File

@ -19,7 +19,8 @@ if (empty($chars) || empty($chars->first())) {
?>
<div class="flex <?= $vertical ? "flex-col" : "flex-row" ?> border border-<?= $this->character->color ?> shadow" x-data="{open : false}">
<div>
<div class="flex <?= $vertical ? "flex-col" : "flex-row" ?> border border-<?= $this->character->color ?> shadow" x-data="{open : false}">
<button <?= ($doSignup && $this->character->can_edit) ? 'x-on:click="open = true"' : '' ?> class="btn btn-outline btn-<?= $this->character->color ?> w-full">
<img src="<?= $this->character->classIcon ?>" class="h-8"><?= $this->character->name ?></button>
<?php if ($showStatus) : ?>
@ -116,4 +117,15 @@ if (empty($chars) || empty($chars->first())) {
</div>
</template>
<?php endif; ?>
</div>
<?php if ($showComment) : ?>
<div class="p-auto bg-glass shadow flex flex-col xl:flex-row items-center gap-2">
<div>
<?= Icon::get('o-chat-bubble-bottom-center-text') ?>
</div>
<div class="text-wrap">
<?= $this->comment ?>
</div>
</div>
<?php endif; ?>
</div>

View File

@ -0,0 +1,16 @@
<?php
namespace WoWPress\Models;
use Wenprise\Eloquent\Model;
use WoWPress\Api\BattleNet;
class Complaint extends Model{
protected $table = "wowpress_complaints";
public $timestamps = false;
protected $primaryKey = 'ID';
protected $guarded = ['ID'];
}

View File

@ -138,6 +138,7 @@ class Raid extends Model
}
}
}
$s->comment = $signup['comment'];
$s->status = $signup['selected'] ? "Selected" : $signup['status'];
$s->role = $signup['status'] == "Unknown" ? "Unknown" : $signup['role'];
$signups[] = $s;

View File

@ -120,10 +120,11 @@ class Signup extends Model
return $this->belongsTo(Raid::class);
}
public function showForm($showRole = false, $showStatus = false, $vertical = false, $doSignup = true)
public function showForm($showRole = false, $showStatus = false, $vertical = false, $doSignup = true, $showComment = false)
{
$tooLate = $this->raid->status == "Locked";
$doSignup = $doSignup && !$tooLate;
$showComment = $showComment && $this->comment;
if ($this->status == "Unknown" && $tooLate) {
$this->setStatus('Too Late');
@ -131,6 +132,7 @@ class Signup extends Model
$showRole = false;
}
require(get_template_directory() . "/template-parts/components/raid-signup.php");
}