Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b65e392fe | ||
|
|
d46b65aa73 | ||
|
|
f4463bbd9a | ||
|
|
ae631cd463 | ||
|
|
4ff703b4ff | ||
|
|
fdbb70a4e5 | ||
|
|
3b438626dd | ||
|
|
4bd4f8046d | ||
|
|
e277c7f7d4 | ||
|
|
cbe3c0983f |
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 566 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 689 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 666 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 604 KiB |
+132
-6
@@ -63,7 +63,7 @@
|
|||||||
.submission-success .intro-card--image {
|
.submission-success .intro-card--image {
|
||||||
width: min(100%, 40rem);
|
width: min(100%, 40rem);
|
||||||
aspect-ratio: 4 / 5;
|
aspect-ratio: 4 / 5;
|
||||||
align-self: center;
|
align-self: flex-start;
|
||||||
justify-self: center;
|
justify-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,6 +229,24 @@ textarea:focus {
|
|||||||
transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
|
transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.option-card--with-icon {
|
||||||
|
justify-items: center;
|
||||||
|
align-content: center;
|
||||||
|
gap: var(--space-2);
|
||||||
|
color: var(--brown);
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-card__icon {
|
||||||
|
color: var(--brown);
|
||||||
|
font-size: 1.35rem;
|
||||||
|
line-height: 1;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-card--with-icon span {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.option-card:hover {
|
.option-card:hover {
|
||||||
background: var(--olive-light);
|
background: var(--olive-light);
|
||||||
@@ -236,6 +254,41 @@ textarea:focus {
|
|||||||
transform: translateY(-3px);
|
transform: translateY(-3px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.option-grid--tomato-choices .option-card:hover,
|
||||||
|
.option-grid--tomato-choices .option-card:has(input:focus-visible) {
|
||||||
|
border-color: var(--tomato);
|
||||||
|
background: var(--tomato);
|
||||||
|
color: var(--butter-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-grid--tomato-choices .option-card:has(input:checked) {
|
||||||
|
border-color: var(--tomato);
|
||||||
|
background: var(--tomato);
|
||||||
|
color: var(--butter-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-grid--icon-choices .option-card--with-icon:hover .option-card__icon,
|
||||||
|
.option-grid--icon-choices .option-card--with-icon:has(input:focus-visible) .option-card__icon,
|
||||||
|
.option-grid--icon-choices .option-card--with-icon:has(input:checked) .option-card__icon {
|
||||||
|
color: var(--butter-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-grid--icon-choices .option-card--with-icon:has(input:disabled) {
|
||||||
|
opacity: 0.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-grid--icon-choices .option-card--with-icon:has(input:disabled):hover {
|
||||||
|
border-color: var(--olive-light);
|
||||||
|
background: var(--butter-light);
|
||||||
|
color: var(--brown);
|
||||||
|
box-shadow: none;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-grid--icon-choices .option-card--with-icon:has(input:disabled):hover .option-card__icon {
|
||||||
|
color: var(--brown);
|
||||||
|
}
|
||||||
|
|
||||||
.option-card input {
|
.option-card input {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
@@ -251,6 +304,20 @@ textarea:focus {
|
|||||||
.option-card--invalid {
|
.option-card--invalid {
|
||||||
border-color: var(--error) !important;
|
border-color: var(--error) !important;
|
||||||
box-shadow: 0 0 0 2px rgba(212, 75, 36, 0.14);
|
box-shadow: 0 0 0 2px rgba(212, 75, 36, 0.14);
|
||||||
|
}
|
||||||
|
|
||||||
|
.guest-count-icon {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
color: var(--brown);
|
||||||
|
font-size: 3rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.guest-count-icon::before {
|
||||||
|
display: block;
|
||||||
|
transform: translateX(1.1rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
.counter {
|
.counter {
|
||||||
@@ -259,8 +326,17 @@ textarea:focus {
|
|||||||
gap: var(--space-16);
|
gap: var(--space-16);
|
||||||
}
|
}
|
||||||
|
|
||||||
.counter input {
|
.counter-value-group {
|
||||||
|
display: grid;
|
||||||
|
justify-items: stretch;
|
||||||
|
row-gap: var(--space-1);
|
||||||
width: 6rem;
|
width: 6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.counter input {
|
||||||
|
width: 100%;
|
||||||
|
height: 3rem;
|
||||||
|
padding-block: 0.75rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,6 +403,20 @@ textarea:focus {
|
|||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.review-gallery {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: var(--space-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.review-gallery__thumb {
|
||||||
|
width: 4.5rem;
|
||||||
|
height: 4.5rem;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
object-fit: cover;
|
||||||
|
box-shadow: var(--shadow-interaction);
|
||||||
|
}
|
||||||
|
|
||||||
.submission-success-actions {
|
.submission-success-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
@@ -417,22 +507,58 @@ textarea:focus {
|
|||||||
margin-top: var(--space-2);
|
margin-top: var(--space-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gallery Upload */
|
|
||||||
.gallery-upload {
|
.gallery-upload {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.75rem;
|
gap: var(--space-16);
|
||||||
}
|
}
|
||||||
|
|
||||||
.gallery-preview {
|
.gallery-preview {
|
||||||
display: contents;
|
display: contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gallery-add-button {
|
||||||
|
width: 7rem;
|
||||||
|
height: 7rem;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
align-content: center;
|
||||||
|
gap: var(--space-1);
|
||||||
|
padding: var(--space-1);
|
||||||
|
border: 1.5px solid var(--olive-light);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
background: var(--butter-light);
|
||||||
|
color: var(--olive);
|
||||||
|
font-family: var(--font-main);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gallery-add-button__icon {
|
||||||
|
color: var(--brown);
|
||||||
|
font-size: 2rem;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gallery-add-button__text {
|
||||||
|
color: var(--black);
|
||||||
|
font-size: 0.95rem;
|
||||||
|
line-height: 1.15;
|
||||||
|
text-align: center;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gallery-add-button:hover {
|
||||||
|
background: var(--olive-light);
|
||||||
|
box-shadow: var(--shadow-interaction);
|
||||||
|
transform: translateY(-3px);
|
||||||
|
}
|
||||||
|
|
||||||
.gallery-thumb {
|
.gallery-thumb {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 5.5rem;
|
width: 7rem;
|
||||||
height: 5.5rem;
|
height: 7rem;
|
||||||
border-radius: var(--radius-sm, 0.5rem);
|
border-radius: var(--radius-sm, 0.5rem);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|||||||
@@ -445,6 +445,30 @@
|
|||||||
grid-row: 1 / 3;
|
grid-row: 1 / 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.detail-gallery-large--single {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
grid-template-rows: auto;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-gallery-large--single .detail-gallery-item {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
grid-row: auto;
|
||||||
|
align-self: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-gallery-large--single .detail-gallery-image {
|
||||||
|
height: auto;
|
||||||
|
min-height: 0;
|
||||||
|
object-fit: contain;
|
||||||
|
object-position: top center;
|
||||||
|
background: var(--butter-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-gallery-large--single img:first-child {
|
||||||
|
grid-row: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.detail-lightbox {
|
.detail-lightbox {
|
||||||
/* Full-screen overlay for enlarged gallery image view. */
|
/* Full-screen overlay for enlarged gallery image view. */
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -847,6 +871,11 @@
|
|||||||
grid-row: auto;
|
grid-row: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.detail-gallery-large--single {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
grid-template-rows: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.detail-lightbox {
|
.detail-lightbox {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -471,12 +471,20 @@ label {
|
|||||||
transition: background-color 0.2s ease, border-color 0.2s ease;
|
transition: background-color 0.2s ease, border-color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-primary-abmelden:hover,
|
.button-primary-abmelden:hover:not(:disabled),
|
||||||
.button-primary-abmelden:focus-visible {
|
.button-primary-abmelden:focus-visible:not(:disabled) {
|
||||||
background: var(--blue-dark);
|
background: var(--blue-dark);
|
||||||
border-color: var(--blue-dark);
|
border-color: var(--blue-dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-primary-abmelden:disabled {
|
||||||
|
background-color: var(--blue);
|
||||||
|
border-color: var(--blue);
|
||||||
|
color: var(--butter-light);
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
.button-primary-eigener-event{
|
.button-primary-eigener-event{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.375rem 1.5rem;
|
padding: 0.375rem 1.5rem;
|
||||||
@@ -589,6 +597,7 @@ label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.category-item-profile {
|
.category-item-profile {
|
||||||
|
position: relative;
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
@@ -643,6 +652,7 @@ label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.profile-pill {
|
.profile-pill {
|
||||||
|
position: relative;
|
||||||
width: 2.375rem;
|
width: 2.375rem;
|
||||||
height: 2.375rem;
|
height: 2.375rem;
|
||||||
border-radius: 1.1875rem;
|
border-radius: 1.1875rem;
|
||||||
@@ -658,6 +668,18 @@ label {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notification-dot {
|
||||||
|
position: absolute;
|
||||||
|
top: -2px;
|
||||||
|
right: -2px;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
background-color: var(--error);
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid var(--butter-light);
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
/* Utilities */
|
/* Utilities */
|
||||||
.text-center {
|
.text-center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
+35
-1
@@ -87,7 +87,7 @@
|
|||||||
"title": "Japanese Delight",
|
"title": "Japanese Delight",
|
||||||
"location": "Zürich",
|
"location": "Zürich",
|
||||||
"address": "Limmatquai 92, 8001 Zürich",
|
"address": "Limmatquai 92, 8001 Zürich",
|
||||||
"date": "02. MAI. 2026",
|
"date": "24. April. 2026",
|
||||||
"time": "12:30 UHR",
|
"time": "12:30 UHR",
|
||||||
"category": "Lunch",
|
"category": "Lunch",
|
||||||
"diet": "Fisch",
|
"diet": "Fisch",
|
||||||
@@ -121,5 +121,39 @@
|
|||||||
"https://i.pinimg.com/1200x/b1/fb/3a/b1fb3a7809f4046843904ac8800daacc.jpg",
|
"https://i.pinimg.com/1200x/b1/fb/3a/b1fb3a7809f4046843904ac8800daacc.jpg",
|
||||||
"https://i.pinimg.com/1200x/c6/93/42/c69342ec621333e853c35bda891d8bc6.jpg"
|
"https://i.pinimg.com/1200x/c6/93/42/c69342ec621333e853c35bda891d8bc6.jpg"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"title": "Mexican Fiesta",
|
||||||
|
"location": "Basel",
|
||||||
|
"address": "Münsterplatz 10, 4051 Basel",
|
||||||
|
"date": "28. April. 2026",
|
||||||
|
"time": "18:00 UHR",
|
||||||
|
"category": "Dinner",
|
||||||
|
"diet": "Omnivore",
|
||||||
|
"spots": 6,
|
||||||
|
"status": "canceled",
|
||||||
|
"host": {
|
||||||
|
"name": "Carlos",
|
||||||
|
"initial": "C"
|
||||||
|
},
|
||||||
|
"hostMessage": [
|
||||||
|
"Hallo zusammen! Leider muss ich dieses Event absagen, da mir etwas Wichtiges dazwischengekommen ist.",
|
||||||
|
"Ich hoffe, wir können das bald nachholen!"
|
||||||
|
],
|
||||||
|
"menu": [
|
||||||
|
"Guacamole & Nachos",
|
||||||
|
"Tacos al Pastor",
|
||||||
|
"Churros"
|
||||||
|
],
|
||||||
|
"specifications": [],
|
||||||
|
"participants": [
|
||||||
|
"Carlos",
|
||||||
|
"Vivien",
|
||||||
|
"Test"
|
||||||
|
],
|
||||||
|
"gallery": [
|
||||||
|
"https://i.pinimg.com/1200x/e2/6a/f5/e26af5c24b805081a3f304d240818302.jpg"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
+46
-23
@@ -80,24 +80,28 @@
|
|||||||
<fieldset class="form-field">
|
<fieldset class="form-field">
|
||||||
<label>Art des Essens / Eventtyp</label>
|
<label>Art des Essens / Eventtyp</label>
|
||||||
|
|
||||||
<div class="option-grid option-grid--4">
|
<div class="option-grid option-grid--4 option-grid--event-type option-grid--icon-choices option-grid--tomato-choices">
|
||||||
<label class="option-card option">
|
<label class="option-card option option-card--with-icon">
|
||||||
<input type="radio" name="eventType" value="Brunch" required />
|
<input type="radio" name="eventType" value="Brunch" required />
|
||||||
|
<i class="fa-solid fa-bread-slice option-card__icon" aria-hidden="true"></i>
|
||||||
<span>Brunch</span>
|
<span>Brunch</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="option-card option">
|
<label class="option-card option option-card--with-icon">
|
||||||
<input type="radio" name="eventType" value="Lunch" />
|
<input type="radio" name="eventType" value="Lunch" />
|
||||||
|
<i class="fa-solid fa-pizza-slice option-card__icon" aria-hidden="true"></i>
|
||||||
<span>Lunch</span>
|
<span>Lunch</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="option-card option">
|
<label class="option-card option option-card--with-icon">
|
||||||
<input type="radio" name="eventType" value="Kaffee + Kuchen" />
|
<input type="radio" name="eventType" value="Kaffee + Kuchen" />
|
||||||
|
<i class="fa-solid fa-mug-hot option-card__icon" aria-hidden="true"></i>
|
||||||
<span>Kaffee + Kuchen</span>
|
<span>Kaffee + Kuchen</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="option-card option">
|
<label class="option-card option option-card--with-icon">
|
||||||
<input type="radio" name="eventType" value="Dinner" />
|
<input type="radio" name="eventType" value="Dinner" />
|
||||||
|
<i class="fa-solid fa-martini-glass option-card__icon" aria-hidden="true"></i>
|
||||||
<span>Dinner</span>
|
<span>Dinner</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -115,15 +119,18 @@
|
|||||||
>
|
>
|
||||||
−
|
−
|
||||||
</button>
|
</button>
|
||||||
<input
|
<div class="counter-value-group">
|
||||||
type="number"
|
<i class="fa-solid fa-user-group guest-count-icon" aria-hidden="true"></i>
|
||||||
id="maxGuests"
|
<input
|
||||||
name="maxGuests"
|
type="number"
|
||||||
min="1"
|
id="maxGuests"
|
||||||
step="1"
|
name="maxGuests"
|
||||||
value="4"
|
min="1"
|
||||||
required
|
step="1"
|
||||||
/>
|
value="0"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="counter-button"
|
class="counter-button"
|
||||||
@@ -152,24 +159,28 @@
|
|||||||
<fieldset class="form-field">
|
<fieldset class="form-field">
|
||||||
<label>Ernährungsform</label>
|
<label>Ernährungsform</label>
|
||||||
|
|
||||||
<div class="option-grid option-grid--4">
|
<div class="option-grid option-grid--4 option-grid--icon-choices option-grid--tomato-choices">
|
||||||
<label class="option-card option">
|
<label class="option-card option option-card--with-icon">
|
||||||
<input type="checkbox" name="dietType" value="Fleisch" />
|
<input type="checkbox" name="dietType" value="Fleisch" />
|
||||||
|
<i class="fa-solid fa-drumstick-bite option-card__icon" aria-hidden="true"></i>
|
||||||
<span>Fleisch</span>
|
<span>Fleisch</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="option-card option">
|
<label class="option-card option option-card--with-icon">
|
||||||
<input type="checkbox" name="dietType" value="Fisch" />
|
<input type="checkbox" name="dietType" value="Fisch" />
|
||||||
|
<i class="fa-solid fa-fish option-card__icon" aria-hidden="true"></i>
|
||||||
<span>Fisch</span>
|
<span>Fisch</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="option-card option">
|
<label class="option-card option option-card--with-icon">
|
||||||
<input type="checkbox" name="dietType" value="Vegetarisch" />
|
<input type="checkbox" name="dietType" value="Vegetarisch" />
|
||||||
|
<i class="fa-solid fa-seedling option-card__icon" aria-hidden="true"></i>
|
||||||
<span>Vegetarisch</span>
|
<span>Vegetarisch</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label class="option-card option">
|
<label class="option-card option option-card--with-icon">
|
||||||
<input type="checkbox" name="dietType" value="Vegan" />
|
<input type="checkbox" name="dietType" value="Vegan" />
|
||||||
|
<i class="fa-solid fa-leaf option-card__icon" aria-hidden="true"></i>
|
||||||
<span>Vegan</span>
|
<span>Vegan</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -198,7 +209,7 @@
|
|||||||
<label>Allergene / Unverträglichkeiten</label>
|
<label>Allergene / Unverträglichkeiten</label>
|
||||||
<p class="field-hint">Optional – nur auswählen, wenn es für dein Event relevant ist.</p>
|
<p class="field-hint">Optional – nur auswählen, wenn es für dein Event relevant ist.</p>
|
||||||
|
|
||||||
<div class="option-grid option-grid--3">
|
<div class="option-grid option-grid--3 option-grid--tomato-choices">
|
||||||
<label class="option-card option">
|
<label class="option-card option">
|
||||||
<input type="checkbox" name="allergies" value="glutenfrei" />
|
<input type="checkbox" name="allergies" value="glutenfrei" />
|
||||||
<span>Glutenfrei</span>
|
<span>Glutenfrei</span>
|
||||||
@@ -243,7 +254,7 @@
|
|||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="eventTime">Uhrzeit</label>
|
<label for="eventTime">Uhrzeit</label>
|
||||||
<input type="time" id="eventTime" name="eventTime" value="00:00" required />
|
<input type="time" id="eventTime" name="eventTime" required />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -297,10 +308,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label>Fotos hinzufügen <span class="field-hint-inline">(optional)</span></label>
|
<label>Wie wird dein Event aussehen? <span class="field-hint-inline">(optional)</span></label>
|
||||||
<div class="gallery-upload">
|
<div class="gallery-upload">
|
||||||
<div class="gallery-preview" id="galleryPreview"></div>
|
<div class="gallery-preview" id="galleryPreview"></div>
|
||||||
<button type="button" class="button-primary" id="galleryAddBtn" aria-label="Foto hinzufügen">Foto hinzufügen</button>
|
<button type="button" class="gallery-add-button" id="galleryAddBtn" aria-label="Foto hinzufügen">
|
||||||
|
<i class="fa-solid fa-plus gallery-add-button__icon" aria-hidden="true"></i>
|
||||||
|
<span class="gallery-add-button__text">Foto<br>hinzufügen</span>
|
||||||
|
</button>
|
||||||
<input type="file" id="galleryFileInput" accept="image/*" multiple hidden />
|
<input type="file" id="galleryFileInput" accept="image/*" multiple hidden />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -375,6 +389,15 @@
|
|||||||
<dt>Event-Abend</dt>
|
<dt>Event-Abend</dt>
|
||||||
<dd data-review="eventDescription">–</dd>
|
<dd data-review="eventDescription">–</dd>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="review-item" data-edit-step="6" data-edit-field="galleryAddBtn" role="button" tabindex="0" aria-label="Fotos bearbeiten">
|
||||||
|
<dt>Fotos</dt>
|
||||||
|
<dd>
|
||||||
|
<div class="review-gallery" data-review-gallery>
|
||||||
|
<span>Keine Fotos hinzugefügt</span>
|
||||||
|
</div>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+121
-4
@@ -270,6 +270,29 @@ function updateReviewField(fieldName, value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeigt hochgeladene Fotos als kleine Vorschaubilder in der Review.
|
||||||
|
*/
|
||||||
|
function updateReviewGallery() {
|
||||||
|
const target = document.querySelector("[data-review-gallery]");
|
||||||
|
if (!target) return;
|
||||||
|
|
||||||
|
target.innerHTML = "";
|
||||||
|
|
||||||
|
if (galleryImages.length === 0) {
|
||||||
|
target.textContent = "Keine Fotos hinzugefügt";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
galleryImages.forEach((src, index) => {
|
||||||
|
const image = document.createElement("img");
|
||||||
|
image.className = "review-gallery__thumb";
|
||||||
|
image.src = src;
|
||||||
|
image.alt = `Foto ${index + 1}`;
|
||||||
|
target.appendChild(image);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baut den Text für Allergien / Hinweise zusammen.
|
* Baut den Text für Allergien / Hinweise zusammen.
|
||||||
* Dabei werden Checkboxen und zusätzliches Freitextfeld kombiniert.
|
* Dabei werden Checkboxen und zusätzliches Freitextfeld kombiniert.
|
||||||
@@ -297,6 +320,8 @@ function updateReview() {
|
|||||||
Object.entries(reviewValues).forEach(([key, value]) => {
|
Object.entries(reviewValues).forEach(([key, value]) => {
|
||||||
updateReviewField(key, value);
|
updateReviewField(key, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateReviewGallery();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -400,6 +425,42 @@ function mapEventTypeToCategory(value) {
|
|||||||
return categoryMap[value] || value.toUpperCase();
|
return categoryMap[value] || value.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert je Eventtyp ein passendes Platzhalterbild.
|
||||||
|
*/
|
||||||
|
function getPlaceholderImageByEventType(eventType) {
|
||||||
|
const normalizedType = String(eventType || "")
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
.normalize("NFD")
|
||||||
|
.replace(/[\u0300-\u036f]/g, "")
|
||||||
|
.replace(/[+&/_-]/g, " ")
|
||||||
|
.replace(/\s+/g, " ");
|
||||||
|
|
||||||
|
if (normalizedType.includes("brunch")) {
|
||||||
|
return "assets/platzhalter_brunch.jpeg";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (normalizedType.includes("lunch")) {
|
||||||
|
return "assets/platzhalter_lunch.jpeg";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
normalizedType.includes("kaffee")
|
||||||
|
|| normalizedType.includes("coffee")
|
||||||
|
|| normalizedType.includes("cafe")
|
||||||
|
|| normalizedType.includes("kuchen")
|
||||||
|
) {
|
||||||
|
return "assets/platzhalter_kaffee.jpeg";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (normalizedType.includes("dinner")) {
|
||||||
|
return "assets/platzhalter_dinner.jpeg";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "assets/platzhalter_dinner.jpeg";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baut aus den Formulardaten ein lokal speicherbares Event-Objekt.
|
* Baut aus den Formulardaten ein lokal speicherbares Event-Objekt.
|
||||||
*/
|
*/
|
||||||
@@ -411,6 +472,8 @@ function buildStoredEvent() {
|
|||||||
const eventDate = form.elements.eventDate.value;
|
const eventDate = form.elements.eventDate.value;
|
||||||
const eventTime = form.elements.eventTime.value;
|
const eventTime = form.elements.eventTime.value;
|
||||||
const eventCity = form.elements.eventCity.value.trim();
|
const eventCity = form.elements.eventCity.value.trim();
|
||||||
|
const fallbackGallery = [getPlaceholderImageByEventType(eventType)];
|
||||||
|
const resolvedGallery = galleryImages.length > 0 ? [...galleryImages] : fallbackGallery;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: Date.now(),
|
id: Date.now(),
|
||||||
@@ -419,6 +482,7 @@ function buildStoredEvent() {
|
|||||||
address: form.elements.eventAddress.value.trim(),
|
address: form.elements.eventAddress.value.trim(),
|
||||||
date: formatDateForStorage(eventDate),
|
date: formatDateForStorage(eventDate),
|
||||||
time: formatTimeForStorage(eventTime),
|
time: formatTimeForStorage(eventTime),
|
||||||
|
eventType,
|
||||||
category: mapEventTypeToCategory(eventType),
|
category: mapEventTypeToCategory(eventType),
|
||||||
diet: dietType,
|
diet: dietType,
|
||||||
spots: Number(form.elements.maxGuests.value),
|
spots: Number(form.elements.maxGuests.value),
|
||||||
@@ -435,7 +499,7 @@ function buildStoredEvent() {
|
|||||||
allergiesNote: form.elements.allergiesOther.value.trim(),
|
allergiesNote: form.elements.allergiesOther.value.trim(),
|
||||||
// Host wird separat geführt und nicht als angemeldeter Gast gezählt.
|
// Host wird separat geführt und nicht als angemeldeter Gast gezählt.
|
||||||
participants: [],
|
participants: [],
|
||||||
gallery: [...galleryImages],
|
gallery: resolvedGallery,
|
||||||
createdAt: new Date().toISOString(),
|
createdAt: new Date().toISOString(),
|
||||||
source: "local"
|
source: "local"
|
||||||
};
|
};
|
||||||
@@ -539,6 +603,52 @@ function validateDietType() {
|
|||||||
return { isValid: true };
|
return { isValid: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verhindert widersprüchliche Ernährungsformen:
|
||||||
|
* Fleisch/Fisch dürfen zusammen, schliessen aber vegetarisch/vegan aus.
|
||||||
|
*/
|
||||||
|
function registerDietConflictHandlers() {
|
||||||
|
const dietOptions = Array.from(form.querySelectorAll('input[name="dietType"]'));
|
||||||
|
const meatFishOptions = dietOptions.filter(input => ["Fleisch", "Fisch"].includes(input.value));
|
||||||
|
const plantOptions = dietOptions.filter(input => ["Vegetarisch", "Vegan"].includes(input.value));
|
||||||
|
|
||||||
|
const updateDietAvailability = changedInput => {
|
||||||
|
if (changedInput?.checked && changedInput.value === "Vegetarisch") {
|
||||||
|
dietOptions.forEach(input => {
|
||||||
|
if (input.value === "Vegan") input.checked = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changedInput?.checked && changedInput.value === "Vegan") {
|
||||||
|
dietOptions.forEach(input => {
|
||||||
|
if (input.value === "Vegetarisch") input.checked = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasMeatOrFish = meatFishOptions.some(input => input.checked);
|
||||||
|
const selectedPlantDiet = plantOptions.find(input => input.checked);
|
||||||
|
|
||||||
|
meatFishOptions.forEach(input => {
|
||||||
|
input.disabled = Boolean(selectedPlantDiet);
|
||||||
|
});
|
||||||
|
|
||||||
|
plantOptions.forEach(input => {
|
||||||
|
input.disabled = hasMeatOrFish || Boolean(selectedPlantDiet && input !== selectedPlantDiet);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
dietOptions.forEach(input => {
|
||||||
|
input.addEventListener("change", () => {
|
||||||
|
dietOptions.forEach(option => {
|
||||||
|
option.closest(".option-card")?.classList.remove("option-card--invalid");
|
||||||
|
});
|
||||||
|
updateDietAvailability(input);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
updateDietAvailability();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prüft alle Pflichtfelder ausser Radios und Checkboxen.
|
* Prüft alle Pflichtfelder ausser Radios und Checkboxen.
|
||||||
* Rückgabe:
|
* Rückgabe:
|
||||||
@@ -648,11 +758,17 @@ function registerCounterHandlers() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Erhöht oder verringert den Wert eines Zahlenfelds.
|
* Erhöht oder verringert den Wert eines Zahlenfelds.
|
||||||
* Der Wert darf dabei nie kleiner als das definierte Minimum werden.
|
* 0 bleibt als bewusster Startwert erlaubt; gültig ist erst eine Auswahl ab min.
|
||||||
*/
|
*/
|
||||||
function updateCounterValue(input, change) {
|
function updateCounterValue(input, change) {
|
||||||
const min = Number(input.min || 1);
|
const min = Number(input.min || 1);
|
||||||
const currentValue = Number(input.value || min);
|
const currentValue = Number(input.value || 0);
|
||||||
|
|
||||||
|
if (currentValue < min && change < 0) {
|
||||||
|
input.value = currentValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
input.value = Math.max(min, currentValue + change);
|
input.value = Math.max(min, currentValue + change);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +881,7 @@ function registerValidationFeedbackHandlers() {
|
|||||||
* Setzt den Fokus auf ein bestimmtes Feld oder die erste Option einer Radio-Gruppe.
|
* Setzt den Fokus auf ein bestimmtes Feld oder die erste Option einer Radio-Gruppe.
|
||||||
*/
|
*/
|
||||||
function focusFieldByName(fieldName) {
|
function focusFieldByName(fieldName) {
|
||||||
const field = form.elements[fieldName];
|
const field = form.elements[fieldName] || document.getElementById(fieldName);
|
||||||
|
|
||||||
if (!field) return;
|
if (!field) return;
|
||||||
|
|
||||||
@@ -862,6 +978,7 @@ function initEventCreationFlow() {
|
|||||||
|
|
||||||
// Counter aktivieren
|
// Counter aktivieren
|
||||||
registerCounterHandlers();
|
registerCounterHandlers();
|
||||||
|
registerDietConflictHandlers();
|
||||||
registerMenuBulletHandler();
|
registerMenuBulletHandler();
|
||||||
registerValidationFeedbackHandlers();
|
registerValidationFeedbackHandlers();
|
||||||
registerReviewEditHandlers();
|
registerReviewEditHandlers();
|
||||||
|
|||||||
+121
-15
@@ -105,6 +105,19 @@
|
|||||||
localStorage.setItem(REGISTRATION_STORAGE_KEY, JSON.stringify(registrationMap));
|
localStorage.setItem(REGISTRATION_STORAGE_KEY, JSON.stringify(registrationMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRegistrationIdsForUser(registrationMap, user) {
|
||||||
|
const userEmail = String(user?.email || '').trim().toLowerCase();
|
||||||
|
if (!userEmail) return [];
|
||||||
|
|
||||||
|
const matchingIds = Object.entries(registrationMap || {})
|
||||||
|
.filter(([email]) => String(email || '').trim().toLowerCase() === userEmail)
|
||||||
|
.flatMap(([, ids]) => (Array.isArray(ids) ? ids : []))
|
||||||
|
.map(id => Number(id))
|
||||||
|
.filter(id => Number.isFinite(id));
|
||||||
|
|
||||||
|
return Array.from(new Set(matchingIds));
|
||||||
|
}
|
||||||
|
|
||||||
function parseEventDateTime(event) {
|
function parseEventDateTime(event) {
|
||||||
if (!event?.date) return null;
|
if (!event?.date) return null;
|
||||||
const dateValue = String(event.date).trim();
|
const dateValue = String(event.date).trim();
|
||||||
@@ -116,11 +129,39 @@
|
|||||||
month = Number(isoDateMatch[2]);
|
month = Number(isoDateMatch[2]);
|
||||||
day = Number(isoDateMatch[3]);
|
day = Number(isoDateMatch[3]);
|
||||||
} else {
|
} else {
|
||||||
const monthMap = { JAN:1, FEB:2, 'MÄR':3, MRZ:3, APR:4, MAI:5, JUN:6, JUL:7, AUG:8, SEP:9, OKT:10, NOV:11, DEZ:12 };
|
const monthMap = {
|
||||||
const localizedMatch = dateValue.match(/^(\d{1,2})\.\s*([A-ZÄÖÜ]{3})\.\s*(\d{4})$/);
|
jan: 1,
|
||||||
|
januar: 1,
|
||||||
|
feb: 2,
|
||||||
|
februar: 2,
|
||||||
|
'mär': 3,
|
||||||
|
mrz: 3,
|
||||||
|
mar: 3,
|
||||||
|
maerz: 3,
|
||||||
|
märz: 3,
|
||||||
|
apr: 4,
|
||||||
|
april: 4,
|
||||||
|
mai: 5,
|
||||||
|
jun: 6,
|
||||||
|
juni: 6,
|
||||||
|
jul: 7,
|
||||||
|
juli: 7,
|
||||||
|
aug: 8,
|
||||||
|
august: 8,
|
||||||
|
sep: 9,
|
||||||
|
sept: 9,
|
||||||
|
september: 9,
|
||||||
|
okt: 10,
|
||||||
|
oktober: 10,
|
||||||
|
nov: 11,
|
||||||
|
november: 11,
|
||||||
|
dez: 12,
|
||||||
|
dezember: 12
|
||||||
|
};
|
||||||
|
const localizedMatch = dateValue.match(/^(\d{1,2})\.\s*([A-Za-zÄÖÜäöü]{3,9})\.?\s*(\d{4})$/);
|
||||||
if (!localizedMatch) return null;
|
if (!localizedMatch) return null;
|
||||||
day = Number(localizedMatch[1]);
|
day = Number(localizedMatch[1]);
|
||||||
month = monthMap[localizedMatch[2]];
|
month = monthMap[String(localizedMatch[2]).toLowerCase()];
|
||||||
year = Number(localizedMatch[3]);
|
year = Number(localizedMatch[3]);
|
||||||
if (!month) return null;
|
if (!month) return null;
|
||||||
}
|
}
|
||||||
@@ -150,8 +191,18 @@
|
|||||||
function isAddressVisibleWindow(event) {
|
function isAddressVisibleWindow(event) {
|
||||||
const eventDateTime = parseEventDateTime(event);
|
const eventDateTime = parseEventDateTime(event);
|
||||||
if (!eventDateTime || Number.isNaN(eventDateTime.getTime())) return false;
|
if (!eventDateTime || Number.isNaN(eventDateTime.getTime())) return false;
|
||||||
const msUntilStart = eventDateTime.getTime() - Date.now();
|
const now = Date.now();
|
||||||
return msUntilStart >= 0 && msUntilStart <= 24 * 60 * 60 * 1000;
|
const start = eventDateTime.getTime();
|
||||||
|
const revealStart = start - (24 * 60 * 60 * 1000);
|
||||||
|
const revealEnd = start + (1 * 60 * 60 * 1000);
|
||||||
|
return now >= revealStart && now <= revealEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEventPastAddressWindow(event) {
|
||||||
|
const eventDateTime = parseEventDateTime(event);
|
||||||
|
if (!eventDateTime || Number.isNaN(eventDateTime.getTime())) return false;
|
||||||
|
const revealEnd = eventDateTime.getTime() + (1 * 60 * 60 * 1000);
|
||||||
|
return Date.now() > revealEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEventOwnedByCurrentUser(event, user) {
|
function isEventOwnedByCurrentUser(event, user) {
|
||||||
@@ -198,6 +249,39 @@
|
|||||||
return labels[diet] || diet;
|
return labels[diet] || diet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPlaceholderImageByEventType(event) {
|
||||||
|
const rawType = String(event?.eventType || event?.category || '')
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
.normalize('NFD')
|
||||||
|
.replace(/[\u0300-\u036f]/g, '')
|
||||||
|
.replace(/[+&/_-]/g, ' ')
|
||||||
|
.replace(/\s+/g, ' ');
|
||||||
|
|
||||||
|
if (rawType.includes('brunch')) {
|
||||||
|
return 'assets/platzhalter_brunch.jpeg';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawType.includes('lunch')) {
|
||||||
|
return 'assets/platzhalter_lunch.jpeg';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
rawType.includes('kaffee')
|
||||||
|
|| rawType.includes('coffee')
|
||||||
|
|| rawType.includes('cafe')
|
||||||
|
|| rawType.includes('kuchen')
|
||||||
|
) {
|
||||||
|
return 'assets/platzhalter_kaffee.jpeg';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawType.includes('dinner')) {
|
||||||
|
return 'assets/platzhalter_dinner.jpeg';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'assets/platzhalter_dinner.jpeg';
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch data source and resolve the matching event record.
|
// Fetch data source and resolve the matching event record.
|
||||||
try {
|
try {
|
||||||
const response = await fetch('data/events.json');
|
const response = await fetch('data/events.json');
|
||||||
@@ -234,9 +318,15 @@
|
|||||||
.map(name => getParticipantNameForViewer(name, isOwnEvent))
|
.map(name => getParticipantNameForViewer(name, isOwnEvent))
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
const galleryImages = Array.isArray(event.gallery) ? event.gallery.filter(Boolean) : [];
|
const galleryImages = Array.isArray(event.gallery) ? event.gallery.filter(Boolean) : [];
|
||||||
const galleryMarkup = galleryImages.length > 0
|
const resolvedGalleryImages = galleryImages.length > 0
|
||||||
? `<div class="detail-gallery detail-gallery-large">
|
? galleryImages
|
||||||
${galleryImages.slice(0, 9).map((img, index) => `
|
: [getPlaceholderImageByEventType(event)];
|
||||||
|
const galleryLayoutClass = resolvedGalleryImages.length === 1
|
||||||
|
? 'detail-gallery detail-gallery-large detail-gallery-large--single'
|
||||||
|
: 'detail-gallery detail-gallery-large';
|
||||||
|
const galleryMarkup = resolvedGalleryImages.length > 0
|
||||||
|
? `<div class="${galleryLayoutClass}">
|
||||||
|
${resolvedGalleryImages.slice(0, 9).map((img, index) => `
|
||||||
<button class="detail-gallery-item" type="button" aria-label="Bild ${index + 1} gross anzeigen" data-fullsrc="${img}">
|
<button class="detail-gallery-item" type="button" aria-label="Bild ${index + 1} gross anzeigen" data-fullsrc="${img}">
|
||||||
<img src="${img}" alt="${event.title} Bild ${index + 1}" class="detail-gallery-image">
|
<img src="${img}" alt="${event.title} Bild ${index + 1}" class="detail-gallery-image">
|
||||||
</button>
|
</button>
|
||||||
@@ -251,28 +341,44 @@
|
|||||||
const isFull = freePlaces === 0;
|
const isFull = freePlaces === 0;
|
||||||
const isRegistrationClosed = isRegistrationClosedForEvent(event);
|
const isRegistrationClosed = isRegistrationClosedForEvent(event);
|
||||||
const deregInfo = getDeregistrationInfo(event);
|
const deregInfo = getDeregistrationInfo(event);
|
||||||
const userRegistrations = currentUser?.email && Array.isArray(registrationMap[currentUser.email])
|
const userRegistrations = getRegistrationIdsForUser(registrationMap, currentUser);
|
||||||
? registrationMap[currentUser.email].map(id => Number(id)) : [];
|
|
||||||
const isRegistered = userRegistrations.includes(Number(event.id));
|
const isRegistered = userRegistrations.includes(Number(event.id));
|
||||||
const isListedParticipant = isUserListedInEventParticipants(event, currentUser);
|
const isListedParticipant = isUserListedInEventParticipants(event, currentUser);
|
||||||
const hasAddressAccess = isRegistered || isListedParticipant;
|
const hasAddressAccess = isRegistered || isListedParticipant || isOwnEvent;
|
||||||
|
const isCanceled = event.status === 'canceled';
|
||||||
|
|
||||||
const actionButtonLabel = isOwnEvent ? 'Dein Event!'
|
const actionButtonLabel = isCanceled ? 'Abgesagt'
|
||||||
|
: isOwnEvent ? 'Dein Event!'
|
||||||
: !currentUser ? 'Einloggen'
|
: !currentUser ? 'Einloggen'
|
||||||
: isRegistered ? (deregInfo.isClosed ? 'Abmeldung geschlossen' : 'Abmelden')
|
: isRegistered ? (deregInfo.isClosed ? 'Abmeldung geschlossen' : 'Abmelden')
|
||||||
: isRegistrationClosed ? 'Anmeldung geschlossen'
|
: isRegistrationClosed ? 'Anmeldung geschlossen'
|
||||||
: 'Anmelden';
|
: 'Anmelden';
|
||||||
const actionButtonDisabled = isOwnEvent
|
const actionButtonDisabled = isCanceled
|
||||||
|
|| isOwnEvent
|
||||||
|| (!isRegistered && (isFull || isRegistrationClosed))
|
|| (!isRegistered && (isFull || isRegistrationClosed))
|
||||||
|| (isRegistered && deregInfo.isClosed);
|
|| (isRegistered && deregInfo.isClosed);
|
||||||
const actionButtonVariantClass = isOwnEvent ? ' button-primary-eigener-event'
|
const actionButtonVariantClass = isOwnEvent ? ' button-primary-eigener-event'
|
||||||
: isRegistered ? ' button-primary-abmelden '
|
: (isRegistered || isRegistrationClosed) ? ' button-primary-abmelden '
|
||||||
: ' button-primary ';
|
: ' button-primary ';
|
||||||
|
|
||||||
const shouldRevealAddress = Boolean(event.address) && isAddressVisibleWindow(event) && hasAddressAccess;
|
const shouldRevealAddress = Boolean(event.address) && isAddressVisibleWindow(event) && hasAddressAccess;
|
||||||
|
let addressMessage = 'Wenn du dich anmeldest, wird die Adresse für diesen Event wird 24 Stunden vorher genau hier sichtbar sein.';
|
||||||
|
|
||||||
|
if (isCanceled) {
|
||||||
|
addressMessage = 'Dieses Event wurde leider vom Gastgeber abgesagt.';
|
||||||
|
} else if (isOwnEvent) {
|
||||||
|
addressMessage = 'Deine Adresse für diesen Event wird 24 Stunden vorher genau hier für alle Teilnehmer sichtbar sein';
|
||||||
|
} else if (hasAddressAccess) {
|
||||||
|
addressMessage = 'Vielen Dank für die Anmeldung! Die Adresse für diesen Event wird 24 Stunden vorher genau hier sichtbar sein.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isCanceled && isEventPastAddressWindow(event)) {
|
||||||
|
addressMessage = 'Vielen Dank, dass du an diesem Event teilgenommen hast.';
|
||||||
|
}
|
||||||
|
|
||||||
const addressPanelMarkup = shouldRevealAddress
|
const addressPanelMarkup = shouldRevealAddress
|
||||||
? `<article class="detail-panel"><h2 class="detail-section-title">Adresse</h2><p>${event.address}</p></article>`
|
? `<article class="detail-panel"><h2 class="detail-section-title">Adresse</h2><p>${event.address}</p></article>`
|
||||||
: `<article class="detail-panel"><h2 class="detail-section-title">Adresse</h2><p>Vielen Dank für die Anmeldung! Die Adresse für diesen Event wird 24 Stunden vorher genau hier sichtbar sein.</p></article>`;
|
: `<article class="detail-panel"><h2 class="detail-section-title">Adresse</h2><p>${addressMessage}</p></article>`;
|
||||||
|
|
||||||
const detailChips = [
|
const detailChips = [
|
||||||
`<span class="event-tag">${eventCategory}</span>`,
|
`<span class="event-tag">${eventCategory}</span>`,
|
||||||
|
|||||||
+67
-33
@@ -286,28 +286,42 @@
|
|||||||
day = Number(isoDateMatch[3]);
|
day = Number(isoDateMatch[3]);
|
||||||
} else {
|
} else {
|
||||||
const monthMap = {
|
const monthMap = {
|
||||||
JAN: 1,
|
jan: 1,
|
||||||
FEB: 2,
|
januar: 1,
|
||||||
'MÄR': 3,
|
feb: 2,
|
||||||
MRZ: 3,
|
februar: 2,
|
||||||
APR: 4,
|
'mär': 3,
|
||||||
MAI: 5,
|
mrz: 3,
|
||||||
JUN: 6,
|
mar: 3,
|
||||||
JUL: 7,
|
maerz: 3,
|
||||||
AUG: 8,
|
märz: 3,
|
||||||
SEP: 9,
|
apr: 4,
|
||||||
OKT: 10,
|
april: 4,
|
||||||
NOV: 11,
|
mai: 5,
|
||||||
DEZ: 12
|
jun: 6,
|
||||||
|
juni: 6,
|
||||||
|
jul: 7,
|
||||||
|
juli: 7,
|
||||||
|
aug: 8,
|
||||||
|
august: 8,
|
||||||
|
sep: 9,
|
||||||
|
sept: 9,
|
||||||
|
september: 9,
|
||||||
|
okt: 10,
|
||||||
|
oktober: 10,
|
||||||
|
nov: 11,
|
||||||
|
november: 11,
|
||||||
|
dez: 12,
|
||||||
|
dezember: 12
|
||||||
};
|
};
|
||||||
const localizedMatch = dateValue.match(/^(\d{1,2})\.\s*([A-ZÄÖÜ]{3})\.\s*(\d{4})$/);
|
const localizedMatch = dateValue.match(/^(\d{1,2})\.\s*([A-Za-zÄÖÜäöü]{3,9})\.?\s*(\d{4})$/);
|
||||||
|
|
||||||
if (!localizedMatch) {
|
if (!localizedMatch) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
day = Number(localizedMatch[1]);
|
day = Number(localizedMatch[1]);
|
||||||
month = monthMap[localizedMatch[2]];
|
month = monthMap[String(localizedMatch[2]).toLowerCase()];
|
||||||
year = Number(localizedMatch[3]);
|
year = Number(localizedMatch[3]);
|
||||||
|
|
||||||
if (!month) {
|
if (!month) {
|
||||||
@@ -383,23 +397,24 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filtered = allEvents.filter(event => {
|
const filtered = allEvents.filter(event => {
|
||||||
|
if (event.status === 'canceled') return false;
|
||||||
|
|
||||||
const categoryMatch = activeCategory === 'ALLE' || event.category === activeCategory;
|
const categoryMatch = activeCategory === 'ALLE' || event.category === activeCategory;
|
||||||
|
|
||||||
// Diet filter: if no diets selected, show all. Otherwise, event MUST have at least one selected diet.
|
// Diet filter: if no diets selected, show all. Otherwise, event MUST have at least one selected diet.
|
||||||
const dietMatch = activeDiets.size === 0 ||
|
const dietMatch = activeDiets.size === 0 ||
|
||||||
(event.diet && event.diet.split(', ').some(d => activeDiets.has(d.trim())));
|
(event.diet && event.diet.split(', ').some(d => activeDiets.has(d.trim())));
|
||||||
|
|
||||||
// Allergie filter: if no allergies selected, show all. Otherwise, event MUST have at least one selected allergie.
|
// Allergie filter: if no allergies selected, show all. Otherwise, event MUST have at least one selected allergie.
|
||||||
const allergieMatch = activeAllergies.size === 0 ||
|
const allergieMatch = activeAllergies.size === 0 ||
|
||||||
(event.specifications && event.specifications.some(spec => activeAllergies.has(spec)));
|
(event.specifications && event.specifications.some(spec => activeAllergies.has(spec)));
|
||||||
|
|
||||||
const locationMatch = selectedLocation === 'ALLE_ORTE' || event.location === selectedLocation;
|
const locationMatch = selectedLocation === 'ALLE_ORTE' || event.location === selectedLocation;
|
||||||
const eventDateIso = parseEventDateToIso(event.date);
|
const eventDateIso = parseEventDateToIso(event.date);
|
||||||
const dateMatch = !selectedDate || eventDateIso === selectedDate;
|
const dateMatch = !selectedDate || eventDateIso === selectedDate;
|
||||||
|
|
||||||
return categoryMatch && dietMatch && allergieMatch && locationMatch && dateMatch;
|
return categoryMatch && dietMatch && allergieMatch && locationMatch && dateMatch;
|
||||||
});
|
});
|
||||||
|
|
||||||
renderEvents(filtered);
|
renderEvents(filtered);
|
||||||
|
|
||||||
sessionStorage.setItem('activeFilter', activeCategory);
|
sessionStorage.setItem('activeFilter', activeCategory);
|
||||||
@@ -459,6 +474,11 @@
|
|||||||
const isOwnEvent = isEventOwnedByCurrentUser(event, currentUser);
|
const isOwnEvent = isEventOwnedByCurrentUser(event, currentUser);
|
||||||
const isRegistered = userRegistrationSet.has(Number(event.id));
|
const isRegistered = userRegistrationSet.has(Number(event.id));
|
||||||
const isRegistrationClosed = isRegistrationClosedForEvent(event);
|
const isRegistrationClosed = isRegistrationClosedForEvent(event);
|
||||||
|
const isCanceled = event.status === 'canceled';
|
||||||
|
|
||||||
|
if (isCanceled) {
|
||||||
|
card.style.opacity = '0.6';
|
||||||
|
}
|
||||||
|
|
||||||
// Build optional specification chips only when data exists.
|
// Build optional specification chips only when data exists.
|
||||||
const specsChips = event.specifications && event.specifications.length > 0
|
const specsChips = event.specifications && event.specifications.length > 0
|
||||||
@@ -470,17 +490,31 @@
|
|||||||
? event.diet.split(', ').map(d => `<span class="event-tag">${d.trim()}</span>`).join('')
|
? event.diet.split(', ').map(d => `<span class="event-tag">${d.trim()}</span>`).join('')
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
const actionMarkup = isOwnEvent
|
let actionMarkup = '';
|
||||||
? '<button class="button-primary-eigener-event" type="button" data-registration-action="own" disabled>Dein Event!</button>'
|
if (isCanceled) {
|
||||||
: isRegistered
|
actionMarkup = '<button class="button-primary" type="button" disabled>Abgesagt</button>';
|
||||||
? '<button class="button-primary button-primary-abmelden" type="button" data-registration-action="unregister">Abmelden</button>'
|
} else if (isOwnEvent) {
|
||||||
: isRegistrationClosed
|
actionMarkup = '<button class="button-primary-eigener-event" type="button" data-registration-action="own" disabled>Dein Event!</button>';
|
||||||
? '<button class="button-primary" button-plaetze" type="button" data-registration-action="closed" disabled>Anmeldung geschlossen</button>'
|
} else if (isRegistered) {
|
||||||
: isFull
|
actionMarkup = isRegistrationClosed
|
||||||
? ''
|
? '<button class="button-primary-abmelden" type="button" disabled>Abmeldung geschlossen</button>'
|
||||||
: !currentUser
|
: '<button class="button-primary-abmelden" type="button" data-registration-action="unregister">Abmelden</button>';
|
||||||
? '<button class="button-primary btn-primary-register" type="button" data-registration-action="login">Anmelden</button>'
|
} else if (isRegistrationClosed) {
|
||||||
: '<button class="button-primary btn-primary-register" type="button" data-registration-action="register">Anmelden</button>';
|
actionMarkup = '<button class="button-primary-abmelden" type="button" data-registration-action="closed" disabled>Anmeldung geschlossen</button>';
|
||||||
|
} else if (!isFull) {
|
||||||
|
if (!currentUser) {
|
||||||
|
actionMarkup = '<button class="button-primary btn-primary-register" type="button" data-registration-action="login">Anmelden</button>';
|
||||||
|
} else {
|
||||||
|
actionMarkup = '<button class="button-primary btn-primary-register" type="button" data-registration-action="register">Anmelden</button>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let sideInfoMarkup = '';
|
||||||
|
if (isCanceled) {
|
||||||
|
sideInfoMarkup = '<span class="button-plaetze">Event abgesagt</span>';
|
||||||
|
} else if (!isRegistrationClosed) {
|
||||||
|
sideInfoMarkup = `<span class="button-plaetze${isFull ? ' event-spots-full' : ''}">${isFull ? 'Ausgebucht' : `${freePlaces} Plätze frei`}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
card.innerHTML = `
|
card.innerHTML = `
|
||||||
<div class="event-main">
|
<div class="event-main">
|
||||||
@@ -501,7 +535,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="event-side${isFull ? ' event-side-full' : ''}">
|
<div class="event-side${isFull ? ' event-side-full' : ''}">
|
||||||
${isRegistrationClosed ? '' : `<span class="button-plaetze${isFull ? ' event-spots-full' : ''}">${isFull ? 'Ausgebucht' : `${freePlaces} Plätze frei`}</span>`}
|
${sideInfoMarkup}
|
||||||
${actionMarkup}
|
${actionMarkup}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
+192
-40
@@ -213,6 +213,11 @@
|
|||||||
const isActive = panel.getAttribute('data-profile-panel') === tabName;
|
const isActive = panel.getAttribute('data-profile-panel') === tabName;
|
||||||
panel.classList.toggle('hidden', !isActive);
|
panel.classList.toggle('hidden', !isActive);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (tabName === 'teilnehmen') {
|
||||||
|
const registeredEvents = getMyRegisteredEvents(allEvents, currentUser);
|
||||||
|
markRegistrationsAsRead(registeredEvents);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reagiert auf Aktionen in der Liste "Meine Anmeldungen" per Event Delegation.
|
// Reagiert auf Aktionen in der Liste "Meine Anmeldungen" per Event Delegation.
|
||||||
@@ -452,13 +457,27 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ermittelt angemeldete Events über die Registration-Map.
|
// Ermittelt angemeldete Events über die Registration-Map und participants-Liste.
|
||||||
function getMyRegisteredEvents(events, user) {
|
function getMyRegisteredEvents(events, user) {
|
||||||
const registrationMap = getRegistrationMap();
|
const registrationMap = getRegistrationMap();
|
||||||
const registeredIds = Array.isArray(registrationMap[user.email]) ? registrationMap[user.email] : [];
|
const registeredIds = Array.isArray(registrationMap[user.email]) ? registrationMap[user.email] : [];
|
||||||
const idSet = new Set(registeredIds.map(id => Number(id)));
|
const idSet = new Set(registeredIds.map(id => Number(id)));
|
||||||
|
|
||||||
return events.filter(event => idSet.has(Number(event.id)));
|
const userFirstName = String(user.vorname || '').trim().toLowerCase();
|
||||||
|
const userFullName = `${String(user.vorname || '').trim()} ${String(user.nachname || '').trim()}`.trim().toLowerCase();
|
||||||
|
|
||||||
|
return events.filter(event => {
|
||||||
|
if (idSet.has(Number(event.id))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (Array.isArray(event.participants)) {
|
||||||
|
const participantSet = new Set(event.participants.map(name => String(name || '').trim().toLowerCase()).filter(Boolean));
|
||||||
|
if ((userFirstName && participantSet.has(userFirstName)) || (userFullName && participantSet.has(userFullName))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rendert angemeldete Events inkl. Zähler.
|
// Rendert angemeldete Events inkl. Zähler.
|
||||||
@@ -477,6 +496,35 @@
|
|||||||
}, 'hosting');
|
}, 'hosting');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSeenAddresses() {
|
||||||
|
try {
|
||||||
|
const raw = localStorage.getItem('socialCookingSeenAddresses');
|
||||||
|
return raw ? JSON.parse(raw) : [];
|
||||||
|
} catch (err) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function markRegistrationsAsRead(events) {
|
||||||
|
const seen = getSeenAddresses();
|
||||||
|
let changed = false;
|
||||||
|
events.forEach(event => {
|
||||||
|
if (isAddressVisibleWindow(event) && !seen.includes(Number(event.id))) {
|
||||||
|
seen.push(Number(event.id));
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (changed) {
|
||||||
|
localStorage.setItem('socialCookingSeenAddresses', JSON.stringify(seen));
|
||||||
|
// Remove dots from UI
|
||||||
|
const tabDot = document.querySelector('[data-category-item="teilnehmen"] .notification-dot');
|
||||||
|
if (tabDot) tabDot.remove();
|
||||||
|
|
||||||
|
const navDot = document.querySelector('.profile-pill .notification-dot');
|
||||||
|
if (navDot) navDot.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Rendert angemeldete Events inkl. Zähler.
|
// Rendert angemeldete Events inkl. Zähler.
|
||||||
function renderMyRegistrations(events, user) {
|
function renderMyRegistrations(events, user) {
|
||||||
const registeredEvents = getMyRegisteredEvents(events, user);
|
const registeredEvents = getMyRegisteredEvents(events, user);
|
||||||
@@ -486,16 +534,51 @@
|
|||||||
myRegistrationsCount.textContent = String(count);
|
myRegistrationsCount.textContent = String(count);
|
||||||
if (myRegistrationsBtnCount) myRegistrationsBtnCount.textContent = String(count);
|
if (myRegistrationsBtnCount) myRegistrationsBtnCount.textContent = String(count);
|
||||||
|
|
||||||
|
const seenAddresses = getSeenAddresses();
|
||||||
|
const unreadEvents = registeredEvents.filter(e => isAddressVisibleWindow(e) && !seenAddresses.includes(Number(e.id)));
|
||||||
|
const hasNotifications = unreadEvents.length > 0;
|
||||||
|
|
||||||
|
const tabButton = document.querySelector('[data-category-item="teilnehmen"]');
|
||||||
|
if (tabButton) {
|
||||||
|
let dot = tabButton.querySelector('.notification-dot');
|
||||||
|
if (hasNotifications) {
|
||||||
|
if (!dot) {
|
||||||
|
dot = document.createElement('span');
|
||||||
|
dot.className = 'notification-dot';
|
||||||
|
tabButton.appendChild(dot);
|
||||||
|
}
|
||||||
|
} else if (dot) {
|
||||||
|
dot.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderEventCards(myRegistrationsList, registeredEvents, {
|
renderEventCards(myRegistrationsList, registeredEvents, {
|
||||||
title: 'Noch keine Anmeldungen',
|
title: 'Noch keine Anmeldungen',
|
||||||
text: 'Entdecke spannende Dinner in deiner Naehe und melde dich direkt an.',
|
text: 'Entdecke spannende Dinner in deiner Naehe und melde dich direkt an.',
|
||||||
buttonLabel: 'Events entdecken',
|
buttonLabel: 'Events entdecken',
|
||||||
href: 'event_overview.html'
|
href: 'event_overview.html'
|
||||||
}, 'registrations');
|
}, 'registrations', seenAddresses);
|
||||||
|
|
||||||
|
// Falls wir bereits auf dem Tab sind, direkt als gelesen markieren
|
||||||
|
const activeTab = document.querySelector('[data-category-item="teilnehmen"].is-active');
|
||||||
|
if (activeTab && hasNotifications) {
|
||||||
|
// Kurze Verzögerung, damit UI sich erst aufbaut
|
||||||
|
setTimeout(() => markRegistrationsAsRead(registeredEvents), 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gibt true zurück, wenn die Abmeldung gesperrt ist (innerhalb von 24h oder in der Vergangenheit).
|
||||||
|
function isDeregistrationClosed(event) {
|
||||||
|
const eventDateTime = parseEventDateTime(event);
|
||||||
|
if (!eventDateTime || Number.isNaN(eventDateTime.getTime())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const msUntilStart = eventDateTime.getTime() - Date.now();
|
||||||
|
return msUntilStart <= 24 * 60 * 60 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Baut die Eventkarten für beide Listen in einheitlichem Markup.
|
// Baut die Eventkarten für beide Listen in einheitlichem Markup.
|
||||||
function renderEventCards(container, events, emptyStateConfig, mode) {
|
function renderEventCards(container, events, emptyStateConfig, mode, seenAddresses = []) {
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
|
|
||||||
if (events.length === 0) {
|
if (events.length === 0) {
|
||||||
@@ -515,33 +598,81 @@
|
|||||||
const card = document.createElement('article');
|
const card = document.createElement('article');
|
||||||
card.className = 'profile-event-card profile-event-card-clickable';
|
card.className = 'profile-event-card profile-event-card-clickable';
|
||||||
card.setAttribute('data-event-id', String(event.id));
|
card.setAttribute('data-event-id', String(event.id));
|
||||||
const addressMarkup = mode === 'registrations' && event.address
|
|
||||||
? (isAddressVisibleWindow(event)
|
const isCanceled = event.status === 'canceled';
|
||||||
? `
|
if (isCanceled) {
|
||||||
|
card.style.opacity = '0.6';
|
||||||
|
}
|
||||||
|
|
||||||
|
let addressMessage = 'Vielen Dank für die Anmeldung! Die Adresse für diesen Event wird 24 Stunden vorher genau hier sichtbar sein.';
|
||||||
|
if (isEventPastAddressWindow(event)) {
|
||||||
|
addressMessage = 'Vielen Dank, dass du an diesem Event teilgenommen hast.';
|
||||||
|
}
|
||||||
|
|
||||||
|
let addressMarkup = '';
|
||||||
|
if (mode === 'registrations' && event.address) {
|
||||||
|
if (isCanceled) {
|
||||||
|
addressMarkup = `
|
||||||
|
<div class="profile-event-address-block" aria-label="Hinweis zur Adresse">
|
||||||
|
<p class="profile-event-address-label">Adresse</p>
|
||||||
|
<p class="profile-event-address">Dieses Event wurde leider vom Gastgeber abgesagt.</p>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
} else if (isAddressVisibleWindow(event)) {
|
||||||
|
addressMarkup = `
|
||||||
<div class="profile-event-address-block" aria-label="Event Adresse">
|
<div class="profile-event-address-block" aria-label="Event Adresse">
|
||||||
<p class="profile-event-address-label">Adresse</p>
|
<p class="profile-event-address-label">Adresse</p>
|
||||||
<p class="profile-event-address">${event.address}</p>
|
<p class="profile-event-address">${event.address}</p>
|
||||||
</div>
|
</div>
|
||||||
`
|
`;
|
||||||
: `
|
} else {
|
||||||
|
addressMarkup = `
|
||||||
<div class="profile-event-address-block" aria-label="Hinweis zur Adresse">
|
<div class="profile-event-address-block" aria-label="Hinweis zur Adresse">
|
||||||
<p class="profile-event-address-label">Adresse</p>
|
<p class="profile-event-address-label">Adresse</p>
|
||||||
<p class="profile-event-address">Vielen Dank für die Anmeldung! Die Adresse für diesen Event wird 24 Stunden vorher genau hier sichtbar sein.</p>
|
<p class="profile-event-address">${addressMessage}</p>
|
||||||
</div>
|
</div>
|
||||||
`)
|
`;
|
||||||
: '';
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const actionMarkup = mode === 'registrations'
|
const isDeregClosed = isDeregistrationClosed(event);
|
||||||
? `
|
|
||||||
|
let actionMarkup = '';
|
||||||
|
if (mode === 'registrations') {
|
||||||
|
if (isCanceled) {
|
||||||
|
actionMarkup = `
|
||||||
|
<div class="event-side">
|
||||||
|
<button class="button-primary-abmelden" type="button" disabled>Abgesagt</button>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
} else if (isDeregClosed) {
|
||||||
|
actionMarkup = `
|
||||||
|
<div class="event-side">
|
||||||
|
<button class="button-primary-abmelden" type="button" disabled>Abmeldung geschlossen</button>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
} else {
|
||||||
|
actionMarkup = `
|
||||||
<div class="event-side">
|
<div class="event-side">
|
||||||
<button class="button-primary-abmelden" type="button" data-unregister-id="${event.id}">Abmelden</button>
|
<button class="button-primary-abmelden" type="button" data-unregister-id="${event.id}">Abmelden</button>
|
||||||
</div>
|
</div>
|
||||||
`
|
`;
|
||||||
: `
|
}
|
||||||
|
} else {
|
||||||
|
if (isCanceled) {
|
||||||
|
actionMarkup = `
|
||||||
|
<div class="event-side">
|
||||||
|
<button class="button-primary-eigener-event" type="button" disabled>Abgesagt</button>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
} else {
|
||||||
|
actionMarkup = `
|
||||||
<div class="event-side">
|
<div class="event-side">
|
||||||
<button class="button-primary-eigener-event" type="button" data-cancel-event-id="${event.id}">Event absagen</button>
|
<button class="button-primary-eigener-event" type="button" data-cancel-event-id="${event.id}">Event absagen</button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
card.innerHTML = `
|
card.innerHTML = `
|
||||||
<div>
|
<div>
|
||||||
@@ -556,17 +687,24 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gibt true zurück, wenn ein Event innerhalb der nächsten 24 Stunden startet.
|
// Gibt true zurück, wenn die Adresse sichtbar sein soll (24h vor bis 1h nach Start).
|
||||||
function isAddressVisibleWindow(event) {
|
function isAddressVisibleWindow(event) {
|
||||||
|
if (event.status === 'canceled') return false;
|
||||||
const eventDateTime = parseEventDateTime(event);
|
const eventDateTime = parseEventDateTime(event);
|
||||||
if (!eventDateTime || Number.isNaN(eventDateTime.getTime())) {
|
if (!eventDateTime || Number.isNaN(eventDateTime.getTime())) return false;
|
||||||
return false;
|
const now = Date.now();
|
||||||
}
|
const start = eventDateTime.getTime();
|
||||||
|
const revealStart = start - (24 * 60 * 60 * 1000);
|
||||||
|
const revealEnd = start + (1 * 60 * 60 * 1000);
|
||||||
|
return now >= revealStart && now <= revealEnd;
|
||||||
|
}
|
||||||
|
|
||||||
const msUntilStart = eventDateTime.getTime() - Date.now();
|
// Gibt true zurück, wenn ein Event bereits vorbei ist (1h nach Start).
|
||||||
const twentyfourHoursInMs = 24 * 60 * 60 * 1000;
|
function isEventPastAddressWindow(event) {
|
||||||
|
const eventDateTime = parseEventDateTime(event);
|
||||||
return msUntilStart >= 0 && msUntilStart <= twentyfourHoursInMs;
|
if (!eventDateTime || Number.isNaN(eventDateTime.getTime())) return false;
|
||||||
|
const revealEnd = eventDateTime.getTime() + (1 * 60 * 60 * 1000);
|
||||||
|
return Date.now() > revealEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse für ISO- und lokalisierte Datumsformate aus den Eventdaten.
|
// Parse für ISO- und lokalisierte Datumsformate aus den Eventdaten.
|
||||||
@@ -587,28 +725,42 @@
|
|||||||
day = Number(isoDateMatch[3]);
|
day = Number(isoDateMatch[3]);
|
||||||
} else {
|
} else {
|
||||||
const monthMap = {
|
const monthMap = {
|
||||||
JAN: 1,
|
jan: 1,
|
||||||
FEB: 2,
|
januar: 1,
|
||||||
'MÄR': 3,
|
feb: 2,
|
||||||
MRZ: 3,
|
februar: 2,
|
||||||
APR: 4,
|
'mär': 3,
|
||||||
MAI: 5,
|
mrz: 3,
|
||||||
JUN: 6,
|
mar: 3,
|
||||||
JUL: 7,
|
maerz: 3,
|
||||||
AUG: 8,
|
märz: 3,
|
||||||
SEP: 9,
|
apr: 4,
|
||||||
OKT: 10,
|
april: 4,
|
||||||
NOV: 11,
|
mai: 5,
|
||||||
DEZ: 12
|
jun: 6,
|
||||||
|
juni: 6,
|
||||||
|
jul: 7,
|
||||||
|
juli: 7,
|
||||||
|
aug: 8,
|
||||||
|
august: 8,
|
||||||
|
sep: 9,
|
||||||
|
sept: 9,
|
||||||
|
september: 9,
|
||||||
|
okt: 10,
|
||||||
|
oktober: 10,
|
||||||
|
nov: 11,
|
||||||
|
november: 11,
|
||||||
|
dez: 12,
|
||||||
|
dezember: 12
|
||||||
};
|
};
|
||||||
const localizedMatch = dateValue.match(/^(\d{1,2})\.\s*([A-ZÄÖÜ]{3})\.\s*(\d{4})$/);
|
const localizedMatch = dateValue.match(/^(\d{1,2})\.\s*([A-Za-zÄÖÜäöü]{3,9})\.?\s*(\d{4})$/);
|
||||||
|
|
||||||
if (!localizedMatch) {
|
if (!localizedMatch) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
day = Number(localizedMatch[1]);
|
day = Number(localizedMatch[1]);
|
||||||
month = monthMap[localizedMatch[2]];
|
month = monthMap[String(localizedMatch[2]).toLowerCase()];
|
||||||
year = Number(localizedMatch[3]);
|
year = Number(localizedMatch[3]);
|
||||||
|
|
||||||
if (!month) {
|
if (!month) {
|
||||||
|
|||||||
+110
-7
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const CURRENT_USER_KEY = 'socialCookingCurrentUser';
|
const CURRENT_USER_KEY = 'socialCookingCurrentUser';
|
||||||
|
const REGISTRATION_STORAGE_KEY = 'socialCookingRegistrations';
|
||||||
|
const EVENTS_STORAGE_KEY = 'socialCookingEvents';
|
||||||
const navcontainers = document.querySelectorAll('.nav-tab-links');
|
const navcontainers = document.querySelectorAll('.nav-tab-links');
|
||||||
const currentPage = (window.location.pathname.split('/').pop() || 'index.html').toLowerCase();
|
const currentPage = (window.location.pathname.split('/').pop() || 'index.html').toLowerCase();
|
||||||
|
|
||||||
@@ -31,6 +33,94 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
window.location.href = 'index.html';
|
window.location.href = 'index.html';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Hilfsfunktionen für Datumsberechnungen
|
||||||
|
function parseEventDateTime(event) {
|
||||||
|
if (!event?.date) return null;
|
||||||
|
const dateValue = String(event.date).trim();
|
||||||
|
const isoDateMatch = dateValue.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
||||||
|
let year, month, day;
|
||||||
|
|
||||||
|
if (isoDateMatch) {
|
||||||
|
year = Number(isoDateMatch[1]);
|
||||||
|
month = Number(isoDateMatch[2]);
|
||||||
|
day = Number(isoDateMatch[3]);
|
||||||
|
} else {
|
||||||
|
const monthMap = {
|
||||||
|
jan: 1, januar: 1,
|
||||||
|
feb: 2, februar: 2,
|
||||||
|
'mär': 3, mrz: 3, mar: 3, maerz: 3, märz: 3,
|
||||||
|
apr: 4, april: 4,
|
||||||
|
mai: 5,
|
||||||
|
jun: 6, juni: 6,
|
||||||
|
jul: 7, juli: 7,
|
||||||
|
aug: 8, august: 8,
|
||||||
|
sep: 9, sept: 9, september: 9,
|
||||||
|
okt: 10, oktober: 10,
|
||||||
|
nov: 11, november: 11,
|
||||||
|
dez: 12, dezember: 12
|
||||||
|
};
|
||||||
|
const localizedMatch = dateValue.match(/^(\d{1,2})\.\s*([A-Za-zÄÖÜäöü]{3,9})\.?\s*(\d{4})$/);
|
||||||
|
if (!localizedMatch) return null;
|
||||||
|
day = Number(localizedMatch[1]);
|
||||||
|
month = monthMap[String(localizedMatch[2]).toLowerCase()];
|
||||||
|
year = Number(localizedMatch[3]);
|
||||||
|
if (!month) return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const timeMatch = String(event.time || '').match(/(\d{1,2}):(\d{2})/);
|
||||||
|
const hours = timeMatch ? Number(timeMatch[1]) : 0;
|
||||||
|
const minutes = timeMatch ? Number(timeMatch[2]) : 0;
|
||||||
|
return new Date(year, month - 1, day, hours, minutes, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isAddressVisibleWindow(event) {
|
||||||
|
if (event.status === 'canceled') return false;
|
||||||
|
const eventDateTime = parseEventDateTime(event);
|
||||||
|
if (!eventDateTime || Number.isNaN(eventDateTime.getTime())) return false;
|
||||||
|
const now = Date.now();
|
||||||
|
const start = eventDateTime.getTime();
|
||||||
|
const revealStart = start - (24 * 60 * 60 * 1000);
|
||||||
|
const revealEnd = start + (1 * 60 * 60 * 1000);
|
||||||
|
return now >= revealStart && now <= revealEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function hasUnreadNotifications(user) {
|
||||||
|
if (!user || !user.email) return false;
|
||||||
|
|
||||||
|
let events = [];
|
||||||
|
try {
|
||||||
|
const rawStored = localStorage.getItem(EVENTS_STORAGE_KEY);
|
||||||
|
const storedEvents = rawStored ? JSON.parse(rawStored) : [];
|
||||||
|
|
||||||
|
const response = await fetch('data/events.json');
|
||||||
|
const apiEvents = await response.json();
|
||||||
|
events = [...storedEvents, ...apiEvents];
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Fehler beim Laden der Events für Benachrichtigungen', err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let map = {};
|
||||||
|
try {
|
||||||
|
const rawReg = localStorage.getItem(REGISTRATION_STORAGE_KEY);
|
||||||
|
map = rawReg ? JSON.parse(rawReg) : {};
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
let seenAddresses = [];
|
||||||
|
try {
|
||||||
|
const rawSeen = localStorage.getItem('socialCookingSeenAddresses');
|
||||||
|
seenAddresses = rawSeen ? JSON.parse(rawSeen) : [];
|
||||||
|
} catch (err) {}
|
||||||
|
|
||||||
|
const registeredIds = Array.isArray(map[user.email]) ? map[user.email] : [];
|
||||||
|
const idSet = new Set(registeredIds.map(id => Number(id)));
|
||||||
|
|
||||||
|
const myRegisteredEvents = events.filter(e => idSet.has(Number(e.id)));
|
||||||
|
|
||||||
|
// Unread = address visible AND NOT marked as seen
|
||||||
|
return myRegisteredEvents.some(e => isAddressVisibleWindow(e) && !seenAddresses.includes(Number(e.id)));
|
||||||
|
}
|
||||||
|
|
||||||
// Baut die Navigation für ausgeloggte Besucher.
|
// Baut die Navigation für ausgeloggte Besucher.
|
||||||
function buildLoggedOutNavigation() {
|
function buildLoggedOutNavigation() {
|
||||||
const loginIsActive = currentPage === 'login.html';
|
const loginIsActive = currentPage === 'login.html';
|
||||||
@@ -71,10 +161,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Baut die Navigation für eingeloggte Benutzer.
|
// Baut die Navigation für eingeloggte Benutzer.
|
||||||
function buildLoggedInNavigation(user) {
|
function buildLoggedInNavigation(user, hasNotifications) {
|
||||||
const initial = (user.vorname || 'U').charAt(0).toUpperCase();
|
const initial = (user.vorname || 'U').charAt(0).toUpperCase();
|
||||||
const isEventOverview = currentPage === 'event_overview.html';
|
const isEventOverview = currentPage === 'event_overview.html';
|
||||||
const isEventCreate = currentPage === 'event_create.html';
|
const isEventCreate = currentPage === 'event_create.html';
|
||||||
|
const notificationMarkup = hasNotifications ? '<span class="notification-dot"></span>' : '';
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<a
|
<a
|
||||||
@@ -105,15 +196,27 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
title="${user.vorname || 'Profil'}"
|
title="${user.vorname || 'Profil'}"
|
||||||
>
|
>
|
||||||
${initial}
|
${initial}
|
||||||
|
${notificationMarkup}
|
||||||
</a>
|
</a>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentUser = getCurrentUser();
|
async function initNavigation() {
|
||||||
const nextMarkup = currentUser ? buildLoggedInNavigation(currentUser) : buildLoggedOutNavigation();
|
const currentUser = getCurrentUser();
|
||||||
|
let nextMarkup;
|
||||||
|
|
||||||
// Wendet das passende Markup auf alle vorhandenen Kopf-Navigationen an.
|
if (currentUser) {
|
||||||
navcontainers.forEach(container => {
|
const hasNotifications = await hasUnreadNotifications(currentUser);
|
||||||
container.innerHTML = nextMarkup;
|
nextMarkup = buildLoggedInNavigation(currentUser, hasNotifications);
|
||||||
});
|
} else {
|
||||||
|
nextMarkup = buildLoggedOutNavigation();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wendet das passende Markup auf alle vorhandenen Kopf-Navigationen an.
|
||||||
|
navcontainers.forEach(container => {
|
||||||
|
container.innerHTML = nextMarkup;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
initNavigation();
|
||||||
});
|
});
|
||||||
@@ -70,6 +70,14 @@
|
|||||||
<div class="panel-head">
|
<div class="panel-head">
|
||||||
<span id="my-registrations-count" class="panel-count">0</span>
|
<span id="my-registrations-count" class="panel-count">0</span>
|
||||||
</div>
|
</div>
|
||||||
|
<p style="font-size: 0.9rem; color: var(--olive); margin-bottom: 16px; display: flex; align-items: flex-start; gap: 8px;">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--olive)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink: 0; margin-top: 1px;">
|
||||||
|
<circle cx="12" cy="12" r="10"/>
|
||||||
|
<line x1="12" y1="8" x2="12" y2="8"/>
|
||||||
|
<line x1="12" y1="12" x2="12" y2="16"/>
|
||||||
|
</svg>
|
||||||
|
Eine Abmeldung ist bis 24 Stunden vor Eventbeginn möglich. Bitte respektiere den Host und melde dich rechtzeitig ab, wenn du nicht kommen kannst.
|
||||||
|
</p>
|
||||||
<div id="my-registrations-list" class="profile-card-list"></div>
|
<div id="my-registrations-list" class="profile-card-list"></div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user