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:
@@ -0,0 +1,107 @@
|
||||
<?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'])) {
|
||||
dbInsert('ideen', [
|
||||
'trip_id' => $tripId,
|
||||
'titel' => trim($_POST['titel'] ?? ''),
|
||||
'beschreibung'=> trim($_POST['beschreibung'] ?? ''),
|
||||
'link' => trim($_POST['link'] ?? ''),
|
||||
'status' => 'offen',
|
||||
'created_by' => $user['id'],
|
||||
]);
|
||||
header('Location: /Develop/PlanerGoogel/ideen.php?trip=' . $tripId); exit;
|
||||
}
|
||||
|
||||
if ($canEdit && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['status'])) {
|
||||
$statuses = ['offen', 'geplant', 'erledigt'];
|
||||
$newStatus = $_POST['status'];
|
||||
if (in_array($newStatus, $statuses)) {
|
||||
dbExec('UPDATE ideen SET status = ? WHERE id = ? AND trip_id = ?', [$newStatus, (int)$_POST['id'], $tripId]);
|
||||
}
|
||||
header('Location: /Develop/PlanerGoogel/ideen.php?trip=' . $tripId); exit;
|
||||
}
|
||||
|
||||
if ($canEdit && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete'])) {
|
||||
dbExec('DELETE FROM ideen WHERE id = ? AND trip_id = ?', [(int)$_POST['delete'], $tripId]);
|
||||
header('Location: /Develop/PlanerGoogel/ideen.php?trip=' . $tripId); exit;
|
||||
}
|
||||
|
||||
$ideen = dbAll(
|
||||
'SELECT i.*, u.name as user_name FROM ideen i
|
||||
LEFT JOIN users u ON u.id = i.created_by
|
||||
WHERE i.trip_id = ?
|
||||
ORDER BY CASE i.status WHEN "geplant" THEN 0 WHEN "offen" THEN 1 ELSE 2 END, i.id DESC',
|
||||
[$tripId]
|
||||
);
|
||||
|
||||
$statusMap = [
|
||||
'offen' => ['label' => 'Offen', 'class' => 'badge-plan', 'icon' => '💡'],
|
||||
'geplant' => ['label' => 'Geplant', 'class' => 'badge-active', 'icon' => '📅'],
|
||||
'erledigt' => ['label' => 'Erledigt', 'class' => 'badge-done', 'icon' => '✅'],
|
||||
];
|
||||
|
||||
$pageTitle = 'Ideen';
|
||||
$activeTab = 'ideen';
|
||||
include __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
|
||||
<main class="main">
|
||||
<div class="page-header">
|
||||
<h1 class="section-head">Ideen</h1>
|
||||
<?php if ($canEdit): ?>
|
||||
<button class="btn btn-primary" onclick="toggleForm('add-form')">+ Idee</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($canEdit): ?>
|
||||
<div id="add-form" class="add-form hidden">
|
||||
<form method="POST" style="display:contents;">
|
||||
<input type="text" name="titel" placeholder="Idee *" required style="min-width:200px;">
|
||||
<input type="text" name="beschreibung" placeholder="Beschreibung">
|
||||
<input type="url" name="link" placeholder="Link (optional)">
|
||||
<button type="submit" name="add" class="btn btn-primary">Hinzufügen</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (empty($ideen)): ?>
|
||||
<div class="empty"><div class="empty-icon">💡</div><p>Noch keine Ideen gesammelt.</p></div>
|
||||
<?php else: ?>
|
||||
<div class="ideen-grid">
|
||||
<?php foreach ($ideen as $ide): $s = $statusMap[$ide['status']] ?? $statusMap['offen']; ?>
|
||||
<div class="idee-card">
|
||||
<div class="idee-header">
|
||||
<span class="idee-icon"><?= $s['icon'] ?></span>
|
||||
<div class="idee-title"><?= h($ide['titel']) ?></div>
|
||||
<span class="tl-badge <?= $s['class'] ?>"><?= $s['label'] ?></span>
|
||||
</div>
|
||||
<?php if ($ide['beschreibung']): ?>
|
||||
<div class="idee-desc"><?= h($ide['beschreibung']) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($ide['link']): ?>
|
||||
<a href="<?= h($ide['link']) ?>" target="_blank" rel="noopener" class="idee-link">🔗 <?= h(parse_url($ide['link'], PHP_URL_HOST) ?: $ide['link']) ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEdit): ?>
|
||||
<div class="idee-actions">
|
||||
<?php foreach (['offen', 'geplant', 'erledigt'] as $st): if ($st === $ide['status']) continue; ?>
|
||||
<form method="POST" style="display:inline;">
|
||||
<input type="hidden" name="id" value="<?= $ide['id'] ?>">
|
||||
<button type="submit" name="status" value="<?= $st ?>" class="btn-secondary" style="font-size:.72rem;padding:4px 10px;"><?= $statusMap[$st]['label'] ?></button>
|
||||
</form>
|
||||
<?php endforeach; ?>
|
||||
<form method="POST" style="display:inline;" onsubmit="return confirm('Idee löschen?')">
|
||||
<button type="submit" name="delete" value="<?= $ide['id'] ?>" class="btn-delete">✕</button>
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<?php include __DIR__ . '/includes/footer.php'; ?>
|
||||
Reference in New Issue
Block a user