kleine ui fixes
This commit is contained in:
parent
b5118a699f
commit
7ce389d179
@ -30,17 +30,17 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* === Kurs-Grid === */
|
/* === Kurs-Grid === */
|
||||||
.course-grid {
|
.courses-view {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
|
||||||
gap: 30px;
|
gap: 30px;
|
||||||
margin: 0 auto;
|
justify-content: center;
|
||||||
|
padding: 30px 0 30px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Kurs-Karte === */
|
/* === Kurs-Karte === */
|
||||||
.course-card {
|
.course-card {
|
||||||
flex: 0 0 calc(33.333% - 20px); /* Drei nebeneinander */
|
|
||||||
background: var(--brand-white);
|
background: var(--brand-white);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -48,7 +48,8 @@ body {
|
|||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-top: 30px;
|
width: 100%;
|
||||||
|
max-width: 600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Optional: Kurs-Bildbereich */
|
/* Optional: Kurs-Bildbereich */
|
||||||
@ -88,18 +89,10 @@ body {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Responsive Anpassung === */
|
|
||||||
@media screen and (max-width: 1024px) {
|
@media screen and (max-width: 1024px) {
|
||||||
.course-card {
|
|
||||||
flex: 0 0 calc(50% - 20px);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 640px) {
|
@media screen and (max-width: 640px) {
|
||||||
.course-card {
|
|
||||||
flex: 0 0 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.welcome-heading {
|
.welcome-heading {
|
||||||
font-size: 36px;
|
font-size: 36px;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
main a {
|
main a {
|
||||||
color: var(--brand-white)
|
color: var(--brand-white);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-flex {
|
.form-flex {
|
||||||
@ -12,6 +12,7 @@ main a{
|
|||||||
|
|
||||||
form label {
|
form label {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
|
color: var(--brand-white);
|
||||||
}
|
}
|
||||||
|
|
||||||
form input {
|
form input {
|
||||||
@ -20,7 +21,8 @@ form input {
|
|||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
form input, textarea {
|
form input,
|
||||||
|
textarea {
|
||||||
border: var(--border-primary);
|
border: var(--border-primary);
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
@ -49,6 +51,27 @@ form input, textarea {
|
|||||||
margin: auto;
|
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 {
|
.form-grid label {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -60,11 +83,6 @@ form input, textarea {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-grid input:last-child, div:nth-last-child(4) {
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
column-span: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
form .error {
|
form .error {
|
||||||
color: var(--error);
|
color: var(--error);
|
||||||
border-color: var(--error);
|
border-color: var(--error);
|
||||||
@ -78,20 +96,20 @@ form .error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fix radio buttons registration */
|
/* fix radio buttons registration */
|
||||||
.input:nth-child(5){
|
.radio {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
max-width: 290px;
|
max-width: 290px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input:nth-child(5) label{
|
.radio {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input:nth-child(5) label input{
|
.radio input {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
@import url(Element/button.css);
|
@import url(Element/button.css);
|
||||||
@import url(Element/card.css);
|
@import url(Element/card.css);
|
||||||
|
|
||||||
*, *:before, *:after {
|
*,
|
||||||
|
*:before,
|
||||||
|
*:after {
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -16,7 +18,7 @@
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: var(--brand-background);
|
background-color: var(--brand-background);
|
||||||
color: #666;
|
color: var(--brand-white);
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@ -48,7 +50,6 @@ main {
|
|||||||
.msg a {
|
.msg a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #09add0;
|
color: #09add0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg a:hover {
|
.msg a:hover {
|
||||||
@ -103,7 +104,7 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hover:hover {
|
.hover:hover {
|
||||||
opacity: .75;
|
opacity: 0.75;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,18 @@ class AdminController
|
|||||||
private $db;
|
private $db;
|
||||||
private $validData = array();
|
private $validData = array();
|
||||||
private $errors = 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)
|
public function __construct($view)
|
||||||
|
@ -59,4 +59,23 @@ class AdminModel extends Database
|
|||||||
|
|
||||||
return true;
|
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';
|
include dirname(__DIR__).'/header.phtml';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h2>Neuer Kurs</h2>
|
<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
|
<?php
|
||||||
$index = 0;
|
$adminModel = new \Blog\Model\AdminModel();
|
||||||
|
$courses = $adminModel->getMyCourses();
|
||||||
|
$doc = new DOMDocument('1.0', 'UTF-8');
|
||||||
|
|
||||||
foreach ($labels as $key => $value) {
|
if (!empty($courses)) {
|
||||||
$hasError = isset($errors[$key]);
|
echo '<div class="courses-view">';
|
||||||
$errorClass = $hasError ? ' error' : '';
|
foreach ($courses as $kurs) {
|
||||||
|
$courseCard = $doc->createElement('div');
|
||||||
|
$courseCard->setAttribute('class', 'course-card');
|
||||||
|
|
||||||
echo '<div class="input">';
|
$courseImage = $doc->createElement('div');
|
||||||
echo '<label for="' . $key . '">' . $value . '</label>';
|
$courseImage->setAttribute('class', 'course-image');
|
||||||
|
$courseCard->appendChild($courseImage);
|
||||||
|
|
||||||
if ($key == "beschreibung") {
|
$courseContent = $doc->createElement('div');
|
||||||
echo '<textarea id="' . $key . '" name="' . $key . '" class="' . $errorClass . '">';
|
$courseContent->setAttribute('class', 'course-content');
|
||||||
if (isset($validData[$key])) {
|
$courseCard->appendChild($courseContent);
|
||||||
echo $validData[$key];
|
|
||||||
|
$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>';
|
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'; ?>
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@ -7,7 +7,7 @@ include dirname(__DIR__) . '/header.phtml';
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h1 class="welcome-heading">KURSE & ERLEBNISSE JEDER ART</h1>
|
<h1 class="welcome-heading">KURSE & ERLEBNISSE JEDER ART</h1>
|
||||||
<p class="welcome-subheading">Alle Kurse in deiner Nähe – auf einen Blick</p>
|
<p class="welcome-subheading">Alle Kurse in deiner Nähe – auf einen Blick</p>
|
||||||
<div class="course-grid">
|
<div class="courses-view">
|
||||||
<?php
|
<?php
|
||||||
// Beispiel-Kurse
|
// Beispiel-Kurse
|
||||||
$kurse = [
|
$kurse = [
|
||||||
|
@ -44,4 +44,4 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<!-- TODO Transparent mit Fehleranzeige bei der Anmeldung -->
|
<!-- TODO Transparent mit Fehleranzeige bei der Anmeldung -->
|
||||||
<main style="color: transparent">
|
<main>
|
Loading…
x
Reference in New Issue
Block a user