su-secret-santa/resources/views/livewire/pages/withdraw.blade.php

352 lines
8.4 KiB
PHP

<?php
use App\Models\Participant;
use App\Services\PostService;
use Illuminate\Support\Facades\Log;
use function Livewire\Volt\{state, mount, rules};
state(['token']);
state([
'participant' => null,
]);
mount(function ($token)
{
$this->token = $token;
if ($this->token) {
$this->participant = Participant::findByToken($this->token);
}
});
$confirmWithdrawal = function ()
{
$this->js(<<<'JS'
if (confirm('Are you sure you want to withdraw from the event? This action cannot be undone.')) {
$wire.call('withdraw');
}
JS);
};
$withdraw = function ()
{
if($this->participant->withdraw()) {
$this->js('alert("Withdrawal complete")');
return $this->redirect('/', navigate: true);
}
else {
$this->js('alert("Something went wrong")');
return null;
}
};
?>
<div>
<h1>Withdraw from the event?</h1>
<button
wire:click="confirmWithdrawal"
class=""
>
Withdraw
</button>
<style>
.user-profile {
display: flex;
align-items: center;
padding: 15px;
background-color: rgba(0,0,0,0.3);
border-radius: 12px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
max-width: 100%;
margin: 15px;
}
.other-content {
display: block;
padding: 15px;
background-color: rgba(0,0,0,0.3);
border-radius: 12px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
max-width: 100%;
margin: 15px;
}
/* Add spacing below the main prompt text */
.prompt-content {
margin-bottom: 10px;
}
/* Reset H2 margin for better spacing */
.prompt-content h2 {
margin-top: 5px;
margin-bottom: 5px;
}
.avatar-container {
width: 60px;
height: 60px;
border-radius: 50%;
overflow: hidden;
margin-right: 15px;
background-color: #ccc;
flex-shrink: 0;
}
.avatar-container img {
width: 100%;
height: 100%;
object-fit: cover;
}
.username-container {
flex-grow: 1;
min-width: 0;
}
.username-container h1 {
margin: 0;
font-size: 1.2em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
body {
background-color: #222;
margin: 10pt;
font-family: sans-serif;
color: white;
overflow: hidden;
}
#viewer {
width: 100vw;
height: 100vh;
background-color: #222;
background-image: url("image/su.png");
background-repeat: no-repeat;
background-size: 400px;
background-position: center;
image-rendering: pixelated;
}
.r6o-editor {
z-index: 3;
height: auto;
}
.r6o-widget.comment {
font-size: 1.5em;
background-color: #333
}
.r6o-editor .r6o-arrow:after {
background-color: #333;
border: 3px white solid;
}
.r6o-editor .r6o-editor-inner .r6o-widget {
border: 3px white solid;
}
.r6o-editor .r6o-editor-inner {
background-color: transparent !important;
}
.r6o-footer {
display: none;
}
div {
color: white;
}
a {
color: white;
font-weight: bold;
}
#here-now {
position: fixed;
bottom: 0;
left: 0;
font-size: 1.5vh;
color: white;
padding: 15px;
z-index: 2;
background-color:#333;
border-radius: 1rem;
border: 3px solid white;
margin: 5pt;
}
#question {
font-size: 3vh;
width: 3vh;
height: 3vh;
position: fixed;
bottom: 0;
right: 0;
background-color: #333;
color: #fff;
border: 3px solid white;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
padding: 15px;
margin: 10px;
}
#question img {
max-width: 100%;
height: auto;
display: block;
}
#modal-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 3;
}
#banner {
max-width: 100%;
}
#modal {
display: none;
font-size: 18pt;
position: fixed;
top: 50%;
opacity: 0;
transition: opacity 0.3s ease-in-out;
left: 50%;
transform: translate(-50%, -50%);
justify-content: center;
border-radius: 1rem;
box-shadow: 0 0 10px 10px #000;
background-color: #333;
align-items: center;
z-index: 4;
width: 80%;
height: 80%;
overflow-y: auto;
}
#modal-content {
position: relative;
padding: 33px;
text-align: center;
max-height: 100%;
font-size: 15pt;
}
@keyframes animateBg {
0% {
background-position: 0 0;
}
100% {
background-position: 100% 0;
}
}
.rainbow {
background: linear-gradient(90deg, #f1672b, #fea419, #efd515, #89d842, #35c2f9, #9b5fe0, #ff68cf, #f1672b, #fea419, #efd515, #89d842, #35c2f9, #9b5fe0, #ff68cf, #f1672b, #fea419, #efd515, #89d842, #35c2f9, #9b5fe0, #ff68cf, #f1672b);
background-size: 300% 100%;
-webkit-background-clip: text;
animation: animateBg 5s infinite linear;
background-clip: text;
color: transparent;
}
.profile-container {
display:flex;
align-items: center;
}
.profileimg {
flex: 0 0 20%; /* 10% of the container's width, not flexible, not growing, not shrinking */
max-height: 100%;
}
.profileimg img {
width: 100%; /* Make sure the image fills its container */
height: auto; /* Maintain aspect ratio */
border-radius: 50%;
}
.profile {
flex: 1; /* Take up remaining space */
padding-left: 1rem; /* Add some space between image and text */
}
#close-button {
position: absolute;
font-size: 3rem;
top: 15px;
right: 30px;
cursor: pointer;
width: 3vh;
height: 3vh;
background-color: #333;
color: #fff;
border: 3px solid white;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
padding: 15px;
margin: 10px;
}
#open-button {
cursor: pointer;
}
#mobile-banner {
display:none;
}
@media screen and (max-width: 1081px) and (-webkit-min-device-pixel-ratio: 2) {
#viewer {
width: 100vw;
height: 66vh;
border-bottom: 3px white solid;
}
#modal-content {
font-size: 20pt;
}
#container {
display: flex;
height: 100vh;
align-items: center;
justify-content: center;
}
#mobile-banner {
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
height: 27vh;
overflow: hidden;
background-color: #444;
}
#mobile-banner img {
max-width: 90%;
max-height: 100%;
}
}</style>
</div>