kleine ui fixes
This commit is contained in:
parent
b5118a699f
commit
7ce389d179
@ -30,17 +30,17 @@ body {
|
||||
}
|
||||
|
||||
/* === Kurs-Grid === */
|
||||
.course-grid {
|
||||
.courses-view {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: 30px;
|
||||
margin: 0 auto;
|
||||
justify-content: center;
|
||||
padding: 30px 0 30px 0;
|
||||
}
|
||||
|
||||
/* === Kurs-Karte === */
|
||||
.course-card {
|
||||
flex: 0 0 calc(33.333% - 20px); /* Drei nebeneinander */
|
||||
background: var(--brand-white);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
@ -48,7 +48,8 @@ body {
|
||||
min-height: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 30px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
/* Optional: Kurs-Bildbereich */
|
||||
@ -88,18 +89,10 @@ body {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* === Responsive Anpassung === */
|
||||
@media screen and (max-width: 1024px) {
|
||||
.course-card {
|
||||
flex: 0 0 calc(50% - 20px);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
.course-card {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
|
||||
.welcome-heading {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
main a {
|
||||
color: var(--brand-white)
|
||||
color: var(--brand-white);
|
||||
}
|
||||
|
||||
.form-flex {
|
||||
@ -12,6 +12,7 @@ main a{
|
||||
|
||||
form label {
|
||||
width: fit-content;
|
||||
color: var(--brand-white);
|
||||
}
|
||||
|
||||
form input {
|
||||
@ -20,7 +21,8 @@ form input {
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
form input, textarea {
|
||||
form input,
|
||||
textarea {
|
||||
border: var(--border-primary);
|
||||
padding: 8px;
|
||||
font-size: 1rem;
|
||||
@ -49,6 +51,27 @@ form input, textarea {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.form-grid-3 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
.form-grid-3 {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
.form-grid-3 {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.form-grid label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -60,11 +83,6 @@ form input, textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-grid input:last-child, div:nth-last-child(4) {
|
||||
grid-column: 1 / -1;
|
||||
column-span: 2;
|
||||
}
|
||||
|
||||
form .error {
|
||||
color: var(--error);
|
||||
border-color: var(--error);
|
||||
@ -78,20 +96,20 @@ form .error {
|
||||
}
|
||||
|
||||
/* fix radio buttons registration */
|
||||
.input:nth-child(5){
|
||||
.radio {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
max-width: 290px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.input:nth-child(5) label{
|
||||
.radio {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.input:nth-child(5) label input{
|
||||
.radio input {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
@ -7,7 +7,9 @@
|
||||
@import url(Element/button.css);
|
||||
@import url(Element/card.css);
|
||||
|
||||
*, *:before, *:after {
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
@ -16,7 +18,7 @@
|
||||
|
||||
body {
|
||||
background-color: var(--brand-background);
|
||||
color: #666;
|
||||
color: var(--brand-white);
|
||||
font-size: 15px;
|
||||
margin: 0;
|
||||
}
|
||||
@ -48,7 +50,6 @@ main {
|
||||
.msg a {
|
||||
text-decoration: none;
|
||||
color: #09add0;
|
||||
|
||||
}
|
||||
|
||||
.msg a:hover {
|
||||
@ -103,7 +104,7 @@ main {
|
||||
}
|
||||
|
||||
.hover:hover {
|
||||
opacity: .75;
|
||||
opacity: 0.75;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,18 @@ class AdminController
|
||||
private $db;
|
||||
private $validData = array();
|
||||
private $errors = array();
|
||||
private $labels = array("name" => "Name*", "preis" => "€ Preis*", "dauer" => "Dauer* (Stunden)", "rabatt" => "Rabatt", "kategorie" => "Kategorie", "stadt" => "Stadt*", "strasse" => "Straße und Nummer*", "plz" => "PLZ*" ,"beschreibung" => "Beschreibung");
|
||||
private $labels = array(
|
||||
"name" => "Name*",
|
||||
"preis" => "€ Preis*",
|
||||
"dauer" => "Dauer* (Stunden)",
|
||||
"rabatt" => "Rabatt",
|
||||
"kategorie" => "Kategorie",
|
||||
"|" => "",
|
||||
"stadt" => "Stadt*",
|
||||
"strasse" => "Straße und Nummer*",
|
||||
"plz" => "PLZ*",
|
||||
"|" => "",
|
||||
"beschreibung" => "Beschreibung");
|
||||
|
||||
|
||||
public function __construct($view)
|
||||
|
@ -59,4 +59,23 @@ class AdminModel extends Database
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getMyCourses() {
|
||||
$sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, o.stadt, o.strasse, o.plz, b.note, b.kommentar
|
||||
FROM kurs AS k
|
||||
JOIN ort AS o ON o.id = k.ort_id
|
||||
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id
|
||||
ORDER BY k.name;";
|
||||
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute();
|
||||
return $sth->fetchAll(\PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Daten.", $e);
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,42 +2,98 @@
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<h2>Neuer Kurs</h2>
|
||||
<form method="post" class="form-grid">
|
||||
<form method="post">
|
||||
<?php
|
||||
function createInputField($label, $name, $errors, $validData, $type = 'input') {
|
||||
$errorClass = isset($errors[$name]) ? 'error' : '';
|
||||
$value = htmlspecialchars($validData[$name] ?? '');
|
||||
$errorMessage = isset($errors[$name]) ? '<p class="error">' . htmlspecialchars($errors[$name]) . '</p>' : '';
|
||||
|
||||
if($type === 'textarea') {
|
||||
return <<<HTML
|
||||
<div style="grid-column: 1 / -1;" class="input">
|
||||
<label for="{$name}">{$label}</label>
|
||||
<textarea class="{$errorClass}" name="{$name}">{$value}</textarea>
|
||||
{$errorMessage}
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
return <<<HTML
|
||||
<div class="input">
|
||||
<label for="{$name}">{$label}</label>
|
||||
<input class="{$errorClass}" type="text" name="{$name}" value="{$value}">
|
||||
{$errorMessage}
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
echo '<div style="margin-top: 32px;" class="form-grid-3">';
|
||||
foreach ($labels as $name => $label) {
|
||||
if($name === "|") {
|
||||
echo '</div>';
|
||||
echo '<div style="margin-top: 32px;" class="form-grid-3">';
|
||||
} else {
|
||||
echo createInputField($label, $name, $errors, $validData, $type = $name === 'beschreibung' ? 'textarea' : 'input');
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
?>
|
||||
<input type="hidden" name="controller" value="admin">
|
||||
<input type="hidden" name="do" value="validateForm">
|
||||
<div class="form-grid-3" style="margin-top: 16px;">
|
||||
<input style="grid-column: 3;" type="submit" name="submit" value="Absenden">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$index = 0;
|
||||
$adminModel = new \Blog\Model\AdminModel();
|
||||
$courses = $adminModel->getMyCourses();
|
||||
$doc = new DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
foreach ($labels as $key => $value) {
|
||||
$hasError = isset($errors[$key]);
|
||||
$errorClass = $hasError ? ' error' : '';
|
||||
if (!empty($courses)) {
|
||||
echo '<div class="courses-view">';
|
||||
foreach ($courses as $kurs) {
|
||||
$courseCard = $doc->createElement('div');
|
||||
$courseCard->setAttribute('class', 'course-card');
|
||||
|
||||
echo '<div class="input">';
|
||||
echo '<label for="' . $key . '">' . $value . '</label>';
|
||||
$courseImage = $doc->createElement('div');
|
||||
$courseImage->setAttribute('class', 'course-image');
|
||||
$courseCard->appendChild($courseImage);
|
||||
|
||||
if ($key == "beschreibung") {
|
||||
echo '<textarea id="' . $key . '" name="' . $key . '" class="' . $errorClass . '">';
|
||||
if (isset($validData[$key])) {
|
||||
echo $validData[$key];
|
||||
$courseContent = $doc->createElement('div');
|
||||
$courseContent->setAttribute('class', 'course-content');
|
||||
$courseCard->appendChild($courseContent);
|
||||
|
||||
$courseLeft = $doc->createElement('div');
|
||||
$courseLeft->setAttribute('class', 'course-left');
|
||||
$courseContent->appendChild($courseLeft);
|
||||
|
||||
$note = $doc->createElement('div', htmlspecialchars($kurs['note'] ?? 'Keine Bewertung') . ' ★');
|
||||
$courseLeft->appendChild($note);
|
||||
|
||||
$name = $doc->createElement('div', htmlspecialchars($kurs['name']));
|
||||
$courseLeft->appendChild($name);
|
||||
|
||||
$address = $doc->createElement('div', htmlspecialchars($kurs['strasse'] . ', ' . $kurs['stadt'] . ' ' . $kurs['plz']));
|
||||
$courseLeft->appendChild($address);
|
||||
|
||||
$courseRight = $doc->createElement('div');
|
||||
$courseRight->setAttribute('class', 'course-right');
|
||||
$courseContent->appendChild($courseRight);
|
||||
|
||||
$price = $doc->createElement('div', htmlspecialchars($kurs['preis']) . ' €');
|
||||
$courseRight->appendChild($price);
|
||||
|
||||
$category = $doc->createElement('div', htmlspecialchars($kurs['kategorie'] ?? 'Keine Kategorie'));
|
||||
$courseRight->appendChild($category);
|
||||
|
||||
echo $doc->saveHTML($courseCard);
|
||||
}
|
||||
echo '</textarea>';
|
||||
} else {
|
||||
echo '<input class="' . $errorClass . '" type="text" name="' . $key . '" value="' . (isset($validData[$key]) ? $validData[$key] : '') . '">';
|
||||
}
|
||||
|
||||
if ($hasError) {
|
||||
echo '<p class="error">' . $errors[$key] . '</p>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
$index++;
|
||||
} else {
|
||||
echo '<p>Keine Kurse gefunden.</p>';
|
||||
}
|
||||
?>
|
||||
|
||||
<input type="hidden" name="controller" value="admin">
|
||||
<input type="hidden" name="do" value="validateForm">
|
||||
<input type="submit" name="submit" value="Absenden"></form>
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@ -7,7 +7,7 @@ include dirname(__DIR__) . '/header.phtml';
|
||||
<div class="col-12">
|
||||
<h1 class="welcome-heading">KURSE & ERLEBNISSE JEDER ART</h1>
|
||||
<p class="welcome-subheading">Alle Kurse in deiner Nähe – auf einen Blick</p>
|
||||
<div class="course-grid">
|
||||
<div class="courses-view">
|
||||
<?php
|
||||
// Beispiel-Kurse
|
||||
$kurse = [
|
||||
|
@ -44,4 +44,4 @@
|
||||
</nav>
|
||||
</header>
|
||||
<!-- TODO Transparent mit Fehleranzeige bei der Anmeldung -->
|
||||
<main style="color: transparent">
|
||||
<main>
|
Loading…
x
Reference in New Issue
Block a user