Initial Release: Lütte Planer mit Google-Login-Vorbereitung
- Login-System (Mock für Tests, Google OAuth vorbereitet) - Reisen erstellen mit Emoji, Ziel und Datum - Ablauf (Timeline), Packliste, Ideen, Notizen, Dokumente - Team-System: Personen einladen per E-Mail + Einladungslinks - Berechtigungen: Nur lesen / Bearbeiten / Admin - E-Mail-Benachrichtigungen beim Einladen Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+80
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config.php';
|
||||
$tripId = $_GET['trip'] ?? '';
|
||||
[$trip, $user] = requireTripAccess($tripId);
|
||||
$canEdit = userCanEdit($tripId, $user['id']);
|
||||
|
||||
if ($canEdit && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add'])) {
|
||||
$titel = trim($_POST['titel'] ?? '');
|
||||
if ($titel) {
|
||||
dbInsert('notizen', ['trip_id' => $tripId, 'titel' => $titel, 'inhalt' => trim($_POST['inhalt'] ?? ''), 'created_by' => $user['id']]);
|
||||
}
|
||||
header('Location: /Develop/PlanerGoogel/notizen.php?trip=' . $tripId); exit;
|
||||
}
|
||||
|
||||
if ($canEdit && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save'])) {
|
||||
dbExec('UPDATE notizen SET inhalt = ?, updated_at = ? WHERE id = ? AND trip_id = ?',
|
||||
[trim($_POST['inhalt'] ?? ''), time(), (int)$_POST['id'], $tripId]);
|
||||
header('Location: /Develop/PlanerGoogel/notizen.php?trip=' . $tripId . '#notiz-' . (int)$_POST['id']); exit;
|
||||
}
|
||||
|
||||
if ($canEdit && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete'])) {
|
||||
dbExec('DELETE FROM notizen WHERE id = ? AND trip_id = ?', [(int)$_POST['delete'], $tripId]);
|
||||
header('Location: /Develop/PlanerGoogel/notizen.php?trip=' . $tripId); exit;
|
||||
}
|
||||
|
||||
$notizen = dbAll('SELECT * FROM notizen WHERE trip_id = ? ORDER BY updated_at DESC', [$tripId]);
|
||||
|
||||
$pageTitle = 'Notizen';
|
||||
$activeTab = 'notizen';
|
||||
include __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
|
||||
<main class="main">
|
||||
<div class="page-header">
|
||||
<h1 class="section-head">Notizen</h1>
|
||||
<?php if ($canEdit): ?>
|
||||
<button class="btn btn-primary" onclick="toggleForm('add-form')">+ Notiz</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($canEdit): ?>
|
||||
<div id="add-form" class="add-form hidden">
|
||||
<form method="POST" style="display:contents;flex-direction:column;width:100%;">
|
||||
<input type="text" name="titel" placeholder="Titel *" required>
|
||||
<textarea name="inhalt" placeholder="Inhalt…" rows="3" style="flex:1;min-width:0;padding:8px 13px;background:#fff;border:1.5px solid var(--border);border-radius:7px;font-family:'Inter',sans-serif;font-size:.83rem;resize:vertical;"></textarea>
|
||||
<button type="submit" name="add" class="btn btn-primary">Erstellen</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (empty($notizen)): ?>
|
||||
<div class="empty"><div class="empty-icon">📝</div><p>Noch keine Notizen.</p></div>
|
||||
<?php else: ?>
|
||||
<div class="notizen-list">
|
||||
<?php foreach ($notizen as $n): ?>
|
||||
<div class="notiz-card" id="notiz-<?= $n['id'] ?>">
|
||||
<div class="notiz-header">
|
||||
<div class="notiz-title"><?= h($n['titel']) ?></div>
|
||||
<?php if ($canEdit): ?>
|
||||
<form method="POST" onsubmit="return confirm('Notiz löschen?')" style="display:inline;">
|
||||
<button type="submit" name="delete" value="<?= $n['id'] ?>" class="btn-delete">✕</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ($canEdit): ?>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="id" value="<?= $n['id'] ?>">
|
||||
<textarea name="inhalt" rows="6" style="width:100%;padding:10px;border:1.5px solid var(--border);border-radius:8px;font-family:'Inter',sans-serif;font-size:.85rem;resize:vertical;margin-bottom:8px;"><?= h($n['inhalt'] ?? '') ?></textarea>
|
||||
<button type="submit" name="save" class="btn btn-primary" style="font-size:.8rem;padding:6px 16px;">Speichern</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<div class="notiz-inhalt"><?= nl2br(h($n['inhalt'] ?? '')) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||
Reference in New Issue
Block a user